提交 e96c275b authored 作者: lidongxu's avatar lidongxu

refactor(plan-search): 拆分搜索计划组件为单独的 vue 文件

同上
上级 c3f7190e
......@@ -7,21 +7,7 @@ export function getPlanListAPI(queryParams) {
baseURL: VITE_APP_PROMOTION,
url: '/plan/v2/query/page',
method: 'POST',
data: {
pageNum: queryParams.pageNum,
pageSize: queryParams.pageSize,
queryParams: {
activityStartDate: queryParams.activityDate && queryParams.activityDate[0],
activityEndDate: queryParams.activityDate && queryParams.activityDate[1],
planStatus: queryParams.planStatus,
province: queryParams.province,
city: queryParams.city,
dealerId: queryParams.zoneId,
orgQcId: queryParams.warzoneId,
employeeId: queryParams.employeeId,
storeNameLike: queryParams.storeName
}
}
data: queryParams
})
}
......
<template>
<div>
<van-popup v-model:show="innerShowPicker"
destroy-on-close
round
position="bottom"
@close="onPopupClose">
<van-picker
:columns="columns"
:cancel-button-text="searchShow ? '' : '取消'"
@confirm="onConfirm">
<template #title>
<!-- 搜索框 -->
<van-search v-if="searchShow"
v-model="searchText"
:placeholder="placeholder"
shape="round"
@update:model-value="onSearch" />
</template>
<template #empty>
<van-empty image="https://fastly.jsdelivr.net/npm/@vant/assets/custom-empty-image.png"
image-size="40"
description="暂无数据" />
</template>
</van-picker>
</van-popup>
</div>
<van-popup
destroy-on-close
round
teleport="body"
position="bottom"
@close="onPopupClose">
<van-picker :columns="columns"
:cancel-button-text="searchShow ? '' : '取消'"
@confirm="onConfirm">
<template #title>
<!-- 搜索框 -->
<van-search v-if="searchShow"
v-model="searchText"
:placeholder="placeholder"
shape="round"
@update:model-value="onSearch" />
</template>
<template #empty>
<van-empty image="https://fastly.jsdelivr.net/npm/@vant/assets/custom-empty-image.png"
image-size="40"
description="暂无数据" />
</template>
</van-picker>
</van-popup>
</template>
<script setup>
const props = defineProps({
// 控制弹窗显示隐藏
modelValue: {
type: Boolean,
default: false
},
// 选择器列数据
columns: {
type: Array,
......@@ -52,22 +45,15 @@ const props = defineProps({
});
// 定义向外触发的事件
const emit = defineEmits(['update:modelValue', 'confirm', 'search']);
const emit = defineEmits(['confirm', 'search']);
// 内部显示状态
const innerShowPicker = ref(props.modelValue);
// 搜索文本
const searchText = ref('');
// 监听 props 变化更新内部状态
watch(() => props.modelValue, (newValue) => {
innerShowPicker.value = newValue;
});
// 弹窗关闭时触发
const onPopupClose = () => {
searchText.value = '';
emit('update:modelValue', false);
emit('search', '');
};
/**
......@@ -77,8 +63,6 @@ const onPopupClose = () => {
*/
const onConfirm = (values) => {
emit('confirm', values);
emit('update:modelValue', false);
};
/**
......
......@@ -11,17 +11,15 @@ export const getPromotionRole = (role) => {
}
// 促销活动状态
export const NOT_EXECUTION = 'NOT_EXECUTION' // 未执行
export const EXECUTION = 'EXECUTION' // 执行
// 后台:返回数字,又让我传给他英文字符
// 后台:返回数字,又让我传给他英文字符,页面展示中文
export const PROMOTION_STATUS = {
0: {
label: '未执行',
value: NOT_EXECUTION
value: 'NOT_EXECUTION'
},
1: {
label: '执行',
value: EXECUTION
value: 'EXECUTION'
}
}
export const getPromotionActiveStatus = (statusNum) => {
......
......@@ -231,7 +231,7 @@ const decreaseCount = async () => {
temNum: form.value.temNum - 1,
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
form.value.temNum--;
}
......@@ -243,7 +243,7 @@ const increaseCount = async () => {
temNum: form.value.temNum + 1,
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
form.value.temNum++;
};
......@@ -302,14 +302,14 @@ const storePictureRead = async (file) => {
const date = new Date()
const month = date.getMonth() + 1
const theDate = date.getDate()
const pictureUrl = await uploadFileToOSSAPI(`examine/${date.getFullYear()}-${month}/${theDate}/${planId.value}/${userStore().getEmployeeNo}/${uuidv4()}.png`, file.file)
const pictureUrl = await uploadFileToOSSAPI(`examine/${date.getFullYear()}-${month}/${theDate}/${planId.value}/${userStore().employeeNo}/${uuidv4()}.png`, file.file)
await createExamine({
id: form.value.id,
storePicture: pictureUrl,
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
}
// 删除店铺门头照
......@@ -319,7 +319,7 @@ const deleteStorePicture = async () => {
storePicture: '',
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
}
......@@ -331,7 +331,7 @@ const planStatusChange = async (val) => {
planStatus: form.value.planStatus,
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
}
......@@ -342,7 +342,7 @@ const changeStoreDd = async () => {
storeDd: form.value.storeDd,
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
}
......@@ -357,7 +357,7 @@ const changeTemOnWork = async () => {
temOnWork: form.value.temOnWork,
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
}
const changeTemOnWorkTimeRange = () => {
......@@ -378,7 +378,7 @@ const changeTemHs = async () => {
temHs: form.value.temHs,
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
}
const changeTemWl = async () => {
......@@ -387,7 +387,7 @@ const changeTemWl = async () => {
temWl: form.value.temWl,
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
}
const changeTemZz = async () => {
......@@ -396,7 +396,7 @@ const changeTemZz = async () => {
temZz: form.value.temZz,
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
}
......@@ -406,7 +406,7 @@ const temWorkPhotosRead = async (file) => {
const date = new Date()
const month = date.getMonth() + 1
const theDate = date.getDate()
const pictureUrl = await uploadFileToOSSAPI(`examine/${date.getFullYear()}-${month}/${theDate}/${planId.value}/${userStore().getEmployeeNo}/${uuidv4()}.png`, file.file)
const pictureUrl = await uploadFileToOSSAPI(`examine/${date.getFullYear()}-${month}/${theDate}/${planId.value}/${userStore().employeeNo}/${uuidv4()}.png`, file.file)
// 如果当前对象包含 objectUrl 则是组件上传的,替换当前元素的对象
const index = form.value.temWorkPhotos.findIndex(o => o.objectUrl)
form.value.temWorkPhotos[index] = {
......@@ -418,7 +418,7 @@ const temWorkPhotosRead = async (file) => {
temWorkPhotos: form.value.temWorkPhotos.map(o => o.url),
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
}
......@@ -429,7 +429,7 @@ const deleteTemWorkPhotos = async () => {
temWorkPhotos: form.value.temWorkPhotos.map(o => o.url),
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
}
......@@ -439,14 +439,14 @@ const storeTcPhotoRead = async (file) => {
const date = new Date()
const month = date.getMonth() + 1
const theDate = date.getDate()
const pictureUrl = await uploadFileToOSSAPI(`examine/${date.getFullYear()}-${month}/${theDate}/${planId.value}/${userStore().getEmployeeNo}/${uuidv4()}.png`, file.file)
const pictureUrl = await uploadFileToOSSAPI(`examine/${date.getFullYear()}-${month}/${theDate}/${planId.value}/${userStore().employeeNo}/${uuidv4()}.png`, file.file)
await createExamine({
id: form.value.id,
storeTcPhoto: pictureUrl,
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
}
......@@ -457,7 +457,7 @@ const deleteStoreTcPhoto = async () => {
storeTcPhoto: '',
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
}
......@@ -467,14 +467,14 @@ const temOnWorkPictureRead = async (file) => {
const date = new Date()
const month = date.getMonth() + 1
const theDate = date.getDate()
const pictureUrl = await uploadFileToOSSAPI(`examine/${date.getFullYear()}-${month}/${theDate}/${planId.value}/${userStore().getEmployeeNo}/${uuidv4()}.png`, file.file)
const pictureUrl = await uploadFileToOSSAPI(`examine/${date.getFullYear()}-${month}/${theDate}/${planId.value}/${userStore().employeeNo}/${uuidv4()}.png`, file.file)
await createExamine({
id: form.value.id,
storeZhjPhoto: pictureUrl,
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
}
// 删除主货架照片
......@@ -484,7 +484,7 @@ const deleteStoreZhjPhoto = async () => {
storeZhjPhoto: '',
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
}
......@@ -494,7 +494,7 @@ const posPhotosRead = async (file) => {
const date = new Date()
const month = date.getMonth() + 1
const theDate = date.getDate()
const pictureUrl = await uploadFileToOSSAPI(`examine/${date.getFullYear()}-${month}/${theDate}/${planId.value}/${userStore().getEmployeeNo}/${uuidv4()}.png`, file.file)
const pictureUrl = await uploadFileToOSSAPI(`examine/${date.getFullYear()}-${month}/${theDate}/${planId.value}/${userStore().employeeNo}/${uuidv4()}.png`, file.file)
// 判断 objectUrl
const index = form.value.posPhotos.findIndex(o => o.objectUrl)
form.value.posPhotos[index] = {
......@@ -506,7 +506,7 @@ const posPhotosRead = async (file) => {
posPhotos: form.value.posPhotos.map(o => o.url),
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
}
// 删除 POS 照片
......@@ -516,7 +516,7 @@ const deletePosPhotos = async () => {
posPhotos: form.value.posPhotos.map(o => o.url),
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
}
......@@ -527,7 +527,7 @@ const posRmbChange = async () => {
posRmb: form.value.posRmb || 0,
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
}
......
......@@ -95,7 +95,7 @@ import { parseTime } from '@/utils'
import userStore from '@/store/modules/user'
const { proxy } = getCurrentInstance()
const isCityManager = ref(userStore().getPromotionIdentity)
const isCityManager = ref(userStore().promotionIdentity)
// 获取路由路径上的 id 参数
const route = useRoute();
const router = useRouter();
......@@ -215,7 +215,7 @@ const clickExamine = async () => {
planStatus: planDetail.value.planStatus === 0 ? '否' : '是',
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: userStore().getEmployeeNo, // 稽查人工号
employeeNo: userStore().employeeNo, // 稽查人工号
})
if (!result.data) {
return proxy.$modal.msgError('创建稽查任务失败')
......
......@@ -153,7 +153,7 @@ import userStore from '@/store/modules/user'
import { parseTime } from '@/utils'
const myForm = ref({})
const { proxy } = getCurrentInstance();
const isCityManager = ref(userStore().getPromotionIdentity)
const isCityManager = ref(userStore().promotionIdentity)
const form = reactive({})
const router = useRouter();
const route = useRoute()
......@@ -197,7 +197,7 @@ const validatorIncidentals = (value, obj) => {
}
}
const onSubmit = async () => {
const data = userStore().getEmployeeInfo
const data = userStore().employeeInfo
for (const key in data) {
form[key] = data[key]
}
......@@ -278,8 +278,8 @@ const getBelongList = async () => {
columns.value = allBelongList.value
// 判断如果是城市经理,则设置默认归属人为自己
if (isCityManager.value) {
form.employeeName = userStore().getEmployeeName
form.employeeNo = userStore().getEmployeeNo
form.employeeName = userStore().employeeName
form.employeeNo = userStore().employeeNo
}
}
getBelongList()
......
<template>
<!-- 搜索组件 -->
<van-popup position="right"
class="wrap">
<!-- 快捷日期 -->
<van-field readonly
label="快捷日期">
<template #input>
<van-button size="small"
type="primary"
v-for="item in pickerOptions"
@click="pickerSelDate(item)">{{ item.text }}</van-button>
</template>
</van-field>
<!-- 日期区间 -->
<van-field :modelValue="searchDateStr"
is-link
readonly
label="日期范围"
placeholder="选择日期"
@click="selSearchCalendar">
</van-field>
<van-calendar v-model:show="showCalendar"
:min-date="searchMinDate"
:show-mark="false"
type="range"
allow-same-day
teleport="body"
:default-date="[query.activityStartDate, query.activityEndDate]"
@confirm="confirmCalendar" />
<!-- 活动类型 -->
<van-field v-model="query.planStatus"
is-link
readonly
label="活动状态"
placeholder="选择活动状态"
@click="showPlanStatus = true">
</van-field>
<van-popup v-model:show="showPlanStatus"
destroy-on-close
teleport="body"
position="bottom">
<van-picker :model-value="[planColumns.find(o => o.text === query.planStatus)?.value]"
:columns="planColumns"
@cancel="showPlanStatus = false"
@confirm="confirmPlan" />
</van-popup>
<!-- 归属人 -->
<van-field :model-value="showEmployeeList.find(o => o.value === query.employeeId)?.text"
is-link
readonly
label="归属人"
placeholder="选择归属人"
:disabled="promotionIdentity"
@click="showEmployee = true">
</van-field>
<PickerSearch v-model:show="showEmployee"
:columns="showEmployeeList"
placeholder="搜索归属人"
@confirm="onEmployeeConfirm"
@search="searchEmployee" />
<!-- 店铺名 -->
<van-field v-model="query.storeNameLike"
label="店铺名"
placeholder="请输入店铺名"
@update:model-value="searchByStoreName"
clearable />
<!-- 重置按钮 -->
<van-button icon="replay"
class="reset-btn"
block
@click="resetFn">重置</van-button>
</van-popup>
</template>
<script setup>
import { parseTime } from '@/utils'
import { useDatePickerOptions } from '@/hooks'
import userStore from '@/store/modules/user'
const promotionIdentity = computed(() => userStore().promotionIdentity)
const employeeNo = computed(() => userStore().employeeNo)
const { recentPickerOptions: pickerOptions } = useDatePickerOptions()
const query = reactive({})
const props = defineProps({
planColumns: { // 活动状态列表
type: Array,
default: []
},
allEmpolyeeList: { // 所有归属人
type: Array,
default: []
}
})
const emits = defineEmits(['query'])
watch(query, () => {
emits('query', query)
}, { deep: true })
// 选择快捷日期
const pickerSelDate = (item) => {
let [startTime, endTime] = item.value() // 拿到日期对象
// 同步更新单独选择日期的选择器和参数
query.activityStartDate = startTime
query.activityEndDate = endTime
}
// 选择日期区间
const showCalendar = ref(false)
const searchDateStr = computed(() => {
if (!query.activityStartDate || !query.activityEndDate) {
return ''
}
return [query.activityStartDate, query.activityEndDate].map(o => parseTime(o, "{y}-{m}-{d}")).join(' 至 ')
})
// 日历最小范围
const searchMinDate = computed(() => {
return new Date(!query.activityStartDate ? new Date().getFullYear() - 1 : query.activityStartDate.getFullYear() - 1, 0, 1)
})
// 日期日历范围
const selSearchCalendar = () => {
// 默认设置今日日期
if (!query.activityStartDate || !query.activityEndDate) {
query.activityStartDate = new Date()
query.activityEndDate = new Date()
}
showCalendar.value = true
}
// 确定日期
const confirmCalendar = (value) => {
showCalendar.value = false
query.activityStartDate = value[0]
query.activityEndDate = value[1]
}
// 活动状态
const showPlanStatus = ref(false)
// 选中的活动状态
const confirmPlan = (val) => {
query.planStatus = val.selectedOptions[0].text
showPlanStatus.value = false
}
// 归属人
const showEmployee = ref(false)
// 展示归属人
const showEmployeeList = ref([])
watch(() => props.allEmpolyeeList, (newValue) => {
showEmployeeList.value = newValue
// 如果是城市经理默认填充
if (promotionIdentity.value) {
// 找到员工的 id
const obj = newValue.find(o => o.employeeNo === employeeNo.value)
query.employeeId = obj.value
}
})
const searchEmployee = (searchName) => {
showEmployeeList.value = props.allEmpolyeeList.filter(item => {
return item.text.includes(searchName)
})
}
// 确定归属人
const onEmployeeConfirm = (val) => {
query.employeeId = val.selectedOptions[0].value
showEmployee.value = false
}
// 店铺名
const searchByStoreName = (val) => {
query.storeNameLike = val
}
// 重置
const resetFn = () => {
query.activityStartDate = ''
query.activityEndDate = ''
query.planStatus = ''
query.employeeId = ''
query.storeNameLike = ''
}
</script>
<style scoped
lang="scss">
.wrap {
--van-field-label-width: 80px;
height: 100vh;
width: 85% !important;
.van-field:first-of-type {
.van-button {
margin: 0 2.5px;
padding: 0 5px;
font-size: 12px !important;
}
}
.van-search {
width: 60%;
}
.reset-btn {
margin-top: 20px;
}
}
</style>
\ No newline at end of file
......@@ -95,11 +95,11 @@ export default defineStore(
},
getters: {
// 获取促销系统身份(true 城市经理)
getPromotionIdentity(state) {
promotionIdentity(state) {
return getPromotionRole(state.userInfo.privilegeId) === CITY_MANAGER
},
// 获取员工工号,姓名,id
getEmployeeInfo(state) {
employeeInfo(state) {
return {
operNo: state.userInfo.userName,
operName: state.userInfo.nickName,
......@@ -107,11 +107,11 @@ export default defineStore(
}
},
// 获取员工工号
getEmployeeNo(state) {
employeeNo(state) {
return state.userInfo.userName
},
// 获取员工姓名
getEmployeeName(state) {
employeeName(state) {
return state.userInfo.nickName
}
}
......
// 把日期对象转成年-月-日前面补0 的数组
/**
* 把日期对象转成年-月-日前面补0 的数组
* @param {*} date 日期对象
* @returns [年,月,日]
* @example 2023-09-01 => [2023, 09, 01]
*/
export function formatDateToArr(date) {
const year = date.getFullYear(); // 获取年份
const month = String(date.getMonth() + 1).padStart(2, '0'); // 获取月份并补零
const day = String(date.getDate()).padStart(2, '0'); // 获取日期并补零
return [year, month, day];
}
/**
* 生成时间列表
* @param {*} startDate 起始时间
......@@ -207,13 +221,3 @@ export function addDateRange(params, dateRange, propName) {
return search;
}
/**
* 生成唯一字符串
* @returns {string}
*/
export function createUniqueString() {
const timestamp = +new Date() + ''
const randomNum = parseInt((1 + Math.random()) * 65536) + ''
return (+(randomNum + timestamp)).toString(32)
}
\ No newline at end of file
......@@ -461,7 +461,7 @@ import { ElMessage, ElMessageBox } from 'element-plus';
import { usePromotionHooks } from '@/hooks'
const { proxy } = getCurrentInstance();
const isCityManager = ref(userStore().getPromotionIdentity)
const isCityManager = ref(userStore().promotionIdentity)
const { recentPickerOptions: pickerOptions } = useDatePickerOptions()
const queryParams = reactive({
......@@ -707,9 +707,9 @@ const getPlanList = async () => {
// 城市经理查自己,职能角色查所有
if (isCityManager.value) {
// 城市经理 (用员工 ID(1,2,3),而不是工号,employeeNo 是工号(000535))
queryParams.employeeId = belongPerList.value.find(item => item.employeeNo === userStore().getEmployeeNo)?.value
queryParams.employeeId = belongPerList.value.find(item => item.employeeNo === userStore().employeeNo)?.value
// 先从归属人查询当前登录用户的战区 ID
queryParams.warzoneId = belongPerList.value.find(item => item.employeeNo === userStore().getEmployeeNo)?.deptQcId
queryParams.warzoneId = belongPerList.value.find(item => item.employeeNo === userStore().employeeNo)?.deptQcId
}
// 日期格式化一下
if (queryParams.activityDate?.length > 0) {
......@@ -811,11 +811,11 @@ const uploadFile = async (file) => {
// 拼接当前月数为文件夹名
const date = new Date()
const month = date.getMonth() + 1
const excelUrl = await uploadFileToOSSAPI(`planExcel/${date.getFullYear()}-${month}/${userStore().getEmployeeNo}/${uuidv4()}.xlsx`, file.file)
const excelUrl = await uploadFileToOSSAPI(`planExcel/${date.getFullYear()}-${month}/${userStore().employeeNo}/${uuidv4()}.xlsx`, file.file)
const targetAPI = isCityManager.value ? addPlanAPI : addPlanByRoleAPI
const res = await targetAPI({
"excelUrl": excelUrl,
"employeeNo": userStore().getEmployeeNo
"employeeNo": userStore().employeeNo
})
planTableList.value = res.data.table
confirmExcelUUID.value = res.data.uuid
......@@ -1061,7 +1061,7 @@ const handleAdd = () => {
resetAddOrEditPlanForm()
// 只有城市经理情况下,默认填充当前登录人为归属人
if (isCityManager.value) {
addOrEditPlanForm.value.employeeNo = userStore().getEmployeeNo
addOrEditPlanForm.value.employeeNo = userStore().employeeNo
}
addOrEditPlanVisible.value = true
}
......@@ -1116,7 +1116,7 @@ const editFn = (row) => {
const handleAddOrEditPlan = async () => {
// 表单校验
await addOrEditPlanRef.value.validate()
addOrEditPlanForm.value.operNo = userStore().getEmployeeNo
addOrEditPlanForm.value.operNo = userStore().employeeNo
addOrEditPlanForm.value.operName = store.state.value.user.userInfo.nickName
addOrEditPlanForm.value.operId = store.state.value.user.userInfo.userId
......@@ -1154,7 +1154,7 @@ const handleDelete = async () => {
})
await deletePlanAPI({
planIds: checkedRowList.value.map(o => o.id),
employeeNo: userStore().getEmployeeNo
employeeNo: userStore().employeeNo
})
ElMessage.success('删除成功')
getPlanList()
......@@ -1221,10 +1221,10 @@ const uploadChangeFile = async (file) => {
// 拼接当前月数为文件夹名
const date = new Date()
const month = date.getMonth() + 1
const excelUrl = await uploadFileToOSSAPI(`planExcel/${date.getFullYear()}-${month}/${userStore().getEmployeeNo}/${uuidv4()}.xlsx`, file.file)
const excelUrl = await uploadFileToOSSAPI(`planExcel/${date.getFullYear()}-${month}/${userStore().employeeNo}/${uuidv4()}.xlsx`, file.file)
const res = await updatePlanAPI({
"excelUrl": excelUrl,
"employeeNo": userStore().getEmployeeNo
"employeeNo": userStore().employeeNo
})
planTableList.value = res.data.table
confirmExcelUUID.value = res.data.uuid
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论