peng
2026-03-24 e46f783a80c0111053b88e2814c78e1a8fc1290e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<template>
  <!-- 操作按钮区域 -->
  <div class="table-card" ref="tableCard" :bordered="false">
    <div class="table-operator">
      <a-form class="query-form" layout="inline" :form="queryParam" @keyup.enter.native="searchQuery">
        <a-form-item label="机构名称">
          <a-input style="width: 150px" placeholder="请输入机构名称" v-model.trim="queryParam.searchKey"/>
        </a-form-item>
        <a-button @click="searchQuery" type="primary" icon="search">查询</a-button>
        <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      </a-form>
    </div>
    <!-- table区域-begin -->
    <div>
      <split-pane :min-precent="10" :default-percent="17" split="vertical">
        <template slot="paneL">
          <div class="organ_tree_ct">
            <organ-tree height="67vh" ref="orgTree" @on-tree-node-select="onTreeNodeSelect"></organ-tree>
          </div>
        </template>
        <template slot="paneR">
          <a-table
            class="infoTable"
            ref="table"
            size="middle"
            rowKey="licenseNum"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="ipagination"
            :loading="loading"
            @change="handleTableChange"
          >
          <span slot="action" slot-scope="text, record">
              <span v-show="record.orgCategory !== '1'">
                <a @click="handleEdit(record)">编辑</a>
                <a-divider type="vertical"/>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                <a>删除</a>
              </a-popconfirm>
              </span>
 
          </span>
          </a-table>
        </template>
      </split-pane>
    </div>
    <!-- table区域-end -->
    <depart-modal ref="sysDepartModal" @ok="modalFormOk"></depart-modal>
  </div>
</template>
<script>
import OrganTree from '../tools/OrganTree'
import {JeecgListMixin} from '@tievd/cube-block/lib/mixins/JeecgListMixin'
import splitPane from 'vue-splitpane'
import DepartModal from "@views/system/modules/DepartModal";
import {httpAction, postAction, putAction, deleteAction} from '@tievd/cube-block/lib/api/manage'
 
// 表头
const columns = [
  {
    title: '机构名称',
    align: "center",
    dataIndex: 'departName',
  },
  {
    title: '机构类型',
    align: "center",
    dataIndex: 'category_dictText',
  },
  {
    title: '上级机构',
    align: 'center',
    dataIndex: 'parentName',
  },
  {
    title: '地址',
    align: "center",
    dataIndex: 'address',
  },
  {
    title: '操作',
    align: 'center',
    dataIndex: 'action',
    scopedSlots: {customRender: 'action'},
  },
]
 
export default {
  name: 'DepartList',
  mixins: [JeecgListMixin],
  components: {
    DepartModal,
    OrganTree,
    splitPane,
  },
  // 页面数据
  data() {
    return {
      iExpandedKeys: [],
      loading: false,
      autoExpandParent: true,
      currFlowId: '',
      currFlowName: '',
      disable: true,
      treeData: [],
      visible: false,
      departTree: [],
      rightClickSelectedKey: '',
      rightClickSelectedOrgCode: '',
      hiding: true,
      model: {},
      dropTrigger: '',
      depart: {},
      columns: columns,
      disableSubmit: false,
      checkedKeys: [],
      selectedKeys: [],
      autoIncr: 1,
      currSelected: {},
 
      allTreeKeys: [],
      checkStrictly: true,
 
      form: this.$form.createForm(this),
      labelCol: {
        xs: {span: 24},
        sm: {span: 5},
      },
      wrapperCol: {
        xs: {span: 24},
        sm: {span: 16},
      },
      graphDatasource: {
        nodes: [],
        edges: [],
      },
      validatorRules: {
        departName: {rules: [{required: true, message: '请输入机构名称!'}]},
        orgCode: {rules: [{required: true, message: '请输入机构编码!'}]},
        orgCategory: {rules: [{required: true, message: '请输入机构类型!'}]},
      },
      url: {
        list: '/jyz/custom/sys/depart/tables',
        delete: '/jyz/custom/sys/depart/delete',
      },
      orgCategoryDisabled: false,
      /* 分页参数 */
      ipagination: {
        current: 1,
        pageSize: 15,
        pageSizeOptions: ['15', '30', '50'],
        showTotal: function showTotal(total, range) {
          return range[0] + '-' + range[1] + ' 共' + total + '条';
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
      queryParam: {
        parentCode: JSON.parse(localStorage.getItem("userDepartInfo")).orgCode,
        parentId: JSON.parse(localStorage.getItem("userDepartInfo")).id
      }
    }
  },
  // 计算属性
  computed: {},
  // 方法
  methods: {
    handleDelete: function handleDelete(id) {
      if (!this.url.delete) {
        this.$message.error('请设置url.delete属性!');
        return;
      }
      var that = this;
      deleteAction(that.url.delete, { id: id }).then(function (res) {
        if (res.success) {
          that.$message.success(res.message);
          that.$refs.orgTree.loadTree();
          that.loadData();
        } else {
          that.$message.warning(res.message);
        }
      });
    },
    onTreeNodeSelect(id, node) {
      this.queryParam.parentCode = node.selectedNodes[0].data.props.orgCode
      this.queryParam.parentId = node.selectedNodes[0].data.props.id
      this.loadData()
    },
    handleEdit: function (record) {
      this.$refs.sysDepartModal.edit(record)
      this.$refs.sysDepartModal.title = '编辑'
    },
    handleAdd() {
      /*this.$refs.sysDepartModal.add({parentId: this.queryParam.parentId})*/
      this.$refs.sysDepartModal.add()
      this.$refs.sysDepartModal.title = '新增'
    },
    modalFormOk() {
      this.$refs.orgTree.loadTree();
      this.loadData();
    }
  },
  created() {
 
  },
  // 在created后执行
  mounted() {
 
  },
 
  // 监听
  watch: {}
 
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
 
.organ_tree_ct {
  height: 76vh;
}
.query-form{
  display: flex;
  align-items: center;
  button{
    margin-bottom: 0 !important;
  }
}
</style>