1
李喆(开发组)
2025-07-10 e4ab26e8c9ba4a9a618731152c5eb4a864c09454
src/views/wel/index.vue
@@ -24,7 +24,8 @@
        <el-button :size="size" text icon="el-icon-delete" type="primary" @click="showDel(row)" placeholder="删除" title="删除"></el-button>
        <el-button :size="size" text v-if="row.nodeType < 60" icon="el-icon-document-add" type="primary" @click="showAdd(row)" placeholder="新增子级" title="新增子级"></el-button>
        <el-button :size="size" text v-if="row.nodeType == 60" icon="el-icon-upload" type="primary" @click="showUpload(row)" placeholder="文件上传" title="文件上传"></el-button>
        <el-button :size="size" text v-if="row.nodeType == 60" icon="el-icon-pie-chart" type="primary" @click="upgrade(row)" placeholder="升级" title="升级"></el-button>
        <el-button :size="size" text v-if="row.nodeType == 70" icon="el-icon-pie-chart" type="primary" @click="upgrade(row)" placeholder="升版" title="升版"></el-button>
        <!-- 工控网才有 -->
        <el-button :size="size" text v-if="row.nodeType == 70 && !isSM" icon="el-icon-position" type="primary" @click="downsend(row)" placeholder="下发" title="下发"></el-button>
      </template>
    </avue-crud>
@@ -33,18 +34,24 @@
      <avue-form :option="modalOption" v-model="modalForm" @submit="modalSubmit" @reset-change="modalCancel"/>
    </el-dialog>
    <el-dialog title="上传文件" append-to-body v-model="uploadmodalBox">
      <avue-form :option="uploadmodalOption" v-model="uploadmodalForm" @submit="uploadmodalSubmit" @reset-change="uploadmodalCancel" :upload-before="uploadBefore" :upload-after="uploadAfter" ref="uploadRef"></avue-form>
      <avue-form :option="uploadmodalOption" v-model="uploadmodalForm" @submit="uploadmodalSubmit" @reset-change="uploadmodalCancel" :upload-before="uploadBefore" :upload-after="uploadAfter">
        <template #fileList="{}" slot-scope="{ value }">
          <div v-for="(file, index) in fileList" :key="index" v-if="fileList.length != 0">
            {{ file.name }}
          </div>
          <div v-else>没有上传文件</div>
        </template>
      </avue-form>
    </el-dialog>
    <avue-tabs :option="tabsOption" @change="tabsHandleChange" style="margin-top: 30px;" v-if="isShowTabs"></avue-tabs>
      <avue-form v-if="tabsType == 'tab1'" :option="tabsFormOption" v-model="tabsForm"></avue-form>
      <span v-else-if="tabsType == 'tab2'">版本信息</span>
      <template v-else-if="tabsType == 'tab3'">
          {{fileContent}}
          <!-- <div v-for="item in fileList" v-if="fileList.length > 0" class="fileListStyle">
            <span>{{item.name}}</span>
            <span class="delFile" @click="delFile(item)">X</span>
          </div> -->
      </template>
    <avue-form v-if="tabsType == 'tab1'" :option="tabsFormOption" v-model="tabsForm"></avue-form>
    <span v-else-if="tabsType == 'tab2'">版本信息</span>
    <template v-else-if="tabsType == 'tab3'">
        {{fileContent}}
    </template>
    <el-dialog title="升版" append-to-body v-model="upgradeModal" width="500">
      <avue-form :option="upgradeModalOption" v-model="upgradeModalForm" @submit="upgradeSubmit" @reset-change="upgradeCancel"></avue-form>
    </el-dialog>
  </basic-container>
</template>
@@ -53,6 +60,7 @@
export default {
  data() {
    return {
      upgradeModal: false,
      file: null,
      fileContent: "",
      isSM: false,  //是否是涉密网 ,工控网5个,涉密网4个
@@ -60,6 +68,17 @@
      nodeTypeList: [],
      fileList: [],
      tabsType: "tab1",
      upgradeModalForm: {},
      upgradeModalOption: {
        emptyText: "取消",
        menuPosition: "right",
        column: [{
          label: '升版',
          prop: 'processEdition',
          labelWidth: "80",
          span: 22
        }]
      },
      tabsOption: {},
      tabsOption1: {
        column: [{
@@ -142,6 +161,7 @@
          {
            label: '节点类型',
            prop: 'nodeType',
            labelWidth: "120",
            type: 'select',
            dicUrl: '/blade-system/dict-biz/dictionary?code=nc_node_type',
            props: {
@@ -153,6 +173,7 @@
          {
            label: '设备(机床)',
            prop: 'machineCode',
            labelWidth: "120",
            type: 'select',
            dicUrl: '/blade-mdm/machine/page',
            props: {
@@ -165,17 +186,20 @@
          },
          {
            label: '节点名称',
            prop: 'name'
            prop: 'name',
            labelWidth: "120",
          },
          {
            label: '节点描述',
            prop: 'description',
            labelWidth: "120",
            hide: true
          },
          {
            label: '备注',
            prop: 'remark',
            type: "textarea",
            labelWidth: "120",
            span: 24
          }
        ]
@@ -270,6 +294,7 @@
          {
            label: '节点类型',
            prop: 'nodeType',
            labelWidth: "120",
            type: 'select',
            dicUrl: '/blade-system/dict-biz/dictionary?code=nc_node_type',
            props: {
@@ -281,6 +306,7 @@
          {
            label: '设备编号',
            prop: 'machineCode',
            labelWidth: "120",
            type: 'select',
            dicUrl: '/blade-mdm/machine/page',
            props: {
@@ -293,19 +319,23 @@
          },
          {
            label: '零组件号/图号',
            prop: 'drawingNo'
            prop: 'drawingNo',
            labelWidth: "120"
          },
          {
            label: '工序',
            prop: 'processName'
            prop: 'processName',
            labelWidth: "120"
          },
          {
            label: '工序版本',
            prop: 'processEdition'
            prop: 'processEdition',
            labelWidth: "120"
          },
          {
            label: '节点分类',
            prop: 'category',
            labelWidth: "120",
            type: 'select',
            dicUrl: '/blade-system/dict-biz/dictionary?code=node_file_type',
            props: {
@@ -316,6 +346,7 @@
          {
            label: '选择文件',
            prop: 'uploadFile',
            labelWidth: "120",
            type: 'upload',
            data: {nodeId: this.id}, 
            action: "",
@@ -325,9 +356,15 @@
            action: "/blade-mdm/program/ncfile/upload"
          },
          {
            label: '文件列表',
            prop: 'fileList',
            labelWidth: "120"
          },
          {
            label: '备注',
            prop: 'remark',
            type: "textarea",
            labelWidth: "120",
            span: 24
          }
        ]
@@ -340,6 +377,22 @@
    }
  },
  methods: {
    upgradeSubmit(row,done) {  //升版
      axios({
        url: '/blade-mdm/program/ncfile/upgrade-process-edition',
        method: 'post',
        data: {id:row.id,newProcessEdition: row.processEdition},
      }).then(
        res => {
            done();
            this.upgradeModal = false;
            //this.$message.success('操作成功');
        }
      );
    },
    upgradeCancel() {
      this.upgradeModal = false;
    },
    downsend(row) {  //下发
      // this.loading = true;
      // axios({
@@ -348,22 +401,13 @@
      //   params: {nodeId:id},
      // }).then(
      //   res => {
            //this.loading = false;
      //   }
      // );
    },
    upgrade(row) {  //升级
      this.loading = true;
      var obj = {id: row.id}
      axios({
        url: '/blade-mdm/program/ncfile/upgrade-process-edition',
        method: 'post',
        data: obj,
      }).then(
        resp => {
          this.$message.success('升级成功');
        }
      );
    upgrade(row) {  //升版
      this.upgradeModalForm = row;
      this.upgradeModal = true;
    },
    delFile(item) {
      this.loading = true;
@@ -380,13 +424,14 @@
      );
    },
    uploadBefore(file,done,loading,column) {
      //done();
      this.file = file;
      this.fileList.push(file);
      //done();  放开就上传了
      return false;
    },
    uploadAfter() {
    },
    uploadmodalSubmit(row,done) {
    uploadmodalSubmit(row,done) {  //上传提交接口
      if(this.file == null) {
        this.$message.error('请上传文件');
        return;
@@ -406,7 +451,7 @@
        res => {
          this.loading = false;
          this.uploadmodalBox = false;
          this.addLocalTreeNode(row.parentId);  //重新加载下一级
          this.addLocalTreeNode(row.id);  //重新加载下一级
          done();
        }
      );
@@ -436,8 +481,21 @@
      this.tabsType = tabs.prop;
    },
    showUpload(row) {
      this.fileList = [];
      this.uploadmodalForm = row;
      this.uploadmodalBox = true;
      //获取文件内容
      this.loading = true;
      axios({
        url: '/blade-mdm/program/ncfile/list-by-node',
        method: 'get',
        params: {nodeId: row.id},
      }).then(
        res => {
          this.loading = false;
          this.fileList = res.data.data;
          this.uploadmodalBox = true;
        }
      );
    },
    getFile(id) { //查看文件内容
      this.loading = true;
@@ -637,9 +695,6 @@
</script>
<style lang="scss">
.el-form-item__label {
  width: 120px!important;
}
.delFile {
  color: red;
  margin-left: 12px;