| | |
| | | //初始化判断是否有id传入 |
| | | onMounted(async ()=>{ |
| | | gridOptions.loading = true |
| | | await initOrder() |
| | | await initOrder(0) |
| | | |
| | | //启用表格拖动选中 |
| | | addListener(xGrid.value,gridOptions) |
| | |
| | | |
| | | |
| | | //页面第一次加载执行 |
| | | const initOrder = async ()=>{ |
| | | const initOrder = async (val)=>{ |
| | | |
| | | await request.get(`/basicData/orderBasicData`).then((res) => { |
| | | if(res.code==200){ |
| | | titleSelectJson.value=deepClone(res.data) |
| | | //其他金额 |
| | | otherMoney.value = titleSelectJson.value.orderOtherMoney[0] |
| | | //let columns = [] |
| | | otherMoney.value.forEach(item => { |
| | | let column = { |
| | | field: `otherColumns.${item.column}`, |
| | | width:100, |
| | | title: item.alias, |
| | | editRender: { |
| | | name: 'input', |
| | | if(val===0){ |
| | | //其他金额 |
| | | otherMoney.value = titleSelectJson.value.orderOtherMoney[0] |
| | | //let columns = [] |
| | | otherMoney.value.forEach(item => { |
| | | let column = { |
| | | field: `otherColumns.${item.column}`, |
| | | width:100, |
| | | title: item.alias, |
| | | editRender: { |
| | | name: 'input', |
| | | } |
| | | } |
| | | } |
| | | //判断 其他列是否是数字 |
| | | if(item.column.indexOf('M')>-1){ |
| | | gridOptions.editRules[`otherColumns.${item.column}`] = [ |
| | | { |
| | | validator ({ cellValue }) { |
| | | const regex = /^(0(\.\d{1,3})?|([1-9]\d{0,4})(\.\d{1,3})?|99999(\.9{1,3})?)$/ |
| | | if (cellValue && !regex.test(cellValue)) { |
| | | return new Error(t('basicData.msg.range99999Dec3')) |
| | | //判断 其他列是否是数字 |
| | | if(item.column.indexOf('M')>-1){ |
| | | gridOptions.editRules[`otherColumns.${item.column}`] = [ |
| | | { |
| | | validator ({ cellValue }) { |
| | | const regex = /^(0(\.\d{1,3})?|([1-9]\d{0,4})(\.\d{1,3})?|99999(\.9{1,3})?)$/ |
| | | if (cellValue && !regex.test(cellValue)) { |
| | | return new Error(t('basicData.msg.range99999Dec3')) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | }else{ |
| | | gridOptions.editRules[`otherColumns.${item.column}`] = [ |
| | | { required: false}, |
| | | { min: 0, max: 255, message: t('basicData.msg.max255') } |
| | | ] |
| | | } |
| | | ] |
| | | }else{ |
| | | gridOptions.editRules[`otherColumns.${item.column}`] = [ |
| | | { required: false}, |
| | | { min: 0, max: 255, message: t('basicData.msg.max255') } |
| | | ] |
| | | } |
| | | |
| | | //columns.push(column) |
| | | gridOptions.columns.push(column) |
| | | //columns.push(column) |
| | | gridOptions.columns.push(column) |
| | | |
| | | }) |
| | | |
| | | }) |
| | | } |
| | | //进入页面下拉框设置默认值 |
| | | titleUploadData.value.orderType = titleSelectJson.value.orderType[0].basicName |
| | | titleUploadData.value.orderClassify = titleSelectJson.value.orderClassify[0].basicName |
| | |
| | | |
| | | //创建客户成功返回方法 |
| | | const createCustomerSuccess = async () => { |
| | | //await initOrder() |
| | | await initOrder(1) |
| | | createCustomerVisible.value = false |
| | | } |
| | | |