TblTradeTenderInfoSubTable.vue 10.5 KB
<template>
  <div>
    <a-table
      ref="table1"
      rowKey="id"
      size="middle"
      :scroll="{x:true}"
      bordered
      :loading="loading"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="ipagination"
      @change="handleTableChange"
    >

      <!-- 内嵌table区域 begin -->
      <template slot="expandedRowRender" slot-scope="record">
        <TblTradeInquiryInfoList :record="record" />
      </template>
      <!-- 内嵌table区域 end -->

      <template slot="htmlSlot" slot-scope="text">
        <div v-html="text"></div>
      </template>

      <template slot="imgSlot" slot-scope="text,record">
        <div style="font-size: 12px;font-style: italic;">
          <span v-if="!text">无图片</span>
          <img v-else :src="getImgView(text)" :preview="record.id" alt="" style="max-width:80px;height:25px;" />
        </div>
      </template>

      <template slot="fileSlot" slot-scope="text">
        <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
        <a-button
          v-else
          ghost
          type="primary"
          icon="download"
          size="small"
          @click="downloadFile(text)">
          <span>下载</span>
        </a-button>
      </template>

      <span slot="action" slot-scope="text, record">
        <!-- 状态:1-询价中,2-询价审批中,3-询价审批通过 -->
        <div v-if="record.status == '1'" v-has="'inquiry:add'">
          <a @click="handleAdd(record)">询价</a>
          <a-divider type="vertical" />
          <!-- <a @click="handleSubmit(record)">提交</a> -->
          <a-popconfirm title="确定提交吗?" @confirm="() => handleSubmit(record)">
            <a>提交</a>
          </a-popconfirm>
        </div>

        <a @click="handleApproval(record)" v-has="'inquiry:approval'" v-if="record.status == '2'">审批</a>

        <!-- <a-divider type="vertical" />
        <a-dropdown>
          <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
          <a-menu slot="overlay">
            <a-menu-item>
              <a @click="handleDetail(record)">详情</a>
            </a-menu-item>
            <a-menu-item>
              <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                <a>删除</a>
              </a-popconfirm>
            </a-menu-item>
          </a-menu>
        </a-dropdown> -->
      </span>
    </a-table>

    <tbl-trade-inquiry-info-modal ref="modalForm" @ok="modalFormOk" ></tbl-trade-inquiry-info-modal>
    <tbl-trade-bid-sub-modal ref="approvalModalForm" @ok="modalFormOk" :formType="'sp'"/>
  </div>
</template>

<script>
  import { getAction, postAction } from '@api/manage'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { mixinDevice } from '@/utils/mixin'
  import TblTradeInquiryInfoList from '../TblTradeInquiryInfoList'
  import '@/assets/less/TableExpand.less'
  import TblTradeInquiryInfoModal from '../modules/TblTradeInquiryInfoModal'
  import TblTradeBidSubModal from '../modules/TblTradeBidSubModal'

  export default {
    name: 'TblTradeTenderInfoSubTable',
    mixins: [JeecgListMixin, mixinDevice],
    components: {
      TblTradeInquiryInfoList,
      TblTradeInquiryInfoModal,
      TblTradeBidSubModal
    },
    props: {
      record: {
        type: Object,
        default: null
      }
    },
    data() {
      return {
        description: '贸易招标信息内嵌列表',
        disableMixinCreated: true,
        loading: false,
        dataSource: [],
        columns: [
          // {
          //   title: '询价标书文件号',
          //   align: 'center',
          //   dataIndex: 'xjbswjh',
          // },
          {
            title: '物料编码',
            align: 'center',
            dataIndex: 'code'
          },
          {
            title: '标段(包)名称',
            align: 'center',
            dataIndex: 'tenderName'
          },
          {
            title: '物料长描述',
            align: 'center',
            dataIndex: 'miaoshu'
          },
          {
            title: '品牌',
            align: 'center',
            dataIndex: 'pinpai'
          },
          {
            title: '计量单位',
            align: 'center',
            dataIndex: 'jldw'
          },
          {
            title: '需求数量',
            align: 'center',
            dataIndex: 'xqsl'
          },
          {
            title: '需求交货期',
            align: 'center',
            dataIndex: 'xqjhq'
          },
          {
            title: '需求单位',
            align: 'center',
            dataIndex: 'xqdw'
          },
          {
            title: '备注',
            align: 'center',
            dataIndex: 'bz'
          },
          // {
          //   title: '税率',
          //   align: 'center',
          //   dataIndex: 'sl',
          // },
          // {
          //   title: '响应单价',
          //   align: 'center',
          //   dataIndex: 'xydj',
          // },
          // {
          //   title: '响应数量',
          //   align: 'center',
          //   dataIndex: 'xysl',
          // },
          // {
          //   title: '响应交货期',
          //   align: 'center',
          //   dataIndex: 'xyjhq',
          // },
          // {
          //   title: '响应说明',
          //   align: 'center',
          //   dataIndex: 'xysm',
          // },
          // {
          //   title: '响应品牌',
          //   align: 'center',
          //   dataIndex: 'xypp',
          // },
          // {
          //   title: '响应币种',
          //   align: 'center',
          //   dataIndex: 'xybz',
          // },
          // {
          //   title: '交货期否决项',
          //   align: 'center',
          //   dataIndex: 'jhqfjx',
          // },
          // {
          //   title: '付款方式否决项',
          //   align: 'center',
          //   dataIndex: 'fkfsfjx',
          // },
          // {
          //   title: '规格型号否决项',
          //   align: 'center',
          //   dataIndex: 'ggxhfjx',
          // },
          // {
          //   title: '品牌否决项',
          //   align: 'center',
          //   dataIndex: 'ppfjx',
          // },

          // {
          //   title: '询价标书文件号',
          //   align: 'center',
          //   dataIndex: 'xjbswjh',
          // },
          // {
          //   title: '项目类型',
          //   align: 'center',
          //   dataIndex: 'xmlx',
          // },
          // {
          //   title: '送货地址',
          //   align: 'center',
          //   dataIndex: 'shdz'
          // },
          // {
          //   title: '优先等级',
          //   align: 'center',
          //   dataIndex: 'yxdj'
          // },
          // {
          //   title: '询价计划完成日期',
          //   align: 'center',
          //   dataIndex: 'xjjhwcsj'
          // },
          // {
          //   title: '标的类型',
          //   align: 'center',
          //   dataIndex: 'bdlx'
          // },
          {
            title: '库存数据',
            align: 'center',
            dataIndex: 'kcsj'
          },
          {
            title: '在途库存',
            align: 'center',
            dataIndex: 'ztkc'
          },
          {
            title: '最近中标单价',
            align: 'center',
            dataIndex: 'zjzbdj'
          },
          // {
          //   title: '中标次数',
          //   align: 'center',
          //   dataIndex: 'zbcs'
          // },
          {
            title: '最后一次中标时间',
            align: 'center',
            dataIndex: 'zhzbsj'
          },
          // {
          //   title: '最后一次未中标时间',
          //   align: 'center',
          //   dataIndex: 'zhwzbsj'
          // },
          {
            title: '操作',
            dataIndex: 'action',
            align: 'center',
            width: 147,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: '/trade/tblTradePriceInquiry/queryTblTradeTenderInfoByMainId',
          submit: '/trade/tblTradeTenderInfo/submit',
          getBidSubData: '/trade/tblTradeBidSub/getBidSubData'
        },
        /* 分页参数 */
        ipagination: {
          current: 1,
          pageSize: 5,
          pageSizeOptions: ['5', '10', '20', '30'],
          showTotal: (total, range) => {
            return range[0] + '-' + range[1] + ' 共' + total + '条'
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        }
      }
    },
    watch: {
      record: {
        immediate: true,
        handler() {
          if (this.record != null) {
            this.loadData(this.record)
          }
        }
      }
    },
    methods: {
      modalFormOk() {
        this.loadData(this.record)
        this.$emit('refresh')
      },
      handleAdd(record) {
        this.$refs.modalForm.tradeId = record.id
        this.$refs.modalForm.wlbm = record.code
        this.$refs.modalForm.add()
        this.$refs.modalForm.title = '询价'
        this.$refs.modalForm.disableSubmit = false
      },
      loadData(record) {
        this.loading = true
        this.dataSource = []
        getAction(this.url.list, {
          id: record.xjbswjh
        }).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records
          }
        }).finally(() => {
          this.loading = false
        })
      },
      handleTableChange(pagination, filters, sorter) {
        // 分页、排序、筛选变化时触发
        // TODO 筛选
        if (Object.keys(sorter).length > 0) {
          this.isorter.column = sorter.field
          this.isorter.order = sorter.order == 'ascend' ? 'asc' : 'desc'
        }
        this.ipagination = pagination
        // this.loadData(this.record);
      },
      handleApproval(record) {
        postAction(this.url.getBidSubData, { tradeId: record.id }).then(res => {
          if (res.success) {
            console.log(res)
            this.$refs.approvalModalForm.edit(res.result)
          } else {
            this.$message.error(res.message)
          }
        })
      },
      handleSubmit(record) {
        postAction(this.url.submit, record).then(res => {
          if (res.success) {
            this.$message.success(res.message)
            this.loadData(this.record)
            this.$emit('refresh')
          } else {
            this.$message.error(res.message)
          }
        })
      }
    }
  }
</script>

<style scoped>

</style>