研发图纸文件管理系统-前端项目
he wei
2022-09-07 9fd2ecdda341457033f68d08967f2d546908c8f4
U 软件下载 等修改
6个文件已修改
1个文件已添加
493 ■■■■ 已修改文件
src/assets/js/const/const_permits.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/resourceManage/product/details/details.vue 49 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/resourceManage/product/list.vue 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/resourceManage/product/prodUpload.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/resourceManage/software/apis.js 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/resourceManage/software/descRes.vue 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/resourceManage/software/list.vue 252 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/const/const_permits.js
@@ -5,5 +5,6 @@
  downloadOther: 10004,
  
  uploadBom: 10009,
  uploadSoftware: 10008
  uploadSoftware: 10008,
  lockBom: 10010
}
src/pages/resourceManage/product/details/details.vue
@@ -59,6 +59,30 @@
                      <a @click="dwgReview(record.dwgUrl)">预览</a>
                      <a-divider type="vertical"></a-divider>
                      <a @click="downloadLog(record)">下载</a>
                      <template
                        v-if="record.softwares.length && canUploadSoftware"
                      >
                        <a-divider type="vertical"></a-divider>
                        <a-popover title="" trigger="hover">
                          <div class="" slot="content" style="width: 450px">
                            <a-table
                              size="small"
                              :scroll="{ y: 300 }"
                              bordered
                              :columns="softwareColumns"
                              :data-source="record.softwares"
                              :pagination="false"
                              :expandRowByClick="true"
                              :row-key="(record1, index) => index"
                            >
                              <template slot="action" slot-scope="text, record1">
                                <a @click="downloadLog(record1)">下载</a>
                              </template>
                            </a-table>
                          </div>
                          <a>软件列表</a>
                        </a-popover>
                      </template>
                    </div>
                  </template>
                </a-table>
@@ -73,26 +97,28 @@
      <a-layout-footer>
        <a-card>
          <template v-if="dataSource.length">
            <a-popover title="" v-if="otherDoc.length">
            <a-popover title="" v-if="otherDoc.length && currentVersion.enabled">
              <files-table slot="content" :list="otherDoc"></files-table>
              <a-button type="primary">其他附件</a-button>
            </a-popover>
            <a-button v-if="canUploadBom" type="primary" @click="zipDownload">bom下载</a-button>
            <a-button v-if="canDownloadBom && currentVersion.enabled" type="primary" @click="zipDownload"
              >bom下载</a-button
            >
            <a-button
              type="primary"
              v-if="softwareList.length && canUploadSoftware"
              v-if="softwareList.length && canUploadSoftware && currentVersion.enabled"
              @click="showSoftwareDownload"
              >软件下载</a-button
            >
            <a-button
              type="primary"
              v-if="!currentVersion.enabled"
              v-if="!currentVersion.enabled && canLockBom"
              @click="changeStatus"
              >激活版本</a-button
            >
            <a-button
              type="primary"
              v-if="currentVersion.enabled"
              v-if="currentVersion.enabled && canLockBom"
              @click="changeStatus"
              >锁定版本</a-button
            >
@@ -111,7 +137,6 @@
      @cancel="softwareDownloadCancel"
    >
      <a-table
        ref="aTable"
        size="small"
        :scroll="{ y: 300 }"
        bordered
@@ -297,7 +322,7 @@
          key: "operation",
          align: "center",
          fixed: "right",
          width: 100,
          width: 180,
          scopedSlots: { customRender: "action" },
        },
      ],
@@ -307,13 +332,13 @@
      softwareColumns: [
        {
          title: "软件名称",
          dataIndex: "softwareName",
          dataIndex: "fileName",
          align: "center",
          // width: 180,
        },
        {
          title: "上传时间",
          dataIndex: "submitTime",
          title: "版本",
          dataIndex: "version",
          align: "center",
          width: 180,
        },
@@ -342,6 +367,9 @@
    canDownloadBom() {
      return checkPermit(PERMITS.downloadBom, this.permits);
    },
    canLockBom() {
      return checkPermit(PERMITS.lockBom, this.permits);
    }
  },
  watch: {
    update(n) {
@@ -541,6 +569,7 @@
          let { code, data } = res.data;
          if (code && data) {
            this.$message.success("操作成功");
            this.currentVersion.enabled = enabled;
          } else {
            this.$message.error("操作失败");
          }
src/pages/resourceManage/product/list.vue
@@ -33,26 +33,34 @@
            <template slot="title">
              <a-space class="operator">
                <span class="title">产品中心</span>
                <a-button v-if="canUploadBom" type="primary" @click="uploadBom">新增</a-button>
                <a-button v-if="canUploadBom" type="primary" @click="uploadBom"
                  >新增</a-button
                >
              </a-space>
            </template>
            <template slot="isNormal" slot-scope="{ record }">
              {{ record.customCode == "" ? "是" : "否" }}
            </template>
            <template slot="action" slot-scope="{ record }">
              <template v-if="canUploadSoftware">
              <!-- <template v-if="canUploadSoftware">
                <a @click="upload(record)">上传软件</a>
                <a-divider type="vertical"></a-divider>
              </template>
              </template> -->
              <a @click="goDetails(record)">详情</a>
              <a-divider type="vertical"></a-divider>
              <a-popover title="" trigger="hover">
                <a-space direction="vertical" slot="content">
                  <a-button type="primary" @click="edit(record)">编辑</a-button>
                  <a-button v-if="canDownloadBom" type="primary" @click="download(record)"
                  <a-button
                    v-if="canDownloadBom"
                    type="primary"
                    @click="download(record)"
                    >下载</a-button
                  >
                  <a-button type="primary" v-if="canUploadBom" @click="showCustom(record)"
                  <a-button
                    type="primary"
                    v-if="canUploadBom"
                    @click="showCustom(record)"
                    >定制</a-button
                  >
                </a-space>
@@ -634,25 +642,18 @@
      this.customShow = true;
    },
    custom(data) {
      console.log(11);
      const { id, parentCode, parentModel, parentName } = this.customProd;
      const param = {
        versionTime: data.versionTime,
        productApproving: {
          bomApprovingList: [
            {
              id,
            },
          ],
          customCode: data.customCode,
          parentCode,
          parentModel,
          parentName,
        },
        customCode: data.customCode,
        id,
        parentCode,
        parentModel,
        parentName,
      };
      addProduct(param).then((res) => {
        const { code, data, msg } = res.data;
        if (code && data) {
        const { code, msg } = res.data;
        if (code) {
          this.$message.success(msg);
          this.customShow = false;
        } else {
@@ -771,7 +772,7 @@
      "roles",
      "projectManagerList",
      "generalManagerList",
      'permits'
      "permits",
    ]),
    ...mapGetters("setting", ["affixed"]),
    canUploadBom() {
@@ -782,7 +783,7 @@
    },
    canDownloadBom() {
      return checkPermit(PERMITS.downloadBom, this.permits);
    }
    },
  },
  mounted() {
    this.getUserByRoleId();
src/pages/resourceManage/product/prodUpload.vue
@@ -24,6 +24,7 @@
          >
            <a-date-picker
              format="YYYY-MM-DD HH:mm:ss"
              valueFormat="YYYY-MM-DD HH:mm:ss"
              :allowClear="false"
              :disabled-date="disabledDate"
              :show-time="{ defaultValue: moment('00:00:00', 'HH:mm:ss') }"
src/pages/resourceManage/software/apis.js
@@ -7,7 +7,7 @@
export const getList = (pageCurr, pageSize, data) => {
  return axios({
    method: "GET",
    url: "productSoftware/getAllSoftware",
    url: "software/getAllSoftware",
    params: { pageCurr, pageSize, ...data }
  })
}
@@ -15,10 +15,38 @@
 * 产品软件审批提交
 * @returns 
 */
export const productSoftwareSubmit = (data) => {
// export const productSoftwareSubmit = (data) => {
//   return axios({
//     method: "POST",
//     url: "worksheetMain/productSoftwareSubmit",
//     headers: {
//       "Content-Type": "multipart/form-data"
//     },
//     data
//   })
// }
/**
 * 软件下载
 * @returns
 */
export const downLoadSoftware = (id) => {
  return axios({
    method: "GET",
    url: "software/downLoadSoftware",
    responseType: "blob",
    params: {
      id
    }
  })
}
/**
 * 软件说明文档解析
 * @returns
 */
export const excelParse = (data) => {
  return axios({
    method: "POST",
    url: "worksheetMain/productSoftwareSubmit",
    url: "software/excelParse",
    headers: {
      "Content-Type": "multipart/form-data"
    },
@@ -26,16 +54,16 @@
  })
}
/**
 * 产品软件下载
 * 软件上传
 * @returns 
 */
export const downLoadSoftware = (softwareName) => {
export const productSoftwareSubmit = (data) => {
  return axios({
    method: "GET",
    url: "productSoftware/downLoadSoftware",
    responseType: "blob",
    params: {
      softwareName
    }
    method: "POST",
    url: "software/upload",
    headers: {
      "Content-Type": "multipart/form-data"
    },
    data
  })
}
}
src/pages/resourceManage/software/descRes.vue
New file
@@ -0,0 +1,93 @@
<template>
  <div class="">
    <table class="table">
      <tbody>
        <tr>
          <th colspan="4">软件基本信息</th>
        </tr>
        <tr>
          <th>文件名称</th>
          <td colspan="3">{{ summarize.fileName }}</td>
        </tr>
        <tr>
          <th>软件类型</th>
          <td colspan="3">{{ summarize.type }}</td>
        </tr>
        <tr>
          <th>软件版本</th>
          <td>{{ summarize.version }}</td>
          <th>软件基于版本</th>
          <td>{{ summarize.basedVersion }}</td>
        </tr>
        <tr>
          <th>软件负责人</th>
          <td>{{ summarize.owner }}</td>
          <th>归档日期</th>
          <td>{{ summarize.filingDate }}</td>
        </tr>
        <tr>
          <th colspan="4">软件适用机型</th>
        </tr>
        <tr v-for="(item, idx) in list" :key="idx">
          <th>物料编码</th>
          <td>{{ item.parentCode }}</td>
          <th>规格型号</th>
          <td>{{ item.parentModel }}</td>
        </tr>
        <tr>
          <th>发布说明</th>
          <td colspan="3">{{ summarize.releaseNotes }}</td>
        </tr>
      </tbody>
    </table>
  </div>
</template>
<script>
export default {
  name: "",
  props: {
    info: {
      type: Array,
      default() {
        return [];
      },
    },
  },
  data() {
    return {};
  },
  computed: {
    list() {
      return this.info.map((v) => ({
        parentCode: v.applyMaterialCode,
        parentModel: v.applyModel,
      }));
    },
    summarize() {
      console.log(this.info[0])
      return this.info[0] || {};
    },
  },
  methods: {},
  mounted() {
    console.log(this.summarize, 90909)
  },
};
</script>
<style lang="less" scoped>
.table {
  width: 100%;
  border-collapse: collapse;
  th,
  td {
    border: 1px #333 solid;
    padding: 4px;
  }
  td {
    color: #13c2c2;
  }
}
</style>
src/pages/resourceManage/software/list.vue
@@ -14,7 +14,7 @@
            @refresh="onRefresh"
            @reset="onReset"
            :format-conditions="true"
            :scroll="{ y }"
            :scroll="{ x: 1920, y }"
            :pagination="{
              current: pageCurr,
              pageSize: pageSize,
@@ -30,7 +30,15 @@
            }"
          >
            <template slot="title">
              <span class="title">软件中心</span>
              <a-space>
                <span class="title">软件中心</span>
                <a-button
                  v-if="canUploadSoftware"
                  type="primary"
                  @click="showUpload"
                  >上传软件</a-button
                >
              </a-space>
            </template>
            <template slot="action" slot-scope="{ record }">
              <template v-if="canDownloadSoftware">
@@ -41,6 +49,53 @@
        </a-card>
      </a-spin>
    </div>
    <!-- 上传软件 -->
    <a-modal
      :visible="uploadShow"
      :footer="null"
      :width="760"
      title="上传软件"
      :destroyOnClose="true"
      :maskClosable="false"
      @cancel="uploadCancel"
    >
      <div class="">
        <a-row type="flex" class="row">
          <a-col flex="6em" class="label">软件包</a-col>
          <a-col :flex="1">
            <a-upload
              class="upload"
              :before-upload="beforeUpload"
              @change="uploadChange"
              accept=".zip"
            >
              <a-button type="primary">选择软件</a-button>
            </a-upload>
          </a-col>
        </a-row>
        <a-row type="flex" class="row">
          <a-col flex="6em" class="label">软件说明</a-col>
          <a-col :flex="1">
            <a-upload
              class="upload"
              :before-upload="beforeUpload"
              @change="uploadChange1"
              accept=".xls,.xlsx"
            >
              <a-button type="primary">说明文件</a-button>
            </a-upload>
          </a-col>
        </a-row>
        <div class="sub-title">说明文件解析结果</div>
        <div class="res-content">
          <desc-res :info="resData"></desc-res>
        </div>
        <div class="modal-footer">
          <a-button type="danger" @click="uploadCancel"> 取消 </a-button>
          <a-button type="primary" @click="uploadSoftware"> 提交 </a-button>
        </div>
      </div>
    </a-modal>
  </div>
</template>
@@ -48,14 +103,24 @@
import AdvanceTable from "@/components/table/advance/AdvanceTable";
import checkPermit from "@/assets/js/tools/checkPermit";
import PERMITS from "@/assets/js/const/const_permits";
import DescRes from "./descRes";
import { getList, downLoadSoftware } from "./apis";
import {
  getList,
  downLoadSoftware,
  excelParse,
  productSoftwareSubmit,
} from "./apis";
import { mapGetters } from "vuex";
export default {
  name: "",
  data() {
    return {
      resData: [],
      file: null,
      file1: null,
      uploadShow: false,
      spinning: false,
      loading: false,
      pageCurr: 1,
@@ -66,35 +131,57 @@
      conditions: {},
      columns: [
        {
          title: "关联产品母料型号",
          dataIndex: "parentModel",
          key: "parentModel",
          title: "名称",
          dataIndex: "fileName",
          align: "center",
          width: 180,
          searchAble: true,
        },
        {
          title: "软件名称",
          dataIndex: "softwareName",
          key: "softwareName",
          title: "类型",
          dataIndex: "type",
          align: "center",
          width: 180,
          noSearch: true,
        },
        {
          title: "版本",
          dataIndex: "version",
          align: "center",
          noSearch: true,
        },
        {
          title: "负责人",
          dataIndex: "owner",
          align: "center",
          noSearch: true,
        },
        {
          title: "适用机料号",
          dataIndex: "applyMaterialCode",
          align: "center",
          noSearch: true,
        },
        {
          title: "适用机型号号",
          dataIndex: "applyModel",
          align: "center",
          noSearch: true,
        },
        {
          title: "操作",
          dataIndex: "operation",
          key: "operation",
          align: "center",
          width: 168,
          fixed: "right",
          scopedSlots: { customRender: "action" },
        },
        }
      ],
      dataSource: [],
    };
  },
  components: {
    AdvanceTable,
    DescRes,
  },
  methods: {
    onSearch(conditions, searchOptions) {
@@ -128,11 +215,6 @@
      Object.keys(conditions).forEach((v) => {
        params[v] = conditions[v];
      });
      let data = {
        pageSize,
        pageCurr,
        ...params,
      };
      getList(pageCurr, pageSize, params).then((res) => {
        res = res.data;
        // console.log(res);
@@ -150,14 +232,16 @@
      });
    },
    download(obj) {
      const { parentModel, softwareName } = obj;
      downLoadSoftware(softwareName).then((res) => {
      const { id } = obj;
      downLoadSoftware(id).then((res) => {
        // console.log(res, "===========");
        let { headers, data, status } = res;
        if (200 == status && data) {
          let url = window.URL.createObjectURL(data);
          const matchRes = /filename=(.*)/.exec(headers["content-disposition"]);
          const fileName = matchRes ? decodeURI(matchRes[1].trim()) : "未知文件名.zip";
          const fileName = matchRes
            ? decodeURI(matchRes[1].trim())
            : "未知文件名.zip";
          let link = document.createElement("a");
          link.style.display = "none";
          link.href = url;
@@ -178,6 +262,90 @@
    },
    activeFN() {
      this.resize();
    },
    showUpload() {
      this.file = null;
      this.file1 = null;
      this.resData = [];
      this.uploadShow = true;
    },
    beforeUpload() {
      return false;
    },
    uploadChange(data) {
      const { file, fileList } = data;
      if (fileList.length > 1) {
        fileList.shift();
      }
      if (fileList.length) {
        this.file = fileList[0].originFileObj;
      } else {
        this.file = null;
      }
    },
    uploadChange1(data) {
      const { file, fileList } = data;
      if (fileList.length > 1) {
        fileList.shift();
      }
      if (fileList.length) {
        this.file1 = fileList[0].originFileObj;
      } else {
        this.file1 = null;
        this.resData = [];
        return false;
      }
      const formData = new FormData();
      formData.append("multipartFile", this.file1);
      excelParse(formData).then((res) => {
        const { code, data, data2, msg } = res.data;
        let list = [];
        if (code && data) {
          list = data2;
          this.$message.success(msg);
        } else {
          this.$message.error(msg);
        }
        this.resData = list;
      });
    },
    uploadCancel() {
      this.uploadShow = false;
    },
    uploadSoftware() {
      if (!this.file) {
        this.$message.error("请选择要上传的软件包");
        return false;
      }
      if (!this.file1) {
        this.$message.error("请选择软件说明文件");
        return false;
      }
      if (!this.resData.length) {
        this.$message.error("软件说明文件解析异常");
        return false;
      }
      let loading = this.$layer.loading();
      const formData = new FormData();
      formData.append("file1", this.file);
      formData.append("file2", this.file1);
      formData.append("softwareStr", JSON.stringify(this.resData));
      productSoftwareSubmit(formData)
        .then((res) => {
          let { code, data, msg } = res.data;
          if (code && data) {
            this.uploadShow = true;
            this.$message.success(msg);
          } else {
            this.$message.error(msg);
          }
          this.$layer.close(loading);
        })
        .catch((error) => {
          this.$layer.close(loading);
          console.log(error);
        });
    },
  },
  watch: {
@@ -217,6 +385,9 @@
  computed: {
    ...mapGetters("account", ["permits"]),
    ...mapGetters("setting", ["affixed"]),
    canUploadSoftware() {
      return checkPermit(PERMITS.uploadSoftware, this.permits);
    },
    canDownloadSoftware() {
      return checkPermit(PERMITS.downloadSoftware, this.permits);
    },
@@ -246,4 +417,45 @@
/deep/table {
  table-layout: fixed;
}
.modal-footer {
  text-align: right;
  button + button {
    margin-left: 8px;
  }
}
.label {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-right: 0.4em;
  height: 32px;
  &::after {
    content: ":";
  }
}
.row ~ .row {
  margin-top: 10px;
}
.upload {
  display: flex;
  /deep/.ant-upload-list {
    flex: 1;
    position: relative;
    & > div {
      position: absolute;
      left: 0;
      right: 0;
    }
  }
}
.sub-title {
  font-size: 14px;
  font-weight: 700;
  margin-top: 10px;
}
.res-content {
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 10px;
}
</style>