diff --git a/src/components/Detail/src/DetailDeviceLedger.vue b/src/components/Detail/src/DetailDeviceLedger.vue index 2a33e31..c2cc3a7 100644 --- a/src/components/Detail/src/DetailDeviceLedger.vue +++ b/src/components/Detail/src/DetailDeviceLedger.vue @@ -41,11 +41,11 @@ />
- + - 点击修改 + 提交
@@ -57,11 +57,11 @@ /> - + - 点击修改 + 提交
- + @@ -598,7 +598,6 @@ defineExpose({ openDetail }) // 提供 open 方法,用于打开弹窗 // 获取图片详情 const formKey = ref(0) const getImage = () => { - fileApi.selectList().then((response) => { props .getImageApi({ number: masterParmas.value.number, @@ -611,23 +610,14 @@ const getImage = () => { imageFormData.value.filePathList = res } else { console.log(444,res) - fileFormData.value.filePathList = res.map(item=>{ - response.forEach(element=>{ - if(item.url == element.url){ - item.name = element.name - } - }) - return item - }) + fileFormData.value.filePathList = res formKey.value += 1 } }) }) - }) } const getImageDialog = () => { - fileApi.selectList().then((response) => { props .getImageApi({ number: masterParmas.value.number, @@ -640,19 +630,11 @@ const getImageDialog = () => { imageFormData.value.filePathList = res } else { console.log(444,res) - fileDialogUploadData.value.filePathList = res.map(item=>{ - response.forEach(element=>{ - if(item.url == element.url){ - item.name = element.name - } - }) - return item - }) + fileDialogUploadData.value.filePathList = res formKey.value += 1 } }) }) - }) } const tableObjectRef = ref() @@ -818,6 +800,7 @@ const uploadImage = async () => { // if (!valid) return let data = { number: masterParmas.value.number, + fileInfoList: imageFormData.value.filePathList, filePathList: imageFormData.value.filePathList.map((item) => item.url), funcCode: imageParmas.value.funcCode, fileBusiType: imageParmas.value.fileBusiType ? imageParmas.value.fileBusiType : '' @@ -844,6 +827,7 @@ const uploadFile = async () => { // console.log(fileFormRef.value?.formModel.filePathList) let data = { number: masterParmas.value.number, + fileInfoList: fileFormData.value.filePathList, filePathList: fileFormData.value.filePathList.map((item) => item.url), funcCode: imageParmas.value.funcCode, fileBusiType: imageParmas.value.fileBusiType ? imageParmas.value.fileBusiType : '' @@ -1001,6 +985,7 @@ function dialogUploadFile() { let data = { number: dialogUploadNumber.value, filePathList: fileDialogUploadData.value.filePathList.map((item) => item.url), + fileInfoList: fileDialogUploadData.value.filePathList, funcCode: props.milestoneFuncCode, fileBusiType: dialogUploadBusiCode.value } diff --git a/src/components/UploadFile/src/UploadFile.vue b/src/components/UploadFile/src/UploadFile.vue index b799c6c..94b8dee 100644 --- a/src/components/UploadFile/src/UploadFile.vue +++ b/src/components/UploadFile/src/UploadFile.vue @@ -55,7 +55,7 @@ const props = defineProps({ type: Array as PropType, required: true }, - title: propTypes.string.def('文件上传'), + title: propTypes.string.def('选择文件'), updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_URL), upData: propTypes.object.def(), fileType: propTypes.array.def(['doc', 'xls', 'ppt', 'txt', 'pdf', 'pdf','png', 'jpg', 'jpeg']), // 文件类型, 例如['png', 'jpg', 'jpeg'] @@ -118,9 +118,16 @@ const beforeUpload: UploadProps['beforeUpload'] = (file: UploadRawFile) => { const handleFileSuccess: UploadProps['onSuccess'] = (res: any): void => { message.success('上传成功') const fileListNew = fileList.value + // 获取最后一个元素的name + if(fileListNew.length==0){ + return + } + const lastName = fileListNew[fileListNew.length - 1].name + // 移除数组的最后一个元素 fileListNew.pop() fileList.value = fileListNew - uploadList.value.push({ name: res.data, url: res.data }) + // 使用提取的name替换res.data的name + uploadList.value.push({ name: lastName, url: res.data }) if (uploadList.value.length == uploadNumber.value) { fileList.value = fileList.value.concat(uploadList.value) uploadList.value = [] @@ -179,7 +186,7 @@ watch( } :deep(.el-upload-list__item-file-name) { - max-width: 250px; + max-width: 550px; } :deep(.upload-file-list .ele-upload-list__item-content) { diff --git a/src/components/UploadFile/src/UploadImg.vue b/src/components/UploadFile/src/UploadImg.vue index fb8903f..8503e36 100644 --- a/src/components/UploadFile/src/UploadImg.vue +++ b/src/components/UploadFile/src/UploadImg.vue @@ -84,7 +84,6 @@ const props = defineProps({ width: propTypes.string.def('150px'), // 组件宽度 ==> 非必传(默认为 150px) borderradius: propTypes.string.def('8px') // 组件边框圆角 ==> 非必传(默认为 8px) }) -debugger const { t } = useI18n() // 国际化 const message = useMessage() // 消息弹窗 // 生成组件唯一id diff --git a/src/utils/validator.ts b/src/utils/validator.ts index 20ec1a6..060a8aa 100644 --- a/src/utils/validator.ts +++ b/src/utils/validator.ts @@ -785,3 +785,19 @@ export default { validateChargeperson, validateYS } + + +// 校验数字必须为小于或等于指定位数 +export function validateNumberMax20Length(rule, value, callback) { + if (value) { + // 正则表达式:匹配1到20位的数字 + const reg = /^\d{1,12}$/; + if (reg.test(value)) { + callback(); + } else { + callback(new Error('请输入小于或等于12位的数字')); + } + } else { + callback(); + } +} \ No newline at end of file diff --git a/src/views/eam/device/deviceAccounts/deviceAccounts.data.ts b/src/views/eam/device/deviceAccounts/deviceAccounts.data.ts index 98f4e7d..4572f2f 100644 --- a/src/views/eam/device/deviceAccounts/deviceAccounts.data.ts +++ b/src/views/eam/device/deviceAccounts/deviceAccounts.data.ts @@ -1,15 +1,12 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' -import { selectAllFactoryArea,selectAllFactoryAreaDept } from '@/api/system/dept' -import { validateHanset,validateNumDot, validateEmail } from '@/utils/validator' +import { selectAllFactoryAreaDept } from '@/api/system/dept' +import { validateNumDot, validateNumberMax20Length } from '@/utils/validator' import * as SupplierApi from '@/api/eam/basic/supplier' import * as UserApi from '@/api/system/user' -import { selecUserByType } from '@/api/system/dept' -const factoryList = await selectAllFactoryArea() const factoryDeptList = await selectAllFactoryAreaDept() -const supplierList = await SupplierApi.getSupplierNoPage() +const supplierList = await SupplierApi.getSupplierNoPage({}) const userListAll = await UserApi.getSimpleUserList() -const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: null }) // 表单校验 export const DeviceAccountsRules = reactive({ name: [ @@ -46,7 +43,7 @@ export const DeviceAccountsRules = reactive({ { max: 20, message: '不得超过20个字符', trigger: 'blur' }, ], purchasePrice: [ - { max: 20, message: '不得超过20个字符', trigger: 'blur' }, + { validator: validateNumberMax20Length, message: '请填写合理的价格', trigger: 'blur' }, { validator:validateNumDot, message: '请输入数字格式', trigger: 'blur'} ], }) diff --git a/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts b/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts index 92d32ad..5e052e9 100644 --- a/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts +++ b/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts @@ -321,6 +321,19 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive([ } }, }, + { + label: '完成方式', + field: 'result', + sort: 'custom', + table: { + width: '150', + }, + isSearch: false, + isTable: true, + isForm: false, + dictType: DICT_TYPE.ORDER_COMPLETE_RESULT, + dictClass: 'string', + }, { label: '操作', field: 'action', @@ -809,19 +822,19 @@ export const DeviceMaintenanceMainSec = useCrudSchemas(reactive([ } }, }, - { - label: '完成方式', - field: 'result', - sort: 'custom', - table: { - width: '150', - }, - isSearch: false, - isTable: true, - isForm: false, - dictType: DICT_TYPE.ORDER_COMPLETE_RESULT, - dictClass: 'string', - }, + // { + // label: '完成方式', + // field: 'result', + // sort: 'custom', + // table: { + // width: '150', + // }, + // isSearch: false, + // isTable: true, + // isForm: false, + // dictType: DICT_TYPE.ORDER_COMPLETE_RESULT, + // dictClass: 'string', + // }, { label: '操作', field: 'action', diff --git a/src/views/eam/mold/moldAccounts/moldAccounts.data.ts b/src/views/eam/mold/moldAccounts/moldAccounts.data.ts index 469c44b..b0e5ddb 100644 --- a/src/views/eam/mold/moldAccounts/moldAccounts.data.ts +++ b/src/views/eam/mold/moldAccounts/moldAccounts.data.ts @@ -2,9 +2,8 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import { selectAllFactoryArea,selectAllFactoryAreaDept } from '@/api/system/dept' import * as SupplierApi from '@/api/eam/basic/supplier' -import { validateHanset,validateNumDot, validateEmail,validateNum } from '@/utils/validator' +import { validateNumDot, validateNum,validateNumberMax20Length } from '@/utils/validator' const factoryList = await selectAllFactoryArea() -const factoryDeptList = await selectAllFactoryAreaDept() const supplierList = await SupplierApi.getSupplierNoPage({}) // 表单校验 export const MoldAccountsRules = reactive({ @@ -24,8 +23,10 @@ export const MoldAccountsRules = reactive({ { max: 60, message: '不得超过60个字符', trigger: 'blur' }, ], purchasePrice: [ - { validator:validateNumDot, message: '请输入数字格式', trigger: 'blur'}, - { max: 20, message: '不得超过20个字符', trigger:'blur'}, + { validator: validateNumDot, message: '请输入数字格式', trigger: 'blur' }, + { validator: validateNumberMax20Length, message: '请填写合理的价格', trigger: 'blur' }, + + // { max: 20, message: '不得超过20个字符', trigger:'blur'}, ], beat:[ { validator:validateNum, message: '请输入数字格式', trigger: 'blur'} diff --git a/src/views/eam/mold/moldmaintenancejob/moldMaintenanceMain.data.ts b/src/views/eam/mold/moldmaintenancejob/moldMaintenanceMain.data.ts index d5326ae..49ab8d9 100644 --- a/src/views/eam/mold/moldmaintenancejob/moldMaintenanceMain.data.ts +++ b/src/views/eam/mold/moldmaintenancejob/moldMaintenanceMain.data.ts @@ -774,6 +774,19 @@ export const MoldMaintenanceMainSec = useCrudSchemas(reactive([ } }, }, + // { + // label: '完成方式', + // field: 'result', + // sort: 'custom', + // table: { + // width: '150', + // }, + // isSearch: false, + // isTable: true, + // isForm: false, + // dictType: DICT_TYPE.ORDER_COMPLETE_RESULT, + // dictClass: 'string', + // }, { label: '操作', field: 'action',