Browse Source

feat: [字典管理] 增加签名

ouqian
memorylkf 1 month ago
parent
commit
a0326278a2
12 changed files with 286 additions and 95 deletions
  1. +4
    -3
      src/api/system/dict/data.js
  2. +5
    -4
      src/api/system/dict/type.js
  3. +1
    -5
      src/api/system/role.js
  4. +1
    -5
      src/api/system/user.js
  5. +9
    -1
      src/lang/en/system/dict.js
  6. +9
    -1
      src/lang/zh/system/dict.js
  7. +2
    -2
      src/lang/zh/system/user.js
  8. +2
    -2
      src/views/index.vue
  9. +67
    -16
      src/views/system/dict/data.vue
  10. +65
    -13
      src/views/system/dict/index.vue
  11. +66
    -16
      src/views/system/role/index.vue
  12. +55
    -27
      src/views/system/user/index.vue

+ 4
- 3
src/api/system/dict/data.js View File

@ -44,9 +44,10 @@ export function updateData(data) {
} }
// 删除字典数据 // 删除字典数据
export function delData(dictCode) {
export function delData(data) {
return request({ return request({
url: '/system/dict/data/' + dictCode,
method: 'delete'
url: '/system/dict/data/delete',
method: 'post',
data
}) })
} }

+ 5
- 4
src/api/system/dict/type.js View File

@ -36,10 +36,11 @@ export function updateType(data) {
} }
// 删除字典类型 // 删除字典类型
export function delType(dictId) {
export function delType(data) {
return request({ return request({
url: '/system/dict/type/' + dictId,
method: 'delete'
url: '/system/dict/type/delete',
method: 'post',
data
}) })
} }
@ -57,4 +58,4 @@ export function optionselect() {
url: '/system/dict/type/optionselect', url: '/system/dict/type/optionselect',
method: 'get' method: 'get'
}) })
}
}

+ 1
- 5
src/api/system/role.js View File

@ -45,11 +45,7 @@ export function dataScope(data) {
} }
// 角色状态修改 // 角色状态修改
export function changeRoleStatus(roleId, status) {
const data = {
roleId,
status
}
export function changeRoleStatus(data) {
return request({ return request({
url: '/system/role/changeStatus', url: '/system/role/changeStatus',
method: 'put', method: 'put',

+ 1
- 5
src/api/system/user.js View File

@ -58,11 +58,7 @@ export function resetUserPwd(userId, password) {
} }
// 用户状态修改 // 用户状态修改
export function changeUserStatus(userId, status) {
const data = {
userId,
status
}
export function changeUserStatus(data) {
return request({ return request({
url: '/system/user/changeStatus', url: '/system/user/changeStatus',
method: 'put', method: 'put',

+ 9
- 1
src/lang/en/system/dict.js View File

@ -5,5 +5,13 @@ export default {
bq: 'Label', bq: 'Label',
jz: 'Value', jz: 'Value',
sort: 'Sort', sort: 'Sort',
refresh: 'Refresh Cache'
refresh: 'Refresh Cache',
addDict: 'Create Term Book',
modifyDict: 'Edit Term Book',
deleteDict: 'Remove Term Book',
addDictData: 'Create Term Book Data',
modifyDictData: 'Edit Term Book Data',
deleteDictData: 'Remove Term Book Data'
} }

+ 9
- 1
src/lang/zh/system/dict.js View File

@ -5,5 +5,13 @@ export default {
bq: '标签', bq: '标签',
jz: '键值', jz: '键值',
sort: '排序', sort: '排序',
refresh: '刷新缓存'
refresh: '刷新缓存',
addDict: '新增字典',
modifyDict: '编辑字典',
deleteDict: '删除字典',
addDictData: '新增字典数据',
modifyDictData: '编辑字典数据',
deleteDictData: '删除字典数据'
} }

+ 2
- 2
src/lang/zh/system/user.js View File

@ -16,8 +16,8 @@ export default {
edit: '编辑', edit: '编辑',
history: '角色变更历史', history: '角色变更历史',
addUser: '新增角色',
modifyUser: '编辑角色',
addUser: '新增用户',
modifyUser: '编辑用户',
phoneError: '请输入正确的手机号码', phoneError: '请输入正确的手机号码',
bgqjs: '变更前角色', bgqjs: '变更前角色',

+ 2
- 2
src/views/index.vue View File

@ -34,7 +34,7 @@
<img src="@/assets/images/home-icon1.jpg" /> <img src="@/assets/images/home-icon1.jpg" />
</div> </div>
<div class="count-right"> <div class="count-right">
<div class="count-count">{{count.studyFinishCount}}</div>
<div class="count-count">{{count.studyWeekCount}}</div>
<div class="count-tip">{{$t('page.business.home.bzxzsy')}}</div> <div class="count-tip">{{$t('page.business.home.bzxzsy')}}</div>
</div> </div>
</div> </div>
@ -43,7 +43,7 @@
<img src="@/assets/images/home-icon1.jpg" /> <img src="@/assets/images/home-icon1.jpg" />
</div> </div>
<div class="count-right"> <div class="count-right">
<div class="count-count">{{count.studyWeekCount}}</div>
<div class="count-count">{{count.studyFinishCount}}</div>
<div class="count-tip">{{$t('page.business.home.ywcsy')}}</div> <div class="count-tip">{{$t('page.business.home.ywcsy')}}</div>
</div> </div>
</div> </div>

+ 67
- 16
src/views/system/dict/data.vue View File

@ -192,16 +192,20 @@
<el-button @click="cancel">{{$t('form.cancel')}}</el-button> <el-button @click="cancel">{{$t('form.cancel')}}</el-button>
</div> </div>
</el-dialog> </el-dialog>
<Sign ref="signRef" @callback="doSign" />
</div> </div>
</template> </template>
<script> <script>
import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data" import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data"
import { optionselect as getDictOptionselect, getType } from "@/api/system/dict/type" import { optionselect as getDictOptionselect, getType } from "@/api/system/dict/type"
import Sign from '@/views/business/study/comp/sign.vue'
export default { export default {
name: "Data", name: "Data",
dicts: ['sys_normal_disable'], dicts: ['sys_normal_disable'],
components:{Sign},
data() { data() {
return { return {
// //
@ -277,6 +281,8 @@ export default {
}, },
readonly:false, readonly:false,
operate:'',
currRow:{}
} }
}, },
created() { created() {
@ -376,37 +382,82 @@ export default {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.dictCode != undefined) { if (this.form.dictCode != undefined) {
updateData(this.form).then(response => {
this.$store.dispatch('dict/removeDict', this.queryParams.dictType)
this.open = false
this.getList()
})
this.operate = "update"
this.$refs.signRef.show(
this.$t('page.system.dict.modifyDictData'),
this.$t('page.system.dict.modifyDictData'),
)
} else { } else {
addData(this.form).then(response => {
this.$store.dispatch('dict/removeDict', this.queryParams.dictType)
this.open = false
this.getList()
})
this.operate = "add"
this.$refs.signRef.show(
this.$t('page.system.dict.addDictData'),
this.$t('page.system.dict.addDictData'),
)
} }
} }
}) })
}, },
doAdd(sign){
this.$modal.loading()
addData({dict:this.form,sign:sign}).then(response => {
this.$refs.signRef.cancel()
this.$store.dispatch('dict/removeDict', this.queryParams.dictType)
this.open = false
this.getList()
}).finally(()=>{
this.$modal.closeLoading()
})
},
doUpdate(sign){
this.$modal.loading()
updateData({dict:this.form,sign:sign}).then(response => {
this.$refs.signRef.cancel()
this.$store.dispatch('dict/removeDict', this.queryParams.dictType)
this.open = false
this.getList()
}).finally(()=>{
this.$modal.closeLoading()
})
},
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const dictCodes = row.dictCode || this.ids
this.$modal.confirm(this.$t('form.confirmDelete')).then(function() {
return delData(dictCodes)
this.currRow = row
this.$modal.confirm(this.$t('form.confirmDelete')).then(()=> {
this.operate = "delete"
this.$refs.signRef.show(
this.$t('page.system.dict.deleteDictData'),
this.$t('page.system.dict.deleteDictData'),
)
}).then(() => { }).then(() => {
this.getList()
this.$store.dispatch('dict/removeDict', this.queryParams.dictType)
}).catch(() => {}) }).catch(() => {})
}, },
doDelete(sign) {
this.$modal.loading()
delData({dict:this.currRow,sign:sign}).then(response => {
this.$refs.signRef.cancel()
this.getList()
is.$store.dispatch('dict/removeDict', this.queryParams.dictType)
}).finally(()=>{
this.$modal.closeLoading()
})
},
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('system/dict/data/export', { this.download('system/dict/data/export', {
...this.queryParams ...this.queryParams
}, `data_${new Date().getTime()}.xlsx`) }, `data_${new Date().getTime()}.xlsx`)
}
},
doSign(val){
if(this.operate==='update'){
this.doUpdate(val)
}
if(this.operate==='add'){
this.doAdd(val)
}
if(this.operate==='delete'){
this.doDelete(val)
}
},
} }
} }
</script> </script>

+ 65
- 13
src/views/system/dict/index.vue View File

@ -189,16 +189,20 @@
<el-button @click="cancel">{{$t('form.cancel')}}</el-button> <el-button @click="cancel">{{$t('form.cancel')}}</el-button>
</div> </div>
</el-dialog> </el-dialog>
<Sign ref="signRef" @callback="doSign" />
</div> </div>
</template> </template>
<script> <script>
import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type" import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type"
import { checkPermi } from "@/utils/permission"; import { checkPermi } from "@/utils/permission";
import Sign from '@/views/business/study/comp/sign.vue'
export default { export default {
name: "Dict", name: "Dict",
dicts: ['sys_normal_disable'], dicts: ['sys_normal_disable'],
components:{Sign},
data() { data() {
return { return {
// //
@ -242,6 +246,8 @@ export default {
}, },
readonly:false, readonly:false,
operate:'',
currRow:{}
} }
}, },
created() { created() {
@ -318,28 +324,63 @@ export default {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.dictId != undefined) { if (this.form.dictId != undefined) {
updateType(this.form).then(response => {
this.open = false
this.getList()
})
this.operate = "update"
this.$refs.signRef.show(
this.$t('page.system.dict.modifyDict'),
this.$t('page.system.dict.modifyDict'),
)
} else { } else {
addType(this.form).then(response => {
this.open = false
this.getList()
})
this.operate = "add"
this.$refs.signRef.show(
this.$t('page.system.dict.addDict'),
this.$t('page.system.dict.addDict'),
)
} }
} }
}) })
}, },
doAdd(sign){
this.$modal.loading()
addType({dict:this.form,sign:sign}).then(response => {
this.$refs.signRef.cancel()
this.open = false
this.getList()
}).finally(()=>{
this.$modal.closeLoading()
})
},
doUpdate(sign){
this.$modal.loading()
updateType({dict:this.form,sign:sign}).then(response => {
this.$refs.signRef.cancel()
this.open = false
this.getList()
}).finally(()=>{
this.$modal.closeLoading()
})
},
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const dictIds = row.dictId || this.ids
this.$modal.confirm(this.$t('form.confirmDelete')).then(function() {
return delType(dictIds)
this.currRow = row
this.$modal.confirm(this.$t('form.confirmDelete')).then(()=> {
this.operate = "delete"
this.$refs.signRef.show(
this.$t('page.system.dict.deleteDict'),
this.$t('page.system.dict.deleteDict'),
)
}).then(() => { }).then(() => {
this.getList()
}).catch(() => {}) }).catch(() => {})
}, },
/** 删除按钮操作 */
doDelete(sign) {
this.$modal.loading()
delType({dict:this.currRow,sign:sign}).then(response => {
this.$refs.signRef.cancel()
this.getList()
}).finally(()=>{
this.$modal.closeLoading()
})
},
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('system/dict/type/export', { this.download('system/dict/type/export', {
@ -351,7 +392,18 @@ export default {
refreshCache().then(() => { refreshCache().then(() => {
this.$store.dispatch('dict/cleanDict') this.$store.dispatch('dict/cleanDict')
}) })
}
},
doSign(val){
if(this.operate==='update'){
this.doUpdate(val)
}
if(this.operate==='add'){
this.doAdd(val)
}
if(this.operate==='delete'){
this.doDelete(val)
}
},
} }
} }
</script> </script>

+ 66
- 16
src/views/system/role/index.vue View File

@ -309,7 +309,7 @@
</div> </div>
</el-dialog> </el-dialog>
<Sign ref="signRef" @callback="doChangRoleUser" />
<Sign ref="signRef" @callback="doSign" />
</div> </div>
</template> </template>
@ -416,7 +416,10 @@ export default {
oldIdList:[] oldIdList:[]
}
},
operate:'',
currRow:{}
} }
}, },
created() { created() {
@ -482,8 +485,22 @@ export default {
}, },
// //
handleStatusChange(row) { handleStatusChange(row) {
changeRoleStatus(row.roleId, row.status === "0"?'1':'0').then(response => {
this.operate = "disable"
this.currRow = row
this.$refs.signRef.show(
row.status === "0"?this.$t('page.system.role.disable'):this.$t('page.system.role.enable'),
row.status === "0"?this.$t('page.system.role.disable'):this.$t('page.system.role.enable'),
)
},
//
doHandleStatusChange(sign) {
this.$modal.loading()
let row = this.currRow
changeRoleStatus({role:{roleId:row.roleId, status:row.status === "0"?'1':'0'},sign:sign}).then(response => {
this.$refs.signRef.cancel()
this.getList() this.getList()
}).finally(()=>{
this.$modal.closeLoading()
}) })
// let text = row.status === "0" ? "" : "" // let text = row.status === "0" ? "" : ""
@ -655,24 +672,42 @@ export default {
this.$modal.loading() this.$modal.loading()
if (this.form.roleId != undefined) { if (this.form.roleId != undefined) {
this.form.menuIds = this.getMenuAllCheckedKeys() this.form.menuIds = this.getMenuAllCheckedKeys()
updateRole(this.form).then(response => {
this.open = false
this.getList()
}).finally(()=>{
this.$modal.closeLoading()
})
this.operate = "update"
this.$refs.signRef.show(
this.$t('page.system.role.modifyRole'),
this.$t('page.system.role.modifyRole'),
)
} else { } else {
this.form.menuIds = this.getMenuAllCheckedKeys() this.form.menuIds = this.getMenuAllCheckedKeys()
addRole(this.form).then(response => {
this.open = false
this.getList()
}).finally(()=>{
this.$modal.closeLoading()
})
this.operate = "add"
this.$refs.signRef.show(
this.$t('page.system.role.addRole'),
this.$t('page.system.role.addRole'),
)
} }
} }
}) })
}, },
doAdd(sign){
this.$modal.loading()
addRole({role:this.form,sign:sign}).then(response => {
this.$refs.signRef.cancel()
this.open = false
this.getList()
}).finally(()=>{
this.$modal.closeLoading()
})
},
doUpdate(sign){
this.$modal.loading()
updateRole({role:this.form,sign:sign}).then(response => {
this.$refs.signRef.cancel()
this.open = false
this.getList()
}).finally(()=>{
this.$modal.closeLoading()
})
},
/** 提交按钮(数据权限) */ /** 提交按钮(数据权限) */
submitDataScope: function() { submitDataScope: function() {
if (this.form.roleId != undefined) { if (this.form.roleId != undefined) {
@ -736,6 +771,7 @@ export default {
} }
} }
if(update){ if(update){
this.operate = 'allocated'
this.$refs.signRef.show( this.$refs.signRef.show(
this.$t('page.system.role.fpjs'), this.$t('page.system.role.fpjs'),
this.$t('page.system.role.fpjs'), this.$t('page.system.role.fpjs'),
@ -752,7 +788,21 @@ export default {
}).finally(()=>{ }).finally(()=>{
this.$modal.closeLoading() this.$modal.closeLoading()
}) })
}
},
doSign(val){
if(this.operate==='update'){
this.doUpdate(val)
}
if(this.operate==='add'){
this.doAdd(val)
}
if(this.operate==='disable'){
this.doHandleStatusChange(val)
}
if(this.operate==='allocated'){
this.doChangRoleUser(val)
}
},
} }
} }
</script> </script>

+ 55
- 27
src/views/system/user/index.vue View File

@ -260,7 +260,7 @@
</div> </div>
</el-dialog> </el-dialog>
<Sign ref="signRef" @callback="doUpdate" />
<Sign ref="signRef" @callback="doSign" />
<el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :title="$t('page.system.user.history')" :visible.sync="changeDialog.visible" width="70%" append-to-body> <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :title="$t('page.system.user.history')" :visible.sync="changeDialog.visible" width="70%" append-to-body>
@ -426,7 +426,10 @@ export default {
total:0, total:0,
list:[] list:[]
}
},
operate:'',
currRow:{}
} }
}, },
watch: { watch: {
@ -484,8 +487,21 @@ export default {
}, },
// //
handleStatusChange(row) { handleStatusChange(row) {
changeUserStatus(row.userId, row.status === "0"?'1':'0').then(response => {
this.operate = "disable"
this.currRow = row
this.$refs.signRef.show(
row.status === "0"?this.$t('page.system.user.disable'):this.$t('page.system.user.enable'),
row.status === "0"?this.$t('page.system.user.disable'):this.$t('page.system.user.enable'),
)
},
doHandleStatusChange(sign) {
this.$modal.loading()
let row = this.currRow
changeUserStatus({user:{userId:row.userId,status:row.status === "0"?'1':'0'},sign:sign}).then(response => {
this.$refs.signRef.cancel()
this.getList() this.getList()
}).finally(()=>{
this.$modal.closeLoading()
}) })
// let text = row.status === "0" ? "" : "" // let text = row.status === "0" ? "" : ""
@ -609,34 +625,31 @@ export default {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.userId != undefined) { if (this.form.userId != undefined) {
let updateRole = false;
if(this.oldRoleIdList.length!==this.form.roleIds.length){
updateRole = true
}else{
for(let i=0;i<this.oldRoleIdList.length;i++){
if(_.findIndex(this.form.roleIds,o=>{return o==this.oldRoleIdList[i]})==-1){
updateRole = true
break
}
}
}
if(updateRole){
this.$refs.signRef.show(
this.$t('page.system.role.fpjs'),
this.$t('page.system.role.fpjs'),
)
}else{
this.doUpdate({})
}
this.operate = "update"
this.$refs.signRef.show(
this.$t('page.system.user.modifyUser'),
this.$t('page.system.user.modifyUser'),
)
} else { } else {
addUser(this.form).then(response => {
this.open = false
this.getList()
})
this.operate = "add"
this.$refs.signRef.show(
this.$t('page.system.user.addUser'),
this.$t('page.system.user.addUser'),
)
} }
} }
}) })
}, },
doAddUser(sign){
this.$modal.loading()
addUser({user:this.form,sign:sign}).then(response => {
this.$refs.signRef.cancel()
this.open = false
this.getList()
}).finally(()=>{
this.$modal.closeLoading()
})
},
doUpdate(sign){ doUpdate(sign){
this.$modal.loading() this.$modal.loading()
updateUser({user:this.form,sign:sign}).then(response => { updateUser({user:this.form,sign:sign}).then(response => {
@ -723,7 +736,22 @@ export default {
handleExportHistory(){ handleExportHistory(){
this.saveSimpleLog({name:'',nameEn:'',jcmc:'角色变更历史导出',jcmcEn:'Role History Export'}) this.saveSimpleLog({name:'',nameEn:'',jcmc:'角色变更历史导出',jcmcEn:'Role History Export'})
this.download('/system/business/roleChange/export', this.changeDialog.searchForm, `roleHistory_${new Date().getTime()}.xlsx`) this.download('/system/business/roleChange/export', this.changeDialog.searchForm, `roleHistory_${new Date().getTime()}.xlsx`)
}
},
doSign(val){
if(this.operate==='update'){
this.doUpdate(val)
}
if(this.operate==='add'){
this.doAddUser(val)
}
if(this.operate==='disable'){
this.doHandleStatusChange(val)
}
if(this.operate==='gh'){
this.doGh(val)
}
},
} }
} }
</script> </script>

Loading…
Cancel
Save