| | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | import gridBody from './extend/materielcodeprintView.vue' |
| | | import modelHeader from './extend/materielcodeSelectView.vue' |
| | | import modelBody from './extend/purchaseOrderNoSelectView.vue' |
| | | import modelFooter from './extend/GetOrderQuantityView.vue' |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | |
| | | gridBody: gridBody, |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | modelHeader: modelHeader, |
| | | modelBody: modelBody, |
| | | modelFooter: modelFooter |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | |
| | | let day = String(date.getDate()).padStart(2, "0"); |
| | | return year + "-" + month + "-" + day; |
| | | }, |
| | | // æ°å¢æ¹æ³ï¼å è½½ç©æç¼å·æ°æ® |
| | | async loadMaterielCodes(option) { |
| | | try { |
| | | option.loading = true; |
| | | const { page, pageSize, keyword } = option.pagination; |
| | | const res = await this.http.post("/api/PurchaseOrderDetail/GetPurchaseOrderDetailMaterielCode", { |
| | | warehouseId: this.editFormFields.warehouseId, |
| | | keyword, |
| | | page, |
| | | pageSize |
| | | }, true); |
| | | |
| | | if (res.status) { |
| | | option.pagination.total = res.total || res.data.length; |
| | | const newData = res.data.map(item => ({ key: item, value: item })); |
| | | option.data = page === 1 ? newData : [...option.data, ...newData]; |
| | | } |
| | | } catch (error) { |
| | | this.$error("æ°æ®å 载失败"); |
| | | } finally { |
| | | option.loading = false; |
| | | } |
| | | }, |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { //æ¡æ¶åå§åé
ç½®åï¼ |
| | | this.$nextTick(() => { |
| | | let warehouseIdOption = this.getOption("warehouseId"); |
| | | let materielCodeOption = this.getOption("materielCode"); |
| | | let purchaseOrderNoOption = this.getOption("purchaseOrderNo"); |
| | | let materielQueryOption = this.getOption("materielQuery"); |
| | | warehouseIdOption.onChange = (val, option) => { |
| | | this.editFormFields.materielCode = ""; |
| | | materielCodeOption.data = []; |
| | | this.editFormFields.purchaseOrderNo = ""; |
| | | purchaseOrderNoOption.data = []; |
| | | if (val == null || val == 0) { |
| | | return this.$error("è¯·éæ©ä»åºï¼") |
| | | } |
| | | this.http.post("/api/PurchaseOrderDetail/GetPurchaseOrderDetailMaterielCode?warehouseId=" + val, {}, true).then( |
| | | source => { |
| | | if (!source.status) return this.$error(source.message); |
| | | this.$nextTick(() => { |
| | | this.editFormOptions.forEach((option) => { |
| | | option.forEach((item) => { |
| | | if (item.field == 'materielCode') { |
| | | //åå§åå¼¹åºæ¡éæ©å¨é
ç½® |
| | | item.extra = { |
| | | icon: 'el-icon-zoom-out', //æ¾ç¤ºå¾æ |
| | | text: 'éæ©æ°æ®', //æ¾ç¤ºææ¬ |
| | | style: 'color: #3a8ee6;font-size: 13px;cursor: pointer;', |
| | | //触åäºä»¶ |
| | | click: (item) => { |
| | | this.$refs.modelHeader.open(this.editFormFields.warehouseId); |
| | | } |
| | | }; |
| | | } |
| | | }); |
| | | }); |
| | | this.editFormOptions.forEach((option) => { |
| | | option.forEach((item) => { |
| | | if (item.field == 'purchaseOrderNo') { |
| | | //åå§åå¼¹åºæ¡éæ©å¨é
ç½® |
| | | item.extra = { |
| | | icon: 'el-icon-zoom-out', //æ¾ç¤ºå¾æ |
| | | text: 'éæ©æ°æ®', //æ¾ç¤ºææ¬ |
| | | style: 'color: #3a8ee6;font-size: 13px;cursor: pointer;', |
| | | //触åäºä»¶ |
| | | click: (item) => { |
| | | this.$refs.modelBody.open(this.editFormFields.materielCode); |
| | | } |
| | | }; |
| | | } |
| | | }); |
| | | }); |
| | | this.editFormOptions.forEach((option) => { |
| | | option.forEach((item) => { |
| | | if (item.field == 'quantity') { |
| | | //åå§åå¼¹åºæ¡éæ©å¨é
ç½® |
| | | item.extra = { |
| | | icon: 'el-icon-zoom-out', //æ¾ç¤ºå¾æ |
| | | text: 'éè´åæå¤§æ°é', //æ¾ç¤ºææ¬ |
| | | style: 'color: #3a8ee6;font-size: 13px;cursor: pointer;', |
| | | //触åäºä»¶ |
| | | click: (item) => { |
| | | this.$refs.modelFooter.open(this.editFormFields.purchaseOrderNo); |
| | | } |
| | | }; |
| | | } |
| | | }); |
| | | }); |
| | | // warehouseIdOption.onChange = (val, option) => { |
| | | // this.editFormFields.materielCode = ""; |
| | | // materielCodeOption.data = []; |
| | | // this.editFormFields.purchaseOrderNo = ""; |
| | | // purchaseOrderNoOption.data = []; |
| | | // if (val == null || val == 0) { |
| | | // return this.$error("è¯·éæ©ä»åºï¼") |
| | | // } |
| | | // this.http.post("/api/PurchaseOrderDetail/GetPurchaseOrderDetailMaterielCode?warehouseId=" + val, {}, true).then( |
| | | // source => { |
| | | // if (!source.status) return this.$error(source.message); |
| | | // this.$nextTick(() => { |
| | | |
| | | for (let i = 0; i < source.data.length; i++) { |
| | | materielCodeOption.data.push({ key: source.data[i], value: source.data[i] }) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | materielCodeOption.onChange = (val, option) => { |
| | | this.editFormFields.purchaseOrderNo = ""; |
| | | purchaseOrderNoOption.data = []; |
| | | if (val == null || val == 0) { |
| | | return this.$error("è¯·éæ©ç©æç¼å·ï¼") |
| | | } |
| | | this.http.post("/api/PurchaseOrderDetail/GetPurchaseOrderNos?materielCode=" + val, {}, true).then( |
| | | source => { |
| | | if (!source.status) return this.$error(source.message); |
| | | this.$nextTick(() => { |
| | | for (let i = 0; i < source.data.length; i++) { |
| | | purchaseOrderNoOption.data.push({ key: source.data[i], value: source.data[i] }) |
| | | } |
| | | }); |
| | | }) |
| | | } |
| | | // for (let i = 0; i < source.data.length; i++) { |
| | | // materielCodeOption.data.push({ key: source.data[i], value: source.data[i] }) |
| | | // } |
| | | // }) |
| | | // }) |
| | | // } |
| | | // materielCodeOption.onChange = (val, option) => { |
| | | // this.editFormFields.purchaseOrderNo = ""; |
| | | // purchaseOrderNoOption.data = []; |
| | | // if (val == null || val == 0) { |
| | | // return this.$error("è¯·éæ©ç©æç¼å·ï¼") |
| | | // } |
| | | // this.http.post("/api/PurchaseOrderDetail/GetPurchaseOrderNos?materielCode=" + val, {}, true).then( |
| | | // source => { |
| | | // if (!source.status) return this.$error(source.message); |
| | | // this.$nextTick(() => { |
| | | // for (let i = 0; i < source.data.length; i++) { |
| | | // purchaseOrderNoOption.data.push({ key: source.data[i], value: source.data[i] }) |
| | | // } |
| | | // }); |
| | | // }) |
| | | // } |
| | | }); |
| | | |
| | | this.columns.push({ |
| | |
| | | let year = date.getFullYear(); |
| | | let month = String(date.getMonth() + 1).padStart(2, "0"); |
| | | let day = String(date.getDate()).padStart(2, "0"); |
| | | this.editFormFields.lotNo = year + month + day; |
| | | let hour= String(date.getHours()).padStart(2, "0"); |
| | | let minute= String(date.getMinutes()).padStart(2, "0"); |
| | | let second= String(date.getSeconds()).padStart(2, "0"); |
| | | //å°yearæªååä¸¤ä½ |
| | | this.editFormFields.lotNo = (year.toString().substr(-2)) + month+day + hour + minute+second; |
| | | this.editFormFields.productionDate = year + "-" + month + "-" + day; |
| | | this.editFormFields.effectiveDate = year + 2 + "-" + month + "-" + day; |
| | | } |