|
|
|
@ -77,7 +77,7 @@ |
|
|
|
<el-dialog v-model="showAdd" width="20vw" draggable align-center style="background-color: rgb(243,250,254);"> |
|
|
|
<div class="add-item"> |
|
|
|
<el-text size="large">活动名称:</el-text> |
|
|
|
<el-input v-model="addForm.activityName" style="width: 12vw" placeholder="请输入活动名称" clearable /> |
|
|
|
<el-input v-model="addForm.activityName" style="width: 12vw" placeholder="请输入活动名称" maxlength="100" clearable /> |
|
|
|
</div> |
|
|
|
<div class="add-item"> |
|
|
|
<el-text size="large">业绩归属:</el-text> |
|
|
|
@ -93,12 +93,12 @@ |
|
|
|
</div> |
|
|
|
<div class="add-item"> |
|
|
|
<el-text size="large">开始时间:</el-text> |
|
|
|
<el-date-picker v-model="addForm.startTime" type="datetime" placeholder="请选择付款时间" |
|
|
|
<el-date-picker v-model="addForm.startTime" type="datetime" placeholder="请选择开始时间" |
|
|
|
:default-time="defaultStartTime" style="width: 12vw" /> |
|
|
|
</div> |
|
|
|
<div class="add-item"> |
|
|
|
<el-text size="large">结束时间:</el-text> |
|
|
|
<el-date-picker v-model="addForm.endTime" type="datetime" placeholder="请选择付款时间" |
|
|
|
<el-date-picker v-model="addForm.endTime" type="datetime" placeholder="请选择结束时间" |
|
|
|
:default-time="defaultEndTime" style="width: 12vw" /> |
|
|
|
</div> |
|
|
|
<div style="display: flex; justify-content: center; margin-top: 5vh;"> |
|
|
|
@ -110,7 +110,7 @@ |
|
|
|
<el-dialog v-model="showEdit" width="20vw" draggable align-center style="background-color: rgb(243,250,254);"> |
|
|
|
<div class="edit-item"> |
|
|
|
<el-text size="large">活动名称:</el-text> |
|
|
|
<el-input v-model="editForm.activityName" style="width: 12vw" placeholder="请输入活动名称" clearable /> |
|
|
|
<el-input v-model="editForm.activityName" style="width: 12vw" placeholder="请输入活动名称" maxlength="100" clearable /> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="edit-item"> |
|
|
|
@ -127,12 +127,12 @@ |
|
|
|
</div> |
|
|
|
<div class="edit-item"> |
|
|
|
<el-text size="large">开始时间:</el-text> |
|
|
|
<el-date-picker v-model="editForm.startTime" type="datetime" placeholder="请选择付款时间" |
|
|
|
<el-date-picker v-model="editForm.startTime" type="datetime" placeholder="请选择开始时间" |
|
|
|
:default-time="defaultStartTime" style="width: 12vw" /> |
|
|
|
</div> |
|
|
|
<div class="edit-item"> |
|
|
|
<el-text size="large">结束时间:</el-text> |
|
|
|
<el-date-picker v-model="editForm.endTime" type="datetime" placeholder="请选择付款时间" |
|
|
|
<el-date-picker v-model="editForm.endTime" type="datetime" placeholder="请选择结束时间" |
|
|
|
:default-time="defaultEndTime" style="width: 12vw" /> |
|
|
|
</div> |
|
|
|
<div style="display: flex; justify-content: center; margin-top: 5vh;"> |
|
|
|
@ -141,8 +141,7 @@ |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<ConfirmDialog v-model="showDel" message="删除该活动数据" @confirm="handleDel()" |
|
|
|
@cancel="hideDel" @close="hideDel" /> |
|
|
|
<ConfirmDialog v-model="showDel" message="删除该活动数据" @confirm="handleDel()" @cancel="hideDel" @close="hideDel" /> |
|
|
|
</template> |
|
|
|
<script setup> |
|
|
|
import { ElMessage, ElPagination } from 'element-plus'; |
|
|
|
@ -156,6 +155,8 @@ const adminStore = useAdminStore(); |
|
|
|
const { adminData, menuTree } = storeToRefs(adminStore) |
|
|
|
import ConfirmDialog from '@/components/dialogs/ConfirmDialog.vue' |
|
|
|
import { add } from 'lodash'; |
|
|
|
// 活动名称正则表达式 |
|
|
|
const activityNameReg = /^[a-zA-Z0-9\u4e00-\u9fa5\u0e00-\u0e7f\uff0c\uff0e\uff01\uff1f\uff0c\uff1b\uff1a\u201c\u201d\u2018\u2019\uff08\uff09\u300a\u300b\u3010\u3011\u2014\uff5e,.,!?:;'"()\[\]_\-&+=\s]{0,100}$/; |
|
|
|
|
|
|
|
const tableData = ref([]) |
|
|
|
const pagination = ref({ |
|
|
|
@ -211,10 +212,9 @@ const getActivity = async function () { |
|
|
|
} |
|
|
|
} |
|
|
|
const handleAdd = async function () { |
|
|
|
if (!addForm.value.activityName) { |
|
|
|
ElMessage.error('请输入活动名称') |
|
|
|
return |
|
|
|
} |
|
|
|
const activityName = addForm.value.activityName |
|
|
|
if (!validateActivityName(activityName)) return |
|
|
|
|
|
|
|
if (!addForm.value.businessBelong) { |
|
|
|
ElMessage.error('请选择业绩归属') |
|
|
|
return |
|
|
|
@ -256,13 +256,16 @@ const handleAdd = async function () { |
|
|
|
startTime: null, |
|
|
|
endTime: null, |
|
|
|
} |
|
|
|
} else{ |
|
|
|
} else { |
|
|
|
ElMessage.error(res.msg || '添加失败') |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const handleEdit = async function () { |
|
|
|
const activityName = editForm.value.activityName |
|
|
|
if (!validateActivityName(activityName)) return |
|
|
|
|
|
|
|
if (!editForm.value.activityName) { |
|
|
|
ElMessage.error('请输入活动名称') |
|
|
|
return |
|
|
|
@ -408,6 +411,25 @@ const hideAdd = () => { |
|
|
|
endTime: null |
|
|
|
} |
|
|
|
} |
|
|
|
const validateActivityName = (name) => { |
|
|
|
// 非空校验 |
|
|
|
if (!name.trim()) { |
|
|
|
ElMessage.error('活动名称不能为空'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
// 长度校验(限制100字符) |
|
|
|
if (name.length > 100) { |
|
|
|
ElMessage.error('活动名称长度不能超过100字符'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
// 字符格式校验 |
|
|
|
if (!activityNameReg.test(name)) { |
|
|
|
ElMessage.error('活动名称仅支持汉字、英文字母、泰语、数字及常见标点'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
}; |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
getActivity() |
|
|
|
getmarkets() |
|
|
|
|