TblTradeInquiryApprovalForm.vue 14.1 KB
<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
      <!-- 主表单区域 -->
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
        <a-row>
          <!-- <a-col :span="6" >
            <a-form-model-item label="询价标书文件号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xjbswjh">
              <a-input v-model="model.xjbswjh" disabled ></a-input>
            </a-form-model-item>
          </a-col> -->
          <a-col :span="6" >
            <a-form-model-item label="物料编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="code">
              <a-input v-model="model.tenderInfo.code" disabled></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="标段(包)名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tenderName">
              <a-input v-model="model.tenderInfo.tenderName" disabled></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="物料长描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="miaoshu">
              <a-input v-model="model.tenderInfo.miaoshu" disabled></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="品牌" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pinpai">
              <a-input v-model="model.tenderInfo.pinpai" disabled></a-input>
            </a-form-model-item>
          </a-col>

          <a-col :span="6" >
            <a-form-model-item label="计量单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jldw">
              <a-input v-model="model.tenderInfo.jldw" disabled></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="需求数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xqsl">
              <a-input v-model="model.tenderInfo.xqsl" disabled></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="需求交货期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xqjhq">
              <j-date v-model="model.tenderInfo.xqjhq" style="width: 100%" disabled/>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="需求单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xqdw">
              <a-input v-model="model.tenderInfo.xqdw" disabled ></a-input>
            </a-form-model-item>
          </a-col>

          <a-col :span="6" >
            <a-form-model-item label="库存数据" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="kcsj">
              <a-input v-model="model.kcsj" disabled ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="在途库存" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ztkf">
              <a-input v-model="model.ztkf" disabled></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="最近中标单价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zjzbdj">
              <a-input v-model="model.zjzbdj" disabled></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="最后一次中标时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zhzbsj">
              <a-input v-model="model.zhzbsj" disabled></a-input>
            </a-form-model-item>
          </a-col>

          <a-col :span="6" :offset="18">
            <a-form-model-item label="投标参考价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tbjg">
              <a-input-number v-model="model.tbjg" placeholder="投标参考价" style="width: 14vw" ></a-input-number>
            </a-form-model-item>
          </a-col>
          <!-- <a-col :span="6" >
            <a-form-model-item label="中标价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zbj">
              <a-input v-model="model.zbj" placeholder="请输入中标价" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="单价差异" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="djchay">
              <a-input v-model="model.djchay" placeholder="请输入单价差异" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sl">
              <a-input v-model="model.sl" placeholder="请输入数量" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sj">
              <a-input v-model="model.sj" placeholder="请输入时间" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="是否中标" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sfzb">
              <a-input v-model="model.sfzb" placeholder="请输入是否中标" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="是否已采购完成" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sfcgwc">
              <a-input v-model="model.sfcgwc" placeholder="请输入是否已采购完成" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="交货时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jhsj">
              <a-input v-model="model.jhsj" placeholder="请输入交货时间" ></a-input>
            </a-form-model-item>
          </a-col> -->
        </a-row>
      </a-form-model>
    </j-form-container>
    <!-- 子表单区域 -->
    <!-- <a-tabs v-model="activeKey" @change="handleChangeTabs">
      <a-tab-pane tab="询价明细表" :key="refKeys[0]" :forceRender="true">
        <j-vxe-table
          keep-source
          :ref="refKeys[0]"
          :loading="tblTradeInquiryInfoTable.loading"
          :columns="tblTradeInquiryInfoTable.columns"
          :dataSource="tblTradeInquiryInfoTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :toolbar="true"
          />
      </a-tab-pane>
    </a-tabs> -->
    <j-vxe-table
      keep-source
      :ref="refKeys[0]"
      :loading="tblTradeInquiryInfoTable.loading"
      :columns="tblTradeInquiryInfoTable.columns"
      :dataSource="tblTradeInquiryInfoTable.dataSource"
      :maxHeight="300"
      :disabled="formDisabled"
      :rowNumber="true"
      :rowSelection="false"
      :toolbar="false"
    />
  </a-spin>
</template>

<script>

  import { getAction } from '@/api/manage'
  import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
  import { JVXETypes } from '@/components/jeecg/JVxeTable'
  import { getRefPromise, VALIDATE_FAILED } from '@/components/jeecg/JVxeTable/utils/vxeUtils.js'
  import { validateDuplicateValue } from '@/utils/util'
  import JFormContainer from '@/components/jeecg/JFormContainer'

  export default {
    name: 'TblTradeInquiryApprovalForm',
    mixins: [JVxeTableModelMixin],
    components: {
      JFormContainer
    },
    data() {
      return {
        labelCol: {
          xs: { span: 24 },
          sm: { span: 8 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 14 }
        },
        model: {
          tenderInfo: {}
         },
        // 新增时子表默认添加几行空数据
        addDefaultRowNum: 1,
        validatorRules: {
          tbjg: [{ required: true, message: '请输入数据!' }]
        },
        refKeys: ['tblTradeInquiryInfo' ],
        tableKeys: ['tblTradeInquiryInfo' ],
        activeKey: 'tblTradeInquiryInfo',
        // 询价明细表
        tblTradeInquiryInfoTable: {
          loading: false,
          dataSource: [],
          columns: [
            {
              title: '供货商名称',
              key: 'ghsmc',
               type: JVXETypes.input,
               disabled: true,
              width: '200px',
              defaultValue: ''
            },
            {
              title: '专票单价',
              key: 'zpdj',
               type: JVXETypes.input,
               disabled: true,
              width: '120px',
              defaultValue: ''
            },
            {
              title: '专票税率(%)',
              key: 'zpsl',
               type: JVXETypes.input,
               disabled: true,
              width: '120px',
              defaultValue: ''
            },
            {
              title: '普票单价',
              key: 'ppdj',
               type: JVXETypes.input,
               disabled: true,
              width: '120px',
              defaultValue: ''
            },
            {
              title: '普票税率(%)',
              key: 'ppsl',
               type: JVXETypes.input,
               disabled: true,
              width: '120px',
              defaultValue: ''
            },
            {
              title: '无票单价',
              key: 'wpdj',
               type: JVXETypes.input,
               disabled: true,
              width: '120px',
              defaultValue: ''
            },
            {
              title: '是否含运费',
              key: 'sfhyf',
               type: JVXETypes.input,
               disabled: true,
              width: '120px',
              defaultValue: ''
            },
            {
              title: '运费',
              key: 'yf',
               type: JVXETypes.input,
               disabled: true,
              width: '120px',
              defaultValue: ''
            },
            {
              title: '发货地址',
              key: 'fhdz',
               type: JVXETypes.input,
               disabled: true,
              width: '200px',
              defaultValue: ''
            },
            {
              title: '最小出货量',
              key: 'zxchl',
               type: JVXETypes.input,
               disabled: true,
              width: '120px',
              defaultValue: ''
            },
            {
              title: 'L/T(交货周期天)',
              key: 'jhzqt',
               type: JVXETypes.input,
               disabled: true,
              width: '160px',
              defaultValue: ''
            },
            {
              title: '价格评价',
              key: 'jgpj',
              type: JVXETypes.select,
              options: [{ value: '最佳', text: '最佳' }, { value: '优选', text: '优选' }, { value: '一般', text: '一般' }],
              width: '100px',
              validateRules: [{ required: true, message: '请选择${title}!' }],
              placeholder: '请选择${title}'
            },
            {
              title: '是否需要重新询价',
              key: 'sfxycxxj',
              type: JVXETypes.select,
              options: [],
              dictCode: 'is_open',
              width: '200px',
              validateRules: [{ required: true, message: '请选择${title}!' }],
              placeholder: '请选择${title}'
            },
            {
              title: '原因/备注',
              key: 'bz',
               type: JVXETypes.input,
              width: '200px',
              placeholder: '请输入${title}',
              defaultValue: ''
            }
            // {
            //   title: '关联招标id',
            //   key: 'tradeId',
            //    type: JVXETypes.input,
            //   width:"200px",
            //   placeholder: '请输入${title}',
            //   defaultValue:'',
            // },
          ]
        },
        url: {
          add: '/trade/tblTradeBidSub/add',
          edit: '/trade/tblTradeBidSub/inquiryApproval',
          queryById: '/trade/tblTradeBidSub/queryById',
          tblTradeInquiryInfo: {
            list: '/trade/tblTradeBidSub/queryTblTradeInquiryInfoByMainId'
          }
        }
      }
    },
    props: {
      // 表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      }
    },
    computed: {
      formDisabled() {
        return this.disabled
      }
    },
    created () {

    },
    methods: {
      // edit(record){
      //   console.log(record)
      // },
      addBefore() {
        this.tblTradeInquiryInfoTable.dataSource = []
      },
      getAllTable() {
        let values = this.tableKeys.map(key => getRefPromise(this, key))
        return Promise.all(values)
      },
      /** 调用完edit()方法之后会自动调用此方法 */
      editAfter() {
        this.$nextTick(() => {
        })
        // 加载子表数据
        if (this.model.id) {
          let params = { id: this.model.tradeId }
          this.requestSubTableData(this.url.tblTradeInquiryInfo.list, params, this.tblTradeInquiryInfoTable)
        }
      },
      // 校验所有一对一子表表单
        validateSubForm(allValues) {
          console.log(allValues)
            return new Promise((resolve, reject) => {
              Promise.all([
              ]).then(() => {
                resolve(allValues)
              }).catch(e => {
                if (e.error === VALIDATE_FAILED) {
                  // 如果有未通过表单验证的子表,就自动跳转到它所在的tab
                  this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index]
                } else {
                  console.error(e)
                }
              })
            })
        },
      /** 整理成formData */
      classifyIntoFormData(allValues) {
        let main = Object.assign(this.model, allValues.formValue)
        return {
          ...main, // 展开
          tblTradeInquiryInfoList: allValues.tablesValue[0].tableData
        }
      },
      validateError(msg) {
        this.$message.error(msg)
      }

    }
  }
</script>

<style scoped>
</style>