Skip to content

Commit 88be39b

Browse files
committed
修改初始化默认值,数据提交时格式化
1 parent 21500bf commit 88be39b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/views/admin/sys-dept/index.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<el-table-column prop="status" label="状态" :formatter="statusFormat" width="100">
5555
<template slot-scope="scope">
5656
<el-tag
57-
:type="scope.row.status === '1' ? 'danger' : 'success'"
57+
:type="scope.row.status === 1 ? 'danger' : 'success'"
5858
disable-transitions
5959
>{{ statusFormat(scope.row) }}</el-tag>
6060
</template>
@@ -185,7 +185,8 @@ export default {
185185
status: undefined
186186
},
187187
// 表单参数
188-
form: {},
188+
form: {
189+
},
189190
// 表单校验
190191
rules: {
191192
parentId: [
@@ -271,11 +272,11 @@ export default {
271272
deptId: undefined,
272273
parentId: undefined,
273274
deptName: undefined,
274-
sorc: undefined,
275+
sort: 10,
275276
leader: undefined,
276277
phone: undefined,
277278
email: undefined,
278-
status: '0'
279+
status: '2'
279280
}
280281
},
281282
/** 搜索按钮操作 */
@@ -300,6 +301,8 @@ export default {
300301
301302
getDept(row.deptId).then(response => {
302303
this.form = response.data
304+
this.form.status = String(this.form.status)
305+
this.form.sort = String(this.form.sort)
303306
this.open = true
304307
this.title = '修改部门'
305308
this.isEdit = true
@@ -309,6 +312,8 @@ export default {
309312
submitForm: function() {
310313
this.$refs['form'].validate(valid => {
311314
if (valid) {
315+
this.form.status = parseInt(this.form.status)
316+
this.form.sort = parseInt(this.form.sort)
312317
if (this.form.deptId !== undefined) {
313318
updateDept(this.form, this.form.deptId).then(response => {
314319
if (response.code === 200) {

0 commit comments

Comments
 (0)