母排附件

main
mhsnet 7 months ago
parent 9bd6df2cca
commit 53c1a8903e

@ -258,7 +258,7 @@
</template> </template>
<script lang="ts" setup name="MuPaiForm"> <script lang="ts" setup name="MuPaiForm">
import { ref, onMounted, computed } from 'vue' import { ref, reactive, onMounted, computed } from 'vue'
import { VXETable } from 'vxe-table' import { VXETable } from 'vxe-table'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { map as _map } from 'lodash' import { map as _map } from 'lodash'
@ -268,6 +268,7 @@ import { storeToRefs } from 'pinia'
import type { UploadProps, UploadChangeParam } from 'ant-design-vue' import type { UploadProps, UploadChangeParam } from 'ant-design-vue'
import { config } from '@/config/axios/config' import { config } from '@/config/axios/config'
import XEUtils from 'xe-utils' import XEUtils from 'xe-utils'
import * as FileUploadApi from '@/api/gw/fileUpload'
const dictStore = useDictStore() const dictStore = useDictStore()
const { dictPdCode, dictProcessType } = storeToRefs(dictStore) const { dictPdCode, dictProcessType } = storeToRefs(dictStore)
@ -284,7 +285,6 @@ const emit = defineEmits(['success'])
// //
const refShow = ref(false) const refShow = ref(false)
// A - // A -
const formDataAInit: any = { const formDataAInit: any = {
"ID": 0, "ID": 0,
"StandardVersion": 1, "StandardVersion": 1,
@ -314,36 +314,57 @@ const formDataAInit: any = {
"Width": undefined, "Width": undefined,
"Sended": 0 "Sended": 0
} }
// B -
const formDataBInit: any = {
ID: 0,
StandardVersion: "",
SupplierWorkNo: "",
SupplierCode: "",
ModelCode: "",
CategoryType: "",
SerialNo: "",
FileItems: JSON.stringify([{ "id": 1, "type": 1, "typeCode": 1, "fileName": "", "fileUrl": "", "fileType": 1, "fType": ".pdf" }, { "id": 2, "type": 1, "typeCode": 2, "fileName": "", "fileUrl": "", "fileType": 1, "fType": ".pdf" }]),
CheckTime: "",
PutCenterTime: "",
PdCode: "GX000080",
FpdCode: "",
Ecode: '',
SgEntityId: "",
DataUniqueIdentifier: "",
Sended: 0
}
// //
const refFormA = ref() const refFormA = ref()
// //
const fileItems = ref([ const fileItems = computed(() => {
{ "id": 1, "type": 1, "typeCode": 1, "fileName": "", "fileUrl": "", "fileType": 1, "fType": ".pdf" }, let FileItems: any = XEUtils.clone(formDataB.value.FileItems, true)
{ "id": 2, "type": 1, "typeCode": 2, "fileName": "", "fileUrl": "", "fileType": 1, "fType": ".pdf" } FileItems = JSON.parse(FileItems)
]) return FileItems
})
const fnChgFileA = async (info: UploadChangeParam) => { const fnChgFileA = async (info: UploadChangeParam) => {
if (info.file.response) { if (info.file.response) {
let FileItemsA: any = XEUtils.clone(fileItems.value, true) let FileItems: any = XEUtils.clone(formDataB.value.FileItems, true)
FileItemsA[0]['fileName'] = info.file.name FileItems = JSON.parse(FileItems)
FileItemsA[0]['fileUrl'] = info.file.response FileItems[0]['fileName'] = info.file.name
fileItems.value = FileItemsA FileItems[0]['fileUrl'] = info.file.response
formDataB.value.FileItems = JSON.stringify(FileItems)
} }
} }
const fnChgFileB = async (info: UploadChangeParam) => { const fnChgFileB = async (info: UploadChangeParam) => {
if (info.file.response) { if (info.file.response) {
let FileItemsA: any = XEUtils.clone(fileItems.value, true) let FileItems: any = XEUtils.clone(formDataB.value.FileItems, true)
FileItemsA[1]['fileName'] = info.file.name FileItems = JSON.parse(FileItems)
FileItemsA[1]['fileUrl'] = info.file.response FileItems[1]['fileName'] = info.file.name
fileItems.value = FileItemsA FileItems[1]['fileUrl'] = info.file.response
formDataB.value.FileItems = JSON.stringify(FileItems)
} }
} }
// [add - |update - |del - ] // [add - |update - |del - ]
const formTypeA: any = ref('') const formTypeA: any = ref('')
// //
const modalTitle = ref('未知表单') const modalTitle = ref('未知表单')
// // A
const formDataA: any = ref(formDataAInit) const formDataA: any = ref(formDataAInit)
// //
const formRulesA: any = ref({ const formRulesA: any = ref({
SupplierWorkNo: [ SupplierWorkNo: [
@ -389,20 +410,21 @@ const formRulesA: any = ref({
{ required: true, message: '请输入公称宽度' } { required: true, message: '请输入公称宽度' }
] ]
}) })
// B
const formDataB: any = ref(formDataBInit)
// //
onMounted(() => { onMounted(() => {
}) })
// //
const open = async (type: string, row?: any) => { const open = async (type: string, row?: any) => {
formTypeA.value = type formTypeA.value = type
await fnResetA()
switch (type) { switch (type) {
case 'add': case 'add':
await fnResetA()
modalTitle.value = '新增母排' modalTitle.value = '新增母排'
refShow.value = true refShow.value = true
break; break;
case 'edit': case 'edit':
await fnResetA()
modalTitle.value = '编辑母排' modalTitle.value = '编辑母排'
refShow.value = true refShow.value = true
const paramsA = { const paramsA = {
@ -415,9 +437,22 @@ const open = async (type: string, row?: any) => {
const rowInfoA = await MuPaiApi.getMuPai(paramsA) const rowInfoA = await MuPaiApi.getMuPai(paramsA)
rowInfoA.Data.Sended = 0 rowInfoA.Data.Sended = 0
formDataA.value = rowInfoA.Data formDataA.value = rowInfoA.Data
//
const queryFileParamsA: any = {
"filter": {
"field": 'SerialNo',
"operator": "Eq",
"value": formDataA.value.SerialNo
}
}
const dataFileRes = await FileUploadApi.getPagingFileList(queryFileParamsA)
if (dataFileRes.Code == 0 && dataFileRes.List) {
if (dataFileRes.List.length > 0) {
formDataB.value = dataFileRes.List[0]
}
}
break; break;
case 'copy': case 'copy':
await fnResetA()
modalTitle.value = '复制母排' modalTitle.value = '复制母排'
refShow.value = true refShow.value = true
const paramsB = { const paramsB = {
@ -512,11 +547,51 @@ const fnSubmitA = async () => {
} }
// B - // B -
const fnSubmitB = async () => { const fnSubmitB = async () => {
console.log('fnSubmitB') formDataB.value.StandardVersion = formDataA.value.StandardVersion
formDataB.value.SupplierWorkNo = formDataA.value.SupplierWorkNo
formDataB.value.SupplierCode = formDataA.value.SupplierCode
formDataB.value.ModelCode = formDataA.value.ModelCode
formDataB.value.CategoryType = formDataA.value.CategoryType
formDataB.value.SerialNo = formDataA.value.SerialNo
formDataB.value.FpdCode = formDataA.value.PdCode
formDataB.value.Ecode = formDataA.value.Ecode
formDataB.value.SgEntityId = formDataA.value.SgEntityId
formDataB.value.DataUniqueIdentifier = formDataA.value.DataUniqueIdentifier
formDataB.value.CheckTime = formDataA.value.CheckTime
formDataB.value.PutCenterTime = formDataA.value.PutCenterTime
const queryParamsA: any = {
"filter": {
"field": 'SerialNo',
"operator": "Eq",
"value": formDataA.value.SerialNo
}
}
const dataFileRes = await FileUploadApi.getPagingFileList(queryParamsA)
if (dataFileRes.Code == 0 && dataFileRes.List) {
if (dataFileRes.List.length > 0) {
let setVal: any = _map(formDataB.value, (o1, k1) => {
return { field: k1, value: o1 }
})
const paramsB = {
filter: {
field: 'SerialNo',
value: formDataB.value.SerialNo
},
set: setVal
}
await FileUploadApi.editFile(paramsB)
} else {
const paramsA = {
data: formDataB.value
}
await FileUploadApi.saveFile(paramsA)
}
}
} }
// //
const fnResetA = () => { const fnResetA = () => {
formDataA.value = formDataAInit formDataA.value = formDataAInit
formDataB.value = formDataBInit
} }
// //
const fnEventCancel = () => { const fnEventCancel = () => {

Loading…
Cancel
Save