人员管理模块开发
Showing
5 changed files
with
565 additions
and
236 deletions
... | @@ -2,16 +2,28 @@ module.exports = { | ... | @@ -2,16 +2,28 @@ module.exports = { |
2 | presets: [ | 2 | presets: [ |
3 | // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app | 3 | // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app |
4 | // '@vue/cli-plugin-babel/preset' | 4 | // '@vue/cli-plugin-babel/preset' |
5 | [ | 5 | |
6 | "@vue/app", | 6 | { |
7 | { | 7 | "plugins": [ |
8 | "useBuiltIns": "entry", | 8 | [ |
9 | polyfills: [ | 9 | "import", |
10 | 'es6.promise', | 10 | { |
11 | 'es6.symbol' | 11 | "libraryName": "vxe-table", |
12 | "style": true // 样式是否也按需加载 | ||
13 | } | ||
14 | ], | ||
15 | [ | ||
16 | "@vue/app", | ||
17 | { | ||
18 | "useBuiltIns": "entry", | ||
19 | polyfills: [ | ||
20 | 'es6.promise', | ||
21 | 'es6.symbol' | ||
22 | ] | ||
23 | } | ||
12 | ] | 24 | ] |
13 | } | 25 | ] |
14 | ] | 26 | } |
15 | ], | 27 | ], |
16 | 'env': { | 28 | 'env': { |
17 | 'development': { | 29 | 'development': { | ... | ... |
... | @@ -21,7 +21,8 @@ | ... | @@ -21,7 +21,8 @@ |
21 | "vue": "2.6.10", | 21 | "vue": "2.6.10", |
22 | "vue-awesome": "^4.5.0", | 22 | "vue-awesome": "^4.5.0", |
23 | "vue-router": "3.0.2", | 23 | "vue-router": "3.0.2", |
24 | "vuex": "3.1.0" | 24 | "vuex": "3.1.0", |
25 | "xe-utils": "^3.5.7" | ||
25 | }, | 26 | }, |
26 | "devDependencies": { | 27 | "devDependencies": { |
27 | "@vue/cli-plugin-babel": "4.4.4", | 28 | "@vue/cli-plugin-babel": "4.4.4", |
... | @@ -42,7 +43,9 @@ | ... | @@ -42,7 +43,9 @@ |
42 | "style-resources-loader": "^1.4.1", | 43 | "style-resources-loader": "^1.4.1", |
43 | "svg-sprite-loader": "4.1.3", | 44 | "svg-sprite-loader": "4.1.3", |
44 | "svgo": "^2.3.1", | 45 | "svgo": "^2.3.1", |
45 | "vue-template-compiler": "2.6.10" | 46 | "vue-template-compiler": "2.6.10", |
47 | "vxe-table": "^3.6.9", | ||
48 | "vxe-table-plugin-element": "^1.11.2" | ||
46 | }, | 49 | }, |
47 | "browserslist": [ | 50 | "browserslist": [ |
48 | "> 1%", | 51 | "> 1%", | ... | ... |
src/directive/vxe-table.js
0 → 100644
1 | import Vue from 'vue' | ||
2 | import XEUtils from 'xe-utils' | ||
3 | import VXETablePluginElement from 'vxe-table-plugin-element' | ||
4 | import { | ||
5 | VXETable, | ||
6 | Icon, | ||
7 | Header, | ||
8 | Column, | ||
9 | Table, | ||
10 | Colgroup, | ||
11 | Input, | ||
12 | Select, | ||
13 | Edit, | ||
14 | Keyboard, | ||
15 | Toolbar, | ||
16 | Tooltip | ||
17 | } from 'vxe-table' | ||
18 | |||
19 | import zhCNLocat from 'vxe-table/lib/locale/lang/zh-CN' | ||
20 | |||
21 | import 'vxe-table-plugin-element/dist/style.css' | ||
22 | // 导入默认的国际化(如果项目中使用多语言,则应该导入到 vue-i18n 中) | ||
23 | |||
24 | VXETable.setup({ | ||
25 | i18n: (key, args) => XEUtils.toFormatString(XEUtils.get(zhCNLocat, key), args) | ||
26 | }) | ||
27 | |||
28 | Vue.use(Icon) | ||
29 | |||
30 | Vue.use(Header) | ||
31 | Vue.use(Toolbar) | ||
32 | Vue.use(Tooltip) | ||
33 | |||
34 | Vue.use(Column) | ||
35 | |||
36 | Vue.use(Colgroup) | ||
37 | |||
38 | Vue.use(Input) | ||
39 | |||
40 | Vue.use(Edit) | ||
41 | Vue.use(Select) | ||
42 | |||
43 | Vue.use(Keyboard) | ||
44 | |||
45 | Vue.use(Table) | ||
46 | Vue.use(VXETable) | ||
47 | |||
48 | VXETable.use(VXETablePluginElement) |
... | @@ -10,6 +10,7 @@ import dataV from '@jiaminghi/data-view'; | ... | @@ -10,6 +10,7 @@ import dataV from '@jiaminghi/data-view'; |
10 | import echarts from "echarts" | 10 | import echarts from "echarts" |
11 | import { startLoadingAddCount, endLoadingSubCount } from './utils/requestLoading' | 11 | import { startLoadingAddCount, endLoadingSubCount } from './utils/requestLoading' |
12 | Vue.mixin(mixin) | 12 | Vue.mixin(mixin) |
13 | import './directive/vxe-table' | ||
13 | // 按需引入vue-awesome图标 | 14 | // 按需引入vue-awesome图标 |
14 | import Icon from 'vue-awesome/components/Icon'; | 15 | import Icon from 'vue-awesome/components/Icon'; |
15 | import 'vue-awesome/icons/chart-bar.js'; | 16 | import 'vue-awesome/icons/chart-bar.js'; | ... | ... |
1 | <template> | 1 | <template> |
2 | <div class="timedTask from-clues"> | 2 | <div class="timedTask from-clues"> |
3 | <h1>水水水水水</h1> | 3 | <div class="from-clues-header"> |
4 | <el-form ref="ruleForm" :model="form" label-width="100px"> | ||
5 | <el-row class="mb-5"> | ||
6 | |||
7 | <el-col :span="3"> | ||
8 | <el-select v-model="selectType" placeholder="请选择" class="select"> | ||
9 | <el-option | ||
10 | v-for="item in typeOptions" | ||
11 | :key="item.value" | ||
12 | :label="item.label" | ||
13 | :value="item.value" | ||
14 | /> | ||
15 | </el-select> | ||
16 | </el-col> | ||
17 | <el-col :span="3"> | ||
18 | <el-input | ||
19 | v-model="queryName" | ||
20 | class="selectName" | ||
21 | clearable | ||
22 | placeholder="请输入" | ||
23 | > | ||
24 | <el-button | ||
25 | slot="append" | ||
26 | icon="el-icon-search" | ||
27 | @click="searchQuery()" | ||
28 | /> | ||
29 | </el-input> | ||
30 | </el-col> | ||
31 | <!-- 按钮操作 --> | ||
32 | <el-col :span="6" class="btnColRight"> | ||
33 | <el-form-item> | ||
34 | <btn nativeType="cz" @click="handleAdd" >添加人员</btn> | ||
35 | <btn nativeType="cx" @click="resetPassword(selectionRows)">重置密码</btn> | ||
36 | <btn nativeType="sb" @click="resetSearch()">重置</btn> | ||
37 | </el-form-item> | ||
38 | </el-col> | ||
39 | |||
40 | </el-row> | ||
41 | </el-form> | ||
42 | </div> | ||
43 | <div class="from-clues-content"> | ||
44 | <vxe-table | ||
45 | ref="xTree" | ||
46 | v-loading="loading" | ||
47 | class="header-bg-type1" | ||
48 | :data="tableData" | ||
49 | show-overflow | ||
50 | border | ||
51 | :checkbox-config="{ highlight: true }" | ||
52 | :empty-render="{ name: 'NotData' }" | ||
53 | highlight-hover-row | ||
54 | max-height="90%" | ||
55 | @checkbox-all="selectAllEvent" | ||
56 | @checkbox-change="selectChangeEvent" | ||
57 | > | ||
58 | <template #empty> | ||
59 | <table-empty /> | ||
60 | </template> | ||
61 | <vxe-table-column | ||
62 | type="checkbox" | ||
63 | width="36" | ||
64 | align="center" | ||
65 | fixed="left" | ||
66 | /> | ||
67 | <vxe-table-column | ||
68 | field="code" | ||
69 | title="工号" | ||
70 | width="80" | ||
71 | align="left" | ||
72 | show-header-overflow="tooltip" | ||
73 | show-overflow="tooltip" | ||
74 | fixed="left" | ||
75 | /> | ||
76 | <vxe-table-column | ||
77 | title="姓名" | ||
78 | width="140" | ||
79 | align="left" | ||
80 | show-header-overflow="tooltip" | ||
81 | show-overflow="tooltip" | ||
82 | fixed="left" | ||
83 | > | ||
84 | <template slot-scope="scope"> | ||
85 | <svg-icon | ||
86 | :icon-class=" | ||
87 | scope.row.sex === '0' | ||
88 | ? 'male' | ||
89 | : scope.row.sex === '1' | ||
90 | ? 'female' | ||
91 | : 'secrecy' | ||
92 | " | ||
93 | /> | ||
94 | {{ scope.row.name }} | ||
95 | </template> | ||
96 | </vxe-table-column> | ||
97 | <vxe-table-column | ||
98 | field="loginName" | ||
99 | title="用户名" | ||
100 | width="110" | ||
101 | align="left" | ||
102 | show-header-overflow="tooltip" | ||
103 | show-overflow="tooltip" | ||
104 | fixed="left" | ||
105 | /> | ||
106 | <vxe-table-column | ||
107 | title="负责人" | ||
108 | align="left" | ||
109 | show-header-overflow="tooltip" | ||
110 | show-overflow="tooltip" | ||
111 | > | ||
112 | <template slot-scope="scope"> | ||
113 | <i v-if="scope.row.isDuty" class="el-icon-check" /> | ||
114 | </template> | ||
115 | </vxe-table-column> | ||
116 | <vxe-table-column | ||
117 | field="departmentName" | ||
118 | title="所属部门" | ||
119 | align="left" | ||
120 | width="140" | ||
121 | min-width="140" | ||
122 | show-header-overflow="tooltip" | ||
123 | show-overflow="tooltip" | ||
124 | /> | ||
125 | <vxe-table-column | ||
126 | field="jobLevel" | ||
127 | :formatter="formatterjobLevel" | ||
128 | title="职位" | ||
129 | align="left" | ||
130 | width="140" | ||
131 | min-width="140" | ||
132 | show-header-overflow="tooltip" | ||
133 | show-overflow="tooltip" | ||
134 | /> | ||
135 | <vxe-table-column | ||
136 | field="mobilePhone" | ||
137 | title="电话" | ||
138 | width="140" | ||
139 | show-header-overflow="tooltip" | ||
140 | show-overflow="tooltip" | ||
141 | align="left" | ||
142 | /> | ||
143 | <vxe-table-column title="状态" width="50"> | ||
144 | <template scope="scope"> | ||
145 | <el-switch | ||
146 | v-model="scope.row.switch" | ||
147 | class="switch" | ||
148 | active-color="#32BAD4" | ||
149 | inactive-color="#B1B9C5" | ||
150 | active-text="启" | ||
151 | inactive-text="禁" | ||
152 | @change="changeStatus(scope.row)" | ||
153 | /> | ||
154 | </template> | ||
155 | </vxe-table-column> | ||
156 | <vxe-table-column | ||
157 | title="排序" | ||
158 | width="148" | ||
159 | min-width="148" | ||
160 | align="left" | ||
161 | fixed="right" | ||
162 | > | ||
163 | <template #header> | ||
164 | <p class="ml8">排序</p> | ||
165 | </template> | ||
166 | <template slot-scope="scope"> | ||
167 | <sort-table | ||
168 | :scope-data="scope" | ||
169 | :sort-url="tableUrl" | ||
170 | @sortOk="getTableList" | ||
171 | /> | ||
172 | </template> | ||
173 | </vxe-table-column> | ||
174 | <vxe-table-column | ||
175 | title="操作" | ||
176 | width="148" | ||
177 | min-width="148" | ||
178 | align="left" | ||
179 | fixed="right" | ||
180 | > | ||
181 | <template #header> | ||
182 | <p class="ml8">操作</p> | ||
183 | </template> | ||
184 | <template slot-scope="scope"> | ||
185 | <el-button type="text" size="small"> | ||
186 | <el-tooltip | ||
187 | class="item" | ||
188 | effect="dark" | ||
189 | content="解锁" | ||
190 | placement="top" | ||
191 | > | ||
192 | <i | ||
193 | class="icon-platform-unlock iconfont" | ||
194 | @click="updateLock(scope.row.id, scope.row.name)" | ||
195 | /> | ||
196 | </el-tooltip> | ||
197 | <el-tooltip | ||
198 | class="item" | ||
199 | effect="dark" | ||
200 | content="重置" | ||
201 | placement="top" | ||
202 | > | ||
203 | <i | ||
204 | class="icon-platform-reset iconfont" | ||
205 | @click="resetPassword(scope.row.id)" | ||
206 | /> | ||
207 | </el-tooltip> | ||
208 | <el-tooltip | ||
209 | class="item" | ||
210 | effect="dark" | ||
211 | content="修改" | ||
212 | placement="top" | ||
213 | > | ||
214 | <i | ||
215 | class="icon-platform-edit iconfont" | ||
216 | @click="handleEdit(scope.row)" | ||
217 | /> | ||
218 | </el-tooltip> | ||
219 | <el-tooltip | ||
220 | class="item" | ||
221 | effect="dark" | ||
222 | content="删除" | ||
223 | placement="top" | ||
224 | > | ||
225 | <i | ||
226 | class="icon-platform-delete iconfont" | ||
227 | @click="handleDelete(scope.row.id, scope.row.name)" | ||
228 | /> | ||
229 | </el-tooltip> | ||
230 | </el-button> | ||
231 | </template> | ||
232 | </vxe-table-column> | ||
233 | </vxe-table> | ||
234 | </div> | ||
4 | </div> | 235 | </div> |
5 | </template> | 236 | </template> |
6 | <script> | 237 | <script> |
7 | // 定时任务 | 238 | // 定时任务 |
8 | import data from "./data" | 239 | import data from "./data"; |
9 | import system from '@/api/system.js' | 240 | import system from "@/api/system.js"; |
10 | import tableMixin from '@/mixins/tableMixin.js' | 241 | import tableMixin from "@/mixins/tableMixin.js"; |
11 | import addTask from '../components/addTask.vue' | ||
12 | export default { | 242 | export default { |
13 | name: "users", | 243 | name: "users", |
14 | mixins: [tableMixin], | 244 | components: {}, |
15 | components: { | 245 | data() { |
16 | addTask | ||
17 | }, | ||
18 | data () { | ||
19 | return { | 246 | return { |
20 | taskData: null, | 247 | title: '', |
21 | form: { | 248 | queryParam: {}, |
22 | job_name: '', | 249 | selectType: '0', |
23 | currentPage: 1 | 250 | queryName: '', |
24 | }, | 251 | organizationId: '', // 组织机构ID |
25 | selectionList: [], | 252 | departmentId: '', // 部门ID |
26 | tableData: { | 253 | departmentList: [], // 部门列表 |
27 | columns: [{ | 254 | levelList: [], // 职务级别 |
28 | label: '序号', | 255 | tableData: [], |
29 | type: 'index', | 256 | sexList: [], |
30 | width: '50', | 257 | typeOptions: [ |
31 | index: this.indexMethod, | 258 | { |
32 | }].concat(data.columns()).concat([ | 259 | value: '0', |
33 | { | 260 | label: '姓名' |
34 | label: "操作", | 261 | }, |
35 | width: 380, | 262 | { |
36 | render: (h, scope) => { | 263 | value: '1', |
37 | return ( | 264 | label: '工号' |
38 | <div> | 265 | }, |
39 | <el-button type="text" size="mini" style="color: #67C23A" | 266 | { |
40 | v-show={scope.row.job_status !== '1' && scope.row.job_status !== '2'} | 267 | value: '2', |
41 | icon="el-icon-magic-stick" | 268 | label: '部门' |
42 | onClick={() => { this.handleRecovery(scope.row) }}>激活 | 269 | }, |
43 | </el-button> | 270 | { |
44 | 271 | value: '3', | |
45 | <el-button type="text" size="mini" | 272 | label: '机构' |
46 | style="color: #67C23A;margin-left:0" | 273 | } |
47 | icon="el-icon-refresh-right" | 274 | ], |
48 | v-show={scope.row.job_status === '2'} | 275 | // tableUrl: api.users, // 接口地址, |
49 | onClick={() => { this.handleActivation(scope.row) }}>恢复 | ||
50 | </el-button> | ||
51 | 276 | ||
52 | <el-button type="text" size="mini" | ||
53 | v-show={scope.row.job_status !== '1'} | ||
54 | icon="el-icon-stopwatch" | ||
55 | onClick={() => { this.handletest(scope.row) }}>手动测试 | ||
56 | </el-button> | ||
57 | <el-button type="text" size="mini" | ||
58 | v-show={scope.row.job_status === '1'} | ||
59 | icon="el-icon-video-pause" | ||
60 | onClick={() => { this.handleSuspend(scope.row) }}>暂停 | ||
61 | </el-button> | ||
62 | <el-button type="text" size="mini" | ||
63 | icon="el-icon-edit" | ||
64 | v-show={scope.row.job_status === '2' || scope.row.job_status === '-1' || scope.row.job_status === '0'} | ||
65 | onClick={() => { this.handleEdit(scope.row) }}>编辑 | ||
66 | </el-button> | ||
67 | <el-button type="text" size="mini" | ||
68 | icon="el-icon-delete" style="color:#F56C6C" | ||
69 | v-show={scope.row.job_status !== '1'} | ||
70 | onClick={() => { this.handleDel(scope.row) }}>删除 | ||
71 | </el-button> | ||
72 | </div> | ||
73 | ); | ||
74 | }, | ||
75 | }, | ||
76 | ]), | ||
77 | data: [] | ||
78 | }, | ||
79 | pageData: { | 277 | pageData: { |
80 | total: 0, | 278 | total: 0, |
81 | pageSize: 15, | 279 | pageSize: 15, |
82 | current: 1, | 280 | current: 1, |
83 | }, | 281 | }, |
84 | } | 282 | }; |
283 | }, | ||
284 | created() { | ||
285 | // 获取区域和组织机构id | ||
286 | eventBus.$on('getSelectedId', (res) => { | ||
287 | if (!res.organizationId) { | ||
288 | this.tableData = [] | ||
289 | this.organizationId = '' | ||
290 | this.departmentId = '' | ||
291 | } else { | ||
292 | this.organizationId = "408dee75-bde5-45cc-80af-62d260bff8d5" | ||
293 | this.departmentId = res.departmentId | ||
294 | this.getTableList() | ||
295 | this.getDepartData() | ||
296 | } | ||
297 | this.initDictConfig() | ||
298 | }) | ||
299 | }, | ||
300 | updated() { | ||
301 | this.tableData.forEach((element) => { | ||
302 | element.switch = element.status === 'ACTIVE' | ||
303 | }) | ||
85 | }, | 304 | }, |
86 | methods: { | 305 | methods: { |
87 | handleAdd () { | 306 | initDictConfig() { |
88 | this.taskData = null | 307 | getDictItems('XB').then((res) => { |
89 | this.$refs.task.isShow() | 308 | if (res.status === 1) { |
309 | this.sexList = res.content | ||
310 | } else { | ||
311 | this.$message.error({ message: res.message, showClose: true }) | ||
312 | } | ||
313 | }) | ||
314 | getDictItems('ZWJB').then((res) => { | ||
315 | if (res.status === 1) { | ||
316 | this.levelList = res.content | ||
317 | } else { | ||
318 | this.$message.error({ message: res.message, showClose: true }) | ||
319 | } | ||
320 | }) | ||
90 | }, | 321 | }, |
91 | async featchData () { | 322 | getDepartData() { |
92 | try { | 323 | getDeptsByIdAction(this.organizationId).then((res) => { |
93 | this.form = Object.assign(this.form, this.formData) | 324 | if (res.status === 1) { |
94 | let { result: { list, total, pages: pageSize, pageNum: current } | 325 | this.departmentList = res.content |
95 | } = await system.getTaskListByName(this.form) | 326 | } else { |
96 | this.tableData.data = list | 327 | this.$message.error({ message: res.message, showClose: true }) |
97 | this.pageData = { | ||
98 | pageSize, | ||
99 | current, | ||
100 | total | ||
101 | } | 328 | } |
102 | } catch (error) { | 329 | }) |
103 | this.message = error | 330 | }, |
104 | this.$refs.msg.messageShow() | 331 | getTableList() { |
332 | this.loading = true | ||
333 | this.queryParam = { | ||
334 | organizationId: this.organizationId, | ||
335 | departmentId: this.departmentId | ||
105 | } | 336 | } |
337 | getUserList(this.queryParam).then((res) => { | ||
338 | if (res.status === 1) { | ||
339 | this.loading = false | ||
340 | this.tableData = res.content | ||
341 | } else { | ||
342 | this.$message.error({ message: res.message, showClose: true }) | ||
343 | } | ||
344 | }) | ||
106 | }, | 345 | }, |
107 | // 暂停 | 346 | // 查询 |
108 | handleSuspend (row) { | 347 | searchQuery() { |
109 | this.$confirm('此操将进行暂停操作, 是否继续?', '提示', { | 348 | switch (this.selectType) { |
110 | confirmButtonText: '确定', | 349 | case '0': |
111 | cancelButtonText: '取消', | 350 | this.queryParam.type = 'NAME' |
112 | type: 'warning', | 351 | break |
352 | case '1': | ||
353 | this.queryParam.type = 'CODE' | ||
354 | break | ||
355 | case '2': | ||
356 | this.queryParam.type = 'DEPARTMENT' | ||
357 | break | ||
358 | case '3': | ||
359 | this.queryParam.type = 'ORGANIZATION' | ||
360 | break | ||
361 | default: | ||
362 | break | ||
363 | } | ||
364 | this.queryParam.typeValue = this.queryName | ||
365 | getUserList(this.queryParam).then((res) => { | ||
366 | if (res.status === 1) { | ||
367 | this.tableData = res.content | ||
368 | } else { | ||
369 | this.$message.error({ message: res.message, showClose: true }) | ||
370 | } | ||
113 | }) | 371 | }) |
114 | .then(() => { | ||
115 | system.pauseJob(row.id) | ||
116 | .then((res) => { | ||
117 | if ((res.code = 200)) { | ||
118 | this.$message({ | ||
119 | type: 'success', | ||
120 | message: res.message, | ||
121 | }) | ||
122 | this.featchData() | ||
123 | } | ||
124 | }) | ||
125 | .catch((error) => { | ||
126 | this.$alert(error, '提示', { | ||
127 | confirmButtonText: '确定', | ||
128 | type: 'error' | ||
129 | }) | ||
130 | }) | ||
131 | }) | ||
132 | .catch(() => { | ||
133 | this.$message({ | ||
134 | type: 'info', | ||
135 | message: '已取消', | ||
136 | }) | ||
137 | }) | ||
138 | }, | 372 | }, |
139 | // 激活 | 373 | // 重置搜索 |
140 | handleRecovery (row) { | 374 | resetSearch() { |
141 | this.$confirm('此操将进行激活操作, 是否继续?', '提示', { | 375 | this.selectType = '0' |
376 | this.queryName = '' | ||
377 | this.queryParam = { | ||
378 | organizationId: this.organizationId, | ||
379 | departmentId: this.departmentId | ||
380 | } | ||
381 | this.getTableList() | ||
382 | }, | ||
383 | // 性别 | ||
384 | formatterSex({ cellValue }) { | ||
385 | if (this.sexList.length !== 0) { | ||
386 | if (cellValue !== null) { | ||
387 | const sex = this.sexList.find((item) => item.value === cellValue).name | ||
388 | return sex | ||
389 | } else { | ||
390 | return cellValue | ||
391 | } | ||
392 | } | ||
393 | }, | ||
394 | // 职务级别 | ||
395 | formatterjobLevel({ cellValue }) { | ||
396 | if (this.levelList.length !== 0) { | ||
397 | if (cellValue) { | ||
398 | const jobLevel = this.levelList.find( | ||
399 | (item) => item.value === cellValue | ||
400 | ).name | ||
401 | return jobLevel | ||
402 | } else { | ||
403 | return cellValue | ||
404 | } | ||
405 | } | ||
406 | }, | ||
407 | // 删除 | ||
408 | handleDelete(id, content) { | ||
409 | this.$confirm(deleteDomStr(content), '执行确认', { | ||
410 | dangerouslyUseHTMLString: true, | ||
411 | customClass: 'customer-delete', | ||
142 | confirmButtonText: '确定', | 412 | confirmButtonText: '确定', |
143 | cancelButtonText: '取消', | 413 | cancelButtonText: '取消', |
144 | type: 'warning', | 414 | type: 'warning' |
145 | }) | 415 | }) |
146 | .then(() => { | 416 | .then(() => { |
147 | system.activateJob(row.id) | 417 | deleteAction(`${api.users}/${id}`).then((res) => { |
148 | .then((res) => { | 418 | if (res.status === 1) { |
149 | if ((res.code = 200)) { | 419 | this.$message.success({ message: res.message, showClose: true }) |
150 | this.$message({ | 420 | } else { |
151 | type: 'success', | 421 | this.$message.error({ message: res.message, showClose: true }) |
152 | message: res.message, | 422 | } |
153 | }) | 423 | this.getTableList() |
154 | this.featchData() | ||
155 | } | ||
156 | }) | ||
157 | .catch((error) => { | ||
158 | this.$alert(error, '提示', { | ||
159 | confirmButtonText: '确定', | ||
160 | type: 'error' | ||
161 | }) | ||
162 | }) | ||
163 | }) | ||
164 | .catch(() => { | ||
165 | this.$message({ | ||
166 | type: 'info', | ||
167 | message: '已取消', | ||
168 | }) | 424 | }) |
169 | }) | 425 | }) |
426 | .catch(() => {}) | ||
170 | }, | 427 | }, |
171 | // 恢复 | 428 | // 修改状态 |
172 | handleActivation (row) { | 429 | changeStatus(row) { |
173 | this.$confirm('此操将进行恢复操作, 是否继续?', '提示', { | 430 | this.$confirm('确定要修改状态吗?', '提示', { |
431 | customClass: 'customer-update', | ||
174 | confirmButtonText: '确定', | 432 | confirmButtonText: '确定', |
175 | cancelButtonText: '取消', | 433 | cancelButtonText: '取消', |
176 | type: 'warning', | 434 | type: 'warning' |
177 | }) | 435 | }) |
178 | .then(() => { | 436 | .then(() => { |
179 | system.resumeJob(row.id) | 437 | const status = row.status === 'ACTIVE' ? 'INACTIVE' : 'ACTIVE' |
180 | .then((res) => { | 438 | const id = row.id |
181 | if ((res.code = 200)) { | 439 | updateStatus(id, status).then((res) => { |
182 | this.$message({ | 440 | if (res.status === 1) { |
183 | type: 'success', | 441 | this.$message.success({ message: res.message, showClose: true }) |
184 | message: res.message, | 442 | this.getTableList() |
185 | }) | 443 | } else { |
186 | this.featchData() | 444 | this.$message.error({ message: res.message, showClose: true }) |
187 | } | 445 | } |
188 | }) | ||
189 | .catch((error) => { | ||
190 | this.$alert(error, '提示', { | ||
191 | confirmButtonText: '确定', | ||
192 | type: 'error' | ||
193 | }) | ||
194 | }) | ||
195 | }) | ||
196 | .catch(() => { | ||
197 | this.$message({ | ||
198 | type: 'info', | ||
199 | message: '已取消', | ||
200 | }) | 446 | }) |
201 | }) | 447 | }) |
448 | .catch((err) => { | ||
449 | console.log({ err }) | ||
450 | }) | ||
202 | }, | 451 | }, |
203 | // 手动测试 | 452 | // 更新用户解锁状态 |
204 | handletest (row) { | 453 | updateLock(id, name) { |
205 | this.$confirm('此操将进行手动测试, 是否继续?', '提示', { | 454 | this.$confirm( |
206 | confirmButtonText: '确定', | 455 | `<div class="customer-message-wrapper"> |
207 | cancelButtonText: '取消', | 456 | <h5 class="title">确定要更新用户解锁状态吗</h5> |
208 | type: 'warning', | 457 | <p class="result">执行后,数据将 |
209 | }) | 458 | <span >无法恢复</span> |
459 | </p> | ||
460 | </div>`, | ||
461 | '执行确认', | ||
462 | { | ||
463 | dangerouslyUseHTMLString: true, | ||
464 | customClass: 'customer-delete', | ||
465 | confirmButtonText: '确定', | ||
466 | cancelButtonText: '取消', | ||
467 | type: 'warning' | ||
468 | } | ||
469 | ) | ||
210 | .then(() => { | 470 | .then(() => { |
211 | system.sjsbTaskRun(row.id) | 471 | updateLock(id).then((res) => { |
212 | .then((res) => { | 472 | if (res.status === 1) { |
213 | if ((res.code = 200)) { | 473 | this.$message.success({ message: res.message, showClose: true }) |
214 | this.$alert(res.message, '提示', { | 474 | this.getTableList() |
215 | confirmButtonText: '确定', | 475 | } else { |
216 | type: 'success' | 476 | this.$message.error({ message: res.message, showClose: true }) |
217 | }); | 477 | } |
218 | this.featchData() | ||
219 | } | ||
220 | }) | ||
221 | .catch((error) => { | ||
222 | this.$alert(error, '提示', { | ||
223 | confirmButtonText: '确定', | ||
224 | type: 'error' | ||
225 | }) | ||
226 | }) | ||
227 | }) | ||
228 | .catch(() => { | ||
229 | this.$message({ | ||
230 | type: 'info', | ||
231 | message: '已取消', | ||
232 | }) | 478 | }) |
233 | }) | 479 | }) |
480 | .catch(() => {}) | ||
234 | }, | 481 | }, |
235 | handleEdit (row) { | 482 | // 重置用户密码 |
236 | this.taskData = row | 483 | resetPassword(data) { |
237 | this.$refs.task.isShow() | 484 | const ids = [] |
238 | }, | 485 | if (data instanceof Array) { |
239 | handleDel (row) { | 486 | data.forEach((item) => { |
240 | this.$confirm('此操将进行删除操作, 是否继续?', '提示', { | 487 | ids.push(item.id) |
241 | confirmButtonText: '确定', | ||
242 | cancelButtonText: '取消', | ||
243 | type: 'warning', | ||
244 | }) | ||
245 | .then(() => { | ||
246 | system.sjsbTaskRemove(row.id) | ||
247 | .then((res) => { | ||
248 | if ((res.code = 200)) { | ||
249 | this.$message({ | ||
250 | type: 'success', | ||
251 | message: res.message, | ||
252 | }) | ||
253 | this.featchData() | ||
254 | } | ||
255 | }) | ||
256 | .catch((error) => { | ||
257 | this.$alert(error, '提示', { | ||
258 | confirmButtonText: '确定', | ||
259 | type: 'error' | ||
260 | }) | ||
261 | }) | ||
262 | }) | 488 | }) |
263 | .catch(() => { | 489 | } else { |
264 | this.$message({ | 490 | ids.push(data) |
265 | type: 'info', | 491 | } |
266 | message: '已取消', | 492 | console.log(ids, 'ids') |
493 | if (ids.length === 0) { | ||
494 | this.$message({ | ||
495 | message: '请选择需要重置密码的用户!', | ||
496 | showClose: true | ||
497 | }) | ||
498 | return | ||
499 | } | ||
500 | this.$confirm( | ||
501 | `<div class="customer-message-wrapper"> | ||
502 | <h5 class="title">确定要重置密码吗</h5> | ||
503 | <p class="result">执行后,数据将 | ||
504 | <span >无法恢复</span> | ||
505 | </p> | ||
506 | </div>`, | ||
507 | '执行确认', | ||
508 | { | ||
509 | dangerouslyUseHTMLString: true, | ||
510 | customClass: 'customer-delete', | ||
511 | confirmButtonText: '确定', | ||
512 | cancelButtonText: '取消', | ||
513 | type: 'warning' | ||
514 | } | ||
515 | ) | ||
516 | .then(() => { | ||
517 | resetPassword(ids).then((res) => { | ||
518 | if (res.status === 1) { | ||
519 | this.$message.success({ message: res.message, showClose: true }) | ||
520 | this.getTableList() | ||
521 | } else { | ||
522 | this.$message.error({ message: res.message, showClose: true }) | ||
523 | } | ||
267 | }) | 524 | }) |
268 | }) | 525 | }) |
526 | .catch(() => {}) | ||
527 | }, | ||
528 | // 新增回显 | ||
529 | reloadTableData() { | ||
530 | this.getTableList() | ||
531 | }, | ||
532 | showimport() { | ||
533 | this.$refs.leadingIn.import(this.tableUrl, '人员') | ||
269 | } | 534 | } |
270 | } | 535 | } |
271 | } | 536 | }; |
272 | </script> | 537 | </script> |
273 | <style scoped lang="scss"> | 538 | <style scoped lang="scss"> |
274 | @import "~@/styles/mixin.scss"; | 539 | @import "~@/styles/mixin.scss"; | ... | ... |
-
Please register or sign in to post a comment