Browse Source

部门

master
蔡玲玲 4 weeks ago
parent
commit
15afc3d995
  1. 44
      base-vue/src/views/modules/sys/dept-add-or-update.vue
  2. 4
      base-vue/src/views/modules/sys/dept.vue
  3. 8
      base-vue/src/views/modules/sys/dict-add-or-update.vue
  4. 26
      base-vue/src/views/modules/sys/dict.vue
  5. 29
      base-vue/src/views/modules/sys/dictDetail-add-or-update.vue

44
base-vue/src/views/modules/sys/dept-add-or-update.vue

@ -1,6 +1,6 @@
<template> <template>
<el-dialog <el-dialog
:title="!id ? '新增部门信息' : '修改部门信息'" :title="dataForm.deptId === null ? '新增部门信息' : '修改部门信息'"
:close-on-click-modal="false" :close-on-click-modal="false"
:visible.sync="visible"> :visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px"> <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-form-item label="部门名称" prop="name">
<el-input v-model="dataForm.name" placeholder="部门名称"></el-input> <el-input v-model="dataForm.name" placeholder="部门名称"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="部门排序" prop="dept_sort"> <el-form-item label="部门排序" prop="deptSort">
<el-input-number <el-input-number
v-model.number="dataForm.dept_sort" v-model.number="dataForm.deptSort"
:min="0" :min="0"
:max="999" :max="999"
controls-position="right" controls-position="right"
@ -28,9 +28,9 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="状态" prop="is_used"> <el-form-item label="状态" prop="isUsed">
<el-switch <el-switch
v-model="dataForm.is_used" v-model="dataForm.isUsed"
active-color="#409EFF" active-color="#409EFF"
inactive-color="#F56C6C" inactive-color="#F56C6C"
/> />
@ -63,21 +63,22 @@
visible: false, visible: false,
id: 0, id: 0,
dataForm: { dataForm: {
deptId: null,
code: null, code: null,
name: null, name: null,
dept_sort: 999, deptSort: 999,
isTop: '1', isTop: '1',
is_used: true, isUsed: true
ext_id: null, // ext_id: null,
sub_count: 0, // sub_count: 0,
pid: null // pid: null
}, },
depts: [], depts: [],
dataRule: { dataRule: {
name: [ name: [
{ required: true, message: '参数值不能为空', trigger: 'blur' } { required: true, message: '参数值不能为空', trigger: 'blur' }
], ],
dept_sort: [ deptSort: [
{ required: true, message: '参数值不能为空', trigger: 'blur', type: 'number' } { required: true, message: '参数值不能为空', trigger: 'blur', type: 'number' }
] ]
} }
@ -92,19 +93,18 @@
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields() this.$refs['dataForm'].resetFields()
if (row) { if (row) {
this.id = row.dept_id this.dataForm = {...row}
this.dataForm = row // if (this.dataForm.pid !== null) {
if (this.dataForm.pid !== null) { // this.dataForm.isTop = '0'
this.dataForm.isTop = '0' // } else {
// this.dataForm.isTop = '1'
// }
if (this.dataForm.pid != null) {
this.getSupDepts(this.dataForm.pid)
} else { } else {
this.dataForm.isTop = '1' this.getDepts()
} }
} }
if (this.dataForm.pid != null) {
this.getSupDepts(this.dataForm.pid)
} else {
this.getDepts()
}
}) })
}, },
getSupDepts(ids) { getSupDepts(ids) {
@ -169,7 +169,7 @@
if (valid) { if (valid) {
this.$http({ this.$http({
url: this.$http.adornUrl('/api/dept'), url: this.$http.adornUrl('/api/dept'),
method: `${!this.id ? 'POST' : 'PUT'}`, method: this.dataForm.deptId !== null ? 'put' :'post',
data: this.$http.adornData(this.dataForm) data: this.$http.adornData(this.dataForm)
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 200) { if (data && data.code === 200) {

4
base-vue/src/views/modules/sys/dept.vue

@ -112,7 +112,7 @@ export default {
{ key: false, display_name: '禁用' } { key: false, display_name: '禁用' }
], ],
dataList: [], dataList: [],
pageIndex: 1, pageIndex: 0,
pageSize: 10, pageSize: 10,
totalPage: 0, totalPage: 0,
dataListLoading: false, dataListLoading: false,
@ -154,7 +154,7 @@ export default {
// //
sizeChangeHandle (val) { sizeChangeHandle (val) {
this.pageSize = val this.pageSize = val
this.pageIndex = 1 this.pageIndex = 0
this.getDataList() this.getDataList()
}, },
// //

8
base-vue/src/views/modules/sys/dict-add-or-update.vue

@ -1,6 +1,6 @@
<template> <template>
<el-dialog <el-dialog
:title="dataForm.dict_id === null ? '新增字典' : '修改字典'" :title="dataForm.dictId === null ? '新增字典' : '修改字典'"
:close-on-click-modal="false" :close-on-click-modal="false"
:visible.sync="visible"> :visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px"> <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
@ -24,7 +24,7 @@
return { return {
visible: false, visible: false,
dataForm: { dataForm: {
dict_id: null, dictId: null,
code: '', code: '',
name: '' name: ''
}, },
@ -41,7 +41,7 @@
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields() this.$refs['dataForm'].resetFields()
if (row) { if (row) {
this.dataForm = row this.dataForm = {...row}
} }
}) })
}, },
@ -51,7 +51,7 @@
if (valid) { if (valid) {
this.$http({ this.$http({
url: this.$http.adornUrl('/api/dict'), 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) data: this.$http.adornData(this.dataForm)
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 200) { if (data && data.code === 200) {

26
base-vue/src/views/modules/sys/dict.vue

@ -10,7 +10,7 @@
<el-form-item> <el-form-item>
<el-button @click="getDataList()">查询</el-button> <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: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-item>
</el-form> </el-form>
<el-table <el-table
@ -47,7 +47,7 @@
label="操作"> label="操作">
<template slot-scope="scope"> <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: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> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -93,7 +93,7 @@
> >
<template slot-scope="scope"> <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: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> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -196,11 +196,11 @@
}) })
}, },
// //
deleteHandle (id) { deleteHandle (type, id) {
var ids = id ? [id] : this.dataListSelections.map(item => { 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: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
@ -208,11 +208,11 @@
this.$http({ this.$http({
url: this.$http.adornUrl('/api/dict/'), url: this.$http.adornUrl('/api/dict/'),
method: 'DELETE', method: 'DELETE',
data: this.$http.adornData(ids) data: ids
}).then(({data}) => { }).then(({data}) => {
if (data) { if (data && data.code === 200) {
this.$message({ this.$message({
message: '操作成功', message: data.msg,
type: 'success', type: 'success',
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
@ -270,12 +270,12 @@
detailAddOrUpdateHandle (row) { detailAddOrUpdateHandle (row) {
this.detailAddOrUpdateVisible = true this.detailAddOrUpdateVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.detailAddOrUpdate.init(row) this.$refs.detailAddOrUpdate.init(row, this.query.code)
}) })
}, },
// //
detailDeleteHandle (id) { detailDeleteHandle (id) {
this.$confirm(`确定对${id}进行删除操作?`, '提示', { this.$confirm('确定删除本条数据吗?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
@ -285,9 +285,9 @@
method: 'DELETE', method: 'DELETE',
data: this.$http.adornData() data: this.$http.adornData()
}).then(({data}) => { }).then(({data}) => {
if (data) { if (data && data.code === 200) {
this.$message({ this.$message({
message: '操作成功', message: data.msg,
type: 'success', type: 'success',
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {

29
base-vue/src/views/modules/sys/dictDetail-add-or-update.vue

@ -10,9 +10,9 @@
<el-form-item label="字典值" prop="value"> <el-form-item label="字典值" prop="value">
<el-input v-model="dataForm.value" placeholder="字典值"></el-input> <el-input v-model="dataForm.value" placeholder="字典值"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="排序" prop="dict_sort"> <el-form-item label="排序" prop="dictSort">
<el-input-number <el-input-number
v-model.number="dataForm.dict_sort" v-model.number="dataForm.dictSort"
:min="0" :min="0"
:max="999" :max="999"
controls-position="right" controls-position="right"
@ -41,21 +41,13 @@
return { return {
visible: false, visible: false,
dataForm: { dataForm: {
dict_id: null, code: null,
label: null, label: null,
value: null, value: null,
dict_sort: null, dictSort: null,
para1: null, para1: null,
para2: null, para2: null,
para3: null, para3: null
name: null,
dictType: null,
createId: null,
createName: null,
createTime: null,
updateId: null,
updateName: null,
updateTime: null
}, },
dataRule: { dataRule: {
label: [ label: [
@ -64,19 +56,20 @@
value: [ value: [
{ required: true, message: '字典值不能为空', trigger: 'blur' } { required: true, message: '字典值不能为空', trigger: 'blur' }
], ],
dict_sort: [ dictSort: [
{ required: true, message: '排序不能为空', trigger: 'blur', type: 'number' } { required: true, message: '排序不能为空', trigger: 'blur', type: 'number' }
] ]
} }
} }
}, },
methods: { methods: {
init (row) { init (row, code) {
this.visible = true this.visible = true
this.dataForm.code = code
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields() this.$refs['dataForm'].resetFields()
if (row) { if (row) {
this.dataForm = row this.dataForm = {...row}
} }
}) })
}, },
@ -89,9 +82,9 @@
method: 'post', method: 'post',
data: this.$http.adornData(this.dataForm) data: this.$http.adornData(this.dataForm)
}).then(({data}) => { }).then(({data}) => {
if (data) { if (data && data.code === 200) {
this.$message({ this.$message({
message: '操作成功', message: data.msg,
type: 'success', type: 'success',
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {

Loading…
Cancel
Save