提交 79748de8 authored 作者: lidongxu's avatar lidongxu

refactor(store/user): 修改用户信息用法_工号昵称id

上级 5944d489
...@@ -170,8 +170,7 @@ import PickerBelong from '../components/PickerBelong' ...@@ -170,8 +170,7 @@ import PickerBelong from '../components/PickerBelong'
const myForm = ref({}) const myForm = ref({})
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const employeeNo = computed(() => userStore().employeeNo) const employeeNo = computed(() => userStore().employeeNo)
const employeeName = computed(() => userStore().employeeName) const empInfo = userStore().empInfo
const employeeInfo = computed(() => userStore().employeeInfo)
const isCityManager = ref(userStore().promotionIdentity) const isCityManager = ref(userStore().promotionIdentity)
const form = reactive({}) const form = reactive({})
const router = useRouter(); const router = useRouter();
...@@ -216,9 +215,9 @@ const validatorIncidentals = (value, obj) => { ...@@ -216,9 +215,9 @@ const validatorIncidentals = (value, obj) => {
} }
} }
const onSubmit = async () => { const onSubmit = async () => {
for (let key in employeeInfo.value) { form.operNo = empInfo.empNo
form[key] = employeeInfo.value[key] form.operName = empInfo.empName
} form.operId = empInfo.empId
if (planId) { if (planId) {
const res = await updatePlanByWebAPI(form) const res = await updatePlanByWebAPI(form)
...@@ -297,9 +296,9 @@ const selEmployee = () => { ...@@ -297,9 +296,9 @@ const selEmployee = () => {
onMounted(() => { onMounted(() => {
// 如果当前是城市经理,自动填入归属人信息 // 如果当前是城市经理,自动填入归属人信息
if (isCityManager.value) { if (isCityManager.value) {
form.employeeName = employeeName.value form.employeeName = empInfo.empName
form.employeeNo = employeeNo.value form.employeeNo = empInfo.empNo
form.employeeId = userStore().employeeId form.employeeId = empInfo.empId
} }
}) })
......
...@@ -99,7 +99,7 @@ const router = useRouter() ...@@ -99,7 +99,7 @@ const router = useRouter()
const route = useRoute() const route = useRoute()
const promotionIdentity = computed(() => userStore().promotionIdentity) const promotionIdentity = computed(() => userStore().promotionIdentity)
const employeeNo = computed(() => userStore().employeeNo) const employeeNo = computed(() => userStore().employeeNo)
const employeeName = computed(() => userStore().employeeName) const empInfo = userStore().empInfo
// 搜索弹窗 // 搜索弹窗
const showSearch = ref(false) const showSearch = ref(false)
...@@ -278,7 +278,7 @@ const confirmPickerBelong = async (val) => { ...@@ -278,7 +278,7 @@ const confirmPickerBelong = async (val) => {
// 循环判断计划是否含有以前和执行中的 // 循环判断计划是否含有以前和执行中的
await batchUpdatePlanAPI({ await batchUpdatePlanAPI({
employeeId: val.selectedOptions[0]?.value, // 选择的归属人 id employeeId: val.selectedOptions[0]?.value, // 选择的归属人 id
operName: employeeName.value, operName: empInfo.empName,
planIds: planList.value.filter(item => item.checked).map(item => item.id) planIds: planList.value.filter(item => item.checked).map(item => item.id)
}) })
......
...@@ -111,24 +111,9 @@ export default defineStore( ...@@ -111,24 +111,9 @@ export default defineStore(
empName: state.userInfo.nickName, // 员工昵称名字 empName: state.userInfo.nickName, // 员工昵称名字
} }
}, },
// 操作人员工工号,姓名,id
employeeInfo(state) {
return {
operNo: state.userInfo.userName,
operName: state.userInfo.nickName,
operId: state.userInfo.userId
}
},
// 获取员工工号 // 获取员工工号
employeeNo(state) { employeeNo(state) {
return state.userInfo.userName return state.userInfo.userName
},
// 获取员工姓名
employeeName(state) {
return state.userInfo.nickName
} }
} }
}) })
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论