Commit 21fcad83 by qinjianhui

fix: 排单开关状态代码修改

parent 984e319f
......@@ -24,7 +24,7 @@ export function updateRuleByIdApi(data: PostData) {
}
// 规则开关
export function ruleSwitchApi(data: PostData) {
export function ruleSwitchApi(data: { id: number; status: string }) {
return axios.post<never, BasePaginationData<never>>(
'factory/podJomallOrderUsArrangeRule/ruleSwitch',
data,
......
......@@ -18,13 +18,12 @@
<div class="box">每天{{ getTime(item) }}开始自动排单</div>
</div>
<div class="action">
<div style="display: flex;align-items: center;gap: 2px;">
<div style="display: flex; align-items: center; gap: 2px">
<div>状态:</div>
<el-switch
v-model="item.status"
@change="(val:string) => ruleSwitch(item.id || 0, val)"
active-value='ACTIVE'
inactive-value='INACTIVE'
active-value="ACTIVE"
inactive-value="INACTIVE"
active-text="开"
inactive-text="关"
inline-prompt
......@@ -33,6 +32,7 @@
--el-switch-on-color: #42b983;
--el-switch-off-color: #f56c6c;
"
@change="(val:string) => ruleSwitch(item.id, val)"
/>
</div>
<el-icon
......@@ -197,13 +197,11 @@
/>
</div>
<div style="display: flex; align-items: center">
<div style="color: #606266; margin-right: 10px">
状态:
</div>
<div style="color: #606266; margin-right: 10px">状态:</div>
<el-switch
v-model="editForm.status"
active-value='ACTIVE'
inactive-value='INACTIVE'
active-value="ACTIVE"
inactive-value="INACTIVE"
active-text="开"
inactive-text="关"
inline-prompt
......@@ -469,18 +467,14 @@ const changeSwitch = () => {
editForm.value.templateWidth = undefined
}
const ruleSwitch = async (id: number, status: string) => {
if(id === 0){
const ruleSwitch = async (id: number | undefined, status: string) => {
if (!id) {
return
}
try {
const params = {
id: id,
status: status,
}
const res = await ruleSwitchApi({
...params,
id,
status,
})
ElMessage({
message: res.message,
......@@ -489,6 +483,7 @@ const ruleSwitch = async (id: number, status: string) => {
})
getList()
} catch (e) {
console.error(e)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment