src/assets/js/apis.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/pages/components/downloadReason.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/pages/components/filesTable.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/pages/resourceManage/components/feedbackDetails.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/pages/resourceManage/details/details.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/pages/resourceManage/details/index.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/pages/resourceManage/materialsCenter/history/history.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/pages/resourceManage/materialsCenter/list.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/pages/resourceManage/product/details/details.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/assets/js/apis.js
@@ -1,14 +1,25 @@ import axios from "@/assets/axios"; /** * 文件下载 * 下载 * @param {*} filePath 文件路径 * @param {*} oprateReason 下载原因 * @param {*} oprateInfo 物料就传id 产品传parentCode + "_" + customCode * @param {*} oprateVersion 物料传0 产品传versionId * @param {*} type 物料传13 产品传12 * @returns */ export const downLoadFileByFilePath = (filePath) => { export const downLoadFileByFilePath = ( filePath, oprateReason, oprateInfo, oprateVersion, type ) => { return axios({ method: "GET", url: "bomFeedbak/downLoadFileByFilePath", params: { filePath }, responseType: "blob" }) } params: { filePath, oprateReason, oprateInfo, oprateVersion, type }, responseType: "blob", }); }; src/pages/components/downloadReason.vue
New file @@ -0,0 +1,47 @@ <template> <a-modal :width="400" :visible="reasonVisible" title="下载原因" :destroyOnClose="true" :maskClosable="false" @cancel="reasonCancel" @ok="reasonOk" > <a-form-model-item ref="name" label="下载原因"> <a-input type="textarea" v-model="reason" placeHolder="请输入下载原因" /> </a-form-model-item> </a-modal> </template> <script> export default { props: { reasonVisible: { type: Boolean, required: true, }, }, data() { return { reason: "", }; }, methods: { reasonCancel() { this.$emit("update:reasonVisible", false); }, reasonOk() { if ("" == this.reason.trim()) { this.$message.error("下载原因不能为空"); return false; } this.reasonCancel(); this.$emit("ok", this.reason); }, }, }; </script> <style scoped> </style> src/pages/components/filesTable.vue
@@ -16,7 +16,7 @@ <a v-if="!record.lockFlag && ((record.fileType == 'dwg' && canViewDoc) || (record.fileType != 'dwg' && canViewOther))" @click="view(record)">预览</a> <template v-if="((record.fileType == 'dwg' && canDownloadDoc) || (record.fileType != 'dwg' && canDownloadOther)) && !record.lockFlag"> <a-divider type="vertical"></a-divider> <a @click="downloadLog(record)">下载</a> <a @click="downloadReason(record)">下载</a> </template> <template v-if="canLockOther && (id || productId)"> <a-divider v-if="!record.lockFlag" type="vertical"></a-divider> @@ -50,6 +50,7 @@ /> </a-form-model-item> </a-modal> <download-reason :reason-visible.sync="downloadReasonVisible" v-if="downloadReasonVisible" @ok="downloadReasonOk"></download-reason> </div> </template> @@ -61,10 +62,14 @@ import { updateAttachLock } from "@/pages/resourceManage/materialsCenter/apis"; import { updateProductLock } from "@/pages/resourceManage/product/details/apis"; import checkPermit from "@/assets/js/tools/checkPermit"; import DownloadReason from '@/pages/components/downloadReason'; import PERMITS from "@/assets/js/const/const_permits"; import { mapGetters } from "vuex"; export default { name: "", components: { DownloadReason, }, props: { list: { type: Array, @@ -78,6 +83,15 @@ return null; }, }, // 类型 产品12 物料13 type: { type: Number, required: true, }, oprateVersion: { type: Number, default: 0 } }, data() { const columns = [ @@ -108,6 +122,8 @@ }, ]; return { downloadUrl: '', downloadReasonVisible: false, reason: "", reasonVisible: false, currObj: null, @@ -165,11 +181,17 @@ this.$layer.close(loading); }); }, downloadLog(record) { const { parentModel, subModel, url } = record; downloadReason(record) { this.downloadUrl = record.url; this.downloadReasonVisible = true; }, downloadReasonOk(data) { this.downloadLog(this.downloadUrl, data); }, downloadLog(url, reason) { let reg = /(.*\\+)*(.*)$/; let fileName = url.match(reg)[2]; downLoadFileByFilePath(url).then((res) => { downLoadFileByFilePath(url, reason, this.info.oprateInfo, this.oprateVersion, this.type).then((res) => { let { data, status } = res; if (200 == status && data) { let url = window.URL.createObjectURL(data); src/pages/resourceManage/components/feedbackDetails.vue
@@ -149,7 +149,7 @@ let reg = /(.*\\+)*(.*)$/; let fileName = this.FkData.file.match(reg)[2]; downLoadFileByFilePath(this.FkData.file).then((res) => { downLoadFileByFilePath(this.FkData.file, '', '', 0, 11).then((res) => { let { headers, data, status } = res; if (200 == status && data) { let url = window.URL.createObjectURL(data); src/pages/resourceManage/details/details.vue
File was deleted src/pages/resourceManage/details/index.js
File was deleted src/pages/resourceManage/materialsCenter/history/history.vue
@@ -100,7 +100,7 @@ :footer="null" @cancel="otherDocCancel" > <files-table :list="otherDoc" :info="info"></files-table> <files-table :list="otherDoc" :info="info" :type="13"></files-table> </a-modal> <!-- 差异 --> <a-modal @@ -261,7 +261,7 @@ } this.dataSource = prods; this.record = list; this.info = { attachLocks, id }; this.info = { attachLocks, id, oprateInfo: id }; this.otherDoc = otherDoc; if (this.record.dwgUrl) { this.otherDoc.unshift(this.record.dwgUrl); src/pages/resourceManage/materialsCenter/list.vue
@@ -136,7 +136,7 @@ :footer="null" @cancel="fileListCancel" > <files-table :list="fileList" :info="info"></files-table> <files-table :list="fileList" :info="info" :type="13"></files-table> <div class="footer"> <a-space> <a-button @click="fileListCancel">关闭</a-button> @@ -202,7 +202,6 @@ import EditLink from "./editLink"; import SubmitForm from "./SubmitForm"; import FilesTable from "@/pages/components/filesTable"; import { downLoadFileByFilePath } from "@/assets/js/apis"; import getWebUrl from "@/assets/js/tools/getWebUrl"; import { @@ -668,31 +667,6 @@ console.log(error); }); }, // downloadLog(record) { // const { parentModel, subModel, dwgUrl } = record; // const url = this.webUrl + dwgUrl; // let reg = /(.*\\+)*(.*)$/; // let fileName = dwgUrl.match(reg)[2]; // downLoadFileByFilePath(dwgUrl).then((res) => { // let { data, status } = res; // if (200 == status && data) { // let url = window.URL.createObjectURL(data); // let link = document.createElement("a"); // link.style.display = "none"; // link.href = url; // link.download = fileName; // document.body.appendChild(link); // link.click(); // document.body.removeChild(link); // window.URL.revokeObjectURL(url); // downloadLog(parentModel, subModel); // } else { // this.$message.error("下载失败"); // } // }); // }, activeFN() { this.resize(); }, @@ -708,7 +682,7 @@ if (dwgUrl) { list.unshift(dwgUrl); } this.info = { attachLocks, id }; this.info = { attachLocks, id, oprateInfo: id }; this.fileList = list; this.fileListShow = true; }); src/pages/resourceManage/product/details/details.vue
@@ -75,7 +75,7 @@ v-if="canViewDoc && canDownloadDoc" type="vertical" ></a-divider> <a v-if="canDownloadDoc" @click="downloadLog(record)" <a v-if="canDownloadDoc" @click="showReason('downloadLog', record)" >下载</a > </div> @@ -105,7 +105,7 @@ <template slot="action" slot-scope="text, record1"> <a v-if="canDownloadSoftware" @click="downloadLog(record1)" @click="showReason('downloadLog', record1)" >下载</a > </template> @@ -183,7 +183,7 @@ v-if=" !currentVersion.enabled && canLockBom && maxVersionid == currentVersion.id (!is0120 || maxVersionid == currentVersion.id) " @click="changeStatus" >激活版本</a-button @@ -192,8 +192,7 @@ type="primary" v-if=" currentVersion.enabled && canLockBom && maxVersionid == currentVersion.id canLockBom " @click="changeStatus" >锁定版本</a-button @@ -224,7 +223,7 @@ :row-key="(record, index) => index" > <template slot="action" slot-scope="text, record"> <a @click="downloadLog(record)">下载</a> <a @click="showReason('downloadLog', record)">下载</a> </template> </a-table> <pop @@ -274,7 +273,7 @@ :footer="null" @cancel="otherDocCancel" > <files-table :list="otherDoc" :info="info"></files-table> <files-table :list="otherDoc" :info="info" :type="12" :oprate-version="currentVersion.version"></files-table> </a-modal> <!-- 锁定清单 --> <a-modal @@ -342,6 +341,7 @@ <a-empty v-else /> </div> </a-modal> <download-reason :reason-visible.sync="downloadReasonVisible" v-if="downloadReasonVisible" @ok="downloadReasonOk"></download-reason> </div> </template> @@ -354,6 +354,8 @@ import Pop from "../../software/pop"; import offset from "@/assets/js/tools/offset"; import DownloadReason from '@/pages/components/downloadReason'; import List from "./list"; import getWebUrl from "@/assets/js/tools/getWebUrl"; import { @@ -365,7 +367,6 @@ } from "./apis"; import { setpHistoryEnable, getLockedList, getLogList } from "../apis"; import { dwgReview } from "@/pages/workplace/apis"; // import { downloadLog } from "@/pages/system/logs/apis"; import { downLoadFileByFilePath } from "@/assets/js/apis"; import { mapGetters } from "vuex"; import createWs from "@/assets/js/websocket"; @@ -376,6 +377,7 @@ mixins: [WSMixin], data() { return { downloadReasonVisible: false, popVisible: false, popPosition: { x: 0, @@ -621,6 +623,7 @@ FilesTable, DiffList, Pop, DownloadReason, }, computed: { ...mapGetters("setting", ["affixed"]), @@ -799,6 +802,7 @@ let otherDoc = []; let attachLocks = []; this.spinning = false; let oprateInfo; if (code && data) { list = data2.map((v) => { if (v.materials && v.materials.length) { @@ -812,11 +816,16 @@ softwareList = data3; otherDoc = data4.files || []; attachLocks = data4.attachLocks || []; let { parentCode, customCode } = data2[0]; oprateInfo = parentCode + "_" + customCode; } this.dataSource = list; this.softwareList = softwareList; this.otherDoc = otherDoc; this.info = { attachLocks, productId: id }; this.info = { attachLocks, productId: id, oprateInfo }; if (-1 == this.update) { this.update = Math.random(); } @@ -839,13 +848,19 @@ console.log(error); }); }, downloadLog(record) { const { parentCode, subModel, dwgUrl, fileUrl: softwareUrl } = record; showReason(action, record) { const { dwgUrl, fileUrl: softwareUrl } = record; const url = softwareUrl ? softwareUrl : dwgUrl; this.downloadUrl = url; this.currentAction = action; this.downloadReasonVisible = true; }, downloadLog(reason) { let url = this.downloadUrl; let reg = /(.*\\+)*(.*)$/; let fileName = url.match(reg)[2]; downLoadFileByFilePath(url).then((res) => { downLoadFileByFilePath(url, reason, this.info.oprateInfo, this.currentVersion.version, 12).then((res) => { let { data, status } = res; if (200 == status && data) { let url = window.URL.createObjectURL(data); @@ -857,8 +872,6 @@ link.click(); document.body.removeChild(link); window.URL.revokeObjectURL(url); // downloadLog(parentCode, subModel); } else { this.$message.error("下载失败"); } @@ -891,21 +904,45 @@ lockListOk() { this.lockListVisible = false; // this.zipDownload(); this[this.currentAction](); // this[this.currentAction](); this.downloadReasonVisible = true; }, OriginalZipDownload() { let loading = this.$layer.loading(); downloadReasonOk(reason) { this[this.currentAction](reason); }, OriginalZipDownload(reason) { // let loading = this.$layer.loading(); // let link = document.createElement("a"); // link.style.display = "none"; // let url = this.webUrl + this.originalZipUrl; // link.href = url; // link.download = url; // document.body.appendChild(link); // link.click(); // this.$layer.close(loading); // document.body.removeChild(link); let url = this.originalZipUrl; let reg = /(.*\\+)*(.*)$/; let fileName = url.match(reg)[2]; downLoadFileByFilePath(url, reason, this.info.oprateInfo, this.currentVersion.version, 12).then((res) => { let { data, status } = res; if (200 == status && data) { let url = window.URL.createObjectURL(data); let link = document.createElement("a"); link.style.display = "none"; let url = this.webUrl + this.originalZipUrl; link.href = url; link.download = url; link.download = fileName; document.body.appendChild(link); link.click(); this.$layer.close(loading); document.body.removeChild(link); window.URL.revokeObjectURL(url); } else { this.$message.error("下载失败"); } }); }, zipDownload() { // TODO zipDownload(reason) { // const { parentCode, currentVersion } = this; const { currentVersion: { id, version },