<template>
  <div class="mod-config">
    <el-form :inline="true" label-position="top" :model="searchData">
      <el-form-item :label="'BU'">
        <el-select v-model="searchData.buDesc" placeholder="请选择" clearable style="width: 80px">
          <el-option
            v-for = "i in userBuList"
            :key = "i.buNo"
            :label = "i.buDesc"
            :value = "i.buDesc">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="'计划编码'">
        <el-input v-model="searchData.planID" clearable style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'工单编码'">
        <el-input v-model="searchData.orderNo" clearable style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'设备编码'">
        <el-input v-model="searchData.objectID" clearable style="width: 100px"></el-input>
      </el-form-item>
      <el-form-item :label="'计划执行人员'">
        <el-input v-model="searchData.planOperatorName" clearable style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'点检项目编码'">
        <el-input v-model="searchData.itemNo" clearable style="width: 100px"></el-input>
      </el-form-item>
      <el-form-item :label="'点检项目名称'">
        <el-input v-model="searchData.itemDesc" clearable style="width: 200px"></el-input>
      </el-form-item>
    </el-form>
    <el-form :inline="true" label-position="top" :model="searchData">
      <el-form-item :label="'状态'">
        <el-select filterable v-model="searchData.status" style="width: 80px">
          <el-option label="全部" value=""></el-option>
          <el-option label="未开工" value="未开工"></el-option>
          <el-option label="待审核" value="待审核"></el-option>
          <el-option label="已完工" value="已完工"></el-option>
          <el-option label="已取消" value="已取消"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="'计划执行日期'">
        <el-date-picker
          style="width: 120px"
          v-model="searchData.startDate"
          :picker-options="pickerOptions"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item style="margin-top: 23px;">
        <laber style="margin-left: -9px;font-size: 19px">&#10142</laber>
      </el-form-item>
      <el-form-item :label="' '">
        <el-date-picker
          style="width: 120px"
          v-model="searchData.endDate"
          :picker-options="pickerOptions"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item :label="'执行时间'">
        <el-date-picker
          style="width: 170px"
          v-model="searchData.reachDate"
          :picker-options="pickerOptions"
          type="datetime"
          value-format='yyyy-MM-dd HH:mm:ss'
          format='yyyy-MM-dd HH:mm:ss'
          placeholder="开始时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item style="margin-top: 23px;">
        <laber style="margin-left: -9px;font-size: 19px">&#10142</laber>
      </el-form-item>
      <el-form-item :label="' '">
        <el-date-picker
          style="width: 170px"
          v-model="searchData.actualDate"
          :picker-options="pickerOptions"
          type="datetime"
          value-format="yyyy-MM-dd HH:mm:ss"
          format='yyyy-MM-dd HH:mm:ss'
          placeholder="结束时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item :label="' '">
        <el-button type="primary" @click="searchClick()">查询</el-button>
        <el-button @click="exportExcel()" type="primary" style="margin-left: 2px">{{'导出'}}</el-button>
<!--        <download-excel-->
<!--          :fields="fields()"-->
<!--          :data="exportData"-->
<!--          type="xls"-->
<!--          :name="exportName"-->
<!--          :header="exportHeader"-->
<!--          :footer="exportFooter"-->
<!--          :fetch="createExportData"-->
<!--          :before-generate="startDownload"-->
<!--          :before-finish="finishDownload"-->
<!--          worksheet="导出信息"-->
<!--          class="el-button el-button&#45;&#45;primary el-button&#45;&#45;medium">-->
<!--          {{ "导出" }}-->
<!--        </download-excel>-->
      </el-form-item>
    </el-form>

    <el-table
      :height="height"
      :data="dataList"
      border
      :row-style="controlRowStyle"
      style="width: 100%;">
      <el-table-column
        prop="checkResult"
        header-align="center"
        align="left"
        label="点检结论"
        width="70">
        <template slot-scope="scope">
          <div :style="{ color: scope.row.checkResult === '合格' ? 'green' : scope.row.checkResult === '不合格' ? 'red' : ''}">
            {{ scope.row.checkResult }}
          </div>
        </template>
      </el-table-column>
      <el-table-column
        v-for="(item,index) in columnList" :key="index"
        :sortable="item.columnSortable"
        :prop="item.columnProp"
        :header-align="item.headerAlign"
        :show-overflow-tooltip="item.showOverflowTooltip"
        :align="item.align"
        :fixed="item.fixed==''?false:item.fixed"
        :min-width="item.columnWidth"
        :label="item.columnLabel">
        <template slot-scope="scope">
          <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
          <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
        </template>
      </el-table-column>
    </el-table>

    <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pageIndex"
      :page-sizes="[20, 50, 100, 200, 500]"
      :page-size="pageSize"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper">
    </el-pagination>

    <el-dialog title="图片查看" :close-on-click-modal="false" v-drag :visible.sync="imageModalFlag" width="390px" style="height: 550px;">
      <div v-viewer>
        <img v-for="(item, index) in descImages" :src="item" :key="index" style="width: 100px;height: 100px"/>
      </div>
      <el-footer style="height:40px;margin-top: 20px;text-align:center">
        <el-button type="primary" @click="imageModalFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>

  </div>
</template>

<script>
import {
  eamCheckRecordSearch,
  eamWorkOrderReportSearch,
  cancelOrder,
  changeOrderOperator,
  checkWorkOrder, // 审核
  updateWorkOrder, // 修改工单
  searchFileUrl,
  getSiteAndBuByUserName
} from "@/api/eam/eam.js"
import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
import Chooselist from '@/views/modules/common/Chooselist_eam'
import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
import excel from "@/utils/excel-util.js";
import {eamCheckRecordSearch2} from "../../../api/eam/eam";
export default {
  components: {
    Chooselist
  },
  watch: {
    searchData: {
      deep: true,
      handler: function (newV, oldV) {
        this.searchData.groupID = this.searchData.groupID.toUpperCase()
      }
    }
  },
  data () {
    return {
      // 是否收藏
      favorite: false,
      // 导出 start
      exportData: [],
      exportName: "设备点检记录" + this.dayjs().format('YYYYMMDDHHmmss'),
      exportHeader: ["设备点检记录"],
      exportFooter: [],
      exportList: [],
      // 导出 end
      tagNo:'',
      searchData: {
        site: this.$store.state.user.site,
        userName: this.$store.state.user.name,
        orderNo: '',
        planID: '',
        objectID: '',
        planOperator: '',
        buDesc: '',
        functionType: 'A',
        status: '',
        startDate: new Date(),
        endDate: '',
        planDate: '',
        page: 1,
        limit: 10,
        searchType: 'checkOrder',
        reachDate: '',
        actualDate: '',
        itemNo: '',
        itemDesc: ''
      },
      height: 200,
      pageIndex: 1,
      pageSize: 20,
      totalPage: 0,
      dataList: [],
      // 展示列集
      columnList: [
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1BuDesc',
          tableId: "101005007Table1",
          tableName: "点检工单表",
          columnProp: 'buDesc',
          headerAlign: "center",
          align: "center",
          columnLabel: 'BU',
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 60,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1PlanID',
          tableId: "101005007Table1",
          tableName: "点检工单表",
          columnProp: 'planID',
          headerAlign: "center",
          align: "left",
          columnLabel: '计划编码',
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1PlanDesc',
          tableId: "101005007Table1",
          tableName: "点检工单表",
          columnProp: 'planDesc',
          headerAlign: "center",
          align: "left",
          columnLabel: '计划描述',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 200,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1OrderNo',
          tableId: "101005007Table1",
          tableName: "点检工单表",
          columnProp: 'orderNo',
          headerAlign: "center",
          align: "left",
          columnLabel: '工单编码',
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1PropertiesCode',
          tableId: "101005007Table1",
          tableName: "点检工单表",
          columnProp: 'propertiesCode',
          headerAlign: "center",
          align: "left",
          columnLabel: '模板编码',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 80,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1CodeDesc',
          tableId: "101005007Table1",
          tableName: "点检工单表",
          columnProp: 'codeDesc',
          headerAlign: "center",
          align: "left",
          columnLabel: '模板名称',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1ObjectID',
          tableId: "101005007Table1",
          tableName: "点检工单表",
          columnProp: 'objectID',
          headerAlign: "center",
          align: "left",
          columnLabel: '设备编码',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 80,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1ObjectDesc',
          tableId: "101005007Table1",
          tableName: "点检工单表",
          columnProp: 'objectDesc',
          headerAlign: "center",
          align: "left",
          columnLabel: '设备名称',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1Status',
          tableId: "101005007Table1",
          tableName: "点检工单表",
          columnProp: 'status',
          headerAlign: "center",
          align: "center",
          columnLabel: '状态',
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 80,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1PlanOperatorName',
          tableId: "101005007Table1",
          tableName: "点检工单表",
          columnProp: 'planOperatorName',
          headerAlign: "center",
          align: "left",
          columnLabel: '计划执行人员',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1ActualOperatorName',
          tableId: "101005007Table1",
          tableName: "点检工单表",
          columnProp: 'actualOperatorName',
          headerAlign: "center",
          align: "left",
          columnLabel: '实际执行人员',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1CheckerName',
          tableId: "101005007Table1",
          tableName: "点检工单表",
          columnProp: 'checkerName',
          headerAlign: "center",
          align: "left",
          columnLabel: '审核人员',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1PlanDate',
          tableId: "101005007Table1",
          tableName: "点检工单表",
          columnProp: 'planDate',
          headerAlign: "center",
          align: "center",
          columnLabel: '计划执行日期',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1ReachDate',
          tableId: "101005007Table1",
          tableName: "点检工单表",
          columnProp: 'reachDate',
          headerAlign: "center",
          align: "center",
          columnLabel: '执行开始时间',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 130,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1ActualDate',
          tableId: "101005007Table1",
          tableName: "点检工单表",
          columnProp: 'actualDate',
          headerAlign: "center",
          align: "center",
          columnLabel: '执行结束时间',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 130,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1WorkTime',
          tableId: "101005007Table1",
          tableName: "点检工单表",
          columnProp: 'workTime',
          headerAlign: "center",
          align: "right",
          columnLabel: '工作时长(m)',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 80,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1Remark',
          tableId: "101005007Table1",
          tableName: "点检工单表",
          columnProp: 'remark',
          headerAlign: "center",
          align: "left",
          columnLabel: '执行结果备注',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 200,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1ItemNo',
          tableId: "101005007Table1",
          tableName: "点检项目表",
          columnProp: 'itemNo',
          headerAlign: "center",
          align: "left",
          columnLabel: '点检项目编码',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 90,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1ItemDesc',
          tableId: "101005007Table1",
          tableName: "点检项目表",
          columnProp: 'itemDesc',
          headerAlign: "center",
          align: "left",
          columnLabel: '点检项目名称',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1ItemRemark',
          tableId: "101005007Table1",
          tableName: "点检项目表",
          columnProp: 'itemRemark',
          headerAlign: "center",
          align: "left",
          columnLabel: '点检方法说明',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 200,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1ValueType',
          tableId: "101005007Table1",
          tableName: "点检项目表",
          columnProp: 'valueType',
          headerAlign: "center",
          align: "center",
          columnLabel: '检测值类型',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 70,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1DefaultValue',
          tableId: "101005007Table1",
          tableName: "点检项目表",
          columnProp: 'defaultValue',
          headerAlign: "center",
          align: "center",
          columnLabel: '参照值',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 70,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1MaxValue',
          tableId: "101005007Table1",
          tableName: "点检项目表",
          columnProp: 'maxValue',
          headerAlign: "center",
          align: "center",
          columnLabel: '最大值',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 70,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 101005007,
          serialNumber: '101005007Table1MinValue',
          tableId: "101005007Table1",
          tableName: "点检项目表",
          columnProp: 'minValue',
          headerAlign: "center",
          align: "center",
          columnLabel: '最小值',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 70,
        },
      ],
      planOperator: '',
      planOperatorName: '',
      // 日期限制
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        },
      },
      descImages: [],
      imageModalFlag: false,
      userBuList: []
    }
  },

  mounted () {
    this.$nextTick(() => {
      this.height = window.innerHeight - 210
    })
  },

  created () {
    // 获取用户的 site 和 bu
    this.getSiteAndBuByUserName()
    // 校验用户是否收藏
    this.favoriteIsOk()
    // 获取数据列表
    this.getDataList()
    // 动态列
    this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
  },

  activated () {
    if (this.$route.params.type === 'tokenLogin') {
      this.searchData.site = this.$route.params.site
      this.searchData.buNo = this.$route.params.buNo
    }
    this.getDataList()
  },

  methods: {
    // 获取用户的bu
    getSiteAndBuByUserName () {
      let tempData = {
        username: this.$store.state.user.name,
      }
      getSiteAndBuByUserName(tempData).then(({data}) => {
        if (data.code === 0) {
          this.userBuList = data.rows
          this.searchData.buDesc = this.userBuList[0].buDesc
        }
      })
    },

    // 控制单行的背景颜色
    controlRowStyle ({row, rowIndex}) {
      // 区分不同的样式对应不同的颜色
      if (row.status === '待审核') {
        return "background-color: #D8ECF1"
      }
    },

    /**
     * 查看项目图片
     */
    checkItemImageModal (row) {
      this.descImages = []
      let tempData = {
        site: row.site,
        orderNo: row.orderNo,
        folder: row.itemNo,
        buNo: row.buNo
      }
      searchFileUrl(tempData).then(({data}) => {
        if (data.code === 0) {
          for (let i = 0; i < data.rows.length; i++) {
            this.descImages.push(data.rows[i].url)
          }
        } else {
          this.$message.warning(data.msg)
        }
      })
      this.imageModalFlag = true
    },

    // 校验用户是否收藏
    favoriteIsOk () {
      let userFavorite = {
        userId: this.$store.state.user.id,
        languageCode: this.$i18n.locale
      }
      userFavoriteList(userFavorite).then(({data}) => {
        for (let i = 0; i < data.list.length; i++) {
          if (this.$route.meta.menuId === data.list[i].menuId) {
            this.favorite = true
          }
        }
      })
    },

    // 收藏 OR 取消收藏
    favoriteFunction () {
      let userFavorite = {
        userId: this.$store.state.user.id,
        functionId: this.$route.meta.menuId,
      }
      if (this.favorite) {
        removeUserFavorite(userFavorite).then(({data}) => {
          this.$message.success(data.msg)
          this.favorite = false
        })
      } else {
        // 收藏
        saveUserFavorite(userFavorite).then(({data}) => {
          this.$message.success(data.msg)
          this.favorite = true
        })
      }
    },

    // 获取基础数据列表S
    getBaseList (val,type) {
      this.tagNo = val
      this.$nextTick(() => {
        let strVal = ''
        if (val === 201) {
          strVal = this.planOperator
          this.$refs.baseList.init(val, strVal)
        }
      })
    },

    /* 列表方法的回调 */
    getBaseData (val) {
      if (this.tagNo === 201) {
        this.planOperator = val.username
        this.planOperatorName = val.user_display
      }
    },

    async exportExcel() {
      this.searchData.limit = -1
      this.searchData.page = 1
      excel.exportTable({
        url: "/pms/eam/eamCheckRecordSearch",
        columnMapping:  this.columnList,//可以直接用table，不需要的列就剔除
        mergeSetting: [],//需要合并的列
        params: this.searchData,
        fileName: this.exportName+".xlsx",
        rowFetcher: res => res.data,
        columnFormatter: [],
        dropColumns: [],//需要剔除的列，例如dropColumns: ["netWeight"]，即剔除净重列
      });
    },

    //导出excel
    // async createExportData () {
    //   this.searchData.limit = -1
    //   this.searchData.page = 1
    //   await eamCheckRecordSearch(this.searchData).then(({data}) => {
    //     this.exportList= data.page.list
    //   })
    //   return this.exportList
    // },
    //
    // startDownload() {},
    //
    // finishDownload() {},
    //
    // fields() {
    //   let json = "{"
    //   this.columnList.forEach((item, index) => {
    //     if (index == this.columnList.length - 1) {
    //       json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
    //     } else {
    //       json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
    //     }
    //   })
    //   json += "}"
    //   let s = eval("(" + json + ")")
    //   return s
    // },

    // 重置查询时间
    searchClick () {
      //this.searchData.planDate = ''
      this.getDataList()
    },

    // 获取数据列表
    getDataList () {
      this.searchData.limit = this.pageSize
      this.searchData.page = this.pageIndex
      eamCheckRecordSearch2(this.searchData).then(({data}) => {
        if (data.code === 0) {
          this.dataList = data.page.list
          this.pageIndex = data.page.currPage
          this.pageSize = data.page.pageSize
          this.totalPage = data.page.totalCount
        }
      })
    },

    // 每页数
    sizeChangeHandle (val) {
      this.pageSize = val
      this.pageIndex = 1
      this.getDataList()
    },

    // 当前页
    currentChangeHandle (val) {
      this.pageIndex = val
      this.getDataList()
    },

    // 动态列开始 获取 用户保存的 格式列
    async getTableUserColumn (tableId, columnId) {
      let queryTableUser = {
        userId: this.$store.state.user.name,
        functionId: this.$route.meta.menuId,
        tableId: tableId,
        status: true,
        languageCode: this.$i18n.locale
      }
      await getTableUserListLanguage(queryTableUser).then(({data}) => {
        if (data.rows.length > 0) {
          switch (columnId) {
            case 1:
              this.columnList = data.rows
              break;
          }
        } else {
          this.getColumnList(tableId, columnId)
        }
      })
    },

    // 获取 tableDefault 列
    async getColumnList(tableId, columnId) {
      let queryTable = {
        functionId: this.$route.meta.menuId,
        tableId: tableId,
        languageCode: this.$i18n.locale
      }
      await getTableDefaultListLanguage(queryTable).then(({data}) => {
        if (!data.rows.length == 0) {
          switch (columnId) {
            case 1:
              this.columnList = data.rows
              break;
          }
        }
      })
    },
  }
}
</script>

<style scoped>
.numInput /deep/ .el-input__inner{
  text-align: right;
}
</style>
