From c52f7f5736836d447832f8fc6cf0f540ef854f15 Mon Sep 17 00:00:00 2001 From: he wei <858544502@qq.com> Date: 星期三, 03 一月 2024 17:20:36 +0800 Subject: [PATCH] U sop添加文件名称搜索 软件列表默认查可用 --- src/pages/resourceManage/sopFile/list.vue | 23 src/pages/resourceManage/software/list.vue | 1 src/pages/resourceManage/sopFile/sopList.vue | 1779 ++++++++++++++++++++++++++++---------------------------- 3 files changed, 912 insertions(+), 891 deletions(-) diff --git a/src/pages/resourceManage/software/list.vue b/src/pages/resourceManage/software/list.vue index 7b27c48..58b3993 100644 --- a/src/pages/resourceManage/software/list.vue +++ b/src/pages/resourceManage/software/list.vue @@ -290,6 +290,7 @@ searchAble: true, noSearch: true, search: { + default: 0, selectOptions: [ { title: "鍏ㄩ儴", diff --git a/src/pages/resourceManage/sopFile/list.vue b/src/pages/resourceManage/sopFile/list.vue index cefd92e..b9ce06f 100644 --- a/src/pages/resourceManage/sopFile/list.vue +++ b/src/pages/resourceManage/sopFile/list.vue @@ -37,10 +37,10 @@ > </a-space> </template> - <template slot="status" slot-scope="{ record }"> - <a-tag color="green" v-if="record.status">鍙敤</a-tag> - <a-tag color="red" v-else>涓嶅彲鐢�</a-tag> - </template> + <template slot="status" slot-scope="{ record }"> + <a-tag color="green" v-if="record.status">鍙敤</a-tag> + <a-tag color="red" v-else>涓嶅彲鐢�</a-tag> + </template> <template slot="action" slot-scope="{ record }"> <a-popover v-if="!record.currentFlag" title="" trigger="hover"> <div class="" slot="content" style="width: 450px"> @@ -399,7 +399,7 @@ dataIndex: "fileName", align: "center", width: 140, - searchAble: false, + searchAble: true, customCell: this.customCell, }, { @@ -853,13 +853,12 @@ const { pageCurr, pageSize, conditions, columns } = this; let params = { pageCurr, pageSize }; let data = {}; - console.log(this.conditions['status']); + // console.log(this.conditions["status"]); Object.keys(conditions).forEach((v) => { switch (v) { - case "code": - case "model": - params[v] = conditions[v]; - break; + // case "code": + // case "model": + // break; case "status": params[v] = conditions[v] ? 1 : 0; break; @@ -867,6 +866,10 @@ case "chileType": data[v] = conditions[v]; break; + + default: + params[v] = conditions[v]; + break; } }); let list = []; diff --git a/src/pages/resourceManage/sopFile/sopList.vue b/src/pages/resourceManage/sopFile/sopList.vue index aeef5fb..79ce3dd 100644 --- a/src/pages/resourceManage/sopFile/sopList.vue +++ b/src/pages/resourceManage/sopFile/sopList.vue @@ -1,21 +1,21 @@ <template> - <div class="main"> - <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="{ y }" - :pagination="{ + <div class="main"> + <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="{ y }" + :pagination="{ current: pageCurr, pageSize: pageSize, total: total, @@ -27,175 +27,186 @@ `绗� ${range[0]}-${range[1]} 鏉★紝鎬昏 ${total} 鏉, onChange: onPageChange, onShowSizeChange: onSizeChange, - }"> - <template slot="action" slot-scope="{ record }"> - <a-popover v-if="!record.currentFlag" title="" trigger="hover"> - <div class="" slot="content" style="width: 450px"> - <a-table - size="small" - :scroll="{ y: 300 }" - bordered - :columns="prodsColumns" - :data-source="record.sopProductList" - :pagination="false" - :expandRowByClick="true" - :row-key="(record1, index) => index" - > - <!-- <template slot="action" slot-scope="record1"> + }" + > + <template slot="action" slot-scope="{ record }"> + <a-popover v-if="!record.currentFlag" title="" trigger="hover"> + <div class="" slot="content" style="width: 450px"> + <a-table + size="small" + :scroll="{ y: 300 }" + bordered + :columns="prodsColumns" + :data-source="record.sopProductList" + :pagination="false" + :expandRowByClick="true" + :row-key="(record1, index) => index" + > + <!-- <template slot="action" slot-scope="record1"> 123{{ record1 }} </template> --> - </a-table> - </div> - <a>閫傜敤浜у搧</a> - </a-popover> - <a-tag v-else class="tag-all" color="#f50"> 閫傜敤鍏ㄩ儴 </a-tag> - <template v-if="canDownload"> - <a-divider type="vertical"></a-divider> - <a v-if="record.isCanPreview" :disabled="!record.status" @click="downloadFile(record)">棰勮</a> - <a v-else :disabled="!record.status" @click="downloadFile(record)">涓嬭浇</a> - </template> - </template> - </advance-table> - </a-card> - </a-spin> - </div> - <pop - :visible.sync="popVisible" - :x="popPosition.x" - :y="popPosition.y" - :position="popPosition.dir" - :info="popInfo" - ></pop> - <a-modal - :visible="uploadShow" - :footer="null" - :width="800" - title="涓婁紶SOP" - :destroyOnClose="true" - :maskClosable="false" - @cancel="uploadCancel" - > - <div class=""> - <template v-if="!onlyXls"> - <a-row type="flex" class="row"> - <a-col flex="6em" class="label">sop鏂囦欢</a-col> - <a-col :flex="1"> - <a-upload - class="upload" - :before-upload="beforeUpload" - @change="uploadChange" - accept=".zip,.rar" - > - <a-button type="primary">閫夋枃浠�</a-button> - </a-upload> - </a-col> - </a-row> - </template> - <a-row type="flex" class="row"> - <a-col flex="6em" class="label">SOP璇存槑</a-col> - <a-col :flex="1"> - <a-upload - class="upload" - :before-upload="beforeUpload" - @change="uploadChange1" - accept=".xls,.xlsx" - > - <a-button type="primary">璇存槑鏂囦欢</a-button> - </a-upload> - </a-col> - </a-row> - <div class="sub-title">璇存槑鏂囦欢瑙f瀽缁撴灉</div> - <div class="res-content"> - <desc-res :info="resObj"></desc-res> - </div> - <div class="modal-footer"> - <a-button type="danger" @click="uploadCancel"> 鍙栨秷 </a-button> - <a-button v-if="!onlyXls" type="primary" @click="uploadSop"> - 鎻愪氦 - </a-button> - <a-button v-else type="primary" @click="applyModel"> 鎻愪氦 </a-button> - </div> - </div> - </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" - :type="2" - v-if="emailShow" - ></email-card> - </a-modal> - <!-- 鎿嶄綔鍘熷洜 --> - <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-form-model-item> - </a-modal> - <!-- 鏃ュ織 --> - <a-modal - :visible="logVisible" - :footer="null" - :width="800" - title="鎿嶄綔鏃ュ織" - :destroyOnClose="true" - @cancel="logCancel" - > - <div class="log-content"> - <a-timeline v-if="logList.length"> - <a-timeline-item - v-for="(item, idx) in logList" - :key="'log_' + idx" - :color="item.status == 0 ? 'red' : 'green'" - > - <div> - <span class="user">{{ item.userName }}</span> 鍦� - <span class="time">{{ item.createTime }}</span> - {{ item.status == 0 ? "閿佸畾" : "瑙i攣" }}浜嗙増鏈� - <span class="version">{{ item.fileVersion }}</span> - </div> - <div>鎿嶄綔鍘熷洜: {{ item.reason ? item.reason : "鏃�" }}</div> - </a-timeline-item> - </a-timeline> - <a-empty v-else /> - </div> - </a-modal> + </a-table> + </div> + <a>閫傜敤浜у搧</a> + </a-popover> + <a-tag v-else class="tag-all" color="#f50"> 閫傜敤鍏ㄩ儴 </a-tag> + <template v-if="canDownload"> + <a-divider type="vertical"></a-divider> + <a + v-if="record.isCanPreview" + :disabled="!record.status" + @click="downloadFile(record)" + >棰勮</a + > + <a + v-else + :disabled="!record.status" + @click="downloadFile(record)" + >涓嬭浇</a + > + </template> + </template> + </advance-table> + </a-card> + </a-spin> + </div> + <pop + :visible.sync="popVisible" + :x="popPosition.x" + :y="popPosition.y" + :position="popPosition.dir" + :info="popInfo" + ></pop> + <a-modal + :visible="uploadShow" + :footer="null" + :width="800" + title="涓婁紶SOP" + :destroyOnClose="true" + :maskClosable="false" + @cancel="uploadCancel" + > + <div class=""> + <template v-if="!onlyXls"> + <a-row type="flex" class="row"> + <a-col flex="6em" class="label">sop鏂囦欢</a-col> + <a-col :flex="1"> + <a-upload + class="upload" + :before-upload="beforeUpload" + @change="uploadChange" + accept=".zip,.rar" + > + <a-button type="primary">閫夋枃浠�</a-button> + </a-upload> + </a-col> + </a-row> + </template> + <a-row type="flex" class="row"> + <a-col flex="6em" class="label">SOP璇存槑</a-col> + <a-col :flex="1"> + <a-upload + class="upload" + :before-upload="beforeUpload" + @change="uploadChange1" + accept=".xls,.xlsx" + > + <a-button type="primary">璇存槑鏂囦欢</a-button> + </a-upload> + </a-col> + </a-row> + <div class="sub-title">璇存槑鏂囦欢瑙f瀽缁撴灉</div> + <div class="res-content"> + <desc-res :info="resObj"></desc-res> + </div> + <div class="modal-footer"> + <a-button type="danger" @click="uploadCancel"> 鍙栨秷 </a-button> + <a-button v-if="!onlyXls" type="primary" @click="uploadSop"> + 鎻愪氦 + </a-button> + <a-button v-else type="primary" @click="applyModel"> 鎻愪氦 </a-button> + </div> + </div> + </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" + :type="2" + v-if="emailShow" + ></email-card> + </a-modal> + <!-- 鎿嶄綔鍘熷洜 --> + <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-form-model-item> + </a-modal> + <!-- 鏃ュ織 --> + <a-modal + :visible="logVisible" + :footer="null" + :width="800" + title="鎿嶄綔鏃ュ織" + :destroyOnClose="true" + @cancel="logCancel" + > + <div class="log-content"> + <a-timeline v-if="logList.length"> + <a-timeline-item + v-for="(item, idx) in logList" + :key="'log_' + idx" + :color="item.status == 0 ? 'red' : 'green'" + > + <div> + <span class="user">{{ item.userName }}</span> 鍦� + <span class="time">{{ item.createTime }}</span> + {{ item.status == 0 ? "閿佸畾" : "瑙i攣" }}浜嗙増鏈� + <span class="version">{{ item.fileVersion }}</span> + </div> + <div>鎿嶄綔鍘熷洜: {{ item.reason ? item.reason : "鏃�" }}</div> + </a-timeline-item> + </a-timeline> + <a-empty v-else /> + </div> + </a-modal> - <!-- 鏃ュ織 --> - <a-modal - :visible="pdfInfo.visible" - :footer="null" - :width="960" - title="鏂囦欢棰勮" - :destroyOnClose="true" - @cancel="pdfCancel"> - <div style="height:600px; overflow-y: auto"> - <iframe :src="pdfInfo.src"></iframe> - </div> - - </a-modal> - </div> + <!-- 鏃ュ織 --> + <a-modal + :visible="pdfInfo.visible" + :footer="null" + :width="960" + title="鏂囦欢棰勮" + :destroyOnClose="true" + @cancel="pdfCancel" + > + <div style="height:600px; overflow-y: auto"> + <iframe :src="pdfInfo.src"></iframe> + </div> + </a-modal> + </div> </template> <script> @@ -207,14 +218,14 @@ import EmailCard from "../../components/emailCard"; import { getUserList } from "../../permission/apis"; import { - fileParse, - addSop, - getList, - getSopType1, - getSopType2, - updateSop, - sopLock, - getLogList, + fileParse, + addSop, + getList, + getSopType1, + getSopType2, + updateSop, + sopLock, + getLogList, } from "./apis"; import offset from "@/assets/js/tools/offset"; import Pop from "./pop"; @@ -222,731 +233,737 @@ import getFileTypeAndName from "@/assets/js/tools/getFileTypeAndName"; import VuePdf from "vue-pdf"; - export default { - props: { - parentCode: { - type: [String, Number], - default: 0 - } - }, - components: { - AdvanceTable, - Pop, - DescRes, - EmailCard, - VuePdf, - }, - name: "list", - data() { - return { - pdfInfo: { - visible: false, - src: "", - loadedRatio: 0, - page: 1, - numPages: 0, - rotate: 0, - }, - rowFileName: '', - logList: [], - logVisible: false, - currentObj: null, - reasonVisible: false, - reason: "", - emailShow: false, - emailInfo: { - title: "", - content: "", - }, - userList: [], - onlyXls: false, - uploadShow: false, - webUrl: getWebUrl(), - prodsColumns: [ - { - title: "鐗╂枡缂栫爜", - dataIndex: "code", - align: "center", - }, - { - title: "鍨�/鏉垮彿", - dataIndex: "model", - align: "center", - width: 180, - }, - // { - // title: "鎿嶄綔", - // dataIndex: "operation", - // align: "center", - // width: 180, - // scopedSlots: { customRender: "action" }, - // }, - ], - file: null, - file1: null, - resObj: {}, - popInfo: {}, - popVisible: false, - popPosition: { - x: 500, - y: 100, - dir: "bottom", - }, - spinning: false, - loading: false, - pageCurr: 1, - pageSize: 20, - total: 0, - y: 400, - update: -1, - conditions: {}, - columns: [ - { - title: "鏂囦欢鍚嶇О", - dataIndex: "fileName", - align: "center", - width: 140, - searchAble: false, - customCell: this.customCell, - }, - { - title: "鍙戝竷鏃堕棿", - dataIndex: "releaseDate", - align: "center", - width: 160, - customCell: this.customCell, - }, - { - title: "璐熻矗浜�", - dataIndex: "editor", - align: "center", - width: 90, - customCell: this.customCell, - }, - { - title: "瀹℃牳浜�", - dataIndex: "auditor", - align: "center", - width: 90, - customCell: this.customCell, - }, - { - title: "鍙戝竷璇存槑", - dataIndex: "releaseNotes", - align: "center", - width: 260, - customCell: this.customCell, - }, - { - title: "鎿嶄綔", - dataIndex: "operation", - align: "center", - width: 200, - fixed: "right", - scopedSlots: { customRender: "action" }, - noSearch: true, - }, - ], - dataSource: [], - }; - }, - computed: { - ...mapGetters("account", ["permits"]), - ...mapGetters("setting", ["affixed"]), - canUpload() { - return checkPermit(PERMITS.uploadSoftware, this.permits); - }, - canDownload() { - return checkPermit(PERMITS.downloadSop, this.permits); - }, - }, - 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); - this.y = h; - } - }); - } - }, - affixed() { - setTimeout(() => { - this.update = Math.random(); - }, 200); - }, - }, - methods: { - searchAllUserList() { - getUserList() - .then((res) => { - let rs = res.data; - if (rs.code && rs.data) { - this.userList = rs.data2; - } - }) - .catch((error) => { - console.log(error); - }); - }, - showUpload() { - this.file = null; - this.file1 = null; - this.resObj = {}; - this.onlyXls = false; - this.uploadShow = true; - }, - updateDesc(row) { - this.file = null; - this.file1 = null; - this.resObj = { rowId: row.id }; - this.rowFileName = row.fileName; - this.onlyXls = true; - this.uploadShow = true; - }, - uploadCancel() { - this.uploadShow = false; - }, - handleEmailShow(record) { - this.emailInfo.title = - "[sop鍙戝竷璁板綍]" + record.fileName + " 鐗堟湰鍙凤細" + record.fileVersion; - let sopProductListText = record.sopProductList - .map((item) => { - return "鐗╂枡缂栫爜锛�" + item.code + " 鍨�/鏉垮彿锛�" + item.model; - }) - .join("\n"); - this.emailInfo.content = - "鏂囦欢鍩虹淇℃伅\n" + - "鏂囦欢鍚嶇О锛�" + - record.fileName + - "\n" + - "鏂囦欢绫诲瀷锛�" + - record.fileType + - "\n" + - "鏂囦欢鐗堟湰锛�" + - record.fileVersion + - "\n" + - "鍏宠仈鐗堟湰锛�" + - record.fileRelatedVersion + - "\n" + - "缂栧埗锛�" + - record.editor + - "\n" + - "瀹℃牳锛�" + - record.auditor + - "\n" + - "鍙戝竷鏃ユ湡锛�" + - record.releaseDate + - "\n" + - "鏂囦欢閫傜敤浜у搧\n" + - sopProductListText + - "\n" + - "鍙戝竷璇存槑锛�" + - record.releaseNotes; - this.emailShow = true; - }, - emailCancel() { - this.emailShow = false; - }, - uploadSop() { - if (!this.file) { - this.$message.error("璇烽�夋嫨瑕佷笂浼犵殑鍘嬬缉鍖�"); - return false; - } - if (!this.file1) { - this.$message.error("璇烽�夋嫨sop璇存槑鏂囦欢"); - return false; - } - if (!this.resObj.fileName) { - this.$message.error("sop璇存槑鏂囦欢瑙f瀽寮傚父"); - return false; - } - // 濡傛灉sop鏂囦欢鍚嶇О != sop璇存槑閲岀殑鏂囦欢鍚嶇О + 鏂囦欢鐗堟湰 鍒欐姤閿欐嫆缁� - let reg = /(.*)\..{1,5}$/; - let name1 = this.file.name.match(reg)[1]; - let { fileName, fileVersion } = this.resObj; - let name2 = fileName + fileVersion; + props: { + parentCode: { + type: [String, Number], + default: 0, + }, + }, + components: { + AdvanceTable, + Pop, + DescRes, + EmailCard, + VuePdf, + }, + name: "list", + data() { + return { + pdfInfo: { + visible: false, + src: "", + loadedRatio: 0, + page: 1, + numPages: 0, + rotate: 0, + }, + rowFileName: "", + logList: [], + logVisible: false, + currentObj: null, + reasonVisible: false, + reason: "", + emailShow: false, + emailInfo: { + title: "", + content: "", + }, + userList: [], + onlyXls: false, + uploadShow: false, + webUrl: getWebUrl(), + prodsColumns: [ + { + title: "鐗╂枡缂栫爜", + dataIndex: "code", + align: "center", + }, + { + title: "鍨�/鏉垮彿", + dataIndex: "model", + align: "center", + width: 180, + }, + // { + // title: "鎿嶄綔", + // dataIndex: "operation", + // align: "center", + // width: 180, + // scopedSlots: { customRender: "action" }, + // }, + ], + file: null, + file1: null, + resObj: {}, + popInfo: {}, + popVisible: false, + popPosition: { + x: 500, + y: 100, + dir: "bottom", + }, + spinning: false, + loading: false, + pageCurr: 1, + pageSize: 20, + total: 0, + y: 400, + update: -1, + conditions: {}, + columns: [ + { + title: "鏂囦欢鍚嶇О", + dataIndex: "fileName", + align: "center", + width: 140, + searchAble: true, + customCell: this.customCell, + }, + { + title: "鍙戝竷鏃堕棿", + dataIndex: "releaseDate", + align: "center", + width: 160, + customCell: this.customCell, + }, + { + title: "璐熻矗浜�", + dataIndex: "editor", + align: "center", + width: 90, + customCell: this.customCell, + }, + { + title: "瀹℃牳浜�", + dataIndex: "auditor", + align: "center", + width: 90, + customCell: this.customCell, + }, + { + title: "鍙戝竷璇存槑", + dataIndex: "releaseNotes", + align: "center", + width: 260, + customCell: this.customCell, + }, + { + title: "鎿嶄綔", + dataIndex: "operation", + align: "center", + width: 200, + fixed: "right", + scopedSlots: { customRender: "action" }, + noSearch: true, + }, + ], + dataSource: [], + }; + }, + computed: { + ...mapGetters("account", ["permits"]), + ...mapGetters("setting", ["affixed"]), + canUpload() { + return checkPermit(PERMITS.uploadSoftware, this.permits); + }, + canDownload() { + return checkPermit(PERMITS.downloadSop, this.permits); + }, + }, + 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); + this.y = h; + } + }); + } + }, + affixed() { + setTimeout(() => { + this.update = Math.random(); + }, 200); + }, + }, + methods: { + searchAllUserList() { + getUserList() + .then((res) => { + let rs = res.data; + if (rs.code && rs.data) { + this.userList = rs.data2; + } + }) + .catch((error) => { + console.log(error); + }); + }, + showUpload() { + this.file = null; + this.file1 = null; + this.resObj = {}; + this.onlyXls = false; + this.uploadShow = true; + }, + updateDesc(row) { + this.file = null; + this.file1 = null; + this.resObj = { rowId: row.id }; + this.rowFileName = row.fileName; + this.onlyXls = true; + this.uploadShow = true; + }, + uploadCancel() { + this.uploadShow = false; + }, + handleEmailShow(record) { + this.emailInfo.title = + "[sop鍙戝竷璁板綍]" + record.fileName + " 鐗堟湰鍙凤細" + record.fileVersion; + let sopProductListText = record.sopProductList + .map((item) => { + return "鐗╂枡缂栫爜锛�" + item.code + " 鍨�/鏉垮彿锛�" + item.model; + }) + .join("\n"); + this.emailInfo.content = + "鏂囦欢鍩虹淇℃伅\n" + + "鏂囦欢鍚嶇О锛�" + + record.fileName + + "\n" + + "鏂囦欢绫诲瀷锛�" + + record.fileType + + "\n" + + "鏂囦欢鐗堟湰锛�" + + record.fileVersion + + "\n" + + "鍏宠仈鐗堟湰锛�" + + record.fileRelatedVersion + + "\n" + + "缂栧埗锛�" + + record.editor + + "\n" + + "瀹℃牳锛�" + + record.auditor + + "\n" + + "鍙戝竷鏃ユ湡锛�" + + record.releaseDate + + "\n" + + "鏂囦欢閫傜敤浜у搧\n" + + sopProductListText + + "\n" + + "鍙戝竷璇存槑锛�" + + record.releaseNotes; + this.emailShow = true; + }, + emailCancel() { + this.emailShow = false; + }, + uploadSop() { + if (!this.file) { + this.$message.error("璇烽�夋嫨瑕佷笂浼犵殑鍘嬬缉鍖�"); + return false; + } + if (!this.file1) { + this.$message.error("璇烽�夋嫨sop璇存槑鏂囦欢"); + return false; + } + if (!this.resObj.fileName) { + this.$message.error("sop璇存槑鏂囦欢瑙f瀽寮傚父"); + return false; + } + // 濡傛灉sop鏂囦欢鍚嶇О != sop璇存槑閲岀殑鏂囦欢鍚嶇О + 鏂囦欢鐗堟湰 鍒欐姤閿欐嫆缁� + let reg = /(.*)\..{1,5}$/; + let name1 = this.file.name.match(reg)[1]; + let { fileName, fileVersion } = this.resObj; + let name2 = fileName + fileVersion; - if (name1.toLowerCase() != name2.toLowerCase()) { - console.log(name1.toLowerCase()+"&&&&&&"+ name2.toLowerCase()); - this.$message.error("sop涓庤鏄庢枃浠跺彲鑳戒笉鍖归厤"); - return false; - } + if (name1.toLowerCase() != name2.toLowerCase()) { + console.log(name1.toLowerCase() + "&&&&&&" + name2.toLowerCase()); + this.$message.error("sop涓庤鏄庢枃浠跺彲鑳戒笉鍖归厤"); + return false; + } - let loading = this.$layer.loading(); + let loading = this.$layer.loading(); - const formData = new FormData(); - formData.append("multipartFile", this.file); - // formData.append("file2", this.file1); - formData.append("sopStr", JSON.stringify(this.resObj)); - addSop(formData) - .then((res) => { - let { code, data, msg } = res.data; - if (code) { - this.uploadShow = false; - this.$message.success("涓婁紶鎴愬姛"); - 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("璇烽�夋嫨sop璇存槑鏂囦欢"); - return false; - } - if (!this.resObj.fileName) { - this.$message.error("sop璇存槑鏂囦欢瑙f瀽寮傚父"); - return false; - } + const formData = new FormData(); + formData.append("multipartFile", this.file); + // formData.append("file2", this.file1); + formData.append("sopStr", JSON.stringify(this.resObj)); + addSop(formData) + .then((res) => { + let { code, data, msg } = res.data; + if (code) { + this.uploadShow = false; + this.$message.success("涓婁紶鎴愬姛"); + 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("璇烽�夋嫨sop璇存槑鏂囦欢"); + return false; + } + if (!this.resObj.fileName) { + this.$message.error("sop璇存槑鏂囦欢瑙f瀽寮傚父"); + return false; + } - if (this.rowFileName.toLowerCase() != this.resObj.fileName.toLowerCase()) { - this.$message.error("璇存槑鏂囦欢涓庤鏉¤褰曞彲鑳戒笉鍖归厤"); - return false; - } - let loading = this.$layer.loading(); - updateSop(this.resObj) - .then((res) => { - let { code, data, msg } = res.data; - if (code) { - this.uploadShow = false; - this.$message.success("涓婁紶鎴愬姛"); - this.searchData(); - } else { - this.$message.error("瑙f瀽澶辫触"); - } - this.$layer.close(loading); - }) - .catch((error) => { - this.$layer.close(loading); - console.log(error); - }); - }, - getSopType1() { - getSopType1() - .then((res) => { - let { code, data } = res.data; - let list = []; - if (code) { - list = data.map((v) => ({ - title: v.type1, - value: v.type1, - })); - } - this.columns[0].search.selectOptions = list; - }) - .catch((err) => { - console.log(err); - }); - }, - getSopType2(type) { - if (type) { - getSopType2(type) - .then((res) => { - let { code, data } = res.data; - let list = []; - if (code) { - list = data.map((v) => ({ - title: v.type2, - value: v.type2, - })); - } - this.columns[1].search.selectOptions = list; - }) - .catch((err) => { - console.log(err); - }); - } else { - this.columns[1].search.selectOptions = []; - } - }, - 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; - } - } else { - if (y + 18 + 360 > clientHeight) { - // y = clientHeight - 378; - dir = "top"; - } else { - dir = "bottom"; - } - if (x < 400) { - x = 400; - } - if (x + 400 > clientWidth) { - x = clientWidth - 400; - } - } - this.popPosition.x = x; - this.popPosition.y = y; - this.popPosition.dir = dir; - this.popInfo = obj; - 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), - }, - }; - }, - 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.resObj = []; - return false; - } - let loading = this.$layer.loading(); - const formData = new FormData(); - formData.append("multipartFile", this.file1); - fileParse(formData) - .then((res) => { - this.$layer.close(loading); - let { code, data, data2, msg } = res.data; - if (code && data) { - let rowId = this.resObj.rowId; - this.resObj = data2; - this.resObj.id = rowId; - this.$message.success("瑙f瀽鎴愬姛"); - } else { - this.$message.error(msg); - } - }) - .catch((error) => { - this.$layer.close(loading); - console.log(error); - }); - }, - resize() { - setTimeout(() => { - this.update = Math.random(); - }, 200); - }, - activeFN() { - this.resize(); - }, - onSearch(conditions, searchOptions, col) { - // console.log(conditions); - // console.log(searchOptions, "00", col); - this.pageCurr = 1; - this.conditions = conditions; - if ("parentType" == col.dataIndex) { - this.parentTypeChange(col.search.value); - } - 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) { - this.conditions = conditions; - this.searchData(); - }, - // 鏂囦欢绫诲瀷鏌ヨ鏉′欢鍙戠敓鍙樺寲 鏌ヨ瀛愭枃浠剁被鍨嬪垪琛� 閲嶇疆瀛愭枃浠剁被鍨嬪�� - parentTypeChange(val) { - let _search = this.columns[1].search; - _search.value = []; - this.conditions["chileType"] = []; - this.getSopType2(val); - }, - searchData() { - const { pageCurr, pageSize, conditions, columns } = this; - let params = { pageCurr, pageSize }; - let data = {}; - Object.keys(conditions).forEach((v) => { - switch (v) { - case "code": - case "model": - params[v] = conditions[v]; - break; - case "status": - params[v] = conditions[v]?1:0; - break; - case "parentType": - case "chileType": - data[v] = conditions[v]; - break; - } - }); - params.status = 1; - params.code = this.parentCode; - let list = []; - let params2 = "{}" == JSON.stringify(data) ? [] : [data]; - getList(params, params2) - .then((res) => { - let { code, data, data2 } = res.data; - let total = 0; - if (code && data) { - // console.log(data2); - list = data2.list; - total = data2.total; - } - this.dataSource = list.map(item=>{ - const fileInfo = getFileTypeAndName(item.fileUrl); - item.isCanPreview = fileInfo.type === "pdf"; - return item; - }); - this.total = total; - this.getSopType1(); - if (-1 == this.update) { - this.update = Math.random(); - } - }) - .catch((err) => { - console.log(err); - }); - }, - downloadFile(record) { - const fileInfo = getFileTypeAndName(record.fileUrl); - let url = this.webUrl + record.fileUrl; - if(fileInfo.type === 'pdf') { // 棰勮 - window.open(url); - }else { // 涓嬭浇 - let loading = this.$layer.loading(); - let link = document.createElement("a"); - link.style.display = "none"; - let fileName = record.fileUrl.split("/").pop(); - link.href = url; - link.download = fileName; - document.body.appendChild(link); - link.click(); - this.$layer.close(loading); - document.body.removeChild(link); - } - }, - reasonCancel() { - this.reasonVisible = false; - }, - reasonOk() { - let { id, status } = this.currentObj; - let reason = this.reason; - status = status == 0 ? 1 : 0; - sopLock(id, status, reason).then((res) => { - const { code } = res.data; - if (code) { - this.$message.success("鎿嶄綔鎴愬姛"); - this.reasonVisible = false; - this.searchData(); - } else { - this.$message.error("鎿嶄綔澶辫触"); - } - }); - }, - lock(record) { - this.reason = ""; - this.currentObj = record; - this.reasonVisible = true; - }, - viewLog(obj) { - // console.log(obj); - const { id, fileVersion } = obj; - getLogList(id).then((res) => { - const { code, data, data2 } = res.data; - if (code) { - this.logList = data2.map((v) => ({ ...v, fileVersion })); - this.logVisible = true; - } else { - this.$message.error("鏃ュ織鏌ヨ澶辫触"); - } - }); - }, - logCancel() { - this.logVisible = false; - }, - pdfCancel() { - this.pdfInfo.visible = false; - }, - goHistory(record) { - let { fileName } = record; - this.$router.push({ - path: "/resource/sop-history", - query: { fileName }, - }); - }, - }, - mounted() { - this.searchData(); - this.searchAllUserList(); - this.getSopType1(); - window.addEventListener("resize", this.resize); - }, - destroyed() { - window.removeEventListener("resize", this.resize); - }, + if ( + this.rowFileName.toLowerCase() != this.resObj.fileName.toLowerCase() + ) { + this.$message.error("璇存槑鏂囦欢涓庤鏉¤褰曞彲鑳戒笉鍖归厤"); + return false; + } + let loading = this.$layer.loading(); + updateSop(this.resObj) + .then((res) => { + let { code, data, msg } = res.data; + if (code) { + this.uploadShow = false; + this.$message.success("涓婁紶鎴愬姛"); + this.searchData(); + } else { + this.$message.error("瑙f瀽澶辫触"); + } + this.$layer.close(loading); + }) + .catch((error) => { + this.$layer.close(loading); + console.log(error); + }); + }, + getSopType1() { + getSopType1() + .then((res) => { + let { code, data } = res.data; + let list = []; + if (code) { + list = data.map((v) => ({ + title: v.type1, + value: v.type1, + })); + } + this.columns[0].search.selectOptions = list; + }) + .catch((err) => { + console.log(err); + }); + }, + getSopType2(type) { + if (type) { + getSopType2(type) + .then((res) => { + let { code, data } = res.data; + let list = []; + if (code) { + list = data.map((v) => ({ + title: v.type2, + value: v.type2, + })); + } + this.columns[1].search.selectOptions = list; + }) + .catch((err) => { + console.log(err); + }); + } else { + this.columns[1].search.selectOptions = []; + } + }, + 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; + } + } else { + if (y + 18 + 360 > clientHeight) { + // y = clientHeight - 378; + dir = "top"; + } else { + dir = "bottom"; + } + if (x < 400) { + x = 400; + } + if (x + 400 > clientWidth) { + x = clientWidth - 400; + } + } + this.popPosition.x = x; + this.popPosition.y = y; + this.popPosition.dir = dir; + this.popInfo = obj; + 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), + }, + }; + }, + 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.resObj = []; + return false; + } + let loading = this.$layer.loading(); + const formData = new FormData(); + formData.append("multipartFile", this.file1); + fileParse(formData) + .then((res) => { + this.$layer.close(loading); + let { code, data, data2, msg } = res.data; + if (code && data) { + let rowId = this.resObj.rowId; + this.resObj = data2; + this.resObj.id = rowId; + this.$message.success("瑙f瀽鎴愬姛"); + } else { + this.$message.error(msg); + } + }) + .catch((error) => { + this.$layer.close(loading); + console.log(error); + }); + }, + resize() { + setTimeout(() => { + this.update = Math.random(); + }, 200); + }, + activeFN() { + this.resize(); + }, + onSearch(conditions, searchOptions, col) { + // console.log(conditions); + // console.log(searchOptions, "00", col); + this.pageCurr = 1; + this.conditions = conditions; + if ("parentType" == col.dataIndex) { + this.parentTypeChange(col.search.value); + } + 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) { + this.conditions = conditions; + this.searchData(); + }, + // 鏂囦欢绫诲瀷鏌ヨ鏉′欢鍙戠敓鍙樺寲 鏌ヨ瀛愭枃浠剁被鍨嬪垪琛� 閲嶇疆瀛愭枃浠剁被鍨嬪�� + parentTypeChange(val) { + let _search = this.columns[1].search; + _search.value = []; + this.conditions["chileType"] = []; + this.getSopType2(val); + }, + searchData() { + const { pageCurr, pageSize, conditions, columns } = this; + let params = { pageCurr, pageSize }; + let data = {}; + Object.keys(conditions).forEach((v) => { + switch (v) { + // case "code": + // case "model": + // break; + case "status": + params[v] = conditions[v] ? 1 : 0; + break; + case "parentType": + case "chileType": + data[v] = conditions[v]; + break; + + default: + params[v] = conditions[v]; + break; + } + }); + params.status = 1; + params.code = this.parentCode; + let list = []; + let params2 = "{}" == JSON.stringify(data) ? [] : [data]; + getList(params, params2) + .then((res) => { + let { code, data, data2 } = res.data; + let total = 0; + if (code && data) { + // console.log(data2); + list = data2.list; + total = data2.total; + } + this.dataSource = list.map((item) => { + const fileInfo = getFileTypeAndName(item.fileUrl); + item.isCanPreview = fileInfo.type === "pdf"; + return item; + }); + this.total = total; + this.getSopType1(); + if (-1 == this.update) { + this.update = Math.random(); + } + }) + .catch((err) => { + console.log(err); + }); + }, + downloadFile(record) { + const fileInfo = getFileTypeAndName(record.fileUrl); + let url = this.webUrl + record.fileUrl; + if (fileInfo.type === "pdf") { + // 棰勮 + window.open(url); + } else { + // 涓嬭浇 + let loading = this.$layer.loading(); + let link = document.createElement("a"); + link.style.display = "none"; + let fileName = record.fileUrl.split("/").pop(); + link.href = url; + link.download = fileName; + document.body.appendChild(link); + link.click(); + this.$layer.close(loading); + document.body.removeChild(link); + } + }, + reasonCancel() { + this.reasonVisible = false; + }, + reasonOk() { + let { id, status } = this.currentObj; + let reason = this.reason; + status = status == 0 ? 1 : 0; + sopLock(id, status, reason).then((res) => { + const { code } = res.data; + if (code) { + this.$message.success("鎿嶄綔鎴愬姛"); + this.reasonVisible = false; + this.searchData(); + } else { + this.$message.error("鎿嶄綔澶辫触"); + } + }); + }, + lock(record) { + this.reason = ""; + this.currentObj = record; + this.reasonVisible = true; + }, + viewLog(obj) { + // console.log(obj); + const { id, fileVersion } = obj; + getLogList(id).then((res) => { + const { code, data, data2 } = res.data; + if (code) { + this.logList = data2.map((v) => ({ ...v, fileVersion })); + this.logVisible = true; + } else { + this.$message.error("鏃ュ織鏌ヨ澶辫触"); + } + }); + }, + logCancel() { + this.logVisible = false; + }, + pdfCancel() { + this.pdfInfo.visible = false; + }, + goHistory(record) { + let { fileName } = record; + this.$router.push({ + path: "/resource/sop-history", + query: { fileName }, + }); + }, + }, + mounted() { + this.searchData(); + this.searchAllUserList(); + this.getSopType1(); + window.addEventListener("resize", this.resize); + }, + destroyed() { + window.removeEventListener("resize", this.resize); + }, }; </script> <style scoped lang="less"> .main { - height: 100%; - position: relative; - .inner { - position: absolute; - left: 0; - top: 0; - right: 0; - bottom: 0; - } + height: 100%; + position: relative; + .inner { + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + } } .img-wraper { - width: 80px; - height: 50px; - display: inline-block; - .image-view { - width: 100%; - height: 100%; - /deep/img { - width: 100%; - height: 100%; - object-fit: contain; - } - } + width: 80px; + height: 50px; + display: inline-block; + .image-view { + width: 100%; + height: 100%; + /deep/img { + width: 100%; + height: 100%; + object-fit: contain; + } + } } /deep/table { - table-layout: fixed; + table-layout: fixed; } .modal-footer { - text-align: right; - button + button { - margin-left: 8px; - } + text-align: right; + button + button { + margin-left: 8px; + } } .label { - display: flex; - justify-content: flex-end; - align-items: center; - padding-right: 0.4em; - height: 32px; - &::after { - content: ":"; - } + display: flex; + justify-content: flex-end; + align-items: center; + padding-right: 0.4em; + height: 32px; + &::after { + content: ":"; + } } .row ~ .row { - margin-top: 10px; + margin-top: 10px; } .sub-title { - font-size: 14px; - font-weight: 700; - margin-top: 10px; + font-size: 14px; + font-weight: 700; + margin-top: 10px; } .res-content { - max-height: 260px; - overflow-y: auto; - margin-bottom: 10px; + max-height: 260px; + overflow-y: auto; + margin-bottom: 10px; } .btn-grp button { - width: 6.4em; + width: 6.4em; } .tag-all { - margin: 0; + margin: 0; } /deep/ .ant-table-fixed-right { - .ant-table-body-outer { - margin-bottom: 0 !important; - } - .ant-table-body-inner { - overflow-x: hidden; - } + .ant-table-body-outer { + margin-bottom: 0 !important; + } + .ant-table-body-inner { + overflow-x: hidden; + } } .log-content { - max-height: 400px; - overflow-y: auto; + max-height: 400px; + overflow-y: auto; - .user { - color: #23aaf2; - font-weight: 700; - } + .user { + color: #23aaf2; + font-weight: 700; + } - .time { - color: #f9be13; - font-weight: 700; - } + .time { + color: #f9be13; + font-weight: 700; + } - .version { - color: #0aedb2; - font-weight: 700; - } + .version { + color: #0aedb2; + font-weight: 700; + } - .ant-timeline-item:first-of-type { - padding-top: 6px; - } + .ant-timeline-item:first-of-type { + padding-top: 6px; + } } </style> -- Gitblit v1.9.1