完善生产异常维修与备件管理功能
This commit is contained in:
@@ -394,16 +394,21 @@ export interface ProduceRepairRecordRow {
|
||||
product_name?: string | null;
|
||||
category_id?: string | number | null;
|
||||
category_name?: string | null;
|
||||
category_ids?: Array<string | number> | string | null;
|
||||
category_names?: string[] | string | null;
|
||||
fault_description_id?: string | number | null;
|
||||
fault_description_ids?: Array<string | number>;
|
||||
fault_description?: string | null;
|
||||
fault_descriptions?: string[];
|
||||
repair_result?: string | null;
|
||||
parts?: Array<Record<string, any>> | string | null;
|
||||
images?: string[] | string | null;
|
||||
operation_fault_steps?: Array<Record<string, any>> | string | null;
|
||||
responsible_operators?: Array<Record<string, any>> | string | null;
|
||||
operator?: string | null;
|
||||
repaired_at?: number | null;
|
||||
repaired_date?: string | null;
|
||||
repair_result_name?: string;
|
||||
remark?: string | null;
|
||||
created_date?: string;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,12 @@ const settingList = ref([
|
||||
name: '基础设置',
|
||||
loadKey: 0
|
||||
},
|
||||
{
|
||||
component: markRaw(defineAsyncComponent(() => import('./modules/repair-flow.vue'))),
|
||||
key: 'repair-flow',
|
||||
name: '维修流程',
|
||||
loadKey: 0
|
||||
},
|
||||
{
|
||||
component: markRaw(defineAsyncComponent(() => import('./modules/step-rule.vue'))),
|
||||
key: 'step-rule',
|
||||
|
||||
@@ -122,7 +122,7 @@ const [BasicForm, formApi] = useForm({
|
||||
class: 'w-full'
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
prop: 'recent_records_today_only',
|
||||
label: '最近记录只显示当日',
|
||||
component: 'RadioGroup',
|
||||
@@ -133,6 +133,54 @@ const [BasicForm, formApi] = useForm({
|
||||
{ label: '否', value: 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'exception_process_id',
|
||||
label: '异常提报工序',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: '/produce/process',
|
||||
requestMethod: 'get',
|
||||
params: { format: 'select' },
|
||||
clearable: true,
|
||||
placeholder: '请选择异常提报对应工序',
|
||||
},
|
||||
},
|
||||
{
|
||||
prop: 'exception_step_id',
|
||||
label: '异常提报步骤',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: '/produce/process-step',
|
||||
requestMethod: 'get',
|
||||
params: { format: 'select' },
|
||||
clearable: true,
|
||||
placeholder: '请选择异常提报对应步骤',
|
||||
},
|
||||
},
|
||||
{
|
||||
prop: 'repair_process_id',
|
||||
label: '维修记录工序',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: '/produce/process',
|
||||
requestMethod: 'get',
|
||||
params: { format: 'select' },
|
||||
clearable: true,
|
||||
placeholder: '请选择维修记录对应工序',
|
||||
},
|
||||
},
|
||||
{
|
||||
prop: 'repair_step_id',
|
||||
label: '维修记录步骤',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: '/produce/process-step',
|
||||
requestMethod: 'get',
|
||||
params: { format: 'select' },
|
||||
clearable: true,
|
||||
placeholder: '请选择维修记录对应步骤',
|
||||
},
|
||||
}
|
||||
]
|
||||
})
|
||||
@@ -156,7 +204,11 @@ async function onSubmit() {
|
||||
{ code: 'product_code_max_length', name: '商品编码最大长度', content: values.product_code_max_length ?? 20 },
|
||||
{ code: 'global_allow_repeat', name: '全局允许重复', content: Number(values.global_allow_repeat ?? 0) },
|
||||
{ code: 'repeat_scan_interval', name: '重复扫码最小间隔', content: values.repeat_scan_interval ?? 0 },
|
||||
{ code: 'recent_records_today_only', name: '最近记录只显示当日', content: Number(values.recent_records_today_only ?? 1) }
|
||||
{ code: 'recent_records_today_only', name: '最近记录只显示当日', content: Number(values.recent_records_today_only ?? 1) },
|
||||
{ code: 'exception_process_id', name: '异常提报工序', content: values.exception_process_id ?? '' },
|
||||
{ code: 'exception_step_id', name: '异常提报步骤', content: values.exception_step_id ?? '' },
|
||||
{ code: 'repair_process_id', name: '维修记录工序', content: values.repair_process_id ?? '' },
|
||||
{ code: 'repair_step_id', name: '维修记录步骤', content: values.repair_step_id ?? '' }
|
||||
]
|
||||
})
|
||||
ElMessage.success('保存成功')
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<div class="repair-flow-page">
|
||||
<BasicForm />
|
||||
<el-button class="site-submit" type="primary" :loading="saving" @click="onSubmit">保存配置</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="tsx">
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { useForm } from '@/components/form'
|
||||
import { ProduceConfigApi } from '@/apps/produce/api'
|
||||
|
||||
const saving = ref(false)
|
||||
const [BasicForm, formApi] = useForm({
|
||||
labelPosition: 'right',
|
||||
labelWidth: '160px',
|
||||
inline: false,
|
||||
schema: [
|
||||
{
|
||||
prop: 'repair_process_id',
|
||||
label: '维修流程工序',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: '/produce/process',
|
||||
requestMethod: 'get',
|
||||
params: { format: 'select' },
|
||||
clearable: true,
|
||||
placeholder: '请选择维修流程对应工序',
|
||||
},
|
||||
},
|
||||
{
|
||||
prop: 'repair_step_id',
|
||||
label: '维修流程步骤',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: '/produce/process-step',
|
||||
requestMethod: 'get',
|
||||
params: { format: 'select' },
|
||||
clearable: true,
|
||||
placeholder: '请选择维修流程对应步骤',
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
const loadConfig = async () => {
|
||||
const current = await ProduceConfigApi.info({ group_code: 'repair_flow' }) as Record<string, any>
|
||||
if (current?.repair_process_id || current?.repair_step_id) {
|
||||
await formApi.setValues(current)
|
||||
return
|
||||
}
|
||||
const legacy = await ProduceConfigApi.info({ group_code: 'basic_setting' }) as Record<string, any>
|
||||
await formApi.setValues({
|
||||
repair_process_id: legacy?.repair_process_id || '',
|
||||
repair_step_id: legacy?.repair_step_id || '',
|
||||
})
|
||||
}
|
||||
|
||||
const onSubmit = async () => {
|
||||
if (saving.value) return
|
||||
saving.value = true
|
||||
try {
|
||||
const values = await formApi.getValues()
|
||||
await ProduceConfigApi.save({
|
||||
group_code: 'repair_flow',
|
||||
configs: [
|
||||
{ code: 'repair_process_id', name: '维修流程工序', content: values.repair_process_id ?? '' },
|
||||
{ code: 'repair_step_id', name: '维修流程步骤', content: values.repair_step_id ?? '' },
|
||||
],
|
||||
})
|
||||
ElMessage.success('保存成功')
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void loadConfig()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.site-submit {
|
||||
margin-left: 160px;
|
||||
}
|
||||
</style>
|
||||
@@ -25,7 +25,7 @@ export const crudSchema = (): CrudSchema => ({
|
||||
labelWidth: '90px',
|
||||
schema: [
|
||||
{ prop: 'keyword', label: '关键字', component: 'Input', componentProps: { clearable: true, placeholder: '商品编码或商品名称' }, colSpan: 8 },
|
||||
{ prop: 'category_id', label: '物料分类', component: 'ApiSelect', componentProps: { api: ProduceMaterialService.categoryOptions, labelField: 'category_name', valueField: 'id', clearable: true, placeholder: '请选择分类' }, colSpan: 8 },
|
||||
{ prop: 'category_id', label: '物料分类', component: 'ApiSelect', componentProps: { api: ProduceMaterialService.categoryOptions, labelField: 'label', valueField: 'value', clearable: true, placeholder: '请选择分类' }, colSpan: 8 },
|
||||
],
|
||||
},
|
||||
columns: [
|
||||
@@ -42,7 +42,7 @@ export const crudSchema = (): CrudSchema => ({
|
||||
labelWidth: '90px',
|
||||
schema: [
|
||||
{ component: 'Input', show: false, ifDetail: true, colSpan: 24, prop: 'id', label: 'ID' },
|
||||
{ component: 'ApiSelect', prop: 'category_id', label: '物料分类', componentProps: { api: ProduceMaterialService.categoryOptions, labelField: 'category_name', valueField: 'id', clearable: true, placeholder: '请选择分类' }, rules: [{ required: true, message: '请选择物料分类' }], colSpan: 12 },
|
||||
{ component: 'ApiSelect', prop: 'category_id', label: '物料分类', componentProps: { api: ProduceMaterialService.categoryOptions, labelField: 'label', valueField: 'value', clearable: true, placeholder: '请选择分类' }, rules: [{ required: true, message: '请选择物料分类' }], colSpan: 12 },
|
||||
{ component: 'Input', prop: 'product_code', label: '商品编码', componentProps: { maxlength: 100, placeholder: '请输入或扫描商品编码' }, rules: [{ required: true, message: '请输入商品编码' }], colSpan: 12 },
|
||||
{ component: 'Input', prop: 'product_name', label: '商品名称', componentProps: { maxlength: 200, placeholder: '请输入商品名称' }, rules: [{ required: true, message: '请输入商品名称' }], colSpan: 24 },
|
||||
],
|
||||
|
||||
@@ -297,7 +297,6 @@ export const crudSchema = (): CrudSchema => ({
|
||||
prop: "id",
|
||||
label: "ID",
|
||||
show: false,
|
||||
ifDetail: true,
|
||||
colSpan: 24,
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user