loulijun2021
2022-08-25 4ae49d50244c67d5e2bda208019be4944870c695
1.点检部位增删查改实现
已修改8个文件
2018 ■■■■■ 文件已修改
src/api/sbgl.js 159 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/kb/zhkb.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sbgl/bybw.vue 515 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sbgl/djbw.vue 538 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sbgl/djbz.vue 743 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sbgl/sbqd.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/template.vue 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/sbgl.js
@@ -102,3 +102,162 @@
    params: data
  })
}
// 设备点检项列表查询
export function DeviceCheckItemSearch(data) {
  return request({
    url: 'DeviceManager/DeviceCheckItemSearch',
    method: 'get',
    params: data
  })
}
// 设备点检项新增编辑
export function AddUpdateDeviceCheckItem(data) {
  return request({
    url: 'DeviceManager/AddUpdateDeviceCheckItem',
    method: 'post',
    data
  })
}
// 设备点检项删除
export function DeleteDeviceCheckItem(data) {
  return request({
    url: 'DeviceManager/DeleteDeviceCheckItem',
    method: 'post',
    params: data
  })
}
// 设备保养项列表查询
export function DeviceMaiItemSearch(data) {
  return request({
    url: 'DeviceManager/DeviceMaiItemSearch',
    method: 'get',
    params: data
  })
}
// 设备保养项新增编辑
export function AddUpdateDeviceMaiItem(data) {
  return request({
    url: 'DeviceManager/AddUpdateDeviceMaiItem',
    method: 'post',
    data
  })
}
// 设备保养项删除
export function DeleteDeviceMaiItem(data) {
  return request({
    url: 'DeviceManager/DeleteDeviceMaiItem',
    method: 'post',
    params: data
  })
}
// 设备点检标准列表查询
export function DeviceCheckStandArdSearch(data) {
  return request({
    url: 'DeviceManager/DeviceCheckStandArdSearch',
    method: 'get',
    params: data
  })
}
// 设备点检标准新增、编辑获取检验项目下拉列表
export function DeviceCheckItemSelect() {
  return request({
    url: 'DeviceManager/DeviceCheckItemSelect',
    method: 'get'
  })
}
// 设备点检标准编辑/查看获取数据
export function ViewDeviceCheckStanedSearch(data) {
  return request({
    url: 'DeviceManager/ViewDeviceCheckStanedSearch',
    method: 'post',
    params: data
  })
}
// 设备点检标准新增编辑
export function AddUpdateDeviceCheckStandArd(data, opertype) {
  return request({
    url: 'DeviceManager/AddUpdateDeviceCheckStandArd?opertype=' + opertype,
    method: 'post',
    data
  })
}
// 设备点检标准删除
export function DeleteDeviceCheckStaned(data) {
  return request({
    url: 'DeviceManager/DeleteDeviceCheckStaned',
    method: 'post',
    params: data
  })
}
// 设备点检标准关联工作站查询
export function DeviceCheckStanedAssociationEqp(data) {
  return request({
    url: 'DeviceManager/DeviceCheckStanedAssociationEqp',
    method: 'get',
    params: data
  })
}
// 设备点检标准关联工作站提交
export function SaveDeviceCheckStanedAssociationEqp(data, checkstand_code) {
  return request({
    url: 'DeviceManager/SaveDeviceCheckStanedAssociationEqp?checkstand_code=' + checkstand_code,
    method: 'post',
    data
  })
}
// 设备保养标准列表查询
export function DeviceRepairStandArdSearch(data) {
  return request({
    url: 'DeviceManager/DeviceRepairStandArdSearch',
    method: 'get',
    params: data
  })
}
// 设备保养标准新增、编辑获取保养项目下拉列表
export function DeviceRepairItemSelect() {
  return request({
    url: 'DeviceManager/DeviceRepairItemSelect',
    method: 'get'
  })
}
// 设备保养标准编辑/查看获取数据
export function ViewDeviceRepairStanedSearch(data) {
  return request({
    url: 'DeviceManager/ViewDeviceRepairStanedSearch',
    method: 'post',
    params: data
  })
}
// 设备保养标准新增编辑
export function AddUpdateDeviceRepairStandArd(data, opertype) {
  return request({
    url: 'DeviceManager/AddUpdateDeviceRepairStandArd?opertype=' + opertype,
    method: 'post',
    data
  })
}
// 设备保养标准删除
export function DeleteDeviceRepairStaned(data) {
  return request({
    url: 'DeviceManager/DeleteDeviceRepairStaned',
    method: 'post',
    params: data
  })
}
// 设备保养标准关联工作站查询
export function DeviceRepairStanedAssociationEqp(data) {
  return request({
    url: 'DeviceManager/DeviceRepairStanedAssociationEqp',
    method: 'get',
    params: data
  })
}
// 设备保养标准关联工作站提交
export function SaveDeviceRepairStanedAssociationEqp(data, repairstand_code) {
  return request({
    url: 'DeviceManager/SaveDeviceRepairStanedAssociationEqp?repairstand_code=' + repairstand_code,
    method: 'post',
    params: data
  })
}
src/router/index.js
@@ -158,7 +158,7 @@
        meta: { code: '1021', title: '设备组', icon: '', keepAlive: true }
      }, {
        path: 'sbqd',
        name: '设备清单Cancel',
        name: 'sbqdCancel',
        code: '1022',
        component: () => import('@/views/sbgl/sbqd'),
        meta: { code: '1022', title: '设备清单', icon: '', keepAlive: true }
src/views/kb/zhkb.vue
@@ -612,7 +612,8 @@
      leftTopData: [],
      tableData: [],
      tableDataRank: []
      tableDataRank: [],
      lineCodeArr: []
    }
  },
@@ -642,6 +643,7 @@
      this.lineArr.forEach((item, index) => {
        // if (index === 0) {
        this.handleEveryLine(item, index)
        this.lineCodeArr.push(item.code)
        // }
      })
    },
@@ -650,16 +652,16 @@
      const res = await LineSearchTopLeftData([item])
      console.log(res, 7)
      let res1, res2, res3, res4
      if (res.data[0].linecode === 'CXSB001') {
      if (res.data[0].linecode === this.lineCodeArr[0]) {
        res1 = res
      }
      if (res.data[0].linecode === 'CXSB002') {
      if (res.data[0].linecode === this.lineCodeArr[1]) {
        res2 = res
      }
      if (res.data[0].linecode === 'CXSB003') {
      if (res.data[0].linecode === this.lineCodeArr[2]) {
        res3 = res
      }
      if (res.data[0].linecode === 'CXSB004') {
      if (res.data[0].linecode === this.lineCodeArr[3]) {
        res4 = res
      }
src/views/sbgl/bybw.vue
@@ -1,11 +1,520 @@
<template />
<template>
  <div>
    <div class="body" :style="{height:mainHeight+'px'}">
      <div class="bodyTopButtonGroup">
        <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
        <el-button icon="el-icon-download" @click="upload">导入</el-button>
      </div>
      <div class="bodyTopFormGroup">
        <el-form
          ref="form"
          :model="form"
          label-width="80px"
          inline
          style="display: flex;justify-content: space-between"
        >
          <div class="elForm">
            <el-form-item label="部位编码" style=" display: flex;">
              <el-input v-model="form.checkitemcode" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="部位名称" style=" display: flex;">
              <el-input v-model="form.checkitemname" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="保养要求" style=" display: flex;">
              <el-input v-model="form.maidescr" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="选中扫码" style=" display: flex;">
              <el-select v-model="form.isqrcode" style="width: 200px" placeholder="请选择">
                <el-option
                  v-for="item in isqrcodeArr"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="点检周期" style=" display: flex;">
              <el-select v-model="form.cycle" style="width: 200px" placeholder="请选择">
                <el-option
                  v-for="item in cycleArr"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                />
              </el-select>
            </el-form-item>
          </div>
          <div style="display: flex;align-items: start;margin-top: 5px;z-index: 2">
            <el-button type="primary" icon="el-icon-search" @click="search">查询</el-button>
            <el-button type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
          </div>
        </el-form>
      </div>
      <div class="elTableDiv">
        <el-table
          :data="tableData"
          :height="tableHeight+'px'"
          border
          :row-class-name="tableRowClassName"
          :style="{width: 100+'%',height:tableHeight+'px',}"
          highlight-current-row
          :header-cell-style="this.$headerCellStyle"
          :cell-style="this.$cellStyle"
          @sort-change="sortChange"
        >
          <!--          <el-table-column-->
          <!--            type="selection"-->
          <!--            width="50"-->
          <!--          />-->
          <el-table-column
            prop="RowNum"
            width="50"
            label="序号"
          />
          <el-table-column
            prop="org_code"
            label="部位编码"
            sortable="custom"
          />
          <el-table-column
            prop="org_name"
            label="部位名称"
            sortable="custom"
          />
          <el-table-column
            prop="description"
            label="保养要求"
            sortable="custom"
          />
          <el-table-column
            prop="parentorg_name"
            label="选择扫码"
            sortable="custom"
          />
          <el-table-column
            prop="parentorg_name"
            label="点检周期"
            sortable="custom"
          />
          <el-table-column
            prop="lm_user"
            label="创建人员"
            sortable="custom"
          />
          <el-table-column
            prop="lm_date"
            label="创建时间"
            width="160"
            sortable="custom"
          />
          <el-table-column
            label="操作"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-button type="text" @click="edit('edit',row)">编辑</el-button>
                <el-button type="text" @click="del(row)">删除</el-button>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!--分页-->
      <pagination
        :total="total"
        :page.sync="form.page"
        :limit.sync="form.rows"
        align="right"
        layout="prev, pager, next,sizes"
        popper-class="select_bottom"
        @pagination="getDeviceMaiItemSearch"
      />
    </div>
    <el-dialog
      :title="operation==='add'?'新增':'编辑'"
      :visible.sync="dialogVisible"
      width="800px"
      :close-on-click-modal="false"
      top="15vh"
      @closed="handleClose"
      @close="handleClose"
    >
      <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
        <el-form-item label="部位编码" prop="OrgCode">
          <el-input v-model="dialogForm.OrgCode" :disabled="operation!=='add'" style="width: 200px" />
        </el-form-item>
        <el-form-item label="部位名称" prop="OrgName">
          <el-input v-model="dialogForm.OrgName" style="width: 200px" />
        </el-form-item>
        <el-form-item prop="SupUnit" label="保养周期">
          <el-select
            v-model="dialogForm.SupUnit"
            style="width: 200px"
            placeholder="请选择"
            :popper-append-to-body="false"
          >
            <el-option
              v-for="item in SupUnitArr"
              :key="item.code"
              :label="item.name"
              :value="item.code"
            />
          </el-select>
        </el-form-item>
        <el-form-item prop="SupUnit" label="选择扫码">
          <el-select
            v-model="dialogForm.SupUnit"
            style="width: 200px"
            placeholder="请选择"
            :popper-append-to-body="false"
          >
            <el-option
              v-for="item in SupUnitArr"
              :key="item.code"
              :label="item.name"
              :value="item.code"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="保养要求" prop="OrgName">
          <el-input v-model="dialogForm.OrgName" type="textarea" style="width: 200px" />
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button @click="dialogVisibleCancel">取 消</el-button>
          <el-button type="primary" @click="dialogVisibleConfirm">确 定</el-button>
        </div>
      </span>
    </el-dialog>
    <!--导入组件-->
    <import-picker ref="importPickerFunc" class="importPickerClass" :shows.sync="shows" :title="title_value" :colos="colos" :code="code" />
  </div>
</template>
<script>
import Pagination from '@/components/Pagination'
import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz'
import { getCookie } from '@/utils/auth'
import { DeviceCheckItemSearch, DeviceMaiItemSearch } from '@/api/sbgl'
import ImportPicker from '@/components/ImportPicker'
const SER_HZ = /^[\u4e00-\u9fa5]+$/
export default {
  name: 'Bybw'
  name: 'Zzjg',
  components: {
    Pagination, ImportPicker
  },
  data() {
    const validateName = (rule, value, callback) => {
      if (!value) {
        return callback(new Error('请输入编码'))
      } else {
        if (SER_HZ.test(value)) {
          return callback(new Error('编码不能为中文'))
        } else {
          callback()
        }
      }
    }
    const validateTypeCode = (rule, value, callback) => {
      if (!value) {
        return callback(new Error('请选择上级'))
      } else {
        callback()
      }
    }
    return {
      mainHeight: 0,
      tableHeight: 0,
      form: {
        checkitemcode: '', // 部位编码
        checkitemname: '', // 部位名称
        maidescr: '', // 保养要求
        isqrcode: '', // 选中扫码
        cycle: '', // 点检周期
        prop: 'lm_date', // 排序字段
        order: 'desc', // 排序字段
        page: 1, // 第几页
        rows: 20 // 每页多少条
      },
      isqrcodeArr: [
      ],
      cycleArr: [
      ],
      total: 10,
      tableData: [],
      dialogVisible: false,
      dialogForm: {
        OrgType: '',
        OrgCode: '',
        OrgName: '',
        SupUnit: ''// 上级单位
      },
      operation: '',
      dialogFormRules: {
        OrgType: [
          { required: true, message: '请输入选择类型', trigger: ['blur', 'change'] }
        ],
        OrgCode: [
          { required: true, validator: validateName, trigger: ['blur', 'change'] }
        ],
        OrgName: [
          { required: true, message: '请输入名称', trigger: ['blur', 'change'] }
        ],
        SupUnit: [
          { required: true, validator: validateTypeCode, trigger: ['blur', 'change'] }
        ]
      },
      title_value: '数据导入 / 保养部位',
      code: '4',
      shows: false
    }
  },
  watch: {
    shows() {
      if (!this.shows) {
        this.getDeviceMaiItemSearch()
      }
    }
  },
  created() {
    this.getDeviceMaiItemSearch()
  },
  mounted() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
  },
  methods: {
    async getDeviceMaiItemSearch() {
      const res = await DeviceMaiItemSearch(this.form)
      this.tableData = res.data
      this.total = res.count
    },
    // 排序改变时
    sortChange({ column, prop, order }) {
      if (order === 'descending') {
        order = 'desc'
      } else if (order === 'ascending') {
        order = 'asc'
      } else {
        order = 'desc'
      }
      this.form.order = order
      this.form.prop = prop
      this.getDeviceMaiItemSearch()
    },
    // 查询
    search() {
      this.getDeviceMaiItemSearch()
    },
    // 导入按钮
    upload() {
      this.shows = true
      this.$refs.importPickerFunc.newDataFunc()
    },
    colos() {
      this.shows = false
    },
    // 重置
    reset() {
      this.form.OrgCode = ''
      this.form.OrgName = ''
      this.form.OrgType = ''
      this.form.UserName = ''
      this.getDeviceMaiItemSearch()
    },
    // 新增按钮
    add(operation) {
      this.operation = operation
      this.dialogVisible = true
    },
    // 修改按钮
    edit(operation, row) {
      this.operation = operation
      this.dialogVisible = true
      this.$nextTick(() => {
        this.dialogForm.OrgCode = row.org_code
        this.dialogForm.OrgName = row.org_name
        this.dialogForm.SupUnit = row.parent_id
      })
    },
    // 删除按钮
    async del(row) {
      this.$confirm('是否确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        DeleteOrganization({ orgid: row.code }).then(res => {
          if (res.code === '200') {
            this.$message.success('删除成功!')
            this.getDeviceMaiItemSearch()
          }
        })
      }).catch(() => {
        this.$message.info('已取消删除')
      })
    },
    // 对话框关闭事件
    handleClose() {
      this.dialogForm.OrgType = ''
      this.dialogForm.OrgCode = ''
      this.dialogForm.OrgName = ''
      this.dialogForm.SupUnit = ''
      this.$refs.dialogForm.clearValidate()
    },
    // 对话框取消
    dialogVisibleCancel() {
      this.dialogVisible = false
    },
    // 对话框确认
    dialogVisibleConfirm() {
      this.$refs.dialogForm.validate(valid => {
        if (valid) {
          const data = {
            OrganCode: this.dialogForm.OrgCode,
            OrganName: this.dialogForm.OrgName,
            OperType: this.operation === 'add' ? 'Add' : 'Update',
            Operator: getCookie('admin')
          }
          AddUpdateOrganization(data).then(res => {
            if (res.code === '200') {
              this.$message.success(this.operation === 'add' ? '添加成功!' : '修改成功!')
              this.dialogVisible = false
              this.getDeviceMaiItemSearch()
            } else {
              this.$message.error(this.operation === 'add' ? '添加失败!' : '修改失败!')
            }
          })
        }
      })
    },
    // 获取页面高度
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 85
        this.tableHeight = this.mainHeight - 200
      })
    },
    tableRowClassName({ row, rowIndex }) {
      return 'custom-row'
    }
  }
}
</script>
<style scoped>
<!--公共页面样式-->
<style lang="scss" scoped>
$main_color: #42b983;
::v-deep .el-button--text {
  font-size: 14px;
  cursor: pointer;
}
.el-icon-share, .el-icon-delete, .el-icon-edit-outline {
  color: $main_color;
  cursor: pointer;
}
.el-icon-edit-outline {
  margin-right: 15px;
}
::v-deep .el-button--primary, .el-button--default, .el-button--info {
  height: 34px;
  display: flex;
  align-items: center;
  padding: 0 15px;
}
::v-deep .el-button--primary {
  //background-color: $main_color !important;
}
::v-deep .el-button--default {
  background-color: #f8f8fa;
  border: none;
}
::v-deep .el-input__inner {
  height: 34px;
  line-height: 34px;
  //color: #a7a7a7;
}
::v-deep .el-dialog__body {
  padding: 20px 100px !important;
}
::v-deep .dialogVisibleRoles .el-dialog__body {
  padding: 20px 20px !important;
}
::v-deep .importPickerClass .el-dialog__body {
  padding: 20px 20px !important;
}
::v-deep .el-dialog__footer {
  display: flex;
  justify-content: flex-end;
}
::v-deep .el-table .caret-wrapper {
  transform: scale(0.8);
}
::v-deep .cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
::v-deep .el-table::before {
  height: 0;
}
::v-deep .el-table__body-wrapper {
  background-color: #f8f8fa;
}
::v-deep .el-table__body .el-table__row.hover-row td {
  background-color: #eaecef;
}
::v-deep .el-form--inline .el-form-item__label {
  color: #a7a7a7;
}
.body ::v-deep .el-divider {
  border: 1px solid #eee;
  width: 99%;
  margin: 10px auto;
}
.body ::v-deep .el-form-item {
  margin-bottom: 0;
}
.userDialogVisible ::v-deep .el-form-item {
  margin-bottom: 0;
}
</style>
<style>
.el-table .custom-row {
  background: #f8f8fa;
}
</style>
src/views/sbgl/djbw.vue
@@ -1,11 +1,543 @@
<template />
<template>
  <div>
    <div class="body" :style="{height:mainHeight+'px'}">
      <div class="bodyTopButtonGroup">
        <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
        <el-button icon="el-icon-download" @click="upload">导入</el-button>
      </div>
      <div class="bodyTopFormGroup">
        <el-form
          ref="form"
          :model="form"
          label-width="80px"
          inline
          style="display: flex;justify-content: space-between"
        >
          <div class="elForm">
            <el-form-item label="部位编码" style=" display: flex;">
              <el-input v-model="form.checkitemcode" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="部位名称" style=" display: flex;">
              <el-input v-model="form.checkitemname" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="点检要求" style=" display: flex;">
              <el-input v-model="form.checkdescr" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="选中扫码" style=" display: flex;">
              <el-select v-model="form.isqrcode" style="width: 200px" placeholder="请选择">
                <el-option
                  v-for="item in isqrcodeArr"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="点检周期" style=" display: flex;">
              <el-select v-model="form.cycle" style="width: 200px" placeholder="请选择">
                <el-option
                  v-for="item in cycleArr"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                />
              </el-select>
            </el-form-item>
          </div>
          <div style="display: flex;align-items: start;margin-top: 5px;z-index: 2">
            <el-button type="primary" icon="el-icon-search" @click="search">查询</el-button>
            <el-button type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
          </div>
        </el-form>
      </div>
      <div class="elTableDiv">
        <el-table
          :data="tableData"
          :height="tableHeight+'px'"
          border
          :row-class-name="tableRowClassName"
          :style="{width: 100+'%',height:tableHeight+'px',}"
          highlight-current-row
          :header-cell-style="this.$headerCellStyle"
          :cell-style="this.$cellStyle"
          @sort-change="sortChange"
        >
          <!--          <el-table-column-->
          <!--            type="selection"-->
          <!--            width="50"-->
          <!--          />-->
          <el-table-column
            prop="RowNum"
            width="50"
            label="序号"
          />
          <el-table-column
            prop="code"
            label="部位编码"
            sortable="custom"
          />
          <el-table-column
            prop="name"
            label="部位名称"
            sortable="custom"
          />
          <el-table-column
            prop="description"
            label="点检要求"
            sortable="custom"
          />
          <el-table-column
            prop="isscan"
            label="选择扫码"
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div v-if="row.isscan==='Y'">是</div>
              <div v-if="row.isscan==='N'">否</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="cycle"
            label="点检周期"
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div v-if="row.cycle==='D'">日</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="lm_user"
            label="创建人员"
            sortable="custom"
          />
          <el-table-column
            prop="lm_date"
            label="创建时间"
            width="160"
            sortable="custom"
          />
          <el-table-column
            label="操作"
            fixed="right"
            width="120"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-tooltip class="item" effect="dark" content="编辑" placement="top">
                  <i class="el-icon-edit-outline" @click="edit('edit',row)" />
                </el-tooltip>
                <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">
                  <i class="el-icon-delete" @click="del(row)" />
                </el-tooltip>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!--分页-->
      <pagination
        :total="total"
        :page.sync="form.page"
        :limit.sync="form.rows"
        align="right"
        layout="prev, pager, next,sizes"
        popper-class="select_bottom"
        @pagination="getDeviceCheckItemSearch"
      />
    </div>
    <el-dialog
      :title="operation==='add'?'新增':'编辑'"
      :visible.sync="dialogVisible"
      width="800px"
      :close-on-click-modal="false"
      top="15vh"
      @closed="handleClose"
      @close="handleClose"
    >
      <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
        <el-form-item label="部位编码" prop="checkitemcode">
          <el-input v-model="dialogForm.checkitemcode" :disabled="operation!=='add'" style="width: 200px" />
        </el-form-item>
        <el-form-item label="部位名称" prop="checkitemname">
          <el-input v-model="dialogForm.checkitemname" style="width: 200px" />
        </el-form-item>
        <el-form-item prop="cycle" label="点检周期">
          <el-select
            v-model="dialogForm.cycle"
            style="width: 200px"
            placeholder="请选择"
            :popper-append-to-body="false"
          >
            <el-option
              v-for="item in cycleArr"
              :key="item.code"
              :label="item.name"
              :value="item.code"
            />
          </el-select>
        </el-form-item>
        <el-form-item prop="isqrcode" label="选择扫码">
          <el-select
            v-model="dialogForm.isqrcode"
            style="width: 200px"
            placeholder="请选择"
            :popper-append-to-body="false"
          >
            <el-option
              v-for="item in isqrcodeArr"
              :key="item.code"
              :label="item.name"
              :value="item.code"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="点检要求" prop="checkitemdescr">
          <el-input v-model="dialogForm.checkitemdescr" type="textarea" style="width: 200px" />
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button @click="dialogVisibleCancel">取 消</el-button>
          <el-button type="primary" @click="dialogVisibleConfirm">确 定</el-button>
        </div>
      </span>
    </el-dialog>
    <!--导入组件-->
    <import-picker ref="importPickerFunc" class="importPickerClass" :shows.sync="shows" :title="title_value" :colos="colos" :code="code" />
  </div>
</template>
<script>
import Pagination from '@/components/Pagination'
import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz'
import { getCookie } from '@/utils/auth'
import { AddUpdateDeviceCheckItem, DeleteDeviceCheckItem, DeviceCheckItemSearch } from '@/api/sbgl'
import ImportPicker from '@/components/ImportPicker'
const SER_HZ = /^[\u4e00-\u9fa5]+$/
export default {
  name: 'Djbw'
  name: 'Zzjg',
  components: {
    Pagination, ImportPicker
  },
  data() {
    const validateName = (rule, value, callback) => {
      if (!value) {
        return callback(new Error('请输入编码'))
      } else {
        if (SER_HZ.test(value)) {
          return callback(new Error('编码不能为中文'))
        } else {
          callback()
        }
      }
    }
    return {
      mainHeight: 0,
      tableHeight: 0,
      form: {
        checkitemcode: '', // 部位编码
        checkitemname: '', // 部位名称
        checkdescr: '', // 点检要求
        isqrcode: '', // 选中扫码
        cycle: '', // 点检周期
        prop: 'lm_date', // 排序字段
        order: 'desc', // 排序字段
        page: 1, // 第几页
        rows: 20 // 每页多少条
      },
      isqrcodeArr: [
        { code: 'Y', name: '是' },
        { code: 'N', name: '否' }
      ],
      cycleArr: [
        { code: 'D', name: '日' }
      ],
      total: 10,
      tableData: [],
      dialogVisible: false,
      dialogForm: {
        id: '',
        checkitemcode: '', // 设备点检部位编码
        checkitemname: '', // 设备点检部位名称
        checkitemdescr: '', // 设备点检部位要求
        cycle: 'D', // 设备点检部位周期
        isqrcode: 'Y', // 是否扫码
        OperType: '' // 操作类型
      },
      operation: '',
      dialogFormRules: {
        checkitemcode: [
          { required: true, validator: validateName, trigger: ['blur', 'change'] }
        ],
        checkitemname: [
          { required: true, message: '请输入部位名称', trigger: ['blur', 'change'] }
        ],
        cycle: [
          { required: true, message: '', trigger: ['blur', 'change'] }
        ],
        isqrcode: [
          { required: true, message: '', trigger: ['blur', 'change'] }
        ]
      },
      title_value: '数据导入 / 点检部位',
      code: '10',
      shows: false
    }
  },
  watch: {
    shows() {
      if (!this.shows) {
        this.getDeviceCheckItemSearch()
      }
    }
  },
  created() {
    this.getDeviceCheckItemSearch()
  },
  mounted() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
  },
  methods: {
    async getDeviceCheckItemSearch() {
      const res = await DeviceCheckItemSearch(this.form)
      this.tableData = res.data
      this.total = res.count
    },
    // 排序改变时
    sortChange({ column, prop, order }) {
      if (order === 'descending') {
        order = 'desc'
      } else if (order === 'ascending') {
        order = 'asc'
      } else {
        order = 'desc'
      }
      this.form.order = order
      this.form.prop = prop
      this.getDeviceCheckItemSearch()
    },
    // 查询
    search() {
      this.getDeviceCheckItemSearch()
    },
    // 重置
    reset() {
      this.form.checkitemcode = ''
      this.form.checkitemname = ''
      this.form.checkitemdescr = ''
      this.form.isqrcode = ''
      this.form.cycle = ''
      this.getDeviceCheckItemSearch()
    },
    // 新增按钮
    add(operation) {
      this.operation = operation
      this.dialogVisible = true
    },
    // 修改按钮
    edit(operation, row) {
      this.operation = operation
      this.dialogVisible = true
      this.$nextTick(() => {
        this.dialogForm.id = row.id
        this.dialogForm.cycle = row.cycle
        this.dialogForm.isscan = row.isqrcode
        this.dialogForm.checkitemcode = row.code
        this.dialogForm.checkitemname = row.name
        this.dialogForm.checkitemdescr = row.description
      })
    },
    // 删除按钮
    async del(row) {
      this.$confirm('是否确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        DeleteDeviceCheckItem({ checkitemcode: row.code }).then(res => {
          if (res.code === '200') {
            this.$message.success('删除成功!')
            this.getDeviceCheckItemSearch()
          }
        })
      }).catch(() => {
        this.$message.info('已取消删除')
      })
    },
    // 对话框关闭事件
    handleClose() {
      this.dialogForm.id = ''
      this.dialogForm.checkitemcode = ''
      this.dialogForm.checkitemname = ''
      this.dialogForm.checkitemdescr = ''
      this.dialogForm.cycle = 'D'
      this.dialogForm.isqrcode = 'Y'
      this.$refs.dialogForm.clearValidate()
    },
    // 对话框取消
    dialogVisibleCancel() {
      this.dialogVisible = false
    },
    // 对话框确认
    dialogVisibleConfirm() {
      this.$refs.dialogForm.validate(valid => {
        if (valid) {
          const data = {
            id: this.dialogForm.id,
            checkitemcode: this.dialogForm.checkitemcode,
            checkitemname: this.dialogForm.checkitemname,
            checkitemdescr: this.dialogForm.checkitemdescr,
            cycle: this.dialogForm.cycle,
            isqrcode: this.dialogForm.isqrcode,
            OperType: this.operation === 'add' ? 'Add' : 'Update'
            // Operator: getCookie('admin')
          }
          AddUpdateDeviceCheckItem(data).then(res => {
            if (res.code === '200') {
              this.$message.success(this.operation === 'add' ? '添加成功!' : '修改成功!')
              this.dialogVisible = false
              this.getDeviceCheckItemSearch()
            } else {
              this.$message.error(this.operation === 'add' ? '添加失败!' : '修改失败!')
            }
          })
        }
      })
    },
    // 获取页面高度
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 85
        this.tableHeight = this.mainHeight - 200
      })
    },
    tableRowClassName({ row, rowIndex }) {
      return 'custom-row'
    },
    // 导入按钮
    upload() {
      this.shows = true
      this.$refs.importPickerFunc.newDataFunc()
    },
    colos() {
      this.shows = false
    }
  }
}
</script>
<style scoped>
<!--公共页面样式-->
<style lang="scss" scoped>
$main_color: #42b983;
::v-deep .el-button--text {
  font-size: 14px;
  cursor: pointer;
}
.el-icon-share, .el-icon-delete, .el-icon-edit-outline {
  color: $main_color;
  cursor: pointer;
}
.el-icon-edit-outline {
  margin-right: 15px;
}
::v-deep .el-button--primary, .el-button--default, .el-button--info {
  height: 34px;
  display: flex;
  align-items: center;
  padding: 0 15px;
}
::v-deep .el-button--primary {
  //background-color: $main_color !important;
}
::v-deep .el-button--default {
  background-color: #f8f8fa;
  border: none;
}
::v-deep .el-input__inner {
  height: 34px;
  line-height: 34px;
  //color: #a7a7a7;
}
::v-deep .el-dialog__body {
  padding: 20px 100px !important;
}
::v-deep .dialogVisibleRoles .el-dialog__body {
  padding: 20px 20px !important;
}
::v-deep .importPickerClass .el-dialog__body {
  padding: 20px 20px !important;
}
::v-deep .el-dialog__footer {
  display: flex;
  justify-content: flex-end;
}
::v-deep .el-table .caret-wrapper {
  transform: scale(0.8);
}
::v-deep .cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
::v-deep .el-table::before {
  height: 0;
}
::v-deep .el-table__body-wrapper {
  background-color: #f8f8fa;
}
::v-deep .el-table__body .el-table__row.hover-row td {
  background-color: #eaecef;
}
::v-deep .el-form--inline .el-form-item__label {
  color: #a7a7a7;
}
.body ::v-deep .el-divider {
  border: 1px solid #eee;
  width: 99%;
  margin: 10px auto;
}
.body ::v-deep .el-form-item {
  margin-bottom: 0;
}
.userDialogVisible ::v-deep .el-form-item {
  margin-bottom: 0;
}
</style>
<style>
.el-table .custom-row {
  background: #f8f8fa;
}
</style>
src/views/sbgl/djbz.vue
@@ -1,11 +1,748 @@
<template />
<template>
  <div>
    <div class="body" :style="{height:mainHeight+'px'}">
      <div class="bodyTopButtonGroup">
        <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
        <el-button icon="el-icon-download" @click="upload">导入</el-button>
      </div>
      <div class="bodyTopFormGroup">
        <el-form
          ref="form"
          :model="form"
          label-width="80px"
          inline
          style="display: flex;justify-content: space-between"
        >
          <div class="elForm">
            <el-form-item label="标准编码" style=" display: flex;">
              <el-input v-model="form.checkstandcode" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="标准名称" style=" display: flex;">
              <el-input v-model="form.checkstandname" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="点检管控" style=" display: flex;">
              <el-select v-model="form.checkcontr" style="width: 200px" placeholder="请选择">
                <el-option
                  v-for="item in checkcontrArr"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                />
              </el-select>
            </el-form-item>
          </div>
          <div style="display: flex;align-items: start;margin-top: 5px;z-index: 2">
            <el-button type="primary" icon="el-icon-search" @click="search">查询</el-button>
            <el-button type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
          </div>
        </el-form>
      </div>
      <div class="elTableDiv">
        <el-table
          :data="tableData"
          :height="tableHeight+'px'"
          border
          :row-class-name="tableRowClassName"
          :style="{width: 100+'%',height:tableHeight+'px',}"
          highlight-current-row
          :header-cell-style="this.$headerCellStyle"
          :cell-style="this.$cellStyle"
          @sort-change="sortChange"
        >
          <!--          <el-table-column-->
          <!--            type="selection"-->
          <!--            width="50"-->
          <!--          />-->
          <el-table-column
            prop="RowNum"
            width="50"
            label="序号"
          />
          <el-table-column
            prop="org_code"
            label="标准编码"
            sortable="custom"
          />
          <el-table-column
            prop="org_name"
            label="标准名称"
            sortable="custom"
          />
          <el-table-column
            prop="parentorg_name"
            label="标准描述"
            sortable="custom"
          />
          <el-table-column
            prop="parentorg_name"
            label="点检管控"
            sortable="custom"
          />
          <el-table-column
            prop="parentorg_name"
            label="关联设备"
            sortable="custom"
          />
          <el-table-column
            prop="lm_user"
            label="创建人员"
            sortable="custom"
          />
          <el-table-column
            prop="lm_date"
            label="创建时间"
            width="160"
            sortable="custom"
          />
          <el-table-column
            label="操作"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-button type="text" @click="edit('edit',row)">编辑</el-button>
                <el-button type="text" @click="del(row)">删除</el-button>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!--分页-->
      <pagination
        :total="total"
        :page.sync="form.page"
        :limit.sync="form.rows"
        align="right"
        layout="prev, pager, next,sizes"
        popper-class="select_bottom"
        @pagination="getDeviceCheckStandArdSearch"
      />
    </div>
    <el-dialog
      :title="operation==='add'?'新增':'编辑'"
      :visible.sync="dialogVisible"
      width="800px"
      :close-on-click-modal="false"
      top="8vh"
      @closed="handleClose"
      @close="handleClose"
    >
      <div>
        <i class="el-icon-s-operation" style="color:#42b983;margin: -20px 10px 20px 0" />设备点检标准信息
      </div>
      <div style="margin: 0 30px;">
        <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
          <el-form-item label="标准编码" prop="code">
            <el-input v-model="dialogForm.code" :disabled="operation!=='add'" style="width: 200px" />
          </el-form-item>
          <el-form-item label="标准名称" prop="name">
            <el-input v-model="dialogForm.name" style="width: 200px" />
          </el-form-item>
          <el-form-item prop="SupUnit" label="点检管控">
            <el-select
              v-model="dialogForm.enable"
              style="width: 200px"
              placeholder="请选择"
              :popper-append-to-body="false"
            >
              <el-option
                v-for="item in checkcontrArr"
                :key="item.code"
                :label="item.name"
                :value="item.code"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="标准描述" prop="description">
            <el-input v-model="dialogForm.description" type="textarea" style="width: 200px" />
          </el-form-item>
        </el-form>
      </div>
      <div>
        <i class="el-icon-s-operation" style="color:#42b983;margin: -20px 10px 20px 0" />设备点检点检信息
      </div>
      <div style="margin-bottom:10px">
        <el-button type="primary" icon="el-icon-circle-plus-outline" @click="addRow">新增</el-button>
      </div>
      <div class="elTableDiv">
        <el-table
          :data="tableDataDialog"
          :height="(tableHeight-300)+'px'"
          border
          :row-class-name="tableRowClassName"
          :style="{width: 100+'%',height:(tableHeight-300)+'px',}"
          highlight-current-row
          :header-cell-style="this.$headerCellStyle"
          :cell-style="this.$cellStyle"
        >
          <el-table-column
            type="index"
            width="50"
            label="序号"
          />
          <el-table-column
            prop="checkitem_code"
            label="点检部位编码"
          >
            <template slot-scope="{row}">
              <div v-if="row.isVisible===0">{{ row.checkitem_code }}</div>
              <el-select
                v-if="row.isVisible===1"
                v-model="row.checkitem_code"
                placeholder="请选择"
                @change="val=>selectChange(val,row)"
              >
                <el-option
                  v-for="item in checkItemSelectArr"
                  :key="item.name"
                  :label="item.code"
                  :value="item.name"
                />
              </el-select>
            </template>
          </el-table-column>
          <el-table-column
            prop="checkitem_name"
            label="点检部位名称"
          >
            <template slot-scope="{row}">
              <div v-if="row.isVisible===0">{{ row.checkitem_name }}</div>
              <el-select
                v-if="row.isVisible===1"
                v-model="row.checkitem_code"
                placeholder="请选择"
                @change="val=>selectChange(val,row)"
              >
                <el-option
                  v-for="item in checkItemSelectArr"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                />
              </el-select>
            </template>
          </el-table-column>
          <el-table-column
            prop="chkdesc"
            label="点检要求"
          >
            <template slot-scope="{row}">
              <div v-if="row.isVisible===0">{{ row.chkdesc }}</div>
              <el-input v-else v-model="row.chkdesc" />
            </template>
          </el-table-column>
          <el-table-column
            prop="isscan"
            label="选择扫码"
          >
            <template slot-scope="{row}">
              <div v-if="row.isVisible===0">{{ row.isscan==='Y'?'是':'否' }}</div>
              <el-select
                v-if="row.isVisible===1"
                v-model="row.isscan"
                placeholder="请选择"
              >
                <el-option
                  v-for="item in checkcontrArr"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                />
              </el-select>
            </template>
          </el-table-column>
          <el-table-column
            prop="cycle"
            label="点检周期"
          >
            <template slot-scope="{row}">
              <div v-if="row.isVisible===0">{{ row.cycle==='D'?'日':'' }}</div>
              <el-select
                v-if="row.isVisible===1"
                v-model="row.cycle"
                placeholder="请选择"
              >
                <el-option
                  v-for="item in cycleArr"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                />
              </el-select>
            </template>
          </el-table-column>
          <el-table-column
            label="操作"
            width="120"
            fixed="right"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-button v-if="row.isVisible===0" type="text" @click="editRow(row)">编辑</el-button>
                <el-button v-if="row.isVisible===0" type="text" @click="delRow(row)">删除</el-button>
                <el-button v-if="row.isVisible===1" type="text" @click="saveRow(row)">确认</el-button>
                <el-button v-if="row.isVisible===1" type="text" @click="cancelRow(row)">取消</el-button>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button @click="dialogVisibleCancel">取 消</el-button>
          <el-button type="primary" @click="dialogVisibleConfirm">确 定</el-button>
        </div>
      </span>
    </el-dialog>
    <!--导入组件-->
    <import-picker
      ref="importPickerFunc"
      class="importPickerClass"
      :shows.sync="shows"
      :title="title_value"
      :colos="colos"
      :code="code"
    />
  </div>
</template>
<script>
import Pagination from '@/components/Pagination'
import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz'
import { getCookie } from '@/utils/auth'
import ImportPicker from '@/components/ImportPicker'
import { AddUpdateDeviceCheckStandArd, DeviceCheckItemSelect, DeviceCheckStandArdSearch } from '@/api/sbgl'
const SER_HZ = /^[\u4e00-\u9fa5]+$/
export default {
  name: 'Djbz'
  name: 'Zzjg',
  components: {
    Pagination, ImportPicker
  },
  data() {
    const validateName = (rule, value, callback) => {
      if (!value) {
        return callback(new Error('请输入编码'))
      } else {
        if (SER_HZ.test(value)) {
          return callback(new Error('编码不能为中文'))
        } else {
          callback()
        }
      }
    }
    const validateTypeCode = (rule, value, callback) => {
      if (!value) {
        return callback(new Error('请选择上级'))
      } else {
        callback()
      }
    }
    return {
      mainHeight: 0,
      tableHeight: 0,
      form: {
        checkstandcode: '', // 标准编码
        checkstandname: '', // 标准名称
        checkcontr: '', // 点检管控
        prop: 'lm_date', // 排序字段
        order: 'desc', // 排序字段
        page: 1, // 第几页
        rows: 20 // 每页多少条
      },
      checkcontrArr: [
        { code: 'Y', name: '是' },
        { code: 'N', name: '否' }
      ],
      cycleArr: [
        { code: 'D', name: '日' }
      ],
      total: 10,
      tableData: [],
      dialogVisible: false,
      dialogForm: {
        code: '',
        name: '',
        enable: 'Y',
        description: ''// 上级单位
      },
      operation: '',
      dialogFormRules: {
        code: [
          { required: true, validator: validateName, trigger: ['blur', 'change'] }
        ],
        name: [
          { required: true, message: '请输入标准名称', trigger: ['blur', 'change'] }
        ],
        enable: [
          { required: true, message: '', trigger: ['blur', 'change'] }
        ]
      },
      tableDataDialog: [], // 表格数据
      tableDataDialogSelected: [], // 已选code
      checkItemSelectArr: [],
      title_value: '数据导入 / 点检部位',
      code: '4',
      shows: false
    }
  },
  watch: {
    shows() {
      if (!this.shows) {
        this.getDeviceCheckStandArdSearch()
      }
    }
  },
  created() {
    this.getDeviceCheckStandArdSearch()
  },
  mounted() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
  },
  methods: {
    async getDeviceCheckStandArdSearch() {
      console.log(this.form, 11)
      const res = await DeviceCheckStandArdSearch(this.form)
      this.tableData = res.data
      this.total = res.count
    },
    // 排序改变时
    sortChange({ column, prop, order }) {
      if (order === 'descending') {
        order = 'desc'
      } else if (order === 'ascending') {
        order = 'asc'
      } else {
        order = 'desc'
      }
      this.form.order = order
      this.form.prop = prop
      this.getDeviceCheckStandArdSearch()
    },
    // 查询
    search() {
      this.getDeviceCheckStandArdSearch()
    },
    // 导入按钮
    upload() {
      this.shows = true
      this.$refs.importPickerFunc.newDataFunc()
    },
    colos() {
      this.shows = false
    },
    // 重置
    reset() {
      this.form.OrgCode = ''
      this.form.OrgName = ''
      this.form.OrgType = ''
      this.form.UserName = ''
      this.getDeviceCheckStandArdSearch()
    },
    async getDeviceCheckItemSelect() {
      const { data: res } = await DeviceCheckItemSelect()
      this.checkItemSelectArr = res
    },
    // 新增按钮
    add(operation) {
      this.operation = operation
      this.dialogVisible = true
      this.getDeviceCheckItemSelect()
    },
    // 修改按钮
    edit(operation, row) {
      this.operation = operation
      this.dialogVisible = true
      this.getDeviceCheckItemSelect()
      this.$nextTick(() => {
        this.dialogForm.OrgCode = row.org_code
        this.dialogForm.OrgName = row.org_name
        this.dialogForm.SupUnit = row.parent_id
      })
    },
    // 删除按钮
    async del(row) {
      this.$confirm('是否确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        DeleteOrganization({ orgid: row.code }).then(res => {
          if (res.code === '200') {
            this.$message.success('删除成功!')
            this.getDeviceCheckStandArdSearch()
          }
        })
      }).catch(() => {
        this.$message.info('已取消删除')
      })
    },
    // 对话框关闭事件
    handleClose() {
      this.dialogForm.code = ''
      this.dialogForm.name = ''
      this.dialogForm.enable = 'Y'
      this.dialogForm.description = ''
      this.tableDataDialog = []
      this.$refs.dialogForm.clearValidate()
    },
    // 对话框取消
    dialogVisibleCancel() {
      this.dialogVisible = false
    },
    // 对话框确认
    dialogVisibleConfirm() {
      this.$refs.dialogForm.validate(valid => {
        if (valid) {
          let Data = []
          // 数组中对象相同的去重
          Data = this.tableDataDialog.filter((currentValue, currentIndex, selfArr) => {
            return selfArr.findIndex(item => item.checkitem_code === currentValue.checkitem_code) === currentIndex
          })
          Data.forEach((item, index) => {
            item.checkitem_seq = index + 1
          })
          console.log(Data, 999)
          const data = {
            'code': this.dialogForm.code,
            'name': this.dialogForm.name,
            'enable': this.dialogForm.enable,
            'description': this.dialogForm.description,
            'Data': Data
          }
          console.log(data, 111)
          AddUpdateDeviceCheckStandArd(data, this.operation === 'add' ? 'Add' : 'Update').then(res => {
            if (res.code === '200') {
              this.$message.success(this.operation === 'add' ? '添加成功!' : '修改成功!')
              this.dialogVisible = false
              this.getDeviceCheckStandArdSearch()
            } else {
              this.$message.error(this.operation === 'add' ? '添加失败!' : '修改失败!')
            }
          })
        }
      })
    },
    selectChange(val, row) {
      row.chkdesc = this.checkItemSelectArr.find(item => {
        return item.code === val || item.name === val
      }).description
      row.checkitem_code = this.checkItemSelectArr.find(item => {
        return item.code === val || item.name === val
      }).code
      row.checkitem_name = this.checkItemSelectArr.find(item => {
        return item.code === val || item.name === val
      }).name
    },
    // 新增行
    addRow() {
      let flag = false
      this.tableDataDialog.forEach(item => {
        if (item.isVisible === 1) {
          // return this.$message.info('请先确认或取消上条记录!')
          flag = true
        }
      })
      if (flag) {
        return this.$message.info('请先确认或取消上条记录!')
      }
      this.tableDataDialog.push({
        checkitem_code: '',
        checkitem_name: '',
        chkdesc: '',
        isscan: 'Y',
        cycle: 'D',
        isVisible: 1
      })
    },
    editRow(row) {
      this.tableDataDialogSelected.forEach((item, index) => {
        if (item === row.checkitem_code) {
          this.tableDataDialogSelected.splice(index, 1)
        }
      })
      this.tableDataDialog.forEach((item, index) => {
        if (item.checkitem_code === row.checkitem_code) {
          this.tableDataDialog.splice(index, 1, {
            checkitem_code: row.checkitem_code,
            checkitem_name: row.checkitem_name,
            chkdesc: row.chkdesc,
            isscan: row.isscan,
            cycle: row.cycle,
            isVisible: 1
          })
        }
      })
    },
    delRow(row) {
      this.tableDataDialog.forEach((item, index) => {
        if (item.checkitem_code === row.checkitem_code) {
          this.tableDataDialog.splice(index, 1)
        }
      })
      this.tableDataDialogSelected.forEach((item, index) => {
        if (item === row.checkitem_code) {
          this.tableDataDialogSelected.splice(index, 1)
        }
      })
    },
    saveRow(row) {
      if (this.tableDataDialogSelected.includes(row.checkitem_code)) {
        return this.$message.info('点检部位不能选择相同!')
      }
      this.tableDataDialogSelected.push(row.checkitem_code)
      row.isVisible = 0
      console.log(this.tableDataDialog)
    },
    cancelRow(row) {
      console.log(row, 111)
      this.tableDataDialog.forEach((item, index) => {
        if (item.checkitem_code === row.checkitem_code && item.isVisible === 1) {
          console.log(item)
          row.isVisible = 0
          this.tableDataDialog.splice(index, 1)
        }
      })
    },
    // 获取页面高度
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 85
        this.tableHeight = this.mainHeight - 200
      })
    },
    tableRowClassName({ row, rowIndex }) {
      return 'custom-row'
    }
  }
}
</script>
<style scoped>
<!--公共页面样式-->
<style lang="scss" scoped>
$main_color: #42b983;
::v-deep .el-button--text {
  font-size: 14px;
  cursor: pointer;
}
.el-icon-share, .el-icon-delete, .el-icon-edit-outline {
  color: $main_color;
  cursor: pointer;
}
.el-icon-edit-outline {
  margin-right: 15px;
}
::v-deep .el-button--primary, .el-button--default, .el-button--info {
  height: 34px;
  display: flex;
  align-items: center;
  padding: 0 15px;
}
::v-deep .el-button--primary {
  //background-color: $main_color !important;
}
::v-deep .el-button--default {
  background-color: #f8f8fa;
  border: none;
}
::v-deep .el-input__inner {
  height: 34px;
  line-height: 34px;
  //color: #a7a7a7;
}
//::v-deep .el-dialog__body {
//  padding: 20px 100px !important;
//}
::v-deep .el-dialog__body {
  padding: 20px 20px !important;
}
::v-deep .dialogVisibleRoles .el-dialog__body {
  padding: 20px 20px !important;
}
::v-deep .importPickerClass .el-dialog__body {
  padding: 20px 20px !important;
}
::v-deep .el-dialog__footer {
  display: flex;
  justify-content: flex-end;
}
::v-deep .el-table .caret-wrapper {
  transform: scale(0.8);
}
::v-deep .cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
::v-deep .el-table::before {
  height: 0;
}
::v-deep .el-table__body-wrapper {
  background-color: #f8f8fa;
}
::v-deep .el-table__body .el-table__row.hover-row td {
  background-color: #eaecef;
}
::v-deep .el-form--inline .el-form-item__label {
  color: #a7a7a7;
}
.body ::v-deep .el-divider {
  border: 1px solid #eee;
  width: 99%;
  margin: 10px auto;
}
.body ::v-deep .el-form-item {
  margin-bottom: 0;
}
.userDialogVisible ::v-deep .el-form-item {
  margin-bottom: 0;
}
::v-deep .el-select__caret{
  display: flex;
  align-items: center;
  justify-content: center;
}
</style>
<style>
.el-table .custom-row {
  background: #f8f8fa;
}
</style>
src/views/sbgl/sbqd.vue
@@ -1183,7 +1183,11 @@
.userDialogVisible ::v-deep .el-form-item {
  margin-bottom: 0;
}
::v-deep .el-select__caret{
  display: flex;
  justify-content: center;
  align-items: center;
}
</style>
<style>
src/views/template.vue
@@ -3,7 +3,7 @@
    <div class="body" :style="{height:mainHeight+'px'}">
      <div class="bodyTopButtonGroup">
        <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
        <el-button icon="el-icon-upload2" @click="upload">导入</el-button>
        <el-button icon="el-icon-download" @click="upload">导入</el-button>
      </div>
      <div class="bodyTopFormGroup">
@@ -22,7 +22,7 @@
              <el-input v-model="form.OrgName" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="组织类型" style=" display: flex;">
              <el-select v-model="form.OrgType" :popper-append-to-body="false" style="width: 200px" placeholder="请选择">
              <el-select v-model="form.OrgType" style="width: 200px" placeholder="请选择">
                <el-option
                  v-for="item in OrgTypeArr"
                  :key="item.code"
@@ -129,7 +129,8 @@
    <el-dialog
      :title="operation==='add'?'新增':'编辑'"
      :visible.sync="dialogVisible"
      width="800"
      width="800px"
      :close-on-click-modal="false"
      top="15vh"
      @closed="handleClose"
      @close="handleClose"
@@ -164,6 +165,10 @@
        </div>
      </span>
    </el-dialog>
    <!--导入组件-->
    <import-picker ref="importPickerFunc" class="importPickerClass" :shows.sync="shows" :title="title_value" :colos="colos" :code="code" />
  </div>
</template>
@@ -171,12 +176,13 @@
import Pagination from '@/components/Pagination'
import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz'
import { getCookie } from '@/utils/auth'
import ImportPicker from '@/components/ImportPicker'
const SER_HZ = /^[\u4e00-\u9fa5]+$/
export default {
  name: 'Zzjg',
  components: {
    Pagination
    Pagination, ImportPicker
  },
  data() {
    const validateName = (rule, value, callback) => {
@@ -241,8 +247,19 @@
        SupUnit: [
          { required: true, validator: validateTypeCode, trigger: ['blur', 'change'] }
        ]
      }
      },
      title_value: '数据导入 / 点检部位',
      code: '4',
      shows: false
    }
  },
  watch: {
    shows() {
      if (!this.shows) {
        this.getOrganizationSearch()
      }
    }
  },
  created() {
@@ -275,8 +292,13 @@
    search() {
      this.getOrganizationSearch()
    },
    // 导入按钮
    upload() {
      this.shows = true
      this.$refs.importPickerFunc.newDataFunc()
    },
    colos() {
      this.shows = false
    },
    // 重置
    reset() {
@@ -357,8 +379,8 @@
    // 获取页面高度
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 250
        this.tableHeight = this.mainHeight - 100
        this.mainHeight = window.innerHeight - 85
        this.tableHeight = this.mainHeight - 200
      })
    },
    tableRowClassName({ row, rowIndex }) {
@@ -462,6 +484,11 @@
  margin-bottom: 0;
}
::v-deep .el-select__caret{
  display: flex;
  align-items: center;
  justify-content: center;
}
</style>
<style>