提交 3e263fa4 authored 作者: lidongxu's avatar lidongxu

refactor(all): 尝试把新改代码合过来

上级 89f48a93
...@@ -89,7 +89,10 @@ export function getPlanStoreListAPI(queryParams = {}) { ...@@ -89,7 +89,10 @@ export function getPlanStoreListAPI(queryParams = {}) {
baseURL: VITE_APP_PROMOTION, baseURL: VITE_APP_PROMOTION,
url: '/user/clientele/query/store/list', url: '/user/clientele/query/store/list',
method: 'POST', method: 'POST',
data: queryParams data: {
storeNameVague: queryParams.storeName,
storeCode: queryParams.storeCode,
}
}) })
} }
......
import { parseTime } from '@/utils' import { parseTime } from '@/utils'
/** /**
* 判断计划是否可变更/删除 * 判断计划是否可编辑/删除
* @param {*} row 计划信息对象 * @param {*} row 计划信息对象
* @returns boolean true 可变更/删除,false 不可变更/删除 * @returns boolean true 可编辑/删除,false 不可编辑/删除
*/ */
export const checkPlanExpire = (row) => { export const checkPlanExpire = (row) => {
// 1. 计划已经开始,不可变更/删除 // 1. 计划已经开始,不可编辑/删除
// 2. 计划未开始,但是上班时间已经 1 小时后,不可变更/删除 if (row.planStatus === 0) {
return false
}
// 2. 计划未开始,但是上班时间已经 1 小时后,不可编辑/删除
const date = new Date() const date = new Date()
const rowDate = new Date(row.clockInTime) const rowDate = new Date(row.clockInTime)
rowDate.setHours(rowDate.getHours() + 1) rowDate.setHours(rowDate.getHours() + 1)
return !(rowDate < date || row.planStatus === 1) if (row.planStatus === 1 && rowDate < date) {
return false
}
// 3. 计划为 2 和 3(审核中/审核拒绝),不可编辑/删除
if (row.planStatus === 2 || row.planStatus === 3) {
return false
}
} }
/** /**
......
...@@ -241,7 +241,7 @@ const selStoreName = async () => { ...@@ -241,7 +241,7 @@ const selStoreName = async () => {
// 获取门店列表 // 获取门店列表
const getStoreList = async (storeName) => { const getStoreList = async (storeName) => {
const res = await getPlanStoreListAPI({ const res = await getPlanStoreListAPI({
storeNameVague: storeName storeName
}) })
columns.value = res.data.map(item => ({ columns.value = res.data.map(item => ({
text: item.storeName, text: item.storeName,
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
link link
:disabled="!selectableFn(scope.row)" :disabled="!selectableFn(scope.row)"
@click="editFn(scope.row)"> @click="editFn(scope.row)">
变更 编辑
</el-button> </el-button>
<el-button type="danger" <el-button type="danger"
link link
...@@ -152,7 +152,8 @@ ...@@ -152,7 +152,8 @@
clearable clearable
@change="selStoreInfo" @change="selStoreInfo"
remote remote
:remote-method="remoteStoreMethod"> :remote-method="remoteStoreMethod"
:disabled="!!addOrEditPlanForm.id">
<el-option v-for="item in storeList" <el-option v-for="item in storeList"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
...@@ -177,7 +178,8 @@ ...@@ -177,7 +178,8 @@
:clearable="false" :clearable="false"
start-placeholder="活动日期" start-placeholder="活动日期"
value-format="YYYY-MM-DDTHH:mm:ss" value-format="YYYY-MM-DDTHH:mm:ss"
:disabled-date="disabledDateFn" /> :disabled-date="disabledDateFn"
:disabled="!!addOrEditPlanForm.id" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -387,8 +389,7 @@ const handleAdd = () => { ...@@ -387,8 +389,7 @@ const handleAdd = () => {
addOrEditPlanVisible.value = true addOrEditPlanVisible.value = true
} }
/*************** 变更计划 ***************/ /*************** 修改计划 ***************/
const editStoreListByDealerId = ref(null)
// 批量 // 批量
const uploadChangeFile = async (file) => { const uploadChangeFile = async (file) => {
proxy.$modal.loading("正在上传数据,请稍后..."); proxy.$modal.loading("正在上传数据,请稍后...");
...@@ -409,18 +410,15 @@ const uploadChangeFile = async (file) => { ...@@ -409,18 +410,15 @@ const uploadChangeFile = async (file) => {
// 单条 // 单条
const editFn = (row) => { const editFn = (row) => {
addOrEditPlanForm.value = { addOrEditPlanForm.value = {
...row, ...row,
inTime: parseTime(row.clockInTime, "{h}:{i}:{s}"), inTime: parseTime(row.clockInTime, "{h}:{i}:{s}"),
outTime: parseTime(row.clockOutTime, "{h}:{i}:{s}") outTime: parseTime(row.clockOutTime, "{h}:{i}:{s}")
} }
// 重新搜索符合经销商 ID 的门店列表
editStoreListByDealerId.value = row.dealerId
getStoreList()
addOrEditPlanVisible.value = true addOrEditPlanVisible.value = true
} }
/*************** 新增/改计划弹框 ***************/ /*************** 新增/改计划弹框 ***************/
// 新增/更改计划表单弹框 // 新增/编辑计划表单弹框
const addOrEditPlanVisible = ref(false) const addOrEditPlanVisible = ref(false)
const addOrEditPlanForm = ref({}) const addOrEditPlanForm = ref({})
const activityModeList = ref(PROMOTION_ACTIVITY_MODE_LIST) // 活动模式 const activityModeList = ref(PROMOTION_ACTIVITY_MODE_LIST) // 活动模式
...@@ -428,7 +426,6 @@ const activityModeList = ref(PROMOTION_ACTIVITY_MODE_LIST) // 活动模式 ...@@ -428,7 +426,6 @@ const activityModeList = ref(PROMOTION_ACTIVITY_MODE_LIST) // 活动模式
const resetAddOrEditPlanForm = () => { const resetAddOrEditPlanForm = () => {
addOrEditPlanForm.value = {} addOrEditPlanForm.value = {}
selecteStoreInfo.value = '' selecteStoreInfo.value = ''
editStoreListByDealerId.value = null
isInfoError.value = false isInfoError.value = false
} }
// 表单验证(所有都是必填项) // 表单验证(所有都是必填项)
...@@ -496,10 +493,8 @@ const allStoreList = ref([]) ...@@ -496,10 +493,8 @@ const allStoreList = ref([])
const selecteStoreInfo = ref('') const selecteStoreInfo = ref('')
const isInfoError = ref(false) const isInfoError = ref(false)
const getStoreList = async () => { const getStoreList = async () => {
console.log(editStoreListByDealerId, 'editStoreListByDealerId')
const { data } = await getPlanStoreListAPI({ const { data } = await getPlanStoreListAPI({
storeNameVague: addOrEditPlanForm.value.storeName, storeName: addOrEditPlanForm.value.storeName
dealerId: editStoreListByDealerId.value,
}) })
allStoreList.value = data allStoreList.value = data
storeList.value = data.map(item => { storeList.value = data.map(item => {
...@@ -592,7 +587,7 @@ const selEmployee = () => { ...@@ -592,7 +587,7 @@ const selEmployee = () => {
} }
// 保存新增/更改计划 // 保存新增/编辑计划
const handleAddOrEditPlan = async () => { const handleAddOrEditPlan = async () => {
// 表单校验 // 表单校验
await proxy.$refs.addOrEditPlanRef.validate() await proxy.$refs.addOrEditPlanRef.validate()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论