提交
This commit is contained in:
1 parent
5e91791ebf
commit
912ada02eb
36 files changed
+3353
-3471
No files matched your search
@@ -1,4 +1,4 @@
|
||||
<!-- 工单备注编辑(入库/临时生产、入库质检) -->
|
||||
<!-- 工单编辑(备注;质检工单可选工单状态) -->
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
@@ -11,16 +11,28 @@
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form label-position="top" class="biz-dialog-form">
|
||||
<el-form-item label="备注">
|
||||
<el-input
|
||||
v-model="remark"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
placeholder="选填"
|
||||
maxlength="512"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<div class="form-grid-2">
|
||||
<el-form-item v-if="showWorkOrderStatus" label="工单状态" class="form-col-span-2">
|
||||
<el-select v-model="workOrderStatus" placeholder="请选择" style="width: 100%">
|
||||
<el-option
|
||||
v-for="opt in workOrderStatusOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" class="form-col-span-2">
|
||||
<el-input
|
||||
v-model="remark"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
placeholder="选填"
|
||||
maxlength="512"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button class="btn-ghost" @click="handleClose"
|
||||
@@ -36,24 +48,34 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue'
|
||||
import { Close, Check } from '@element-plus/icons-vue'
|
||||
import { workOrderStatus as workOrderStatusRegistry, workOrderStatusLabel } from '@/utils/status-tag-registry'
|
||||
|
||||
export type WorkOrderRemarkSubmitPayload = {
|
||||
remark: string
|
||||
workOrderStatus?: string
|
||||
}
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
visible: boolean
|
||||
title?: string
|
||||
initialRemark?: string
|
||||
initialWorkOrderStatus?: string
|
||||
showWorkOrderStatus?: boolean
|
||||
submitting?: boolean
|
||||
}>(),
|
||||
{
|
||||
title: '编辑备注',
|
||||
initialRemark: '',
|
||||
initialWorkOrderStatus: '',
|
||||
showWorkOrderStatus: false,
|
||||
submitting: false
|
||||
}
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:visible', val: boolean): void
|
||||
(e: 'submit', remark: string): void
|
||||
(e: 'submit', payload: WorkOrderRemarkSubmitPayload): void
|
||||
}>()
|
||||
|
||||
const dialogVisible = computed({
|
||||
@@ -62,13 +84,27 @@
|
||||
})
|
||||
|
||||
const remark = ref('')
|
||||
const workOrderStatus = ref('')
|
||||
|
||||
const workOrderStatusOptions = computed(() =>
|
||||
Object.keys(workOrderStatusRegistry).map((value) => ({
|
||||
value,
|
||||
label: workOrderStatusLabel(value)
|
||||
}))
|
||||
)
|
||||
|
||||
function handleClose() {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
|
||||
function handleSubmit() {
|
||||
emit('submit', remark.value.trim())
|
||||
const payload: WorkOrderRemarkSubmitPayload = {
|
||||
remark: remark.value.trim()
|
||||
}
|
||||
if (props.showWorkOrderStatus) {
|
||||
payload.workOrderStatus = workOrderStatus.value
|
||||
}
|
||||
emit('submit', payload)
|
||||
}
|
||||
|
||||
watch(
|
||||
@@ -76,6 +112,7 @@
|
||||
(val) => {
|
||||
if (val) {
|
||||
remark.value = props.initialRemark || ''
|
||||
workOrderStatus.value = props.initialWorkOrderStatus || ''
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user