Commit 21fcad83 by qinjianhui

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

parent 984e319f
...@@ -24,7 +24,7 @@ export function updateRuleByIdApi(data: PostData) { ...@@ -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>>( return axios.post<never, BasePaginationData<never>>(
'factory/podJomallOrderUsArrangeRule/ruleSwitch', 'factory/podJomallOrderUsArrangeRule/ruleSwitch',
data, data,
......
...@@ -18,13 +18,12 @@ ...@@ -18,13 +18,12 @@
<div class="box">每天{{ getTime(item) }}开始自动排单</div> <div class="box">每天{{ getTime(item) }}开始自动排单</div>
</div> </div>
<div class="action"> <div class="action">
<div style="display: flex;align-items: center;gap: 2px;"> <div style="display: flex; align-items: center; gap: 2px">
<div>状态:</div> <div>状态:</div>
<el-switch <el-switch
v-model="item.status" v-model="item.status"
@change="(val:string) => ruleSwitch(item.id || 0, val)" active-value="ACTIVE"
active-value='ACTIVE' inactive-value="INACTIVE"
inactive-value='INACTIVE'
active-text="开" active-text="开"
inactive-text="关" inactive-text="关"
inline-prompt inline-prompt
...@@ -33,8 +32,9 @@ ...@@ -33,8 +32,9 @@
--el-switch-on-color: #42b983; --el-switch-on-color: #42b983;
--el-switch-off-color: #f56c6c; --el-switch-off-color: #f56c6c;
" "
@change="(val:string) => ruleSwitch(item.id, val)"
/> />
</div> </div>
<el-icon <el-icon
size="24" size="24"
title="编辑" title="编辑"
...@@ -197,22 +197,20 @@ ...@@ -197,22 +197,20 @@
/> />
</div> </div>
<div style="display: flex; align-items: center"> <div style="display: flex; align-items: center">
<div style="color: #606266; margin-right: 10px"> <div style="color: #606266; margin-right: 10px">状态:</div>
状态: <el-switch
</div> v-model="editForm.status"
<el-switch active-value="ACTIVE"
v-model="editForm.status" inactive-value="INACTIVE"
active-value='ACTIVE' active-text="开"
inactive-value='INACTIVE' inactive-text="关"
active-text="开" inline-prompt
inactive-text="关" class="ml-2"
inline-prompt style="
class="ml-2" --el-switch-on-color: #42b983;
style=" --el-switch-off-color: #f56c6c;
--el-switch-on-color: #42b983; "
--el-switch-off-color: #f56c6c; />
"
/>
</div> </div>
<div v-if="editForm.isAuto"> <div v-if="editForm.isAuto">
<div label="排版类型:"> <div label="排版类型:">
...@@ -469,19 +467,15 @@ const changeSwitch = () => { ...@@ -469,19 +467,15 @@ const changeSwitch = () => {
editForm.value.templateWidth = undefined editForm.value.templateWidth = undefined
} }
const ruleSwitch = async (id: number, status: string) => { const ruleSwitch = async (id: number | undefined, status: string) => {
if(id === 0){ if (!id) {
return return
} }
try { try {
const res = await ruleSwitchApi({
const params = { id,
id: id, status,
status: status, })
}
const res = await ruleSwitchApi({
...params,
})
ElMessage({ ElMessage({
message: res.message, message: res.message,
type: 'success', type: 'success',
...@@ -489,6 +483,7 @@ const ruleSwitch = async (id: number, status: string) => { ...@@ -489,6 +483,7 @@ const ruleSwitch = async (id: number, status: string) => {
}) })
getList() getList()
} catch (e) { } 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