lyh
2025-05-09 79dda6eb5451d16a148bd5c51f61567e8847b136
产品结构树引用(借用)部件前端页面
修改原有删除文档接口
已添加1个文件
已修改7个文件
382 ■■■■■ 文件已修改
src/api/dnc.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/Component/ComponentInfo.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/Document/NcComponentBorrowModal.vue 324 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/Document/NcDocumentSearchModal.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/ProductStructureTreeContextMenu.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/common/DocumentBatchDeleteModal.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/dnc.js
@@ -30,7 +30,7 @@
  // ä¸‹è½½æ–‡æ¡£
  downloadDocumentApi: ({ docId, docName }) => requestGetDownLoad(`/nc/doc/download/${docId}`, docName),
  // åˆ é™¤æ–‡æ¡£
  deleteDocumentApi: docId => deleteAction(`/nc/doc/delete?id=${docId}`),
  deleteDocumentApi: ({ docId,attributionType, attributionId}) => deleteAction(`/nc/doc/delete/${docId}/${attributionType}/${attributionId}`),
  // æ–‡æ¡£å‡ºåº“
  documentOutboundApi: ({ docId, docName }) => requestGetDownLoad(`/nc/doc/pull/${docId}`, docName),
  // æ–‡æ¡£å–消出库
src/views/dnc/base/modules/ProductStructure/Component/ComponentInfo.vue
@@ -11,6 +11,7 @@
    <a-descriptions-item label="处理类型    ">{{currentLevelDetails.processType}}</a-descriptions-item>
    <a-descriptions-item label="材质">{{currentLevelDetails.structureType}}</a-descriptions-item>
    <a-descriptions-item label="重量" >{{currentLevelDetails.componentWeight}}</a-descriptions-item>
    <a-descriptions-item label="引用部件" >{{currentLevelDetails.borrowId>0?'是':'否'}}</a-descriptions-item>
    <a-descriptions-item label="创建人">{{currentLevelDetails.createBy_dictText}}</a-descriptions-item>
    <a-descriptions-item label="创建时间">{{currentLevelDetails.createTime}}</a-descriptions-item>
    <a-descriptions-item label="修改人">{{currentLevelDetails.updateBy_dictText}}</a-descriptions-item>
src/views/dnc/base/modules/ProductStructure/Document/NcComponentBorrowModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,324 @@
<!--
 Description: å¼•用部件List
 Author: ä½œè€… liuyh
 Date:   2025-02-27
-->
<template>
  <a-modal width="75%" :title="title" :visible="visible" @cancel="visible=false" :maskClosable="false" centered
           @ok="confirmBatchDeleteDocument">
      <div style="width: 100%">
        <a-tabs>
          <a-tab-pane tab="可引用部件列表">
            <div class="table-page-search-wrapper">
              <a-form layout="inline" @keyup.enter.native="searchQuery">
                <a-row :gutter="24">
                  <a-col :md="7" :sm="7">
                    <a-form-item label="部件名称">
                      <a-input placeholder="请输入部件名称" v-model="queryParam.componentName" allow-clear></a-input>
                    </a-form-item>
                  </a-col>
                  <a-col :md="7" :sm="7">
                    <a-form-item label="部件代号">
                      <a-input placeholder="请输入部件代号" v-model="queryParam.componentCode" allow-clear></a-input>
                    </a-form-item>
                  </a-col>
                  <a-col :md="7" :sm="7">
                    <a-form-item label="部件型号">
                      <a-input placeholder="请输入部件型号" v-model="queryParam.componentModel" allow-clear></a-input>
                    </a-form-item>
                  </a-col>
                  <a-col :md="7" :sm="7">
                    <a-form-item label="规格">
                      <a-input placeholder="请输入规格" v-model="queryParam.componentScale" allow-clear></a-input>
                    </a-form-item>
                  </a-col>
                  <a-col :md="7" :sm="7">
                    <a-form-item label="材质">
                      <a-input placeholder="请输入材质" v-model="queryParam.structureType" allow-clear></a-input>
                    </a-form-item>
                  </a-col>
                  <a-col :md="4" :sm="4">
                    <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>
            <a-table :columns="columns" :data-source="dataSource" bordered :pagination="ipagination" :loading="loading"
                     :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" @change="handleTableChange"
                     :scroll="{y:380}" :size="size" rowKey="componentId" style="min-height: 480px">
              <span slot="docName" slot-scope="text">{{ text }}</span>
            </a-table>
          </a-tab-pane>
        </a-tabs>
      </div>
  </a-modal>
</template>
<script>
import { deleteAction, getAction } from '@/api/manage'
import dncApi from '@/api/dnc'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
  name: 'NcComponentBorrowModal',
  components: {},
  mixins: [JeecgListMixin],
  props: {
    currentBorrowInfo: {
      type: Object
    },
    size: {
      type: String
    }
  },
  data() {
    return {
      disableMixinCreated: true,
      visible: false,
      title: '',
      columns: [
        {
          title: '序号',
          dataIndex: 'rowIndex',
          key: 'rowIndex',
          width: 50,
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '部件名称',
          dataIndex: 'componentName',
          align: 'center',
          width: 100,
        },
        {
          title: '部件代号',
          dataIndex: 'componentCode',
          align: 'center',
          width: 100,
        },
        {
          title: '部件型号',
          dataIndex: 'componentModel',
          align: 'center',
          width: 100,
        },
        {
          title: '物料编码',
          dataIndex: 'materielCode',
          align: 'center',
          width: 100,
        },
        {
          title: '规格',
          dataIndex: 'componentScale',
          align: 'center',
          width: 60,
        },
        {
          title: '材料',
          dataIndex: 'structureType',
          align: 'center',
          width: 60,
        },
        {
          title: '创建时间',
          dataIndex: 'createTime',
          align: 'center',
          width: 150,
        },
        {
          title: '创建人',
          dataIndex: 'createBy_dictText',
          align: 'center',
          width: 100,
        }
      ],
      searchValue: '',
      searchInput: '',
      spinning: false,
      allTreeKeys: [],
      checkedKeys: [],
      expandedKeys: [],
      autoExpandParent: true,
      isExpandAllTreeNode: true,
      date: [],
      url: {
        list: '/nc/component/getByComponentId',
        borrow: '/nc/component/borrow',
      }
    }
  },
  watch: {
    visible: {
      handler(value) {
        if (value) {
          this.resetData()
          this.loadData()
        }
      }
    },
    isExpandAllTreeNode: {
      handler(value) {
        if (value) this.expandedKeys = this.allTreeKeys
        else this.expandedKeys = []
      }
    }
  },
  created() {
    this.$bus.$on('treeMenuItemMethodTrigger', this.triggerCorrespondingMethod)
  },
  methods: {
    handleComponentBorrow() {
      if (this.currentBorrowInfo.entity.borrowId){
        this.$message.warning('该部件为引用部件,无法引用')
        this.visible=false
      }else {
        this.visible = true
      }
    },
    // èŽ·å–å½“å‰å¯å¼•ç”¨éƒ¨ä»¶
    loadData() {
      this.dataSource = []
      if (!this.url.list) {
        this.$message.error('请设置url.list属性!')
        return
      }
      var params = this.getQueryParams()//查询条件
      if (!params) return false
      params.componentId = this.currentBorrowInfo.key
      this.loading = true
      getAction(this.url.list, params).then((res) => {
        if (res.success) {
          this.dataSource = res.result.records
          if (res.result.total) {
            this.ipagination.total = res.result.total
          } else {
            this.ipagination.total = 0
          }
        } else this.$message.warning(res.message)
      }).finally(() => {
        this.loading = false
      })
    },
    /**
     * è¡¨æ ¼åˆ†é¡µã€æŽ’序改变、筛选时触发
     * @param pagination åˆ†é¡µå™¨é€‰é¡¹
     * @param filters ç­›é€‰é€‰é¡¹
     * @param sorter æŽ’序选项
     */
    handleTableChange(pagination, filters, sorter) {
      if (sorter.order) {
        this.isorter.column = sorter.field
        this.isorter.order = sorter.order === 'ascend' ? 'asc' : 'desc'
      } else {
        this.isorter.column = 'createTime'
        this.isorter.order = 'desc'
      }
      for (let key in filters) {
        this.filters[key] = filters[key].join(',')
      }
      this.loadData()
    },
    resetData() {
      this.searchInput = ''
      this.expandedKeys = []
      this.selectedRowKeys = []
      this.selectionRows = {}
      this.checkedKeys = []
      this.filters = {}
      this.isorter = Object.assign({}, this.defaultSorter)
    },
    triggerCorrespondingMethod({ methodName, modalTitle }) {
      if (this[methodName]) {
        this[methodName]()
        this.title = modalTitle
      }
    },
    // ç¡®è®¤æ‰¹é‡åˆ é™¤æ–‡æ¡£
    confirmBatchDeleteDocument() {
      if (this.selectedRowKeys.length <= 0) {
        // this.$message.warning('请选择一条记录!');
        this.$notification.warning({
          message:'消息',
          description:"请选择一个部件"
        });
        return;
      } else {
        var ids = "";
        for (var a = 0; a < this.selectedRowKeys.length; a++) {
          ids += this.selectedRowKeys[a] + ",";
        }
        var that = this;
        this.$confirm({
          title: "确认引用",
          content: "是否引用选中数据?",
          onOk: function () {
            that.loading = true;
            var queryParam = {
              newIds: ids,
              oldId: that.currentBorrowInfo.key
            }
            getAction(that.url.borrow,queryParam).then((res) => {
              if (res.success) {
                //重新计算分页问题
                that.reCalculatePage(that.selectedRowKeys.length)
                // that.$message.success(res.message);
                that.$notification.success({
                  message:'消息',
                  description:res.message
                });
                that.loadData();
                that.onClearSelected();
                that.$emit('submitSuccess')
              } else {
                // that.$message.warning(res.message);
                that.$notification.warning({
                  message:'消息',
                  description:res.message
                });
              }
            }).finally(() => {
              that.loading = false;
            });
          }
        });
      }
    },
  }
}
</script>
<style scoped lang="less">
/deep/ .ant-modal {
  .tabs-container {
    display: flex;
    justify-content: space-between;
    .replaceSearch {
      color: #40a9ff;
      font-weight: bold;
      background-color: rgb(204, 204, 204);
    }
  }
}
::-webkit-scrollbar {
  width: 8px;
}
</style>
src/views/dnc/base/modules/ProductStructure/Document/NcDocumentSearchModal.vue
@@ -1,3 +1,8 @@
<!--
 Description: æ£€ç´¢ç”µå­æ ·æ¿List
 Author: ä½œè€… liuyh
 Date:   2025-02-27
-->
<template>
  <a-modal width="75%" :title="title" :visible="visible" @cancel="visible=false" :maskClosable="false" centered
           @ok="handleAssignDocumentToDevice">
src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue
@@ -231,7 +231,7 @@
        okText: '确认',
        cancelText: '取消',
        onOk: () => {
          dncApi.deleteDocumentApi(docId)
          dncApi.deleteDocumentApi({docId,attributionType,attributionId})
            .then((res) => {
              if (res.success) {
                that.$notification.success({
src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue
@@ -4,7 +4,7 @@
      <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"/>
                   @change="handleSearchInputChange" />
          <!--          <a-tooltip title="刷新">-->
          <!--            <a-button icon="reload" @click="handleTreeReload" style="width: 18%;margin-left: 8px"></a-button>-->
          <!--          </a-tooltip>-->
@@ -31,16 +31,16 @@
                  @select="handleTreeSelect" @expand="handleTreeExpand" @rightClick="handleTreeRightClick">
            <template slot="title" slot-scope="{ label, parentId, key:treeKey,type}">
              <ProductStructureTreeContextMenu ref="contextMenuRef"
                                               :treeParams="{label,treeKey,searchValue,type}"/>
                                               :treeParams="{label,treeKey,searchValue,type}" />
            </template>
            <a-icon slot="switcherIcon" type="down"/>
            <a-icon slot="product" type="shopping"/>
            <a-icon slot="component" type="camera"/>
            <a-icon slot="part" type="hdd"/>
            <a-icon slot="processSpecVersion" type="tag"/>
            <a-icon slot="process" type="apartment"/>
            <a-icon slot="processStep" type="tool"/>
            <a-icon slot="switcherIcon" type="down" />
            <a-icon slot="product" type="shopping" />
            <a-icon slot="component" type="camera" />
            <a-icon slot="part" type="hdd" />
            <a-icon slot="processSpecVersion" type="tag" />
            <a-icon slot="process" type="apartment" />
            <a-icon slot="processStep" type="tool" />
          </a-tree>
        </div>
      </div>
@@ -48,23 +48,25 @@
    <!--产品弹窗-->
    <ProductModal ref="productModalFormRef" :currentTreeNodeInfo="rightClickSelected"
                  @submitSuccess="getTreeDataByApi"/>
                  @submitSuccess="getTreeDataByApi" />
    <!--部件弹窗-->
    <ComponentModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
    <ComponentModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess" />
    <!--零件弹窗-->
    <PartModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
    <PartModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess" />
    <!--工艺规程版本弹窗-->
    <ProcessSpecVersionModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
    <ProcessSpecVersionModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess" />
    <!--工序弹窗-->
    <ProcessModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
    <ProcessModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess" />
    <!--工步弹窗-->
    <ProcessStepModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
    <ProcessStepModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess" />
    <!--权限配置弹窗-->
    <AssignPermissionModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
    <AssignPermissionModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess" />
    <!--检索电子模板弹窗-->
    <NcDocumentSearchModal :currentDocumentInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
    <NcDocumentSearchModal :currentDocumentInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess" />
    <!--引用部件-->
    <NcComponentBorrowModal :currentBorrowInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess" />
    <!--产品结构树基本右键菜单(空白处触发)-->
    <ProductStructureBaseContextMenu ref="baseContextmenuRef"/>
    <ProductStructureBaseContextMenu ref="baseContextmenuRef" />
  </a-card>
</template>
@@ -80,8 +82,10 @@
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'
import ProductStructureBaseContextMenu
  from '@views/dnc/base/modules/ProductStructure/ProductStructureBaseContextMenu.vue'
import NcDocumentSearchModal from '@views/dnc/base/modules/ProductStructure/Document/NcDocumentSearchModal.vue'
import NcComponentBorrowModal from '@views/dnc/base/modules/ProductStructure/Document/NcComponentBorrowModal.vue'
export default {
  name: 'ProductStructureTree',
@@ -96,7 +100,8 @@
    ComponentModal,
    ProductModal,
    ProductStructureTreeContextMenu,
    NcDocumentSearchModal
    NcDocumentSearchModal,
    NcComponentBorrowModal
  },
  data() {
    return {
src/views/dnc/base/modules/ProductStructure/ProductStructureTreeContextMenu.vue
@@ -53,6 +53,7 @@
          // {  label: '导出文档', code: 'component_export', icon: 'export', isCommonMethod: true },
          { label: '导入其他文档', code: 'component_import', icon: 'import', isCommonMethod: true },
          { label: '检索电子样板', code: 'component_search', icon: 'search', isCommonMethod: true },
          { label: '引用部件',code: 'component_borrow',icon: 'plus',isCommonMethod: false},
          { label: '删除', code: 'component_delete', icon: 'delete', isCommonMethod: true },
          { label: '权限配置', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true }
        ],
src/views/dnc/common/DocumentBatchDeleteModal.vue
@@ -212,7 +212,7 @@
          selectedRowKeys.forEach(key => {
            if (attributionType !== 4) {
              method = dncApi.deleteDocumentApi
              queryParam = key
              queryParam = { docId: key,attrType:attributionType,attrId:attributionId }
            } else {
              method = dncApi.deleteDeviceRelativeDocumentApi
              queryParam = { docId: key, attributionId }