1、MDC零件加工管理和OEE页面开发100%
2、DNC结构树取消搜索框侧边下拉菜单改为树组件空白处右键菜单
已添加9个文件
已修改10个文件
2372 ■■■■ 文件已修改
src/api/mdc.js 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/DeviceStructure/DeviceStructureBaseContextMenu.vue 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue 495 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/DeviceStructure/Document/HasReceivedDocumentTableList.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/DeviceStructure/Document/HasSentDocumentTableList.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/DeviceCustomType/UseDeviceCustomTypeEquipmentTableList.vue 133 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/Document/NcDocumentTableList.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/Document/OtherDocumentTableList.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/ProductStructureBaseContextMenu.vue 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/common/ImportFileModal.vue 362 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/OEEAnalysis.vue 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/PartsMatchingManagement.vue 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/OEEAnalysis/ComputeOeeModal.vue 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/OEEAnalysis/OEEAnalysisList.vue 304 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/PartsMatchingManagement/PartsMatchingForm.vue 191 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/PartsMatchingManagement/PartsMatchingList.vue 321 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/PartsMatchingManagement/PartsMatchingModal.vue 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/mdc.js
@@ -20,16 +20,6 @@
  addWorkshopApi: params => postAction('/mdc/mdcWorkshopInfo/add', params),
  // ç¼–辑车间信息
  editWorkshopApi: params => putAction('/mdc/mdcWorkshopInfo/edit', params),
  // åˆ é™¤å•个车间信息
  deleteSingleWorkshopApi: id => deleteAction('/mdc/mdcWorkshopInfo/delete', { id }),
  // æ‰¹é‡åˆ é™¤è½¦é—´ä¿¡æ¯
  deleteBatchWorkshopApi: ids => deleteAction('/mdc/mdcWorkshopInfo/deleteBatch', { ids }),
  // æ–°å¢žå¤§å±è½¦é—´å’Œè®¾å¤‡å…³ç³»
  addDeviceInWorkshopApi: params => postAction('/mdc/mdcWorkshopInfo/addWorkshopEquipment', params),
  // åˆ é™¤å•个大屏车间和设备关系
  deleteSingleDeviceInWorkshopApi: params => deleteAction('/mdc/mdcWorkshopInfo/deleteWorkshopEquipment', params),
  // æ‰¹é‡åˆ é™¤å¤§å±è½¦é—´å’Œè®¾å¤‡å…³ç³»
  deleteBatchDeviceInWorkshopApi: params => deleteAction('/mdc/mdcWorkshopInfo/deleteWorkshopEquipmentBatch', params),
  // -------------------------------------设备参数阈值管理页面--------------------------------------------
  // æ ¹æ®é©±åŠ¨ç±»åž‹èŽ·å–å‚æ•°
  getParamListByDriveTypeApi: controlSystemType => getAction(`/mdc/mdcDriveTypeParamConfig/getDriveParamOptionsByType?controlSystemType=${controlSystemType}`),
@@ -37,8 +27,7 @@
  addParamThresholdApi: params => postAction('/mdc/mdcEquipmentThreshold/add', params),
  // ç¼–辑设备参数阈值
  editParamThresholdApi: params => postAction('/mdc/mdcEquipmentThreshold/edit', params),
  // åˆ é™¤è®¾å¤‡å‚数阈值
  deleteParamThresholdApi: id => deleteAction('/mdc/mdcEquipmentThreshold/delete', { id }),
  // åˆ é™¤è®¾å¤‡å‚数阈值
  deleteBatchParamThresholdApi: ids => deleteAction('/mdc/mdcEquipmentThreshold/deleteBatch', { ids })
  // -------------------------------------OEE页面--------------------------------------------
  // è®¡ç®—OEE
  computeOeeApi: params => postAction('/mdc/mdcOeeInfo/computeOee', params),
}
src/views/dnc/base/modules/DeviceStructure/DeviceStructureBaseContextMenu.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,68 @@
<template>
  <a-menu :style="menuStyle" @click="menuItemClick" v-if="menuVisible" mode="vertical">
    <template v-for="menuItem in baseContextMenuList">
      <a-menu-item :key="menuItem.code" v-has="menuItem.code" v-if="menuItem.isHasPermission">
        <a-icon :type="menuItem.icon"/>
        {{ menuItem.label }}
      </a-menu-item>
      <a-menu-item :key="menuItem.code" v-else>
        <a-icon :type="menuItem.icon"/>
        {{ menuItem.label }}
      </a-menu-item>
    </template>
  </a-menu>
</template>
<script>
export default {
  name: 'DeviceStructureBaseContextMenu',
  components: {},
  props: {
    tableRowInfo: {
      type: Object
    }
  },
  data() {
    return {
      menuVisible: false,
      menuStyle: {
        position: 'fixed',
        top: 0,
        left: 0,
        border: '1px solid #eee',
        boxShadow: '0 2px 8px rgba(0, 0, 0, 0.15)',
        zIndex: 999
      },
      currentMenuLevel: '',
      baseContextMenuList: [
        { label: '刷新', code: 'tree_reload', icon: 'reload', isHasPermission: false, isCommonMethod: false },
      ]
    }
  },
  methods: {
    menuItemClick({ key }) {
      console.log('menuKey', key)
      const isCommonMethod = this.baseContextMenuList.find(item => item.code === key).isCommonMethod
      const modalTitle = this.baseContextMenuList.find(item => item.code === key).label
      const menuKeyArray = key.split('_')
      // product_add => handleAdd è§¦å‘对应组件事件
      let methodName
      // åˆ¤æ–­æ˜¯å¦ä¸ºå…¬å…±æ–¹æ³•,如果为公共方法则截取专有属性product/component/part/process等字段
      if (isCommonMethod) {
        methodName = 'handle' + menuKeyArray.map(item => item[0].toUpperCase() + item.slice(1)).slice(1).join('')
      } else {
        methodName = 'handle' + menuKeyArray.map(item => item[0].toUpperCase() + item.slice(1)).join('')
      }
      this.$bus.$emit('treeMenuItemMethodTrigger', { methodName, modalTitle })
    }
  }
}
</script>
<style scoped>
/deep/ .ant-menu-item {
  height: 32px;
  line-height: 32px;
}
</style>
src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue
@@ -1,24 +1,24 @@
<template>
  <a-card class="tree_con" :loading="cardLoading" :bordered="false" @contextmenu.native="e=>e.preventDefault()">
  <a-card class="tree_con" :loading="cardLoading" :bordered="false" @contextmenu.native.stop="openBaseContextMenu">
    <a-spin :spinning="loading">
      <div style="display: flex;flex-direction: column;height: 100%">
        <div style="display: flex">
          <a-input placeholder="输入关键字进行搜索" allowClear v-model="searchInput"
                   @change="handleSearchInputChange"/>
          <a-dropdown :trigger="['click']" placement="bottomCenter" style="margin: 0 8px">
            <a-menu slot="overlay">
              <a-menu-item key="1" @click="expandedKeys = allTreeKeys">展开所有</a-menu-item>
              <a-menu-item key="2" @click="expandedKeys = ['-1']">合并所有</a-menu-item>
              <a-menu-item key="3" @click="getTreeDataByApi">刷新</a-menu-item>
            </a-menu>
            <a-button>
              <a-icon type="bars"/>
            </a-button>
          </a-dropdown>
          <!--          <a-dropdown :trigger="['click']" placement="bottomCenter" style="margin: 0 8px">-->
          <!--            <a-menu slot="overlay">-->
          <!--              <a-menu-item key="1" @click="expandedKeys = allTreeKeys">展开所有</a-menu-item>-->
          <!--              <a-menu-item key="2" @click="expandedKeys = ['-1']">合并所有</a-menu-item>-->
          <!--              <a-menu-item key="3" @click="getTreeDataByApi">刷新</a-menu-item>-->
          <!--            </a-menu>-->
          <!--            <a-button>-->
          <!--              <a-icon type="bars"/>-->
          <!--            </a-button>-->
          <!--          </a-dropdown>-->
        </div>
        <!--设备结构树-->
        <div style="flex: 1;overflow:auto;margin-top: 10px">
        <div id="tree-container" style="flex: 1;overflow:auto;margin-top: 10px">
          <a-tree blockNode show-icon :expandedKeys.sync="expandedKeys"
                  :selectedKeys="selectedKeys" :treeData="treeDataSource" :autoExpandParent="autoExpandParent"
                  @select="handleTreeSelect" @expand="handleTreeExpand" @rightClick="handleTreeRightClick">
@@ -37,246 +37,281 @@
    <!--权限配置弹窗-->
    <AssignPermissionModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="getTreeDataByApi"/>
    <!--产品结构树基本右键菜单(空白处触发)-->
    <DeviceStructureBaseContextMenu ref="baseContextmenuRef"/>
  </a-card>
</template>
<script>
  import dncApi from '@/api/dnc'
  import DeviceStructureTreeContextMenu from './DeviceStructureTreeContextMenu'
  import AssignPermissionModal from './Permission/AssignPermissionModal'
import dncApi from '@/api/dnc'
import DeviceStructureTreeContextMenu from './DeviceStructureTreeContextMenu'
import AssignPermissionModal from './Permission/AssignPermissionModal'
import DeviceStructureBaseContextMenu
  from '@views/dnc/base/modules/DeviceStructure/DeviceStructureBaseContextMenu.vue'
  export default {
    name: 'DeviceStructureTree',
    components: {
      AssignPermissionModal,
      DeviceStructureTreeContextMenu
    },
    data() {
      return {
        searchInput: '',
        cardLoading: false,
        loading: false,
        treeDataSource: [],
        selectedKeys: [],
        expandedKeys: [],
        beforeSearchExpandedKeys: [],
        searchValue: '',
        dataList: [],
        autoExpandParent: true,
        checkStrictly: true,
        allTreeKeys: [],
        currentSelected: {},
        rightClickSelected: {},
        currentDeviceDocClassCode: 'SEND',
        url: {
          delete: '/nc/product/delete'
        }
      }
    },
    created() {
      this.getTreeDataByApi()
      this.$bus.$on('treeMenuItemMethodTrigger', this.triggerCorrespondingMethod)
      this.$bus.$on('handleSwitchDeviceDocClassCode', this.setCurrentDeviceDocClassCode)
    },
    beforeDestroy() {
      this.$bus.$off('treeMenuItemMethodTrigger', this.triggerCorrespondingMethod)
      this.$bus.$off('handleSwitchDeviceDocClassCode', this.setCurrentDeviceDocClassCode)
    },
    methods: {
      getTreeDataByApi() {
        this.loading = true
        this.cardLoading = true
        this.treeDataSource = []
        dncApi.getDeviceTreeDataApi()
          .then(res => {
            if (res.success) {
              this.dataList = []
              this.allTreeKeys = []
              this.treeDataSource = res.result
              this.generateList(this.treeDataSource)
              this.expandedKeys = this.beforeSearchExpandedKeys = this.allTreeKeys
              this.$bus.$emit('sendDeviceTreeNodeInfo', this.treeDataSource[0])
            } else {
              this.$message.warn(res.message)
            }
          })
          .finally(() => {
            this.loading = false
            this.cardLoading = false
          })
      },
      setCurrentDeviceDocClassCode(documentActiveTabKey) {
        if (documentActiveTabKey === 1) this.currentDeviceDocClassCode = 'SEND'
        else this.currentDeviceDocClassCode = 'REC'
      },
      /**
       * æ ‘节点选中时触发
       * @param selectedKeys é€‰ä¸­èŠ‚ç‚¹key
       * @param {node} node èŠ‚ç‚¹å¯¹è±¡
       */
      handleTreeSelect(selectedKeys, { node }) {
        let record = node.dataRef
        this.currentSelected = Object.assign({}, record)
        // å‘右侧父级组件发送当前选中树节点信息
        this.$bus.$emit('sendDeviceTreeNodeInfo', this.currentSelected)
        if (selectedKeys.length === 0) return
        this.selectedKeys = selectedKeys
      },
      /**
       * æ ‘节点右键单击节点时触发
       * @param event äº‹ä»¶å¯¹è±¡
       * @param node èŠ‚ç‚¹å¯¹è±¡
       */
      handleTreeRightClick({ event, node }) {
        const record = node.dataRef
        // è‹¥å³é”®æ—¶å½“前右侧展示层级为设备层级且当前右键树层级同为设备层级时则在触发右键菜单功能时同时触发左键选中功能
        if (this.currentSelected.type === 2 && record.type === 2) this.handleTreeSelect([record.key], { node })
        this.rightClickSelected = Object.assign({}, record)
      },
      /**
       * æ ‘节点展开合并时触发
       * @param expandedKeys å±•开项key
       */
      handleTreeExpand(expandedKeys) {
        this.expandedKeys = this.beforeSearchExpandedKeys = expandedKeys
        console.log('beforeSearchExpandedKeys', this.beforeSearchExpandedKeys)
        this.autoExpandParent = false
      },
      /* è¾“入查询内容变化时触发 */
      handleSearchInputChange() {
        let search = this.searchInput
        let expandedKeys
        let autoExpandParent
        if (search !== '') {
          expandedKeys = this.dataList
            .map(item => {
              if (item.title != null) {
                if (item.title.indexOf(search) > -1) {
                  return this.getParentKey(item.key, this.treeDataSource)
                }
                return null
              }
            })
            .filter((item, i, self) => item && self.indexOf(item) === i)
          autoExpandParent = true
        } else {
          expandedKeys = this.beforeSearchExpandedKeys
          autoExpandParent = false
        }
        Object.assign(this, {
          expandedKeys,
          searchValue: search,
          autoExpandParent
        })
      },
      /**
       * é€’归获得输入项的父级key
       * @param key å­é¡¹key
       * @param tree å­é¡¹
       */
      getParentKey(key, tree) {
        let parentKey
        for (let i = 0; i < tree.length; i++) {
          const node = tree[i]
          if (node.children) {
            if (node.children.some(item => item.key === key)) {
              parentKey = node.key
            } else if (
              this.getParentKey(key, node.children)) {
              parentKey = this.getParentKey(key, node.children)
            }
          }
        }
        return parentKey
      },
      /**
       * é€’归获得所有树节点key
       * @param data
       */
      generateList(data) {
        for (let i = 0; i < data.length; i++) {
          const node = data[i]
          const key = node.key
          const title = node.title
          this.dataList.push({ key, title })
          this.allTreeKeys.push(key)
          this.setTreeNodeIcon(node)
          if (node.children) this.generateList(node.children)
        }
      },
      triggerCorrespondingMethod({ methodName }) {
        if (this[methodName]) this[methodName]()
      },
      /**
       * è®¾ç½®æ ‘节点图标
       * @param treeNode
       */
      setTreeNodeIcon(treeNode) {
        if (!treeNode.equipmentId) {
          treeNode.slots = { icon: 'workshop' }
        } else {
          treeNode.slots = { icon: 'device' }
        }
export default {
  name: 'DeviceStructureTree',
  components: {
    DeviceStructureBaseContextMenu,
    AssignPermissionModal,
    DeviceStructureTreeContextMenu
  },
  data() {
    return {
      searchInput: '',
      cardLoading: false,
      loading: false,
      treeDataSource: [],
      selectedKeys: [],
      expandedKeys: [],
      beforeSearchExpandedKeys: [],
      searchValue: '',
      dataList: [],
      autoExpandParent: true,
      checkStrictly: true,
      allTreeKeys: [],
      currentSelected: {},
      rightClickSelected: {},
      currentDeviceDocClassCode: 'SEND',
      url: {
        delete: '/nc/product/delete'
      }
    }
  },
  created() {
    this.getTreeDataByApi()
    this.$bus.$on('treeMenuItemMethodTrigger', this.triggerCorrespondingMethod)
    this.$bus.$on('handleSwitchDeviceDocClassCode', this.setCurrentDeviceDocClassCode)
  },
  beforeDestroy() {
    this.$bus.$off('treeMenuItemMethodTrigger', this.triggerCorrespondingMethod)
    this.$bus.$off('handleSwitchDeviceDocClassCode', this.setCurrentDeviceDocClassCode)
  },
  methods: {
    // è°ƒç”¨æŽ¥å£èŽ·å–æ ‘çš„æ•°æ®
    getTreeDataByApi() {
      this.loading = true
      this.cardLoading = true
      this.treeDataSource = []
      dncApi.getDeviceTreeDataApi()
        .then(res => {
          if (res.success) {
            this.dataList = []
            this.allTreeKeys = []
            this.treeDataSource = res.result
            this.generateList(this.treeDataSource)
            this.expandedKeys = this.beforeSearchExpandedKeys = this.allTreeKeys
            this.$bus.$emit('sendDeviceTreeNodeInfo', this.treeDataSource[0])
          } else {
            this.$message.warn(res.message)
          }
        })
        .finally(() => {
          this.loading = false
          this.cardLoading = false
        })
    },
    /**
     * é€šè¿‡å³ä¾§tab栏所在activeKey设置当前设备的NC文档类型
     * @param documentActiveTabKey å³ä¾§tab栏的activeKey
     */
    setCurrentDeviceDocClassCode(documentActiveTabKey) {
      if (documentActiveTabKey === 1) this.currentDeviceDocClassCode = 'SEND'
      else this.currentDeviceDocClassCode = 'REC'
    },
    /**
     * æ ‘节点选中时触发
     * @param selectedKeys é€‰ä¸­èŠ‚ç‚¹key
     * @param {node} node èŠ‚ç‚¹å¯¹è±¡
     */
    handleTreeSelect(selectedKeys, { node }) {
      let record = node.dataRef
      this.currentSelected = Object.assign({}, record)
      // å‘右侧父级组件发送当前选中树节点信息
      this.$bus.$emit('sendDeviceTreeNodeInfo', this.currentSelected)
      if (selectedKeys.length === 0) return
      this.selectedKeys = selectedKeys
    },
    /**
     * æ ‘节点右键单击节点时触发
     * @param event äº‹ä»¶å¯¹è±¡
     * @param node èŠ‚ç‚¹å¯¹è±¡
     */
    handleTreeRightClick({ event, node }) {
      if (this.$refs.baseContextmenuRef) this.$refs.baseContextmenuRef.menuVisible = false
      const record = node.dataRef
      // è‹¥å³é”®æ—¶å½“前右侧展示层级为设备层级且当前右键树层级同为设备层级时则在触发右键菜单功能时同时触发左键选中功能
      if (this.currentSelected.type === 2 && record.type === 2) this.handleTreeSelect([record.key], { node })
      this.rightClickSelected = Object.assign({}, record)
    },
    /**
     * æ ‘节点展开合并时触发
     * @param expandedKeys å±•开项key
     */
    handleTreeExpand(expandedKeys) {
      this.expandedKeys = this.beforeSearchExpandedKeys = expandedKeys
      console.log('beforeSearchExpandedKeys', this.beforeSearchExpandedKeys)
      this.autoExpandParent = false
    },
    /* è¾“入查询内容变化时触发 */
    handleSearchInputChange() {
      let search = this.searchInput
      let expandedKeys
      let autoExpandParent
      if (search !== '') {
        expandedKeys = this.dataList
          .map(item => {
            if (item.title != null) {
              if (item.title.indexOf(search) > -1) {
                return this.getParentKey(item.key, this.treeDataSource)
              }
              return null
            }
          })
          .filter((item, i, self) => item && self.indexOf(item) === i)
        autoExpandParent = true
      } else {
        expandedKeys = this.beforeSearchExpandedKeys
        autoExpandParent = false
      }
      Object.assign(this, {
        expandedKeys,
        searchValue: search,
        autoExpandParent
      })
    },
    /**
     * é€’归获得输入项的父级key
     * @param key å­é¡¹key
     * @param tree å­é¡¹
     */
    getParentKey(key, tree) {
      let parentKey
      for (let i = 0; i < tree.length; i++) {
        const node = tree[i]
        if (node.children) {
          if (node.children.some(item => item.key === key)) {
            parentKey = node.key
          } else if (
            this.getParentKey(key, node.children)) {
            parentKey = this.getParentKey(key, node.children)
          }
        }
      }
      return parentKey
    },
    /**
     * é€’归获得所有树节点key
     * @param data
     */
    generateList(data) {
      for (let i = 0; i < data.length; i++) {
        const node = data[i]
        const key = node.key
        const title = node.title
        this.dataList.push({ key, title })
        this.allTreeKeys.push(key)
        this.setTreeNodeIcon(node)
        if (node.children) this.generateList(node.children)
      }
    },
    /**
     * æ ‘所在父元素的右键事件
     * @param event äº‹ä»¶å¯¹è±¡
     */
    openBaseContextMenu(event) {
      event.preventDefault()
      if (event.target.id !== 'tree-container') return
      this.$refs.baseContextmenuRef.menuStyle.top = event.clientY + 'px'
      this.$refs.baseContextmenuRef.menuStyle.left = event.clientX + 'px'
      this.$refs.baseContextmenuRef.menuVisible = true
      document.body.addEventListener('click', this.handleBaseContextMenuClose)
    },
    /**
     * è®¾ç½®æ ‘节点图标
     * @param treeNode
     */
    setTreeNodeIcon(treeNode) {
      if (!treeNode.equipmentId) {
        treeNode.slots = { icon: 'workshop' }
      } else {
        treeNode.slots = { icon: 'device' }
      }
    },
    // æŽ§åˆ¶åŸºç¡€å³é”®èœå•关闭
    handleBaseContextMenuClose() {
      this.$refs.baseContextmenuRef.menuVisible = false
      document.body.removeEventListener('click', this.handleBaseContextMenuClose)
    },
    // åˆ·æ–°é‡æ–°èŽ·å–æ ‘çš„æ•°æ®
    handleTreeReload() {
      this.getTreeDataByApi()
    },
    triggerCorrespondingMethod({ methodName }) {
      if (this[methodName]) this[methodName]()
    }
  }
}
</script>
<style lang="less" scoped>
  /deep/ .ant-card-body {
    padding: 0 12px 0 0;
  }
/deep/ .ant-card-body {
  padding: 0 12px 0 0;
}
  /deep/ .ant-card-body, /deep/ .ant-spin-nested-loading, /deep/ .ant-spin-container {
    height: 100%;
  }
/deep/ .ant-card-body, /deep/ .ant-spin-nested-loading, /deep/ .ant-spin-container {
  height: 100%;
}
  /deep/ .ant-tree-title, .ant-tree-title .ant-dropdown-trigger {
    display: inline-block;
    width: calc(100% - 24px) !important;
  }
/deep/ .ant-tree-title, .ant-tree-title .ant-dropdown-trigger {
  display: inline-block;
  width: calc(100% - 24px) !important;
}
  ::-webkit-scrollbar {
    width: 8px;
  }
::-webkit-scrollbar {
  width: 8px;
}
  @media screen and (min-width: 1920px) {
    .tree_con {
      height: 748px !important;
    }
@media screen and (min-width: 1920px) {
  .tree_con {
    height: 748px !important;
  }
}
  @media screen and (min-width: 1680px) and (max-width: 1920px) {
    .tree_con {
      height: 748px !important;
    }
@media screen and (min-width: 1680px) and (max-width: 1920px) {
  .tree_con {
    height: 748px !important;
  }
}
  @media screen and (min-width: 1400px) and (max-width: 1680px) {
    .tree_con {
      height: 600px !important;
    }
@media screen and (min-width: 1400px) and (max-width: 1680px) {
  .tree_con {
    height: 600px !important;
  }
}
  @media screen and (min-width: 1280px) and (max-width: 1400px) {
    .tree_con {
      height: 501px !important;
    }
@media screen and (min-width: 1280px) and (max-width: 1400px) {
  .tree_con {
    height: 501px !important;
  }
}
  @media screen and (max-width: 1280px) {
    .tree_con {
      height: 501px !important;
    }
@media screen and (max-width: 1280px) {
  .tree_con {
    height: 501px !important;
  }
}
</style>
src/views/dnc/base/modules/DeviceStructure/Document/HasReceivedDocumentTableList.vue
@@ -1,6 +1,6 @@
<template>
  <div>
    <a-table :columns="columns" :data-source="dataSource" bordered :pagination="ipagination"
    <a-table :columns="columns" :data-source="dataSource" bordered :pagination="ipagination" :loading="loading"
             :scroll="{y:265}" :customRow="customRow" :size="size" rowKey="docId" @change="handleTableChange">
    </a-table>
src/views/dnc/base/modules/DeviceStructure/Document/HasSentDocumentTableList.vue
@@ -1,6 +1,6 @@
<template>
  <div>
    <a-table :columns="columns" :data-source="dataSource" bordered :pagination="ipagination"
    <a-table :columns="columns" :data-source="dataSource" bordered :pagination="ipagination" :loading="loading"
             :scroll="{y:265}" :customRow="customRow" :size="size" rowKey="docId" @change="handleTableChange">
    </a-table>
src/views/dnc/base/modules/ProductStructure/DeviceCustomType/UseDeviceCustomTypeEquipmentTableList.vue
@@ -1,81 +1,82 @@
<template>
  <a-table :columns="columns" :data-source="dataSource" bordered :pagination="false" :size="size" rowKey="id" :scroll="{y:189}">
  <a-table :columns="columns" :data-source="dataSource" bordered :pagination="false" :loading="loading" :size="size"
           rowKey="id" :scroll="{y:189}">
  </a-table>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  export default {
    name: 'UseDeviceCustomTypeEquipmentTableList',
    components: {},
    mixins: [JeecgListMixin],
    props: {
      currentLevelDetails: {
        type: Object
      },
      size: {
        type: String
      }
export default {
  name: 'UseDeviceCustomTypeEquipmentTableList',
  components: {},
  mixins: [JeecgListMixin],
  props: {
    currentLevelDetails: {
      type: Object
    },
    data() {
      return {
        disableMixinCreated: true,
        columns: [
          {
            title: '设备编号',
            align: 'center',
            dataIndex: 'equipmentId',
            width:250
          },
          {
            title: '设备名称',
            align: 'center',
            dataIndex: 'equipmentName',
            width:250
          },
          {
            title: '设备型号',
            align: 'center',
            dataIndex: 'equipmentModel',
            width:250
          },
          {
            title: '机床IP',
            align: 'center',
            dataIndex: 'equipmentIp',
            width:200
          },
          {
            title: '驱动类型',
            align: 'center',
            dataIndex: 'driveType'
          },
          {
            title: '端口',
            align: 'center',
            dataIndex: 'dataPort'
          },
          {
            title: '数控系统',
            align: 'center',
            dataIndex: 'controlSystem'
          }
        ],
        url: {
          list: '/nc/deviceManagement/getEquipmentListById'
    size: {
      type: String
    }
  },
  data() {
    return {
      disableMixinCreated: true,
      columns: [
        {
          title: '设备编号',
          align: 'center',
          dataIndex: 'equipmentId',
          width: 250
        },
        {
          title: '设备名称',
          align: 'center',
          dataIndex: 'equipmentName',
          width: 250
        },
        {
          title: '设备型号',
          align: 'center',
          dataIndex: 'equipmentModel',
          width: 250
        },
        {
          title: '机床IP',
          align: 'center',
          dataIndex: 'equipmentIp',
          width: 200
        },
        {
          title: '驱动类型',
          align: 'center',
          dataIndex: 'driveType'
        },
        {
          title: '端口',
          align: 'center',
          dataIndex: 'dataPort'
        },
        {
          title: '数控系统',
          align: 'center',
          dataIndex: 'controlSystem'
        }
      ],
      url: {
        list: '/nc/deviceManagement/getEquipmentListById'
      }
    },
    methods: {
      setQueryParamAndLoadData() {
        const { deviceManagementId } = this.currentLevelDetails
        this.queryParam = Object.assign({}, { id: deviceManagementId })
        this.loadData()
      },
    }
  },
  methods: {
    setQueryParamAndLoadData() {
      const { deviceManagementId } = this.currentLevelDetails
      this.queryParam = Object.assign({}, { id: deviceManagementId })
      this.loadData()
    }
  }
}
</script>
<style scoped>
src/views/dnc/base/modules/ProductStructure/Document/NcDocumentTableList.vue
@@ -1,6 +1,6 @@
<template>
  <div style="flex: 1">
    <a-table :columns="columns" :data-source="dataSource" bordered :pagination="ipagination"
    <a-table :columns="columns" :data-source="dataSource" bordered :pagination="ipagination" :loading="loading"
             :scroll="{y:265}" :customRow="customRow" :size="size" rowKey="docId" @change="handleTableChange">
    </a-table>
@@ -94,7 +94,7 @@
  watch: {
    currentNCDocumentAttributionInfo: {
      handler(value) {
        this.currentClickedDocumentInfo = {}
        this.currentClickedDocumentInfo = this.currentRightClickedDocumentInfo = {}
      },
      immediate: true
    }
src/views/dnc/base/modules/ProductStructure/Document/OtherDocumentTableList.vue
@@ -1,6 +1,6 @@
<template>
  <div>
    <a-table :columns="columns" :data-source="dataSource" bordered :pagination="ipagination"
    <a-table :columns="columns" :data-source="dataSource" bordered :pagination="ipagination" :loading="loading"
             :scroll="{y:265}" :customRow="customRow" :size="size" rowKey="docId" @change="handleTableChange">
    </a-table>
src/views/dnc/base/modules/ProductStructure/ProductStructureBaseContextMenu.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,69 @@
<template>
  <a-menu :style="menuStyle" @click="menuItemClick" v-if="menuVisible" mode="vertical">
    <template v-for="menuItem in baseContextMenuList">
      <a-menu-item :key="menuItem.code" v-has="menuItem.code" v-if="menuItem.isHasPermission">
        <a-icon :type="menuItem.icon"/>
        {{ menuItem.label }}
      </a-menu-item>
      <a-menu-item :key="menuItem.code" v-else>
        <a-icon :type="menuItem.icon"/>
        {{ menuItem.label }}
      </a-menu-item>
    </template>
  </a-menu>
</template>
<script>
export default {
  name: 'ProductStructureBaseContextMenu',
  components: {},
  props: {
    tableRowInfo: {
      type: Object
    }
  },
  data() {
    return {
      menuVisible: false,
      menuStyle: {
        position: 'fixed',
        top: 0,
        left: 0,
        border: '1px solid #eee',
        boxShadow: '0 2px 8px rgba(0, 0, 0, 0.15)',
        zIndex: 999
      },
      currentMenuLevel: '',
      baseContextMenuList: [
        { label: '刷新', code: 'tree_reload', icon: 'reload', isHasPermission: false, isCommonMethod: false },
        { label: '添加产品', code: 'product_add', icon: 'plus', isHasPermission: true, isCommonMethod: false }
      ]
    }
  },
  methods: {
    menuItemClick({ key }) {
      console.log('menuKey', key)
      const isCommonMethod = this.baseContextMenuList.find(item => item.code === key).isCommonMethod
      const modalTitle = this.baseContextMenuList.find(item => item.code === key).label
      const menuKeyArray = key.split('_')
      // product_add => handleAdd è§¦å‘对应组件事件
      let methodName
      // åˆ¤æ–­æ˜¯å¦ä¸ºå…¬å…±æ–¹æ³•,如果为公共方法则截取专有属性product/component/part/process等字段
      if (isCommonMethod) {
        methodName = 'handle' + menuKeyArray.map(item => item[0].toUpperCase() + item.slice(1)).slice(1).join('')
      } else {
        methodName = 'handle' + menuKeyArray.map(item => item[0].toUpperCase() + item.slice(1)).join('')
      }
      this.$bus.$emit('treeMenuItemMethodTrigger', { methodName, modalTitle })
    }
  }
}
</script>
<style scoped>
/deep/ .ant-menu-item {
  height: 32px;
  line-height: 32px;
}
</style>
src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue
@@ -96,15 +96,16 @@
    receiveCurrentTreeNodeInfo(treeNodeInfo) {
      console.log('treeNodeInfo', treeNodeInfo)
      const { id, type } = treeNodeInfo
      // ä»Žæ ‘组件接受树节点信息后从父组件流入子组件
      // ä»Žæ ‘组件接受树节点信息后从父组件流入子组件并重置数据
      this.currentClickedTypeInfo = this.currentRightClickedTableRowInfo = {}
      this.currentTreeNodeInfo = treeNodeInfo
      this.currentNCDocumentAttributionInfo = Object.assign({}, {
        attributionId: id,
        attributionType: type,
        docClassCode: 'NC'
      })
      // æ¸…空上一节点已经加载过得文档列表tabKey
      this.hasLoadedDataTabKeyArray = []
      if (+type === 5 || +type === 6) {
        this.activeTabKey = 1
        this.$nextTick(() => {
@@ -123,6 +124,10 @@
      this.hasLoadedDataTabKeyArray.push(this.activeTabKey)
    },
    /**
     * æŽ¥å—当前点击的设备类信息
     * @param record å½“前点击的设备类行信息
     */
    receiveCurrentClickedTypeInfo(record) {
      const { id, attributionType } = record
      this.currentClickedTypeInfo = Object.assign({}, record)
@@ -142,7 +147,6 @@
     */
    handleTableContextMenuOpen(record) {
      this.currentRightClickedTableRowInfo = Object.assign({}, record)
      console.log('currentRightClickedTableRowInfo', this.currentRightClickedTableRowInfo)
      this.$refs.tableContextMenuRef.currentMenuLevel = record.param
      this.$refs.tableContextMenuRef.menuStyle.top = event.clientY + 'px'
      this.$refs.tableContextMenuRef.menuStyle.left = event.clientX + 'px'
@@ -163,8 +167,9 @@
        this.hasLoadedDataTabKeyArray.push(activeTabKey)
      }
    },
    /**
     * æ–‡æ¡£ä»¥åŠNC程序导入/出库/入库成功后触发重新加载文档列表
     * æ–‡æ¡£ä»¥åŠNC程序导入/出库/入库/取消出库/发布/归档成功后触发重新加载文档列表
     * @param docClassCode æ–‡æ¡£ç±»åˆ«
     * @param attributionType æ–‡æ¡£çˆ¶çº§type类型
     * @param attributionId æ–‡æ¡£çˆ¶çº§Id
@@ -173,12 +178,19 @@
      console.log('docClassCode, attributionType, attributionId', docClassCode, attributionType, attributionId)
      // åœ¨æ­¤å¤„设备NC文档父级参数是可此方法是结构树以及设备类两种不同导入方式的共同出口
      this.currentNCDocumentAttributionInfo = Object.assign({}, { docClassCode, attributionId, attributionType })
      // è‹¥å¼•入设备类则只需要判断当前出现的文档所属是否是当前左键选中的文档,若不是当前选中的文档则不刷新文档列表(避免无效刷新)
      if (this.currentRightClickedTableRowInfo.hasOwnProperty('deviceManagementId')) {
        if (this.currentClickedTypeInfo.id !== attributionId) return
      } else {
        if (this.currentTreeNodeInfo.id !== attributionId) return
      // åˆ¤æ–­å½“前右侧展示的文档的所属是否是当前左键选中树节点或设备类,若不是当前左键选中的则在导入后不刷新右侧的文档列表(避免无效刷新)
      // åˆ¤æ–­æ˜¯å¦æ˜¯åœ¨æ–‡æ¡£åˆ—表中进行出库/入库/发布/归档等操作,若是在文档列表中操作则操作成功后直接刷新文档列表
      if (!this.currentRightClickedTableRowInfo.hasOwnProperty('docId')) {
        if (this.currentRightClickedTableRowInfo.hasOwnProperty('deviceManagementId')) {
          // æ­¤ç§æƒ…况是在引入设备类并在设备类列表中进行NC文档导入
          if (this.currentClickedTypeInfo.id !== attributionId) return
        } else {
          // æ­¤ç§æƒ…况是在结构树节点上进行文档导入
          if (this.currentTreeNodeInfo.id !== attributionId) return
        }
      }
      if (docClassCode === 'NC') {
        this.$nextTick(() => {
          if (this.$refs.ncDocumentTableListRef) this.$refs.ncDocumentTableListRef.loadData(1)
@@ -432,7 +444,7 @@
    },
    /**
     * é‡å½’档当前右键选中文档且后续无法继续发布或归档
     * å½’档当前右键选中文档且后续无法继续发布或归档
     * @param menuLabel
     */
    handlePigeonhole(menuLabel) {
src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue
@@ -1,17 +1,17 @@
<template>
  <a-card class="tree_con" :loading="cardLoading" :bordered="false" @contextmenu.native="e=>e.preventDefault()">
  <a-card class="tree_con" :loading="cardLoading" :bordered="false" @contextmenu.native.stop="openBaseContextMenu">
    <a-spin :spinning="loading">
      <div style="display: flex;flex-direction: column;height: 100%">
        <div style="display: flex;justify-content: space-between">
          <a-input placeholder="输入关键字进行搜索" allowClear v-model="searchInput"
                   @change="handleSearchInputChange"/>
          <a-tooltip title="刷新">
            <a-button icon="reload" @click="getTreeDataByApi" style="width: 18%;margin-left: 8px"></a-button>
          </a-tooltip>
          <a-button type="primary" v-has="'product_add'" icon="plus" style="margin-left: 8px"
                    @click="$refs.productModalFormRef.triggerCorrespondingMethod({modalTitle:'添加产品',methodName:'handleProductAdd'})">
            äº§å“
          </a-button>
          <!--          <a-tooltip title="刷新">-->
          <!--            <a-button icon="reload" @click="handleTreeReload" style="width: 18%;margin-left: 8px"></a-button>-->
          <!--          </a-tooltip>-->
          <!--          <a-button type="primary" v-has="'product_add'" icon="plus" style="margin-left: 8px"-->
          <!--                    @click="$refs.productModalFormRef.triggerCorrespondingMethod({modalTitle:'添加产品',methodName:'handleProductAdd'})">-->
          <!--            äº§å“-->
          <!--          </a-button>-->
          <!--          <a-dropdown :trigger="['click']" placement="bottomCenter" style="margin: 0 8px">-->
          <!--            <a-menu slot="overlay">-->
          <!--              <a-menu-item key="1" @click="expandedKeys = allTreeKeys">展开所有</a-menu-item>-->
@@ -25,7 +25,7 @@
        </div>
        <!--产品结构树-->
        <div style="flex: 1;overflow:auto;margin-top: 10px">
        <div id="tree-container" style="flex: 1;overflow:auto;margin-top: 10px">
          <a-tree blockNode show-icon :expandedKeys.sync="expandedKeys"
                  :selectedKeys="selectedKeys" :treeData="treeDataSource" :autoExpandParent="autoExpandParent"
                  @select="handleTreeSelect" @expand="handleTreeExpand" @rightClick="handleTreeRightClick">
@@ -61,6 +61,8 @@
    <ProcessStepModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
    <!--权限配置弹窗-->
    <AssignPermissionModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
    <!--产品结构树基本右键菜单(空白处触发)-->
    <ProductStructureBaseContextMenu ref="baseContextmenuRef"/>
  </a-card>
</template>
@@ -76,10 +78,13 @@
import ProcessStepModal from './ProcessStep/ProcessStepModal'
import AssignPermissionModal from './Permission/AssignPermissionModal'
import DeviceCustomTypeModal from '@views/dnc/base/modules/ProductStructure/DeviceCustomType/DeviceCustomTypeModal.vue'
import ProductStructureBaseContextMenu
  from '@views/dnc/base/modules/ProductStructure/ProductStructureBaseContextMenu.vue'
export default {
  name: 'ProductStructureTree',
  components: {
    ProductStructureBaseContextMenu,
    DeviceCustomTypeModal,
    AssignPermissionModal,
    ProcessStepModal,
@@ -118,6 +123,7 @@
    this.$bus.$off('treeMenuItemMethodTrigger', this.triggerCorrespondingMethod)
  },
  methods: {
    // è°ƒç”¨æŽ¥å£èŽ·å–æ ‘çš„æ•°æ®
    getTreeDataByApi() {
      this.loading = true
      this.cardLoading = true
@@ -180,6 +186,7 @@
     * @param node èŠ‚ç‚¹å¯¹è±¡
     */
    handleTreeRightClick({ node }) {
      if (this.$refs.baseContextmenuRef) this.$refs.baseContextmenuRef.menuVisible = false
      const that = this
      const record = node.dataRef
      const { id, type } = record
@@ -339,8 +346,17 @@
      }
    },
    triggerCorrespondingMethod({ methodName }) {
      if (this[methodName]) this[methodName]()
    /**
     * æ ‘所在父元素的右键事件
     * @param event äº‹ä»¶å¯¹è±¡
     */
    openBaseContextMenu(event) {
      event.preventDefault()
      if (event.target.id !== 'tree-container') return
      this.$refs.baseContextmenuRef.menuStyle.top = event.clientY + 'px'
      this.$refs.baseContextmenuRef.menuStyle.left = event.clientX + 'px'
      this.$refs.baseContextmenuRef.menuVisible = true
      document.body.addEventListener('click', this.handleBaseContextMenuClose)
    },
    /**
@@ -369,7 +385,23 @@
          break
        default:
      }
    },
    // æŽ§åˆ¶åŸºç¡€å³é”®èœå•关闭
    handleBaseContextMenuClose() {
      this.$refs.baseContextmenuRef.menuVisible = false
      document.body.removeEventListener('click', this.handleBaseContextMenuClose)
    },
    // åˆ·æ–°é‡æ–°èŽ·å–æ ‘çš„æ•°æ®
    handleTreeReload() {
      this.getTreeDataByApi()
    },
    triggerCorrespondingMethod({ methodName }) {
      if (this[methodName]) this[methodName]()
    }
  }
}
</script>
src/views/dnc/common/ImportFileModal.vue
@@ -7,7 +7,7 @@
      </a-button>
    </a-upload>
    <div style="margin-top: 16px">已选择{{fileList.length}}个文件</div>
    <div style="margin-top: 16px">已选择{{ fileList.length }}个文件</div>
    <template slot="footer">
      <a-button @click="handleModalClose">取消</a-button>
@@ -26,197 +26,195 @@
</template>
<script>
  import dncApi from '@/api/dnc'
import dncApi from '@/api/dnc'
  export default {
    name: 'ImportFileModal',
    components: {},
    data() {
      return {
        visible: false,
        title: '',
        fileList: [],
        uploadParams: {},
        uploading: false,
        isUploadMultiple: true,
        currentDeviceDocClassCode: 'SEND',
        currentTitleAfterClass: ''
export default {
  name: 'ImportFileModal',
  components: {},
  data() {
    return {
      visible: false,
      title: '',
      fileList: [],
      uploadParams: {},
      uploading: false,
      isUploadMultiple: true,
      currentDeviceDocClassCode: 'SEND',
      currentTitleAfterClass: ''
    }
  },
  created() {
    this.$bus.$on('treeMenuItemMethodTrigger', this.triggerCorrespondingMethod)
    this.$bus.$on('tableMenuItemMethodTrigger', this.triggerCorrespondingMethod)
  },
  methods: {
    /**
     * ç‚¹å‡»å¯¼å…¥æ–‡æ¡£æˆ–NC程序时触发
     * @param treeNodeInfo ç‚¹å‡»æ ‘节点右键菜单导入程序时传入树节点信息
     * @param tableRowInfo å³é”®è¡¨æ ¼è¡Œæ—¶ä¼ å…¥è¡Œä¿¡æ¯
     * @param modalTitle å¼¹çª—标题
     */
    handleImport(treeNodeInfo, tableRowInfo, modalTitle) {
      this.isUploadMultiple = true
      let attributionId // æ–‡æ¡£æ‰€å±žå±‚级Id
      let attributionType  // æ–‡æ¡£æ‰€å±žå±‚级类型
      let docClassCode // æ–‡æ¡£ç±»åž‹
      if (treeNodeInfo) {
        attributionId = treeNodeInfo.treeKey
        attributionType = treeNodeInfo.type
        docClassCode = treeNodeInfo.param
      } else {
        // è‹¥å·¥åºåŠå·¥æ­¥å±‚级下有设备类时则导入NC的参数需要调整
        attributionId = tableRowInfo.param === 'deviceCustomType' ? tableRowInfo.id : tableRowInfo.attributionId
        attributionType = tableRowInfo.attributionType
        docClassCode = tableRowInfo.param === 'deviceCustomType' ? 'NC' : tableRowInfo.param
      }
      this.setModalTitle(modalTitle, docClassCode)
      this.uploadParams = Object.assign({}, { attributionId, attributionType, docClassCode })
      console.log('uploadParams=====================', this.uploadParams)
      this.visible = true
    },
    /**
     * ç‚¹å‡»æ–‡æ¡£ç”Ÿå‘½å‘¨æœŸçš„入库时触发
     * @param _
     * @param tableRowInfo å³é”®è¡¨æ ¼è¡Œæ—¶ä¼ å…¥è¡Œä¿¡æ¯
     */
    handlePush(_, tableRowInfo) {
      this.isUploadMultiple = false
      const { docId, attributionId, attributionType, param } = tableRowInfo
      this.uploadParams = Object.assign({}, {
        docId,
        attributionId,
        attributionType,
        docClassCode: param
      })
      this.visible = true
    },
    /**
     * é€‰æ‹©å¥½æ–‡ä»¶ç‚¹å‡»ç¡®å®šåŽ
     * @param file æ–‡ä»¶å¯¹è±¡
     */
    beforeUpload(file) {
      if (this.isUploadMultiple) {
        if (!this.fileList.find(item => item.name === file.name)) this.fileList = [...this.fileList, file]
      } else this.fileList.splice(0, 1, file)
      return false
    },
    // ç‚¹å‡»ä¸Šä¼ è‡³æœåŠ¡å™¨æŒ‰é’®æ—¶è§¦å‘
    handleUpload() {
      const { fileList, $notification, isUploadMultiple, uploadParams, $bus, handleModalClose } = this
      this.uploading = true
      let uploadedFileCount = 0
      let uploadSuccessFileCount = 0
      let apiMethod,params
      fileList.forEach((file, index) => {
        const formData = new FormData()
        formData.append('file', file)
        file.status = 'uploading'
        // ç›®å‰æ ¹æ®æ˜¯å¦ä¸Šä¼ å¤šä¸ªæ–‡ä»¶åˆ¤æ–­ä¸¤ä¸ªåŠŸèƒ½ï¼Œè‹¥åŽç»­å¢žåŠ åŠŸèƒ½æˆ–è°ƒæ•´éœ€æ±‚åˆ™è°ƒæ•´åˆ¤æ–­æ¡ä»¶
        if (isUploadMultiple) {
          apiMethod = dncApi.importDocumentFromLocalApi
          params = Object.assign({}, { params: uploadParams, formData })
        } else {
          apiMethod = dncApi.documentVersionUpdateApi
          params = Object.assign({}, { docId: uploadParams.docId, formData })
        }
        apiMethod(params)
          .then(res => {
            if (res.success) {
              file.status = 'done'
              uploadSuccessFileCount++
              $notification.success({
                message: '消息',
                description: res.message
              })
            } else {
              file.status = 'error'
              $notification.error({
                message: '消息',
                description: res.message
              })
            }
          })
          .catch(err => {
            file.status = 'error'
          })
          .finally(() => {
            uploadedFileCount++
            fileList.splice(index, 1, file)
            // å½“文件全部上传完成后
            if (uploadedFileCount === fileList.length) {
              // è‡³å°‘有一个文件上传成功后就需要重新加载文档列表
              if (uploadSuccessFileCount > 0) {
                $bus.$emit('reloadDocumentListData', uploadParams)
                if (!isUploadMultiple) {
                  $bus.$emit('reloadMainBottomTableData', 'documentVersion')
                  handleModalClose() //无法连续入库多个版本因此入库成功后即可退出窗口
                }
              }
              this.uploading = false
            }
          })
      })
    },
    /**
     * åˆ é™¤æ–‡ä»¶åˆ—表项时触发
     * @param file æ–‡ä»¶å¯¹è±¡
     */
    handleRemove(file) {
      const index = this.fileList.indexOf(file)
      const newFileList = this.fileList.slice()
      newFileList.splice(index, 1)
      this.fileList = newFileList
    },
    // æŽ§åˆ¶æ–‡ä»¶ä¸Šä¼ çª—口关闭并清空文件列表
    handleModalClose() {
      this.visible = false
      this.fileList = []
    },
    /**
     * è®¾ç½®å¼¹çª—标题
     * @param modalTitle å¼¹çª—标题
     * @param docClassCode æ–‡æ¡£ç±»åž‹
     */
    setModalTitle(modalTitle, docClassCode) {
      switch (docClassCode) {
        case 'SEND':
          this.title = modalTitle + '(发送)'
          break
        case 'REC':
          this.title = modalTitle + '(接收)'
          break
      }
    },
    created() {
      this.$bus.$on('treeMenuItemMethodTrigger', this.triggerCorrespondingMethod)
      this.$bus.$on('tableMenuItemMethodTrigger', this.triggerCorrespondingMethod)
    },
    methods: {
      /**
       * ç‚¹å‡»å¯¼å…¥æ–‡æ¡£æˆ–NC程序时触发
       * @param treeNodeInfo ç‚¹å‡»æ ‘节点右键菜单导入程序时传入树节点信息
       * @param tableRowInfo å³é”®è¡¨æ ¼è¡Œæ—¶ä¼ å…¥è¡Œä¿¡æ¯
       * @param modalTitle å¼¹çª—标题
       */
      handleImport(treeNodeInfo, tableRowInfo, modalTitle) {
        this.isUploadMultiple = true
        let attributionId // æ–‡æ¡£æ‰€å±žå±‚级Id
        let attributionType  // æ–‡æ¡£æ‰€å±žå±‚级类型
        let docClassCode // æ–‡æ¡£ç±»åž‹
        if (treeNodeInfo) {
          attributionId = treeNodeInfo.treeKey
          attributionType = treeNodeInfo.type
          docClassCode = treeNodeInfo.param
        } else {
          // è‹¥å·¥åºåŠå·¥æ­¥å±‚级下有设备类时则导入NC的参数需要调整
          attributionId = tableRowInfo.param==='deviceCustomType'?tableRowInfo.id:tableRowInfo.attributionId
          attributionType = tableRowInfo.attributionType
          docClassCode = tableRowInfo.param==='deviceCustomType'?'NC':tableRowInfo.param
        }
        this.setModalTitle(modalTitle, docClassCode)
        this.uploadParams = Object.assign({}, { attributionId, attributionType, docClassCode })
        console.log('uploadParams=====================', this.uploadParams)
        this.visible = true
      },
      /**
       * ç‚¹å‡»æ–‡æ¡£ç”Ÿå‘½å‘¨æœŸçš„入库时触发
       * @param _
       * @param tableRowInfo å³é”®è¡¨æ ¼è¡Œæ—¶ä¼ å…¥è¡Œä¿¡æ¯
       */
      handlePush(_, tableRowInfo) {
        this.isUploadMultiple = false
        console.log('tableRowInfo', tableRowInfo)
        this.uploadParams = Object.assign({}, {
          docId: tableRowInfo.docId,
          attributionId: tableRowInfo.attributionId,
          docClassCode: tableRowInfo.param
        })
        this.visible = true
      },
      /**
       * é€‰æ‹©å¥½æ–‡ä»¶ç‚¹å‡»ç¡®å®šåŽ
       * @param file æ–‡ä»¶å¯¹è±¡
       */
      beforeUpload(file) {
        if (this.isUploadMultiple) {
          if (!this.fileList.find(item => item.name === file.name)) this.fileList = [...this.fileList, file]
        }
        else this.fileList.splice(0, 1, file)
        return false
      },
      // ç‚¹å‡»ä¸Šä¼ è‡³æœåŠ¡å™¨æŒ‰é’®æ—¶è§¦å‘
      handleUpload() {
        const { fileList, $notification, isUploadMultiple, uploadParams, $bus, handleModalClose } = this
        this.uploading = true
        let uploadedFileCount = 0
        let uploadSuccessFileCount = 0
        let apiMethod
        let params
        fileList.forEach((file, index) => {
          const formData = new FormData()
          formData.append('file', file)
          file.status = 'uploading'
          // ç›®å‰æ ¹æ®æ˜¯å¦ä¸Šä¼ å¤šä¸ªæ–‡ä»¶åˆ¤æ–­ä¸¤ä¸ªåŠŸèƒ½ï¼Œè‹¥åŽç»­å¢žåŠ åŠŸèƒ½æˆ–è°ƒæ•´éœ€æ±‚åˆ™è°ƒæ•´åˆ¤æ–­æ¡ä»¶
          if (isUploadMultiple) {
            apiMethod = dncApi.importDocumentFromLocalApi
            params = Object.assign({}, { params: uploadParams, formData })
          } else {
            apiMethod = dncApi.documentVersionUpdateApi
            params = Object.assign({}, { docId: uploadParams.docId, formData })
          }
          apiMethod(params)
            .then(res => {
              if (res.success) {
                file.status = 'done'
                uploadSuccessFileCount++
                console.log('uploadSuccessFileCount++', uploadSuccessFileCount)
                $notification.success({
                  message: '消息',
                  description: res.message
                })
              } else {
                file.status = 'error'
                $notification.error({
                  message: '消息',
                  description: res.message
                })
              }
            })
            .catch(err => {
              file.status = 'error'
            })
            .finally(() => {
              uploadedFileCount++
              fileList.splice(index, 1, file)
              // å½“文件全部上传完成后
              if (uploadedFileCount === fileList.length) {
                // è‡³å°‘有一个文件上传成功后就需要重新加载文档列表
                if (uploadSuccessFileCount > 0) {
                  $bus.$emit('reloadDocumentListData', uploadParams)
                  if (!isUploadMultiple) {
                    $bus.$emit('reloadMainBottomTableData', 'documentVersion')
                    handleModalClose() //无法连续入库多个版本因此入库成功后即可退出窗口
                  }
                }
                this.uploading = false
              }
            })
        })
      },
      /**
       * åˆ é™¤æ–‡ä»¶åˆ—表项时触发
       * @param file æ–‡ä»¶å¯¹è±¡
       */
      handleRemove(file) {
        const index = this.fileList.indexOf(file)
        const newFileList = this.fileList.slice()
        newFileList.splice(index, 1)
        this.fileList = newFileList
      },
      // æŽ§åˆ¶æ–‡ä»¶ä¸Šä¼ çª—口关闭并清空文件列表
      handleModalClose() {
        this.visible = false
        this.fileList = []
      },
      /**
       * è®¾ç½®å¼¹çª—标题
       * @param modalTitle å¼¹çª—标题
       * @param docClassCode æ–‡æ¡£ç±»åž‹
       */
      setModalTitle(modalTitle, docClassCode) {
        switch (docClassCode) {
          case 'SEND':
            this.title = modalTitle + '(发送)'
            break
          case 'REC':
            this.title = modalTitle + '(接收)'
            break
        }
      },
      triggerCorrespondingMethod({ methodName, modalTitle, treeNodeInfo, tableRowInfo }) {
        if (this[methodName]) {
          this.title = modalTitle
          this[methodName](treeNodeInfo, tableRowInfo, modalTitle)
        }
    triggerCorrespondingMethod({ methodName, modalTitle, treeNodeInfo, tableRowInfo }) {
      if (this[methodName]) {
        this.title = modalTitle
        this[methodName](treeNodeInfo, tableRowInfo, modalTitle)
      }
    }
  }
}
</script>
<style scoped lang="less">
  /deep/ .ant-btn-primary#custom-upload-button {
    color: #fff;
    background-color: #67C23A;
    border-color: #67C23A;
/deep/ .ant-btn-primary#custom-upload-button {
  color: #fff;
  background-color: #67C23A;
  border-color: #67C23A;
    &[disabled] {
      color: rgba(0, 0, 0, 0.25);
      background-color: #f5f5f5;
      border-color: #d9d9d9;
    }
  &[disabled] {
    color: rgba(0, 0, 0, 0.25);
    background-color: #f5f5f5;
    border-color: #d9d9d9;
  }
}
</style>
src/views/mdc/base/OEEAnalysis.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,82 @@
<template>
  <div style="width: 100%; height: 100%;">
    <a-card :bordered="false">
      <a-row type="flex" :gutter="16">
        <a-col :md="5">
          <a-tabs :activeKey="activeKey" @change="tabChange">
            <a-tab-pane key="1" tab="车间层级" force-render>
              <base-tree @getCurrSelected="changeSelectionNode"></base-tree>
            </a-tab-pane>
            <a-tab-pane v-if="isDepartType == 0" key="2" tab="部门层级">,
              <depart-tree @getCurrSelectedDD="changeSelectionNodedd"></depart-tree>
            </a-tab-pane>
          </a-tabs>
        </a-col>
        <a-col :md="19">
          <OEEAnalysisList :nodePeople='selectPeople' :nodeTree='selectEquipment' :Type="selectTypeTree"/>
        </a-col>
      </a-row>
    </a-card>
  </div>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import BaseTree from '../common/BaseTree'
  import OEEAnalysisList from './modules/OEEAnalysis/OEEAnalysisList'
  import DepartTree from './modules/DepartList/DepartListTree/DepartTree'
  import { mapActions } from 'vuex'
  export default {
    name: 'OEEAnalysis',
    components: {
      BaseTree,
      DepartTree,
      OEEAnalysisList
    },
    data() {
      return {
        activeKey: '1',
        selectEquipmentId: '',
        selectEquipment: {},
        selectPeople: {},
        selectTypeTree: '',
        isDepartType: ''
      }
    },
    created() {
      this.queryTreeData()
    },
    methods: {
      ...mapActions(['QueryDepartTree']),
      queryTreeData() {
        this.QueryDepartTree().then(res => {
          if (res.success) {
            this.isDepartType = res.result[0].value
          } else {
            // this.$message.warn(res.message)
            this.$notification.warning({
              message: '消息',
              description: res.message
            })
          }
        }).finally(() => {
        })
      },
      tabChange(val) {
        this.activeKey = val
        this.selectTypeTree = val
      },
      changeSelectionNode(val) {
        this.selectEquipment = val
        this.selectTypeTree = '1'
      },
      changeSelectionNodedd(val) {
        this.selectPeople = val
        this.selectTypeTree = '2'
      }
    }
  }
</script>
src/views/mdc/base/PartsMatchingManagement.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,82 @@
<template>
  <div style="width: 100%; height: 100%;">
    <a-card :bordered="false">
      <a-row type="flex" :gutter="16">
        <a-col :md="5">
          <a-tabs :activeKey="activeKey" @change="tabChange">
            <a-tab-pane key="1" tab="车间层级" force-render>
              <base-tree @getCurrSelected="changeSelectionNode"></base-tree>
            </a-tab-pane>
            <a-tab-pane v-if="isDepartType == 0" key="2" tab="部门层级">,
              <depart-tree @getCurrSelectedDD="changeSelectionNodedd"></depart-tree>
            </a-tab-pane>
          </a-tabs>
        </a-col>
        <a-col :md="19">
          <PartsMatchingList :nodePeople='selectPeople' :nodeTree='selectEquipment' :Type="selectTypeTree"/>
        </a-col>
      </a-row>
    </a-card>
  </div>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import BaseTree from '../common/BaseTree'
  import PartsMatchingList from './modules/PartsMatchingManagement/PartsMatchingList'
  import DepartTree from './modules/DepartList/DepartListTree/DepartTree'
  import { mapActions } from 'vuex'
  export default {
    name: 'PartsMatchingManagement',
    components: {
      BaseTree,
      DepartTree,
      PartsMatchingList
    },
    data() {
      return {
        activeKey: '1',
        selectEquipmentId: '',
        selectEquipment: {},
        selectPeople: {},
        selectTypeTree: '',
        isDepartType: ''
      }
    },
    created() {
      this.queryTreeData()
    },
    methods: {
      ...mapActions(['QueryDepartTree']),
      queryTreeData() {
        this.QueryDepartTree().then(res => {
          if (res.success) {
            this.isDepartType = res.result[0].value
          } else {
            // this.$message.warn(res.message)
            this.$notification.warning({
              message: '消息',
              description: res.message
            })
          }
        }).finally(() => {
        })
      },
      tabChange(val) {
        this.activeKey = val
        this.selectTypeTree = val
      },
      changeSelectionNode(val) {
        this.selectEquipment = val
        this.selectTypeTree = '1'
      },
      changeSelectionNodedd(val) {
        this.selectPeople = val
        this.selectTypeTree = '2'
      }
    }
  }
</script>
src/views/mdc/base/modules/OEEAnalysis/ComputeOeeModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,88 @@
<template>
  <a-modal title="计算OEE" :visible="visible" :width="550" @cancel="handleModalClose" @ok="handleComputeOee"
           :maskClosable="false">
    <a-form-model :model="model" :labelCol="labelColLong" :wrapperCol="wrapperColLong">
      <a-row>
        <a-col :span="24">
          <a-form-model-item label="日期">
            <a-range-picker v-model="dates" style="width: 100%" value-format="YYYY-MM-DD"
                            @change="dateParamChange"></a-range-picker>
          </a-form-model-item>
        </a-col>
      </a-row>
    </a-form-model>
  </a-modal>
</template>
<script>
  import mdcApi from '@/api/mdc'
  export default {
    name: 'ComputeOeeModal',
    components: {},
    data() {
      return {
        visible: false,
        model: {},
        dates: [],
        labelColLong: {
          xs: { span: 24 },
          sm: { span: 3 }
        },
        wrapperColLong: {
          xs: { span: 24 },
          sm: { span: 21 }
        }
      }
    },
    methods: {
      handleComputeOee() {
        console.log('model', this.model)
        if (this.dates.length === 0) {
          this.$notification.warning({
            message: '消息',
            description: '请选择时间'
          })
          return
        }
        mdcApi.computeOeeApi(this.model)
          .then(res => {
            if (res.success) {
              this.$notification.success({
                message: '消息',
                description: res.message
              })
              this.visible = false
            } else {
              this.$notification.error({
                message: '消息',
                description: '计算失败'
              })
            }
          })
          .catch(err => {
            this.$notification.error({
              message: '消息',
              description: '计算失败'
            })
          })
      },
      dateParamChange(value1, value2) {
        this.model.startTime = value2[0]
        this.model.endTime = value2[1]
      },
      handleModalClose() {
        this.visible = false
        this.model = {}
        this.dates = []
      }
    }
  }
</script>
<style scoped>
</style>
src/views/mdc/base/modules/OEEAnalysis/OEEAnalysisList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,304 @@
<template>
  <div class="device_list">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="设备编号">
              <a-input placeholder="请输入设备编号" v-model="queryParam.equipmentId"/>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="日期">
              <a-range-picker v-model="dates" style="width: 100%" @change="dateParamChange"></a-range-picker>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-space>
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload">重置</a-button>
            </a-space>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- æŸ¥è¯¢åŒºåŸŸ-END -->
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator">
      <a-button type="primary" icon="download" @click="handleExportXls('OEE')">导出</a-button>
      <a-button type="primary" icon="edit" @click="handleComputeModalOpen">计算</a-button>
    </div>
    <!-- table区域-begin -->
    <div id="DeviceList" style="flex: 1;overflow: hidden">
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:'max-content',y:scrollY}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading">
        <template slot="percent" slot-scope="text">
          {{text+'%'}}
        </template>
      </a-table>
    </div>
    <ComputeOeeModal ref="computeOeeModalRef"/>
  </div>
</template>
<script>
  import moment from 'moment'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import ComputeOeeModal from './ComputeOeeModal'
  export default {
    name: 'OEEAnalysisList',
    mixins: [JeecgListMixin],
    components: { ComputeOeeModal },
    props: { nodeTree: '', Type: '', nodePeople: '' },
    data() {
      return {
        description: 'OEE页面',
        disableMixinCreated: true,
        /* åˆ†é¡µå‚æ•° */
        ipagination: {
          current: 1,
          pageSize: 30,
          pageSizeOptions: ['30', '50', '100'],
          showTotal: (total, range) => {
            return range[0] + '-' + range[1] + ' å…±' + total + '条'
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        dates: [moment().subtract(1, 'day'), moment()],
        queryParam: {},
        // è¡¨å¤´
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            title: '设备编号',
            align: 'center',
            dataIndex: 'equipmentId',
            width: 230
          },
          {
            title: '日期',
            align: 'center',
            dataIndex: 'theDate',
            width: 150
          },
          {
            title: '日历工作时间(min)',
            align: 'center',
            dataIndex: 'calendarLong',
            width: 150
          },
          {
            title: '计划停机时间(min)',
            align: 'center',
            dataIndex: 'planCloseLong',
            width: 150
          },
          {
            title: '负荷时间(min)',
            align: 'center',
            dataIndex: 'loadLong',
            width: 150
          },
          {
            title: '非计划停机时间(min)',
            align: 'center',
            dataIndex: 'noplanCloseLong',
            width: 150
          },
          {
            title: '开动时间(min)',
            align: 'center',
            dataIndex: 'actuateLong',
            width: 150
          },
          {
            title: '时间开动率',
            align: 'center',
            dataIndex: 'timeActuationRate',
            width: 150,
            scopedSlots: { customRender: 'percent' }
          },
          {
            title: '有效运行时间(min)',
            align: 'center',
            dataIndex: 'effectiveRunLong',
            width: 150
          },
          {
            title: '性能开动率',
            align: 'center',
            dataIndex: 'performanceRate',
            width: 150,
            scopedSlots: { customRender: 'percent' }
          },
          {
            title: '加工零件数量',
            align: 'center',
            dataIndex: 'processCount',
            width: 150
          },
          {
            title: '合格零件数量',
            align: 'center',
            dataIndex: 'passCount',
            width: 150
          },
          {
            title: '一次合格率',
            align: 'center',
            dataIndex: 'passRate',
            width: 150,
            scopedSlots: { customRender: 'percent' }
          },
          {
            title: 'OEE',
            align: 'center',
            dataIndex: 'oee',
            width: 150,
            scopedSlots: { customRender: 'percent' }
          }
        ],
        scrollY: 465,
        url: {
          list: '/mdc/mdcOeeInfo/list',
          exportXlsUrl: '/mdc/mdcOeeInfo/exportXls'
        }
      }
    },
    watch: {
      Type(valmath) {
        this.dataList = []
        this.queryParam.typeTree = valmath
        // console.log(this.queryParam.typeTree)
      },
      nodeTree(val) { //监听currSelected å˜åŒ–,将变化后的数值传递给 getCurrSelected äº‹ä»¶
        if (JSON.stringify(val) != '{}') {
          if (val.equipmentId) {
            this.queryParam.parentId = ''
            this.queryParam.equipmentId = val.equipmentId
          } else {
            this.queryParam.parentId = val.key
            this.queryParam.equipmentId = ''
          }
          this.searchQuery()
        }
      },
      nodePeople(val) {
        if (JSON.stringify(val) != '{}') {
          if (val.equipmentId) {
            this.queryParam.parentId = ''
            this.queryParam.equipmentId = val.equipmentId
          } else {
            this.queryParam.parentId = val.key
            this.queryParam.equipmentId = ''
          }
          this.searchQuery()
        }
      }
    },
    methods: {
      handleComputeModalOpen() {
        this.$refs.computeOeeModalRef.visible = true
      },
      dateParamChange(v1, v2) {
        this.queryParam.startTime = v2[0]
        this.queryParam.endTime = v2[1]
        this.dates = [v1[0], v1[1]]
      },
      searchReset() {
        this.dates = [moment().subtract(1, 'day'), moment()]
        this.queryParam = {
          startTime: this.dates[0].format('YYYY-MM-DD'),
          endTime: this.dates[1].format('YYYY-MM-DD')
        }
        this.loadData(1)
      },
      /**
       * å½“浏览器可视窗口尺寸发生改变时触发
       */
      handleWindowResize() {
        const boxHeight = +window.getComputedStyle(document.getElementById('DeviceList')).height.slice(0, -2)
        const tableHeadHeight = +window.getComputedStyle(document.querySelector('.ant-table-thead th')).height.slice(0, -2)
        this.scrollY = boxHeight - tableHeadHeight - 50
      }
    },
    created() {
      this.queryParam.startTime = this.dates[0].format('YYYY-MM-DD')
      this.queryParam.endTime = this.dates[1].format('YYYY-MM-DD')
      this.loadData()
    },
    mounted() {
      window.addEventListener('resize', this.handleWindowResize)
      this.handleWindowResize()
    },
    beforeDestroy() {
      window.removeEventListener('resize', this.handleWindowResize)
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
  .device_list {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  @media screen and (min-width: 1920px) {
    .device_list {
      height: 811px !important;
    }
  }
  @media screen and (min-width: 1680px) and (max-width: 1920px) {
    .device_list {
      height: 811px !important;
    }
  }
  @media screen and (min-width: 1400px) and (max-width: 1680px) {
    .device_list {
      height: 663px !important;
    }
  }
  @media screen and (min-width: 1280px) and (max-width: 1400px) {
    .device_list {
      height: 564px !important;
    }
  }
  @media screen and (max-width: 1280px) {
    .device_list {
      height: 564px !important;
    }
  }
</style>
src/views/mdc/base/modules/PartsMatchingManagement/PartsMatchingForm.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,191 @@
<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
        <a-row>
          <a-col :span="24">
            <a-form-model-item label="设备组" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentIds">
              <a-input-search :readOnly="true" v-model="model.equipmentIds"
                              @search="deviceSearch" :disabled="disableSelectDevice" enter-button
                              placeholder="请选择设备"></a-input-search>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="零件号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="partId">
              <a-input placeholder="请输入零件号" v-model="model.partId" allowClear/>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="标准加工工时(min)" :labelCol="labelCol" :wrapperCol="wrapperCol"
                               prop="standardProcessLong">
              <a-input-number :min="0" placeholder="请输入标准加工工时(min)" v-model="model.standardProcessLong"
                              @change="inputNumberChange"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="加工零件数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="processCount">
              <a-input-number :min="0" v-model="model.processCount" placeholder="请输入加工零件数量"
                              @change="inputNumberChange"></a-input-number>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="合格零件数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="passCount">
              <a-input-number :min="0" v-model="model.passCount" placeholder="请输入合格零件数量"></a-input-number>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="加工总时长" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input v-model="model.totalProcessLong" placeholder="加工零件数量 X æ ‡å‡†åŠ å·¥å·¥æ—¶" readOnly></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="theDate">
              <a-date-picker v-model="model.theDate" :disabled="disabled" format="YYYY-MM-DD"
                             value-format="YYYY-MM-DD" style="width: 100%"></a-date-picker>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </j-form-container>
    <select-device-drawer ref="selectDeviceDrawer" @selectFinished="selectOK" :title="'选择设备'"/>
  </a-spin>
</template>
<script>
  import { httpAction, getAction } from '@/api/manage'
  import SelectDeviceDrawer from '@/views/system/modules/SelectDeviceDrawer'
  export default {
    name: 'PartsMatchingForm',
    components: { SelectDeviceDrawer },
    props: {
      //表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      },
      disableSelectDevice: {
        type: Boolean,
        default: false
      }
    },
    data() {
      return {
        model: {
          passCount: 0
        },
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 }
        },
        confirmLoading: false,
        validatorRules: {
          equipmentIds: [
            { required: true, message: '请选择设备!' }
          ],
          partId: [
            { required: true, message: '请输入零件号!' }
          ],
          standardProcessLong: [
            { required: true, message: '请输入标准加工工时(min)!' }
          ],
          processCount: [
            { required: true, message: '请输入加工零件数量!' }
          ],
          passCount: [
            { required: true, message: '请输入合格零件数量!' }
          ],
          theDate: [
            { required: true, message: '请选择日期!' }
          ]
        },
        url: {
          add: '/mdc/mdcPartProcessInfo/add',
          edit: '/mdc/mdcPartProcessInfo/edit'
        }
      }
    },
    computed: {
      formDisabled() {
        return this.disabled
      }
    },
    created() {
      //备份model原始值
      this.modelDefault = JSON.parse(JSON.stringify(this.model))
    },
    methods: {
      add() {
        this.edit(this.modelDefault)
      },
      edit(record) {
        this.model = Object.assign({}, { equipmentIds: record.equipmentId }, record)
        console.log('model', this.model)
        this.visible = true
      },
      inputNumberChange() {
        if (this.model.standardProcessLong && this.model.processCount) {
          this.model.totalProcessLong = this.model.standardProcessLong * this.model.processCount
        }
      },
      submitForm() {
        const that = this
        // è§¦å‘表单验证
        this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true
            let httpUrl = ''
            let method = 'post'
            if (!this.model.id) {
              httpUrl += this.url.add
            } else {
              httpUrl += this.url.edit
            }
            httpAction(httpUrl, this.model, method).then((res) => {
              if (res.success) {
                that.$notification.success({
                  message: '消息',
                  description: res.message
                })
                that.$emit('ok')
              } else {
                that.$notification.warning({
                  message: '消息',
                  description: res.message
                })
              }
            }).finally(() => {
              that.confirmLoading = false
            })
          }
        })
      },
      deviceSearch() {
        this.$refs.selectDeviceDrawer.visible = true
        this.$refs.selectDeviceDrawer.selectedRowKeys = []
        this.$refs.selectDeviceDrawer.selectedRows = []
        this.$refs.selectDeviceDrawer.checkedKeys = this.model.equipmentIds ? this.model.equipmentIds.split(',') : []
      },
      /**
       * é€‰æ‹©å·²æœ‰è®¾å¤‡åŽç‚¹å‡»ç¡®å®šæ—¶è§¦å‘
       * @param data å·²é€‰æ‹©çš„设备
       */
      selectOK(data) {
        this.$set(this.model, 'equipmentIds', data.join(','))
        if (this.model.equipmentIds) this.$refs.form.clearValidate('equipmentIds')
      }
    }
  }
</script>
<style scoped lang="less">
  /deep/ .ant-input-number {
    width: 100% !important;
  }
</style>
src/views/mdc/base/modules/PartsMatchingManagement/PartsMatchingList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,321 @@
<template>
  <div class="device_list">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="设备编号">
              <a-input placeholder="请输入设备编号" v-model="queryParam.equipmentId"/>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="零件号">
              <a-input placeholder="请输入零件号" v-model="queryParam.partId" allowClear/>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="日期">
              <a-range-picker v-model="dates" style="width: 100%" @change="dateParamChange"></a-range-picker>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-space>
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload">重置</a-button>
            </a-space>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- æŸ¥è¯¢åŒºåŸŸ-END -->
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-button type="primary" icon="download" @click="importTemplate('零件加工管理')">导入模板</a-button>
      <a-button type="primary" icon="download" @click="handleExportXls('零件加工管理')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"
                @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel">
            <a-icon type="delete"/>
            åˆ é™¤
          </a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> æ‰¹é‡æ“ä½œ
          <a-icon type="down"/>
        </a-button>
      </a-dropdown>
    </div>
    <!-- table区域-begin -->
    <div id="DeviceList" style="flex: 1;overflow: hidden">
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:'max-content',y:scrollY}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange">
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical"/>
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
    <PartsMatchingModal ref="modalForm" @ok="modalFormOk"/>
  </div>
</template>
<script>
  import moment from 'moment'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import PartsMatchingModal from './PartsMatchingModal'
  export default {
    name: 'PartsMatchingList',
    mixins: [JeecgListMixin],
    components: {
      PartsMatchingModal
    },
    props: { nodeTree: '', Type: '', nodePeople: '' },
    data() {
      return {
        description: 'partsMatching管理页面',
        /* åˆ†é¡µå‚æ•° */
        ipagination: {
          current: 1,
          pageSize: 30,
          pageSizeOptions: ['30', '50', '100'],
          showTotal: (total, range) => {
            return range[0] + '-' + range[1] + ' å…±' + total + '条'
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        queryParam: {},
        disableMixinCreated: true,
        dates: [moment().subtract(1, 'day'), moment()],
        // è¡¨å¤´
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            title: '日期',
            align: 'center',
            dataIndex: 'theDate',
            width: 200
          },
          {
            title: '设备编号',
            align: 'center',
            dataIndex: 'equipmentId',
            width: 230
          },
          {
            title: '零件号',
            align: 'center',
            dataIndex: 'partId',
            width: 150
          },
          {
            title: '标准加工工时(min)',
            align: 'center',
            dataIndex: 'standardProcessLong',
            width: 150
          },
          {
            title: '加工零件数量',
            align: 'center',
            dataIndex: 'processCount',
            width: 150
          },
          {
            title: '合格零件数量',
            align: 'center',
            dataIndex: 'passCount',
            width: 150
          },
          {
            title: '加工总时长',
            align: 'center',
            dataIndex: 'totalProcessLong',
            width: 150
          },
          {
            title: '操作',
            dataIndex: 'action',
            align: 'center',
            fixed: 'right',
            width: 150,
            scopedSlots: { customRender: 'action' }
          }
        ],
        scrollY: 465,
        url: {
          list: '/mdc/mdcPartProcessInfo/list',
          delete: '/mdc/mdcPartProcessInfo/delete',
          deleteBatch: '/mdc/mdcPartProcessInfo/deleteBatch',
          exportXlsUrl: '/mdc/mdcPartProcessInfo/exportXls',
          importExcelUrl: '/mdc/mdcPartProcessInfo/importExcel'
        }
      }
    },
    watch: {
      Type(valmath) {
        this.dataList = []
        this.queryParam.typeTree = valmath
        // console.log(this.queryParam.typeTree)
      },
      nodeTree(val) { //监听currSelected å˜åŒ–,将变化后的数值传递给 getCurrSelected äº‹ä»¶
        if (JSON.stringify(val) != '{}') {
          if (val.equipmentId) {
            this.queryParam.parentId = ''
            this.queryParam.equipmentId = val.equipmentId
          } else {
            this.queryParam.parentId = val.key
            this.queryParam.equipmentId = ''
          }
          this.searchQuery()
        }
      },
      nodePeople(val) {
        if (JSON.stringify(val) != '{}') {
          if (val.equipmentId) {
            this.queryParam.parentId = ''
            this.queryParam.equipmentId = val.equipmentId
          } else {
            this.queryParam.parentId = val.key
            this.queryParam.equipmentId = ''
          }
          this.searchQuery()
        }
      }
    },
    computed: {
      importExcelUrl: function() {
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
      }
    },
    methods: {
      dateParamChange(v1, v2) {
        this.queryParam.startTime = v2[0]
        this.queryParam.endTime = v2[1]
        this.dates = [v1[0], v1[1]]
      },
      importTemplate(fileName) {
        var a = document.createElement('a')
        a.href = `/static/${fileName}.xls`
        a.download = `${fileName}.xls`
        a.style.display = 'none'
        document.body.appendChild(a)
        a.click()
        a.remove()
      },
      searchReset() {
        this.dates = [moment().subtract(1, 'day'), moment()]
        this.queryParam = {
          startTime: this.dates[0].format('YYYY-MM-DD'),
          endTime: this.dates[1].format('YYYY-MM-DD')
        }
        this.loadData(1)
      },
      /**
       * å½“浏览器可视窗口尺寸发生改变时触发
       */
      handleWindowResize() {
        const boxHeight = +window.getComputedStyle(document.getElementById('DeviceList')).height.slice(0, -2)
        const tableHeadHeight = +window.getComputedStyle(document.querySelector('.ant-table-thead th')).height.slice(0, -2)
        this.scrollY = boxHeight - tableHeadHeight - 50
      }
    },
    created() {
      this.queryParam.startTime = this.dates[0].format('YYYY-MM-DD')
      this.queryParam.endTime = this.dates[1].format('YYYY-MM-DD')
      this.loadData()
    },
    mounted() {
      window.addEventListener('resize', this.handleWindowResize)
      this.handleWindowResize()
    },
    beforeDestroy() {
      window.removeEventListener('resize', this.handleWindowResize)
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
  .device_list {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  @media screen and (min-width: 1920px) {
    .device_list {
      height: 811px !important;
    }
  }
  @media screen and (min-width: 1680px) and (max-width: 1920px) {
    .device_list {
      height: 811px !important;
    }
  }
  @media screen and (min-width: 1400px) and (max-width: 1680px) {
    .device_list {
      height: 663px !important;
    }
  }
  @media screen and (min-width: 1280px) and (max-width: 1400px) {
    .device_list {
      height: 564px !important;
    }
  }
  @media screen and (max-width: 1280px) {
    .device_list {
      height: 564px !important;
    }
  }
</style>
src/views/mdc/base/modules/PartsMatchingManagement/PartsMatchingModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,64 @@
<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    cancelText="关闭">
    <PartsMatchingForm ref="realForm" @ok="submitCallback" :disabled="disableSubmit"
                      :disableSelectDevice="disableSelectDevice"/>
  </j-modal>
</template>
<script>
  import PartsMatchingForm from './PartsMatchingForm'
  export default {
    name: 'PartsMatchingModal',
    components: {
      PartsMatchingForm
    },
    data() {
      return {
        title: '',
        width: 800,
        visible: false,
        disableSubmit: false,
        disableSelectDevice: false
      }
    },
    methods: {
      add() {
        this.visible = true
        this.disableSelectDevice = false
        this.$nextTick(() => {
          this.$refs.realForm.add()
        })
      },
      edit(record) {
        this.visible = true
        this.disableSelectDevice = true
        this.$nextTick(() => {
          this.$refs.realForm.edit(record)
        })
      },
      close() {
        this.$emit('close')
        this.visible = false
      },
      handleOk() {
        this.$refs.realForm.submitForm()
      },
      submitCallback() {
        this.$emit('ok')
        this.visible = false
      },
      handleCancel() {
        this.close()
      }
    }
  }
</script>