Browse Source

解决测试bug

master
ljlong_2630 8 months ago
parent
commit
ac44b13667
  1. 35
      src/components/Detail/src/DetailDeviceLedger.vue
  2. 13
      src/components/UploadFile/src/UploadFile.vue
  3. 1
      src/components/UploadFile/src/UploadImg.vue
  4. 16
      src/utils/validator.ts
  5. 11
      src/views/eam/device/deviceAccounts/deviceAccounts.data.ts
  6. 39
      src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts
  7. 9
      src/views/eam/mold/moldAccounts/moldAccounts.data.ts
  8. 13
      src/views/eam/mold/moldmaintenancejob/moldMaintenanceMain.data.ts

35
src/components/Detail/src/DetailDeviceLedger.vue

@ -41,11 +41,11 @@
/> />
<div v-if="isBasic && tabsExtend == 1"> <div v-if="isBasic && tabsExtend == 1">
<el-form ref="imageFormRef" :model="imageFormData" :key="formKey"> <el-form ref="imageFormRef" :model="imageFormData" :key="formKey">
<el-form-item label="文件上传"> <el-form-item label="">
<UploadImgs v-model="imageFormData.filePathList" /> <UploadImgs v-model="imageFormData.filePathList" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-button type="primary" @click="uploadImage">点击修改</el-button> <el-button type="primary" @click="uploadImage">提交</el-button>
</div> </div>
<div v-if="isBasic && tabsExtend == 2"> <div v-if="isBasic && tabsExtend == 2">
<el-tabs class="demo-tabs" v-model="imageParmas.fileBusiType" @tab-change="handleTabsChange"> <el-tabs class="demo-tabs" v-model="imageParmas.fileBusiType" @tab-change="handleTabsChange">
@ -57,11 +57,11 @@
/> />
</el-tabs> </el-tabs>
<el-form ref="fileFormRef" :model="fileFormData" :key="formKey"> <el-form ref="fileFormRef" :model="fileFormData" :key="formKey">
<el-form-item label="文件上传"> <el-form-item label="">
<UploadFile v-model="fileFormData.filePathList" :limit="20" /> <UploadFile v-model="fileFormData.filePathList" :limit="20" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-button type="primary" @click="uploadFile">点击修改</el-button> <el-button type="primary" @click="uploadFile">提交</el-button>
</div> </div>
<!-- 单表切换tabs 展现table --> <!-- 单表切换tabs 展现table -->
<Table <Table
@ -197,7 +197,7 @@
:key="dialogFormKey" :key="dialogFormKey"
> >
<el-form ref="fileDialogUploadRef" :model="fileDialogUploadData" > <el-form ref="fileDialogUploadRef" :model="fileDialogUploadData" >
<el-form-item label="文件选择"> <el-form-item label="">
<UploadFile v-model="fileDialogUploadData.filePathList" :limit="20" /> <UploadFile v-model="fileDialogUploadData.filePathList" :limit="20" />
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -598,7 +598,6 @@ defineExpose({ openDetail }) // 提供 open 方法,用于打开弹窗
// //
const formKey = ref(0) const formKey = ref(0)
const getImage = () => { const getImage = () => {
fileApi.selectList().then((response) => {
props props
.getImageApi({ .getImageApi({
number: masterParmas.value.number, number: masterParmas.value.number,
@ -611,23 +610,14 @@ const getImage = () => {
imageFormData.value.filePathList = res imageFormData.value.filePathList = res
} else { } else {
console.log(444,res) console.log(444,res)
fileFormData.value.filePathList = res.map(item=>{ fileFormData.value.filePathList = res
response.forEach(element=>{
if(item.url == element.url){
item.name = element.name
}
})
return item
})
formKey.value += 1 formKey.value += 1
} }
}) })
}) })
})
} }
const getImageDialog = () => { const getImageDialog = () => {
fileApi.selectList().then((response) => {
props props
.getImageApi({ .getImageApi({
number: masterParmas.value.number, number: masterParmas.value.number,
@ -640,19 +630,11 @@ const getImageDialog = () => {
imageFormData.value.filePathList = res imageFormData.value.filePathList = res
} else { } else {
console.log(444,res) console.log(444,res)
fileDialogUploadData.value.filePathList = res.map(item=>{ fileDialogUploadData.value.filePathList = res
response.forEach(element=>{
if(item.url == element.url){
item.name = element.name
}
})
return item
})
formKey.value += 1 formKey.value += 1
} }
}) })
}) })
})
} }
const tableObjectRef = ref() const tableObjectRef = ref()
@ -818,6 +800,7 @@ const uploadImage = async () => {
// if (!valid) return // if (!valid) return
let data = { let data = {
number: masterParmas.value.number, number: masterParmas.value.number,
fileInfoList: imageFormData.value.filePathList,
filePathList: imageFormData.value.filePathList.map((item) => item.url), filePathList: imageFormData.value.filePathList.map((item) => item.url),
funcCode: imageParmas.value.funcCode, funcCode: imageParmas.value.funcCode,
fileBusiType: imageParmas.value.fileBusiType ? imageParmas.value.fileBusiType : '' fileBusiType: imageParmas.value.fileBusiType ? imageParmas.value.fileBusiType : ''
@ -844,6 +827,7 @@ const uploadFile = async () => {
// console.log(fileFormRef.value?.formModel.filePathList) // console.log(fileFormRef.value?.formModel.filePathList)
let data = { let data = {
number: masterParmas.value.number, number: masterParmas.value.number,
fileInfoList: fileFormData.value.filePathList,
filePathList: fileFormData.value.filePathList.map((item) => item.url), filePathList: fileFormData.value.filePathList.map((item) => item.url),
funcCode: imageParmas.value.funcCode, funcCode: imageParmas.value.funcCode,
fileBusiType: imageParmas.value.fileBusiType ? imageParmas.value.fileBusiType : '' fileBusiType: imageParmas.value.fileBusiType ? imageParmas.value.fileBusiType : ''
@ -1001,6 +985,7 @@ function dialogUploadFile() {
let data = { let data = {
number: dialogUploadNumber.value, number: dialogUploadNumber.value,
filePathList: fileDialogUploadData.value.filePathList.map((item) => item.url), filePathList: fileDialogUploadData.value.filePathList.map((item) => item.url),
fileInfoList: fileDialogUploadData.value.filePathList,
funcCode: props.milestoneFuncCode, funcCode: props.milestoneFuncCode,
fileBusiType: dialogUploadBusiCode.value fileBusiType: dialogUploadBusiCode.value
} }

13
src/components/UploadFile/src/UploadFile.vue

@ -55,7 +55,7 @@ const props = defineProps({
type: Array as PropType<UploadUserFile[]>, type: Array as PropType<UploadUserFile[]>,
required: true required: true
}, },
title: propTypes.string.def('文件上传'), title: propTypes.string.def('选择文件'),
updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_URL), updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_URL),
upData: propTypes.object.def(), upData: propTypes.object.def(),
fileType: propTypes.array.def(['doc', 'xls', 'ppt', 'txt', 'pdf', 'pdf','png', 'jpg', 'jpeg']), // , ['png', 'jpg', 'jpeg'] 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 => { const handleFileSuccess: UploadProps['onSuccess'] = (res: any): void => {
message.success('上传成功') message.success('上传成功')
const fileListNew = fileList.value const fileListNew = fileList.value
// name
if(fileListNew.length==0){
return
}
const lastName = fileListNew[fileListNew.length - 1].name
//
fileListNew.pop() fileListNew.pop()
fileList.value = fileListNew fileList.value = fileListNew
uploadList.value.push({ name: res.data, url: res.data }) // 使nameres.dataname
uploadList.value.push({ name: lastName, url: res.data })
if (uploadList.value.length == uploadNumber.value) { if (uploadList.value.length == uploadNumber.value) {
fileList.value = fileList.value.concat(uploadList.value) fileList.value = fileList.value.concat(uploadList.value)
uploadList.value = [] uploadList.value = []
@ -179,7 +186,7 @@ watch(
} }
:deep(.el-upload-list__item-file-name) { :deep(.el-upload-list__item-file-name) {
max-width: 250px; max-width: 550px;
} }
:deep(.upload-file-list .ele-upload-list__item-content) { :deep(.upload-file-list .ele-upload-list__item-content) {

1
src/components/UploadFile/src/UploadImg.vue

@ -84,7 +84,6 @@ const props = defineProps({
width: propTypes.string.def('150px'), // ==> 150px width: propTypes.string.def('150px'), // ==> 150px
borderradius: propTypes.string.def('8px') // ==> 8px borderradius: propTypes.string.def('8px') // ==> 8px
}) })
debugger
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// id // id

16
src/utils/validator.ts

@ -785,3 +785,19 @@ export default {
validateChargeperson, validateChargeperson,
validateYS 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();
}
}

11
src/views/eam/device/deviceAccounts/deviceAccounts.data.ts

@ -1,15 +1,12 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import { selectAllFactoryArea,selectAllFactoryAreaDept } from '@/api/system/dept' import { selectAllFactoryAreaDept } from '@/api/system/dept'
import { validateHanset,validateNumDot, validateEmail } from '@/utils/validator' import { validateNumDot, validateNumberMax20Length } from '@/utils/validator'
import * as SupplierApi from '@/api/eam/basic/supplier' import * as SupplierApi from '@/api/eam/basic/supplier'
import * as UserApi from '@/api/system/user' import * as UserApi from '@/api/system/user'
import { selecUserByType } from '@/api/system/dept'
const factoryList = await selectAllFactoryArea()
const factoryDeptList = await selectAllFactoryAreaDept() const factoryDeptList = await selectAllFactoryAreaDept()
const supplierList = await SupplierApi.getSupplierNoPage() const supplierList = await SupplierApi.getSupplierNoPage({})
const userListAll = await UserApi.getSimpleUserList() const userListAll = await UserApi.getSimpleUserList()
const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: null })
// 表单校验 // 表单校验
export const DeviceAccountsRules = reactive({ export const DeviceAccountsRules = reactive({
name: [ name: [
@ -46,7 +43,7 @@ export const DeviceAccountsRules = reactive({
{ max: 20, message: '不得超过20个字符', trigger: 'blur' }, { max: 20, message: '不得超过20个字符', trigger: 'blur' },
], ],
purchasePrice: [ purchasePrice: [
{ max: 20, message: '不得超过20个字符', trigger: 'blur' }, { validator: validateNumberMax20Length, message: '请填写合理的价格', trigger: 'blur' },
{ validator:validateNumDot, message: '请输入数字格式', trigger: 'blur'} { validator:validateNumDot, message: '请输入数字格式', trigger: 'blur'}
], ],
}) })

39
src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts

@ -321,6 +321,19 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
}, },
{
label: '完成方式',
field: 'result',
sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isTable: true,
isForm: false,
dictType: DICT_TYPE.ORDER_COMPLETE_RESULT,
dictClass: 'string',
},
{ {
label: '操作', label: '操作',
field: 'action', field: 'action',
@ -809,19 +822,19 @@ export const DeviceMaintenanceMainSec = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
}, },
{ // {
label: '完成方式', // label: '完成方式',
field: 'result', // field: 'result',
sort: 'custom', // sort: 'custom',
table: { // table: {
width: '150', // width: '150',
}, // },
isSearch: false, // isSearch: false,
isTable: true, // isTable: true,
isForm: false, // isForm: false,
dictType: DICT_TYPE.ORDER_COMPLETE_RESULT, // dictType: DICT_TYPE.ORDER_COMPLETE_RESULT,
dictClass: 'string', // dictClass: 'string',
}, // },
{ {
label: '操作', label: '操作',
field: 'action', field: 'action',

9
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 { dateFormatter } from '@/utils/formatTime'
import { selectAllFactoryArea,selectAllFactoryAreaDept } from '@/api/system/dept' import { selectAllFactoryArea,selectAllFactoryAreaDept } from '@/api/system/dept'
import * as SupplierApi from '@/api/eam/basic/supplier' 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 factoryList = await selectAllFactoryArea()
const factoryDeptList = await selectAllFactoryAreaDept()
const supplierList = await SupplierApi.getSupplierNoPage({}) const supplierList = await SupplierApi.getSupplierNoPage({})
// 表单校验 // 表单校验
export const MoldAccountsRules = reactive({ export const MoldAccountsRules = reactive({
@ -24,8 +23,10 @@ export const MoldAccountsRules = reactive({
{ max: 60, message: '不得超过60个字符', trigger: 'blur' }, { max: 60, message: '不得超过60个字符', trigger: 'blur' },
], ],
purchasePrice: [ purchasePrice: [
{ validator:validateNumDot, message: '请输入数字格式', trigger: 'blur'}, { validator: validateNumDot, message: '请输入数字格式', trigger: 'blur' },
{ max: 20, message: '不得超过20个字符', trigger:'blur'}, { validator: validateNumberMax20Length, message: '请填写合理的价格', trigger: 'blur' },
// { max: 20, message: '不得超过20个字符', trigger:'blur'},
], ],
beat:[ beat:[
{ validator:validateNum, message: '请输入数字格式', trigger: 'blur'} { validator:validateNum, message: '请输入数字格式', trigger: 'blur'}

13
src/views/eam/mold/moldmaintenancejob/moldMaintenanceMain.data.ts

@ -774,6 +774,19 @@ export const MoldMaintenanceMainSec = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
}, },
// {
// label: '完成方式',
// field: 'result',
// sort: 'custom',
// table: {
// width: '150',
// },
// isSearch: false,
// isTable: true,
// isForm: false,
// dictType: DICT_TYPE.ORDER_COMPLETE_RESULT,
// dictClass: 'string',
// },
{ {
label: '操作', label: '操作',
field: 'action', field: 'action',

Loading…
Cancel
Save