From 7028e87d5da8b049343339d1c5b237fa78d805da Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Fri, 21 Mar 2025 15:02:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/user.js | 23 +++++-- src/views/parameter/component/addVisitor.vue | 63 ++++++++++++++++++-- src/views/visit/check.vue | 27 ++++++--- src/views/visit/record.vue | 13 +++- 4 files changed, 103 insertions(+), 23 deletions(-) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index c288974..a561c81 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -17,7 +17,8 @@ const getDefaultState = () => { token: getToken(), name: '', avatar: '', - roles: [] + roles: [], + myRoles:[] } } @@ -38,7 +39,11 @@ const mutations = { }, SET_ROLES: (state, roles) => { state.roles = roles - } + }, + SET_MYROLES: (state, myRoles) => { + state.myRoles = myRoles + }, + } const actions = { @@ -79,17 +84,23 @@ const actions = { if (!response) { reject('身份验证失败请重新登录') - } + } + console.log("response",response) + response["myRoles"]=[] + response["role"].map(item=>{ + response["myRoles"].push(item.name) + }) response["roles"] = ["admin"]; - const { + const { + myRoles, roles, name, avatar } = response - - commit('SET_ROLES', roles) + commit('SET_ROLES', roles) + commit('SET_MYROLES', myRoles) commit('SET_NAME', name) commit('SET_AVATAR', avatar) resolve(response) diff --git a/src/views/parameter/component/addVisitor.vue b/src/views/parameter/component/addVisitor.vue index b380788..020fffe 100644 --- a/src/views/parameter/component/addVisitor.vue +++ b/src/views/parameter/component/addVisitor.vue @@ -45,7 +45,7 @@ size="small" type="primary" ghost - @click="form.audit_admin.splice(scope.$index, 1)" + @click="delRow(scope.$index)" >删除 @@ -95,7 +95,7 @@ audit_admin:[], remark:"" }, - checkList:['一级审核人','二级审核人','三级审核人'], + checkList:[], rules:{ name:[ { @@ -207,15 +207,65 @@ name:res?.name, audit_admin:res?.audit_admin, remark:res?.remark + } + let arr = [] + if(res.audit_admin.length>0){ + res.audit_admin.map((item,index)=>{ + arr.push(`${this.indexToChinese(index)}级审核人`) + }) + this.checkList = arr } }, addRow(){ - if(this.form.audit_admin.length==3){ - return - } + // if(this.form.audit_admin.length==3){ + // return + // } + this.form.audit_admin.push({ type:'',admin_id:'',level:'',type_name:'',admin_name:'' }) + let checkName = `${this.indexToChinese(this.form.audit_admin.length-1)}级审核人` + this.checkList.push(checkName) + console.log("this.checkList",this.checkList) + }, + delRow(index){ + this.form.audit_admin.splice(index, 1) + this.checkList.splice(index, 1) + let arr = [] + this.checkList.map((item,index)=>{ + arr.push(`${this.indexToChinese(index)}级审核人`) + }) + this.checkList = arr + console.log("this.arr",this.checkList) + }, + indexToChinese(index) { + const chineseNumbers = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十']; + if (index >= 0 && index < 10) { + return chineseNumbers[index]; + } else if (index === 10) { + return '十'; + } else if (index < 20) { + return '十' + chineseNumbers[index - 11]; + } else { + const tens = Math.floor(index / 10); + const units = index % 10; + let result = ''; + if (tens > 1) { + result += chineseNumbers[tens - 1] + '十'; + } else { + result += '十'; + } + if (units > 0) { + result += chineseNumbers[units - 1]; + } + return result; + } }, submit() { + + if(this.form.audit_admin.length>0){ + this.form.audit_admin.map((item,index)=>{ + item.level = index+1 + }) + } console.log(this.form) // return let that = this @@ -241,7 +291,8 @@ } } else { this.id = '' - this.type = '' + this.type = '' + this.checkList = [] this.$refs['dialog'].reset() } } diff --git a/src/views/visit/check.vue b/src/views/visit/check.vue index 92fe7c6..13d0a04 100644 --- a/src/views/visit/check.vue +++ b/src/views/visit/check.vue @@ -22,8 +22,9 @@ :inactive-value="0" > -