研发图纸文件管理系统-前端项目
he wei
2023-02-08 36cba2723570b4df7ef54970f43b443c80eedab5
U 物料上传dwg 或 图片 物料上传不走审批
3个文件已修改
85 ■■■■■ 已修改文件
src/pages/components/PartsUpload.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/resourceManage/materialsCenter/apis.js 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/resourceManage/materialsCenter/list.vue 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/components/PartsUpload.vue
@@ -38,7 +38,7 @@
    },
    text: {
      type: String,
      default: "提交审核",
      default: "上传",
    },
    noFooter: {
      type: Boolean,
src/pages/resourceManage/materialsCenter/apis.js
@@ -125,6 +125,24 @@
  })
}
/**
 * 更新图片或者图纸
 * {
 * file,
 * materialStr: {id,subCode,subModel}
 * }
 * @returns
 */
export const picOrDwg = (data) => {
  return axios({
    method: "PUT",
    url: "material/picOrDwg",
    headers: {
      "Content-Type": "multipart/form-data"
    },
    data
  })
}
/**
 * 修改附件锁定状态
 * @returns
 */
@@ -146,3 +164,15 @@
    params: { materialId, materialId2 }
  })
}
/**
 * 新增物料
 * @returns
 */
export const addMaterial = (data) => {
  return axios({
    method: "POST",
    url: "material",
    data
  })
}
src/pages/resourceManage/materialsCenter/list.vue
@@ -140,7 +140,9 @@
      <div class="footer">
        <a-space>
          <a-button @click="fileListCancel">关闭</a-button>
          <a-button type="primary" v-if="canUpload" @click="fileUploadShow">上传附件</a-button>
          <a-button type="primary" v-if="canUpload" @click="fileUploadShow"
            >上传附件</a-button
          >
        </a-space>
      </div>
    </a-modal>
@@ -154,7 +156,18 @@
      @cancel="fileUploadCancel"
      @ok="fileUploadChange"
    >
      <a-upload :before-upload="beforeUpload" @change="uploadListChange" multiple>
      <div class="type-grp">
        <a-radio-group v-model="uploadType" button-style="solid">
          <a-radio-button value="normal"> 普通附件 </a-radio-button>
          <a-radio-button value="pic"> 图片 </a-radio-button>
          <a-radio-button value="dwg"> 图纸 </a-radio-button>
        </a-radio-group>
      </div>
      <a-upload
        :before-upload="beforeUpload"
        @change="uploadListChange"
        multiple
      >
        <!-- :showUploadList="false" -->
        <a-button type="primary">选择附件</a-button>
      </a-upload>
@@ -171,7 +184,13 @@
import FilesTable from "@/pages/components/filesTable";
import getWebUrl from "@/assets/js/tools/getWebUrl";
import { uploadOthers, zipParse, getFileList } from "./apis";
import {
  uploadOthers,
  picOrDwg,
  zipParse,
  getFileList,
  addMaterial,
} from "./apis";
import { dwgReview } from "@/pages/workplace/apis";
import { downloadLog } from "@/pages/system/logs/apis";
import { mapGetters } from "vuex";
@@ -185,6 +204,7 @@
  mixins: [WSMixin],
  data() {
    return {
      uploadType: "normal",
      fileUploadVisible: false,
      uploadFileList: [],
      info: {},
@@ -496,8 +516,9 @@
          if (rs.code == 1 && rs.data) {
            this.resList = rs.data2;
            this.title = rs.data3;
            rs.data2[0].fileUrl = rs.msg
            this.resShow = true;
            this.$message.success(rs.msg);
            this.$message.success('解析成功');
          } else {
            this.$message.error(rs.msg);
          }
@@ -518,6 +539,10 @@
      this.uploadFileList = data.fileList;
    },
    fileUploadChange(data) {
      if (!this.uploadFileList.length) {
        this.$message.error("请选择要上传的附件");
        return false;
      }
      let loading = this.$layer.loading();
      const formData = new FormData();
      const { id, subModel, subCode } = this.currentObj;
@@ -531,7 +556,8 @@
      this.uploadFileList.forEach((v, i) => {
        formData.append("file", v.originFileObj);
      });
      uploadOthers(formData)
      let upload = this.uploadType != "normal" ? picOrDwg : uploadOthers;
      upload(formData)
        .then((res) => {
          this.$layer.close(loading);
          const { code, data, msg } = res.data;
@@ -551,8 +577,18 @@
    resCancel() {
      this.resShow = false;
    },
    resOk() {
      this.submitShow = true;
    resOk(data) {
      // 不走审批
      // this.submitShow = true;
      addMaterial(data).then((res) => {
        let { code, data, msg } = res.data;
        if (code && data) {
          this.$message.success('上传成功');
          this.resShow = false;
        } else {
          this.$message.error(msg);
        }
      });
    },
    successSubmit() {
      this.submitShow = false;
@@ -701,4 +737,7 @@
  display: flex;
  justify-content: flex-end;
}
.type-grp {
  margin-bottom: 20px;
}
</style>