import { required, diyRequired } from '@/components/template/rules_verify.js' import { listPageV2 } from '@/api/auxiliaryFittings/supplier' import { goodsPurchaseList, goodsPurchaseDetail } from '@/api/goodsPurchasedStored.js' import { storageListPageV2 } from '@/api/storage.js' import ImageUpload from '@/components/file-upload' export default { data() { return { gysList: [], warehouseList: [], cgrkOrder: [] } }, computed: { formItems() { return [ { md: 24, isShow: true, name: 'slot-component', formItemAttributes: { label: '', prop: '', 'label-width': '0px' }, render: (h, { props, onInput }) => { var { value } = props return (
{{ SAVE: '保存', WAIT: '待审核', OK: '通过', FAIL: '失败' }[this.formData.status] || ''} {this.formData.id || ''} {JSON.parse(localStorage.getItem('greemall_user')).companyName}
{ if(this.logs){ this.logs.push({errMsg:`*供应商名称不能为空`}) } this?.tishicuowu?.() return new Error('必须填写') })]}> { this.formData.venderId = val }} placeholder="请选择" disabled={!!~['WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)} onChange={val => { if (val) { this.formData['venderName'] = this.gysList.find(item => item.venderId == val).venderName } else { this.formData['venderName'] = '' } if (!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name)) { this.formData.goodsPurchaseId = '' this.cgrkOrder = [] this.formData.items = [] this.getCgrkOrder() } }} > {this.gysList.map(item => ( ))}
{ this.formData.storageId = val }} placeholder="请选择" disabled={!!~['WAIT', 'OK', 'FAIL'].indexOf(this.formData.status) || !!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name) || JSON.parse(localStorage.getItem('greemall_user')).joinCode === "NO"} onChange={val => { if (val) { this.formData['storageName'] = this.warehouseList.find(item => item.storageId == val).storageName } else { this.formData['storageName'] = '' } }} > {this.warehouseList.map(item => ( ))}
{!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name) ? (
{ if(this.logs){ this.logs.push({errMsg:`*采购入库单不能为空`}) } this?.tishicuowu?.() return new Error('必须填写') })]}> { this.formData.goodsPurchaseId = val }} placeholder="请选择" disabled={!!~['WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)} filterable={true} clearable={true} onChange={val => { this.formData.items = [] if (val) { goodsPurchaseDetail({ id: val, isQuery: true }).then(res => { this.joinCode = res.data.joinCode === "CODE" this.formData.storageId = res.data.storageId this.formData.storageName = res.data.storageName this.getWarehouseList() this.formData.items = res.data.items.map(item => ({ brandId: item.brandId, brandName: item.brandName, mainId: item.mainId, mainName: item.mainName, smallId: item.smallId, smallName: item.smallName, goodsMaterialId: item.goodsMaterialId, goodsMaterialName: item.goodsMaterialName, specsName: item.specsName, unit: item.unit, insideQty: item.insideQty, outQty: item.outQty, partsQty: item.partsQty, qty: item.qty, price: item.price, amount: item.amount, stockQty: item.stockQty, factoryNo: item.factoryNo, retQty: '', retInsideQty: '', retOutQty: '', retPartsQty: '', insideCodeQty: '', outCodeQty: '', partsCodeQty: '', retAmount: '', details: {} })) }) } }} > {this.cgrkOrder.map(item => ( ))}
) : ( )}
{!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name) ? [ {this.formData.totalQty}, {this.formData.totalAmount}, , ] : null} {this.formData.createBy} {this.formData.createTime} {this.formData.examineBy} {this.formData.examineTime} { this.formData.remark = val }} maxlength="200" show-word-limit autosize={{ minRows: 2, maxRows: 4 }} disabled={!!~['WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)} >
) } } ] } }, methods: { // 获取供应商列表 getGysList() { listPageV2({ pageNum: 1, pageSize: -1, params: [ { param: 'a.status', compare: '=', value: 'ON' }, { param: 'a.vender_type', compare: 'like', value: '商品' } ] }).then(res => { this.gysList = res.data.records }) }, getCgrkOrder() { if (this.formData.venderId) { goodsPurchaseList({ pageNum: 1, pageSize: -1, params: [ { param: 'a.vender_id', compare: '=', value: this.formData.venderId }, { "param": "a.status", "compare": "=", "value": "OK" } ] }).then(res => { this.cgrkOrder = res.data.records if (this.formData.goodsPurchaseId) { goodsPurchaseDetail({ id: this.formData.goodsPurchaseId, isQuery: true }).then(res => { this.joinCode = res.data.joinCode === "CODE" }) } }) } }, getWarehouseList(){ storageListPageV2({ pageNum: 1, pageSize: -1, params: [{param: "a.type", compare: "like", value: "商品"}] }).then(res => { if(JSON.parse(localStorage.getItem('greemall_user')).joinCode != "NO"){ this.formData.storageId = res.data.records[0].storageId this.formData.storageName = res.data.records[0].storageName } this.warehouseList = res.data.records }) } } }