From 14a3a423147d31aae2a52e2cf7398ee64794e56f Mon Sep 17 00:00:00 2001 From: he wei <858544502@qq.com> Date: 星期二, 02 一月 2024 18:21:45 +0800 Subject: [PATCH] U 初始筛选条件 --- src/pages/resourceManage/sopFile/list.vue | 143 ++++++++++++++++++++++++++--------------------- src/components/table/advance/SearchArea.vue | 9 +++ 2 files changed, 89 insertions(+), 63 deletions(-) diff --git a/src/components/table/advance/SearchArea.vue b/src/components/table/advance/SearchArea.vue index cbbe5e5..8bc7772 100644 --- a/src/components/table/advance/SearchArea.vue +++ b/src/components/table/advance/SearchArea.vue @@ -85,6 +85,7 @@ }, created() { this.formatColumns(this.columns) + this.setDefault(this.searchCols) }, watch: { columns(newVal, oldVal) { @@ -198,6 +199,14 @@ this.searchOptions = getSearchOptions(this.searchCols) this.$emit('change', this.conditions, this.searchOptions, col) }, + setDefault(columns) { + columns.filter(item => item.search.default != undefined) + .forEach(col => { + // const {value, default} = col.search + col.search.value = col.search.default; + this.backupAndEmitChange(col); + }); + }, getConditions(columns) { const conditions = {} columns.filter(item => item.search.value !== undefined && item.search.value !== '' && item.search.value !== null) diff --git a/src/pages/resourceManage/sopFile/list.vue b/src/pages/resourceManage/sopFile/list.vue index 58d01d2..e9efca6 100644 --- a/src/pages/resourceManage/sopFile/list.vue +++ b/src/pages/resourceManage/sopFile/list.vue @@ -60,8 +60,18 @@ <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> + <a + v-if="record.isCanPreview" + :disabled="!record.status" + @click="downloadFile(record)" + >棰勮</a + > + <a + v-else + :disabled="!record.status" + @click="downloadFile(record)" + >涓嬭浇</a + > </template> <a-divider type="vertical"></a-divider> <a-popover title="" trigger="hover"> @@ -221,19 +231,19 @@ </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> + <!-- 鏃ュ織 --> + <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> @@ -261,27 +271,26 @@ import getFileTypeAndName from "@/assets/js/tools/getFileTypeAndName"; import VuePdf from "vue-pdf"; - export default { components: { AdvanceTable, Pop, DescRes, EmailCard, - VuePdf, + VuePdf, }, name: "list", data() { return { - pdfInfo: { - visible: false, - src: "", - loadedRatio: 0, - page: 1, - numPages: 0, - rotate: 0, - }, - rowFileName: '', + pdfInfo: { + visible: false, + src: "", + loadedRatio: 0, + page: 1, + numPages: 0, + rotate: 0, + }, + rowFileName: "", logList: [], logVisible: false, currentObj: null, @@ -433,15 +442,18 @@ width: 260, customCell: this.customCell, }, - { - title: "鏄惁閿佸畾", - dataIndex: "status", - dataType: "boolean", - align: "center", - searchAble: true, - width: 100, - scopedSlots: { customRender: "status" }, - }, + { + title: "鏄惁閿佸畾", + dataIndex: "status", + dataType: "boolean", + align: "center", + searchAble: true, + width: 100, + search: { + default: true, + }, + scopedSlots: { customRender: "status" }, + }, { title: "鎿嶄綔", dataIndex: "operation", @@ -590,7 +602,7 @@ let name2 = fileName + fileVersion; if (name1.toLowerCase() != name2.toLowerCase()) { - console.log(name1.toLowerCase()+"&&&&&&"+ name2.toLowerCase()); + console.log(name1.toLowerCase() + "&&&&&&" + name2.toLowerCase()); this.$message.error("sop涓庤鏄庢枃浠跺彲鑳戒笉鍖归厤"); return false; } @@ -628,7 +640,9 @@ return false; } - if (this.rowFileName.toLowerCase() != this.resObj.fileName.toLowerCase()) { + if ( + this.rowFileName.toLowerCase() != this.resObj.fileName.toLowerCase() + ) { this.$message.error("璇存槑鏂囦欢涓庤鏉¤褰曞彲鑳戒笉鍖归厤"); return false; } @@ -835,15 +849,16 @@ const { pageCurr, pageSize, conditions, columns } = this; let params = { pageCurr, pageSize }; let data = {}; + console.log(this.conditions['status']); 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 "status": + params[v] = conditions[v] ? 1 : 0; + break; case "parentType": case "chileType": data[v] = conditions[v]; @@ -861,10 +876,10 @@ list = data2.list; total = data2.total; } - this.dataSource = list.map(item=>{ - const fileInfo = getFileTypeAndName(item.fileUrl); - item.isCanPreview = fileInfo.type === "pdf"; - return item; + this.dataSource = list.map((item) => { + const fileInfo = getFileTypeAndName(item.fileUrl); + item.isCanPreview = fileInfo.type === "pdf"; + return item; }); this.total = total; this.getSopType1(); @@ -877,22 +892,24 @@ }); }, 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); - } + 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; @@ -933,9 +950,9 @@ logCancel() { this.logVisible = false; }, - pdfCancel() { - this.pdfInfo.visible = false; - }, + pdfCancel() { + this.pdfInfo.visible = false; + }, goHistory(record) { let { fileName } = record; this.$router.push({ -- Gitblit v1.9.1