From accebdce93486d3b4f26e55ffdea047549cce20c Mon Sep 17 00:00:00 2001
From: cuijian <cuijian@xalxzn.com>
Date: 星期一, 28 七月 2025 21:12:38 +0800
Subject: [PATCH] Merge branch 'master' of http://125.76.225.53:18448/r/xhj/vue_mdc_xhj

---
 src/views/mdc/base/modules/DepartList/DepartListContent/DepartList.vue |  622 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 622 insertions(+), 0 deletions(-)

diff --git a/src/views/mdc/base/modules/DepartList/DepartListContent/DepartList.vue b/src/views/mdc/base/modules/DepartList/DepartListContent/DepartList.vue
new file mode 100644
index 0000000..b35b021
--- /dev/null
+++ b/src/views/mdc/base/modules/DepartList/DepartListContent/DepartList.vue
@@ -0,0 +1,622 @@
+<template>
+  <div class="device_list">
+    <a-row>
+        <a-col :md="leftColMd" :sm="24">
+          <a-card :bordered="false">
+
+            <!-- 鎿嶄綔鎸夐挳鍖哄煙 -->
+            <div class="table-operator">
+              <a-button @click="handleAddTier" type="primary" icon="plus">鏂板閮ㄩ棬
+              </a-button>
+              <!--<a-button @click="handleAdd" type="primary" icon="plus">鏂板浜哄憳-->
+              <!--</a-button>-->
+              <!--<a-button @click="handleEdit" v-if="selectedRowKeys.length ==1" icon="edit">缂栬緫-->
+              <!--</a-button>-->
+              <a-button @click="deviceSearch" v-if="selectedRowKeys.length ==1" type="primary" icon="search">閫夋嫨璁惧
+              </a-button>
+              <!--<a-button @click="batchDelll" v-if="selectedRowKeys.length >0" icon="delete">鍒犻櫎-->
+              <!--</a-button>-->
+            </div>
+            <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
+              <i class="anticon anticon-info-circle ant-alert-icon">
+              </i> 宸查�夋嫨 <a><b>{{ selectedRowKeys.length }}</b></a>椤�
+              <a style="margin-left: 24px" @click="onClearSelected">娓呯┖</a>
+            </div>
+
+            <!-- table鍖哄煙-begin -->
+            <div>
+              <a-table ref="table" bordered size="middle" rowKey="id" :columns="columns"
+                       :scroll="{x: 400}" :dataSource="dataSource" :pagination="ipagination" :loading="loading"
+                       :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}"
+                       @change="handleTableChange">
+        <span slot="action" slot-scope="text, record">
+          <a @click="handleEdit(record)">缂栬緫</a>
+          <a-divider type="vertical"/>
+          <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)">
+            <a>鍒犻櫎</a>
+          </a-popconfirm>
+        </span>
+
+                <!--瀛楃涓茶秴闀挎埅鍙栫渷鐣ュ彿鏄剧ず-->
+                <span slot="num" slot-scope="text" style="font-weight: bold">
+          <j-ellipsis :value="text" :length="8"/>
+        </span>
+                <span slot="name" slot-scope="text" style="font-weight: bold">
+          <j-ellipsis :value="text" :length="8"/>
+        </span>
+                <span slot="model" slot-scope="text" style="font-weight: bold">
+          <j-ellipsis :value="text" :length="8"/>
+        </span>
+              </a-table>
+            </div>
+            <!-- table鍖哄煙-end -->
+            <depart-model ref="modalForm" @ok="modalFormOk"></depart-model>
+            <tier-model ref="tierModalForm" @ok="modalFormOk"></tier-model>
+            <depart-list-seach-list ref="seachModalForm" @ok="modalFormOk"  @sendSelectionRows="getDeviceRows"></depart-list-seach-list>
+          </a-card>
+        </a-col>
+        <a-col :md="rightColMd" :sm="24" v-if="selectedRowKeys.length == 1">
+          <a-table
+            ref="table2"
+            bordered
+            size="middle"
+            rowKey="id"
+            :columns="columns2"
+            :dataSource="dataSource2"
+            :pagination="ipagination2"
+            :loading="loading2"
+            @change="handleTableChange2">
+             <span slot="action" slot-scope="text, record">
+          <!--<a @click="handleEdit(record)">缂栬緫</a>-->
+          <!--<a-divider type="vertical"/>-->
+          <a-popconfirm title="纭畾绉婚櫎鍚�?" @confirm="() => handleDeleteZi(record.id)">
+            <a>绉婚櫎</a>
+          </a-popconfirm>
+        </span>
+          </a-table>
+
+        </a-col>
+    </a-row>
+  </div>
+
+
+</template>
+
+<script>
+  import JDictSelectTag from '@/components/dict/JDictSelectTag'
+  import {
+    requestPut,
+    deleteAction,
+    getAction,
+    postAction,
+    putAction
+  } from '@/api/manage'
+  import DepartModel from './DepartModel'
+  import TierModel from './TierModel'
+  import {
+    JeecgListMixin
+  } from '@/mixins/JeecgListMixin'
+  import JInput from '@/components/jeecg/JInput'
+  import JEllipsis from '@/components/jeecg/JEllipsis'
+  import Tooltip from 'ant-design-vue/es/tooltip'
+  import DepartListSeachList from './DepartListSeachList'
+  import { filterObj } from '@/utils/util'
+  export default {
+    name: 'DepartList',
+    mixins: [JeecgListMixin],
+    components: {
+      Tooltip,
+      DepartModel,
+      TierModel,
+      DepartListSeachList,
+      JDictSelectTag,
+      JInput,
+      JEllipsis
+    },
+    props: { node: '' },
+    data() {
+      return {
+        sectionId:"",
+        queryParam: {},
+        dataStartsoucre:[],
+        columns: [
+          // {
+          //   title: '灞傜骇缂栫爜',
+          //   align: 'center',
+          //   dataIndex: 'sectionNumber'
+          // },
+          {
+            title: '鍚嶇О',
+            align: 'center',
+            dataIndex: 'sectionName'
+          },
+          // {
+          //   title: '鐖剁骇',
+          //   align: 'center',
+          //   dataIndex: 'parentId'
+          // },
+          // {
+          //   title: '灞傜骇',
+          //   align: 'center',
+          //   dataIndex: 'sectionRank'
+          // },
+          {
+            title: '鎺掑簭',
+            align: 'center',
+            dataIndex: 'sortNo'
+          },
+          {
+              title: '鎿嶄綔',
+              dataIndex: 'action',
+              scopedSlots: {customRender: 'action'},
+              align: "center",
+              width: 150
+            }
+        ],
+        dataSource2:[],
+        ipagination2: {
+          current: 1,
+          pageSize: 10,
+          pageSizeOptions: ['10', '20', '30'],
+          showTotal: (total, range) => {
+            return range[0] + '-' + range[1] + ' 鍏�' + total + '鏉�'
+          },
+          showQuickJumper: true,
+          showSizeChanger: true,
+          total: 0
+        },
+        isorter2: {
+          column: 'createTime',
+          order: 'desc'
+        },
+        filters2: {},
+        loading2: false,
+        columns2: [
+          {
+            title: '#',
+            dataIndex: '',
+            key: 'rowIndex',
+            width: 60,
+            align: "center",
+            customRender: function (t, r, index) {
+              return parseInt(index) + 1;
+            }
+          },{
+
+            title: '缁熶竴缂栫爜',
+            align: 'center',
+            dataIndex: 'equipmentId',
+          },
+          {
+            title: '璁惧鍚嶇О',
+            align: 'center',
+            dataIndex: 'equipmentName',
+          },
+          {
+            title: '椹卞姩绫诲瀷',
+            align: 'center',
+            dataIndex: 'driveType'
+          },
+          // {
+          //   title: '璁惧鍨嬪彿',
+          //   align: 'center',
+          //   dataIndex: 'equipmentModel'
+          // },
+          {
+            title: '璁惧绫诲瀷',
+            align: 'center',
+            dataIndex: 'equipmentType_dictText'
+          },
+          {
+            title: '鎿嶄綔',
+            dataIndex: 'action',
+            scopedSlots: {customRender: 'action'},
+            align: "center",
+            width: 150
+          }
+        ],
+        url: {
+          list: '/mdc/sectionEquipment/pageList',
+          delete: '/mdc/sectionEquipment/deleteBatch',
+          list2: '/mdc/mdcequipment/pageListEquipments',
+          updateEquipment:'/mdc/sectionEquipment/updateEquipment',
+          updateBatchSection:'/mdc/mdcequipment/updateBatchSection'
+        },
+        mapDateList:{}
+      }
+    },
+    watch:{
+      node(val) {
+        // console.log(val);
+        this.selectedRowKeys = [];
+        if (val.entity) {
+
+          // if(val.entity.id == "1528990384565837826"){
+          //   this.columns = this.columns1
+          // }else{
+          //   this.columns = this.columns2
+          // }
+          // this.$set(this.queryParams, 'equipmentName', val.entity.equipmentName)
+          // this.$set(this.queryParams, 'equipmentId', val.entity.equipmentId)
+          // this.equipment = val.entity
+
+        } else {
+          // this.initEquipment(val.entity.id)
+        }
+      }
+    },
+    computed: {
+      leftColMd() {
+        return this.selectedRowKeys.length === 0 ? 24 : 8
+      },
+      rightColMd() {
+        return this.selectedRowKeys.length === 0 ? 0 : 16
+      }
+    },
+    methods: {
+      deviceSearch() {
+        // console.log(this.selectionRows)
+        // console.log(this.selectionRows.id)
+        // console.log(this.selectedRowKeys)
+        this.$refs.seachModalForm.openPage(this.selectedRowKeys)
+        this.$refs.seachModalForm.title = '閫夋嫨璁惧'
+        this.$refs.seachModalForm.disableSubmit = false
+      },
+      getDeviceRows(val) {
+        // console.log(val)
+        // let map = {}
+        // val.forEach(item => {
+        //   let key = item.equipmentId;
+        //   if(!map[key]){
+        //     let list = [];
+        //     list.push(item);
+        //     map[key] = list;
+        //   }else {
+        //     map[key].push(item);
+        //   }
+        // });
+        // this.mapDateList = map;
+        // console.log(this.mapDateList);
+        var equipmentIds;
+        for(var i = 0;i<val.length;i++){
+          if (i == 0) {
+            equipmentIds =  val[i].equipmentId;
+          } else {
+            equipmentIds = equipmentIds + "," + val[i].equipmentId;
+          }
+        }
+        let obj = {
+          id:this.sectionId,
+          equipmentId:equipmentIds
+        }
+        var param = Object.assign(obj)
+        putAction(this.url.updateEquipment,param).then(res=>{
+          // console.log(res);
+          if(res.success){
+            this.loadData2();
+          }
+        })
+        // console.log("========",equipmentIds);
+        // this.form.setFieldsValue({
+        //   equipmentId: equipmentIds,
+        // })
+      },
+      onClearSelected() {
+        this.selectedRowKeys = []
+        this.selectionRows = []
+      },
+      loadData(arg) {
+        if(!this.url.list){
+          this.$message.error("璇疯缃畊rl.list灞炴��!")
+          return
+        }
+        //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭
+        if (arg === 1) {
+          this.ipagination.current = 1;
+        }
+        var params = this.getQueryParams();//鏌ヨ鏉′欢
+
+        if(!params){
+          return false;
+        }
+        this.loading = true;
+        console.log(params);
+        getAction(this.url.list, params).then((res) => {
+          if (res.success) {
+            this.dataSource = res.result.records;
+            //update-begin---author:zhangyafei    Date:20201118  for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------
+            // this.dataSource = res.result.records||res.result;
+            if(res.result.total)
+            {
+              this.ipagination.total = res.result.total;
+            }else{
+              this.ipagination.total = 0;
+            }
+            //update-end---author:zhangyafei    Date:20201118  for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------
+          }else{
+            // this.$message.warning(res.message)
+            this.$notification.warning({
+              message:'娑堟伅',
+              description:res.message
+            });
+          }
+        }).finally(() => {
+          this.loading = false
+        })
+      },
+      batchDelll: function () {
+        if(!this.url.deleteBatch){
+          this.$message.error("璇疯缃畊rl.deleteBatch灞炴��!")
+          return
+        }
+        if (this.selectedRowKeys.length <= 0) {
+          // this.$message.warning('璇烽�夋嫨涓�鏉¤褰曪紒');
+          this.$notification.warning({
+            message:'娑堟伅',
+            description:"璇烽�夋嫨涓�鏉¤褰�"
+          });
+          return;
+        } else {
+          var ids = "";
+          for (var a = 0; a < this.selectedRowKeys.length; a++) {
+            ids += this.selectedRowKeys[a] + ",";
+          }
+          var that = this;
+          this.$confirm({
+            title: "纭鍒犻櫎",
+            content: "鏄惁鍒犻櫎閫変腑鏁版嵁?",
+            onOk: function () {
+              that.loading = true;
+              deleteAction(that.url.deleteBatch, {ids: ids}).then((res) => {
+                if (res.success) {
+                  //閲嶆柊璁$畻鍒嗛〉闂
+                  that.reCalculatePage(that.selectedRowKeys.length)
+                  // that.$message.success(res.message);
+                  that.$notification.success({
+                    message:'娑堟伅',
+                    description:res.message
+                  });
+                  that.loadData();
+                  that.onClearSelected();
+                  that.$emit('delectTree','')
+                } else {
+                  // that.$message.warning(res.message);
+                  that.$notification.warning({
+                    message:'娑堟伅',
+                    description:res.message
+                  });
+                }
+              }).finally(() => {
+                that.loading = false;
+              });
+            }
+          });
+        }
+      },
+      handleDelete: function (id) {
+        if(!this.url.delete){
+          this.$message.error("璇疯缃畊rl.delete灞炴��!")
+          return
+        }
+        var that = this;
+        deleteAction(that.url.delete, {ids: id}).then((res) => {
+          if (res.success) {
+            //閲嶆柊璁$畻鍒嗛〉闂
+            that.reCalculatePage(1)
+            // that.$message.success(res.message);
+            that.$notification.success({
+              message:'娑堟伅',
+              description:res.message
+            });
+            that.loadData();
+            that.onClearSelected();
+            that.$emit('delectTree','')
+          } else {
+            // that.$message.warning(res.message);
+            that.$notification.warning({
+              message:'娑堟伅',
+              description:res.message
+            });
+          }
+        })
+      },
+      handleDeleteZi: function (id) {
+        if(!this.url.delete){
+          this.$message.error("璇疯缃畊rl.delete灞炴��!")
+          return
+        }
+        let that = this;
+        getAction(that.url.updateBatchSection, {ids: id}).then((res) => {
+          if (res.success) {
+            //閲嶆柊璁$畻鍒嗛〉闂
+           that.reCalculatePage(1)
+            // that.$message.success(res.message);
+            that.$notification.success({
+              message:'娑堟伅',
+              description:res.message
+            });
+            that.loadData2();
+            // that.onClearSelected();
+            // that.$emit('delectTree','')
+          } else {
+            // that.$message.warning(res.message);
+            that.$notification.warning({
+              message:'娑堟伅',
+              description:res.message
+            });
+          }
+        })
+      },
+      getQueryParams2() {
+        //鑾峰彇鏌ヨ鏉′欢
+        let sqp = {}
+        if (this.superQueryParams2) {
+          sqp['superQueryParams'] = encodeURI(this.superQueryParams2)
+          sqp['superQueryMatchType'] = this.superQueryMatchType2
+        }
+        var param = Object.assign(sqp, this.queryParam2, this.isorter2, this.filters2)
+        param.field = this.getQueryField2()
+        param.pageNo = this.ipagination2.current
+        param.pageSize = this.ipagination2.pageSize
+        param.sectionId = this.sectionId
+        return filterObj(param)
+      },
+      loadData2(arg) {
+        if (!this.url.list2) {
+          this.$message.error('璇疯缃畊rl.list2灞炴��!')
+          return
+        }
+        //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭
+        if (arg === 1) {
+          this.ipagination2.current = 1
+        }
+        if (this.currentRoleId === '') return
+        let params = this.getQueryParams2()//鏌ヨ鏉′欢
+        params.roleId = this.currentRoleId
+        this.loading2 = true
+        getAction(this.url.list2, params).then((res) => {
+          if (res.success) {
+            this.dataSource2 = res.result.records
+            this.ipagination2.total = res.result.total
+
+          }
+          this.loading2 = false
+        })
+
+      },
+      getQueryField2() {
+        //TODO 瀛楁鏉冮檺鎺у埗
+        var str = 'id,'
+        this.columns2.forEach(function(value) {
+          str += ',' + value.dataIndex
+        })
+        return str
+      },
+      handleTableChange2(pagination, filters, sorter) {
+        //鍒嗛〉銆佹帓搴忋�佺瓫閫夊彉鍖栨椂瑙﹀彂
+        //TODO 绛涢��
+        if (Object.keys(sorter).length > 0) {
+          this.isorter2.column = sorter.field
+          this.isorter2.order = 'ascend' == sorter.order ? 'asc' : 'desc'
+        }
+        this.ipagination2 = pagination
+        this.loadData2()
+      },
+      modalFormOk(val) {
+        // 鏂板/淇敼 鎴愬姛鏃讹紝閲嶈浇鍒楄〃
+        this.loadData();
+        this.loadData2()
+        this.$emit('openBasetree','')
+        this.selectedRowKeys = []
+      },
+      handleEdit: function (record) {
+        if (record.id) {
+          this.$refs.modalForm.title = '缂栬緫'
+          this.$refs.modalForm.disableSubmit = false
+          this.$refs.modalForm.edit(record)
+        } else {
+          this.$refs.tierModalForm.title = '缂栬緫'
+          this.$refs.tierModalForm.disableSubmit = false
+          this.$refs.tierModalForm.edit(record)
+        }
+      },
+      // handleEdit() {
+      //   this.selectionRows = this.dataSource.filter(item => this.selectedRowKeys[0] == item.id)
+      //   let row = this.selectionRows[0]
+      //   if (row.equipmentId) {
+      //     this.$refs.modalForm.title = '缂栬緫璁惧'
+      //     this.$refs.modalForm.disableSubmit = false
+      //     this.$refs.modalForm.edit(row)
+      //   } else {
+      //     this.$refs.tierModalForm.title = '缂栬緫灞傜骇'
+      //     this.$refs.tierModalForm.disableSubmit = false
+      //     this.$refs.tierModalForm.edit(row)
+      //   }
+      // },
+      handleAdd() {
+        if (this.node && JSON.stringify(this.node) != '{}') {
+        //   // console.log(this.node);
+        //   if(this.node.entity.equipmentId != null){
+        //     // alert('涓嶅彲鍦ㄦ灞傜骇涓嬪鍔犺澶�')
+        //     this.$message.warning('涓嶅彲鍦ㄦ灞傜骇涓嬪鍔犺澶囷紒')
+        //   }else{
+            this.$refs.modalForm.add(this.node)
+            this.$refs.modalForm.title = '鏂板浜哄憳'
+            this.$refs.modalForm.disableSubmit = false
+          // }
+        } else {
+          this.$message.warning('璇烽�夋嫨鎵�灞炲眰绾э紒')
+        }
+      },
+      handleAddTier() {
+        // if (this.node && JSON.stringify(this.node) != '{}') {
+          // if(this.node.entity.equipmentId != null){
+          //   // alert('涓嶅彲鍦ㄦ灞傜骇涓嬪鍔犲眰绾�')
+          //   this.$message.warning('涓嶅彲鍦ㄦ灞傜骇涓嬪鍔犲眰绾э紒')
+          // }else{
+            this.$refs.tierModalForm.add(this.node)
+            this.$refs.tierModalForm.title = '鏂板閮ㄩ棬'
+            this.$refs.tierModalForm.disableSubmit = false
+          // }
+        // }else{
+        //   this.$refs.tierModalForm.add(this.node)
+        //   this.$refs.tierModalForm.title = '鏂板閮ㄩ棬'
+        //   this.$refs.tierModalForm.disableSubmit = false
+        // }
+      },
+      pQuery(parentId) {
+        this.queryParam.parentId = parentId[0]
+        if(this.selectedRowKeys.length >= 1) {
+          this.selectedRowKeys.length = 0
+        }
+        this.loadData()
+      },
+      onSelectChange(selectedRowKeys, selectionRows) {
+        this.selectedRowKeys = selectedRowKeys;
+        this.selectionRows = selectionRows;
+        // console.log(this.selectedRowKeys)
+        this.sectionId =  this.selectedRowKeys[0]
+        // console.log(this.sectionId)
+        // this.ipagination2.current = 1
+        this.loadData2(1)
+      },
+    },
+    created() {
+    }
+  }
+</script>
+
+<style lang="less" scoped>
+  @import '~@assets/less/common.less';
+
+  @media screen and (min-width: 1920px){
+    .device_list{
+      height: 748px!important;
+      overflow: scroll;
+    }
+  }
+  @media screen and (min-width: 1680px) and (max-width: 1920px){
+    .device_list{
+      height: 748px!important;
+      overflow: scroll;
+    }
+  }
+  @media screen and (min-width: 1400px) and (max-width: 1680px){
+    .device_list{
+      height: 600px!important;
+      overflow: scroll;
+    }
+  }
+  @media screen and (min-width: 1280px) and (max-width: 1400px){
+    .device_list{
+      height: 501px!important;
+      overflow: scroll;
+    }
+  }
+  @media screen and (max-width: 1280px){
+    .device_list{
+      height: 501px!important;
+      overflow: scroll;
+    }
+  }
+</style>

--
Gitblit v1.9.3