Jelajahi Sumber

修改客户端事件驱动报表获取数据组时,未筛选问题
客户端通过id获取数据项信息添加,数据项类型筛选

zhoupeng 1 tahun lalu
induk
melakukan
647d6636f7

+ 32 - 5
chuanyi_client2/src/api/datasource.js

@@ -126,7 +126,16 @@ export function getDriverList(data) {
  * 查询组配置
  * @returns {AxiosPromise}
  */
-export function getAllItemGroup() {
+export function getAllItemGroup(readMode) {
+    if (readMode) {
+        return request({
+            url: '/itemGroup/getAllItemGroup?readMode=' + readMode,
+            headers: {
+                isToken: true
+            },
+            method: 'get'
+        })
+    }
     return request({
         url: '/itemGroup/getAllItemGroup',
         headers: {
@@ -141,9 +150,18 @@ export function getAllItemGroup() {
  * @param id
  * @returns {AxiosPromise}
  */
-export function getItemGroupById(id) {
+export function getItemGroupById(id, itemType) {
+    if (itemType) {
+        return request({
+            url: '/itemGroup/getItemGroupById?id=' + id + '&itemType=' + itemType,
+            headers: {
+                isToken: true
+            },
+            method: 'get'
+        })
+    }
     return request({
-        url: '/itemGroup/getItemGroupById/' + id,
+        url: '/itemGroup/getItemGroupById?id=' + id,
         headers: {
             isToken: true
         },
@@ -157,9 +175,18 @@ export function getItemGroupById(id) {
  * @param id
  * @returns {AxiosPromise}
  */
-export function getTableItemGroupById(id) {
+export function getTableItemGroupById(id, itemType) {
+    if (itemType) {
+        return request({
+            url: '/itemGroup/getTableItemGroupById?id=' + id + '&itemType=' + itemType,
+            headers: {
+                isToken: true
+            },
+            method: 'get'
+        })
+    }
     return request({
-        url: '/itemGroup/getTableItemGroupById/' + id,
+        url: '/itemGroup/getTableItemGroupById?id=' + id,
         headers: {
             isToken: true
         },

+ 14 - 10
chuanyi_client2/src/components/CustomDialog/DataItem.vue

@@ -28,8 +28,10 @@
       </div>
       <el-divider content-position="left">数据项(共 {{ itemDataListByTree.length }} 项)</el-divider>
       <div>
-        <el-input placeholder="请输入关键字进行过滤" v-model="filterItemData" style="width: calc(100% - 100px);" size="mini"></el-input>
-        <el-checkbox v-model="isSelectAllItem" @change="selectAllItem" style="width: 100px; text-align: center;">全选</el-checkbox>
+        <el-input placeholder="请输入关键字进行过滤" v-model="filterItemData" style="width: calc(100% - 100px);"
+                  size="mini"></el-input>
+        <el-checkbox v-model="isSelectAllItem" @change="selectAllItem" style="width: 100px; text-align: center;">全选
+        </el-checkbox>
       </div>
       <div style="height: 50vh; margin-top: 10px; overflow: auto;">
         <el-tree class="cy-item-tree"
@@ -48,9 +50,11 @@
                 <svg-icon v-else-if="node.expanded" icon-class="folder-open"/>
                 <svg-icon v-else icon-class="folder"/>
                 <span :title='data.itemName || "-"' style="margin-left: 2px;">
-                  {{ data.describe
-                    ? ((data.itemName ? data.itemName : '') + '(' + data.describe + ')')
-                    : data.itemName ? data.itemName : '' }}
+                  {{
+                    data.describe
+                        ? ((data.itemName ? data.itemName : '') + '(' + data.describe + ')')
+                        : data.itemName ? data.itemName : ''
+                  }}
                 </span>
               </span>
         </el-tree>
@@ -104,7 +108,7 @@ export default {
       const data = traverseNode(this.$refs.itemTree.store.root.childNodes)
       if (this.isSelectAllItem) {
         let arr = traverseVisible(data)
-        let ids = Array.from(arr, ({ id }) => id)
+        let ids = Array.from(arr, ({id}) => id)
         this.$refs.itemTree.setCheckedKeys(ids)
       } else {
         this.$refs.itemTree.setCheckedNodes([])
@@ -135,7 +139,7 @@ export default {
       this.isSelectAllItem = false
       this.itemDataListByTree = []
       const loading = showLoading(this, '加载中,请稍候···')
-      getTableItemGroupById(id).then(res => {
+      getTableItemGroupById(id, 1).then(res => {
         loading.close()
         this.itemDataListByTree = res.data.itemList
       }).catch((e) => {
@@ -145,7 +149,7 @@ export default {
     },
     /** 获取数据组列表 */
     getDataGroupList() {
-      getAllItemGroup().then(res => {
+      getAllItemGroup(1).then(res => {
         this.dataGroupList = res.data
       }).catch((e) => {
         showAlertWin(this, null, e)
@@ -165,7 +169,7 @@ export default {
     dialogItemClose(done) {
       this.itemDataListByTree = []
       this.filterItemData = ''
-      if (typeof(done) === 'function') {
+      if (typeof (done) === 'function') {
         done()
       } else {
         this.dialogDataItemVisible = false
@@ -177,4 +181,4 @@ export default {
 
 <style scoped>
 
-</style>
+</style>

+ 1 - 1
chuanyi_client2/src/components/HeaderMain/index.vue

@@ -941,7 +941,7 @@ export default {
         return resolve(this.groupDataList)
       }
       if (node.data.id == -1) {
-        getAllItemGroup().then(res => {
+        getAllItemGroup(null).then(res => {
           if (!res.data) {
             resolve([])
             return

+ 9 - 2
chuanyi_client2/src/views/home/index.vue

@@ -64,7 +64,7 @@
         :visible.sync="dialogIndexChartVisible"
         :close-on-click-modal="false"
         :append-to-body="true">
-      <el-form ref="chartForm" :model="chartForm" :rules="chartFormRules" label-width="100px">
+      <el-form ref="chartForm" :model="chartForm" :rules="chartFormRules" label-width="110px">
         <el-form-item label='统计图名称:' prop="chartName">
           <el-input placeholder="请输入统计图名称" v-model="chartForm.chartName" maxlength="20" show-word-limit></el-input>
         </el-form-item>
@@ -190,6 +190,13 @@ export default {
         userGroupList: []
       },
       chartFormRules: {
+        chartName: [
+          { required: true, message: '名称不能为空', trigger: 'blur' }
+        ],chartItemList: [
+          { required: true, message: '数据项不能为空', trigger: 'blur' }
+        ],userGroupList: [
+          { required: true, message: '用户组不能为空', trigger: 'blur' }
+        ]
       }
     }
   },
@@ -312,4 +319,4 @@ export default {
 
 <style>
 
-</style>
+</style>

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

@@ -1331,7 +1331,7 @@ export default {
     },
     /** 获取右侧数据组列表 */
     getDataGroupList(callback) {
-      getAllItemGroup().then(res => {
+      getAllItemGroup(this.templateReportType).then(res => {
         this.dataGroupList = res.data
         if (callback) callback()
       }).catch((e) => {