Browse Source

Merge remote-tracking branch 'origin/master'

sangwenwei 5 months ago
parent
commit
d2e90cb899
3 changed files with 36 additions and 11 deletions
  1. 9 0
      src/api/workCollectAccessory/index.js
  2. 11 7
      src/views/attachment/Form.vue
  3. 16 4
      src/views/attachment/List.vue

+ 9 - 0
src/api/workCollectAccessory/index.js

@@ -76,4 +76,13 @@ export default {
 			},
 		});
 	},
+
+	// 根据分类去重查询
+	getClassificationList(param) {
+		return request({
+			url: prefix + "/workCollectAccessory/getClassificationList",
+			method: "get",
+			params: param,
+		});
+	},
 };

+ 11 - 7
src/views/attachment/Form.vue

@@ -2,7 +2,8 @@
 	<div>
 		<el-dialog :title="title" :close-on-click-modal="false" width="50%" @close="close" @keyup.enter.native=""
 			v-model="visible" @open="handleOpen">
-			<el-form :model="inputForm" ref="inputForm" v-loading="loading" :class="method === 'view' ? 'readonly' : ''"
+			<el-form :model="inputForm" :rules="rules" ref="inputForm" v-loading="loading"
+				:class="method === 'view' ? 'readonly' : ''"
 				:disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" label-width="100px"
 				@submit.native.prevent>
 				<el-divider content-position="left"><i class="el-icon-document"></i>
@@ -77,7 +78,12 @@ export default {
 			keyWatch: '',
 			dateList: [],
 			dictList: [],
-			ossService: null
+			ossService: null,
+			rules: {
+				classification: [
+					{ required: true, message: "请选择收藏分类", trigger: "change" },
+				],
+			},
 		}
 	},
 	created() {
@@ -151,15 +157,13 @@ export default {
 		// 表单提交
 		async doSubmit() {
 			let files = this.$refs.uploadComponent.getDataList()
-			console.log(files);
-			if (files.length <= 0) {
+			if (this.$refs.uploadComponent.checkProgress()) {
 				this.loading = false
-				this.$message.error(`请上传附件后提交`);
 				return
 			}
-			if (this.$refs.uploadComponent.checkProgress()) {
+			if (files.length <= 0) {
 				this.loading = false
-				this.$message.error(`待附件上传完毕后提交`);
+				this.$message.error(`请上传附件后提交`);
 				return
 			}
 			this.loading = true

+ 16 - 4
src/views/attachment/List.vue

@@ -171,7 +171,6 @@ export default {
             $table.connect($toolbar);
         });
         this.refreshList();
-        this.handleGetDict()
     },
     methods: {
         ifName(row) {
@@ -213,9 +212,19 @@ export default {
         },
         //获取字典值
         handleGetDict() {
-            workCollectAccessoryService.queryDictListByName("classification").then((data) => {
-                this.$refs.workCollectAccessoryRef.dictList = data
-                this.dictList = data
+            workCollectAccessoryService.getClassificationList({
+                ...this.searchForm,
+            }).then((data) => {
+                let dictList = data.map(item => {
+                    return {
+                        label: item.classification,
+                        value: item.classification,
+                    }
+                })
+                if (this.activeName == 0) {
+                    this.$refs.workCollectAccessoryRef.dictList = dictList
+                }
+                this.dictList = dictList
             });
         },
         // 判断用户是否已经收藏此文件
@@ -249,6 +258,7 @@ export default {
                         this.$message.success(res);
                         this.loading = false;
                         this.refreshList();
+
                     })
             });
         },
@@ -338,6 +348,8 @@ export default {
                     this.dataList = data.records;
                     this.tablePage.total = data.total;
                     this.loading = false;
+                    // 获取分类去重的数据
+                    this.handleGetDict()
                 });
         },
         // 当前页