TblTradeInquiryInfoModal.vue 6.1 KB
<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    fullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    cancelText="关闭">

    <!-- 子表单区域 -->
    <a-tabs v-model="activeKey" @change="handleChangeTabs">
      <a-tab-pane tab="历史询价" :key="refKeys[0]" :forceRender="true">
        <a-table
          ref="table"
          size="middle"
          bordered
          rowKey="id"
          class="j-table-force-nowrap"
          :scroll="{x:true}"
          :columns="columns"
          :dataSource="dataSource"
          :pagination="true"
          :loading="loading"
        >

          <span slot="action" slot-scope="text, record">
            <a @click="handleReuse(record)">复用</a>

          </span>

        </a-table>
      </a-tab-pane>
      <a-tab-pane tab="新增询价" :key="refKeys[1]" :forceRender="true">
        <tbl-trade-inquiry-info-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" :tradeId="tradeId" :wlbm="wlbm"></tbl-trade-inquiry-info-form>
      </a-tab-pane>
    </a-tabs>

  </j-modal>
</template>

<script>

  import { getAction } from '@api/manage'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import TblTradeInquiryInfoForm from './TblTradeInquiryInfoForm'
  export default {
    name: 'TblTradeInquiryInfoModal',
    mixins: [JeecgListMixin],
    components: {
      TblTradeInquiryInfoForm
    },
    props: {
      model: {
        type: Object,
        default: null
      }
    },
    data () {
      return {
        title: '',
        width: 896,
        visible: false,
        disableSubmit: false,
        tradeId: '',
        wlbm: '',
        disableMixinCreated: true,
        refKeys: ['history', 'add' ],
        activeKey: 'history',
        // 表头
        columns: [
          {
            title: '供货商名称',
            align: 'center',
            dataIndex: 'ghsmc'
          },
          // {
          //   title:'电话',
          //   align:"center",
          //   dataIndex: 'tel'
          // },
          // {
          //   title:'网络链接地址',
          //   align:"center",
          //   dataIndex: 'wldz'
          // },
          // {
          //   title:'微信号',
          //   align:"center",
          //   dataIndex: 'wxh'
          // },
          {
            title: '专票单价',
            align: 'center',
            dataIndex: 'zpdj'
          },
          {
            title: '专票税率(%)',
            align: 'center',
            dataIndex: 'zpsl'
          },
          {
            title: '普票单价',
            align: 'center',
            dataIndex: 'ppdj'
          },
          {
            title: '普票税率(%)',
            align: 'center',
            dataIndex: 'ppsl'
          },
          {
            title: '无票单价',
            align: 'center',
            dataIndex: 'wpdj'
          },
          {
            title: '是否含运费',
            align: 'center',
            dataIndex: 'sfhyf'
          },
          {
            title: '运费',
            align: 'center',
            dataIndex: 'yf'
          },
          {
            title: '发货地址',
            align: 'center',
            dataIndex: 'fhdz'
          },
          {
            title: '最小出货量',
            align: 'center',
            dataIndex: 'zxchl'
          },
          {
            title: 'L/T(交货周期天)',
            align: 'center',
            dataIndex: 'jhzqt'
          },
          {
            title: '价格评价',
            align: 'center',
            dataIndex: 'jgpj'
          },
          // {
          //   title: '是否需要重新询价',
          //   align: 'center',
          //   dataIndex: 'sfxycxxj',
          //   customRender: (text, record) => {
          //     if (text == 'Y') {
          //       return '是'
          //     } else if (text == 'N') {
          //       return '否'
          //     }
          //   }
          // },
          // {
          //   title: '原因/备注',
          //   align: 'center',
          //   dataIndex: 'bz'
          // },
          {
            title: '操作',
            dataIndex: 'action',
            align: 'center',
            fixed: 'right',
            width: 147,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: '/trade/tblTradeInquiryInfo/list'
        }

      }
    },
    methods: {
      add () {
        // 默认当前tab页为历史页
        this.activeKey = this.refKeys['0']
        this.visible = true
        this.$nextTick(() => {
          this.loadData()
          this.$refs.realForm.add()
        })
      },
      edit (record) {
        // 默认当前tab页为新增页
        this.activeKey = this.refKeys['1']
        this.visible = true
        this.$nextTick(() => {
          this.loadData()
          this.$refs.realForm.edit(record)
        })
      },
      close () {
        this.$emit('close')
        this.visible = false
      },
      handleOk () {
        this.$refs.realForm.submitForm()
      },
      submitCallback() {
        this.$emit('ok')
        this.visible = false
      },
      handleCancel () {
        this.close()
      },
      handleChangeTabs(activeKey) {
      },
      handleReuse(record) {
        let model = { ...record }
        delete model.id
        delete model.createBy
        delete model.createTime
        delete model.updateBy
        delete model.updateTime
        delete model.sysOrgCode
        delete model.jgpj
        delete model.sfxycxxj
        delete model.bz
        delete model.tradeId
        console.log(model)
        this.$refs.realForm.edit(model)
        this.activeKey = this.refKeys['1']
      },
      loadData(record) {
        this.loading = true
        this.dataSource = []
        getAction(this.url.list, { wlbm: this.wlbm }).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records
          }
        }).finally(() => {
          this.loading = false
        })
      }
    }
  }
</script>