123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- 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 (
- <div>
- {this.activeName == 'goodsInfo'
- ? [
- !!~[0,1].indexOf(this.formDialogType) ? (
- <div style="margin-bottom:10px">
- <el-button type="primary" onClick={this.addGoodsInfo}>
- 添加
- </el-button>
- </div>
- ) : this.formDialogType == 1 && this.joinCode ? (
- <div style="margin-bottom:10px">
- <el-button type="primary" onClick={this.domlMban}>
- 下载导入模板
- </el-button>
- </div>
- ) : null,
- <zj-table
- columns={this.storage_goods}
- tableData={this.formData.items}
- tableAttributes={{
- size: 'mini',
- border: true
- }}
- />
- ]
- : this.activeName == 'codeInfo' && this.joinCode
- ? [
- !!~[0,1].indexOf(this.formDialogType) ? (
- <div style="margin-bottom:10px">
- <el-button type="primary" onClick={this.addCodeInfo} disabled={this.isEditIndex != -1}>
- 添加
- </el-button>
- </div>
- ) : null,
- <zj-table
- columns={this.storage_codes}
- tableData={this.formData.codeInfoList}
- tableAttributes={{
- size: 'mini',
- border: true
- }}
- />
- ]
- : null}
- </div>
- )
- }
- }
- ]
- }
- },
- 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('下载失败')
- })
- }
- }
- }
|