yangys
2025-09-09 729b698b17d7468acbc6c495746a72c9150fdaeb
src/views/basesetting/machine.vue
@@ -27,22 +27,22 @@
          @on-load="onLoad"
        >
          <template #menu-left>
            <el-button type="primary" size="default" icon="el-icon-circle-plus" plain @click="handleExport">导出</el-button>
            <el-upload :show-file-list="false" class="upload-demo"
                action="/api/blade-mdm/machine/import"
                       :on-change="handleChange">
              <el-button type="primary" plain size="default">导入</el-button>
            </el-upload>
            <el-button type="primary" size="default" icon="el-icon-circle-plus" plain @click="handleAdd">新增</el-button>
            <div class="menuLeft">
              <el-button type="primary" size="default" icon="el-icon-circle-plus" plain @click="handleExport">导出</el-button>
              <!-- <el-upload :show-file-list="false" class="upload-demo"
                  action="/api/blade-mdm/machine/import"
                        :on-change="handleChange">
                <el-button type="primary" plain size="default">导入</el-button>
              </el-upload> -->
              <el-button type="primary" plain @click="importAction">导入</el-button>
               <el-button type="primary" plain @click="downloadTemplate">下载模板
                        </el-button>
              <el-button type="primary" size="default" icon="el-icon-circle-plus" plain @click="handleAdd">新增</el-button>
            </div>
          </template>
          <template #menu="scope">
            <el-button type="primary" text size="default" icon="el-icon-upload" @click.stop="handleEdit(scope.row, scope.index)">编辑</el-button>
            <el-button type="primary" text size="default" icon="el-icon-upload" @click.stop="handleDel(scope.row, scope.index)">删除</el-button>
            <el-button type="primary" text size="default" icon="el-icon-edit" @click.stop="handleEdit(scope.row, scope.index)">编辑</el-button>
            <el-button type="primary" text size="default" icon="el-icon-delete" @click.stop="handleDel(scope.row, scope.index)">删除</el-button>
            <!--
            <el-button type="primary" text size="default" icon="el-icon-upload" @click.stop="handleUp(scope.row, scope.index)">产生机床回传机构树</el-button>
            -->
@@ -60,6 +60,11 @@
            </template>
          </avue-form>
        </el-dialog>
        <el-dialog title="" append-to-body v-model="excelBox" width="555px">
            <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
            </avue-form>
        </el-dialog>
      </basic-container>
    </el-col>
  </el-row>
@@ -76,6 +81,29 @@
  data() {
    var that = this;
    return {
      excelBox: false,
      excelOption: {
          submitBtn: false,
          emptyBtn: false,
          column: [
              {
                  label: '文件导入',
                  prop: 'file',
                  type: 'upload',
                  drag: true,
                  loadText: '导入中,请稍后',
                  span: 24,
                  propsHttp: {
                      res: 'data',
                  },
                  data: {
                  },
                  tip: '',
                  action: '/blade-mdm/machine/import',
              },
          ],
      },
      excelForm: {},
      treeOption: {
        nodeKey: 'id',
        lazy: true,
@@ -131,6 +159,7 @@
        labelWidth: 120,
        emptyBtn: false,
        searchSpan: 8,
        searchEnter:true,
        column: [
          {
            label: '编号/名称',
@@ -279,7 +308,7 @@
            dataType: 'string',
          },
          {
            label: '系统控制',
            label: '控制系统',
            prop: 'controlSystem',
            type: 'select',
            span: 12,
@@ -300,11 +329,27 @@
            }]
          },
          {
            label: '程序临时目录',
            prop: 'progTempDir',
            type: 'input',
            span: 12,
            dataType: 'string',
          },
          {
            label: '程序下发目录',
            prop: 'progSendDir',
            type: 'input',
            span: 12,
            dataType: 'string',
          },
          {
            label: '下发目录保存时间',
            prop: 'sendDirExpiryHours',
            placeholder:"(小时)",
            max:24,
            min:0,
            type: 'number',
            span: 12,
          },
          {
            label: '程序回传目录',
@@ -313,13 +358,16 @@
            span: 12,
            dataType: 'string',
          },
        {
            label: '程序临时目录',
            prop: 'progTempDir',
            type: 'input',
          {
            label: '回传目录保存时间',
            prop: 'receiveDirExpiryHours',
            max:24,
            min:0,
            placeholder:"(小时)",
            type: 'number',
            span: 12,
            dataType: 'string',
          },
          {
            label: '备注',
            prop: 'remark',
@@ -333,6 +381,25 @@
    };
  },
  methods: {
    importAction() {
      this.excelBox = true;
    },
    uploadAfter(res, done, loading, column) {
        window.console.log('res',res);
        //console.log('res',res)
        if(res.failure==0 && res.success>0){
            //有成功的,关闭对话框
            this.excelBox = false;
            this.$message.success(res.message);
            this.onLoad(this.page);
            //done();
        }else{
            //0成功的,仅提示
            this.$message.info("成功"+res.success+",失败"+res.failure+":"+res.message);
            done();
        }
    },
    handleChange(a,b,c) {
      console.log(a,b,c);
    },
@@ -422,6 +489,15 @@
        });
      });
    },
    downloadTemplate() {
      NProgress.start();
      exportBlob(
          `/blade-mdm/machine/download-template`
      ).then(res => {
          downloadXls(res.data, `机床导入模版.xlsx`);
          NProgress.done();
      });
    },
    formSubmit(params, done) {
      var obj = {...params};
      if(params.status.length == 0) {
@@ -444,6 +520,8 @@
        }else {
          this.$message({type: 'error',message: res.data.msg});
        }
        done();
      }).catch(e=>{
        done();
      });
    },
@@ -525,4 +603,8 @@
  margin-left: 6px;
  margin-right: 6px;
}
.menuLeft {
  display: flex;
  align-items: center;
}
</style>