From d8f97ebbbe27affff762f4f131f29f773e4c4738 Mon Sep 17 00:00:00 2001 From: he wei <858544502@qq.com> Date: 星期六, 21 十月 2023 08:55:43 +0800 Subject: [PATCH] UA 物料图纸历史 0809详情等修改 --- src/pages/components/filesTable.vue | 160 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 150 insertions(+), 10 deletions(-) diff --git a/src/pages/components/filesTable.vue b/src/pages/components/filesTable.vue index 61ed668..2d1d2a1 100644 --- a/src/pages/components/filesTable.vue +++ b/src/pages/components/filesTable.vue @@ -13,14 +13,32 @@ > <template slot="action" slot-scope="text, record"> <div v-if="record.url"> - <a v-if="!record.lockFlag && ((record.fileType == 'dwg' && canViewDoc) || (record.fileType != 'dwg' && canViewOther))" @click="view(record)">棰勮</a> - <template v-if="((record.fileType == 'dwg' && canDownloadDoc) || (record.fileType != 'dwg' && canDownloadOther)) && !record.lockFlag"> + <a + v-if=" + !record.lockFlag && + ((record.fileType == 'dwg' && canViewDoc) || + (record.fileType != 'dwg' && canViewOther)) + " + @click="view(record)" + >棰勮</a + > + <template + v-if=" + ((record.fileType == 'dwg' && canDownloadDoc) || + (record.fileType != 'dwg' && canDownloadOther)) && + !record.lockFlag + " + > <a-divider type="vertical"></a-divider> <a @click="downloadReason(record)">涓嬭浇</a> </template> <template v-if="canLockOther && (id || productId)"> <a-divider v-if="!record.lockFlag" type="vertical"></a-divider> <a @click="lock(record)">{{ record.lockFlag ? "瑙i攣" : "閿佸畾" }}</a> + </template> + <template v-if="isOwnerDwg(record)"> + <a-divider type="vertical"></a-divider> + <a @click="history(record)">鍘嗗彶</a> </template> </div> </template> @@ -50,7 +68,46 @@ /> </a-form-model-item> </a-modal> - <download-reason :reason-visible.sync="downloadReasonVisible" v-if="downloadReasonVisible" @ok="downloadReasonOk"></download-reason> + <download-reason + :reason-visible.sync="downloadReasonVisible" + v-if="downloadReasonVisible" + @ok="downloadReasonOk" + ></download-reason> + <a-modal + :visible="dwgHisVisible" + title="鐗╂枡鍥剧焊鍘嗗彶" + :width="860" + :destroyOnClose="true" + @cancel="dwgHisClose" + > + <a-table + ref="table" + :columns="dwgColumns" + :dataSource="dwgDataSource" + :scroll="{ x: 400, y1 }" + :row-key="(record, index) => index" + :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, + }" + > + <template slot="action" slot-scope="text, record"> + <a @click="dwgReview(record.url)">棰勮</a> + </template> + </a-table> + <template v-slot:footer> + <a-button @click="dwgHisClose">鍏抽棴</a-button> + </template> + </a-modal> </div> </template> @@ -58,11 +115,11 @@ import getWebUrl from "@/assets/js/tools/getWebUrl"; import { dwgReview } from "@/pages/workplace/apis"; // import { downloadLog } from "@/pages/system/logs/apis"; -import { downLoadFileByFilePath } from "@/assets/js/apis"; +import { downLoadFileByFilePath, getDwgHisById } from "@/assets/js/apis"; import { updateAttachLock } from "@/pages/resourceManage/materialsCenter/apis"; import { updateProductLock } from "@/pages/resourceManage/product/details/apis"; import checkPermit from "@/assets/js/tools/checkPermit"; -import DownloadReason from '@/pages/components/downloadReason'; +import DownloadReason from "@/pages/components/downloadReason"; import PERMITS from "@/assets/js/const/const_permits"; import { mapGetters } from "vuex"; export default { @@ -83,6 +140,10 @@ return null; }, }, + subModel: { + type: String, + default: "", + }, // 绫诲瀷 浜у搧12 鐗╂枡13 type: { type: Number, @@ -90,8 +151,8 @@ }, oprateVersion: { type: Number, - default: 0 - } + default: 0, + }, }, data() { const columns = [ @@ -117,12 +178,35 @@ dataIndex: "operation", key: "operation", align: "center", + width: 200, + scopedSlots: { customRender: "action" }, + }, + ]; + const dwgColumns = [ + { + title: "鏂囦欢鍚嶇О", + dataIndex: "fileName", + align: "center", + width: 200, + }, + { + title: "鎿嶄綔", + dataIndex: "operation", + key: "operation", + align: "center", width: 140, scopedSlots: { customRender: "action" }, }, ]; return { - downloadUrl: '', + dwgHisVisible: false, + dwgColumns, + dwgDataSource: [], + pageCurr: 1, + pageSize: 10, + total: 0, + y1: 400, + downloadUrl: "", downloadReasonVisible: false, reason: "", reasonVisible: false, @@ -164,6 +248,9 @@ handleCancel() { this.previewVisible = false; }, + dwgHisClose() { + this.dwgHisVisible = false; + }, dwgReview(url) { let loading = this.$layer.loading(); dwgReview(url) @@ -191,7 +278,13 @@ downloadLog(url, reason) { let reg = /(.*\\+)*(.*)$/; let fileName = url.match(reg)[2]; - downLoadFileByFilePath(url, reason, this.info.oprateInfo, this.oprateVersion, this.type).then((res) => { + downLoadFileByFilePath( + url, + reason, + this.info.oprateInfo, + this.oprateVersion, + this.type + ).then((res) => { let { data, status } = res; if (200 == status && data) { let url = window.URL.createObjectURL(data); @@ -230,7 +323,7 @@ localReason: this.reason, lockFlag, materialId: this.id ? this.id : undefined, - productId: this.productId ? this.productId : undefined + productId: this.productId ? this.productId : undefined, }; let update = isProd ? updateProductLock : updateAttachLock; update([params]).then((res) => { @@ -245,6 +338,53 @@ } }); }, + isOwnerDwg(record) { + if (!this.subModel) { + return false; + } + let reg = new RegExp("^" + this.subModel, "i"); + return reg.test(record.fileName) && record.fileType == "dwg"; + }, + history(record) { + this.getList(); + this.dwgHisVisible = true; + }, + getList() { + getDwgHisById(this.id, this.pageCurr, this.pageSize) + .then((res) => { + let { code, data, data2 } = res.data; + let list = []; + let total = 0; + if (code && data) { + // console.log(data); + let reg = /(.*\\+)*(.*)$/; + list = data2.list.map((item) => { + let url = item.dwgUrl; + let fileName = url.match(reg)[2]; + return { + fileName, + url, + }; + }); + total = data2.total; + } + this.dwgDataSource = list; + this.total = total; + }) + .catch((err) => { + console.log(err); + }); + }, + onPageChange(page, pageSize) { + this.pageCurr = page; + this.pageSize = pageSize; + this.getList(); + }, + onSizeChange(current, size) { + this.pageCurr = 1; + this.pageSize = size; + this.getList(); + }, }, computed: { dataSource() { -- Gitblit v1.9.1