AvoidList.vue 10.1 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 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>
      <!-- 高级查询区域 -->
      <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: scrollXWidth, y: 720}"
        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">
          <a @click="handleEdit(record)">编辑</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>
    </div>

    <avoid-modal ref="modalForm" @ok="modalFormOk"></avoid-modal>
  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import AvoidModal from './modules/AvoidModal'

  export default {
    name: 'AvoidList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      AvoidModal
    },
    data () {
      return {
        description: '存放静态避让数据管理页面',
        scrollXWidth: 2200,
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'当前地标',
            align:"center",
            dataIndex: 'landmark'
          },
          {
            title:'岔道号',
            align:"center",
            dataIndex: 'crossNum'
          },
          {
            title:'后置地标',
            align:"center",
            dataIndex: 'behindLandmark'
          },
          {
            title:'前置地标',
            align:"center",
            dataIndex: 'aheadLandmark'
          },
          {
            title:'避让地标号1',
            align:"center",
            dataIndex: 'avoid1'
          },
          {
            title:'避让地标号2',
            align:"center",
            dataIndex: 'avoid2'
          },
          {
            title:'避让地标号3',
            align:"center",
            dataIndex: 'avoid3'
          },
          {
            title:'避让地标号4',
            align:"center",
            dataIndex: 'avoid4'
          },
          {
            title:'避让地标号5',
            align:"center",
            dataIndex: 'avoid5'
          },
          {
            title:'避让地标号6',
            align:"center",
            dataIndex: 'avoid6'
          },
          {
            title:'避让地标号7',
            align:"center",
            dataIndex: 'avoid7'
          },
          {
            title:'避让地标号8',
            align:"center",
            dataIndex: 'avoid8'
          },
          {
            title:'避让地标号9',
            align:"center",
            dataIndex: 'avoid9'
          },
          {
            title:'避让地标号10',
            align:"center",
            dataIndex: 'avoid10'
          },
          {
            title:'避让地标号11',
            align:"center",
            dataIndex: 'avoid11'
          },
          {
            title:'避让地标号12',
            align:"center",
            dataIndex: 'avoid12'
          },
          {
            title:'避让地标号13',
            align:"center",
            dataIndex: 'avoid13'
          },
          {
            title:'避让地标号14',
            align:"center",
            dataIndex: 'avoid14'
          },
          {
            title:'避让地标号15',
            align:"center",
            dataIndex: 'avoid15'
          },
          {
            title:'避让地标号16',
            align:"center",
            dataIndex: 'avoid16'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/avoid/avoid/list",
          delete: "/avoid/avoid/delete",
          deleteBatch: "/avoid/avoid/deleteBatch",
          exportXlsUrl: "/avoid/avoid/exportXls",
          importExcelUrl: "avoid/avoid/importExcel",
          
        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
    this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    mounted() {
      // this.getdata();
    },
    methods: {
      // getdata(){
      //   let currColumns = res.result.columns;
      //   // res.result.columns表示接口获取的columns值,具体根据接口返回值修改
      //
      //   for(let a=0;a<currColumns.length;a++){
      //     // 设置除最后一列的宽度,需要空一列自适应
      //     if(a < currColumns.length-1) {
      //       currColumns[a].width = 150;
      //     }
      //   }
      //   console.log("-------------------",currColumns)
      //   // 横向滚动长度大于所有宽度,才能实现固定表头
      //   this.scrollXWidth = (currColumns.length) * 150 + 180;
      //   this.columns = [...currColumns]
      // },
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'int',value:'landmark',text:'当前地标',dictCode:''})
        fieldList.push({type:'int',value:'crossNum',text:'岔道号',dictCode:''})
        fieldList.push({type:'int',value:'behindLandmark',text:'后置地标',dictCode:''})
        fieldList.push({type:'int',value:'aheadLandmark',text:'前置地标',dictCode:''})
        fieldList.push({type:'int',value:'avoid1',text:'避让地标号1',dictCode:''})
        fieldList.push({type:'int',value:'avoid2',text:'避让地标号2',dictCode:''})
        fieldList.push({type:'int',value:'avoid3',text:'避让地标号3',dictCode:''})
        fieldList.push({type:'int',value:'avoid4',text:'避让地标号4',dictCode:''})
        fieldList.push({type:'int',value:'avoid5',text:'避让地标号5',dictCode:''})
        fieldList.push({type:'int',value:'avoid6',text:'避让地标号6',dictCode:''})
        fieldList.push({type:'int',value:'avoid7',text:'避让地标号7',dictCode:''})
        fieldList.push({type:'int',value:'avoid8',text:'避让地标号8',dictCode:''})
        fieldList.push({type:'int',value:'avoid9',text:'避让地标号9',dictCode:''})
        fieldList.push({type:'int',value:'avoid10',text:'避让地标号10',dictCode:''})
        fieldList.push({type:'int',value:'avoid11',text:'避让地标号11',dictCode:''})
        fieldList.push({type:'int',value:'avoid12',text:'避让地标号12',dictCode:''})
        fieldList.push({type:'int',value:'avoid13',text:'避让地标号13',dictCode:''})
        fieldList.push({type:'int',value:'avoid14',text:'避让地标号14',dictCode:''})
        fieldList.push({type:'int',value:'avoid15',text:'避让地标号15',dictCode:''})
        fieldList.push({type:'int',value:'avoid16',text:'避让地标号16',dictCode:''})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>