ソースを参照

账户管理调整

ZhangWenQiang 4 年 前
コミット
6510597c70

+ 50 - 0
src/views/hwaccount/HwAccountManager.vue

@@ -92,6 +92,7 @@ export default {
   mixins: [JeecgListMixin, Arithmetic],
   components: {
   },
+  props: ['value'],
   data() {
     return {
       allowClear:false,
@@ -142,11 +143,45 @@ export default {
       },
     }
   },
+  watch: {
+    value: {
+      immediate: true,
+      handler(value) {
+        this.dataSource = []
+        this.loadData(1, value[0], value[1])
+      }
+    },
+  },
   created() {
 
   }
   ,
   methods: {
+    loadData(pageNum, subcontractorId, cpType) {
+      this.loading = true
+      if (pageNum === 1) {
+        this.ipagination.current = 1
+      }
+      // update-begin- --- author:wangshuai ------ date:20200102 ---- for:传过来的部门编码为空全查
+      if (!subcontractorId) {
+        this.loading = false
+        // update-end- --- author:wangshuai ------ date:20200102 ---- for:传过来的部门编码为空全查
+      }else{
+        //加载数据 若传入参数1则加载第一页的内容
+        getAction(this.url.list, {
+          subcontractorId, cpType,
+          ...this.getQueryParams()
+        }).then((res) => {
+          if (res.success) {
+            this.dataSource = res.result.records
+            this.ipagination.total = res.result.total
+          }
+        }).finally(() => {
+          this.loading = false
+        })
+      }
+    },
+
     getQueryParams(){
       console.log(this.queryParam.generateTimeRange)
       var param = Object.assign({}, this.queryParam,this.isorter);
@@ -164,6 +199,21 @@ export default {
     onDateOk(value) {
       console.log(value);
     },
+    searchQuery() {
+      this.loadData(1, this.value[0],this.value[1])
+    },
+    searchReset() {
+      this.queryParam = {}
+      this.loadData(1, this.value[0],this.value[1])
+    },
+    handleTableChange(pagination, filters, sorter) {
+      if (Object.keys(sorter).length > 0) {
+        this.isorter.column = sorter.field
+        this.isorter.order = 'ascend' === sorter.order ? 'asc' : 'desc'
+      }
+      this.ipagination = pagination
+      this.loadData(null, this.value[0], this.value[1])
+    },
     handleExportXls(fileName) {
       if (!fileName || typeof fileName != 'string') {
         fileName = '导出文件'

+ 37 - 0
src/views/hwaccount/HwCompanyAccount.vue

@@ -0,0 +1,37 @@
+<template>
+  <a-row type="flex" :gutter="16">
+    <a-col :md="5" :sm="24">
+      <HwSubcontractorList v-model="currentApplicationName"/>
+    </a-col>
+    <a-col :md="24-5" :sm="24">
+      <HwAccountManager v-model="currentApplicationName"/>
+    </a-col>
+  </a-row>
+</template>
+
+<script>
+  import HwSubcontractorList from './HwSubcontractorList'
+  import HwAccountManager from './HwAccountManager'
+
+
+  export default {
+    name: "HlwCompanyAccount",
+    components: {
+      HwSubcontractorList,
+      HwAccountManager
+    },
+    data () {
+      return {
+        description: '平台企业账户表管理页面',
+        currentApplicationName: ''
+      }
+    },
+    methods: {
+      initDictConfig(){
+      }
+    }
+  }
+</script>
+<style scoped>
+  @import '~@assets/less/common.less';
+</style>

+ 101 - 0
src/views/hwaccount/HwSubcontractorList.vue

@@ -0,0 +1,101 @@
+<template>
+  <a-card :loading="cardLoading" :bordered="false" style="height: 100%;">
+    <a-spin :spinning="loading">
+      <a-tree
+        showLine
+        checkStrictly
+        :expandedKeys.sync="expandedKeys"
+        :selectedKeys="selectedKeys"
+        :dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
+        :treeData="treeDataSource"
+        @select="handleTreeSelect"
+      />
+    </a-spin>
+  </a-card>
+</template>
+
+<script>
+  import { httpAction,getAction,deleteAction } from '@/api/manage'
+  const queryDepartTreeList = (params)=>getAction("/saasmanager/hwPlatformCompanyAccount/myAccount",params);
+
+  export default {
+    name: 'AddressListLeft',
+    props: ['value'],
+    data() {
+      return {
+        cardLoading: true,
+        loading: false,
+        treeDataSource: [],
+        selectedKeys: [],
+        expandedKeys: [],
+        url: {
+
+        },
+      }
+    },
+    created() {
+      this.queryTreeData()
+    },
+    methods: {
+
+      queryTreeData(keyword) {
+        this.commonRequestThen(queryDepartTreeList())
+      },
+
+      handleTreeSelect(selectedKeys, event) {
+        if (selectedKeys.length > 0 && this.selectedKeys[0] !== selectedKeys[0]) {
+          this.selectedKeys = [selectedKeys[0]]
+          let subcontractorId = event.node.dataRef.subcontractorId
+          let cpType = event.node.dataRef.cpType
+          this.emitInput(subcontractorId, cpType)
+        }
+      },
+
+      emitInput(subcontractorId, cpType) {
+        var arr = [subcontractorId, cpType];
+        this.$emit('input', arr)
+      },
+
+      commonRequestThen(promise) {
+        this.loading = true
+        promise.then(res => {
+          if (res.success) {
+            //处理树结构
+            res.result.forEach((item, index) => {
+              item.key = item.subcontractorId
+              item.value = item.cpType
+              item.title = item.subcontractorName
+            })
+            this.treeDataSource = res.result
+            // update-begin- --- author:wangshuai ------ date:20200102 ---- for:去除默认选中第一条数据、默认展开所有第一级
+            // 默认选中第一条数据、默认展开所有第一级
+            // if (res.result.length > 0) {
+            //   this.expandedKeys = []
+            //   res.result.forEach((item, index) => {
+            //     if (index === 0) {
+            //       this.selectedKeys = [item.id]
+            //       this.emitInput(item.id)
+            //     }
+            //     this.expandedKeys.push(item.id)
+            //   })
+            // }
+           // update-end- --- author:wangshuai ------ date:20200102 ---- for:去除默认选中第一条数据、默认展开所有第一级
+          } else {
+            this.$message.warn(res.message)
+            console.error('组织机构查询失败:', res)
+          }
+        }).finally(() => {
+          this.loading = false
+          this.cardLoading = false
+        })
+      },
+
+    }
+  }
+</script>
+
+<style scoped>
+  /deep/ .ant-card-body {
+    padding: 24px 12px;
+  }
+</style>