提交 4b922a3a authored 作者: lidongxu's avatar lidongxu

fix(promotion/plan): 新增编辑时,检验所有表单

修复下班时间小时选下一个小时以后,分钟选不了 0 等
上级 b273c54f
......@@ -13,7 +13,7 @@ let downloadLoadingInstance;
export let isRelogin = { show: false };
// 促销系统后台 baseURL
export const promotionBaseURL = import.meta.env.VITE_APP_PROMOTION_BASE_API
export const promotionBaseURL = import.meta.env.VITE_APP_PROMOTION
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
// 创建axios实例
......@@ -31,7 +31,7 @@ service.interceptors.request.use(config => {
// 是否需要防止数据重复提交
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
if (getToken() && !isToken) {
if (config.url.indexOf(promotionBaseURL) >= 0) {
if (config.baseURL === promotionBaseURL) {
// 促销后台不能带 Bearer 前缀
config.headers['Authorization'] = getToken()
} else {
......
......@@ -234,13 +234,14 @@
<el-dialog :title="(addOrEditPlanForm.id ? '修改' : '新增') + '计划'"
v-model="addOrEditPlanVisible"
width="60%">
<!-- 日期表单 -->
<!-- 表单 -->
<el-form :model="addOrEditPlanForm"
label-width="150px"
:rules="addOrEditPlanFormRules"
ref="addOrEditPlanRef"
inline>
<el-row>
<el-col :span="10">
<el-col :span="12">
<!-- 门店列表 -->
<el-form-item label="门店列表"
prop="storeCode">
......@@ -265,11 +266,11 @@
<a class="link"
v-show="isInfoError"
target="_blank"
href="https://cloud.region2.qince.com/sysapp/react/web/main.html#/home" >跳转勤策系统</a>
href="https://cloud.region2.qince.com/sysapp/react/web/main.html#/home">跳转勤策系统</a>
</div>
</el-form-item>
</el-col>
<el-col :span="10">
<el-col :span="12">
<!-- 活动日期 -->
<el-form-item label="活动日期"
prop="date">
......@@ -282,14 +283,15 @@
</el-row>
<el-row>
<!-- 活动模式 -->
<el-col :span="10">
<el-col :span="12">
<el-form-item label="活动模式"
prop="pattern">
<el-select v-model="addOrEditPlanForm.pattern"
placeholder="请选择活动模式"
filterable
clearable
style="width: 95%">
style="width: 95%"
@change="selPattern">
<el-option v-for="item in activityModeList"
:key="item.value"
:label="item.label"
......@@ -297,7 +299,7 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="10">
<el-col :span="12">
<!-- 归属人 -->
<el-form-item label="归属人"
prop="employeeNo">
......@@ -306,7 +308,8 @@
filterable
clearable
style="width: 95%"
:disabled="cityManagerPrivilege">
:disabled="cityManagerPrivilege"
@change="selEmployee">
<el-option v-for="item in managerList"
:key="item.employeeNo"
:label="item.label"
......@@ -316,7 +319,7 @@
</el-col>
</el-row>
<el-row>
<el-col :span="10">
<el-col :span="12">
<!-- 上班打卡时间 -->
<el-form-item label="上班打卡时间"
prop="clockInTime">
......@@ -326,7 +329,7 @@
style="width: 95%" />
</el-form-item>
</el-col>
<el-col :span="10">
<el-col :span="12">
<!-- 下班打卡时间 -->
<el-form-item label="下班打卡时间"
prop="clockOutTime">
......@@ -342,7 +345,7 @@
</el-col>
</el-row>
<el-row>
<el-col :span="10">
<el-col :span="12">
<!-- 工资 -->
<el-form-item label="工资"
prop="salary">
......@@ -351,7 +354,7 @@
placeholder="请输入工资" />
</el-form-item>
</el-col>
<el-col :span="10">
<el-col :span="12">
<!-- 杂费 -->
<el-form-item label="杂费"
prop="incidentals">
......@@ -422,6 +425,8 @@ const getProCity = async () => {
value: item.num
}))
} else {
queryParams.cityId = undefined
cityList.value = []
provinceList.value = data.map(item => ({
label: item.name,
value: item.num
......@@ -430,6 +435,7 @@ const getProCity = async () => {
getPlanList()
}
getProCity()
// 查询经销商列表
const zoneList = ref([])
const getDealerList = async () => {
......@@ -692,7 +698,7 @@ const planTableList = ref([])
const dialogVisible = ref(false)
const confirmExcelUUID = ref('')
const confirmTableColumns = [
{
{
label: '活动 ID',
prop: 'id',
width: 90,
......@@ -824,7 +830,8 @@ const formatterConfirm = (row, col, value) => {
return value
}
}
// 确认计划-保存表格到计划库
const addOrEditPlanRef = ref(null)
// 表格上传计划确认保存
const confirmPlanBtn = async () => {
await savePlanAPI(confirmExcelUUID.value)
ElMessage.success('保存成功')
......@@ -835,8 +842,13 @@ const confirmPlanBtn = async () => {
// 新增/编辑计划
const addOrEditPlanVisible = ref(false)
const addOrEditPlanForm = ref({
})
// 重置表单
const resetAddOrEditPlanForm = () => {
addOrEditPlanForm.value = {}
selecteStoreInfo.value = ''
isInfoError.value = false
}
// 新增/编辑计划-表单验证(所有都是必填项
const addOrEditPlanFormRules = reactive({
storeCode: [
......@@ -915,6 +927,7 @@ const disabledDateFn = (time) => {
}
}
const handleAdd = () => {
resetAddOrEditPlanForm()
addOrEditPlanVisible.value = true
}
const activityModeList = ref([
......@@ -945,8 +958,14 @@ const disabledHours = (h) => {
return makeRange(0, date.getHours() - 1);
}
const disabledMinutes = (h, m) => {
const date = new Date(addOrEditPlanForm.value.clockInTime)
return makeRange(0, date.getMinutes() - 1);
// 如果小时大于上班打卡时间小时,则不限制分钟
const inDate = new Date(addOrEditPlanForm.value.clockInTime)
if (h > inDate.getHours()) {
return makeRange(0, -1);
} else {
const date = new Date(addOrEditPlanForm.value.clockInTime)
return makeRange(0, date.getMinutes() - 1);
}
}
const disabledSeconds = (h, m, s) => {
const date = new Date(addOrEditPlanForm.value.clockInTime)
......@@ -956,12 +975,13 @@ const disabledSeconds = (h, m, s) => {
// 编辑计划
const editFn = (row) => {
addOrEditPlanForm.value = { ...row }
console.log('编辑', addOrEditPlanForm.value)
addOrEditPlanVisible.value = true
}
// 保存新增/编辑计划
const handleAddOrEditPlan = async () => {
// 表单校验
await addOrEditPlanRef.value.validate()
addOrEditPlanForm.value.operNo = store.state.value.user.userInfo.userName
addOrEditPlanForm.value.operName = store.state.value.user.userInfo.nickName
addOrEditPlanForm.value.operId = store.state.value.user.userInfo.userId
......@@ -1034,12 +1054,22 @@ const selStoreInfo = (storeCode) => {
// 门店系统名称、经销商不可为空,请到勤策中修改;
selecteStoreInfo.value = ''
}
// 清除表单验证提示
addOrEditPlanRef.value.clearValidate('storeCode');
}
// 门店搜索
const remoteStoreMethod = (query) => {
addOrEditPlanForm.value.storeName = query
getStoreList()
}
// 新增计划表单-选完以后去掉错误提示
const selPattern = () => {
addOrEditPlanRef.value.clearValidate('pattern');
}
const selEmployee = () => {
addOrEditPlanRef.value.clearValidate('employeeNo');
}
</script>
<style scoped
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论