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. 7
      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">
<el-form ref="imageFormRef" :model="imageFormData" :key="formKey">
<el-form-item label="文件上传">
<el-form-item label="">
<UploadImgs v-model="imageFormData.filePathList" />
</el-form-item>
</el-form>
<el-button type="primary" @click="uploadImage">点击修改</el-button>
<el-button type="primary" @click="uploadImage">提交</el-button>
</div>
<div v-if="isBasic && tabsExtend == 2">
<el-tabs class="demo-tabs" v-model="imageParmas.fileBusiType" @tab-change="handleTabsChange">
@ -57,11 +57,11 @@
/>
</el-tabs>
<el-form ref="fileFormRef" :model="fileFormData" :key="formKey">
<el-form-item label="文件上传">
<el-form-item label="">
<UploadFile v-model="fileFormData.filePathList" :limit="20" />
</el-form-item>
</el-form>
<el-button type="primary" @click="uploadFile">点击修改</el-button>
<el-button type="primary" @click="uploadFile">提交</el-button>
</div>
<!-- 单表切换tabs 展现table -->
<Table
@ -197,7 +197,7 @@
:key="dialogFormKey"
>
<el-form ref="fileDialogUploadRef" :model="fileDialogUploadData" >
<el-form-item label="文件选择">
<el-form-item label="">
<UploadFile v-model="fileDialogUploadData.filePathList" :limit="20" />
</el-form-item>
</el-form>
@ -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
}

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

@ -55,7 +55,7 @@ const props = defineProps({
type: Array as PropType<UploadUserFile[]>,
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 })
// 使nameres.dataname
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) {

1
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

16
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();
}
}

11
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'}
],
})

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: '操作',
field: 'action',
@ -809,19 +822,19 @@ export const DeviceMaintenanceMainSec = 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: '完成方式',
// field: 'result',
// sort: 'custom',
// table: {
// width: '150',
// },
// isSearch: false,
// isTable: true,
// isForm: false,
// dictType: DICT_TYPE.ORDER_COMPLETE_RESULT,
// dictClass: 'string',
// },
{
label: '操作',
field: 'action',

7
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({
@ -25,7 +24,9 @@ export const MoldAccountsRules = reactive({
],
purchasePrice: [
{ validator: validateNumDot, message: '请输入数字格式', trigger: 'blur' },
{ max: 20, message: '不得超过20个字符', trigger:'blur'},
{ validator: validateNumberMax20Length, message: '请填写合理的价格', trigger: 'blur' },
// { max: 20, message: '不得超过20个字符', trigger:'blur'},
],
beat:[
{ 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: '操作',
field: 'action',

Loading…
Cancel
Save