HazardousWasteList.vue 9.86 KB
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-button @click="wasteHzPrint" type="primary" icon="plus">汇总码</a-button>
      <!-- 高级查询区域 -->

    </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"
        bordered
        rowKey="id"
        class="j-table-force-nowrap"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}"
        :customRow="clickThenSelect"
        @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">
          <a @click="handleEdit(record)">编辑</a>
           <a-divider type="vertical"/>
          <a @click="wastePrint(record,1)">修改码</a>
           <a-divider type="vertical"/>
          <a @click="wastePrint(record,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-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>

      </a-table>
    </div>

    <a-tabs defaultActiveKey="1">
      <a-tab-pane tab="危险废物记录" key="1">
        <HazardousWasteDetailList :mainId="selectedMainId"/>
      </a-tab-pane>
    </a-tabs>

    <hazardousWaste-modal ref="modalForm" @ok="modalFormOk"></hazardousWaste-modal>
    <waste-print-modal ref="wastePrint"></waste-print-modal>
  </a-card>
</template>

<script>

import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import HazardousWasteModal from './modules/HazardousWasteModal'
import {getAction} from '@/api/manage'
import HazardousWasteDetailList from './HazardousWasteDetailList'
import '@/assets/less/TableExpand.less'
import WastePrintModal from "./modules/WastePrintModal";

export default {
  name: "HazardousWasteList",
  mixins: [JeecgListMixin],
  components: {
    HazardousWasteDetailList,
    HazardousWasteModal,
    WastePrintModal
  },
  data() {
    return {
      description: '危险废物管理页面',
      // 表头
      columns: [
        {
          title: '废物名称',
          align: "center",
          dataIndex: 'wasteName'
        },
        {
          title: '废物类别',
          align: "center",
          dataIndex: 'wasteType'
        },
        {
          title: '废物代码',
          align: "center",
          dataIndex: 'wasteCode'
        },
        {
          title: '废物形态',
          align: "center",
          dataIndex: 'wasteForm'
        },
        {
          title: '主要成分',
          align: "center",
          dataIndex: 'mainComponent'
        },
        {
          title: '有害成分',
          align: "center",
          dataIndex: 'harmfulIngredient'
        },
        {
          title: '注意事项',
          align: "center",
          dataIndex: 'announcements'
        },
        {
          title: '数字识别码',
          align: "center",
          dataIndex: 'numericIdentificationCode'
        },
        {
          title: '产生/收集单位`',
          align: "center",
          dataIndex: 'produceUnit'
        },
        {
          title: '联系人',
          align: "center",
          dataIndex: 'contactPerson'
        },
        {
          title: '联系人电话',
          align: "center",
          dataIndex: 'contactPhone'
        },
        {
          title: '产生日期',
          align: "center",
          dataIndex: 'produceDate',
          customRender: function (text) {
            return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {
          title: '废物重量',
          align: "center",
          dataIndex: 'wasteWeight'
        },
        {
          title: '备注',
          align: "center",
          dataIndex: 'remark'
        },
        {
          title: '图片标识',
          align: "center",
          dataIndex: 'picType'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: "center",
          fixed: "right",
          width: 147,
          scopedSlots: {customRender: 'action'},
        }
      ],
      url: {
        list: "/waste/hazardousWaste/list",
        delete: "/waste/hazardousWaste/delete",
        deleteBatch: "/waste/hazardousWaste/deleteBatch",
        exportXlsUrl: "/waste/hazardousWaste/exportXls",
        importExcelUrl: "waste/hazardousWaste/importExcel",
      },
      dictOptions: {},
      /* 分页参数 */
      ipagination: {
        current: 1,
        pageSize: 5,
        pageSizeOptions: ['5', '10', '50'],
        showTotal: (total, range) => {
          return range[0] + "-" + range[1] + " 共" + total + "条"
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
      selectedMainId: '',
      superFieldList: [],
    }
  },
  created() {
    this.getSuperFieldList();
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    }
  },
  methods: {
    wastePrint(record, type) {
      var url = '';
      if (type == 1) {
        url = this.MTS.base_pro_URL + '/waste/wasteUpdateInfo?id=' + record.id + '&type=' + record.picType;
      } else {
        url = this.MTS.base_pro_URL + '/waste/wasteInfo?id=' + record.id + '&type=' + record.picType;
      }
      this.$refs.wastePrint.open(url, record.wasteName);
    },
    wasteHzPrint() {
      var url = this.MTS.base_pro_URL + '/waste/wasteList';
      this.$refs.wastePrint.open(url, '');
    },
    initDictConfig() {
    },
    clickThenSelect(record) {
      return {
        on: {
          click: () => {
            this.onSelectChange(record.id.split(","), [record]);
          }
        }
      }
    },
    onClearSelected() {
      this.selectedRowKeys = [];
      this.selectionRows = [];
      this.selectedMainId = ''
    },
    onSelectChange(selectedRowKeys, selectionRows) {
      this.selectedMainId = selectedRowKeys[0]
      this.selectedRowKeys = selectedRowKeys;
      this.selectionRows = selectionRows;
    },
    loadData(arg) {
      if (!this.url.list) {
        this.$message.error("请设置url.list属性!")
        return
      }
      //加载数据 若传入参数1则加载第一页的内容
      if (arg === 1) {
        this.ipagination.current = 1;
      }
      this.onClearSelected()
      var params = this.getQueryParams();//查询条件
      this.loading = true;
      getAction(this.url.list, params).then((res) => {
        if (res.success) {
          this.dataSource = res.result.records;
          this.ipagination.total = res.result.total;
        }
        if (res.code === 510) {
          this.$message.warning(res.message)
        }
        this.loading = false;
      })
    },
    getSuperFieldList() {
      let fieldList = [];
      fieldList.push({type: 'string', value: 'wasteType', text: '废物类别', dictCode: ''})
      fieldList.push({type: 'string', value: 'wasteCode', text: '废物代码', dictCode: ''})
      fieldList.push({type: 'string', value: 'wasteForm', text: '废物形态', dictCode: ''})
      fieldList.push({type: 'string', value: 'mainComponent', text: '主要成分', dictCode: ''})
      fieldList.push({type: 'string', value: 'harmfulIngredient', text: '有害成分', dictCode: ''})
      fieldList.push({type: 'string', value: 'announcements', text: '注意事项', dictCode: ''})
      fieldList.push({type: 'string', value: 'numericIdentificationCode', text: '数字识别码', dictCode: ''})
      fieldList.push({type: 'string', value: 'produceUnit', text: '产生/收集单位`', dictCode: ''})
      fieldList.push({type: 'string', value: 'contactPerson', text: '联系人', dictCode: ''})
      fieldList.push({type: 'string', value: 'contactPhone', text: '联系人电话', dictCode: ''})
      fieldList.push({type: 'date', value: 'produceDate', text: '产生日期'})
      fieldList.push({type: 'BigDecimal', value: 'wasteWeight', text: '废物重量', dictCode: ''})
      fieldList.push({type: 'string', value: 'remark', text: '备注', dictCode: ''})
      this.superFieldList = fieldList
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less'
</style>