diff --git a/src/utils/validateOnly.js b/src/utils/validateOnly.js index 01ea39d..2463afc 100644 --- a/src/utils/validateOnly.js +++ b/src/utils/validateOnly.js @@ -126,3 +126,24 @@ export async function checkDictCode(value, id, {err1 = dictCodeErrMsg.err1} = {} return err1 } } + +const departNameErrMsg = { + err1:'请输入机构/部门名称' +} +/** + * 部门管理部门名称唯一校验 + * @param value:要校验的值 + * @param id:数据id + * */ +export async function checkDepartName(value, id, {err1 = departNameErrMsg.err1} = {}) { + if (value) { + const param = { + confusionCode: 'depart_name', + fieldVal: value, + dataId: id + } + return duplicateCheck(param) + } else { + return err1 + } +} diff --git a/src/views/system/DepartList.vue b/src/views/system/DepartList.vue index d0d1251..44f7c18 100644 --- a/src/views/system/DepartList.vue +++ b/src/views/system/DepartList.vue @@ -1,202 +1,625 @@ diff --git a/src/views/system/modules/DepartModal.vue b/src/views/system/modules/DepartModal.vue index c5ff6cd..eecd741 100644 --- a/src/views/system/modules/DepartModal.vue +++ b/src/views/system/modules/DepartModal.vue @@ -18,18 +18,18 @@ label="机构名称" :hidden="false" hasFeedback> - + + + + + - - - - - - - - - - - + - + - + - + - + @@ -93,6 +93,7 @@ import { httpAction } from "@/api/manage"; import { queryIdTree } from "@/api/api"; import pick from "lodash.pick"; import ATextarea from "ant-design-vue/es/input/TextArea"; +import {checkDepartName, checkRoleCode} from "@/utils/validateOnly"; export default { name: "SysDepartModal", @@ -123,9 +124,10 @@ export default { confirmLoading: false, form: this.$form.createForm(this), validatorRules: { - departName: { rules: [{ required: true, message: "请输入机构/部门名称!" }] }, - orgCode: { rules: [{ required: true, message: "请输入机构编码!" }] }, - mobile: { rules: [{ validator: this.validateMobile }] } + departName: { rules: [{ required: true,validator:this.validateDepartName }],validateTrigger: 'blur' }, + orgCode: { rules: [{ required: true, message: "请输入机构编码!" }] ,validateTrigger: 'blur' }, + mobile: { rules: [{ validator: this.validateMobile }] ,validateTrigger: 'blur' + } }, url: { add: "/sys/sysDepart/add" @@ -207,6 +209,15 @@ export default { handleCancel() { this.close(); }, + validateDepartName(rule, value, callback){ + checkDepartName(value,this.model.id).then(res => { + if(res.success){ + callback() + }else { + callback(res.code === 500 ? '机构/部门已经存在': res) + } + }) + }, validateMobile(rule, value, callback) { if (!value || new RegExp(/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/).test(value)) { callback(); diff --git a/src/views/system/modules/DeptUserInfo.vue b/src/views/system/modules/DeptUserInfo.vue index a9c2d83..9ad418d 100644 --- a/src/views/system/modules/DeptUserInfo.vue +++ b/src/views/system/modules/DeptUserInfo.vue @@ -1,13 +1,5 @@ diff --git a/src/views/system/modules/DictItemModal.vue b/src/views/system/modules/DictItemModal.vue index 4dc0315..4a67e0a 100644 --- a/src/views/system/modules/DictItemModal.vue +++ b/src/views/system/modules/DictItemModal.vue @@ -15,14 +15,14 @@ :labelCol="labelCol" :wrapperCol="wrapperCol" label="名称"> - + - + { return range[0] + "-" + range[1] + " 共" + total + "条" }, @@ -163,10 +165,12 @@ }, methods: { searchQuery() { + this.lastQueryParam = { ...this.queryParam } this.loadData(1); }, searchReset() { this.queryParam = {}; + this.lastQueryParam = {} this.loadData(1); }, handleCancel() { @@ -180,6 +184,8 @@ }, add() { this.visible = true; + // 再次打开 清除之前的选中状态 + this.onClearSelected() }, loadData(arg) { //加载数据 若传入参数1则加载第一页的内容 @@ -195,7 +201,7 @@ }) }, getQueryParams() { - var param = Object.assign({}, this.queryParam, this.isorter); + var param = Object.assign({}, this.lastQueryParam, this.isorter); param.field = this.getQueryField(); param.pageNo = this.ipagination.current; param.pageSize = this.ipagination.pageSize; @@ -284,4 +290,4 @@ height: 90% !important; overflow-y: hidden } - \ No newline at end of file + diff --git a/src/views/system/modules/UserModal.vue b/src/views/system/modules/UserModal.vue index aeafaca..4c49c2f 100644 --- a/src/views/system/modules/UserModal.vue +++ b/src/views/system/modules/UserModal.vue @@ -24,23 +24,23 @@ + :readOnly="!!model.id" :disabled="disableSubmit" /> - + @@ -54,7 +54,7 @@ {{ item.title }} @@ -93,18 +94,18 @@ - + - + - @@ -418,8 +419,6 @@ export default { formData.confirmpassword = formData.password formData.phone = encrypt(that.rsaPublicKey,values.phone) formData.email = encrypt(that.rsaPublicKey,values.email) - debugger - //update-begin-author:taoyan date:2020710 for:多租户配置 formData.relTenantIds = this.currentTenant.length > 0 ? this.currentTenant.join(',') : '' //update-end-author:taoyan date:2020710 for:多租户配置 diff --git a/vue.config.js b/vue.config.js index 1bb32f1..e9226d3 100644 --- a/vue.config.js +++ b/vue.config.js @@ -66,8 +66,8 @@ module.exports = { less: { modifyVars: { /* less 变量覆盖,用于自定义 ant design 主题 */ - 'primary-color': '#1890FF', - 'link-color': '#1890FF', + 'primary-color': '#069f99', + 'link-color': '#069f99', 'border-radius-base': '4px', }, javascriptEnabled: true, @@ -95,4 +95,4 @@ module.exports = { }, lintOnSave: undefined -} \ No newline at end of file +}