TblTradeInquiryInfoList.vue 7.9 KB
<template>
  <div>

    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="true"
        :loading="loading"
      >

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text,record">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img
            v-else
            :src="getImgView(text)"
            :preview="record.id"
            height="25px"
            alt=""
            style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            下载
          </a-button>
        </template>

        <span slot="action" slot-scope="text, record">
          <div v-if="record.status == '1'" v-has="'inquiry:add'">
            <a @click="handleEdit(record)">编辑</a>
            <a-divider type="vertical" />
            <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
              <a>删除</a>
            </a-popconfirm>
          </div>

          <!-- <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>
    </div>

    <tbl-trade-inquiry-info-modal ref="modalForm" @ok="modalFormOk"></tbl-trade-inquiry-info-modal>
  </div>
</template>

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

  export default {
    name: 'TblTradeInquiryInfoList',
    mixins: [JeecgListMixin, mixinDevice],
    components: {
      TblTradeInquiryInfoModal
    },
    props: {
      record: {
        type: Object,
        default: null
      }
    },
    data () {
      return {
        description: '询价明细表管理页面',
        disableMixinCreated: true,
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function (t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            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:'关联招标id',
          //   align:"center",
          //   dataIndex: 'tradeId'
          // },
          {
            title: '操作',
            dataIndex: 'action',
            align: 'center',
            fixed: 'right',
            width: 147,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: '/trade/tblTradeInquiryInfo/list',
          delete: '/trade/tblTradeInquiryInfo/delete',
          deleteBatch: '/trade/tblTradeInquiryInfo/deleteBatch',
          exportXlsUrl: '/trade/tblTradeInquiryInfo/exportXls',
          importExcelUrl: 'trade/tblTradeInquiryInfo/importExcel'

        },
        dictOptions: {},
        superFieldList: []
      }
    },
    created() {
    this.getSuperFieldList()
    },
    computed: {
      importExcelUrl: function() {
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
      }
    },
    methods: {
      modalFormOk() {
        this.loadData(this.record)
      },
      // handleDelete(id){
      //    this.loadData(this.record)
      // },
      handleDelete: function (id) {
        if (!this.url.delete) {
          this.$message.error('请设置url.delete属性!')
          return
        }
        var that = this
        deleteAction(that.url.delete, { id: id }).then((res) => {
          if (res.success) {
            that.$message.success(res.message)
            that.loadData(that.record)
          } else {
            that.$message.warning(res.message)
          }
        })
      },
      initDictConfig() {
      },
      getSuperFieldList() {
        let fieldList = []

        this.superFieldList = fieldList
      },
      loadData(record) {
        this.loading = true
        this.dataSource = []
        getAction(this.url.list, {
          tradeId: record.id
        }).then((res) => {
          console.log(this.record)
          if (res.success) {
            console.log(this.record)
            res.result.records.forEach(e => {
              e.status = this.record.status
            })
            this.dataSource = res.result.records
          }
        }).finally(() => {
          this.loading = false
        })
      }
    },
    watch: {
      record: {
        immediate: true,
        handler() {
          if (this.record != null) {
            this.loadData(this.record)
          }
        }
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>