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" > -
只看自己审核记录
+
只看自己审核记录
- + @@ -89,7 +90,8 @@ getList, destroy } from '@/api/visit/record.js' - import showVisit from '@/views/visit/component/showVisit' + import showVisit from '@/views/visit/component/showVisit' + import store from "@/store/modules/user.js" export default { components: { showVisit @@ -103,9 +105,11 @@ keyword: "", audit_status: 0, my_accept_admin: 0, - my_audit: 0, - my_self:0 - }, + my_audit: 1, + my_self:0, + is_auth:0 + }, + is_admin:false, selectRange: [], statusList: [{ id: -1, @@ -168,7 +172,7 @@ prop: 'follw_people', width: 80, formatter:(cell, data, value)=>{ - return value?'是':'否' + return value.length>0?'是':'否' } }, { @@ -237,7 +241,14 @@ } }, computed: {}, - mounted() { + mounted() { + const state = store.state + console.log("state",state) + if(state.myRoles && state.myRoles.includes('系统管理员')){ + this.select.my_audit = 0 + this.is_admin = true + } + console.log(this.is_admin,state.myRoles.includes('系统管理员')) this.getList() }, methods: { diff --git a/src/views/visit/record.vue b/src/views/visit/record.vue index f7c773b..80a13b1 100644 --- a/src/views/visit/record.vue +++ b/src/views/visit/record.vue @@ -62,7 +62,8 @@ import addCommon from '@/views/visit/component/addCommon' import { download - } from '@/utils/downloadRequest' + } from '@/utils/downloadRequest' + import store from "@/store/modules/user.js" export default { components: { addCommon @@ -74,7 +75,8 @@ page: 1, page_size: 10, keyword: "", - audit_status: "", + audit_status: "", + my_accept_admin:'', start_date: "", end_date: "", is_export: 0 @@ -244,7 +246,12 @@ } }, computed: {}, - mounted() { + mounted() { + console.log("stote",store) + // const state = store.state + // if(state.role && state.role.includes('系统管理员')!=-1){ + // this.select.my_accept_admin = '' + // } this.getList() }, methods: {