loulijun2021
2023-09-20 8b6eba58c666295de2f764dd7032afd36d7591fc
1.设备清单页面及导入100%
已添加2个文件
已修改5个文件
976 ■■■■■ 文件已修改
src/api/DeviceManager.js 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicSettings/contactUnitList.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicSettings/processSList.vue 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/deviceManager/deviceList.vue 780 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/materialManager/inventoryList.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/systemSetting/dataImport.vue 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/DeviceManager.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,52 @@
import request from '@/utils/request'
// è®¾å¤‡ç±»åž‹æŸ¥è¯¢
export function DeviceTypeSearch(data) {
  return request({
    url: 'DeviceManager/DeviceTypeSearch',
    method: 'get',
    params: data
  })
}
// è®¾å¤‡ç±»åž‹æ–°å¢ž
export function AddUpdateDeviceType(data, OperType) {
  return request({
    url: 'DeviceManager/AddUpdateDeviceType?OperType=' + OperType,
    method: 'post',
    data
  })
}
// è®¾å¤‡ç±»åž‹åˆ é™¤
export function DeleteDeviceType(data) {
  return request({
    url: 'DeviceManager/DeleteDeviceType',
    method: 'post',
    params: data
  })
}
// è®¾å¤‡åˆ—表查询
export function DeviceMangerSearch(data) {
  return request({
    url: 'DeviceManager/DeviceMangerSearch',
    method: 'get',
    params: data
  })
}
// è®¾å¤‡æ¸…单新增编辑
export function AddUpdateDeviceManger(data) {
  return request({
    url: 'DeviceManager/AddUpdateDeviceManger',
    method: 'post',
    data
  })
}
// è®¾å¤‡ä¿¡æ¯åˆ é™¤
export function DeleteDeviceManger(data) {
  return request({
    url: 'DeviceManager/DeleteDeviceManger',
    method: 'post',
    data
  })
}
src/router/index.js
@@ -166,6 +166,12 @@
        code: '0109',
        component: () => import('@/views/basicSettings/installLampList'),
        meta: { code: '0109', title: '安灯设置', icon: '', keepAlive: true }
      }, {
        path: 'processSList',
        name: 'processSListCancel',
        code: '0112',
        component: () => import('@/views/basicSettings/processSList'),
        meta: { code: '0112', title: '工序设置', icon: '', keepAlive: true }
      }
    ]
src/views/basicSettings/contactUnitList.vue
@@ -664,7 +664,7 @@
    treeEditClick(node, data, operation) {
      this.dialogClassForm.data_sources = data.data_sources
      this.dialogClassForm.customerclasscode = data.code
      this.dialogClassForm.customerclassname = data.name
      this.dialogClassForm.customerclassname = data.name.split(' ')[1]
      this.dialogClassForm.parentcode = data.idparent === '-1' ? '' : data.idparent
      this.dialogClassForm.OperType = 'Update'
      this.operation = operation
src/views/basicSettings/processSList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,11 @@
<template />
<script>
export default {
  name: 'ProcessSList'
}
</script>
<style scoped>
</style>
src/views/deviceManager/deviceList.vue
@@ -0,0 +1,780 @@
<template>
  <div>
    <div class="body" :style="{height:mainHeight+'px'}">
      <div style="display: flex">
        <div style="width: 300px;margin: 10px 10px 0  0;background:#fff">
          <div style="margin: 20px 10px 0 10px;display: flex;justify-content: space-between;">
            <div style="display: flex;">
              <div
                style="width: 5px;height: 100%;border-radius: 5px;"
                :style="{background:$store.state.settings.theme}"
              />
              <div style="margin-left: 8px;">设备清单</div>
            </div>
            <div style="margin-right:10px">
              <el-tooltip v-del-tab-index class="item" effect="dark" content="新增" placement="top">
                <i class="el-icon-plus" style="cursor: pointer;color: #999" @click="treeAddClick('add')" />
              </el-tooltip>
            </div>
          </div>
          <el-tree
            ref="treeLeftRef"
            style="padding: 10px;overflow: auto"
            :style="{height:(tableHeight+222)+'px'}"
            :data="treeLeft"
            node-key="code"
            highlight-current
            :props="defaultPropsLeft"
            :default-expand-all="true"
            :expand-on-click-node="false"
            @node-click="getDeviceMangerSearch"
          >
            <span slot-scope="{ node, data }" class="custom-tree-node">
              <span v-if="!data.isEdit">{{ data.name }}</span>
              <span v-if="!data.isEdit">
                <el-tooltip v-del-tab-index class="item" effect="dark" content="编辑" placement="top">
                  <i
                    v-if="data.code!=='-1'"
                    class="el-icon-edit"
                    style="margin-right:10px;color: #999"
                    @click.stop="treeEditClick(node,data,'edit')"
                  />
                </el-tooltip>
                <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">
                  <i
                    v-if="data.code!=='-1'"
                    class="el-icon-delete"
                    style="margin-right: 4px;color: #999"
                    @click.stop="treeDeleteClick(node,data)"
                  />
                </el-tooltip>
              </span>
            </span>
          </el-tree>
        </div>
        <div
          style=" width:calc(100% - 300px);"
        >
          <div class="bodyTopButtonGroup" style="justify-content: space-between">
            <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
            <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=9')">导入</el-button>
          </div>
          <div class="bodyTopFormGroup">
            <el-form
              ref="form"
              :model="form"
              label-width="100px"
              inline
              style="display: flex;"
            >
              <div class="elForm">
                <el-form-item label="设备编码" style=" display: flex;">
                  <el-input v-model="form.devicecode" placeholder="请输入" style="width: 200px" />
                </el-form-item>
                <el-form-item label="设备名称" style=" display: flex;">
                  <el-input v-model="form.devicename" placeholder="请输入" style="width: 200px" />
                </el-form-item>
                <!--                <el-form-item label="使用状态" style=" display: flex;">-->
                <!--                  <el-select-->
                <!--                    v-model="form.status"-->
                <!--                    style="width: 100%;"-->
                <!--                    placeholder="请选择"-->
                <!--                  >-->
                <!--                    <el-option-->
                <!--                      v-for="item in statusArr"-->
                <!--                      :key="item.code"-->
                <!--                      :label="item.name"-->
                <!--                      :value="item.code"-->
                <!--                    />-->
                <!--                  </el-select>-->
                <!--                </el-form-item>-->
                <el-form-item label="所属组织" style=" display: flex;">
                  <el-cascader
                    ref="cascader"
                    v-model="form.storgcode"
                    :options="cascaderOptions"
                    filterable
                    :props="defaultProps"
                    :show-all-levels="false"
                  />
                </el-form-item>
                <!--                <el-form-item label="用户编码" style=" display: flex;">-->
                <!--                  <el-input v-model="form.usercode" placeholder="请输入" style="width: 200px" />-->
                <!--                </el-form-item>-->
                <!--                <el-form-item v-show="isExpandForm" label="用户名称" style=" display: flex;">-->
                <!--                  <el-input v-model="form.username" placeholder="请输入" style="width: 200px" />-->
                <!--                </el-form-item>-->
                <!--                <el-form-item v-show="isExpandForm" label="用户编码" style=" display: flex;">-->
                <!--                  <el-input v-model="form.usercode" placeholder="请输入" style="width: 200px" />-->
                <!--                </el-form-item>-->
                <!--                <el-form-item v-show="isExpandForm" label="用户名称" style=" display: flex;">-->
                <!--                  <el-input v-model="form.username" placeholder="请输入" style="width: 200px" />-->
                <!--                </el-form-item>-->
                <!--                <el-form-item v-show="isExpandForm" label="用户编码" style=" display: flex;">-->
                <!--                  <el-input v-model="form.usercode" placeholder="请输入" style="width: 200px" />-->
                <!--                </el-form-item>-->
                <!--                <el-form-item v-show="isExpandForm" label="用户名称" style=" display: flex;">-->
                <!--                  <el-input v-model="form.username" placeholder="请输入" style="width: 200px" />-->
                <!--                </el-form-item>-->
              </div>
              <div
                class="bodySearchReset"
                :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
              >
                <el-button v-waves type="primary" icon="el-icon-search" @click="getDeviceMangerSearch($refs.treeLeftRef.getCurrentNode())">查询</el-button>
                <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
              </div>
            </el-form>
            <div
              class="bodyTopFormExpand"
              style="height: 5px;"
            >
              <!--              <svg-icon-->
              <!--                v-show="mouseHoverType==='mouseout'"-->
              <!--                style="cursor: pointer"-->
              <!--                :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"-->
              <!--                @mouseenter="mouseHoverType=$event.type"-->
              <!--              />-->
              <!--              <svg-icon-->
              <!--                v-show="mouseHoverType==='mouseenter'"-->
              <!--                style="cursor: pointer"-->
              <!--                :icon-class="!isExpandForm?'doubleDown':'doubleUp'"-->
              <!--                @click="isExpandForm=!isExpandForm"-->
              <!--                @mouseout="mouseHoverType=$event.type"-->
              <!--              />-->
            </div>
          </div>
          <div class="elTableDiv">
            <el-table
              ref="tableDataRef"
              class="tableFixed"
              :data="tableData"
              :height="isExpandForm?tableHeight:(tableHeight+80)+'px'"
              border
              row-class-name="custom-row"
              :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px',}"
              highlight-current-row
              :header-cell-style="this.$headerCellStyle"
              :cell-style="this.$cellStyle"
              @sort-change="sortChange"
            >
              <!--            prop="RowNum"-->
              <el-table-column
                prop="rowNum"
                width="50"
                fixed
                label="序号"
              />
              <el-table-column
                prop="code"
                label="设备编码"
                sortable="custom"
              />
              <el-table-column
                prop="name"
                label="设备名称"
                sortable="custom"
              />
              <el-table-column
                prop="eqptype_name"
                label="设备类型"
                sortable="custom"
              />
              <el-table-column
                prop="torg_name"
                label="所属组织"
                sortable="custom"
              />
              <el-table-column
                prop="enable"
                label="使用状态"
                width="110"
                sortable="custom"
              >
                <template slot-scope="{row}">
                  <el-tag v-if="row.enable==='0'" size="small" type="success">正常</el-tag>
                  <el-tag v-if="row.enable==='1'" size="small" type="danger">停用</el-tag>
                </template>
              </el-table-column>
              <el-table-column
                label="创建人员"
                prop="lm_user"
                sortable="custom"
                width="110"
              />
              <el-table-column
                label="创建时间"
                prop="lm_date"
                sortable="custom"
                width="160"
              />
              <el-table-column
                label="操作"
                width="120"
                fixed="right"
              >
                <template slot-scope="{row}">
                  <div class="operationClass">
                    <el-tooltip class="item" effect="dark" content="编辑" placement="top">
                      <i
                        class="el-icon-edit-outline"
                        :style="{color:$store.state.settings.theme}"
                        @click="edit('edit',row)"
                      />
                    </el-tooltip>
                    <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">
                      <i
                        class="el-icon-delete"
                        :style="{color:$store.state.settings.theme}"
                        @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="total,prev, pager, next,sizes,jumper"
            popper-class="select_bottom"
            @pagination="getDeviceMangerSearch($refs.treeLeftRef.getCurrentNode())"
          />
        </div>
      </div>
    </div>
    <!--    è®¾å¤‡ç±»åˆ«æ–°å¢žä¿®æ”¹-->
    <el-dialog
      v-el-drag-dialog
      :title="operation==='add'?'新增':'编辑'"
      :visible.sync="dialogClassVisible"
      width="800px"
      :close-on-click-modal="false"
      top="15vh"
      @closed="handleClassClose"
      @close="handleClassClose"
    >
      <el-form ref="dialogClassForm" inline :rules="dialogClassFormRules" :model="dialogClassForm" label-width="110px">
        <el-form-item label="设备类型编码" prop="code">
          <el-input v-model="dialogClassForm.code" :disabled="operation!=='add'" style="width: 200px" />
        </el-form-item>
        <el-form-item label="设备类型名称" prop="name">
          <el-input v-model="dialogClassForm.name" style="width: 200px" />
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button v-waves @click="dialogVisibleClassCancel">取 æ¶ˆ</el-button>
          <el-button
            v-waves
            type="primary"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            @click="dialogVisibleClassConfirm"
          >ç¡® å®š</el-button>
        </div>
      </span>
    </el-dialog>
    <!--   è®¾å¤‡æ¸…单新增修改-->
    <el-dialog
      v-el-drag-dialog
      :title="operation==='add'?'新增':'编辑'"
      :visible.sync="dialogVisible"
      width="800px"
      :close-on-click-modal="false"
      top="15vh"
      @closed="handleClose"
      @close="handleClose"
    >
      <el-form ref="dialogForm" class="" inline :rules="dialogFormRules" :model="dialogForm" label-width="110px">
        <el-form-item label="设备编码" prop="devicecode">
          <el-input v-model="dialogForm.devicecode" :disabled="operation!=='add'" style="width: 200px" />
        </el-form-item>
        <el-form-item label="设备名称" prop="devicename">
          <el-input v-model="dialogForm.devicename" style="width: 200px" />
        </el-form-item>
        <el-form-item label="设备类型" prop="devicetypecode">
          <el-select
            v-model="dialogForm.devicetypecode"
            style="width:200px"
            placeholder="请选择"
            filterable
            :popper-append-to-body="false"
          >
            <el-option
              v-for="item in treeLeftArr"
              :key="item.code"
              :label="item.name"
              :value="item.code"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="所属组织" prop="storgcode">
          <el-cascader
            ref="dialogCascader"
            v-model="dialogForm.storgcode"
            :options="cascaderOptions"
            filterable
            style="width: 200px;"
            :props="defaultProps"
            :show-all-levels="false"
          />
        </el-form-item>
        <el-form-item required label="状态">
          <el-radio-group v-model="dialogForm.status">
            <el-radio label="0">正常</el-radio>
            <el-radio label="1">停用</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button v-waves @click="dialogVisibleCancel">取 æ¶ˆ</el-button>
          <el-button
            v-waves
            type="primary"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            @click="dialogVisibleConfirm"
          >ç¡® å®š</el-button>
        </div>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import waves from '@/directive/waves'
import Pagination from '@/components/Pagination'
import { validateCode } from '@/utils/global'
import elDragDialog from '@/directive/el-drag-dialog'
import {
  TMaterielAddUpdate,
  TMaterielClassTree,
  TMaterielClassTreeAddUpdate,
  TMaterielClassTreeDelete,
  TMaterielData, TMaterielDelete
} from '@/api/ProductModel'
import arrayToTree from 'array-to-tree'
import { PrentOrganization, UnitSerch } from '@/api/GeneralBasicData'
import {
  AddUpdateDeviceManger,
  AddUpdateDeviceType, DeleteDeviceManger,
  DeleteDeviceType,
  DeviceMangerSearch,
  DeviceTypeSearch
} from '@/api/DeviceManager'
export default {
  name: 'RoleList',
  directives: { waves, elDragDialog },
  components: {
    Pagination
  },
  data() {
    return {
      mouseHoverType: 'mouseout',
      isExpandForm: false,
      mainHeight: 0,
      tableHeight: 0,
      operation: '',
      treeLeft: [
        {
          code: '-1',
          name: '全部'
        }
      ], // å·¦ä¾§æ ‘
      treeLeftArr: [],
      defaultPropsLeft: {
        children: 'children',
        label: 'name'
      },
      tableData: [],
      form: {
        devicetype: '',
        devicecode: '',
        devicename: '',
        status: '',
        storgcode: '',
        page: 1,
        rows: 20,
        prop: 'lm_date', // æŽ’序字段
        order: 'desc' // æŽ’序字段
      },
      total: 0,
      statusArr: [
        { code: '0', name: '正常' },
        { code: '1', name: '停用' }
      ],
      defaultProps: {
        checkStrictly: true,
        expandTrigger: 'hover',
        value: 'torg_code',
        label: 'torg_name'
      },
      Options: [],
      cascaderOptions: [],
      dialogClassVisible: false,
      dialogClassForm: {
        code: '', // è®¾å¤‡ç±»åž‹ç¼–码
        name: '', // è®¾å¤‡åç§°åç§°
        OperType: ''// OperType
      },
      dialogClassFormRules: {
        code: [
          { required: true, validator: validateCode, trigger: ['blur', 'change'] }
        ],
        name: [
          { required: true, message: '请输设备类型名称', trigger: ['blur', 'change'] }
        ]
      },
      dialogVisible: false,
      dialogForm: {
        devicecode: '', //  è®¾å¤‡ç¼–码
        devicename: '', //  è®¾å¤‡åç§°
        devicetypecode: '', // è®¾å¤‡ç±»åž‹ç¼–码
        storgcode: [], // ç»„织编码
        status: '0', // ä½¿ç”¨çŠ¶æ€: æ­£å¸¸(0)停用(1)
        OperType: '' // æ“ä½œç±»åž‹
      },
      dialogFormRules: {
        devicecode: [
          { required: true, validator: validateCode, trigger: ['blur', 'change'] }
        ],
        devicename: [
          { required: true, message: '请输入设备名称', trigger: ['blur', 'change'] }
        ],
        devicetypecode: [
          { required: true, message: '请选择设备类型', trigger: ['blur', 'change'] }
        ],
        storgcode: [
          { required: true, message: '请选择所属组织', trigger: ['blur', 'change'] }
        ]
      }
    }
  },
  created() {
  },
  mounted() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
    this.getDeviceTypeSearch()
    this.getPrentOrganization()
  },
  methods: {
    async getDeviceTypeSearch() {
      const res = await DeviceTypeSearch()
      res.data.forEach(i => {
        i.idparent = i.idparent ? i.idparent : '-1'
      })
      this.treeLeftArr = res.data
      this.treeLeftArr.forEach(e => {
        e.name = e.code + ' ' + e.name
      })
      this.treeLeft = arrayToTree(this.treeLeft.concat(res.data), {
        parentProperty: 'idparent',
        customID: 'code',
        childrenProperty: 'children'
      })
      this.$nextTick(() => {
        this.$refs.treeLeftRef.setCurrentKey('-1')
        this.getDeviceMangerSearch(this.$refs.treeLeftRef.getCurrentNode())
      })
    },
    async getDeviceMangerSearch(node) {
      this.form.storgcode = this.form.storgcode ? this.$refs.cascader.checkedValue[this.$refs.cascader.checkedValue.length - 1] : ''
      this.form.devicetype = node.code !== '-1' ? node.code : ''
      const res = await DeviceMangerSearch(this.form)
      this.tableData = res.data
      this.total = res.count
    },
    // ç»„织架构级联选择器
    async getPrentOrganization() {
      const { data: res } = await PrentOrganization()
      this.Options = res
      this.cascaderOptions = arrayToTree(res, {
        parentProperty: 'parent_id',
        customID: 'torg_code',
        childrenProperty: 'children'
      })
    },
    // èŽ·å–é¡µé¢é«˜åº¦
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 85
        this.tableHeight = this.mainHeight - 280
        this.$refs.tableDataRef.doLayout()
      })
    },
    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.getDeviceMangerSearch(this.$refs.treeLeftRef.getCurrentNode())
    },
    // æ–°å¢žæŒ‰é’®
    add(operation) {
      this.operation = operation
      this.dialogVisible = true
      this.dialogForm.OperType = 'Add'
    },
    // ä¿®æ”¹æŒ‰é’®
    async edit(operation, row) {
      this.operation = operation
      this.dialogVisible = true
      this.dialogForm.OperType = 'Update'
      this.$nextTick(() => {
        this.dialogForm.devicecode = row.code
        this.dialogForm.devicename = row.name
        this.dialogForm.status = row.enable
        this.dialogForm.devicetypecode = row.eqptype_code
        this.dialogForm.storgcode = this.findParent([], row.torg_code, this.cascaderOptions).reverse()
      })
    },
    // parents:用于返回的数组,childNode:要查询的节点,treeData:json树形数据
    findParent(parents, childNode, treeData) {
      // console.log(parents, childNode, treeData, 2)
      for (let i = 0; i < treeData.length; i++) {
        // çˆ¶èŠ‚ç‚¹æŸ¥è¯¢æ¡ä»¶
        if (treeData[i].torg_code === childNode) {
          // å¦‚果找到结果,保存当前节点
          parents.push(treeData[i].torg_code)
          // ç”¨å½“前节点再去原数据查找当前节点的父节点
          this.findParent(parents, treeData[i].parent_id, this.cascaderOptions)
          break
        } else {
          if (treeData[i].children instanceof Array) {
            //    æ²¡æ‰¾åˆ°ï¼ŒéåŽ†è¯¥èŠ‚ç‚¹çš„å­èŠ‚ç‚¹
            this.findParent(parents, childNode, treeData[i].children)
          }
        }
      }
      return parents
    },
    del(row) {
      this.$confirm('是否确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        DeleteDeviceManger({ devicecode: row.code }).then(res => {
          if (res.code === '200') {
            this.$notify.success('删除成功!')
            this.getDeviceMangerSearch(this.$refs.treeLeftRef.getCurrentNode())
          }
        })
      }).catch(() => {
        this.$notify.info('已取消删除')
      })
    },
    reset() {
      // this.form.storgcode = ''
      this.form.devicecode = ''
      this.form.devicename = ''
      this.form.status = ''
      this.form.devicetype = ''
      this.$refs.cascader.checkedValue = []
      this.$refs.treeLeftRef.setCurrentKey('-1')
      this.getDeviceMangerSearch(this.$refs.treeLeftRef.getCurrentNode())
    },
    // å¯¹è¯æ¡†å…³é—­äº‹ä»¶
    handleClose() {
      this.dialogForm.devicecode = ''
      this.dialogForm.devicename = ''
      // this.dialogForm.storgcode =  []
      this.dialogForm.devicetypecode = ''
      this.dialogForm.status = '0'
      this.$refs.dialogCascader.checkedValue = ''
      this.$refs.dialogForm.clearValidate()
    },
    // å¯¹è¯æ¡†å–消
    dialogVisibleCancel() {
      this.dialogVisible = false
    },
    // å¯¹è¯æ¡†ç¡®è®¤
    dialogVisibleConfirm() {
      this.$refs.dialogForm.validate(valid => {
        if (valid) {
          this.dialogForm.storgcode = this.$refs.dialogCascader.checkedValue[this.$refs.dialogCascader.checkedValue.length - 1]
          this.$store.state.app.buttonIsDisabled = true
          AddUpdateDeviceManger(this.dialogForm).then(res => {
            if (res.code === '200') {
              this.$notify.success(this.operation === 'add' ? '添加成功!' : '修改成功!')
              this.dialogVisible = false
              this.$store.state.app.buttonIsDisabled = false
              this.getDeviceMangerSearch(this.$refs.treeLeftRef.getCurrentNode())
            } else {
              this.$store.state.app.buttonIsDisabled = false
              this.$notify.error(this.operation === 'add' ? '添加失败!' : '修改失败!')
            }
          })
        }
      })
    },
    treeEditClick(node, data, operation) {
      this.dialogClassForm.code = data.code
      this.dialogClassForm.name = data.name.split(' ')[1]
      this.dialogClassForm.OperType = 'Update'
      this.operation = operation
      this.dialogClassVisible = true
    },
    treeDeleteClick(node, data) {
      this.$confirm('是否确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        DeleteDeviceType({ devicetypecode: data.code }).then(res => {
          if (res.code === '200') {
            this.$notify.success('删除成功!')
            this.getDeviceTypeSearch()
          }
        })
      }).catch(() => {
        this.$notify.info('已取消删除')
      })
    },
    treeAddClick(operation) {
      this.operation = operation
      this.dialogClassVisible = true
      this.dialogClassForm.OperType = 'Add'
    },
    handleClassClose() {
      this.dialogClassForm.code = ''
      this.dialogClassForm.name = ''
      this.$refs.dialogClassForm.clearValidate()
    },
    dialogVisibleClassCancel() {
      this.dialogClassVisible = false
    },
    dialogVisibleClassConfirm() {
      this.$refs.dialogClassForm.validate(valid => {
        if (valid) {
          const data = [{
            code: this.dialogClassForm.code,
            name: this.dialogClassForm.name,
            group: '',
            description: ''
          }]
          AddUpdateDeviceType(data, this.dialogClassForm.OperType).then(res => {
            if (res.code === '200') {
              this.$notify.success(this.operation === 'add' ? '添加成功!' : '修改成功!')
              this.dialogClassVisible = false
              this.$store.state.app.buttonIsDisabled = false
              this.getDeviceTypeSearch()
            } else {
              this.$store.state.app.buttonIsDisabled = false
              this.$notify.error(this.operation === 'add' ? '添加失败!' : '修改失败!')
            }
          })
        }
      })
    },
    unittypcodeChange(val) {
      console.log(val)
      this.dialogForm.unitcode = ''
      this.dialogForm.unitsubcode = ''
      this.dialogForm.idSubUnitByReport = ''
      this.dialogForm.idUnitByStock = ''
      this.dialogForm.idUnitByPurchase = ''
      this.dialogForm.idUnitBySale = ''
      this.dialogForm.idunitbymanufacture = ''
      // this.$refs.dialogForm.clearValidate()
      // this.$forceUpdate()
    },
    unitcodeChange(val, type) {
      console.log(val)
      if (type === '1') {
        // this.dialogForm.unitcode = val
        this.dialogForm.unitsubcode = ''
        this.dialogForm.idSubUnitByReport = ''
        const unitname = this.unitcodeSingleArr.find(i => i.unitcode === val).unitname
        this.dialogForm.idUnitByStock = unitname
        this.dialogForm.idUnitByPurchase = unitname
        this.dialogForm.idUnitBySale = unitname
        this.dialogForm.idunitbymanufacture = unitname
      }
      if (type === '0') {
        const t = this.unitcodeGroupArr.find(i => i.unitcode === val).children
        this.idSubUnitByReportArr = t.filter(i => i.isMainUnit !== '1')
        this.idUnitBvStockArr = t
        const mainUnitCode = t.find(i => i.isMainUnit === '1').unitcode
        this.dialogForm.unitsubcode = mainUnitCode
        this.dialogForm.idSubUnitByReport = this.idSubUnitByReportArr[0].unitcode
        this.dialogForm.idUnitByStock = mainUnitCode
        this.dialogForm.idUnitByPurchase = mainUnitCode
        this.dialogForm.idUnitBySale = mainUnitCode
        this.dialogForm.idunitbymanufacture = mainUnitCode
      }
    }
  }
}
</script>
<style scoped lang="scss">
.custom-tree-node {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  padding-right: 8px;
}
//::v-deep .el-checkbox__label {
//  width: 55px;
//}
//
.el-icon-plus:hover, .el-icon-edit:hover, .el-icon-delete:hover {
  color: #000 !important;
}
</style>
src/views/materialManager/inventoryList.vue
@@ -913,7 +913,7 @@
    treeEditClick(node, data, operation) {
      this.dialogClassForm.data_sources = data.data_sources
      this.dialogClassForm.inventoryclasscode = data.code
      this.dialogClassForm.inventoryclassname = data.name
      this.dialogClassForm.inventoryclassname = data.name.split(' ')[1]
      this.dialogClassForm.parentcode = data.idparent === '-1' ? '' : data.idparent
      this.dialogClassForm.OperType = 'Update'
      this.operation = operation
src/views/systemSetting/dataImport.vue
@@ -128,7 +128,7 @@
                    item.indexOf('所属仓库编码')!==-1||
                    item.indexOf('上级库位编码')!==-1||
                    item.indexOf('规格型号')!==-1||
                    item.indexOf('存货分类编码')!==-1||
                    item.indexOf('存货分类')!==-1||
                    item.indexOf('计量单位/组名称')!==-1
                  "
@@ -505,6 +505,22 @@
          j.uuid = nanoid()
        })
      }
      if (this.sheetName.indexOf('设备类型') !== -1) {
        this.statusArr = [
          { code: '0', name: '正常' },
          { code: '1', name: '停用' }
        ]
        const orgArr = this.orgArr.map(i => i.torg_code)
        this.tableData[0].forEach(j => {
          j.uuid = nanoid()
        })
        this.tableData[1].forEach(j => {
          j['*状态'] = j['*状态'] ? this.statusArr.find(e => e.name === j['*状态']).code : ''
          j['*所属组织编码'] = j['*所属组织编码'] ? (orgArr.includes(j['*所属组织编码']) ? this.findParent([], j['*所属组织编码'], this.orgOptions).reverse() : '') : ''
          j.uuid = nanoid()
        })
      }
    },
    // æäº¤
    submit() {
@@ -565,6 +581,12 @@
              return this.$message.info(res.message)
            }
          }
          if (this.sheetName.indexOf('设备类型') !== -1) {
            const res = this.handleDeviceListSubmitData()
            if (res.code !== '200') {
              return this.$message.info(res.message)
            }
          }
          const data = {
            fileCode: this.excelCode,
@@ -604,6 +626,15 @@
            if (this.sheetName.indexOf('人员管理') !== -1) {
              this.handlePersonListUploadTemplate(false)
            }
            if (this.sheetName.indexOf('设备类型') !== -1) {
              this.tableData[0].forEach(j => {
                j.uuid = nanoid()
              })
              this.tableData[1].forEach(j => {
                j['*所属组织编码'] = this.findParent([], j['*所属组织编码'], this.orgOptions).reverse()
                j.uuid = nanoid()
              })
            }
          })
        })
        .catch(e => {
@@ -624,7 +655,7 @@
      const orgArr = this.orgArr.map(i => i.torg_code)
      // this.sheetName.indexOf('人员管理')
      // ç¬¬ä¸€æ¬¡æäº¤
      // ç¬¬ä¸€æ¬¡æ¸²æŸ“
      if (isFirstUpload) {
        this.tableData[0].forEach(j => {
          j['所属岗位编码'] = j['所属岗位编码'] ? j['所属岗位编码'].split(',').filter(e => postArr.includes(e)) : []
@@ -636,7 +667,7 @@
        })
      }
      // éžç¬¬ä¸€æ¬¡æäº¤
      // éžç¬¬ä¸€æ¬¡æ¸²æŸ“
      if (!isFirstUpload) {
        this.tableData[0].forEach(j => {
          j.所属岗位编码 = typeof j.所属岗位编码 === 'string' ? j.所属岗位编码.split(',').filter(e => postArr.includes(e)) : []
@@ -991,6 +1022,67 @@
      return { code: '200', message: '成功!' }
    },
    // å¤„理设备清单提交数据
    handleDeviceListSubmitData() {
      let flag = true
      let msg = ''
      if ([...new Set(this.tableData[0].map(i => i['*设备类型编号(唯一)']))].length !== this.tableData[0].length) {
        return this.$message.info('设备类型编号不能重复!')
      }
      if ([...new Set(this.tableData[1].map(i => i['*设备编号(唯一)']))].length !== this.tableData[1].length) {
        return this.$message.info('设备编号不能重复!')
      }
      this.tableData[0].forEach(j => {
        if (!j['*设备类型编号(唯一)']) {
          flag = false
          msg = '*设备类型编号(唯一)不能为空!'
        }
        if (!j['*设备类型名称']) {
          flag = false
          msg = '*设备类型名称不能为空!'
        }
      })
      this.tableData[1].forEach(j => {
        if (!j['*设备编号(唯一)']) {
          flag = false
          msg = '*设备编号(唯一)不能为空!'
        }
        if (!j['*设备名称']) {
          flag = false
          msg = '*设备名称不能为空!'
        }
        if (!j['*所属组织编码']) {
          flag = false
          msg = '*所属组织编码不能为空!'
        }
        if (!j['*设备类型编码']) {
          flag = false
          msg = '*设备类型编码不能为空!'
        }
        if (!j['*状态']) {
          flag = false
          msg = '*状态不能为空!'
        }
      })
      if (!flag) {
        return { code: '301', message: msg }
      }
      this.tableData[1].forEach(j => {
        j['*所属组织编码'] = j['*所属组织编码'][j['*所属组织编码'].length - 1]
      })
      this.tableData[0].map(item => {
        delete (item.uuid)
      })
      this.tableData[1].map(item => {
        delete (item.uuid)
      })
      return { code: '200', message: '成功!' }
    },
    // parents:用于返回的数组,childNode:要查询的节点,treeData:json树形数据
    findParent(parents, childNode, treeData) {
      // console.log(parents, childNode, treeData, 2)
@@ -1104,10 +1196,10 @@
        })
      }
      // å­˜è´§æ¡£æ¡ˆ
      if (this.sheetName.indexOf('存货类型') !== -1 && this.activeName === '0') {
      if (this.sheetName.indexOf('存货分类') !== -1 && this.activeName === '0') {
        this.tableData[0].unshift({
          uuid: nanoid(),
          '*存货分类编码(唯一)': '',
          '*存货分类编号(唯一)': '',
          '*存货分类名称': '',
          '上级编码': ''
        })
@@ -1115,7 +1207,7 @@
      if (this.sheetName.indexOf('存货') !== -1 && this.activeName === '1') {
        this.tableData[1].unshift({
          uuid: nanoid(),
          '*存货编码(唯一)': '',
          '*存货编号(唯一)': '',
          '*存货名称': '',
          '规格型号': '',
          '*存货分类编码': '',
@@ -1130,6 +1222,25 @@
          '是否委外': '0'
        })
      }
      // è®¾å¤‡æ¸…单
      if (this.sheetName.indexOf('设备类型') !== -1 && this.activeName === '0') {
        this.tableData[0].unshift({
          uuid: nanoid(),
          '*设备类型编号(唯一)': '',
          '*设备类型名称': '',
          '描述': ''
        })
      }
      if (this.sheetName.indexOf('设备清单') !== -1 && this.activeName === '1') {
        this.tableData[1].unshift({
          uuid: nanoid(),
          '*设备编号(唯一)': '',
          '*设备名称': '',
          '*所属组织编码': '',
          '设备类型编码': '',
          '*状态': '0'
        })
      }
    },
    delRow(row) {
      // é’ˆå¯¹å•sheet