Prechádzať zdrojové kódy

修改组回显数据

FinalYu 2 rokov pred
rodič
commit
d04c94c6f1

+ 75 - 50
chuanyi_client2/src/components/HeaderMain/index.vue

@@ -441,10 +441,11 @@
         :visible.sync="dialogReportEventConfigVisible"
         :close-on-click-modal="false"
         :append-to-body="true">
-      <el-form :model="reportEventConfigForm" ref="reportEventConfigForm" :rules="reportEventConfigFormRules" label-position="top">
+      <el-form :model="reportEventConfigForm" ref="reportEventConfigForm" :rules="reportEventConfigFormRules" label-position="top"
+               style="height: 50vh; overflow: auto;">
         <el-form-item label="条件数据项:" prop="itemName">
           <el-radio-group v-model="reportEventConfigForm.itemName">
-            <el-radio v-for="item in groupBasicForm.itemList" :label="item.itemName" style="margin: 5px 0;">
+            <el-radio v-for="item in groupBasicForm.itemList" :label="item.itemName" style="margin: 5px 0; width: 100%;">
               {{ item.itemName }}
             </el-radio>
           </el-radio-group>
@@ -702,7 +703,7 @@ export default {
       } else if (this.groupRateForm.readMode == 2) {
         tips = '条件值'
       } else {
-        tips = '模式值'
+        tips = '周期值'
       }
       if (value == null) {
         callback(new Error(tips + '不能为空'))
@@ -944,6 +945,7 @@ export default {
         daySetting: [],
         valuePeriod: ['00:00:00', '23:59:59']
       }
+      this.updateGroupData = null
       this.chooseItemDataView = false
       this.getDataSourceList()
       this.groupDialogVisible = true
@@ -979,6 +981,8 @@ export default {
             for (let i = 0; i < _itemList.length; i ++) {
               if (_itemList[i].itemName == this.reportEventConfigForm.itemName) {
                 _itemList[i].tableReportId = this.reportEventConfigForm.tableReportId
+              } else {
+                _itemList[i].tableReportId = null
               }
             }
           }
@@ -1090,35 +1094,7 @@ export default {
         this.chooseItemDataView = true
         this.groupDialogTitle = '修改数据组'
         this.groupRateForm.readMode = item.readMode + ''
-        this.groupRateForm.modeValue = item.modeValue
-        if (item.readMode == 0) { // 周期
-          if (parseInt(item.modeValue) % 3600 == 0) { // 时
-            this.groupRateForm.modeValueH = item.modeValue / 3600
-            this.groupRateForm.modeValueM = 0
-            this.groupRateForm.modeValueS = 0
-          } else {
-            if ((parseInt(item.modeValue) % 3600) % 60 == 0) { // 分
-              this.groupRateForm.modeValueH = Math.floor(item.modeValue / 3600)
-              this.groupRateForm.modeValueM = (parseInt(item.modeValue) % 3600) / 60
-              this.groupRateForm.modeValueS = 0
-            } else { // 秒
-              this.groupRateForm.modeValueH = Math.floor(item.modeValue / 3600)
-              this.groupRateForm.modeValueM = Math.floor((parseInt(item.modeValue) % 3600) / 60)
-              this.groupRateForm.modeValueS = (parseInt(item.modeValue) % 3600) % 60
-            }
-          }
-        } else if (item.readMode == 1) { // 值改变读取
-          this.groupRateForm.readModeType = item.readModeType
-        } else if (item.readMode == 2) { // 条件读取
-          this.groupRateForm.eventMode = item.eventMode
-          let _itemList = item.itemList
-          for (let i = 0; i < _itemList.length; i ++) {
-            if (_itemList[i].tableReportId) {
-              this.reportEventConfigForm.tableReportId = _itemList[i].tableReportId
-              this.reportEventConfigForm.itemName = _itemList[i].itemName
-            }
-          }
-        }
+        this.withReadMode(item, item.readMode)
         this.groupRateForm.valuePeriod = [item.startReadTime, item.endReadTime]
         this.groupRateForm.daySetting = item.readWeek ? item.readWeek.split(',') : []
       }).catch((e) => {
@@ -1126,6 +1102,38 @@ export default {
         showAlertWin(this, e)
       })
     },
+    /** 处理模式不同值显示不同 */
+    withReadMode(item, readMode) {
+      this.groupRateForm.modeValue = item.modeValue
+      if (readMode == 0) { // 周期
+        if (parseInt(item.modeValue) % 3600 == 0) { // 时
+          this.groupRateForm.modeValueH = item.modeValue / 3600
+          this.groupRateForm.modeValueM = 0
+          this.groupRateForm.modeValueS = 0
+        } else {
+          if ((parseInt(item.modeValue) % 3600) % 60 == 0) { // 分
+            this.groupRateForm.modeValueH = Math.floor(item.modeValue / 3600)
+            this.groupRateForm.modeValueM = (parseInt(item.modeValue) % 3600) / 60
+            this.groupRateForm.modeValueS = 0
+          } else { // 秒
+            this.groupRateForm.modeValueH = Math.floor(item.modeValue / 3600)
+            this.groupRateForm.modeValueM = Math.floor((parseInt(item.modeValue) % 3600) / 60)
+            this.groupRateForm.modeValueS = (parseInt(item.modeValue) % 3600) % 60
+          }
+        }
+      } else if (readMode == 1) { // 值改变读取
+        this.groupRateForm.readModeType = item.readModeType
+      } else if (readMode == 2) { // 条件读取
+        this.groupRateForm.eventMode = item.eventMode
+        let _itemList = item.itemList
+        for (let i = 0; i < _itemList.length; i ++) {
+          if (_itemList[i].tableReportId) {
+            this.reportEventConfigForm.tableReportId = _itemList[i].tableReportId
+            this.reportEventConfigForm.itemName = _itemList[i].itemName
+          }
+        }
+      }
+    },
     /** 更新组项信息 */
     updateGroupItem() {
       let id = this.chooseGroupData.id
@@ -1348,11 +1356,10 @@ export default {
       this.groupRateForm.modeValueH = 0
       this.groupRateForm.modeValueM = 0
       this.groupRateForm.modeValueS = 0
-      this.reportEventConfigForm = {
-        itemName: '',
-        tableReportId: null,
-        tableReportName: null
-      },
+      this.resetReportEventConfigForm()
+      if (this.updateGroupData && this.updateGroupData.readMode == val) {
+        this.withReadMode(this.updateGroupData, val)
+      }
 
       this.groupRateForm.readMode = val
       this.$refs.groupRateForm.clearValidate()
@@ -1699,6 +1706,16 @@ export default {
       this.itemDataStep = 1
       this.filterItemData = ''
       this.dataLineListSelections = []
+      let flag = false
+      for (let i = 0; i < this.chooseItemDataList.length; i ++) {
+        if (this.chooseItemDataList[i].itemName == this.reportEventConfigForm.itemName) {
+          flag = true
+          break
+        }
+      }
+      if (!flag) {
+        this.resetReportEventConfigForm()
+      }
       this.dataItemDialogVisible = false
       this.chooseItemDataView = true
     },
@@ -1834,14 +1851,7 @@ export default {
         this.bomCheckKey = new Date().getTime()
         this.dataLineListSelections = []
         this.dialogReportEventConfigVisible = false
-        if (this.$refs['reportEventConfigForm']) {
-          this.reportEventConfigForm = {
-            itemName: '',
-            tableReportId: null,
-            tableReportName: null
-          }
-          this.$refs['reportEventConfigForm'].resetFields()
-        }
+        this.resetReportEventConfigForm()
       })
     },
     /** 保存数据模型事件 */
@@ -2022,16 +2032,31 @@ export default {
     },
     resetReportEventConfigForm() {
       if (this.$refs['reportEventConfigForm']) {
-        this.reportEventConfigForm = {
-          itemName: '',
-          tableReportId: null,
-          tableReportName: null
-        }
         this.$refs['reportEventConfigForm'].resetFields()
       }
+      this.reportEventConfigForm = {
+        itemName: '',
+        tableReportId: null,
+        tableReportName: null
+      }
     },
     /** 弹出层关闭事件 */
     dialogReportEventConfigClose() {
+      this.resetReportEventConfigForm()
+      if (this.updateGroupData && this.updateGroupData.readMode == 2) {
+        let _itemList = this.updateGroupData.itemList
+        for (let i = 0; i < _itemList.length; i ++) {
+          if (_itemList[i].tableReportId) {
+            let items = this.groupBasicForm.itemList
+            items.forEach((item) => {
+              if (_itemList[i].itemName == item.itemName) {
+                this.reportEventConfigForm.tableReportId = _itemList[i].tableReportId
+                this.reportEventConfigForm.itemName = _itemList[i].itemName
+              }
+            })
+          }
+        }
+      }
       if (typeof(done) === 'function') {
         done()
       } else {

+ 2 - 1
chuanyi_client2/src/permission.js

@@ -32,7 +32,8 @@ router.beforeEach(async (to, from, next) => {
                             message: '您还没有设置角色,请联系管理员!',
                             type: 'warning'
                         })
-                        await store.dispatch('user/resetToken')
+                        await store.dispatch('user/Logout')
+                        // await store.dispatch('user/resetToken')
                         next(`/login?redirect=${to.fullPath}`)
                         return
                     }

+ 89 - 74
chuanyi_client2/src/views/group_item/index.vue

@@ -111,7 +111,7 @@
     <!-- 修改数据项基础信息 -->
     <el-dialog
         title="修改数据项"
-        width="50%"
+        width="600px"
         top="10vh"
         center
         v-dialog-drag
@@ -144,29 +144,29 @@
                     maxlength="20"
                     placeholder="请输入描述信息"></el-input>
         </el-form-item>
-        <el-divider content-position="left" class="cy-divider">事件报表配置(以下任意一项配置为空都将会无效)</el-divider>
-        <el-form-item label="事件驱动产生条件:" prop="eventMode">
-          <el-radio-group v-model="itemForm.eventMode">
-            <el-radio label="0">大于</el-radio>
-            <el-radio label="1">小于</el-radio>
-            <el-radio label="2">布尔类型</el-radio>
-          </el-radio-group>
-        </el-form-item>
-        <el-form-item label="阈值:" prop="eventValue">
-          <el-input v-model="itemForm.eventValue" placeholder="请输入阈值" maxlength="8">
-          </el-input>
-        </el-form-item>
-        <el-form-item label="事件驱动报表:" prop="tableReportId">
-          <el-select v-model="itemForm.tableReportId" filterable clearable
-                     placeholder="请选择事件驱动报表" style="width: 100%;">
-            <el-option
-                v-for="(item, index) in this.eventReportList"
-                :key="index"
-                :label="item.reportTableName"
-                :value="item.id">
-            </el-option>
-          </el-select>
-        </el-form-item>
+<!--        <el-divider content-position="left" class="cy-divider">事件报表配置(以下任意一项配置为空都将会无效)</el-divider>-->
+<!--        <el-form-item label="事件驱动产生条件:" prop="eventMode">-->
+<!--          <el-radio-group v-model="itemForm.eventMode">-->
+<!--            <el-radio label="0">大于</el-radio>-->
+<!--            <el-radio label="1">小于</el-radio>-->
+<!--            <el-radio label="2">布尔类型</el-radio>-->
+<!--          </el-radio-group>-->
+<!--        </el-form-item>-->
+<!--        <el-form-item label="阈值:" prop="eventValue">-->
+<!--          <el-input v-model="itemForm.eventValue" placeholder="请输入阈值" maxlength="8">-->
+<!--          </el-input>-->
+<!--        </el-form-item>-->
+<!--        <el-form-item label="事件驱动报表:" prop="tableReportId">-->
+<!--          <el-select v-model="itemForm.tableReportId" filterable clearable-->
+<!--                     placeholder="请选择事件驱动报表" style="width: 100%;">-->
+<!--            <el-option-->
+<!--                v-for="(item, index) in this.eventReportList"-->
+<!--                :key="index"-->
+<!--                :label="item.reportTableName"-->
+<!--                :value="item.id">-->
+<!--            </el-option>-->
+<!--          </el-select>-->
+<!--        </el-form-item>-->
       </el-form>
       <span slot='footer'>
         <el-button type="primary" @click="editConfirmEvent" style="margin-top: 20px;">确定</el-button>
@@ -237,9 +237,9 @@ export default {
       itemForm: {
         id: null,
         dataModelId: null,
-        eventMode: null,
-        eventValue: null,
-        tableReportId: null,
+        // eventMode: null,
+        // eventValue: null,
+        // tableReportId: null,
         describe: ''
       }
     }
@@ -410,63 +410,78 @@ export default {
       _this.getAllDataModel(status => {
         if (!status) return
         const loading = showLoading(_this, '加载中,请稍候···')
-        let params = {
-          'page': 1,
-          'limit': 1000,
-          'isAutoReport': 3
-        }
-        getAllReportTable(params).then(res => {
-          let eventReportList = res.data.reportTableList
-          this.eventReportList = eventReportList
-          getItemById(row.id).then(res => {
-            loading.close()
-            _this.$nextTick(() => {
-              _this.itemForm.id = row.id
-              _this.itemForm.dataModelId = res.data.dataModelId
-              _this.itemForm.describe = res.data.describe
-              _this.itemForm.tableReportId = res.data.tableReportId
-              _this.itemForm.eventMode = res.data.eventMode + ''
-              _this.itemForm.eventValue = res.data.eventValue
-              _this.dialogItemVisible = true
-            })
-          }).catch((e) => {
-            loading.close()
-            showAlertWin(_this, e)
+        getItemById(row.id).then(res => {
+          loading.close()
+          _this.$nextTick(() => {
+            _this.itemForm.id = row.id
+            _this.itemForm.dataModelId = res.data.dataModelId
+            _this.itemForm.describe = res.data.describe
+            // _this.itemForm.tableReportId = res.data.tableReportId
+            // _this.itemForm.eventMode = res.data.eventMode + ''
+            // _this.itemForm.eventValue = res.data.eventValue
+            _this.dialogItemVisible = true
           })
         }).catch((e) => {
           loading.close()
-          showAlertWin(this, e)
+          showAlertWin(_this, e)
         })
+        // let params = {
+        //   'page': 1,
+        //   'limit': 1000,
+        //   'isAutoReport': 3
+        // }
+        // getAllReportTable(params).then(res => {
+        //   let eventReportList = res.data.reportTableList
+        //   this.eventReportList = eventReportList
+        //   getItemById(row.id).then(res => {
+        //     loading.close()
+        //     _this.$nextTick(() => {
+        //       _this.itemForm.id = row.id
+        //       _this.itemForm.dataModelId = res.data.dataModelId
+        //       _this.itemForm.describe = res.data.describe
+        //       _this.itemForm.tableReportId = res.data.tableReportId
+        //       _this.itemForm.eventMode = res.data.eventMode + ''
+        //       _this.itemForm.eventValue = res.data.eventValue
+        //       _this.dialogItemVisible = true
+        //     })
+        //   }).catch((e) => {
+        //     loading.close()
+        //     showAlertWin(_this, e)
+        //   })
+        // }).catch((e) => {
+        //   loading.close()
+        //   showAlertWin(this, e)
+        // })
       })
     },
     /** 编辑确认事件 */
     editConfirmEvent() {
-      if (this.itemForm.eventValue) {
-        let reg = /^(\-)?\d+(\.\d{1,2})?$/
-        if (!reg.test(this.itemForm.eventValue)) {
-          this.$message({
-            message: '阈值不合法',
-            type: 'warning'
-          })
-          return
-        }
-        if (this.itemForm.eventMode == '2' && this.itemForm.eventValue != 0 && this.itemForm.eventValue != 1) {
-          this.$message({
-            message: '布尔类型时阈值只能为0或者1',
-            type: 'warning'
-          })
-          return
-        }
-      }
+      // if (this.itemForm.eventValue) {
+      //   let reg = /^(\-)?\d+(\.\d{1,2})?$/
+      //   if (!reg.test(this.itemForm.eventValue)) {
+      //     this.$message({
+      //       message: '阈值不合法',
+      //       type: 'warning'
+      //     })
+      //     return
+      //   }
+      //   if (this.itemForm.eventMode == '2' && this.itemForm.eventValue != 0 && this.itemForm.eventValue != 1) {
+      //     this.$message({
+      //       message: '布尔类型时阈值只能为0或者1',
+      //       type: 'warning'
+      //     })
+      //     return
+      //   }
+      // }
       const loading = showLoading(this, '加载中,请稍候···')
       // 若驱动报表事件任意一项为空,则清空报表事项
-      if ((!this.itemForm.eventMode || this.itemForm.eventMode == 'null')
-          || (this.itemForm.eventValue == null || this.itemForm.eventValue == '')
-          || !this.itemForm.tableReportId) {
-        this.itemForm.eventMode = null
-        this.itemForm.eventValue = null
-        this.itemForm.tableReportId = null
-      }
+      // if ((!this.itemForm.eventMode || this.itemForm.eventMode == 'null')
+      //     || (this.itemForm.eventValue == null || this.itemForm.eventValue == '')
+      //     || !this.itemForm.tableReportId) {
+      //   this.itemForm.eventMode = null
+      //   this.itemForm.eventValue = null
+      //   this.itemForm.tableReportId = null
+      // }
       let params = JSON.parse(JSON.stringify(this.itemForm))
       updateItem(params).then(res => {
         loading.close()

+ 1 - 1
chuanyi_client2/src/views/report_template/index.vue

@@ -383,7 +383,7 @@
         </div>
         <div v-if="chooseGroupItemList.length > 0">
           <template>
-            <el-divider content-position="left">数据项排方式</el-divider>
+            <el-divider content-position="left">数据项排方式</el-divider>
             <div class="cy-line custom-tree">
               <el-radio-group v-model="itemShowParams.fieldType" @input="showDataTypeEvent">
                 <el-radio label="1">横向</el-radio>

+ 3 - 3
chuanyi_client2/src/views/user_group/index.vue

@@ -27,7 +27,7 @@
     <!-- 新增用户组 -->
     <el-dialog
         :title="userGroupTitle"
-        width="80%"
+        width="600px"
         top="10vh"
         center
         v-dialog-drag
@@ -75,10 +75,10 @@
         :close-on-click-modal="false"
         :append-to-body="true">
       <div style="display: flex;height: 50vh; overflow: auto;">
-        <div style="width: calc(20% - 15px); margin-right: 15px;">
+        <div style="width: calc(30% - 15px); margin-right: 15px;">
           <el-tree :data="departments" :default-expand-all="true" @node-click="handleNodeClick"></el-tree>
         </div>
-        <div style="width: 80%; border-left: 1px solid #d8d6d6; padding-left: 20px;">
+        <div style="width: 70%; border-left: 1px solid #d8d6d6; padding-left: 20px;">
           <el-table :data="userDataList" border :stripe="true"
                     @sort-change="sortChange1"
                     :header-cell-style="{background: '#E8E8E8'}">