Browse Source

Merge remote-tracking branch 'origin/master'

sangwenwei 6 months ago
parent
commit
fe26dd62a8
3 changed files with 37 additions and 14 deletions
  1. 10 0
      src/api/workCollectAccessory/index.js
  2. 10 5
      src/views/attachment/Form.vue
  3. 17 9
      src/views/attachment/List.vue

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

@@ -66,4 +66,14 @@ export default {
 			},
 		});
 	},
+
+	queryDictListByName(dictName) {
+		return request({
+			url: prefix + "/workCollectAccessory/queryDictListByName",
+			method: "get",
+			params: {
+				dictName: dictName,
+			},
+		});
+	},
 };

+ 10 - 5
src/views/attachment/Form.vue

@@ -1,12 +1,12 @@
 <template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
 	<div>
-		<el-dialog :title="title" :close-on-click-modal="false" draggable width="50%" @close="close"
-			@keyup.enter.native="" v-model="visible" @open="handleOpen">
+		<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' : ''"
 				:disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" label-width="100px"
 				@submit.native.prevent>
 				<el-divider content-position="left"><i class="el-icon-document"></i>
-					上传附件
+					附件信息
 				</el-divider>
 				<el-row :gutter="15">
 					<el-col :span="24">
@@ -136,9 +136,13 @@ export default {
 							this.inputForm.workAttachments.push(file)
 							this.inputForm.classification = res.classification
 							this.inputForm.fileDescription = res.fileDescription
-							console.log(this.inputForm.workAttachments);
 
-							this.$refs.uploadComponent.newUpload(method, this.inputForm.workAttachments, 'workCollect')
+							// 附件创建人不是本人的话,禁用再次上传
+							if (res.createById != this.$store.state.user.id) {
+								this.$refs.uploadComponent.newUpload('view', this.inputForm.workAttachments, 'workCollect', null, null, false)
+							} else {
+								this.$refs.uploadComponent.newUpload(method, this.inputForm.workAttachments, 'workCollect')
+							}
 						})
 					})
 				}
@@ -189,6 +193,7 @@ export default {
 			this.inputForm = {
 				id: '',
 			}
+			this.$emit("onFreshDict")
 			this.visible = false
 			this.$refs.uploadComponent.clearUpload()
 		},

+ 17 - 9
src/views/attachment/List.vue

@@ -3,13 +3,18 @@
         <el-form :inline="true" class="query-form m-b-10" v-if="searchVisible" ref="searchForm" :model="searchForm"
             @keyup.enter="refreshList()" @submit.prevent>
             <!-- 搜索框-->
-            <el-form-item prop="fileName" label="附件名称">
+            <el-form-item prop="fileName" label="附件名称:">
                 <el-input style="width: 200px;" v-model="searchForm.fileName" placeholder="请输入附件名称"
                     clearable></el-input>
             </el-form-item>
-            <el-form-item prop="userName" label="上传人">
+            <el-form-item prop="userName" label="上传人:">
                 <el-input style="width: 200px;" v-model="searchForm.userName" placeholder="请输入上传人" clearable></el-input>
             </el-form-item>
+            <el-form-item prop="userName" label="收藏分类:">
+                <el-select v-model="searchForm.classification" clearable placeholder="请选择收藏分类">
+                    <el-option v-for="(item, index) in dictList" :key="index" :label="item.label" :value="item.value" />
+                </el-select>
+            </el-form-item>
             <el-form-item>
                 <el-button type="primary" @click="refreshList()" icon="search">查询</el-button>
                 <el-button type="default" @click="resetSearch()" icon="refresh-right">重置</el-button>
@@ -19,7 +24,7 @@
         <div class="jp-table">
             <vxe-toolbar ref="dataSetToolbar" :refresh="{ query: refreshList }" export print custom>
                 <template #buttons>
-                    <el-button v-if="hasPermission('database:datamodel:dataSet:add')" type="primary" icon="plus"
+                    <el-button v-if="hasPermission('attachment:add')" type="primary" icon="plus"
                         @click="add()">上传附件</el-button>
                 </template>
                 <template #tools>
@@ -43,7 +48,7 @@
                             <div>
                                 <el-link type="primary" :underline="false" @click="showFile(scope.row)">{{
                                     scope.row.fileName
-                                }}</el-link>
+                                    }}</el-link>
                             </div>
                         </template>
                     </vxe-column>
@@ -60,7 +65,7 @@
                     <vxe-column fixed="right" align="center" width="320" title="操作">
                         <template #default="scope">
                             <el-button v-if="
-                                activeName == '0' && scope.row.createById == userInfo.id
+                                activeName == '0'
                             " type="success" text @click="edit(scope.row.id)">编辑</el-button>
                             <el-button v-if="activeName == '0' && !scope.row.officeId && scope.row.collectType != 1"
                                 type="primary" text @click="share(scope.row.id, '1')">部门共享</el-button>
@@ -111,7 +116,8 @@
 
         </v-dialog>
         <el-image-viewer hide-on-click-modal v-if="showViewer" @close="closeViewer" :url-list="[url]" zIndex="9999" />
-        <workCollectAccessoryForm @refreshList="refreshList" ref="workCollectAccessoryRef"></workCollectAccessoryForm>
+        <workCollectAccessoryForm @refreshList="refreshList" @onFreshDict="handleGetDict" ref="workCollectAccessoryRef">
+        </workCollectAccessoryForm>
     </div>
 </template>
 
@@ -150,7 +156,8 @@ export default {
             interfaceTable: [],
             loading: false,
             userInfo: {},
-            ossService: null
+            ossService: null,
+            dictList: []
         };
     },
     activated() {
@@ -164,6 +171,7 @@ export default {
             $table.connect($toolbar);
         });
         this.refreshList();
+        this.handleGetDict()
     },
     methods: {
         ifName(row) {
@@ -191,7 +199,6 @@ export default {
         showFile(row) {
             if (this.ifName(row)) {
                 this.ossService.getTemporaryUrl(row.url).then((data) => {
-                    console.log(data);
                     this.onPreview(data)
                 })
             } else {
@@ -206,8 +213,9 @@ export default {
         },
         //获取字典值
         handleGetDict() {
-            dictService.getDictListMapByDict("classification").then((data) => {
+            workCollectAccessoryService.queryDictListByName("classification").then((data) => {
                 this.$refs.workCollectAccessoryRef.dictList = data
+                this.dictList = data
             });
         },
         // 判断用户是否已经收藏此文件