| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | import { el, fa, th } from "element-plus/es/locales.mjs"; |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //è·å表åé
ç½® |
| | | getOption(field) { |
| | | let option; |
| | | this.detailOptions.columns.forEach(x => { |
| | | if (x.field == field) { |
| | | option = x; |
| | | } |
| | | // x.forEach(item => { |
| | | // if (item.field == field) { |
| | | // option = item; |
| | | // } |
| | | // }) |
| | | }) |
| | | return option; |
| | | }, |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | // let enableBtn = this.buttons.find(x => x.value == 'Add'); |
| | | // if (enableBtn) { |
| | | // this.detailOptions.columns.forEach(x => { |
| | | // if (x.field == 'materielCode' || x.field == 'batchNo' || x.field == 'orderQuantity') { |
| | | // x.readonly = false |
| | | // } |
| | | // }); |
| | | // } |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | this.detailOptions.columns.forEach(x => { |
| | | |
| | | if (x.field == 'materielCode') { |
| | | x.onChange = (val, option) => { |
| | | // this.$error(val.materielCode) |
| | |
| | | source => { |
| | | if (!source.status) return this.$error(source.message); |
| | | val.materielName = source.data.materielName; |
| | | this.$success(source.data.materielName); |
| | | // this.$success(source.data.materielName); |
| | | this.refresh(); |
| | | }) |
| | | // let locationCodes = this.getOption("locationCode"); |
| | | // locationCodes.bind.data.splice(0); |
| | | // this.http.post("/api/LocationInfo/GetLocationCodes", { Extra: val.materielCode }, true).then( |
| | | // source => { |
| | | // if (!source.status) return this.$error(source.message); |
| | | // val.materielName = source.message; |
| | | // for (let i = 0; i < source.data.length; i++) { |
| | | // locationCodes.bind.data.push({ key: source.data[i], value: source.data[i] }); |
| | | // } |
| | | // this.refresh(); |
| | | // }) |
| | | } |
| | | } |
| | | |
| | | }); |
| | | }, |
| | | searchBefore(param) { |
| | |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | let req = true; |
| | | // let locationCodes = formData.detailData.map(x=>{ |
| | | // // this.$error(x.locationCode); |
| | | // return x.locationCode |
| | | // }); |
| | | |
| | | formData.detailData.forEach(x => { |
| | | // if ('locationCode' in x) { |
| | | // // return this.$error(x.batchNo); |
| | | // } |
| | | if (!x.hasOwnProperty('batchNo')) { |
| | | req = false; |
| | | return this.$error("æå·ä¸è½ä¸ºç©º"); |
| | | } |
| | | }) |
| | | if (formData.detailData.length > 3) return this.$error("å
¥åºåæç»ä¸è½è¶
è¿3个"); |
| | | return req; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | // this.$error(formData.detailData.length) |
| | | if (formData.detailData.length > 3) return this.$error("å
¥åºåæç»ä¸è½è¶
è¿3个"); |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | if (this.currentAction == 'Add') { |
| | | let locationCodes=this.getOption("locationCode"); |
| | | locationCodes.bind.data.splice(0); |
| | | this.http.post("/api/LocationInfo/GetLocationCodes", null, true).then( |
| | | source => { |
| | | if (!source.status) return this.$error(source.message); |
| | | for (let i = 0; i < source.data.length; i++) { |
| | | locationCodes.bind.data.push({ key: source.data[i], value: source.data[i] }); |
| | | } |
| | | this.refresh(); |
| | | }) |
| | | this.detailOptions.columns.forEach(x => { |
| | | if (x.field == 'materielCode' || x.field == 'batchNo' || x.field == 'orderQuantity' || x.field == 'locationCode') { |
| | | x.readonly = false |
| | | } |
| | | }); |
| | | } else { |
| | | this.detailOptions.columns.forEach(x => { |
| | | if (x.field == 'materielCode' || x.field == 'batchNo' || x.field == 'orderQuantity' || x.field == 'locationCode') { |
| | | x.readonly = true// row.orderStatus > 0 |
| | | } |
| | | }); |
| | | } |
| | | // if (row.orderStatus != '0') { |
| | | // this.detailOptions.columns.forEach(x => { |
| | | // if (x.field == 'materielCode' || x.field == 'batchNo' || x.field == 'orderQuantity') { |
| | | // x.readonly = row.orderStatus > 0 |
| | | // } |
| | | // }); |
| | | // } else { |
| | | // this.detailOptions.columns.forEach(x => { |
| | | // if (x.field == 'materielCode' || x.field == 'batchNo' || x.field == 'orderQuantity') { |
| | | // x.disabled = true; |
| | | // } |
| | | // }) |
| | | // } |
| | | } |
| | | } |
| | | }; |