import { goodsPurchaseDetail } from '@/api/goodsPurchasedStored.js' import { commonTemplateDownload } from '@/api/common.js' export default { data() { return {} }, computed: { formItems2() { return [ { md: 24, isShow: true, name: 'slot-component', formItemAttributes: { label: '', prop: '', 'label-width': '0px' }, render: (h, { props, onInput }) => { var { value } = props return (
{this.activeName == 'goodsInfo' ? [ !!~[0,1].indexOf(this.formDialogType) ? (
添加
) : this.formDialogType == 1 && this.joinCode ? (
下载导入模板
) : null, ] : this.activeName == 'codeInfo' && this.joinCode ? [ !!~[0,1].indexOf(this.formDialogType) ? (
添加
) : null, ] : null}
) } } ] } }, watch: { activeName(newVal) { this.isEditIndex = -1 if (newVal == 'codeInfo') { // 获取单据下的条码 this.getGoodsPurchaseCodeList() } else { if (this.formData.id) { // 更新表单信息 goodsPurchaseDetail({ id: this.formData.id }).then(res => { Object.assign(this.formData, res.data, { fileUrl: res.data.fileUrl ? [{ url: res.data.fileUrl }] : [], items: res.data.items.map(item => ({ ...item, details: {} })) }) }) } // 清空条码数据列表 this.formData.codeInfoList = [] } } }, methods: { domlMban() { commonTemplateDownload({ name: '商品采购条码模板.xlsx' }, `${this.$route.meta.title}`) .then(res => { this.$message({ message: '下载成功', type: 'success' }) }) .catch(err => { this.$message.error('下载失败') }) } } }