New file |
| | |
| | | import axios from "@/assets/axios"; |
| | | |
| | | /** |
| | | * 根据子件code获取最终的信息 |
| | | * @returns |
| | | */ |
| | | export const getInfo = (scode) => { |
| | | return axios({ |
| | | method: "GET", |
| | | url: "productBom/getBomBySubcode", |
| | | params: { |
| | | scode |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * 根据子件名称和母料型号查询历史版本记录 |
| | | * @returns |
| | | */ |
| | | export const getHistory = (pmodel, sname) => { |
| | | return axios({ |
| | | method: "GET", |
| | | url: "productBomHistory/getBomHistoryByPModelAndSName", |
| | | params: { |
| | | pmodel, |
| | | sname |
| | | } |
| | | }) |
| | | } |
New file |
| | |
| | | <template> |
| | | <a-spin :spinning="spinning" tip="拼命加载中..."> |
| | | <a-card> |
| | | <a-descriptions title="图纸信息"> |
| | | <a-descriptions-item label="母料型号">{{ |
| | | info.parentModel |
| | | }}</a-descriptions-item> |
| | | <a-descriptions-item label="母料名称">{{ |
| | | info.parentName |
| | | }}</a-descriptions-item> |
| | | <a-descriptions-item v-if="info.parentCode" label="母料编号">{{ |
| | | info.parentCode |
| | | }}</a-descriptions-item> |
| | | <a-descriptions-item label="类别">{{ |
| | | info.category |
| | | }}</a-descriptions-item> |
| | | <a-descriptions-item label="子件型号">{{ |
| | | info.subModel |
| | | }}</a-descriptions-item> |
| | | <a-descriptions-item label="子件名称">{{ |
| | | info.subName |
| | | }}</a-descriptions-item> |
| | | </a-descriptions> |
| | | <advance-table |
| | | :data-source="dataSource" |
| | | :columns="columns" |
| | | :loading="loading" |
| | | title="" |
| | | row-key="subCode" |
| | | @search="onSearch" |
| | | @refresh="onRefresh" |
| | | @reset="onReset" |
| | | :format-conditions="true" |
| | | :scroll="{ x: 2700 }" |
| | | > |
| | | <template slot="title"> |
| | | <span class="title">图纸历史版本</span> |
| | | </template> |
| | | <template slot="pictureUrl" slot-scope="{ record }"> |
| | | <image-view |
| | | v-if="record" |
| | | :url="webUrl + record.pictureUrl" |
| | | @load="imageLoad" |
| | | ></image-view> |
| | | </template> |
| | | <template slot="action" slot-scope="{ record }"> |
| | | <div v-if="record.dwgUrl"> |
| | | <a @click="dwgReview(record.dwgUrl)">预览</a> |
| | | <a-divider type="vertical"></a-divider> |
| | | <a :href="webUrl + record.dwgUrl" download>下载</a> |
| | | </div> |
| | | </template> |
| | | </advance-table> |
| | | </a-card> |
| | | </a-spin> |
| | | </template> |
| | | |
| | | <script> |
| | | import AdvanceTable from "@/components/table/advance/AdvanceTable"; |
| | | import ImageView from "@/pages/components/ImageView"; |
| | | import getWebUrl from "@/assets/js/tools/getWebUrl"; |
| | | import { dwgReview } from "@/pages/workplace/apis"; |
| | | import { getInfo, getHistory } from "./apis"; |
| | | export default { |
| | | name: "", |
| | | data() { |
| | | return { |
| | | scode: this.$route.params.subCode, |
| | | info: {}, |
| | | webUrl: getWebUrl(), |
| | | loading: false, |
| | | spinning: false, |
| | | y: 500, |
| | | conditions: {}, |
| | | columns: [ |
| | | { |
| | | title: "子件编码", |
| | | dataIndex: "subCode", |
| | | key: "subCode", |
| | | align: "center", |
| | | width: 130, |
| | | }, |
| | | { |
| | | title: "子件型号", |
| | | dataIndex: "subModel", |
| | | key: "subModel", |
| | | width: 180, |
| | | align: "center", |
| | | noSearch: true, |
| | | }, |
| | | { |
| | | title: "子件名称", |
| | | dataIndex: "subName", |
| | | key: "subName", |
| | | align: "center", |
| | | width: 180, |
| | | noSearch: true, |
| | | }, |
| | | { |
| | | title: "单位", |
| | | dataIndex: "unit", |
| | | key: "unit", |
| | | align: "center", |
| | | width: 80, |
| | | noSearch: true, |
| | | }, |
| | | { |
| | | title: "子件数量", |
| | | dataIndex: "quantity", |
| | | key: "quantity", |
| | | align: "center", |
| | | width: 120, |
| | | noSearch: true, |
| | | }, |
| | | { |
| | | title: "生产商", |
| | | dataIndex: "producer", |
| | | key: "producer", |
| | | align: "center", |
| | | width: 80, |
| | | }, |
| | | { |
| | | title: "封装类型/材质", |
| | | dataIndex: "material", |
| | | key: "material", |
| | | align: "center", |
| | | width: 180, |
| | | }, |
| | | { |
| | | title: "元件编号/料厚", |
| | | dataIndex: "thickness", |
| | | key: "thickness", |
| | | align: "center", |
| | | noSearch: true, |
| | | width: 180, |
| | | }, |
| | | { |
| | | title: "表面处理/物料详情", |
| | | dataIndex: "surfaceDetail", |
| | | key: "surfaceDetail", |
| | | align: "center", |
| | | noSearch: true, |
| | | width: 180, |
| | | }, |
| | | { |
| | | title: "备注", |
| | | dataIndex: "notes", |
| | | key: "notes", |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "图片", |
| | | dataIndex: "pictureUrl", |
| | | key: "pictureUrl", |
| | | align: "center", |
| | | noSearch: true, |
| | | width: 120, |
| | | scopedSlots: { customRender: "pictureUrl" }, |
| | | }, |
| | | { |
| | | title: "上传人", |
| | | dataIndex: "upUser", |
| | | key: "upUser", |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "创建日期", |
| | | dataIndex: "createDate", |
| | | key: "createDate", |
| | | align: "center", |
| | | noSearch: true, |
| | | width: 120, |
| | | }, |
| | | { |
| | | title: "更新日期", |
| | | dataIndex: "updateDate", |
| | | key: "updateDate", |
| | | align: "center", |
| | | noSearch: true, |
| | | width: 120, |
| | | }, |
| | | { |
| | | title: "版本", |
| | | dataIndex: "version", |
| | | key: "version", |
| | | align: "center", |
| | | width: 120, |
| | | }, |
| | | { |
| | | title: "操作", |
| | | dataIndex: "operation", |
| | | key: "operation", |
| | | align: "center", |
| | | width: 140, |
| | | fixed: "right", |
| | | scopedSlots: { customRender: "action" }, |
| | | }, |
| | | ], |
| | | dataSource: [], |
| | | }; |
| | | }, |
| | | components: { |
| | | AdvanceTable, |
| | | ImageView, |
| | | }, |
| | | methods: { |
| | | getInfo() { |
| | | getInfo(this.scode).then((res) => { |
| | | res = res.data; |
| | | if (res.code && res.data) { |
| | | this.info = res.data2; |
| | | this.searchData(); |
| | | } |
| | | }); |
| | | }, |
| | | searchData() { |
| | | const { subName, parentModel } = this.info; |
| | | getHistory(parentModel, subName).then((res) => { |
| | | res = res.data; |
| | | console.log(res); |
| | | let data = []; |
| | | if (res.code && res.data) { |
| | | data = res.data2; |
| | | } |
| | | this.dataSource = data; |
| | | }); |
| | | }, |
| | | dwgReview(url) { |
| | | this.spinning = true; |
| | | dwgReview(url) |
| | | .then((res) => { |
| | | this.spinning = false; |
| | | let rs = res.data; |
| | | if (rs.code == 1 && rs.data) { |
| | | window.open(this.webUrl + rs.data); |
| | | } else { |
| | | this.$message.error(rs.msg); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | this.spinning = false; |
| | | console.log(error); |
| | | }); |
| | | }, |
| | | onSearch(conditions, searchOptions) { |
| | | this.conditions = conditions; |
| | | this.searchData(); |
| | | }, |
| | | onRefresh(conditions) { |
| | | this.conditions = conditions; |
| | | this.searchData(); |
| | | }, |
| | | onReset(conditions) { |
| | | this.conditions = conditions; |
| | | this.searchData(); |
| | | }, |
| | | }, |
| | | |
| | | mounted() { |
| | | this.getInfo(); |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | </style> |
New file |
| | |
| | | import details from './details'; |
| | | export default details; |
| | |
| | | <template> |
| | | <a-card> |
| | | <advance-table |
| | | :data-source="dataSource" |
| | | :row-selection="{ |
| | | selectedRowKeys, |
| | | onChange: onSelectChange, |
| | | fixed: true, |
| | | selections: true, |
| | | columnWidth: 60 |
| | | }" |
| | | :columns="columns" |
| | | :loading="loading" |
| | | title="" |
| | | row-key="subCode" |
| | | @search="onSearch" |
| | | @refresh="onRefresh" |
| | | @reset="onReset" |
| | | :format-conditions="true" |
| | | :scroll="{ x: 2700 }" |
| | | :pagination="{ |
| | | current: pageCurr, |
| | | pageSize: pageSize, |
| | | total: total, |
| | | showSizeChanger: true, |
| | | showLessItems: true, |
| | | showQuickJumper: true, |
| | | pageSizeOptions: ['10', '20', '50', '100', '1000'], |
| | | showTotal: (total, range) => |
| | | `第 ${range[0]}-${range[1]} 条,总计 ${total} 条`, |
| | | onChange: onPageChange, |
| | | onShowSizeChange: onSizeChange, |
| | | }" |
| | | > |
| | | <template slot="title"> |
| | | <span class="title">图纸中心</span> |
| | | <a-space class="operator" style="margin-left: 1em;"> |
| | | <a-button>打包</a-button> |
| | | </a-space> |
| | | </template> |
| | | <template slot="action" slot-scope="scope"> |
| | | <a @click="scope.record">下载</a> |
| | | <a-divider type="vertical"></a-divider> |
| | | <a @click="scope.record">详情</a> |
| | | </template> |
| | | </advance-table> |
| | | </a-card> |
| | | <a-spin :spinning="spinning" tip="拼命加载中..."> |
| | | <a-card> |
| | | <advance-table |
| | | :data-source="dataSource" |
| | | :row-selection="{ |
| | | selectedRowKeys, |
| | | onChange: onSelectChange, |
| | | fixed: true, |
| | | selections: true, |
| | | columnWidth: 60, |
| | | }" |
| | | :columns="columns" |
| | | :loading="loading" |
| | | title="" |
| | | row-key="subCode" |
| | | @search="onSearch" |
| | | @refresh="onRefresh" |
| | | @reset="onReset" |
| | | :format-conditions="true" |
| | | :scroll="{ x: 2700 }" |
| | | :pagination="{ |
| | | current: pageCurr, |
| | | pageSize: pageSize, |
| | | total: total, |
| | | showSizeChanger: true, |
| | | showLessItems: true, |
| | | showQuickJumper: true, |
| | | pageSizeOptions: ['10', '20', '50', '100', '1000'], |
| | | showTotal: (total, range) => |
| | | `第 ${range[0]}-${range[1]} 条,总计 ${total} 条`, |
| | | onChange: onPageChange, |
| | | onShowSizeChange: onSizeChange, |
| | | }" |
| | | > |
| | | <template slot="title"> |
| | | <span class="title">图纸中心</span> |
| | | <a-space class="operator" style="margin-left: 1em"> |
| | | <a-button @click="packageDoc">打包</a-button> |
| | | </a-space> |
| | | </template> |
| | | <template slot="pictureUrl" slot-scope="{ record }"> |
| | | <image-view |
| | | v-if="record" |
| | | :url="webUrl + record.pictureUrl" |
| | | @load="imageLoad" |
| | | ></image-view> |
| | | </template> |
| | | <template slot="action" slot-scope="{ record }"> |
| | | <div v-if="record.dwgUrl"> |
| | | <a @click="dwgReview(record.dwgUrl)">预览</a> |
| | | <a-divider type="vertical"></a-divider> |
| | | <a :href="webUrl + record.dwgUrl" download>下载</a> |
| | | <a-divider type="vertical"></a-divider> |
| | | </div> |
| | | <a @click="goDetails(record)">详情</a> |
| | | </template> |
| | | </advance-table> |
| | | </a-card> |
| | | </a-spin> |
| | | </template> |
| | | |
| | | <script> |
| | | import AdvanceTable from "@/components/table/advance/AdvanceTable"; |
| | | import { searchCadDrawer } from "./apis"; |
| | | import ImageView from "@/pages/components/ImageView"; |
| | | import getWebUrl from "@/assets/js/tools/getWebUrl"; |
| | | import { dwgReview } from "@/pages/workplace/apis"; |
| | | import { searchCadDrawer, packageDoc } from "./apis"; |
| | | |
| | | export default { |
| | | name: "DrawCenter", |
| | | components: { |
| | | AdvanceTable, |
| | | ImageView, |
| | | }, |
| | | data() { |
| | | return { |
| | | selectedRowKeys: [], |
| | | selectedRows: [], |
| | | spinning: false, |
| | | loading: false, |
| | | pageCurr: 1, |
| | | pageSize: 10, |
| | | total: 0, |
| | | webUrl: getWebUrl(), |
| | | y: 500, |
| | | conditions: {}, |
| | | columns: [ |
| | | { |
| | |
| | | key: "pictureUrl", |
| | | align: "center", |
| | | noSearch: true, |
| | | width: 80, |
| | | width: 120, |
| | | scopedSlots: { customRender: "pictureUrl" }, |
| | | }, |
| | | { |
| | | title: "上传人", |
| | |
| | | this.total = total; |
| | | }); |
| | | }, |
| | | onSelectChange(selectedRowKeys) { |
| | | console.log('selectedRowKeys changed: ', selectedRowKeys); |
| | | onSelectChange(selectedRowKeys, selectedRows) { |
| | | // console.log("selectedRowKeys changed: ", selectedRowKeys, selectedRows); |
| | | this.selectedRowKeys = selectedRowKeys; |
| | | this.selectedRows = selectedRows; |
| | | }, |
| | | imageLoad() { |
| | | this.y++; |
| | | this.$nextTick(() => { |
| | | this.y--; |
| | | }); |
| | | }, |
| | | dwgReview(url) { |
| | | this.spinning = true; |
| | | dwgReview(url) |
| | | .then((res) => { |
| | | this.spinning = false; |
| | | let rs = res.data; |
| | | if (rs.code == 1 && rs.data) { |
| | | window.open(this.webUrl + rs.data); |
| | | } else { |
| | | this.$message.error(rs.msg); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | this.spinning = false; |
| | | console.log(error); |
| | | }); |
| | | }, |
| | | goDetails(recode) { |
| | | console.log(recode); |
| | | const { subCode } = recode; |
| | | this.$router.push(`/draw/details/${subCode}`); |
| | | }, |
| | | packageDoc() { |
| | | if (!this.selectedRowKeys.length) { |
| | | this.$message.info("请选择要打包的子件"); |
| | | return false; |
| | | } |
| | | // TODO |
| | | const params = { |
| | | list: this.selectedRows.map((v) => v.fileUrl), |
| | | }; |
| | | packageDoc(params).then((res) => { |
| | | // console.log(res, "==========="); |
| | | let { headers, data } = res; |
| | | let url = window.URL.createObjectURL(data); |
| | | const matchRes = /filename=(.*)/.exec(headers["content-disposition"]); |
| | | const fileName = matchRes ? matchRes[1].trim() : "未知文件名.zip"; |
| | | 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); |
| | | }); |
| | | }, |
| | | }, |
| | | computed: {}, |
| | |
| | | }) |
| | | } |
| | | /** |
| | | * 新增用户 |
| | | * 图纸打包下载 |
| | | * @returns |
| | | */ |
| | | export const addUser = (data) => { |
| | | export const packageDoc = () => { |
| | | return axios({ |
| | | method: "POST", |
| | | url: "docUser/addUser", |
| | | headers: { |
| | | "Content-Type": "multipart/form-data" |
| | | }, |
| | | data |
| | | method: "GET", |
| | | url: "productBom/downloadCadDrawer", |
| | | responseType: "blob" |
| | | }) |
| | | } |
| | |
| | | name: '图纸中心', |
| | | component: () => import('@/pages/drawManage/drawCenter'), |
| | | }, |
| | | { |
| | | path: 'details/:subCode', |
| | | name: '图纸详情', |
| | | meta: { |
| | | invisible: true, |
| | | highlight: '/draw/center' |
| | | }, |
| | | component: () => import('@/pages/drawManage/details'), |
| | | }, |
| | | // { |
| | | // path: 'analysis', |
| | | // name: '图纸审批', |