部门
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="!id ? '新增部门信息' : '修改部门信息'"
|
||||
:title="dataForm.deptId === null ? '新增部门信息' : '修改部门信息'"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="visible">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
|
||||
@@ -10,9 +10,9 @@
|
||||
<el-form-item label="部门名称" prop="name">
|
||||
<el-input v-model="dataForm.name" placeholder="部门名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门排序" prop="dept_sort">
|
||||
<el-form-item label="部门排序" prop="deptSort">
|
||||
<el-input-number
|
||||
v-model.number="dataForm.dept_sort"
|
||||
v-model.number="dataForm.deptSort"
|
||||
:min="0"
|
||||
:max="999"
|
||||
controls-position="right"
|
||||
@@ -28,9 +28,9 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态" prop="is_used">
|
||||
<el-form-item label="状态" prop="isUsed">
|
||||
<el-switch
|
||||
v-model="dataForm.is_used"
|
||||
v-model="dataForm.isUsed"
|
||||
active-color="#409EFF"
|
||||
inactive-color="#F56C6C"
|
||||
/>
|
||||
@@ -63,21 +63,22 @@
|
||||
visible: false,
|
||||
id: 0,
|
||||
dataForm: {
|
||||
deptId: null,
|
||||
code: null,
|
||||
name: null,
|
||||
dept_sort: 999,
|
||||
deptSort: 999,
|
||||
isTop: '1',
|
||||
is_used: true,
|
||||
ext_id: null,
|
||||
sub_count: 0,
|
||||
pid: null
|
||||
isUsed: true
|
||||
// ext_id: null,
|
||||
// sub_count: 0,
|
||||
// pid: null
|
||||
},
|
||||
depts: [],
|
||||
dataRule: {
|
||||
name: [
|
||||
{ required: true, message: '参数值不能为空', trigger: 'blur' }
|
||||
],
|
||||
dept_sort: [
|
||||
deptSort: [
|
||||
{ required: true, message: '参数值不能为空', trigger: 'blur', type: 'number' }
|
||||
]
|
||||
}
|
||||
@@ -92,19 +93,18 @@
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (row) {
|
||||
this.id = row.dept_id
|
||||
this.dataForm = row
|
||||
if (this.dataForm.pid !== null) {
|
||||
this.dataForm.isTop = '0'
|
||||
this.dataForm = {...row}
|
||||
// if (this.dataForm.pid !== null) {
|
||||
// this.dataForm.isTop = '0'
|
||||
// } else {
|
||||
// this.dataForm.isTop = '1'
|
||||
// }
|
||||
if (this.dataForm.pid != null) {
|
||||
this.getSupDepts(this.dataForm.pid)
|
||||
} else {
|
||||
this.dataForm.isTop = '1'
|
||||
this.getDepts()
|
||||
}
|
||||
}
|
||||
if (this.dataForm.pid != null) {
|
||||
this.getSupDepts(this.dataForm.pid)
|
||||
} else {
|
||||
this.getDepts()
|
||||
}
|
||||
})
|
||||
},
|
||||
getSupDepts(ids) {
|
||||
@@ -169,7 +169,7 @@
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/api/dept'),
|
||||
method: `${!this.id ? 'POST' : 'PUT'}`,
|
||||
method: this.dataForm.deptId !== null ? 'put' :'post',
|
||||
data: this.$http.adornData(this.dataForm)
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 200) {
|
||||
|
||||
@@ -112,7 +112,7 @@ export default {
|
||||
{ key: false, display_name: '禁用' }
|
||||
],
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageIndex: 0,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
@@ -154,7 +154,7 @@ export default {
|
||||
// 每页数
|
||||
sizeChangeHandle (val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.pageIndex = 0
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="dataForm.dict_id === null ? '新增字典' : '修改字典'"
|
||||
:title="dataForm.dictId === null ? '新增字典' : '修改字典'"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="visible">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
|
||||
@@ -24,7 +24,7 @@
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
dict_id: null,
|
||||
dictId: null,
|
||||
code: '',
|
||||
name: ''
|
||||
},
|
||||
@@ -41,7 +41,7 @@
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (row) {
|
||||
this.dataForm = row
|
||||
this.dataForm = {...row}
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -51,7 +51,7 @@
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/api/dict'),
|
||||
method: this.dataForm.dict_id !== null ? 'put' :'post',
|
||||
method: this.dataForm.dictId !== null ? 'put' :'post',
|
||||
data: this.$http.adornData(this.dataForm)
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 200) {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="isAuth('sys:dict:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
<el-button v-if="isAuth('sys:dict:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
|
||||
<el-button v-if="isAuth('sys:dict:delete')" type="danger" @click="deleteHandle(1)" :disabled="dataListSelections.length <= 0">批量删除</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
@@ -47,7 +47,7 @@
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="isAuth('sys:dict:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row)">修改</el-button>
|
||||
<el-button v-if="isAuth('sys:dict:delete')" type="text" size="small" @click="deleteHandle(scope.row.dict_id)">删除</el-button>
|
||||
<el-button v-if="isAuth('sys:dict:delete')" type="text" size="small" @click="deleteHandle(2, scope.row.dictId)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -93,7 +93,7 @@
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="isAuth('sys:dict:update')" type="text" size="small" @click="detailAddOrUpdateHandle(scope.row)">修改</el-button>
|
||||
<el-button v-if="isAuth('sys:dict:delete')" type="text" size="small" @click="detailDeleteHandle(scope.row.dict_id)">删除</el-button>
|
||||
<el-button v-if="isAuth('sys:dict:delete')" type="text" size="small" @click="detailDeleteHandle(scope.row.dictId)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -196,11 +196,11 @@
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle (id) {
|
||||
deleteHandle (type, id) {
|
||||
var ids = id ? [id] : this.dataListSelections.map(item => {
|
||||
return item.dict_id
|
||||
return item.dictId
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
this.$confirm(type === 1 ? `确定删除选中的${this.dataListSelections.length}条数据吗?` : '确定删除本条数据吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
@@ -208,11 +208,11 @@
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/api/dict/'),
|
||||
method: 'DELETE',
|
||||
data: this.$http.adornData(ids)
|
||||
data: ids
|
||||
}).then(({data}) => {
|
||||
if (data) {
|
||||
if (data && data.code === 200) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
message: data.msg,
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
@@ -270,12 +270,12 @@
|
||||
detailAddOrUpdateHandle (row) {
|
||||
this.detailAddOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.detailAddOrUpdate.init(row)
|
||||
this.$refs.detailAddOrUpdate.init(row, this.query.code)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
detailDeleteHandle (id) {
|
||||
this.$confirm(`确定对${id}进行删除操作?`, '提示', {
|
||||
this.$confirm('确定删除本条数据吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
@@ -285,9 +285,9 @@
|
||||
method: 'DELETE',
|
||||
data: this.$http.adornData()
|
||||
}).then(({data}) => {
|
||||
if (data) {
|
||||
if (data && data.code === 200) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
message: data.msg,
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
<el-form-item label="字典值" prop="value">
|
||||
<el-input v-model="dataForm.value" placeholder="字典值"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="dict_sort">
|
||||
<el-form-item label="排序" prop="dictSort">
|
||||
<el-input-number
|
||||
v-model.number="dataForm.dict_sort"
|
||||
v-model.number="dataForm.dictSort"
|
||||
:min="0"
|
||||
:max="999"
|
||||
controls-position="right"
|
||||
@@ -41,21 +41,13 @@
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
dict_id: null,
|
||||
code: null,
|
||||
label: null,
|
||||
value: null,
|
||||
dict_sort: null,
|
||||
dictSort: null,
|
||||
para1: null,
|
||||
para2: null,
|
||||
para3: null,
|
||||
name: null,
|
||||
dictType: null,
|
||||
createId: null,
|
||||
createName: null,
|
||||
createTime: null,
|
||||
updateId: null,
|
||||
updateName: null,
|
||||
updateTime: null
|
||||
para3: null
|
||||
},
|
||||
dataRule: {
|
||||
label: [
|
||||
@@ -64,19 +56,20 @@
|
||||
value: [
|
||||
{ required: true, message: '字典值不能为空', trigger: 'blur' }
|
||||
],
|
||||
dict_sort: [
|
||||
dictSort: [
|
||||
{ required: true, message: '排序不能为空', trigger: 'blur', type: 'number' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init (row) {
|
||||
init (row, code) {
|
||||
this.visible = true
|
||||
this.dataForm.code = code
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (row) {
|
||||
this.dataForm = row
|
||||
this.dataForm = {...row}
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -89,9 +82,9 @@
|
||||
method: 'post',
|
||||
data: this.$http.adornData(this.dataForm)
|
||||
}).then(({data}) => {
|
||||
if (data) {
|
||||
if (data && data.code === 200) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
message: data.msg,
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
|
||||
Reference in New Issue
Block a user