loulijun2021
2023-04-11 aae53f420a50b06095d25989da1e59d2deaaab87
src/views/deviceManager/checkPosition.vue
@@ -73,8 +73,13 @@
      </div>
      <div class="elTableDiv">
        <TableColumnSettings
          :list1="tableColumnSettingsArray"
          @tableColumnUpdate="tableColumnUpdate"
        />
        <el-table
          ref="tableDataRef"
          :key="tableTimeStampKey"
          :data="tableData"
          :height="isExpandForm?tableHeight:(tableHeight+40)+'px'"
          border
@@ -86,83 +91,113 @@
          :cell-style="this.$cellStyle"
          @sort-change="sortChange"
        >
          <el-table-column
            v-for="item in tableColumnSettingsArray"
            v-if="item.show"
            :key="item.id"
            :sortable="item.sortable"
            :prop="item.prop"
            :min-width="item.minWidth"
            :label="item.label"
            :width="item.width"
            show-tooltip-when-overflow
            :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false"
          >
            <template slot-scope="{row}">
              <div v-if="!row[item.prop]">/</div>
              <div v-else-if="item.prop==='cycle'">{{ cycleArr.find(i=>i.code===row[item.prop]).name }}</div>
              <div v-else-if="item.prop==='isscan'">
                <div v-if="row[item.prop]==='Y'">
                  <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />
                  是
                </div>
                <div v-if="row[item.prop]==='N'">
                  <i class="el-icon-info" style="margin-right: 2px" />
                  否
                </div>
              </div>
              <div v-else>{{ row[item.prop] }}</div>
            </template>
          </el-table-column>
          <!--          <el-table-column-->
          <!--            type="selection"-->
          <!--            width="50"-->
          <!--          />-->
          <el-table-column
            prop="RowNum"
            width="50"
            fixed
            label="序号"
          />
          <el-table-column
            prop="code"
            label="部位编码"
            sortable="custom"
            show-tooltip-when-overflow
          />
          <el-table-column
            prop="name"
            label="部位名称"
            show-tooltip-when-overflow
            sortable="custom"
          />
          <el-table-column
            prop="description"
            label="点检要求"
            show-tooltip-when-overflow
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div v-if="row.description">{{ row.description }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="isscan"
            label="选择扫码"
            sortable="custom"
            show-tooltip-when-overflow
          >
            <template slot-scope="{row}">
              <div v-if="row.isscan==='Y'">
                <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />
                是
              </div>
              <div v-if="row.isscan==='N'">
                <i class="el-icon-info" style="margin-right: 2px" />
                否
              </div>
            </template>
          </el-table-column>
          <el-table-column
            prop="cycle"
            label="点检周期"
            show-tooltip-when-overflow
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div v-if="row.cycle==='Y'">年</div>
              <div v-if="row.cycle==='S'">季</div>
              <div v-if="row.cycle==='M'">月</div>
              <div v-if="row.cycle==='W'">周</div>
              <div v-if="row.cycle==='D'">日</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="lm_user"
            label="创建人员"
            sortable="custom"
            show-tooltip-when-overflow
          />
          <el-table-column
            prop="lm_date"
            label="创建时间"
            show-tooltip-when-overflow
            width="160"
            sortable="custom"
          />
          <!--          <el-table-column-->
          <!--            prop="RowNum"-->
          <!--            width="50"-->
          <!--            fixed-->
          <!--            label="序号"-->
          <!--          />-->
          <!--          <el-table-column-->
          <!--            prop="code"-->
          <!--            label="部位编码"-->
          <!--            sortable="custom"-->
          <!--            show-tooltip-when-overflow-->
          <!--          />-->
          <!--          <el-table-column-->
          <!--            prop="name"-->
          <!--            label="部位名称"-->
          <!--            show-tooltip-when-overflow-->
          <!--            sortable="custom"-->
          <!--          />-->
          <!--          <el-table-column-->
          <!--            prop="description"-->
          <!--            label="点检要求"-->
          <!--            show-tooltip-when-overflow-->
          <!--            sortable="custom"-->
          <!--          >-->
          <!--            <template slot-scope="{row}">-->
          <!--              <div v-if="row.description">{{ row.description }}</div>-->
          <!--              <div v-else>/</div>-->
          <!--            </template>-->
          <!--          </el-table-column>-->
          <!--          <el-table-column-->
          <!--            prop="isscan"-->
          <!--            label="选择扫码"-->
          <!--            sortable="custom"-->
          <!--            show-tooltip-when-overflow-->
          <!--          >-->
          <!--            <template slot-scope="{row}">-->
          <!--              <div v-if="row.isscan==='Y'">-->
          <!--                <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />-->
          <!--                是-->
          <!--              </div>-->
          <!--              <div v-if="row.isscan==='N'">-->
          <!--                <i class="el-icon-info" style="margin-right: 2px" />-->
          <!--                否-->
          <!--              </div>-->
          <!--            </template>-->
          <!--          </el-table-column>-->
          <!--          <el-table-column-->
          <!--            prop="cycle"-->
          <!--            label="点检周期"-->
          <!--            show-tooltip-when-overflow-->
          <!--            sortable="custom"-->
          <!--          >-->
          <!--            <template slot-scope="{row}">-->
          <!--              <div v-if="row.cycle==='Y'">年</div>-->
          <!--              <div v-if="row.cycle==='S'">季</div>-->
          <!--              <div v-if="row.cycle==='M'">月</div>-->
          <!--              <div v-if="row.cycle==='W'">周</div>-->
          <!--              <div v-if="row.cycle==='D'">日</div>-->
          <!--            </template>-->
          <!--          </el-table-column>-->
          <!--          <el-table-column-->
          <!--            prop="lm_user"-->
          <!--            label="创建人员"-->
          <!--            sortable="custom"-->
          <!--            show-tooltip-when-overflow-->
          <!--          />-->
          <!--          <el-table-column-->
          <!--            prop="lm_date"-->
          <!--            label="创建时间"-->
          <!--            show-tooltip-when-overflow-->
          <!--            width="160"-->
          <!--            sortable="custom"-->
          <!--          />-->
          <el-table-column
            label="操作"
            fixed="right"
@@ -278,11 +313,12 @@
import { validateCode } from '@/utils/global'
import elDragDialog from '@/directive/el-drag-dialog'
import waves from '@/directive/waves'
import TableColumnSettings from '@/components/TableColumnSettings'
export default {
  name: 'Zzjg',
  components: {
    Pagination, ImportPicker
    Pagination, ImportPicker, TableColumnSettings
  },
  directives: { elDragDialog, waves },
  data() {
@@ -316,6 +352,82 @@
      total: 10,
      tableData: [],
      tableColumnSettingsArray: [
        { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 隐藏列  show: false隐藏,true显示
        { minWidth: false, width: 55, prop: 'RowNum', label: '序号', id: 2, show: true, fixed: 'left', sortable: false }, // custom
        {
          minWidth: 110,
          width: false,
          prop: 'code',
          label: '部位编码',
          id: 3,
          show: true,
          fixed: false,
          sortable: true
        },
        {
          minWidth: 110,
          width: false,
          prop: 'name',
          label: '部位名称',
          id: 4,
          show: true,
          fixed: false,
          sortable: true
        },
        {
          minWidth: 330,
          width: false,
          prop: 'description',
          label: '点检要求',
          id: 5,
          show: true,
          fixed: false,
          sortable: true
        },
        {
          minWidth: false,
          width: 110,
          prop: 'isscan',
          label: '选择扫码',
          id: 6,
          show: true,
          fixed: false,
          sortable: true
        },
        {
          minWidth: false,
          width: 110,
          prop: 'cycle',
          label: '点检周期',
          id: 7,
          show: true,
          fixed: false,
          sortable: true
        },
        {
          minWidth: false,
          width: 110,
          prop: 'lm_user',
          label: '创建人员',
          id: 8,
          show: true,
          fixed: false,
          sortable: true
        },
        {
          minWidth: false,
          width: 160,
          prop: 'lm_date',
          label: '创建时间',
          id: 9,
          show: true,
          fixed: false,
          sortable: true
        }
      ],
      tableTimeStampKey: new Date().getTime(), // 表格key
      dialogVisible: false,
      dialogForm: {
        id: '',
@@ -363,6 +475,13 @@
    this.getHeight()
  },
  methods: {
    tableColumnUpdate(val, isCopyTrue) {
      if (isCopyTrue) {
        this.tableColumnSettingsArray = val
      }
      this.tableTimeStampKey = new Date().getTime()
      this.$refs.tableDataRef.doLayout()
    },
    async getDeviceCheckItemSearch() {
      const res = await DeviceCheckItemSearch(this.form)
      this.tableData = res.data