chenrui 4 年之前
父节点
当前提交
f4b30f48be

+ 19 - 3
src/views/BasicSettings/Organization.vue

@@ -11,7 +11,8 @@
       :showPagination="false"
       :columns="columns"
       :data="loadData"
-      bordered>
+      :defaultExpandedRowKeys="defaultExpandedRowKeys"
+      :bordered="true">
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
         <a-button
@@ -81,6 +82,7 @@ export default {
         return findOrgTree().then(res => {
           //  递归去除空children
           this.recursionFun(res.data)
+          this.defaultExpandedRowKeys[0] = res.data[0].id
           return res.data
         })
       },
@@ -93,10 +95,24 @@ export default {
         name: [{ required: true, message: '请输入组织机构名称', trigger: 'blur' }]
       },
       nowId: '', //  当前操作的数据id
-      nowPid: '' //  当前操作的数据上级id
+      nowPid: '', //  当前操作的数据上级id
+      defaultExpandedRowKeys: [] //  树形数据默认展开项
     }
   },
+  mounted () {
+    this.getList()
+  },
   methods: {
+    getList () {
+      findOrgTree().then(res => {
+        if (res.status == 200) {
+          //  递归去除空children
+          this.recursionFun(res.data)
+          this.listData = res.data
+          this.defaultExpandedRowKeys[0] = this.listData[0].id
+        }
+      })
+    },
     //  添加子级
     addOrg (item) {
       this.nowId = ''
@@ -162,7 +178,7 @@ export default {
     //  递归函数
     recursionFun (data) {
       if (data) {
-        data.map(item => {
+        data.map((item, index) => {
           if (item.children && item.children.length == 0) {
             delete item.children
           } else {

+ 2 - 2
src/views/BasicSettings/StoreAssociatedEquipmentModal.vue

@@ -120,7 +120,7 @@ export default {
     return {
       isShow: this.openModal, //  弹框是否展示
       columns: [
-        { title: '序号', dataIndex: 'no', width: '100', align: 'center' },
+        { title: '序号', dataIndex: 'no', width: '60', align: 'center' },
         { title: '设备名称', dataIndex: 'vsDeviceName', width: '100', align: 'center' },
         { title: '设备ID', dataIndex: 'vsDeviceId', width: '100', align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '265', align: 'center' }
@@ -128,7 +128,7 @@ export default {
       equipmentData: [], //  已绑设备
       passagewayData: [], //  设备通道
       passagewayColumns: [
-        { title: '序号', dataIndex: 'no', width: '100', align: 'center' },
+        { title: '序号', dataIndex: 'no', width: '60', align: 'center' },
         { title: '设备通道名称', dataIndex: 'name', width: '100', align: 'center' },
         { title: '设备ID', dataIndex: 'deviceId', width: '100', align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '265', align: 'center' }

+ 1 - 2
src/views/BasicSettings/StoreManagement.vue

@@ -115,7 +115,7 @@ export default {
         isEnable: '' //  启用状态
       },
       columns: [
-        { title: '序号', dataIndex: 'no', width: '40', align: 'center' },
+        { title: '序号', dataIndex: 'no', width: '60', align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: '100', align: 'center' },
         { title: '组织机构', dataIndex: 'orgCodeName', width: '100', align: 'center' },
         { title: '门店名称', dataIndex: 'name', width: '100', align: 'center' },
@@ -134,7 +134,6 @@ export default {
               const _item = res.data.list[i]
               _item.no = no + i + 1
             }
-            res.data.count = Number(res.data.count)
             return res.data
           }
         })