研发图纸文件管理系统-前端项目
he wei
2022-09-14 6b962b10000e67f9a40c3d349c32b33446938754
U 添加产品中丝印的锁定
6个文件已修改
162 ■■■■ 已修改文件
src/layouts/tabs/TabsView.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/components/filesTable.vue 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/resourceManage/materialsCenter/history/history.vue 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/resourceManage/materialsCenter/list.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/resourceManage/product/details/apis.js 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/resourceManage/product/details/details.vue 94 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layouts/tabs/TabsView.vue
@@ -320,7 +320,7 @@
        //this.WSClose2();
        setTimeout(() => {
          this.$router.push("/login");
          location.reload();
          // location.reload();
        }, 2000);
      }
    },
src/pages/components/filesTable.vue
@@ -18,7 +18,7 @@
            <a-divider type="vertical"></a-divider>
            <a @click="downloadLog(record)">下载</a>
          </template>
          <template v-if="canLockOther">
          <template v-if="canLockOther && (id || productId)">
            <a-divider v-if="!record.lockFlag" type="vertical"></a-divider>
            <a @click="lock(record)">{{ record.lockFlag ? "解锁" : "锁定" }}</a>
          </template>
@@ -58,6 +58,7 @@
import { dwgReview } from "@/pages/workplace/apis";
import { downloadLog } from "@/pages/system/logs/apis";
import { updateAttachLock } from "@/pages/resourceManage/materialsCenter/apis";
import { updateProductLock } from "@/pages/resourceManage/product/details/apis";
import checkPermit from "@/assets/js/tools/checkPermit";
import PERMITS from "@/assets/js/const/const_permits";
import { mapGetters } from "vuex";
@@ -177,34 +178,37 @@
    },
    lock(obj) {
      this.currObj = obj;
      this.reason = '';
      this.reason = "";
      this.reasonVisible = true;
    },
    reasonCancel() {
      this.reasonVisible = false;
    },
    reasonOk() {
      if (!this.id) {
        this.$message.error("无效的物料ID");
      if (!this.id && !this.productId) {
        this.$message.error("无效的ID");
        return false;
      }
      let obj = this.currObj;
      let lockFlag = !obj.lockFlag * 1;
      let isProd = !!this.productId;
      let params = {
        attachName: obj.fileName,
        localReason: this.reason,
        lockFlag,
        materialId: this.id,
        materialId: this.id ? this.id : undefined,
        productId: this.productId ? this.productId : undefined
      };
      updateAttachLock([params]).then((res) => {
      let update = isProd ? updateProductLock : updateAttachLock;
      update([params]).then((res) => {
        const { code, data, msg } = res.data;
        if (code && data) {
          this.$message.success('操作成功');
          this.$message.success("操作成功");
          obj.lockFlag = lockFlag;
          obj.localReason = this.reason;
          this.reasonVisible = false;
        } else {
          this.$message.error('操作失败');
          this.$message.error("操作失败");
        }
      });
    },
@@ -237,6 +241,9 @@
    id() {
      return this.info ? this.info.id : 0;
    },
    productId() {
      return this.info ? this.info.productId : 0;
    },
    attachLocks() {
      return this.info ? this.info.attachLocks : [];
    },
src/pages/resourceManage/materialsCenter/history/history.vue
@@ -74,16 +74,27 @@
      <a-layout-footer>
        <a-card>
          <template v-if="dataSource.length">
            <a-popover title="" v-if="otherDoc.length">
            <!-- <a-popover title="" v-if="otherDoc.length" trigger="click">
              <div class="file-list" slot="content">
                <files-table :list="otherDoc"></files-table>
                <files-table :list="otherDoc" :info="info"></files-table>
              </div>
              <a-button type="primary">其他附件</a-button>
            </a-popover>
            </a-popover> -->
            <a-button v-if="otherDoc.length" type="primary" @click="showOtherDoc">其他附件</a-button>
          </template>
        </a-card>
      </a-layout-footer>
    </a-layout>
    <!-- 其他附件列表弹窗 -->
    <a-modal
      :visible="otherDocVisible"
      title="其他附件"
      :destroyOnClose="true"
      :width="600"
      :footer="null"
      @cancel="otherDocCancel"
    >
      <files-table :list="otherDoc" :info="info"></files-table>
    </a-modal>
  </a-layout>
</template>
@@ -101,6 +112,7 @@
  data() {
    return {
      otherDocVisible: false,
      diffShow: false,
      diffData: [],
      softwareDownloadShow: false,
@@ -203,14 +215,17 @@
        let list = [];
        let prods = [];
        let otherDoc = [];
        let attachLocks = [];
        this.spinning = false;
        if (code && data) {
          list = data2;
          prods = data2.products;
          attachLocks = data2.attachLocks || [];
          otherDoc = data3;
        }
        this.dataSource = prods;
        this.record = list;
        this.info = { attachLocks, id };
        this.otherDoc = otherDoc;
        if (this.record.dwgUrl) {
          this.otherDoc.unshift(this.record.dwgUrl);
@@ -234,6 +249,14 @@
          console.log(error);
        });
    },
    showOtherDoc() {
      this.getInfo();
      this.otherDocVisible = true;
    },
    otherDocCancel() {
      this.otherDocVisible = false;
    },
  },
  mounted() {
    this.getVersions();
src/pages/resourceManage/materialsCenter/list.vue
@@ -526,6 +526,7 @@
          const { code, data, msg } = res.data;
          if (code && data) {
            this.$message.success(msg);
            this.panelShow(this.currentObj);
            this.fileUploadVisible = false;
          } else {
            this.$message.error(msg);
src/pages/resourceManage/product/details/apis.js
@@ -58,3 +58,14 @@
    params: { preProductId, productId }
  })
}
/**
 * 修改附件锁定状态
 * @returns
 */
 export const updateProductLock = (data) => {
  return axios({
    method: "POST",
    url: "attachLock/updateProductLock",
    data
  })
}
src/pages/resourceManage/product/details/details.vue
@@ -63,7 +63,10 @@
                    <template
                      v-if="record.softwares.length && canDownloadSoftware"
                    >
                      <a-divider v-if="record.dwgUrl" type="vertical"></a-divider>
                      <a-divider
                        v-if="record.dwgUrl"
                        type="vertical"
                      ></a-divider>
                      <a-popover title="" trigger="hover">
                        <div class="" slot="content" style="width: 450px">
                          <a-table
@@ -97,13 +100,21 @@
      <a-layout-footer>
        <a-card>
          <template v-if="dataSource.length">
            <a-popover
            <!-- <a-popover
              title=""
              v-if="otherDoc.length && currentVersion.enabled"
            >
              <files-table slot="content" :list="otherDoc"></files-table>
              <div class="file-list" slot="content">
                <files-table :list="otherDoc"></files-table>
              </div>
              <a-button type="primary">其他附件</a-button>
            </a-popover>
            </a-popover> -->
            <a-button
              v-if="otherDoc.length && currentVersion.enabled"
              type="primary"
              @click="showOtherDoc"
              >其他附件</a-button
            >
            <a-button
              v-if="canDownloadBom && currentVersion.enabled"
              type="primary"
@@ -191,6 +202,17 @@
        />
      </a-form-model-item>
    </a-modal>
    <!-- 其他附件列表弹窗 -->
    <a-modal
      :visible="otherDocVisible"
      title="其他附件"
      :destroyOnClose="true"
      :width="800"
      :footer="null"
      @cancel="otherDocCancel"
    >
      <files-table :list="otherDoc" :info="info"></files-table>
    </a-modal>
  </a-layout>
</template>
@@ -220,8 +242,9 @@
  mixins: [WSMixin],
  data() {
    return {
      otherDocVisible: false,
      reasonVisible: false,
      reason: '',
      reason: "",
      lastId: undefined,
      diffShow: false,
      diffData: [],
@@ -453,7 +476,7 @@
        parentCode,
        customCode,
      };
      console.log("=====9=", data, JSON.stringify(data));
      // console.log("=====9=", data, JSON.stringify(data));
      this.SOCKET.send(JSON.stringify(data));
    },
    onWSMessage(res) {
@@ -467,13 +490,12 @@
      this.currentVersion = obj;
      this.getInfo();
    },
    getInfo() {
    getInfo(force) {
      const {
        currentVersion: { id, version },
        info,
        lastId,
      } = this;
      if (id == lastId) {
      if (id == lastId && !force) {
        return false;
      }
      this.lastId = id;
@@ -484,6 +506,7 @@
        let list = [];
        let softwareList = [];
        let otherDoc = [];
        let attachLocks = [];
        this.spinning = false;
        if (code && data) {
          list = data2.map((v) => {
@@ -493,11 +516,13 @@
            return v;
          });
          softwareList = data3;
          otherDoc = data4;
          otherDoc = data4.files || [];
          attachLocks = data4.attachLocks || [];
        }
        this.dataSource = list;
        this.softwareList = softwareList;
        this.otherDoc = otherDoc;
        this.info = { attachLocks, productId: id };
        if (-1 == this.update) {
          this.update = Math.random();
        }
@@ -597,23 +622,41 @@
    },
    reasonOk() {
      let {
        currentVersion: { customCode, parentCode, enabled, version, versionTime },
        reason
        currentVersion: {
          customCode,
          parentCode,
          enabled,
          version,
          versionTime,
        },
        reason,
      } = this;
      enabled = !enabled * 1;
      setpHistoryEnable({ customCode, parentCode, enabled, version, reason, versionTime }).then(
        (res) => {
          let { code, data } = res.data;
          if (code && data) {
            this.$message.success("操作成功");
            this.currentVersion.enabled = enabled;
            this.reasonVisible = false;
          } else {
            this.$message.error("操作失败");
          }
      setpHistoryEnable({
        customCode,
        parentCode,
        enabled,
        version,
        reason,
        versionTime,
      }).then((res) => {
        let { code, data } = res.data;
        if (code && data) {
          this.$message.success("操作成功");
          this.currentVersion.enabled = enabled;
          this.reasonVisible = false;
        } else {
          this.$message.error("操作失败");
        }
      );
    }
      });
    },
    showOtherDoc() {
      this.getInfo(1);
      this.otherDocVisible = true;
    },
    otherDocCancel() {
      this.otherDocVisible = false;
    },
  },
  mounted() {
    this.sendMessage();
@@ -717,4 +760,7 @@
    background: #ffbcc9;
  }
}
.file-list {
  width: 600px;
}
</style>