ldong před 2 týdny
rodič
revize
b0ed387544

+ 13 - 8
src/views/knowledge_manage/components/importMoreFileDia.vue

@@ -62,7 +62,8 @@
           </el-table-column>
           <el-table-column label="操作" width="80" align="center">
             <template slot-scope="scope">
-              <el-button type="text" style="color: #F56C6C;" size="small" @click="deleteRow(scope.$index)">删除</el-button>
+              <el-button type="text" style="color: #F56C6C;" size="small"
+                @click="deleteRow(scope.$index)">删除</el-button>
             </template>
           </el-table-column>
           <div slot="empty" style="padding: 20px 0">
@@ -177,8 +178,12 @@ export default {
   },
   methods: {
     // 删除
-    deleteRow(index){
-      this.eventForm.tableData.splice(index,1)
+    deleteRow(index) {
+      if (this.eventForm.tableData.length < 2) {
+        this.$message.warning('当前仅剩一条文件信息时不可删除!')
+        return
+      }
+      this.eventForm.tableData.splice(index, 1)
     },
     // 批量设置
     setMore() {
@@ -211,10 +216,10 @@ export default {
 
     async handleConfirmSet() {
       await this.$refs.setRef.validate()
-      this.eventForm.tableData.forEach((el,index)=>{
-        const arr=['classifyId','source','tagId','startTime','endTime']
-        arr.forEach(item=>{
-          this.$set(this.eventForm.tableData[index],item,this.setForm[item])
+      this.eventForm.tableData.forEach((el, index) => {
+        const arr = ['classifyId', 'source', 'tagId', 'startTime', 'endTime']
+        arr.forEach(item => {
+          this.$set(this.eventForm.tableData[index], item, this.setForm[item])
         })
       })
       this.cancelSet()
@@ -272,7 +277,7 @@ export default {
     },
     cancelSet() {
       this.$refs.setRef.resetFields()
-      this.showSet=false
+      this.showSet = false
     },
 
     cancelHandle() {