From b9286feac19a914f5646a1218a80156db027ed81 Mon Sep 17 00:00:00 2001 From: he wei <858544502@qq.com> Date: 星期四, 13 三月 2025 17:12:40 +0800 Subject: [PATCH] U 软件已上传的源码包 共享给未上传的 --- src/pages/resourceManage/software/list.vue | 2012 +++++++++++++++++++++++++++++++++------------------------- src/pages/resourceManage/software/apis.js | 26 src/pages/user/apis.js | 2 3 files changed, 1,167 insertions(+), 873 deletions(-) diff --git a/src/pages/resourceManage/software/apis.js b/src/pages/resourceManage/software/apis.js index 5ccba43..85c9bdf 100644 --- a/src/pages/resourceManage/software/apis.js +++ b/src/pages/resourceManage/software/apis.js @@ -136,6 +136,18 @@ } }) } +/** + * 鎸夎蒋浠惰礋璐d汉鏌ヨ 浠栫殑鏈笂浼犳簮鐮佺殑鎵�鏈夎蒋浠� 璁板綍 + */ +export const getFileNameByOwner = (owner) => { + return axios({ + method: "GET", + url: "softcode/getFileNameByOwnerWithCode", + params: { + owner + } + }) +} /** * 婧愮爜鍖呬笂浼� @@ -151,4 +163,18 @@ }, data }) +} + +/** + * 鍏变韩婧愮爜鍖� + */ +export const connectCode = (num, fileNames) => { + return axios({ + method: "POST", + url: "softcode/setCodeByFileNmaes", + data: { + num, + fileNames + } + }) } \ No newline at end of file diff --git a/src/pages/resourceManage/software/list.vue b/src/pages/resourceManage/software/list.vue index cec583a..64ae4f8 100644 --- a/src/pages/resourceManage/software/list.vue +++ b/src/pages/resourceManage/software/list.vue @@ -3,59 +3,124 @@ <div class="inner" ref="wraper"> <a-spin class="" :spinning="spinning" tip="鎷煎懡鍔犺浇涓�..."> <a-card> - <advance-table ref="table" class="doc-center-table" :data-source="dataSource" :columns="columns" title="" - :row-key="(record, index) => index" @search="onSearch" @refresh="onRefresh" @reset="onReset" - :format-conditions="true" :scroll="{ x: 2020, y }" :pagination="{ - current: pageCurr, - pageSize: pageSize, - total: total, - showSizeChanger: true, - showLessItems: true, - showQuickJumper: true, - pageSizeOptions: ['10', '20', '50', '100'], - showTotal: (total, range) => - `绗� ${range[0]}-${range[1]} 鏉★紝鎬昏 ${total} 鏉, - onChange: onPageChange, - onShowSizeChange: onSizeChange, - }" :rowClassName="rowClassFn"> + <advance-table + ref="table" + class="doc-center-table" + :data-source="dataSource" + :columns="columns" + title="" + :row-key="(record, index) => index" + @search="onSearch" + @refresh="onRefresh" + @reset="onReset" + :format-conditions="true" + :scroll="{ x: 2020, y }" + :pagination="{ + current: pageCurr, + pageSize: pageSize, + total: total, + showSizeChanger: true, + showLessItems: true, + showQuickJumper: true, + pageSizeOptions: ['10', '20', '50', '100'], + showTotal: (total, range) => + `绗� ${range[0]}-${range[1]} 鏉★紝鎬昏 ${total} 鏉, + onChange: onPageChange, + onShowSizeChange: onSizeChange, + }" + :rowClassName="rowClassFn" + > <template slot="dataIndex" slot-scope="{ index }"> {{ index + 1 }} </template> <template slot="title"> <a-space> <span class="title">杞欢涓績</span> - <a-button v-if="canUploadSoftware" type="primary" @click="showUpload">涓婁紶杞欢</a-button> + <a-button + v-if="canUploadSoftware" + type="primary" + @click="showUpload" + >涓婁紶杞欢</a-button + > </a-space> </template> <template slot="tags" slot-scope="tags"> - <a-tag :color="tags.record.codeFlag ? 'green' : 'red'">{{ tags.text }}</a-tag> + <a-tag + :color="tags.record.codeFlag ? 'green' : 'red'" + >{{ tags.text }}</a-tag + > </template> <template slot="action" slot-scope="{ record }"> <a-popover title="" trigger="hover"> <div class="" slot="content" style="width: 450px"> - <a-table size="small" :scroll="{ y: 300 }" bordered :columns="prodsColumns" :data-source="record.links" - :pagination="false" :expandRowByClick="true" :row-key="(record1, index) => index"> + <a-table + size="small" + :scroll="{ y: 300 }" + bordered + :columns="prodsColumns" + :data-source="record.links" + :pagination="false" + :expandRowByClick="true" + :row-key="(record1, index) => index" + > </a-table> </div> <a>閫傜敤鏈哄瀷</a> </a-popover> <template v-if="canDownloadSoftware"> <a-divider type="vertical"></a-divider> - <a :disabled="!!record.soft.lockFlag && !isTester" @click="download(record)">涓嬭浇</a> + <a + :disabled="!!record.soft.lockFlag && !isTester" + @click="download(record)" + >涓嬭浇</a + > <a-divider type="vertical"></a-divider> </template> <a-popover title="" trigger="hover"> <a-space class="btn-grp" direction="vertical" slot="content"> - <a-button v-if="canUploadSoftware" :disabled="!!record.soft.lockFlag" type="primary" - @click="updateDesc(record)">鏇存柊璇存槑</a-button> - <a-button v-if="record.soft.lockFlag !== -1 ? canLock : isTester" type="primary" - @click="lock(record)">{{ record.soft.lockFlag ? "瑙i攣" : "閿佸畾" }}</a-button> - <a-button v-if="canUploadSoftware" type="primary" @click="handleEmailShow(record)">閭欢閫氱煡</a-button> - <a-button type="primary" :disabled="!isTester" @click="handleConfirmDelete(record)">鍒犻櫎</a-button> - <template v-if="isCoder"> - <a-button type="primary" v-if="record.codeFlag" @click="downloadSource(record)">涓嬭浇婧愮爜</a-button> - <a-button type="primary" @click="uploadSourceClick(record)">涓婁紶婧愮爜</a-button> - </template> + <a-button + v-if="canUploadSoftware" + :disabled="!!record.soft.lockFlag" + type="primary" + @click="updateDesc(record)" + >鏇存柊璇存槑</a-button + > + <a-button + v-if="record.soft.lockFlag !== -1 ? canLock : isTester" + type="primary" + @click="lock(record)" + >{{ record.soft.lockFlag ? "瑙i攣" : "閿佸畾" }}</a-button + > + <a-button + v-if="canUploadSoftware" + type="primary" + @click="handleEmailShow(record)" + >閭欢閫氱煡</a-button + > + <a-button + type="primary" + :disabled="!isTester" + @click="handleConfirmDelete(record)" + >鍒犻櫎</a-button + > + <a-button + type="primary" + v-if="isCoderDown && record.codeFlag" + @click="downloadSource(record)" + >涓嬭浇婧愮爜</a-button + > + <a-button + type="primary" + v-if="isCoderUp && record.soft.owner == user.name && record.codeFlag" + @click="connectSource(record)" + >鍏变韩婧愮爜</a-button + > + <a-button + type="primary" + v-if="isCoderUp && record.soft.owner == user.name" + @click="uploadSourceClick(record)" + >涓婁紶婧愮爜</a-button + > </a-space> <a>鏇村</a> </a-popover> @@ -65,22 +130,39 @@ </a-spin> </div> <!-- 涓婁紶杞欢 --> - <a-modal :visible="uploadShow" :footer="null" :width="760" :title="onlyXls ? '鏇存柊鍙戝竷璇存槑' : '涓婁紶杞欢'" :destroyOnClose="true" - :maskClosable="false" @cancel="uploadCancel"> + <a-modal + :visible="uploadShow" + :footer="null" + :width="760" + :title="onlyXls ? '鏇存柊鍙戝竷璇存槑' : '涓婁紶杞欢'" + :destroyOnClose="true" + :maskClosable="false" + @cancel="uploadCancel" + > <div class=""> <template v-if="!onlyXls"> <a-row type="flex" class="row"> <a-col flex="6em" class="label">鏇存柊鏃堕棿</a-col> <a-col :flex="1"> - <a-date-picker format="YYYY-MM-DD HH:mm:ss" valueFormat="YYYY-MM-DD HH:mm:ss" :allowClear="false" - :disabled-date="disabledDate" :show-time="{ defaultValue: moment('00:00:00', 'HH:mm:ss') }" - v-model="versionTime" /> + <a-date-picker + format="YYYY-MM-DD HH:mm:ss" + valueFormat="YYYY-MM-DD HH:mm:ss" + :allowClear="false" + :disabled-date="disabledDate" + :show-time="{ defaultValue: moment('00:00:00', 'HH:mm:ss') }" + v-model="versionTime" + /> </a-col> </a-row> <a-row type="flex" class="row"> <a-col flex="6em" class="label">杞欢鍖�</a-col> <a-col :flex="1"> - <a-upload class="upload" :before-upload="beforeUpload" @change="uploadChange" accept=".zip,.rar"> + <a-upload + class="upload" + :before-upload="beforeUpload" + @change="uploadChange" + accept=".zip,.rar" + > <a-button type="primary">閫夋嫨杞欢</a-button> </a-upload> </a-col> @@ -89,7 +171,12 @@ <a-row type="flex" class="row"> <a-col flex="6em" class="label">杞欢璇存槑</a-col> <a-col :flex="1"> - <a-upload class="upload" :before-upload="beforeUpload" @change="uploadChange1" accept=".xls,.xlsx"> + <a-upload + class="upload" + :before-upload="beforeUpload" + @change="uploadChange1" + accept=".xls,.xlsx" + > <a-button type="primary">璇存槑鏂囦欢</a-button> </a-upload> </a-col> @@ -107,34 +194,81 @@ </div> </div> </a-modal> - <pop :visible.sync="popVisible" :x="popPosition.x" :y="popPosition.y" :info="popInfo" :position="popPosition.dir"> + <pop + :visible.sync="popVisible" + :x="popPosition.x" + :y="popPosition.y" + :info="popInfo" + :position="popPosition.dir" + > </pop> <!-- 鎿嶄綔鍘熷洜 --> - <a-modal :visible="reasonVisible" :width="460" title="鎿嶄綔鍘熷洜" :destroyOnClose="true" :maskClosable="false" - @cancel="reasonCancel" @ok="reasonOk"> + <a-modal + :visible="reasonVisible" + :width="460" + title="鎿嶄綔鍘熷洜" + :destroyOnClose="true" + :maskClosable="false" + @cancel="reasonCancel" + @ok="reasonOk" + > <a-form-model-item ref="name" label="鎿嶄綔鍘熷洜"> - <a-input type="textarea" v-model="reason" placeHolder="璇疯緭鍏ユ搷浣滃師鍥�" /> + <a-input + type="textarea" + v-model="reason" + placeHolder="璇疯緭鍏ユ搷浣滃師鍥�" + /> </a-form-model-item> </a-modal> - + <!-- 涓婁紶杞欢 --> - <a-modal :visible="emailShow" :footer="null" :width="760" title="閭欢鍙戦��" :destroyOnClose="true" :maskClosable="false" - @cancel="emailCancel"> - <email-card :visible.sync="emailShow" :users="userList" :title="emailInfo.title" :content="emailInfo.content" - v-if="emailShow"></email-card> + <a-modal + :visible="emailShow" + :footer="null" + :width="760" + title="閭欢鍙戦��" + :destroyOnClose="true" + :maskClosable="false" + @cancel="emailCancel" + > + <email-card + :visible.sync="emailShow" + :users="userList" + :title="emailInfo.title" + :content="emailInfo.content" + v-if="emailShow" + ></email-card> </a-modal> - + <!-- 涓婁紶婧愮爜鍖� --> - <a-modal :visible="uploadSourceShow" :footer="null" :width="760" title="涓婁紶杞欢婧愮爜鍖�" :destroyOnClose="true" - :maskClosable="false" @cancel="uploadSourceCancel"> + <a-modal + :visible="uploadSourceShow" + :footer="null" + :width="760" + title="涓婁紶杞欢婧愮爜鍖�" + :destroyOnClose="true" + :maskClosable="false" + @cancel="uploadSourceCancel" + > <div class=""> <template> <a-row type="flex" class="row"> <a-col flex="6em" class="label">瀵瑰簲杞欢</a-col> <a-col :flex="1"> - <a-select mode="multiple" placeholder="璇烽�夋嫨瀵瑰簲鐨勮蒋浠�" show-search v-model="names" style="width: 36em;"> - <a-select-option v-for="(item, idx) in otherSoftList" :key="'soft_' + idx" :value="item.fileName"> - {{ item.fileName }} <span class="version">({{ item.version }})</span> + <a-select + mode="multiple" + placeholder="璇烽�夋嫨瀵瑰簲鐨勮蒋浠�" + show-search + v-model="names" + style="width: 36em;" + > + <a-select-option + v-for="(item, idx) in otherSoftList" + :key="'soft_' + idx" + :value="item.fileName" + > + {{ item.fileName }} + <span class="version">({{ item.version }})</span> </a-select-option> </a-select> </a-col> @@ -142,16 +276,63 @@ <a-row type="flex" class="row"> <a-col flex="6em" class="label">杞欢婧愮爜鍖�</a-col> <a-col :flex="1"> - <a-upload class="upload" :before-upload="beforeUpload" @change="sourceUploadChange" accept=".zip,.rar"> + <a-upload + class="upload" + :before-upload="beforeUpload" + @change="sourceUploadChange" + accept=".zip,.rar" + > <a-button type="primary">閫夋嫨杞欢</a-button> </a-upload> </a-col> </a-row> </template> - + <div class="modal-footer"> <a-button type="danger" @click="uploadSourceCancel"> 鍙栨秷 </a-button> <a-button type="primary" @click="uploadSource"> 鎻愪氦 </a-button> + </div> + </div> + </a-modal> + + <!-- 鍏变韩婧愮爜鍖� --> + <a-modal + :visible="connectSourceShow" + :footer="null" + :width="760" + title="鍏变韩杞欢婧愮爜鍖�" + :destroyOnClose="true" + :maskClosable="false" + @cancel="connectSourceCancel" + > + <div class=""> + <template> + <a-row type="flex" class="row"> + <a-col flex="10em" class="label">瑕佸叡浜婧愮爜鐨勮蒋浠�</a-col> + <a-col :flex="1"> + <a-select + mode="multiple" + placeholder="璇烽�夋嫨瀵瑰簲鐨勮蒋浠�" + show-search + v-model="fileNames" + style="width: 36em;" + > + <a-select-option + v-for="(item, idx) in otherSoftList" + :key="'soft_' + idx" + :value="item.fileName" + > + {{ item.fileName }} + <span class="version">({{ item.version }})</span> + </a-select-option> + </a-select> + </a-col> + </a-row> + </template> + + <div class="modal-footer"> + <a-button type="danger" @click="connectSourceCancel"> 鍙栨秷 </a-button> + <a-button type="primary" @click="connectSourceSubmit"> 鎻愪氦 </a-button> </div> </div> </a-modal> @@ -159,869 +340,954 @@ </template> <script> - import AdvanceTable from "@/components/table/advance/AdvanceTable"; - import checkPermit from "@/assets/js/tools/checkPermit"; - import PERMITS from "@/assets/js/const/const_permits"; - import DescRes from "./descRes"; - import Pop from "./pop"; - import offset from "@/assets/js/tools/offset"; - import moment from "moment"; - import { getUserList } from "../../permission/apis"; +import AdvanceTable from "@/components/table/advance/AdvanceTable"; +import checkPermit from "@/assets/js/tools/checkPermit"; +import PERMITS from "@/assets/js/const/const_permits"; +import DescRes from "./descRes"; +import Pop from "./pop"; +import offset from "@/assets/js/tools/offset"; +import moment from "moment"; +import { getUserList } from "../../permission/apis"; - import { message, Modal } from "ant-design-vue"; +import { message, Modal } from "ant-design-vue"; - import { - getList, - downLoadSoftware, - excelParse, - productSoftwareSubmit, - applyModel, - updateSoftwareLock, - deleteSoftwareApi, - downLoadCode, - getFileNameByCreateTime, - uploadCode, - } from "./apis"; - import { mapGetters } from "vuex"; - import EmailCard from "../../components/emailCard"; - import { - searchDefaultMailUser, - sendMail, - } from "../../components/emailCard/apis"; +import { + getList, + downLoadSoftware, + excelParse, + productSoftwareSubmit, + applyModel, + updateSoftwareLock, + deleteSoftwareApi, + downLoadCode, + getFileNameByCreateTime, + uploadCode, + connectCode, + getFileNameByOwner, +} from "./apis"; +import { mapGetters } from "vuex"; +import EmailCard from "../../components/emailCard"; +import { + searchDefaultMailUser, + sendMail, +} from "../../components/emailCard/apis"; - import { getRoleUser } from "@/pages/user/apis"; - // TODO - // const tester = ["鏉庢鍗�"]; +import { getRoleUser } from "@/pages/user/apis"; +// TODO +// const tester = ["鏉庢鍗�"]; - export default { - name: "", - data() { - return { - mailList: [], - tester: [], - versionTime: moment().format("YYYY-MM-DD HH:mm:ss"), - reasonVisible: false, - reason: "", - currentObj: null, - popVisible: false, - uploadSourceShow: false, - names: [], - otherSoftList: [], - popPosition: { - x: 0, - y: 0, - dir: "bottom", +export default { + name: "", + data() { + return { + connectSourceShow: false, + fileNames: [], + mailList: [], + tester: [], + coderDown: [], + coderUp: [], + versionTime: moment().format("YYYY-MM-DD HH:mm:ss"), + reasonVisible: false, + reason: "", + currentObj: null, + popVisible: false, + uploadSourceShow: false, + names: [], + otherSoftList: [], + popPosition: { + x: 0, + y: 0, + dir: "bottom", + }, + popInfo: [], + onlyXls: false, + resData: [], + file: null, + file1: null, + sourceFile: null, + uploadShow: false, + spinning: false, + loading: false, + pageCurr: 1, + pageSize: 10, + total: 0, + y: 400, + update: -1, + conditions: {}, + columns: [ + { + fixed: "left", + title: "搴忓彿", + dataIndex: "dataIndex", + key: "dataIndex", + align: "center", + width: 60, + noSearch: true, + scopedSlots: { customRender: "dataIndex" }, }, - popInfo: [], - onlyXls: false, - resData: [], - file: null, - file1: null, - sourceFile: null, - uploadShow: false, - spinning: false, - loading: false, - pageCurr: 1, - pageSize: 10, - total: 0, - y: 400, - update: -1, - conditions: {}, - columns: [ - { - fixed: "left", - title: "搴忓彿", - dataIndex: "dataIndex", - key: "dataIndex", - align: "center", - width: 60, - noSearch: true, - scopedSlots: { customRender: "dataIndex" }, + { + title: "鐘舵��", + dataIndex: "soft.lockFlag", + dataType: "select", + align: "center", + width: 140, + visible: false, + searchAble: true, + noSearch: true, + search: { + default: 0, + selectOptions: [ + { + title: "鍏ㄩ儴", + value: 11, + }, + { + title: "鍙敤", + value: 0, + }, + { + title: "涓嶅彲鐢�", + value: 12, + }, + { + title: "寰呮祴璇�", + value: -1, + }, + ], }, - { - title: "鐘舵��", - dataIndex: "soft.lockFlag", - dataType: "select", - align: "center", - width: 140, - visible: false, - searchAble: true, - noSearch: true, - search: { - default: 0, - selectOptions: [ - { - title: "鍏ㄩ儴", - value: 11, - }, - { - title: "鍙敤", - value: 0, - }, - { - title: "涓嶅彲鐢�", - value: 12, - }, - { - title: "寰呮祴璇�", - value: -1, - }, - ], - }, - // customCell: this.customCell, - }, - { - title: "鍚嶇О", - dataIndex: "soft.fileName", - align: "center", - searchAble: true, - customCell: this.customCell, - }, - { - title: "涓婁紶鏃ユ湡", - dataIndex: "soft.createTime", - align: "center", - noSearch: true, - customCell: this.customCell, - }, - { - title: "鏄惁宸蹭笂浼犳簮鐮�", - dataIndex: "codeFlagStr", - align: "center", - noSearch: true, - customCell: this.customCell, - scopedSlots: { customRender: 'tags' }, - }, - { - title: "婧愮爜鍖呭悕绉�", - dataIndex: "codeName", - align: "center", - width: 180, - noSearch: true, - customCell: this.customCell, - }, - { - title: "绫诲瀷", - dataIndex: "soft.type", - align: "center", - width: 180, - noSearch: true, - customCell: this.customCell, - }, - { - title: "鐗堟湰", - dataIndex: "soft.version", - align: "center", - searchAble: true, - customCell: this.customCell, - }, - { - title: "璐熻矗浜�", - dataIndex: "soft.owner", - align: "center", - searchAble: true, - width: 160, - customCell: this.customCell, - }, - { - title: "閫傜敤鏈哄瀷鍙�", - dataIndex: "applyModel", - align: "center", - searchAble: true, - visible: false, - }, - { - title: "閫傜敤鏈烘枡鍙�", - dataIndex: "applyMaterialCode", - align: "center", - searchAble: true, - visible: false, - }, - { - title: "鏉垮彿", - dataIndex: "soft.boardNumber", - align: "center", - searchAble: true, - customCell: this.customCell, - }, - { - title: "鍗囩骇璇存槑", - dataIndex: "soft.releaseNotes", - align: "center", - noSearch: true, - customCell: this.customCell, - }, - { - title: "鏈�鍚庝竴娆℃搷浣滃師鍥�", - dataIndex: "soft.localReason", - align: "center", - noSearch: true, - customCell: this.customCell, - }, - { - title: "鎿嶄綔", - dataIndex: "operation", - align: "center", - width: 228, - fixed: "right", - scopedSlots: { customRender: "action" }, - noSearch: true, - }, - ], - dataSource: [], - prodsColumns: [ - { - title: "鍨嬪彿", - dataIndex: "applyModel", - align: "center", - searchAble: true, - }, - { - title: "鏂欏彿", - dataIndex: "applyMaterialCode", - align: "center", - width: 180, - noSearch: true, - }, - ], - emailShow: false, - emailInfo: { - title: "", - content: "", + // customCell: this.customCell, }, - userList: [], - }; + { + title: "鍚嶇О", + dataIndex: "soft.fileName", + align: "center", + searchAble: true, + customCell: this.customCell, + }, + { + title: "涓婁紶鏃ユ湡", + dataIndex: "soft.createTime", + align: "center", + noSearch: true, + customCell: this.customCell, + }, + { + title: "鏄惁宸蹭笂浼犳簮鐮�", + dataIndex: "codeFlagStr", + align: "center", + noSearch: true, + customCell: this.customCell, + scopedSlots: { customRender: 'tags' }, + }, + { + title: "婧愮爜鍖呭悕绉�", + dataIndex: "codeName", + align: "center", + width: 180, + noSearch: true, + customCell: this.customCell, + }, + { + title: "绫诲瀷", + dataIndex: "soft.type", + align: "center", + width: 180, + noSearch: true, + customCell: this.customCell, + }, + { + title: "鐗堟湰", + dataIndex: "soft.version", + align: "center", + searchAble: true, + customCell: this.customCell, + }, + { + title: "璐熻矗浜�", + dataIndex: "soft.owner", + align: "center", + searchAble: true, + width: 160, + customCell: this.customCell, + }, + { + title: "閫傜敤鏈哄瀷鍙�", + dataIndex: "applyModel", + align: "center", + searchAble: true, + visible: false, + }, + { + title: "閫傜敤鏈烘枡鍙�", + dataIndex: "applyMaterialCode", + align: "center", + searchAble: true, + visible: false, + }, + { + title: "鏉垮彿", + dataIndex: "soft.boardNumber", + align: "center", + searchAble: true, + customCell: this.customCell, + }, + { + title: "鍗囩骇璇存槑", + dataIndex: "soft.releaseNotes", + align: "center", + noSearch: true, + customCell: this.customCell, + }, + { + title: "鏈�鍚庝竴娆℃搷浣滃師鍥�", + dataIndex: "soft.localReason", + align: "center", + noSearch: true, + customCell: this.customCell, + }, + { + title: "鎿嶄綔", + dataIndex: "operation", + align: "center", + width: 228, + fixed: "right", + scopedSlots: { customRender: "action" }, + noSearch: true, + }, + ], + dataSource: [], + prodsColumns: [ + { + title: "鍨嬪彿", + dataIndex: "applyModel", + align: "center", + searchAble: true, + }, + { + title: "鏂欏彿", + dataIndex: "applyMaterialCode", + align: "center", + width: 180, + noSearch: true, + }, + ], + emailShow: false, + emailInfo: { + title: "", + content: "", + }, + userList: [], + }; + }, + components: { + EmailCard, + AdvanceTable, + DescRes, + Pop, + }, + methods: { + moment, + rowClassFn(record) { + let classList = []; + if (record.soft.lockFlag == -1) { + classList.push("locked"); + } + return classList; }, - components: { - EmailCard, - AdvanceTable, - DescRes, - Pop, + disabledDate(current) { + // Can not select days before today and today + return current > moment().endOf("day"); }, - methods: { - moment, - rowClassFn(record) { - let classList = []; - if (record.soft.lockFlag == -1) { - classList.push("locked"); + onSearch(conditions, searchOptions) { + // console.log(conditions); + // console.log(searchOptions, "options"); + this.pageCurr = 1; + this.conditions = conditions; + this.searchData(); + }, + onPageChange(page, pageSize) { + this.pageCurr = page; + this.pageSize = pageSize; + this.searchData(); + }, + onSizeChange(current, size) { + this.pageCurr = 1; + this.pageSize = size; + this.searchData(); + }, + onRefresh(conditions) { + this.conditions = conditions; + this.searchData(); + }, + onReset(conditions) { + // console.log(conditions, "reset"); + this.conditions = conditions; + this.searchData(); + }, + searchData() { + const { pageCurr, pageSize, conditions } = this; + let params = {}; + if (undefined == conditions["soft.lockFlag"]) { + conditions["soft.lockFlag"] = 11; + } + Object.keys(conditions).forEach((v) => { + switch (v) { + case "soft.lockFlag": + params["lockFlag"] = conditions[v]; + break; + case "soft.fileName": + params["fileName"] = conditions[v]; + break; + case "soft.owner": + params["owner"] = conditions[v]; + break; + case "soft.boardNumber": + params["boardNumber"] = conditions[v]; + break; + case "soft.version": + params["version"] = conditions[v]; + break; + default: + params[v] = conditions[v]; + break; } - return classList; - }, - disabledDate(current) { - // Can not select days before today and today - return current > moment().endOf("day"); - }, - onSearch(conditions, searchOptions) { - // console.log(conditions); - // console.log(searchOptions, "options"); - this.pageCurr = 1; - this.conditions = conditions; - this.searchData(); - }, - onPageChange(page, pageSize) { - this.pageCurr = page; - this.pageSize = pageSize; - this.searchData(); - }, - onSizeChange(current, size) { - this.pageCurr = 1; - this.pageSize = size; - this.searchData(); - }, - onRefresh(conditions) { - this.conditions = conditions; - this.searchData(); - }, - onReset(conditions) { - // console.log(conditions, "reset"); - this.conditions = conditions; - this.searchData(); - }, - searchData() { - const { pageCurr, pageSize, conditions } = this; - let params = {}; - if (undefined == conditions["soft.lockFlag"]) { - conditions["soft.lockFlag"] = 11; + }); + getList(pageCurr, pageSize, params).then((res) => { + res = res.data; + // console.log(res); + let data = []; + let total = 0; + if (res.code && res.data) { + data = res.data2.list.map((v) => { + let soft = v.softwares[0]; + return { + ...v, + id: soft.id, + fileName: v.fileName, + codeFlag: v.codeFlag, + codeName: v.codeName || '--', + codeFlagStr: v.codeFlag ? '宸蹭笂浼犳簮鐮�' : '鏈笂浼犳簮鐮�', + soft, + links: v.softwares, + }; + }); + total = res.data2.total; } - Object.keys(conditions).forEach((v) => { - switch (v) { - case "soft.lockFlag": - params["lockFlag"] = conditions[v]; - break; - case "soft.fileName": - params["fileName"] = conditions[v]; - break; - case "soft.owner": - params["owner"] = conditions[v]; - break; - case "soft.boardNumber": - params["boardNumber"] = conditions[v]; - break; - case "soft.version": - params["version"] = conditions[v]; - break; - default: - params[v] = conditions[v]; - break; - } - }); - getList(pageCurr, pageSize, params).then((res) => { - res = res.data; - // console.log(res); - let data = []; - let total = 0; - if (res.code && res.data) { - data = res.data2.list.map((v) => { - let soft = v.softwares[0]; - return { - id: soft.id, - fileName: v.fileName, - codeFlag: v.codeFlag, - codeName: v.codeName || '--', - codeFlagStr: v.codeFlag ? '宸蹭笂浼犳簮鐮�' : '鏈笂浼犳簮鐮�', - soft, - links: v.softwares, - }; - }); - total = res.data2.total; - } - this.dataSource = data; - this.total = total; - if (-1 == this.update) { - this.update = Math.random(); - } - }); - }, - download(obj) { - const { id } = obj; - let loading = this.$layer.loading(); - downLoadSoftware(id).then((res) => { - // console.log(res, "==========="); - let { headers, data, status } = res; - if (200 == status && data) { - let url = window.URL.createObjectURL(data); - const matchRes = /filename=(.*)/.exec(headers["content-disposition"]); - const fileName = matchRes - ? decodeURI(matchRes[1].trim()) - : "鏈煡鏂囦欢鍚�.zip"; - let link = document.createElement("a"); - link.style.display = "none"; - link.href = url; - link.download = fileName; - document.body.appendChild(link); - link.click(); - this.$layer.close(loading); - document.body.removeChild(link); - window.URL.revokeObjectURL(url); - } else { - this.$layer.close(loading); - this.$message.error("鎿嶄綔澶辫触"); - } - }); - }, - resize() { - setTimeout(() => { + this.dataSource = data; + this.total = total; + if (-1 == this.update) { this.update = Math.random(); - }, 200); - }, - activeFN() { - this.resize(); - }, - showUpload() { + } + }); + }, + download(obj) { + const { id } = obj; + let loading = this.$layer.loading(); + downLoadSoftware(id).then((res) => { + // console.log(res, "==========="); + let { headers, data, status } = res; + if (200 == status && data) { + let url = window.URL.createObjectURL(data); + const matchRes = /filename=(.*)/.exec(headers["content-disposition"]); + const fileName = matchRes + ? decodeURI(matchRes[1].trim()) + : "鏈煡鏂囦欢鍚�.zip"; + let link = document.createElement("a"); + link.style.display = "none"; + link.href = url; + link.download = fileName; + document.body.appendChild(link); + link.click(); + this.$layer.close(loading); + document.body.removeChild(link); + window.URL.revokeObjectURL(url); + } else { + this.$layer.close(loading); + this.$message.error("鎿嶄綔澶辫触"); + } + }); + }, + resize() { + setTimeout(() => { + this.update = Math.random(); + }, 200); + }, + activeFN() { + this.resize(); + }, + showUpload() { + this.file = null; + this.file1 = null; + this.resData = []; + this.onlyXls = false; + this.versionTime = moment().format("YYYY-MM-DD HH:mm:ss"); + this.uploadShow = true; + }, + updateDesc() { + this.file = null; + this.file1 = null; + this.resData = []; + this.onlyXls = true; + this.uploadShow = true; + }, + beforeUpload() { + return false; + }, + uploadChange(data) { + const { file, fileList } = data; + if (fileList.length > 1) { + fileList.shift(); + } + if (fileList.length) { + this.file = fileList[0].originFileObj; + } else { this.file = null; + } + }, + uploadChange1(data) { + const { file, fileList } = data; + if (fileList.length > 1) { + fileList.shift(); + } + if (fileList.length) { + this.file1 = fileList[0].originFileObj; + } else { this.file1 = null; this.resData = []; - this.onlyXls = false; - this.versionTime = moment().format("YYYY-MM-DD HH:mm:ss"); - this.uploadShow = true; - }, - updateDesc() { - this.file = null; - this.file1 = null; - this.resData = []; - this.onlyXls = true; - this.uploadShow = true; - }, - beforeUpload() { return false; - }, - uploadChange(data) { - const { file, fileList } = data; - if (fileList.length > 1) { - fileList.shift(); - } - if (fileList.length) { - this.file = fileList[0].originFileObj; + } + const formData = new FormData(); + formData.append("multipartFile", this.file1); + excelParse(formData).then((res) => { + const { code, data, data2, msg } = res.data; + let list = []; + if (code && data) { + list = data2; + this.$message.success(msg); } else { - this.file = null; + this.$message.error("瑙f瀽澶辫触"); } - }, - uploadChange1(data) { - const { file, fileList } = data; - if (fileList.length > 1) { - fileList.shift(); - } - if (fileList.length) { - this.file1 = fileList[0].originFileObj; - } else { - this.file1 = null; - this.resData = []; - return false; - } - const formData = new FormData(); - formData.append("multipartFile", this.file1); - excelParse(formData).then((res) => { - const { code, data, data2, msg } = res.data; - let list = []; - if (code && data) { - list = data2; + this.resData = list; + }); + }, + uploadCancel() { + this.uploadShow = false; + }, + uploadSoftware() { + if (!this.file) { + this.$message.error("璇烽�夋嫨瑕佷笂浼犵殑杞欢鍖�"); + return false; + } + if (!this.file1) { + this.$message.error("璇烽�夋嫨杞欢璇存槑鏂囦欢"); + return false; + } + if (!this.resData.length) { + this.$message.error("杞欢璇存槑鏂囦欢瑙f瀽寮傚父"); + return false; + } + let info = this.resData[0]; + if (!info.boardNumber || !info.type) { + this.$error({ + title: "绯荤粺鎻愮ず", + content: "缂哄皯鏉垮彿鎴栬蒋浠剁被鍨嬶紝璇疯緭鍏ユ澘鍙峰拰杞欢绫诲瀷", + }); + return false; + } + let loading = this.$layer.loading(); + + const formData = new FormData(); + formData.append("file1", this.file); + formData.append("file2", this.file1); + formData.append("fontUpdateTime", this.versionTime); + formData.append("softwareStr", JSON.stringify(this.resData)); + productSoftwareSubmit(formData) + .then((res) => { + let { code, data, msg } = res.data; + if (code) { + this.uploadShow = false; this.$message.success(msg); + this.searchData(); + } else { + this.$message.error(msg); + } + this.$layer.close(loading); + }) + .catch((error) => { + this.$layer.close(loading); + console.log(error); + }); + }, + applyModel() { + if (!this.file1) { + this.$message.error("璇烽�夋嫨杞欢璇存槑鏂囦欢"); + return false; + } + if (!this.resData.length) { + this.$message.error("杞欢璇存槑鏂囦欢瑙f瀽寮傚父"); + return false; + } + let loading = this.$layer.loading(); + + const formData = new FormData(); + formData.append("multipartFile", this.file1); + formData.append("softwareStr", JSON.stringify(this.resData)); + applyModel(formData) + .then((res) => { + let { code, data, msg } = res.data; + if (code) { + this.uploadShow = false; + this.$message.success(msg); + this.searchData(); } else { this.$message.error("瑙f瀽澶辫触"); } - this.resData = list; + this.$layer.close(loading); + }) + .catch((error) => { + this.$layer.close(loading); + console.log(error); }); - }, - uploadCancel() { - this.uploadShow = false; - }, - uploadSoftware() { - if (!this.file) { - this.$message.error("璇烽�夋嫨瑕佷笂浼犵殑杞欢鍖�"); - return false; - } - if (!this.file1) { - this.$message.error("璇烽�夋嫨杞欢璇存槑鏂囦欢"); - return false; - } - if (!this.resData.length) { - this.$message.error("杞欢璇存槑鏂囦欢瑙f瀽寮傚父"); - return false; - } - let info = this.resData[0]; - if (!info.boardNumber || !info.type) { - this.$error({ - title: "绯荤粺鎻愮ず", - content: "缂哄皯鏉垮彿鎴栬蒋浠剁被鍨嬶紝璇疯緭鍏ユ澘鍙峰拰杞欢绫诲瀷", - }); - return false; - } - let loading = this.$layer.loading(); - - const formData = new FormData(); - formData.append("file1", this.file); - formData.append("file2", this.file1); - formData.append("fontUpdateTime", this.versionTime); - formData.append("softwareStr", JSON.stringify(this.resData)); - productSoftwareSubmit(formData) - .then((res) => { - let { code, data, msg } = res.data; - if (code) { - this.uploadShow = false; - this.$message.success(msg); - this.searchData(); - } else { - this.$message.error(msg); - } - this.$layer.close(loading); - }) - .catch((error) => { - this.$layer.close(loading); - console.log(error); - }); - }, - applyModel() { - if (!this.file1) { - this.$message.error("璇烽�夋嫨杞欢璇存槑鏂囦欢"); - return false; - } - if (!this.resData.length) { - this.$message.error("杞欢璇存槑鏂囦欢瑙f瀽寮傚父"); - return false; - } - let loading = this.$layer.loading(); - - const formData = new FormData(); - formData.append("multipartFile", this.file1); - formData.append("softwareStr", JSON.stringify(this.resData)); - applyModel(formData) - .then((res) => { - let { code, data, msg } = res.data; - if (code) { - this.uploadShow = false; - this.$message.success(msg); - this.searchData(); - } else { - this.$message.error("瑙f瀽澶辫触"); - } - this.$layer.close(loading); - }) - .catch((error) => { - this.$layer.close(loading); - console.log(error); - }); - }, - cellMouseenter(e, obj) { - // console.log("enter", e, obj); - const wraper = this.$refs.wraper; - const { clientHeight, clientWidth } = wraper; - const { target, clientX, clientY } = e; - let { left: x, top: y } = offset(wraper); - x = clientX - x; - y = clientY - y; - // 濡傛灉clientHeight 灏忎簬380 * 2 鍒欏乏鍙冲竷灞� - let dir = "bottom"; - if (clientHeight < 380 * 2) { - if (x + 420 + 18 > clientWidth) { - dir = "left"; - } else { - dir = "right"; - } - if (y < 180) { - y = 180; - } else if (y > clientHeight - 378) { - y = clientHeight / 2; - } + }, + cellMouseenter(e, obj) { + // console.log("enter", e, obj); + const wraper = this.$refs.wraper; + const { clientHeight, clientWidth } = wraper; + const { target, clientX, clientY } = e; + let { left: x, top: y } = offset(wraper); + x = clientX - x; + y = clientY - y; + // 濡傛灉clientHeight 灏忎簬380 * 2 鍒欏乏鍙冲竷灞� + let dir = "bottom"; + if (clientHeight < 380 * 2) { + if (x + 420 + 18 > clientWidth) { + dir = "left"; } else { - if (y + 18 + 360 > clientHeight) { - // y = clientHeight - 378; - dir = "top"; - } else { - dir = "bottom"; - } - if (x < 300) { - x = 300; - } - if (x + 300 > clientWidth) { - x = clientWidth - 300; - } + dir = "right"; } - this.popPosition.x = x; - this.popPosition.y = y; - this.popPosition.dir = dir; - this.popInfo = obj.links; - this.popVisible = true; - }, - cellMouseleave(e, obj) { - // console.log("leave", obj); - this.popVisible = false; - }, - customCell(record) { + if (y < 180) { + y = 180; + } else if (y > clientHeight - 378) { + y = clientHeight / 2; + } + } else { + if (y + 18 + 360 > clientHeight) { + // y = clientHeight - 378; + dir = "top"; + } else { + dir = "bottom"; + } + if (x < 300) { + x = 300; + } + if (x + 300 > clientWidth) { + x = clientWidth - 300; + } + } + this.popPosition.x = x; + this.popPosition.y = y; + this.popPosition.dir = dir; + this.popInfo = obj.links; + this.popVisible = true; + }, + cellMouseleave(e, obj) { + // console.log("leave", obj); + this.popVisible = false; + }, + customCell(record) { + return { + on: { + mouseenter: (e) => this.cellMouseenter(e, record), + mouseleave: (e) => this.cellMouseleave(e, record), + }, + }; + }, + reasonCancel() { + this.reasonVisible = false; + }, + reasonOk() { + let { + soft: { fileUrl, lockFlag }, + } = this.currentObj; + // 澶氫紶涓�涓綋鍓嶇姸鎬� + let lockFlagNow = lockFlag; + lockFlag = !lockFlag * 1; + let params = { + fileUrl, + localReason: this.reason, + lockFlag, + lockFlagNow, + }; + updateSoftwareLock(params).then((res) => { + const { code, data } = res.data; + if (code && data) { + this.$message.success("鎿嶄綔鎴愬姛"); + this.reasonVisible = false; + // 濡傛灉鏄祴璇曚汉鍛樿В閿佺‘璁� 鍒欒嚜鍔ㄥ彂閫侀偖浠� + if (lockFlagNow == -1 && this.isTester) { + this.sendEmail(); + } + this.searchData(); + } else { + this.$message.error("鎿嶄綔澶辫触"); + } + }); + }, + sendEmail() { + let { title, content } = this.handleEmailShow(this.currentObj, true); + let params = { mailList: this.mailList, title, content }; + sendMail(params); + }, + lock(record) { + this.reason = ""; + this.currentObj = record; + this.reasonVisible = true; + }, + handleEmailShow(record, get) { + this.emailInfo.title = + "[杞欢鍙戝竷璁板綍]" + + record.soft.fileName + + " 鐗堟湰鍙凤細" + + record.soft.version; + let { soft, links } = record; + let content = []; + content.push("杞欢鍩烘湰淇℃伅"); + content.push("鏂囦欢鍚嶇О: " + soft.fileName); + content.push("鏉垮彿: " + soft.boardNumber); + content.push("杞欢绫诲瀷: " + soft.type); + content.push("杞欢鐗堟湰: " + soft.version); + content.push("杞欢鍩轰簬鐗堟湰: " + soft.basedVersion); + content.push("杞欢璐熻矗浜�: " + soft.owner); + content.push("褰掓。鏃ユ湡: " + soft.filingDate); + content.push("杞欢绫诲瀷: " + soft.type); + content.push("杞欢閫傜敤鏈哄瀷"); + links.forEach((v) => { + content.push( + "鐗╂枡缂栫爜: " + v.applyMaterialCode + " 瑙勬牸鍨嬪彿: " + v.applyModel + ); + }); + content.push("鍙戝竷璇存槑: " + soft.releaseNotes); + this.emailInfo.content = content.join("\n"); + if (get) { return { - on: { - mouseenter: (e) => this.cellMouseenter(e, record), - mouseleave: (e) => this.cellMouseleave(e, record), - }, + title: this.emailInfo.title, + content: content.join("\n"), }; - }, - reasonCancel() { - this.reasonVisible = false; - }, - reasonOk() { - let { - soft: { fileUrl, lockFlag }, - } = this.currentObj; - // 澶氫紶涓�涓綋鍓嶇姸鎬� - let lockFlagNow = lockFlag; - lockFlag = !lockFlag * 1; - let params = { - fileUrl, - localReason: this.reason, - lockFlag, - lockFlagNow, - }; - updateSoftwareLock(params).then((res) => { - const { code, data } = res.data; - if (code && data) { - this.$message.success("鎿嶄綔鎴愬姛"); - this.reasonVisible = false; - // 濡傛灉鏄祴璇曚汉鍛樿В閿佺‘璁� 鍒欒嚜鍔ㄥ彂閫侀偖浠� - if (lockFlagNow == -1 && this.isTester) { - this.sendEmail(); - } - this.searchData(); - } else { - this.$message.error("鎿嶄綔澶辫触"); - } - }); - }, - sendEmail() { - let { title, content } = this.handleEmailShow(this.currentObj, true); - let params = { mailList: this.mailList, title, content }; - sendMail(params); - }, - lock(record) { - this.reason = ""; - this.currentObj = record; - this.reasonVisible = true; - }, - handleEmailShow(record, get) { - this.emailInfo.title = - "[杞欢鍙戝竷璁板綍]" + - record.soft.fileName + - " 鐗堟湰鍙凤細" + - record.soft.version; - let { soft, links } = record; - let content = []; - content.push("杞欢鍩烘湰淇℃伅"); - content.push("鏂囦欢鍚嶇О: " + soft.fileName); - content.push("鏉垮彿: " + soft.boardNumber); - content.push("杞欢绫诲瀷: " + soft.type); - content.push("杞欢鐗堟湰: " + soft.version); - content.push("杞欢鍩轰簬鐗堟湰: " + soft.basedVersion); - content.push("杞欢璐熻矗浜�: " + soft.owner); - content.push("褰掓。鏃ユ湡: " + soft.filingDate); - content.push("杞欢绫诲瀷: " + soft.type); - content.push("杞欢閫傜敤鏈哄瀷"); - links.forEach((v) => { - content.push( - "鐗╂枡缂栫爜: " + v.applyMaterialCode + " 瑙勬牸鍨嬪彿: " + v.applyModel - ); - }); - content.push("鍙戝竷璇存槑: " + soft.releaseNotes); - this.emailInfo.content = content.join("\n"); - if (get) { - return { - title: this.emailInfo.title, - content: content.join("\n"), - }; - } - this.emailShow = true; - }, - emailCancel() { - this.emailShow = false; - }, - searchAllUserList() { - getUserList() - .then((res) => { - let rs = res.data; - if (rs.code && rs.data) { - this.userList = rs.data2; - this.searchDefaultMailUser(); - } - }) - .catch((error) => { - console.log(error); - }); - }, - searchDefaultMailUser() { - // 杞欢 type涓�1 - let type = 1; - searchDefaultMailUser(type).then((res) => { + } + this.emailShow = true; + }, + emailCancel() { + this.emailShow = false; + }, + searchAllUserList() { + getUserList() + .then((res) => { let rs = res.data; - let data = []; - if (rs.code === 1) { - data = rs.data.map((item) => { - return item.user; - }); + if (rs.code && rs.data) { + this.userList = rs.data2; + this.searchDefaultMailUser(); } - this.mailList = this.userList - .filter((o) => data.includes(o.name) && o.mail) - .map((item) => { - return item.mail; - }); + }) + .catch((error) => { + console.log(error); }); - }, - getRoleUser() { - getRoleUser(0) - .then((res) => { - let { code, data, data2 } = res.data; - let list = []; - if (code && data) { - // console.log(data); - list = data2.map((v) => v.name); - } - this.tester = list; - }) - .catch((err) => { - console.log(err); + }, + searchDefaultMailUser() { + // 杞欢 type涓�1 + let type = 1; + searchDefaultMailUser(type).then((res) => { + let rs = res.data; + let data = []; + if (rs.code === 1) { + data = rs.data.map((item) => { + return item.user; }); - }, - handleConfirmDelete(obj) { - Modal.confirm({ - content: () => "鍒犻櫎褰撳墠杞欢锛屽垹闄ゅ悗鏃犳硶鎭㈠锛岃娉ㄦ剰锛侊紒锛�", - onOk: async () => { - try { - const res = await deleteSoftwareApi( - obj.soft.fileName, - obj.soft.version - ); - const rs = res.data; - if (rs.code === 1 && rs.data) { - this.$message.success("鍒犻櫎鎴愬姛銆�"); - } else { - this.$message.error("鍒犻櫎澶辫触!!!"); - } - this.searchData(); - } catch (e) { - this.$message.error("鍒犻櫎澶辫触锛岃鑱旂郴寮�鍙戜汉鍛�!!!"); - console.log(e); - } - }, - }); - }, - // 鏌ヨ鍏朵粬鐗堟湰 涓庡綋鍓嶈蒋浠朵笂浼犳棩鏈熷墠涓夊ぉ鍐呯殑鍒楄〃 - getOtherSoft(date) { - return getFileNameByCreateTime(date).then((res) => { + } + this.mailList = this.userList + .filter((o) => data.includes(o.name) && o.mail) + .map((item) => { + return item.mail; + }); + }); + }, + getRoleUser() { + getRoleUser(0) + .then((res) => { let { code, data, data2 } = res.data; let list = []; if (code && data) { - console.log(data); - list = data2; + // console.log(data); + list = data2.map((v) => v.name); } - this.otherSoftList = list; - return list; + this.tester = list; }) - .catch((err) => { - console.log(err); - return []; - }); - - }, - sourceUploadChange(data) { - const { file, fileList } = data; - if (fileList.length > 1) { - fileList.shift(); - } - if (fileList.length) { - this.sourceFile = fileList[0].originFileObj; - } else { - this.sourceFile = null; - } - }, - // 涓婁紶婧愮爜鍖� - uploadSource(record) { - if (!this.sourceFile) { - this.$message.error("璇烽�夋嫨瑕佷笂浼犵殑婧愮爜鍖�"); - return false; - } - if (!this.names.length) { - this.$message.error("璇烽�夋嫨婧愮爜鍖呭搴旂殑杞欢"); - return false; - } - let loading = this.$layer.loading(); - - const formData = new FormData(); - formData.append("file", this.sourceFile); - formData.append("fileNames", this.names.join(',')); - uploadCode(formData) - .then((res) => { - let { code, data, msg } = res.data; - if (code) { - this.uploadSourceShow = false; - this.$message.success('涓婁紶鎴愬姛'); - this.searchData(); - } else { - this.$message.error('涓婁紶澶辫触'); - } - this.$layer.close(loading); - }) - .catch((error) => { - this.$layer.close(loading); - console.log(error); - }); - }, - // 涓嬭浇婧愮爜鍖� - downloadSource(record) { - let loading = this.$layer.loading(); - downLoadCode(record.fileName).then((res) => { - let { headers, data, status } = res; - if (200 == status && data) { - let url = window.URL.createObjectURL(data); - const matchRes = /filename=(.*)/.exec(headers["content-disposition"]); - const fileName = matchRes - ? decodeURI(matchRes[1].trim()) - : "鏈煡鏂囦欢鍚�.zip"; - let link = document.createElement("a"); - link.style.display = "none"; - link.href = url; - link.download = fileName; - document.body.appendChild(link); - link.click(); - this.$layer.close(loading); - document.body.removeChild(link); - window.URL.revokeObjectURL(url); - } else { - this.$layer.close(loading); - this.$message.error("鎿嶄綔澶辫触"); - } + .catch((err) => { + console.log(err); }); - }, - async uploadSourceClick(obj) { - console.log('obj', obj, '============='); - this.currentObj = obj; - let date = obj.soft.createTime.split(' ')[0]; - await this.getOtherSoft(date); - this.names = [obj.fileName]; - this.uploadSourceShow = true; - }, - uploadSourceCancel() { - this.uploadSourceShow = false; - }, + + // 涓婁紶婧愮爜浜哄憳鍒楄〃 + getRoleUser(3) + .then((res) => { + let { code, data, data2 } = res.data; + let list = []; + if (code && data) { + // console.log(data); + list = data2.map((v) => v.name); + } + this.coderUp = list; + }) + .catch((err) => { + console.log(err); + }); + // 涓嬭浇婧愮爜浜哄憳鍒楄〃 + getRoleUser(2) + .then((res) => { + let { code, data, data2 } = res.data; + let list = []; + if (code && data) { + // console.log(data); + list = data2.map((v) => v.name); + } + this.coderDown = list; + }) + .catch((err) => { + console.log(err); + }); }, - watch: { - update(n) { - if (-1 != n && !this._inactive) { - this.$nextTick(() => { - const table = this.$refs.table; - const header = document.querySelectorAll( - ".doc-center-table .ant-table-header" - )[0].clientHeight; - const bar = document.querySelectorAll(".header-bar")[0].clientHeight; - if (table.fullScreen) { - this.y = table.$el.clientHeight - bar - header - 64; + handleConfirmDelete(obj) { + Modal.confirm({ + content: () => "鍒犻櫎褰撳墠杞欢锛屽垹闄ゅ悗鏃犳硶鎭㈠锛岃娉ㄦ剰锛侊紒锛�", + onOk: async () => { + try { + const res = await deleteSoftwareApi( + obj.soft.fileName, + obj.soft.version + ); + const rs = res.data; + if (rs.code === 1 && rs.data) { + this.$message.success("鍒犻櫎鎴愬姛銆�"); } else { - const wraper = this.$refs.wraper.clientHeight; - const card = document.querySelectorAll(".ant-card-body")[0]; - const { paddingBottom, paddingTop } = getComputedStyle(card, null); - const h = - wraper - - header - - 64 - - bar - - parseInt(paddingBottom) - - parseInt(paddingTop); - // console.log(h, "h",wraper, header, bar ); - this.y = h; + this.$message.error("鍒犻櫎澶辫触!!!"); } - }); - } - }, - affixed() { - setTimeout(() => { - this.update = Math.random(); - }, 200); - }, + this.searchData(); + } catch (e) { + this.$message.error("鍒犻櫎澶辫触锛岃鑱旂郴寮�鍙戜汉鍛�!!!"); + console.log(e); + } + }, + }); }, - computed: { - ...mapGetters("account", ["permits", "user"]), - ...mapGetters("setting", ["affixed"]), - canUploadSoftware() { - return checkPermit(PERMITS.uploadSoftware, this.permits); - }, - canDownloadSoftware() { - return checkPermit(PERMITS.downloadSoftware, this.permits); - }, - canLock() { - return checkPermit(PERMITS.lockOther, this.permits); - }, - isTester() { - return this.tester.some((v) => v == this.user.name); - }, - isCoder() { - return '鏉庢枃娑�' == this.user.name; + // 鏌ヨ鍏朵粬鐗堟湰 涓庡綋鍓嶈蒋浠朵笂浼犳棩鏈熷墠涓夊ぉ鍐呯殑鍒楄〃 + getOtherSoft(date) { + return getFileNameByCreateTime(date).then((res) => { + let { code, data, data2 } = res.data; + let list = []; + if (code && data) { + console.log(data); + list = data2; + } + this.otherSoftList = list; + return list; + }) + .catch((err) => { + console.log(err); + return []; + }); + + }, + sourceUploadChange(data) { + const { file, fileList } = data; + if (fileList.length > 1) { + fileList.shift(); + } + if (fileList.length) { + this.sourceFile = fileList[0].originFileObj; + } else { + this.sourceFile = null; } }, - mounted() { - this.getRoleUser(); - this.searchData(); - this.searchAllUserList(); - window.addEventListener("resize", this.resize); + // 涓婁紶婧愮爜鍖� + uploadSource(record) { + if (!this.sourceFile) { + this.$message.error("璇烽�夋嫨瑕佷笂浼犵殑婧愮爜鍖�"); + return false; + } + if (!this.names.length) { + this.$message.error("璇烽�夋嫨婧愮爜鍖呭搴旂殑杞欢"); + return false; + } + let loading = this.$layer.loading(); + + const formData = new FormData(); + formData.append("file", this.sourceFile); + formData.append("fileNames", this.names.join(',')); + uploadCode(formData) + .then((res) => { + let { code, data, msg } = res.data; + if (code) { + this.uploadSourceShow = false; + this.$message.success('涓婁紶鎴愬姛'); + this.searchData(); + } else { + this.$message.error('涓婁紶澶辫触'); + } + this.$layer.close(loading); + }) + .catch((error) => { + this.$layer.close(loading); + console.log(error); + }); }, - destroyed() { - window.removeEventListener("resize", this.resize); + // 涓嬭浇婧愮爜鍖� + downloadSource(record) { + let loading = this.$layer.loading(); + downLoadCode(record.fileName).then((res) => { + let { headers, data, status } = res; + if (200 == status && data) { + let url = window.URL.createObjectURL(data); + const matchRes = /filename=(.*)/.exec(headers["content-disposition"]); + const fileName = matchRes + ? decodeURI(matchRes[1].trim()) + : "鏈煡鏂囦欢鍚�.zip"; + let link = document.createElement("a"); + link.style.display = "none"; + link.href = url; + link.download = fileName; + document.body.appendChild(link); + link.click(); + this.$layer.close(loading); + document.body.removeChild(link); + window.URL.revokeObjectURL(url); + } else { + this.$layer.close(loading); + this.$message.error("鎿嶄綔澶辫触"); + } + }); }, - }; + async uploadSourceClick(obj) { + // console.log('obj', obj, '============='); + this.currentObj = obj; + let date = obj.soft.createTime.split(' ')[0]; + await this.getOtherSoft(date); + this.names = [obj.fileName]; + this.uploadSourceShow = true; + }, + // 鍏变韩婧愮爜 + async connectSource(record) { + let loading = this.$layer.loading(); + this.currentObj = record; + this.fileNames = []; + await this.getSoftwareList(record.soft.owner); + this.$layer.close(loading); + this.connectSourceShow = true; + }, + // 鏍规嵁璐熻矗浜� 鏌ヨ杞欢鍒楄〃 鏈笂浼犳簮鐮� + async getSoftwareList(name) { + let _res = await getFileNameByOwner(name); + let res = _res.data; + let list = []; + if (res.code && res.data) { + list = res.data2; + } + this.otherSoftList = list; + }, + connectSourceCancel() { + this.connectSourceShow = false; + }, + connectSourceSubmit() { + let num = this.currentObj.codeNum; + let fileNames = this.fileNames; + if (!fileNames.length) { + this.$message.error('璇烽�夋嫨瑕佸叡浜簮鐮佸寘鐨勮蒋浠�'); + return false; + } + let loading = this.$layer.loading(); + connectCode(num, fileNames).then((res) => { + let { code, data } = res.data; + this.$layer.close(loading); + if (code && data) { + this.$message.success('鎿嶄綔鎴愬姛'); + this.connectSourceShow = false; + } else { + this.$message.error('鎿嶄綔澶辫触'); + } + }) + .catch((err) => { + this.$layer.close(loading); + console.log(err); + }); + + }, + uploadSourceCancel() { + this.uploadSourceShow = false; + }, + }, + watch: { + update(n) { + if (-1 != n && !this._inactive) { + this.$nextTick(() => { + const table = this.$refs.table; + const header = document.querySelectorAll( + ".doc-center-table .ant-table-header" + )[0].clientHeight; + const bar = document.querySelectorAll(".header-bar")[0].clientHeight; + if (table.fullScreen) { + this.y = table.$el.clientHeight - bar - header - 64; + } else { + const wraper = this.$refs.wraper.clientHeight; + const card = document.querySelectorAll(".ant-card-body")[0]; + const { paddingBottom, paddingTop } = getComputedStyle(card, null); + const h = + wraper - + header - + 64 - + bar - + parseInt(paddingBottom) - + parseInt(paddingTop); + // console.log(h, "h",wraper, header, bar ); + this.y = h; + } + }); + } + }, + affixed() { + setTimeout(() => { + this.update = Math.random(); + }, 200); + }, + }, + computed: { + ...mapGetters("account", ["permits", "user"]), + ...mapGetters("setting", ["affixed"]), + canUploadSoftware() { + return checkPermit(PERMITS.uploadSoftware, this.permits); + }, + canDownloadSoftware() { + return checkPermit(PERMITS.downloadSoftware, this.permits); + }, + canLock() { + return checkPermit(PERMITS.lockOther, this.permits); + }, + isTester() { + return this.tester.some((v) => v == this.user.name); + }, + isCoderUp() { + return this.coderUp.some((v) => v == this.user.name); + }, + isCoderDown() { + return this.coderDown.some((v) => v == this.user.name); + } + }, + mounted() { + this.getRoleUser(); + this.searchData(); + this.searchAllUserList(); + window.addEventListener("resize", this.resize); + }, + destroyed() { + window.removeEventListener("resize", this.resize); + }, +}; </script> <style scoped lang="less"> @@ -1043,6 +1309,7 @@ } .modal-footer { + margin-top: 16px; text-align: right; button+button { @@ -1105,6 +1372,7 @@ /deep/.locked.locked.locked:hover>td { background: #fcd583; } + .version { color: #090; display: inline-block; diff --git a/src/pages/user/apis.js b/src/pages/user/apis.js index 3349c41..137388d 100644 --- a/src/pages/user/apis.js +++ b/src/pages/user/apis.js @@ -128,7 +128,7 @@ }); }; /** - * 鏌ヨ瑙掕壊鐢ㄦ埛鍒楄〃 鏉冮檺绫诲瀷0锛氭祴璇曪紝1涓嬭浇 + * 鏌ヨ瑙掕壊鐢ㄦ埛鍒楄〃 鏉冮檺绫诲瀷0锛氭祴璇曪紝 1涓嬭浇 2锛氭簮鐮佷笅杞� 3锛氭簮鐮佷笂浼� * @param {*} roleType * @returns */ -- Gitblit v1.9.1