瀏覽代碼

fix:部门管理相关bug修复

scholar-wei 3 年之前
父節點
當前提交
0e7683f7df

二進制
CallCenterWeb.UI/.DS_Store


+ 154 - 156
CallCenterWeb.UI/RMYY/src/views/systemSetup/roleSetting/department/component/addOrEdit.vue

@@ -17,7 +17,7 @@
17 17
         <el-input v-model="ruleForm.location" placeholder="请输入部门位置" />
18 18
       </el-form-item>
19 19
       <el-form-item label="排序编号" prop="sort">
20
-        <el-input v-model.number="ruleForm.sort" maxlength="20" placeholder="请输入排序编号" />
20
+        <el-input v-model.number="ruleForm.sort" type="number" maxlength="20" placeholder="请输入排序编号" />
21 21
       </el-form-item>
22 22
       <el-form-item>
23 23
         <el-button type="primary" @click="submitForm">保存</el-button>
@@ -27,184 +27,182 @@
27 27
 </template>
28 28
 
29 29
 <script>
30
-  import {
31
-    getTreeList,
32
-    addType,
33
-    editType,
34
-    getTypeDetail
35
-  } from '@/api/systemSetup/roleSetting/department'
36
-  import selectDeptTree from '../../../../../components/context/commonSelect/selectDeptTree.vue'
37
-  export default {
38
-    name: 'AddOrEditKnowledge',
39
-    props: {
40
-      rowid: {
41
-        type: String,
42
-        default: ''
30
+import store from '@/store'
31
+import {
32
+  getTreeList,
33
+  addType,
34
+  editType,
35
+  getTypeDetail
36
+} from '@/api/systemSetup/roleSetting/department'
37
+import selectDeptTree from '../../../../../components/context/commonSelect/selectDeptTree.vue'
38
+export default {
39
+  name: 'AddOrEditKnowledge',
40
+  props: {
41
+    rowid: {
42
+      type: String,
43
+      default: ''
44
+    },
45
+    layerid: {
46
+      type: String,
47
+      default: ''
48
+    },
49
+    listPid: {
50
+      type: Number,
51
+      default: 0
52
+    },
53
+    clickId: {
54
+      type: String,
55
+      default: ''
56
+    },
57
+    clickType: {
58
+      type: Number,
59
+      default: 0
60
+    }
61
+  },
62
+  data() {
63
+    return {
64
+      loading: false,
65
+      deptid: [],
66
+      ruleForm: {
67
+        id: this.rowid,
68
+        DeptId: '',
69
+        hosid: '',
70
+        pid: 0,
71
+        name: '', // 分类名称 name
72
+        code: '',
73
+        officeTelephone: '',
74
+        location: '',
75
+        sort: '' // 序号
43 76
       },
44
-      layerid: {
45
-        type: String,
46
-        default: ''
77
+      hospitalsParam: {
78
+        id: 0,
79
+        name: ''
47 80
       },
48
-      listPid: {
49
-        type: Number,
50
-        default: 0
81
+      hospitals: [], // 院区
82
+      deptmentName: [], // 部门列表
83
+      rules: {
84
+        name: [
85
+          { required: true, message: '请输入部门名称', trigger: 'blur' }
86
+        ],
87
+        DeptId: [
88
+          { required: true, message: '请选择上级部门', trigger: 'blur' }
89
+        ]
90
+
51 91
       },
52
-      addPid: {
53
-        type: String,
54
-        default: ''
92
+      // 自定义菜单下拉数据的key值
93
+      props: {
94
+        value: 'id',
95
+        label: 'text'
55 96
       },
56
-      addParentid: {
57
-        type: String,
58
-        default: ''
59
-      }
60
-    },
61
-    data() {
62
-      return {
63
-        loading: false,
64
-        deptid: [],
65
-        ruleForm: {
66
-          id: this.rowid,
67
-          DeptId: '',
68
-          hosid: '',
69
-          pid: '',
70
-          name: '', // 分类名称 name
71
-          code: '',
72
-          officeTelephone: '',
73
-          location: '',
74
-          sort: '', // 序号
75
-        },
76
-        hospitalsParam: {
77
-          id: 0,
78
-          name: ''
79
-        },
80
-        hospitals: [], // 院区
81
-        deptmentName: [],
82
-        rules: {
83
-
84
-        },
85
-        // 自定义菜单下拉数据的key值
86
-        props: {
87
-          value: 'id',
88
-          label: 'text'
89
-        },
90
-        addEditJudgment: true, // 添加flase 编辑true
91
-        addEditLock: true // 添加true 编辑false
92
-      }
93
-    },
94
-    // watch: {
95
-    //   addPid(newVal) {
96
-    //     this.deptid = this.$store.getters.deptmap[parseInt(newVal)].ids
97
-    //   }
98
-    // },
99
-    created() {
100
-      this.getDeptment() // 部门
101
-      if (this.rowid && this.addParentid != '-1') {
102
-        console.log('555')
103
-        this.getTypeDetails(this.rowid)
97
+      addEditJudgment: true, // 添加flase 编辑true
98
+      addEditLock: true // 添加true 编辑false
99
+    }
100
+  },
101
+  async created() {
102
+    await this.getDeptment() // 部门
103
+    this.ruleForm.DeptId = this.clickId
104
+    if (this.clickType === 1) {
105
+      this.deptid = [this.clickId]
106
+      this.ruleForm.hosid = this.deptid[0]
107
+    } else {
108
+      if (this.rowid) {
109
+        this.getTypeDetails(this.clickId)
110
+      } else {
111
+        this.deptid = this.$store.getters.deptmap[parseInt(this.clickId)].ids
112
+        this.ruleForm.hosid = this.deptid[0]
113
+        this.ruleForm.pid = this.clickId
104 114
       }
105
-      if (this.addPid) {
106
-        console.log('666', this.addPid)
107
-        if (this.addParentid != '-1') {
108
-          this.deptid = this.$store.getters.deptmap[parseInt(this.addPid)].ids
109
-          this.ruleForm.hosid = this.deptid[0]
110
-        } else {
111
-          this.deptid = [this.addPid]
112
-          this.ruleForm.hosid = this.addPid
115
+    }
116
+  },
117
+  methods: {
118
+    // 获取菜单详情
119
+    getTypeDetails(rowid) {
120
+      getTypeDetail(rowid).then((response) => {
121
+        if (response.state.toLowerCase() === 'success') {
122
+          const res = response.data
123
+          this.ruleForm.id = res.F_DeptId
124
+          this.ruleForm.pid = res.F_ParentId // 父节点id
125
+          this.ruleForm.name = res.F_DeptName // 分类名称
126
+          this.ruleForm.sort = res.F_Sort // 排序
127
+          this.ruleForm.code = res.F_DeptCode // 编码
128
+          this.ruleForm.officeTelephone = res.F_OfficeTelephone // 电话
129
+          this.ruleForm.location = res.F_Location // 位置
130
+          this.ruleForm.DeptId = res.F_DeptId.toString() // 所属部门Number(res.F_DeptId)
131
+          this.ruleForm.hosid = res.T_Woid
132
+          this.deptid = this.$store.getters.deptmap[parseInt(this.clickId)].ids
113 133
         }
114
-        console.log(this.deptid)
115
-      }
134
+      })
116 135
     },
117
-    methods: {
118
-      // 获取菜单详情
119
-      getTypeDetails(rowid) {
120
-        getTypeDetail(rowid).then((response) => {
136
+    // 获取部门列表
137
+    getDeptment() {
138
+      return new Promise((resolve) => {
139
+        getTreeList().then((response) => {
121 140
           if (response.state.toLowerCase() === 'success') {
122
-            const res = response.data
123
-            this.ruleForm.id = res.F_DeptId
124
-            this.ruleForm.pid = res.F_ParentId // 父节点id
125
-            this.ruleForm.name = res.F_DeptName // 分类名称
126
-            this.ruleForm.sort = res.F_Sort // 排序
127
-            this.ruleForm.code = res.F_DeptCode //编码
128
-            this.ruleForm.officeTelephone = res.F_OfficeTelephone //电话
129
-            this.ruleForm.location = res.F_Location //位置
130
-            this.ruleForm.DeptId = res.F_DeptId.toString() // 所属部门Number(res.F_DeptId)
131
-            const levelid = response.data.F_ParentId
132
-            this.deptid = this.$store.getters.deptmap[parseInt(res.F_DeptId)].ids
133
-            console.log(this.deptid)
134
-            this.ruleForm.hosid = this.deptid[0]
141
+            this.deptmentName = response.data
135 142
           }
136 143
         })
137
-      },
138
-      // 获取部门列表
139
-      getDeptment() {
140
-        return new Promise((resolve) => {
141
-          getTreeList().then((response) => {
142
-            if (response.state.toLowerCase() === 'success') {
143
-              this.deptmentName = response.data
144
-            }
145
-          })
146
-          resolve()
147
-        })
148
-      },
149
-      // // 院区
150
-      // getHospitals(data) {
151
-      //   this.ruleForm.hosid = data.value
152
-      // },
153
-      getDeptid(data) {
154
-        console.log(data, '999999')
155
-        this.ruleForm.hosid = data[0]
156
-        this.ruleForm.pid = data[data.length - 1]
157
-        this.deptid = data
158
-        // console.log(this.ruleForm.hosid,this.ruleForm.pid)
159
-        // this.ruleForm.DeptId=data
160
-      },
161
-      submitForm() {
162
-        this.$refs.ruleForm.validate((valid) => {
163
-          if (valid) {
164
-            this.loading = true
165
-            if (!this.rowid) {
166
-              // 添加
167
-              if (this.addPid) {
168
-                this.ruleForm.pid = this.addPid
169
-              }
170
-              addType(this.ruleForm)
171
-                .then((response) => {
172
-                  this.loading = false
173
-                  if (response.state.toLowerCase() === 'success') {
174
-                    this.$parent.$layer.close(this.layerid)
175
-                    this.$message.success('恭喜你,添加成功!')
176
-                    this.$parent.getDepList() // 重新加载父级数据
177
-                    this.$parent.getTreeList()
178
-                  }
179
-                })
180
-                .catch(() => {
181
-                  this.loading = false
182
-                })
183
-              return
184
-            }
185
-            // 编辑
186
-            editType(this.ruleForm)
144
+        resolve()
145
+      })
146
+    },
147
+    getDeptid(data) {
148
+      this.ruleForm.hosid = data[0]
149
+      this.ruleForm.DeptId = data[data.length - 1]
150
+      if (data.length > 1) {
151
+        this.ruleForm.pid = this.ruleForm.DeptId
152
+      } else {
153
+        this.ruleForm.pid = 0
154
+      }
155
+      this.deptid = data
156
+    },
157
+    submitForm() {
158
+      this.$refs.ruleForm.validate((valid) => {
159
+        if (valid) {
160
+          this.loading = true
161
+          if (!this.rowid) {
162
+            // 添加
163
+            addType(this.ruleForm)
187 164
               .then((response) => {
188 165
                 this.loading = false
189 166
                 if (response.state.toLowerCase() === 'success') {
190 167
                   this.$parent.$layer.close(this.layerid)
191
-                  // this.$parent.getDepList(this.listPid) // 重新加载父级数据this.listPid
192
-                  this.$message.success('恭喜你,编辑成功!')
168
+                  this.$message.success('恭喜你,添加成功!')
169
+                  this.$parent.getDepList() // 重新加载父级数据
193 170
                   this.$parent.getTreeList()
194
-                  // this.$parent.handleNodeClick(this.addPid)
171
+                  store.dispatch('getDeptTree')
195 172
                 }
196 173
               })
197 174
               .catch(() => {
198 175
                 this.loading = false
199 176
               })
200
-          } else {
201
-            this.$message.error('请输入有效的必填项信息!')
202
-            return false
177
+            return
203 178
           }
204
-        })
205
-      }
179
+          // 编辑
180
+          editType(this.ruleForm)
181
+            .then((response) => {
182
+              this.loading = false
183
+              if (response.state.toLowerCase() === 'success') {
184
+                this.$parent.$layer.close(this.layerid)
185
+                // this.$parent.getDepList(this.listPid) // 重新加载父级数据this.listPid
186
+                this.$message.success('恭喜你,编辑成功!')
187
+                store.dispatch('getDeptTree')
188
+                this.$parent.getTreeList()
189
+                this.$parent.handleNodeClick({
190
+                  id: this.rowid,
191
+                  TypeId: 2
192
+                })
193
+              }
194
+            })
195
+            .catch(() => {
196
+              this.loading = false
197
+            })
198
+        } else {
199
+          this.$message.error('请输入有效的必填项信息!')
200
+          return false
201
+        }
202
+      })
206 203
     }
207 204
   }
205
+}
208 206
 </script>
209 207
 
210 208
 <style lang="scss" scoped></style>

+ 229 - 243
CallCenterWeb.UI/RMYY/src/views/systemSetup/roleSetting/department/index.vue

@@ -3,291 +3,277 @@
3 3
     <el-row :gutter="24">
4 4
       <el-col :span="6">
5 5
         <el-alert :closable="false" title="部门列表" type="success" />
6
-        <el-input v-model="filterText" placeholder="请输入部门名称" class="filter-item" style="margin-top: 10px;" size="small"
6
+        <el-input
7
+          v-model="filterText"
8
+          placeholder="请输入部门名称"
9
+          class="filter-item"
10
+          style="margin-top: 10px;"
11
+          size="small"
7 12
           clearable />
8
-        <el-tree ref="treeRef" :props="defaultProps" :data="treelists" node-key="id" :highlight-current='true'
9
-          :default-expand-all='false' @node-click="handleNodeClick" :filter-node-method="filterNode" />
13
+        <el-tree
14
+          ref="treeRef"
15
+          :props="defaultProps"
16
+          :data="treelists"
17
+          :highlight-current="true"
18
+          :default-expand-all="false"
19
+          :filter-node-method="filterNode"
20
+          node-key="id"
21
+          @node-click="handleNodeClick" />
10 22
       </el-col>
11 23
       <el-col :span="18">
12 24
         <el-alert :closable="false" title="部门信息" type="success" style="margin-bottom: 5px;" />
13
-        <table class="tabdept" cellspacing="0" cellpadding="0" v-if="selectdeptid&&selectpid!='-1'">
25
+        <table v-if="clickType !== 1" class="tabdept" cellspacing="0" cellpadding="0">
14 26
           <tr>
15 27
             <th>部门:</th>
16
-            <td>{{tabdata.F_DeptName}}</td>
28
+            <td>{{ tabdata.F_DeptName }}</td>
17 29
             <th>编码:</th>
18
-            <td>{{tabdata.F_DeptCode}}</td>
30
+            <td>{{ tabdata.F_DeptCode }}</td>
19 31
             <th>办公电话:</th>
20
-            <td>{{tabdata.F_OfficeTelephone}}</td>
32
+            <td>{{ tabdata.F_OfficeTelephone }}</td>
21 33
           </tr>
22 34
           <tr>
23 35
             <th>位置:</th>
24
-            <td colspan="3">{{tabdata.F_Location}}</td>
36
+            <td colspan="3">{{ tabdata.F_Location }}</td>
25 37
             <th>排序:</th>
26
-            <td>{{tabdata.F_Sort}}</td>
38
+            <td>{{ tabdata.F_Sort }}</td>
27 39
           </tr>
28 40
         </table>
29 41
         <el-button v-permission="'add_department'" size="medium" type="primary" @click="btn_add()">增加子部门</el-button>
30
-        <el-button v-permission="'edit_department'" v-if="selectdeptid&&selectpid!='-1'" size="medium" type="primary" @click="btn_edit()">编辑</el-button>
31
-        <el-button v-permission="'delete_department'" v-if="selectdeptid&&selectpid!='-1'" size="medium" type="danger" @click="btn_delete()">删除</el-button>
42
+        <el-button v-permission="'edit_department'" v-if="clickType !== 1" size="medium" type="primary" @click="btn_edit()">编辑</el-button>
43
+        <el-button v-permission="'delete_department'" v-if="clickType !== 1" size="medium" type="danger" @click="btn_delete()">删除</el-button>
32 44
       </el-col>
33 45
     </el-row>
34 46
   </div>
35 47
 </template>
36 48
 <script>
37
-  import {
38
-    getScoreList,
39
-    deleteType,
40
-    deleteScore,
41
-    getDepartmentList,
42
-    getTypeDetail
43
-  } from '@/api/systemSetup/roleSetting/department'
44
-  import addOrEditDepartment from './component/addOrEdit'
45
-  import {
46
-    getListyqlistall
47
-  } from '@/api/faultRepair/faultRepair'
48
-  import {
49
-    getDeptTree
50
-  } from '@/api/systemSetup/roleSetting/userManage'
51
-  import Pagination from '@/components/context/Pagination' // 对el-pagination 二次封装
52
-  export default {
53
-    name: 'Department',
54
-    components: {
55
-      Pagination
49
+import {
50
+  deleteType,
51
+  getDepartmentList,
52
+  getTypeDetail
53
+} from '@/api/systemSetup/roleSetting/department'
54
+import addOrEditDepartment from './component/addOrEdit'
55
+
56
+import {
57
+  getDeptTree
58
+} from '@/api/systemSetup/roleSetting/userManage'
59
+import Pagination from '@/components/context/Pagination' // 对el-pagination 二次封装
60
+export default {
61
+  name: 'Department',
62
+  components: {
63
+    Pagination
64
+  },
65
+  filters: {
66
+    judgmentLockName(status) {
67
+      const statusMap = {
68
+        0: '未锁定',
69
+        1: '锁定'
70
+      }
71
+      return statusMap[status]
56 72
     },
57
-    filters: {
58
-      judgmentLockName(status) {
59
-        const statusMap = {
60
-          0: '未锁定',
61
-          1: '锁定'
62
-        }
63
-        return statusMap[status]
73
+    judgmentTargetMoney(status) {
74
+      if (status === 0) {
75
+        return ''
76
+      } else {
77
+        return status
78
+      }
79
+    }
80
+  },
81
+  data() {
82
+    return {
83
+      ruleForm: {
84
+        keyword: '',
85
+        hosid: ''
64 86
       },
65
-      judgmentTargetMoney(status) {
66
-        if (status === 0) {
67
-          return ''
68
-        } else {
69
-          return status
70
-        }
87
+      filterText: '',
88
+      teamkeyword: '',
89
+      clickId: 1,
90
+      clickType: 1,
91
+      // selectedId: '',
92
+      // addParentid: '',
93
+      listGrade: 1,
94
+      listPid: 0,
95
+      // addPid: 0,
96
+      depId: 0, // 最后一级部门id
97
+      loading: false,
98
+      hospitals: [], // 院区
99
+      pageParams: {
100
+        pageindex: 1, // 当前第几页
101
+        pagesize: Number(this.$store.getters.serverConfig.PAGESIZE), // 每页几条数据
102
+        total: 0 // 总共多少数据
103
+      },
104
+      pageParamsSecond: {
105
+        pageindex: 1, // 当前第几页
106
+        pagesize: Number(this.$store.getters.serverConfig.PAGESIZE), // 每页几条数据
107
+        total: 0 // 总共多少数据
108
+      },
109
+      pageParamsThird: {
110
+        pageindex: 1, // 当前第几页
111
+        pagesize: Number(this.$store.getters.serverConfig.PAGESIZE), // 每页几条数据
112
+        total: 0 // 总共多少数据
113
+      },
114
+      defaultProps: {
115
+        children: 'children',
116
+        label: 'text',
117
+        value: 'id'
118
+      },
119
+      tabdata: {
120
+        name: '总部/综合保障中心',
121
+        code: 'ZHBZZX',
122
+        phone: '0371-888888888',
123
+        address: '东区一楼501',
124
+        sort: '9'
125
+      },
126
+      selectdeptid: '',
127
+      selectpid: '',
128
+      treelists: [], // 菜单树数据
129
+      dataLists: [], // 中心管理列表数据
130
+      teamLists: [], // 小组列表数据
131
+      departmentDataLists: [] // 部门列表数据
132
+    }
133
+  },
134
+  watch: {
135
+    filterText(val) {
136
+      this.$refs.treeRef.filter(val)
137
+    }
138
+  },
139
+  created() {
140
+    this.getTreeList()
141
+    document.onkeyup = (e) => {
142
+      if (e.keyCode === 13) {
143
+        // this.getdepts()
71 144
       }
145
+    }
146
+  },
147
+  methods: {
148
+    filterNode(value, data) {
149
+      if (!value) return true
150
+      return data.text.indexOf(value) !== -1
72 151
     },
73
-    data() {
74
-      return {
75
-        ruleForm: {
76
-          keyword: '',
77
-          hosid: ''
78
-        },
79
-        filterText:'',
80
-        teamkeyword: '',
81
-        selectedId: '',
82
-        addParentid:'',
83
-        listGrade: 1,
84
-        listPid: 0,
85
-        addPid: 0,
86
-        depId: 0, // 最后一级部门id
87
-        loading: false,
88
-        clickId: '', // 中心点击id
89
-        hospitals: [], // 院区
90
-        pageParams: {
91
-          pageindex: 1, // 当前第几页
92
-          pagesize: Number(this.$store.getters.serverConfig.PAGESIZE), // 每页几条数据
93
-          total: 0 // 总共多少数据
94
-        },
95
-        pageParamsSecond: {
96
-          pageindex: 1, // 当前第几页
97
-          pagesize: Number(this.$store.getters.serverConfig.PAGESIZE), // 每页几条数据
98
-          total: 0 // 总共多少数据
99
-        },
100
-        pageParamsThird: {
101
-          pageindex: 1, // 当前第几页
102
-          pagesize: Number(this.$store.getters.serverConfig.PAGESIZE), // 每页几条数据
103
-          total: 0 // 总共多少数据
104
-        },
105
-        defaultProps: {
106
-          children: 'children',
107
-          label: 'text',
108
-          value: 'id'
109
-        },
110
-        tabdata: {
111
-          name: '总部/综合保障中心',
112
-          code: 'ZHBZZX',
113
-          phone: '0371-888888888',
114
-          address: '东区一楼501',
115
-          sort: '9'
116
-        },
117
-        selectdeptid: '',
118
-        selectpid:'',
119
-        treelists: [], // 菜单树数据
120
-        dataLists: [], // 中心管理列表数据
121
-        teamLists: [], // 小组列表数据
122
-        departmentDataLists: [] // 部门列表数据
152
+    // 部门分类
153
+    getDepList(listPid) {
154
+      if (listPid != null) {
155
+        this.depId = listPid
156
+        this.listGrade--
123 157
       }
158
+      this.loading = true
159
+      return new Promise((resolve) => {
160
+        const params = {
161
+          pageindex: this.pageParams.pageindex, // 第几页
162
+          pagesize: this.pageParams.pagesize, // 每页几条信息
163
+          pid: this.depId,
164
+          keyword: this.ruleForm.keyword.trim(),
165
+          hosid: this.ruleForm.hosid
166
+        }
167
+        getDepartmentList(params)
168
+          .then((response) => {
169
+            this.loading = false
170
+            this.departmentDataLists = response.rows
171
+            this.pageParams.total = response.total
172
+          })
173
+          .catch((result) => {
174
+            this.loading = false
175
+            this.departmentDataLists = []
176
+          })
177
+        resolve()
178
+      })
179
+    },
180
+    getdepts() {
181
+
124 182
     },
125
-    watch: {
126
-      filterText(val) {
127
-        this.$refs.treeRef.filter(val);
183
+    // 添加
184
+    btn_add() {
185
+      if (this.clickId === '') {
186
+        this.$message.warning('请选择父级部门')
187
+        return
128 188
       }
189
+      this.$layer.iframe({
190
+        content: {
191
+          content: addOrEditDepartment, // 传递的组件对象
192
+          parent: this, // 当前的vue对象
193
+          data: {
194
+            clickId: this.clickId,
195
+            clickType: this.clickType
196
+          } // props//该方法会自动添加一个key为layerid的值, 该值为创建层的id, 可以直接使用
197
+        },
198
+        area: ['50%', '55%'],
199
+        shadeClose: false,
200
+        title: '添加部门分类'
201
+      })
129 202
     },
130
-    created() {
131
-      this.getTreeList()
132
-      document.onkeyup = (e) => {
133
-        if (e.keyCode === 13) {
134
-          // this.getdepts()
135
-        }
203
+
204
+    btn_edit() {
205
+      if (this.clickType === 1 || !this.clickId) {
206
+        this.$message.warning('请选择部门进行编辑')
207
+        return
136 208
       }
137
-      // getTypeDetail(1).then((response) => {
138
-      //   if (response.state.toLowerCase() === 'success') {
139
-      //     this.tabdata = response.data
140
-      //   }
141
-      // })
209
+      this.$layer.iframe({
210
+        content: {
211
+          content: addOrEditDepartment, // 传递的组件对象
212
+          parent: this, // 当前的vue对象
213
+          data: {
214
+            rowid: this.clickId,
215
+            clickId: this.clickId,
216
+            clickType: this.clickType
217
+          } // props//该方法会自动添加一个key为layerid的值, 该值为创建层的id, 可以直接使用
218
+        },
219
+        area: ['50%', '55%'],
220
+        shadeClose: false,
221
+        title: '编辑部门分类'
222
+      })
223
+      this.F_DeptId = ''
142 224
     },
143
-    methods: {
144
-      filterNode(value, data) {
145
-        if (!value) return true;
146
-        return data.text.indexOf(value) !== -1;
147
-      },
148
-      // 部门分类
149
-      getDepList(listPid) {
150
-        if (listPid != null) {
151
-          this.depId = listPid
152
-          this.listGrade--
153
-        }
154
-        this.loading = true
155
-        return new Promise((resolve) => {
156
-          const params = {
157
-            pageindex: this.pageParams.pageindex, // 第几页
158
-            pagesize: this.pageParams.pagesize, // 每页几条信息
159
-            pid: this.depId,
160
-            keyword: this.ruleForm.keyword.trim(),
161
-            hosid: this.ruleForm.hosid
162
-          }
163
-          getDepartmentList(params)
164
-            .then((response) => {
165
-              this.loading = false
166
-              this.departmentDataLists = response.rows
167
-              this.pageParams.total = response.total
168
-            })
169
-            .catch((result) => {
170
-              this.loading = false
171
-              this.departmentDataLists = []
172
-            })
173
-          resolve()
225
+    // 删除
226
+    btn_delete() {
227
+      this.$confirm('您确定要删除吗?', '提示', {
228
+        confirmButtonText: '确定',
229
+        cancelButtonText: '取消',
230
+        type: 'warning'
231
+      })
232
+        .then(() => {
233
+          deleteType(this.clickId).then((response) => {
234
+            if (response.state.toLowerCase() === 'success') {
235
+              this.$message.success('删除成功!')
236
+              this.tabdata = {}
237
+              this.getTreeList()
238
+            }
239
+          })
174 240
         })
175
-      },
176
-      getdepts() {
177
-
178
-      },
179
-      // 添加
180
-      btn_add() {
181
-        if(this.selectdeptid==''){
182
-          this.$message.warning('请选择一行添加子部门')
183
-          return;
184
-        }
185
-        this.$layer.iframe({
186
-          content: {
187
-            content: addOrEditDepartment, // 传递的组件对象
188
-            parent: this, // 当前的vue对象
189
-            data: {
190
-              addPid: this.selectdeptid.toString(),
191
-              addParentid:this.addParentid.toString()
192
-            } // props//该方法会自动添加一个key为layerid的值, 该值为创建层的id, 可以直接使用
193
-          },
194
-          area: ['50%', '55%'],
195
-          shadeClose: false,
196
-          title: '添加部门分类'
241
+        .catch(() => {
242
+          this.$message.info('已取消删除')
197 243
         })
198
-      },
199
-
200
-      btn_edit() {
201
-        // this.F_DeptId = F_DeptId
202
-        // if (F_DeptId === '') {
203
-        //   this.$message({
204
-        //     message: '请选择一行编辑!',
205
-        //     type: 'warning'
206
-        //   })
207
-        //   return
208
-        // }
209
-        if(this.selectdeptid==''||this.selectpid=='-1'){
210
-          this.$message.warning('请选择部门进行编辑')
211
-          return;
212
-        }
213
-        this.$layer.iframe({
214
-          content: {
215
-            content: addOrEditDepartment, // 传递的组件对象
216
-            parent: this, // 当前的vue对象
217
-            data: {
218
-              rowid: this.selectdeptid.toString()
219
-            } // props//该方法会自动添加一个key为layerid的值, 该值为创建层的id, 可以直接使用
220
-          },
221
-          area: ['50%', '55%'],
222
-          shadeClose: false,
223
-          title: '编辑部门分类'
244
+    },
245
+    // 树
246
+    getTreeList() {
247
+      return new Promise((resolve) => {
248
+        getDeptTree(this.parentid).then((response) => {
249
+          if (response.state.toLowerCase() === 'success') {
250
+            this.treelists = response.data
251
+          }
224 252
         })
225
-        this.F_DeptId = ''
226
-      },
227
-      // // 删除
228
-      // btn_delete() {
229
-      //   this.F_DeptId = F_DeptId
230
-      //   if (this.F_DeptId === '') {
231
-      //     this.$message({
232
-      //       message: '没有可删除的选项!',
233
-      //       type: 'warning'
234
-      //     })
235
-      //   } else {
236
-      //     const id = F_DeptId
237
-      //     this.deleteType(F_DeptId)
238
-      //   }
239
-      //   this.F_DeptId = ''
240
-      // },
241
-      // 删除
242
-      btn_delete() {
243
-        this.$confirm('您确定要删除吗?', '提示', {
244
-            confirmButtonText: '确定',
245
-            cancelButtonText: '取消',
246
-            type: 'warning'
247
-          })
248
-          .then(() => {
249
-            deleteType(this.selectdeptid).then((response) => {
250
-              if (response.state.toLowerCase() === 'success') {
251
-                this.$message.success('删除成功!')
252
-                this.tabdata = {}
253
-                this.getTreeList()
254
-              }
255
-            })
256
-          })
257
-          .catch(() => {
258
-            this.$message.info('已取消删除')
259
-          })
260
-      },
261
-      //树
262
-      getTreeList() {
253
+        resolve()
254
+      })
255
+    },
256
+    handleNodeClick(data) {
257
+      console.log(data)
258
+      // this.selectdeptid = data.id
259
+      // this.selectpid = data.parentid
260
+      // this.addParentid = data.parentid
261
+      this.clickId = data.id
262
+      this.clickType = data.TypeId
263
+      if (this.clickType !== 1) {
264
+        // this.selectdeptid = data.id
263 265
         return new Promise((resolve) => {
264
-          getDeptTree(this.parentid).then((response) => {
266
+          getTypeDetail(this.clickId).then((response) => {
265 267
             if (response.state.toLowerCase() === 'success') {
266
-              this.treelists = response.data
268
+              this.tabdata = response.data
267 269
             }
268 270
           })
269 271
           resolve()
270 272
         })
271
-      },
272
-      handleNodeClick(data) {
273
-        console.log(data)
274
-        this.selectdeptid = data.id
275
-        this.selectpid = data.parentid
276
-        this.addParentid = data.parentid
277
-        if (data.TypeId != 1) {
278
-          this.selectdeptid = data.id
279
-          return new Promise((resolve) => {
280
-            getTypeDetail(data.id).then((response) => {
281
-              if (response.state.toLowerCase() === 'success') {
282
-                this.tabdata = response.data
283
-              }
284
-            })
285
-            resolve()
286
-          })
287
-        }
288 273
       }
289 274
     }
290 275
   }
276
+}
291 277
 </script>
292 278
 <style lang="scss" scoped>
293 279
   .search {