zhuhao 1 éve
szülő
commit
cfabf7da14

+ 3 - 3
src/api/newApi/event.js

@@ -23,9 +23,9 @@ export default {
   /**
   * 修改事件
   */
-  // eventUpdate(data) {
-  //  return axios.post('/v2/event/update', data)
-  // },
+  updateEvent(data) {
+   return axios.post('/xiaoshi/event/updateEvent', data)
+  },
   /**
   * 删除事件
   */

+ 8 - 10
src/views/event/components/dialog/addEvent.vue

@@ -12,9 +12,8 @@
             </el-autocomplete>
           </el-form-item>
           <el-form-item label="所属客户" prop="clientId" v-if="userinfo.tenantType == 1" >
-          <!-- <el-form-item label="所属客户" prop="clientId"> -->
             <!-- <el-select v-model="formData[0].clientId" :disabled="(formData[0].id && !this.row) ? true : false" -->
-            <el-select v-model="formData[0].clientId" clearable
+            <el-select ref="select" v-model="formData[0].clientId" clearable
               style="width: 100%;" placeholder="请选择客户">
               <el-option
                 v-for="item in clientList"
@@ -35,7 +34,7 @@
           </el-form-item>
           <el-form-item label="事件场景" prop="scenarioId">
             <!-- <el-select v-model="formData[0].applicationScenarios[0]" :disabled="(formData[0].id && !this.row) ? true : false" -->
-            <el-select v-model="formData[0].scenarioId" 
+            <el-select ref="select2" v-model="formData[0].scenarioId" 
               style="width: 100%;" placeholder="请选择事件场景">
               <el-option
                 v-for="item in commonData.ENTERPRISE_APPLICATION_SCENARIO ? commonData.ENTERPRISE_APPLICATION_SCENARIO : []"
@@ -191,9 +190,7 @@ export default {
       this.type = type
       if (data) {
         this.title = '编辑事件'
-        let form = JSON.parse(JSON.stringify(data))
-        this.$set(this.formData, 0, form)
-        // console.log(this.formData);
+        this.$set(this.formData, 0, data)
       } else {
         if (this.type == 1) {
           this.title='新增事件'
@@ -213,8 +210,9 @@ export default {
     },
     //关闭弹窗
     handleClose() {
-      if (this.type=='1') {
-        console.log(this.type);
+      if (this.type == '1') {
+        this.$refs.select.blur()
+        this.$refs.select2.blur()
         this.$refs.ruleForm.resetFields()
       }
       this.dialogVisible = false
@@ -285,11 +283,12 @@ export default {
     },
     //提交保存、编辑事件接口
     addInterface(forms) {
+      this.$emit('isAddEdit',forms)
       let formData = new FormData()
       // formData.append('file')//文件数据
       formData.append('event', JSON.stringify(forms[0]))
       if (forms[0].id) {//编辑
-        this.$api.eventEditEvent(formData).then(res => {
+        this.$api.updateEvent(formData).then(res => {
           if (res.code == 200) {
             this.$emit('isSuccess','编辑成功')
             this.$message.success('事件编辑成功')
@@ -372,7 +371,6 @@ export default {
     async querySearchQuestion(queryString, cb) {
       this.eventInput=queryString
       await this.questionEventList()
-      console.log(this.questionNameArr, cb);
       var records=[]
       this.questionNameArr.forEach(item => {
         item.value = item.name

+ 24 - 8
src/views/event/components/index.vue

@@ -48,6 +48,9 @@
             :groupBy='groupingValue'
             :groupingOption="groupingOption"
             :searchOption="searchOption"
+            :addEditData="addEditData"
+            :deleData="deleData"
+            @getData="getData"
           ></component>
         </div>
       </el-main>
@@ -65,7 +68,7 @@
       </el-footer>
     </el-container>
 
-    <addEvent ref="addEvent"  @isSuccess="handleSuccess"></addEvent>
+    <addEvent ref="addEvent"  @isSuccess="handleSuccess" @isAddEdit="isAddEdit"></addEvent>
     <fields ref="field"></fields>
   </div>
 </template>
@@ -126,7 +129,11 @@ export default {
       //场景
       scene:[],
       //表格全部栏位
-      fieldList:[],
+      fieldList: [],
+      // 分组时新增或编辑事件数组
+      addEditData: [],
+      // 分组时删除事件数组
+      deleData:[],
     };
   },
   watch: {},
@@ -145,13 +152,19 @@ export default {
         this.scene = response.data.ENTERPRISE_APPLICATION_SCENARIO  
       })
     },
+    // 分组时若删除当前分组最后一条数据时重新请求分组接口
+    getData(val) {
+      this.getGrouping()
+    },
+    // 子组件新增事件、编辑事件成功往孙组件table发送数据
+    isAddEdit(val) {
+      this.addEditData=val
+    },
     // 子组件新增事件成功
     handleSuccess(val) {
-      // console.log(val);
       this.queryParams.current = 1
       this.searchOption.searchQuery=''
       this.getList()
-      // this.isGrouping()
     },
     //显示视图?
     showViews() {
@@ -229,7 +242,9 @@ export default {
       this.$api.queryEvent(params).then(res => {
         if (res.code == 200) {
           this.tableData = res.data.data
-          this.total=res.data.total
+          if (!this.groupingValue) {
+            this.total=res.data.total
+          }
         }
       }).catch(err => {
         this.tableData = []
@@ -284,12 +299,11 @@ export default {
           this.$refs.field.open(this.fieldList)
           break;
       }
-      
     },
 
     //获取排序字段// 子组件table排序
     handleSort({ column, prop, order, str }) {
-      this.sort=[]
+      this.sort=[]//如需要多个字段排序,则不需要清空
       if (order == 'null') {
         return;
       }
@@ -336,19 +350,21 @@ export default {
           break;
         case 'cancel'://取消关联
           break;
-        case 'edit'://编辑事件,打开单件事件弹窗
+        case 'edit'://编辑事件,打开单件事件弹窗,1代表单个事件弹窗
           this.$refs.addEvent.open(row, 1)
           break;
       }
     },
     // 删除事件
     eventDelete(row) {
+      this.deleData=[]
       this.$confirm('此操作将删除该事件, 是否继续?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
         // 调用接口
+        this.deleData.push(row)
         let params = [ row.id ]
         this.$api.deleteEvent(params).then(res => {
           if (res.code == 200) {

+ 0 - 1
src/views/event/components/mixins/index.js

@@ -57,7 +57,6 @@ export default {
   methods: {
     // 点击名称等事件
     handleItem(row, key) {
-      // console.log(row,key);
       let path = {}
       let router=this.$router.resolve({
         path: '',

+ 10 - 2
src/views/event/components/view/mergeTable.vue

@@ -4,7 +4,7 @@
       <el-table-column type="expand">
         <template slot-scope="props">
           <div style="padding: 10px;height: 340px;">
-            <Table  :column="column"  @option="handleOption" :row="{row:props.row,groupBy:groupBy,searchOption:searchOption}"/>
+            <Table  :column="column"  @option="handleOption" :row="{row:props.row,groupBy:groupBy,searchOption:searchOption,}" :addEditData="addEditData" :deleData="deleData" @getData="getData"/>
           </div>
         </template>
       </el-table-column>
@@ -25,6 +25,10 @@ import Table from "./table";
 
 export default {
   props: {
+    // 分组时删除事件数组
+    deleData:Array,
+    // 分组时新增或编辑事件数组
+    addEditData:Array,
     // 检索条件
     searchOption: {
       type: Object,
@@ -112,6 +116,10 @@ export default {
     
   },
   methods: {
+    // 分组时若删除当前分组最后一条数据时重新请求分组接口
+    getData(val) {
+      this.$emit('getData',val)
+    },
     // 排序
     sortChange({ column, prop, order }) {
       let str='1'
@@ -123,7 +131,7 @@ export default {
     },
     //打开展开行获取数据并保存起来
     expandChange(row, expandedRows) {
-      
+
     }
   }
 }

+ 34 - 18
src/views/event/components/view/table.vue

@@ -106,7 +106,9 @@ export default {
         ]
       }
     },
-    row: null
+    row: null,
+    editData:null,
+    addEditData:null,
   },
   data() {
     return {
@@ -125,14 +127,35 @@ export default {
     };
   },
   watch: {
-
+    // 分组时新增或编辑事件处理
+    'addEditData'(val) {
+      let a = this.tableData.findIndex(item => {
+        return item.id == val[0].id
+      })
+      if (a != -1) {
+        this.$set(this.tableData,[a],val[0])
+      } else {
+        this.$set(this.tableData, [this.tableData.length], val[0])
+      }
+    },
+    'deleData'(val) {
+      let a = this.tableData.findIndex(item => {
+        return item.id == val[0].id
+      })
+      if (a != -1) {
+        this.tableData.splice(a, 1)
+        // 分组时若删除当前分组最后一条数据时重新请求分组接口
+        if (this.tableData.length==0) {
+          this.$emit('getData',true)
+        }
+      }
+    },
   },
   mounted() {
     if (!this.row) {
       this.disabled = true
     } else {
       this.disabled = false
-      // this.getList()
     }
   },
   methods: {
@@ -140,21 +163,14 @@ export default {
       if (!this.row) return;
       if (this.params.current * this.params.size >= this.params.total) {
         this.isMore = true
-        if (!this.row.searchOption) {
-          this.disabled = true
-        }
+        this.disabled = true
         setTimeout(() => {
           this.isMore = false;
           this.isFlag = false
         }, 1000)
       }
       if (this.disabled) return;
-      if (!this.row.searchOption) {
-        this.params.current += 1
-      } else {
-        this.params.current = 1
-        this.tableData=[]
-      }
+      this.params.current += 1
       let params = {
         ...this.params,
         ...this.row.searchOption,//检索条件
@@ -166,14 +182,12 @@ export default {
       this.isFlag = true;
       this.$api.queryEvent(params).then(res => {
         if (res.code == 200) {
-          this.tableData = this.tableData.concat(res.data.data)
+          this.tableData.push(...res.data.data)
           this.params.total = res.data.total
         }
       }).catch(err => {
-        this.tableData = []
       })
       setTimeout(() => {
-
         this.isMore = false;
         this.isFlag = false
       }, 1000)
@@ -185,6 +199,7 @@ export default {
     },
     // 排序方法
     handleSort({ column, prop, order }) {
+      this.sort=[]//如需要多个字段排序,则不需要清空
       if (order == 'null') {
         return;
       }
@@ -203,7 +218,9 @@ export default {
         params.orderType = orderType[order]
         this.sort.push(params)
       }
-      this.getList()
+      this.params.current = 0
+      this.disabled = false
+      this.tableData.splice(0)
     },
     // 数据处理
     getColumnData(row, key) {
@@ -213,8 +230,7 @@ export default {
         } else {
           return '--'
         }
-      }
-      else if (key == 'eventDate') {
+      }else if (key == 'eventDate') {
         if (row.eventDate) {
           return row.eventDate.slice(0, 10)
         } else {

+ 1 - 1
src/views/product/components/dialog/classifyNode.vue

@@ -1,5 +1,5 @@
 <template>
-  <!-- 新增/编辑分类节点 -->
+  <!-- 新增/编辑架构分类节点 -->
   <div class="classifyNode">
     <el-dialog :title="title" :visible.sync="dialogVisible" :before-close="handleClose" width="600px" :close-on-click-modal="false">
       <el-form :model="form" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">