|
|
@@ -143,7 +143,7 @@
|
|
|
@click="openDelayReasonDialog(scope.row)"
|
|
|
v-hasPermi="['pms:iot-main-work-order:update']"
|
|
|
>
|
|
|
- {{ t('workOrderMaterial.delayReason') || '延保原因' }}
|
|
|
+ {{ t('mainPlan.delayed') || '延时' }}
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
link
|
|
|
@@ -181,17 +181,18 @@
|
|
|
<!-- 延保原因弹窗 -->
|
|
|
<el-dialog
|
|
|
v-model="delayReasonDialogVisible"
|
|
|
- :title="t('workOrderMaterial.delayReason') || '延保原因'"
|
|
|
+ :title="t('workOrderMaterial.delayReason') || '延时原因'"
|
|
|
width="500px"
|
|
|
:close-on-click-modal="false"
|
|
|
>
|
|
|
- <el-form :model="delayReasonForm" label-width="80px">
|
|
|
- <el-form-item :label="t('workOrderMaterial.delayReason') || '延保原因'">
|
|
|
+ <el-form :model="delayReasonForm" label-width="0px" :rules="delayReasonRules"
|
|
|
+ ref="delayReasonFormRef">
|
|
|
+ <el-form-item label=" " prop="delayReason" class="required-item" label-width="16px">
|
|
|
<el-input
|
|
|
v-model="delayReasonForm.delayReason"
|
|
|
type="textarea"
|
|
|
:rows="4"
|
|
|
- :placeholder="t('workOrderMaterial.inputDelayReason') || '请输入延保原因'"
|
|
|
+ :placeholder="t('workOrderMaterial.inputDelayReason') || '请输入延时原因'"
|
|
|
maxlength="500"
|
|
|
show-word-limit
|
|
|
/>
|
|
|
@@ -221,6 +222,9 @@ const { push } = useRouter() // 路由跳转
|
|
|
/** 保养工单 列表 */
|
|
|
defineOptions({ name: 'IotMainWorkOrder' })
|
|
|
|
|
|
+// 表单引用
|
|
|
+const delayReasonFormRef = ref<InstanceType<typeof ElForm>>()
|
|
|
+
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
const { t } = useI18n() // 国际化
|
|
|
const tableRef = ref() // 表格引用
|
|
|
@@ -258,6 +262,13 @@ const queryFormRef = ref() // 搜索的表单
|
|
|
const exportLoading = ref(false) // 导出的加载中
|
|
|
const hoverText = ref('');
|
|
|
|
|
|
+// 定义表单验证规则
|
|
|
+const delayReasonRules = {
|
|
|
+ delayReason: [
|
|
|
+ { required: true, message: t('workOrderMaterial.inputDelayReason') || '请输入延时原因', trigger: 'blur' }
|
|
|
+ ]
|
|
|
+}
|
|
|
+
|
|
|
// 列宽度配置
|
|
|
const columnWidths = ref({
|
|
|
serial: '80px',
|
|
|
@@ -321,6 +332,11 @@ const openDelayReasonDialog = (row: IotMainWorkOrderVO) => {
|
|
|
|
|
|
/** 保存延保原因 */
|
|
|
const saveDelayReason = async () => {
|
|
|
+ // 表单验证
|
|
|
+ if (!delayReasonFormRef.value) return
|
|
|
+ const valid = await delayReasonFormRef.value.validate()
|
|
|
+ if (!valid) return
|
|
|
+
|
|
|
if (!delayReasonForm.id) {
|
|
|
message.error('ID不能为空')
|
|
|
return
|
|
|
@@ -334,14 +350,14 @@ const saveDelayReason = async () => {
|
|
|
delayReason: delayReasonForm.delayReason
|
|
|
})
|
|
|
|
|
|
- message.success(t('common.saveSuccess') || '保存成功')
|
|
|
+ message.success(t('common.success') || '保存成功')
|
|
|
delayReasonDialogVisible.value = false
|
|
|
|
|
|
// 刷新列表数据
|
|
|
await getList()
|
|
|
} catch (error) {
|
|
|
console.error('保存延保原因失败:', error)
|
|
|
- message.error(t('common.saveFailed') || '保存失败')
|
|
|
+ message.error(t('sys.api.operationFailed') || '保存失败')
|
|
|
} finally {
|
|
|
saveDelayReasonLoading.value = false
|
|
|
}
|
|
|
@@ -413,8 +429,8 @@ const calculateColumnWidths = () => {
|
|
|
calculateColumnMinWidth('updateTime', t('dict.fillTime'), (row: any) => row.result == 2 ? formatCellDate(row.updateTime) : '');
|
|
|
|
|
|
// 操作列固定宽度
|
|
|
- minWidths.operation = 200;
|
|
|
- totalMinWidth += 200;
|
|
|
+ minWidths.operation = 160;
|
|
|
+ totalMinWidth += 160;
|
|
|
|
|
|
// 2. 计算可伸缩列最终宽度
|
|
|
const newWidths: Record<string, string> = {};
|
|
|
@@ -485,6 +501,10 @@ const resultOptions = computed(() => [
|
|
|
label: t('operationFill.all'),
|
|
|
value: '0' // 空值会触发 clearable 效果
|
|
|
},
|
|
|
+ {
|
|
|
+ label: t('mainPlan.delayed'),
|
|
|
+ value: '3' // 空值会触发 clearable 效果
|
|
|
+ },
|
|
|
...getStrDictOptions(DICT_TYPE.PMS_MAIN_WORK_ORDER_RESULT)
|
|
|
])
|
|
|
|
|
|
@@ -723,4 +743,15 @@ watch(isLeftContentCollapsed, () => {
|
|
|
transform: rotate(180deg);
|
|
|
}
|
|
|
|
|
|
+/* 延时原因 必填星号样式 */
|
|
|
+:deep(.required-item .el-form-item__label:before) {
|
|
|
+ content: '*';
|
|
|
+ color: #ff4d4f;
|
|
|
+ margin-right: 2px;
|
|
|
+}
|
|
|
+
|
|
|
+/* 调整标签区域样式 */
|
|
|
+:deep(.required-item .el-form-item__label) {
|
|
|
+ padding-right: 0 !important;
|
|
|
+}
|
|
|
</style>
|