提交 89f48a93 authored 作者: lidongxu's avatar lidongxu

refactor: 1

上级 903d7d80
...@@ -89,10 +89,7 @@ export function getPlanStoreListAPI(queryParams = {}) { ...@@ -89,10 +89,7 @@ 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: { data: queryParams
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 小时后,不可编辑/删除 // 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)
......
...@@ -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({
storeName storeNameVague: storeName
}) })
columns.value = res.data.map(item => ({ columns.value = res.data.map(item => ({
text: item.storeName, text: item.storeName,
......
...@@ -152,8 +152,7 @@ ...@@ -152,8 +152,7 @@
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"
...@@ -178,8 +177,7 @@ ...@@ -178,8 +177,7 @@
: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>
...@@ -389,7 +387,8 @@ const handleAdd = () => { ...@@ -389,7 +387,8 @@ 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("正在上传数据,请稍后...");
...@@ -410,10 +409,13 @@ const uploadChangeFile = async (file) => { ...@@ -410,10 +409,13 @@ 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
} }
...@@ -426,6 +428,7 @@ const activityModeList = ref(PROMOTION_ACTIVITY_MODE_LIST) // 活动模式 ...@@ -426,6 +428,7 @@ 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
} }
// 表单验证(所有都是必填项) // 表单验证(所有都是必填项)
...@@ -493,8 +496,10 @@ const allStoreList = ref([]) ...@@ -493,8 +496,10 @@ 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({
storeName: addOrEditPlanForm.value.storeName storeNameVague: addOrEditPlanForm.value.storeName,
dealerId: editStoreListByDealerId.value,
}) })
allStoreList.value = data allStoreList.value = data
storeList.value = data.map(item => { storeList.value = data.map(item => {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论