import { required } from '@/components/template/rules_verify.js' import { listPageV2 } from '@/api/auxiliaryFittings/supplier' import { goodsPurchaseList, goodsPurchaseDetail } from '@/api/goodsPurchasedStored.js' import ImageUpload from '@/components/file-upload' export default { data() { return { gysList: [], 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}
{ this.formData.venderId = val }} placeholder="请选择" disabled={!!~['SAVE', 'WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)} onChange={val => { if (val) { this.formData['venderName'] = this.gysList.find(item => item.venderId == val).venderName if (!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name)) { this.cgrkOrder = [] this.formData.items = [] this.getCgrkOrder() } } else { this.formData['venderName'] = '' if (!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name)) { this.cgrkOrder = [] this.formData.items = [] this.formData.goodsPurchaseId = '' } } }} > {this.gysList.map(item => ( ))}
{!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name) ? (
{ this.formData.goodsPurchaseId = val }} placeholder="请选择" disabled={!!~['SAVE', 'WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)} filterable={true} clearable={true} onChange={val => { this.formData.items = [] if (val) { goodsPurchaseDetail({ id: val }).then(res => { 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, 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={!!~['SAVE', '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 }] }).then(res => { this.cgrkOrder = res.data.records console.log(res.data.records) }) } } } }