Commit 984e319f by sunyang

us排版开关

parent 5dac4fdb
......@@ -23,6 +23,14 @@ export function updateRuleByIdApi(data: PostData) {
)
}
// 规则开关
export function ruleSwitchApi(data: PostData) {
return axios.post<never, BasePaginationData<never>>(
'factory/podJomallOrderUsArrangeRule/ruleSwitch',
data,
)
}
// us规则列表
export function getByFactoryNoApi(data: { factoryNo: number }) {
return axios.get<never, BaseRespData<never>>(
......
......@@ -17,8 +17,24 @@
<div class="box">批次数量:{{ item.arrangeMax }}</div>
<div class="box">每天{{ getTime(item) }}开始自动排单</div>
</div>
<div class="action">
<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-text="开"
inactive-text="关"
inline-prompt
class="ml-2"
style="
--el-switch-on-color: #42b983;
--el-switch-off-color: #f56c6c;
"
/>
</div>
<el-icon
size="24"
title="编辑"
......@@ -180,6 +196,24 @@
"
/>
</div>
<div style="display: flex; align-items: center">
<div style="color: #606266; margin-right: 10px">
状态:
</div>
<el-switch
v-model="editForm.status"
active-value='ACTIVE'
inactive-value='INACTIVE'
active-text="开"
inactive-text="关"
inline-prompt
class="ml-2"
style="
--el-switch-on-color: #42b983;
--el-switch-off-color: #f56c6c;
"
/>
</div>
<div v-if="editForm.isAuto">
<div label="排版类型:">
<el-radio-group v-model="editForm.type">
......@@ -215,6 +249,7 @@ import {
usArrangeRuleApi,
getByFactoryNoApi,
updateRuleByIdApi,
ruleSwitchApi,
} from '@/api/podUsSchedulingRules.ts'
import { Plus, Minus } from '@element-plus/icons-vue'
......@@ -223,7 +258,7 @@ import CustomizeForm from '@/components/CustomizeForm.tsx'
import { Edit } from '@element-plus/icons-vue'
import { debounce } from 'lodash-es'
const editForm = ref<BaseForm>({ isAuto: false })
const editForm = ref<BaseForm>({ isAuto: false, status: 'ACTIVE' })
const tableData = ref([])
import userUserStore from '@/store/user'
const userStore = userUserStore()
......@@ -311,6 +346,7 @@ interface BaseForm {
hour?: string | number
minute?: string | number
second?: string | number
status?: string
}
type ParamKey = `param${number}`
type ParamValue = string | number | boolean | null | undefined
......@@ -433,6 +469,29 @@ const changeSwitch = () => {
editForm.value.templateWidth = undefined
}
const ruleSwitch = async (id: number, status: string) => {
if(id === 0){
return
}
try {
const params = {
id: id,
status: status,
}
const res = await ruleSwitchApi({
...params,
})
ElMessage({
message: res.message,
type: 'success',
offset: window.innerHeight / 2,
})
getList()
} catch (e) {
}
}
const padTimeUnit = (value: string | number): string => {
const num = Number(value)
// 若转换后是 NaN(无效值),或原始值不存在(null/undefined/''),均返回 '00'
......@@ -513,6 +572,9 @@ const getTime = (item: BaseForm) => {
}
.action {
display: flex;
align-items: center;
gap: 100px;
.iconView {
}
}
......
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