|
|
|
|
@ -1,6 +1,13 @@
|
|
|
|
|
<template>
|
|
|
|
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="920px">
|
|
|
|
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="110px" v-loading="formLoading">
|
|
|
|
|
<el-form
|
|
|
|
|
ref="formRef"
|
|
|
|
|
:model="formData"
|
|
|
|
|
:rules="formRules"
|
|
|
|
|
label-width="110px"
|
|
|
|
|
v-loading="formLoading || fileUploading"
|
|
|
|
|
element-loading-text="资料上传中,请稍候"
|
|
|
|
|
>
|
|
|
|
|
<el-row :gutter="16">
|
|
|
|
|
<!-- <el-col :span="24">
|
|
|
|
|
<el-form-item label="资产编号" prop="id">
|
|
|
|
|
@ -116,15 +123,14 @@
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('EquipmentManagement.EquipmentLedger.productionDate')" prop="productionDate" required>
|
|
|
|
|
<el-form-item :label="t('EquipmentManagement.EquipmentLedger.productionDate')" prop="productionDate">
|
|
|
|
|
<el-date-picker v-model="formData.productionDate" type="date" value-format="YYYY-MM-DD"
|
|
|
|
|
:placeholder="t('EquipmentManagement.EquipmentLedger.placeholderProductionDate')" class="!w-full" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('EquipmentManagement.EquipmentLedger.factoryEntryDate')" prop="factoryEntryDate"
|
|
|
|
|
required>
|
|
|
|
|
<el-form-item :label="t('EquipmentManagement.EquipmentLedger.factoryEntryDate')" prop="factoryEntryDate">
|
|
|
|
|
<el-date-picker v-model="formData.factoryEntryDate" type="date" value-format="YYYY-MM-DD"
|
|
|
|
|
:placeholder="t('EquipmentManagement.EquipmentLedger.placeholderFactoryEntryDate')" class="!w-full" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
@ -193,7 +199,12 @@
|
|
|
|
|
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item :label="t('EquipmentManagement.EquipmentLedger.fileUrl')" prop="fileUrl">
|
|
|
|
|
<UploadFile :is-show-tip="false" v-model="formData.fileUrl" :limit="9" />
|
|
|
|
|
<UploadFile
|
|
|
|
|
:is-show-tip="false"
|
|
|
|
|
v-model="formData.fileUrl"
|
|
|
|
|
:limit="9"
|
|
|
|
|
@uploading-change="handleFileUploadingChange"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col v-if="formType === 'update'" :span="24">
|
|
|
|
|
@ -219,7 +230,7 @@
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">{{ t('common.ok') }}</el-button>
|
|
|
|
|
<el-button @click="submitForm" type="primary" :disabled="formLoading || fileUploading">{{ t('common.ok') }}</el-button>
|
|
|
|
|
<el-button @click="dialogVisible = false">{{ t('common.cancel') }}</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</Dialog>
|
|
|
|
|
@ -377,6 +388,7 @@ const bjSelectedIds = ref<number[]>([])
|
|
|
|
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
|
|
|
|
const dialogTitle = ref('') // 弹窗的标题
|
|
|
|
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
|
|
|
const fileUploading = ref(false)
|
|
|
|
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
|
|
|
|
const deviceList = ref<DeviceVO[]>([]) // 列表
|
|
|
|
|
const list = ref<CriticalComponentVO[]>([])
|
|
|
|
|
@ -500,7 +512,7 @@ const initFormData = () => ({
|
|
|
|
|
remark: undefined,
|
|
|
|
|
componentIds: [] as number[],
|
|
|
|
|
beijianIds: [] as number[],
|
|
|
|
|
fileUrl: undefined,
|
|
|
|
|
fileUrl: '',
|
|
|
|
|
qrcodeUrl: undefined,
|
|
|
|
|
templateJson: undefined,
|
|
|
|
|
sort: undefined,
|
|
|
|
|
@ -538,12 +550,14 @@ const formRules = reactive<FormRules>({
|
|
|
|
|
deviceCode: [{ validator: validateDeviceCode, trigger: ['blur', 'change'] }],
|
|
|
|
|
deviceName: [{ required: true, message: t('EquipmentManagement.EquipmentLedger.placeholderDeviceName'), trigger: 'blur' }],
|
|
|
|
|
deviceType: [{ required: true, message: t('EquipmentManagement.EquipmentLedger.placeholderDeviceType'), trigger: 'change' }],
|
|
|
|
|
ratedCapacity: [{ validator: validateScheduledRequired('额定产能'), trigger: ['blur', 'change'] }],
|
|
|
|
|
productionDate: [{ required: true, message: t('EquipmentManagement.EquipmentLedger.placeholderProductionDate'), trigger: 'change' }],
|
|
|
|
|
factoryEntryDate: [{ required: true, message: t('EquipmentManagement.EquipmentLedger.placeholderFactoryEntryDate'), trigger: 'change' }]
|
|
|
|
|
ratedCapacity: [{ validator: validateScheduledRequired('额定产能'), trigger: ['blur', 'change'] }]
|
|
|
|
|
})
|
|
|
|
|
const formRef = ref() // 表单 Ref
|
|
|
|
|
|
|
|
|
|
const handleFileUploadingChange = (uploading: boolean) => {
|
|
|
|
|
fileUploading.value = uploading
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => formData.value.isScheduled,
|
|
|
|
|
() => {
|
|
|
|
|
@ -930,6 +944,10 @@ const bjToggleSelection = () => {
|
|
|
|
|
/** 提交表单 */
|
|
|
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
|
|
|
const submitForm = async () => {
|
|
|
|
|
if (fileUploading.value) {
|
|
|
|
|
message.warning('资料上传中,请等待上传完成后再提交')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// 校验表单
|
|
|
|
|
await formRef.value.validate()
|
|
|
|
|
// 提交请求
|
|
|
|
|
@ -1041,6 +1059,7 @@ const setBJDefaultSelections = () => {
|
|
|
|
|
|
|
|
|
|
/** 重置表单 */
|
|
|
|
|
const resetForm = () => {
|
|
|
|
|
fileUploading.value = false
|
|
|
|
|
formData.value = initFormData()
|
|
|
|
|
formRef.value?.resetFields()
|
|
|
|
|
}
|
|
|
|
|
|