master
lion 9 months ago
parent 62ee6f5e9c
commit 7028e87d5d

@ -17,7 +17,8 @@ const getDefaultState = () => {
token: getToken(), token: getToken(),
name: '', name: '',
avatar: '', avatar: '',
roles: [] roles: [],
myRoles:[]
} }
} }
@ -38,7 +39,11 @@ const mutations = {
}, },
SET_ROLES: (state, roles) => { SET_ROLES: (state, roles) => {
state.roles = roles state.roles = roles
} },
SET_MYROLES: (state, myRoles) => {
state.myRoles = myRoles
},
} }
const actions = { const actions = {
@ -79,17 +84,23 @@ const actions = {
if (!response) { if (!response) {
reject('身份验证失败请重新登录') reject('身份验证失败请重新登录')
} }
console.log("response",response)
response["myRoles"]=[]
response["role"].map(item=>{
response["myRoles"].push(item.name)
})
response["roles"] = ["admin"]; response["roles"] = ["admin"];
const { const {
myRoles,
roles, roles,
name, name,
avatar avatar
} = response } = response
commit('SET_ROLES', roles)
commit('SET_ROLES', roles) commit('SET_MYROLES', myRoles)
commit('SET_NAME', name) commit('SET_NAME', name)
commit('SET_AVATAR', avatar) commit('SET_AVATAR', avatar)
resolve(response) resolve(response)

@ -45,7 +45,7 @@
size="small" size="small"
type="primary" type="primary"
ghost ghost
@click="form.audit_admin.splice(scope.$index, 1)" @click="delRow(scope.$index)"
>删除</Button >删除</Button
> >
</template> </template>
@ -95,7 +95,7 @@
audit_admin:[], audit_admin:[],
remark:"" remark:""
}, },
checkList:['一级审核人','二级审核人','三级审核人'], checkList:[],
rules:{ rules:{
name:[ name:[
{ {
@ -207,15 +207,65 @@
name:res?.name, name:res?.name,
audit_admin:res?.audit_admin, audit_admin:res?.audit_admin,
remark:res?.remark 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(){ addRow(){
if(this.form.audit_admin.length==3){ // if(this.form.audit_admin.length==3){
return // return
} // }
this.form.audit_admin.push({ type:'',admin_id:'',level:'',type_name:'',admin_name:'' }) 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() { submit() {
if(this.form.audit_admin.length>0){
this.form.audit_admin.map((item,index)=>{
item.level = index+1
})
}
console.log(this.form) console.log(this.form)
// return // return
let that = this let that = this
@ -241,7 +291,8 @@
} }
} else { } else {
this.id = '' this.id = ''
this.type = '' this.type = ''
this.checkList = []
this.$refs['dialog'].reset() this.$refs['dialog'].reset()
} }
} }

@ -22,8 +22,9 @@
:inactive-value="0" :inactive-value="0"
> >
</el-switch> </el-switch>
<div style="margin:0 10px;">只看自己审核记</div> <div v-if="is_admin" style="margin:0 10px;"></div>
<el-switch <el-switch
v-if="is_admin"
v-model="select.my_audit" v-model="select.my_audit"
active-color="#004593" active-color="#004593"
inactive-color="#ddd" inactive-color="#ddd"
@ -79,7 +80,7 @@
</template> </template>
</el-table-column> </el-table-column>
</template> </template>
</xy-table> </xy-table>
<showVisit ref="showVisit" @refresh="getList"></showVisit> <showVisit ref="showVisit" @refresh="getList"></showVisit>
</div> </div>
</template> </template>
@ -89,7 +90,8 @@
getList, getList,
destroy destroy
} from '@/api/visit/record.js' } 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 { export default {
components: { components: {
showVisit showVisit
@ -103,9 +105,11 @@
keyword: "", keyword: "",
audit_status: 0, audit_status: 0,
my_accept_admin: 0, my_accept_admin: 0,
my_audit: 0, my_audit: 1,
my_self:0 my_self:0,
}, is_auth:0
},
is_admin:false,
selectRange: [], selectRange: [],
statusList: [{ statusList: [{
id: -1, id: -1,
@ -168,7 +172,7 @@
prop: 'follw_people', prop: 'follw_people',
width: 80, width: 80,
formatter:(cell, data, value)=>{ formatter:(cell, data, value)=>{
return value?'是':'否' return value.length>0?'是':'否'
} }
}, },
{ {
@ -237,7 +241,14 @@
} }
}, },
computed: {}, 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() this.getList()
}, },
methods: { methods: {

@ -62,7 +62,8 @@
import addCommon from '@/views/visit/component/addCommon' import addCommon from '@/views/visit/component/addCommon'
import { import {
download download
} from '@/utils/downloadRequest' } from '@/utils/downloadRequest'
import store from "@/store/modules/user.js"
export default { export default {
components: { components: {
addCommon addCommon
@ -74,7 +75,8 @@
page: 1, page: 1,
page_size: 10, page_size: 10,
keyword: "", keyword: "",
audit_status: "", audit_status: "",
my_accept_admin:'',
start_date: "", start_date: "",
end_date: "", end_date: "",
is_export: 0 is_export: 0
@ -244,7 +246,12 @@
} }
}, },
computed: {}, 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() this.getList()
}, },
methods: { methods: {

Loading…
Cancel
Save