
<template>

  <a-card :bordered="false">
    <!-- 查询区域 -->
    <h3 >总库物资管理详情页</h3>
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
<!--          <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!--            <a-form-item label="流程表单号">-->
<!--              <a-input placeholder="请输入流程表单号" v-model="queryParam.processId"></a-input>-->
<!--            </a-form-item>-->
<!--          </a-col>-->
          <a-col :xl="4" :lg="7" :md="8" :sm="16">
            <a-form-item label="供应商">
              <a-input placeholder="请输入供应商信息" v-model="queryParam.supplierId"></a-input>
            </a-form-item>
          </a-col>

<!--            <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!--              <a-form-item label="供应商描述">-->
<!--                <j-search-select-tag placeholder="请选择供应商描述" v-model="queryParam.supplierDescription" dict=",,"/>-->
<!--              </a-form-item>-->
<!--            </a-col>-->
<!--            <a-col :xl="4" :lg="7" :md="8" :sm="16">-->
<!--              <a-form-item label="物料组">-->
<!--                <a-input placeholder="请输入物料组" v-model="queryParam.itemGroup" dict=",,"/>-->
<!--              </a-form-item>-->
<!--            </a-col>-->
<!--            <a-col :xl="4" :lg="7" :md="8" :sm="16">-->
<!--              <a-form-item label="物料">-->
<!--                <a-input placeholder="请输入物料" v-model="queryParam.item" dict=",,"/>-->
<!--              </a-form-item>-->
<!--            </a-col>-->
<!--            <a-col :xl="4" :lg="7" :md="8" :sm="16">-->
<!--              <a-form-item label="物料描述">-->
<!--                <a-input placeholder="请输入物料描述" v-model="queryParam.itemDescription" dict=",,"/>-->
<!--              </a-form-item>-->
<!--            </a-col>-->

<!--          <template v-if="toggleSearchStatus">-->
<!--            <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!--              <a-form-item label="计量单位">-->
<!--                <a-input placeholder="请输入计量单位" v-model="queryParam.unitMeasurement"></a-input>-->
<!--              </a-form-item>-->
<!--            </a-col>-->
<!--            <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!--              <a-form-item label="数量">-->
<!--                <a-input placeholder="请输入数量" v-model="queryParam.amount"></a-input>-->
<!--              </a-form-item>-->
<!--            </a-col>-->
<!--            <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!--              <a-form-item label="价格">-->
<!--                <a-input placeholder="请输入价格" v-model="queryParam.price"></a-input>-->
<!--              </a-form-item>-->
<!--            </a-col>-->
<!--            <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!--              <a-form-item label="金额">-->
<!--                <a-input placeholder="请输入金额" v-model="queryParam.rates"></a-input>-->
<!--              </a-form-item>-->
<!--            </a-col>-->
            <a-col :xl="4" :lg="7" :md="8" :sm="16">
              <a-form-item label="仓储地点">
                <a-input placeholder="请选择仓储地点" v-model="queryParam.unitWasteWarehouseCodeId" dict=",,"/>
              </a-form-item>
            </a-col>
            <a-col :xl="4" :lg="7" :md="8" :sm="16">
              <a-form-item label="存储仓位">
                <a-input placeholder="请选择存储仓位" v-model="queryParam.freightSpace" dict=",,"/>
              </a-form-item>
            </a-col>
            <a-col :xl="4" :lg="7" :md="8" :sm="16">
              <a-form-item label="生产时间">
                <j-date placeholder="请选择生产时间" v-model="queryParam.productionTime"></j-date>
              </a-form-item>
            </a-col>
            <a-col :xl="4" :lg="7" :md="8" :sm="16">
              <a-form-item label="保质期">
                <j-date placeholder="请选择保质期" v-model="queryParam.expirationDate"></j-date>
              </a-form-item>
            </a-col>
            <a-col :xl="4" :lg="7" :md="8" :sm="16">
              <a-form-item label="批次">
                <a-input placeholder="请选择批次" v-model="queryParam.batch" dict=",,"/>
              </a-form-item>
            </a-col>
<!--            <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!--              <a-form-item label="是否到货">-->
<!--                <a-input placeholder="请输入是否到货" v-model="queryParam.arrivalNotice"></a-input>-->
<!--              </a-form-item>-->
<!--            </a-col>-->
            <a-col :xl="4" :lg="7" :md="8" :sm="16">
              <a-form-item label="入库时间">
                <j-date placeholder="请选择入库时间" v-model="queryParam.inboundTime"></j-date>
              </a-form-item>
            </a-col>
            <a-col :xl="4" :lg="7" :md="8" :sm="16">
              <a-form-item label="入库人">
                <a-input placeholder="请选择入库人" v-model="queryParam.librarySign" dict=",,"/>
              </a-form-item>
            </a-col>
<!--            <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!--              <a-form-item label="核算属性">-->
<!--                <a-input placeholder="请输入核算属性" v-model="queryParam.accountingAttributes"></a-input>-->
<!--              </a-form-item>-->
<!--            </a-col>-->
<!--          </template>-->
<!--          <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!--            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">-->

<!--              <a @click="handleToggleSearch" style="margin-left: 8px">-->
<!--                {{ toggleSearchStatus ? '收起' : '展开' }}-->
<!--                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>-->
<!--              </a>-->
<!--            </span>-->
<!--          </a-col>-->
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-button type="primary" icon="download" @click="handleExportXls('物资总库')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
      <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>

      <!-- 高级查询区域 -->
<!--      <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>-->
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
      </a-dropdown>


    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" 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" style="overflow: hidden;" class="table-page-search-submitButtons">



          <a-dropdown>

              <a class="ant-dropdown-link" @click="handleDetaills(record)">查看详情<a-icon type="down" /></a>


          </a-dropdown>
        </span>

      </a-table>
    </div>

    <process-supplies-stronger-modal ref="modalForm" @ok="modalFormOk"></process-supplies-stronger-modal>
  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import ProcessSuppliesStrongerModal from './modules/ProcessSuppliesStrongerModal'
  import JDate from '@/components/jeecg/JDate.vue'
  import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
  import JSuperQuery from '@/components/jeecg/JSuperQuery.vue'


  export default {
    name: 'ProcessSuppliesStrongerLists',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      JDate,
      JSearchSelectTag,
      ProcessSuppliesStrongerModal,
      JSuperQuery,
    },
    data () {
      return {
        description: '物资总库管理详情页面',
        //  表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'流程表单号',
            align:"center",
            dataIndex: 'processId'
          },
          {
            title:'供应商',
            align:"center",
            dataIndex: 'supplierId'
          },
          {
            title:'供应商描述',
            align:"center",
            dataIndex: 'supplierDescription'
          },
          {
            title:'物料组',
            align:"center",
            dataIndex: 'itemGroup'
          },
          {
            title:'物料',
            align:"center",
            dataIndex: 'item'
          },
          {
            title:'物料描述',
            align:"center",
            dataIndex: 'itemDescription'
          },
          {
            title:'计量单位',
            align:"center",
            dataIndex: 'unitMeasurement'
          },
          {
            title:'数量',
            align:"center",
            dataIndex: 'amount'
          },
          {
            title:'单价',
            align:"center",
            dataIndex: 'price'
          },
          {
            title:'金额',
            align:"center",
            dataIndex: 'rates'
          },
          {
            title:'仓储地点',
            align:"center",
            dataIndex: 'unitWasteWarehouseCodeId'
          },
          {
            title:'存储仓位',
            align:"center",
            dataIndex: 'freightSpace'
          },
          {
            title:'生产时间',
            align:"center",
            dataIndex: 'productionTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title:'保质期',
            align:"center",
            dataIndex: 'expirationDate',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title:'批次',
            align:"center",
            dataIndex: 'batch'
          },
          {
            title:'是否到货',
            align:"center",
            dataIndex: 'arrivalNotice'
          },
          {
            title:'入库时间',
            align:"center",
            dataIndex: 'inboundTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title:'入库人',
            align:"center",
            dataIndex: 'librarySign'
          },
          {
            title:'核算属性',
            align:"center",
            dataIndex: 'accountingAttributes'
          },
          // {
          //   title: '详情',
          //   dataIndex: 'action',
          //   align:"center",
          //   fixed:"right",
          //   width:147,
          //   scopedSlots: { customRender: 'action' }
          // }
        ],
        url: {
          list: "/suppliesstronger/processSuppliesStronger/list",
          delete: "/suppliesstronger/processSuppliesStronger/delete",
          deleteBatch: "/suppliesstronger/processSuppliesStronger/deleteBatch",
          exportXlsUrl: "/suppliesstronger/processSuppliesStronger/exportXls",
          importExcelUrl: "suppliesstronger/processSuppliesStronger/importExcel",

        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
    this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      handleDetaills(){
        this.item = true;
      },
      handlereturn(){
       this.$emit("strongerExit",false);
      },
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'processId',text:'流程表单号',dictCode:''})
        fieldList.push({type:'string',value:'supplierId',text:'供应商',dictCode:''})
        fieldList.push({type:'sel_search',value:'supplierDescription',text:'供应商描述',dictTable:'', dictText:'', dictCode:''})
        fieldList.push({type:'sel_search',value:'itemGroup',text:'物料组',dictTable:'', dictText:'', dictCode:''})
        fieldList.push({type:'sel_search',value:'item',text:'物料',dictTable:'', dictText:'', dictCode:''})
        fieldList.push({type:'sel_search',value:'itemDescription',text:'物料描述',dictTable:'', dictText:'', dictCode:''})
        fieldList.push({type:'string',value:'unitMeasurement',text:'计量单位',dictCode:''})
        fieldList.push({type:'int',value:'amount',text:'数量',dictCode:''})
        fieldList.push({type:'BigDecimal',value:'price',text:'单价',dictCode:''})
        fieldList.push({type:'BigDecimal',value:'rates',text:'金额',dictCode:''})
        fieldList.push({type:'sel_search',value:'unitWasteWarehouseCodeId',text:'仓储地点',dictTable:'', dictText:'', dictCode:''})
        fieldList.push({type:'sel_search',value:'freightSpace',text:'存储仓位',dictTable:'', dictText:'', dictCode:''})
        fieldList.push({type:'date',value:'productionTime',text:'生产时间'})
        fieldList.push({type:'date',value:'expirationDate',text:'保质期'})
        fieldList.push({type:'sel_search',value:'batch',text:'批次',dictTable:'', dictText:'', dictCode:''})
        fieldList.push({type:'int',value:'arrivalNotice',text:'是否到货',dictCode:''})
        fieldList.push({type:'date',value:'inboundTime',text:'入库时间'})
        fieldList.push({type:'sel_search',value:'librarySign',text:'入库人',dictTable:'', dictText:'', dictCode:''})
        fieldList.push({type:'string',value:'accountingAttributes',text:'核算属性',dictCode:''})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>