| | |
| | | </a-row> |
| | | </a-card> |
| | | <a-table |
| | | ref="aTable" |
| | | size="small" :scroll="{ x: 1920, y: y}" bordered |
| | | :columns="columns" :data-source="dataSource" |
| | | :pagination="false" rowKey="subCode"> |
| | | ref="aTable" |
| | | size="small" |
| | | :scroll="{ x: 1920, y: y }" |
| | | bordered |
| | | :columns="columns" |
| | | :data-source="dataSource" |
| | | :pagination="false" |
| | | rowKey="subCode" |
| | | > |
| | | <template slot="pictureUrl" slot-scope="text"> |
| | | <image-view v-if="text" :url="webUrl+text" @load="imageLoad"></image-view> |
| | | <div class="img-wraper"> |
| | | <image-view |
| | | v-if="text" |
| | | :url="webUrl + text" |
| | | ></image-view> |
| | | </div> |
| | | </template> |
| | | <template slot="dwgExist" slot-scope="text, record"> |
| | | <a-tag :color="record.dwgUrl?'blue':'red'">{{record.dwgUrl?"已上传":"未上传"}}</a-tag> |
| | | <a-tag :color="record.dwgUrl ? 'blue' : 'red'">{{ |
| | | record.dwgUrl ? "已上传" : "未上传" |
| | | }}</a-tag> |
| | | </template> |
| | | <template slot="action" slot-scope="text, 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 :href="webUrl + record.dwgUrl" download>下载</a> |
| | | </div> |
| | | </template> |
| | | </a-table> |
| | |
| | | <script> |
| | | import getWebUrl from "@/assets/js/tools/getWebUrl"; |
| | | import ImageView from "@/pages/components/ImageView"; |
| | | import {dwgReview} from "@/pages/workplace/apis"; |
| | | import { dwgReview } from "@/pages/workplace/apis"; |
| | | export default { |
| | | name: "DrawUpload", |
| | | components: {ImageView}, |
| | | components: { ImageView }, |
| | | props: { |
| | | list: { |
| | | type: Array, |
| | | default() { |
| | | return [] |
| | | } |
| | | return []; |
| | | }, |
| | | }, |
| | | text: { |
| | | type: String, |
| | | default: "提交审核" |
| | | default: "提交审核", |
| | | }, |
| | | noFooter: { |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | y: { |
| | | type: Number, |
| | | default: 500 |
| | | } |
| | | }, |
| | | data() { |
| | | const columns = [ |
| | | { |
| | | title: '子件编码', |
| | | dataIndex: 'subCode', |
| | | title: "子件编码", |
| | | dataIndex: "subCode", |
| | | width: 120, |
| | | fixed: 'left', |
| | | align: 'center' |
| | | fixed: "left", |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: '子件名称', |
| | | dataIndex: 'subName', |
| | | align: 'center', |
| | | title: "子件名称", |
| | | dataIndex: "subName", |
| | | align: "center", |
| | | ellipsis: true, |
| | | }, |
| | | // { |
| | |
| | | // ellipsis: true, |
| | | // }, |
| | | { |
| | | title: '子件型号', |
| | | dataIndex: 'subModel', |
| | | align: 'center', |
| | | title: "子件型号", |
| | | dataIndex: "subModel", |
| | | align: "center", |
| | | ellipsis: true, |
| | | }, |
| | | { |
| | | title: '类别', |
| | | dataIndex: 'category', |
| | | align: 'center', |
| | | title: "类别", |
| | | dataIndex: "category", |
| | | align: "center", |
| | | ellipsis: true, |
| | | }, |
| | | // { |
| | |
| | | // ellipsis: true, |
| | | // }, |
| | | { |
| | | title: '子件数量', |
| | | dataIndex: 'quantity', |
| | | align: 'center' |
| | | title: "子件数量", |
| | | dataIndex: "quantity", |
| | | align: "center", |
| | | }, |
| | | // { |
| | | // title: '生产商', |
| | |
| | | // ellipsis: true, |
| | | // }, |
| | | { |
| | | title: '封装类型/材质', |
| | | dataIndex: 'material', |
| | | align: 'center' |
| | | }, |
| | | { |
| | | title: '元件编号/料厚', |
| | | dataIndex: 'thickness', |
| | | align: 'center' |
| | | }, |
| | | { |
| | | title: '表面处理/物料详情', |
| | | dataIndex: 'surfaceDetail', |
| | | align: 'center', |
| | | ellipsis: true, |
| | | }, |
| | | { |
| | | title: '备注', |
| | | dataIndex: 'notes', |
| | | align: 'center', |
| | | ellipsis: true, |
| | | }, |
| | | { |
| | | title: '是否已上传图纸', |
| | | dataIndex: 'dwgExist', |
| | | align: 'center', |
| | | ellipsis: true, |
| | | scopedSlots: { customRender: 'dwgExist' }, |
| | | }, |
| | | { |
| | | title: '图片', |
| | | dataIndex: 'pictureUrl', |
| | | width: 120, |
| | | align: 'center', |
| | | scopedSlots: { customRender: 'pictureUrl' }, |
| | | }, |
| | | { |
| | | title: '操作', |
| | | dataIndex: "operation", |
| | | key: 'operation', |
| | | title: "封装类型/材质", |
| | | dataIndex: "material", |
| | | align: "center", |
| | | fixed: 'right', |
| | | }, |
| | | { |
| | | title: "元件编号/料厚", |
| | | dataIndex: "thickness", |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "表面处理/物料详情", |
| | | dataIndex: "surfaceDetail", |
| | | align: "center", |
| | | ellipsis: true, |
| | | }, |
| | | { |
| | | title: "备注", |
| | | dataIndex: "notes", |
| | | align: "center", |
| | | ellipsis: true, |
| | | }, |
| | | { |
| | | title: "是否已上传图纸", |
| | | dataIndex: "dwgExist", |
| | | align: "center", |
| | | ellipsis: true, |
| | | scopedSlots: { customRender: "dwgExist" }, |
| | | }, |
| | | { |
| | | title: "图片", |
| | | dataIndex: "pictureUrl", |
| | | width: 120, |
| | | align: "center", |
| | | scopedSlots: { customRender: "pictureUrl" }, |
| | | }, |
| | | { |
| | | title: "操作", |
| | | dataIndex: "operation", |
| | | key: "operation", |
| | | align: "center", |
| | | fixed: "right", |
| | | width: 100, |
| | | scopedSlots: { customRender: 'action' } |
| | | scopedSlots: { customRender: "action" }, |
| | | }, |
| | | ]; |
| | | return { |
| | | columns: columns, |
| | | webUrl: getWebUrl(), |
| | | y: 500, |
| | | spinning: false |
| | | } |
| | | // y: 500, |
| | | spinning: false, |
| | | }; |
| | | }, |
| | | methods: { |
| | | 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); |
| | | }); |
| | | 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); |
| | | }); |
| | | }, |
| | | handleClick() { |
| | | this.$emit('success', this.list); |
| | | } |
| | | this.$emit("success", this.list); |
| | | }, |
| | | }, |
| | | computed: { |
| | | dataSource() { |
| | | return this.list.map(item=>{ |
| | | return this.list.map((item) => { |
| | | return item; |
| | | }); |
| | | }, |
| | |
| | | parentModel: "", |
| | | parentName: "", |
| | | }; |
| | | if(this.list.length !== 0) { |
| | | if (this.list.length !== 0) { |
| | | let item = this.list[0]; |
| | | info.parentCode = item.parentCode; |
| | | info.parentModel = item.parentModel; |
| | | info.parentName = item.parentName; |
| | | } |
| | | return info; |
| | | } |
| | | }, |
| | | }, |
| | | mounted() { |
| | | |
| | | } |
| | | } |
| | | mounted() {}, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | <style lang="less" scoped> |
| | | .content-label, |
| | | .content-value { |
| | | font-weight: bold; |
| | |
| | | padding: 8px; |
| | | text-align: right; |
| | | } |
| | | .img-wraper { |
| | | width: 80px; |
| | | height: 50px; |
| | | display: inline-block; |
| | | .image-view { |
| | | width: 100%; |
| | | height: 100%; |
| | | /deep/img { |
| | | width: 100%; |
| | | height: 100%; |
| | | object-fit: contain; |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | import DrawUpload from "./DrawUpload"; |
| | | import DrawUpload from "./DrawUpload"; |
| | | export default DrawUpload; |
| | |
| | | * zip解析 新增物料 |
| | | * @returns |
| | | */ |
| | | export const zipParse = (data) => { |
| | | export const zipParse = (data) => { |
| | | return axios({ |
| | | method: "POST", |
| | | url: "componentApproving/zipParse", |
| | |
| | | show-search |
| | | :titles="['可用物料', '已选中']" |
| | | :list-style="{ |
| | | width: '374px', |
| | | width: '376px', |
| | | height: '200px', |
| | | }" |
| | | :operations="['添加', '移除']" |
| | | :operationStyle="{ |
| | | width: '92px', |
| | | textAlign: 'center' |
| | | textAlign: 'center', |
| | | }" |
| | | :target-keys="targetKeys" |
| | | :render="(item) => `${item.subCode} ${item.subName}`" |
| | |
| | | </a-col> |
| | | </a-row> |
| | | <a-row class="row" type="flex" :gutter="gutter"> |
| | | <a-col flex="7em" class="text-right"> |
| | | <!-- <a-col flex="7em" class="text-right"> |
| | | <span class="required">审核人</span> |
| | | </a-col> |
| | | <a-col flex="2"> |
| | | <a-select |
| | | show-search |
| | | v-model="info.nextUser" |
| | | placeholder="请选择审核人" |
| | | <a-col flex="2"> --> |
| | | <a-col flex="2.16"> |
| | | <a-form-model-item |
| | | class="ant-row-flex" |
| | | label="审核人" |
| | | :labelCol="{ flex: '7em' }" |
| | | :wrapperCol="{ flex: 1 }" |
| | | prop="nextUser" |
| | | > |
| | | <a-select-option |
| | | v-for="(item, key) in userList" |
| | | :key="'key' + key" |
| | | :value="item.id" |
| | | :title="item.name" |
| | | <a-select |
| | | show-search |
| | | v-model="info.nextUser" |
| | | placeholder="请选择审核人" |
| | | > |
| | | {{ item.name }} |
| | | </a-select-option> |
| | | </a-select> |
| | | <a-select-option |
| | | v-for="(item, key) in userList" |
| | | :key="'key' + key" |
| | | :value="item.id" |
| | | :title="item.name" |
| | | > |
| | | {{ item.name }} |
| | | </a-select-option> |
| | | </a-select> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col flex="7em" class="text-right"> |
| | | <!-- <a-col flex="7em" class="text-right"> |
| | | <span>工单描述</span> |
| | | </a-col> |
| | | </a-col> --> |
| | | <a-col flex="3"> |
| | | <a-textarea |
| | | placeholder="请输入图纸描述" |
| | | v-model="info.description" |
| | | :rows="4" |
| | | /> |
| | | <a-form-model-item |
| | | class="ant-row-flex" |
| | | label="工单描述" |
| | | :labelCol="{ flex: '7em' }" |
| | | :wrapperCol="{ flex: 1 }" |
| | | prop="description" |
| | | > |
| | | <a-textarea |
| | | placeholder="请输入图纸描述" |
| | | v-model="info.description" |
| | | :rows="4" |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | </a-layout-content> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { componentRelatedSubmit } from "../product/apis"; |
| | | import { getAllMaterialNoLimit, addCompentConnectBom } from "./apis"; |
| | | import { materialRelatedSubmit } from "../product/apis"; |
| | | import { getAllMaterialNoLimit } from "./apis"; |
| | | import { mapGetters } from "vuex"; |
| | | export default { |
| | | name: "", |
| | |
| | | ], |
| | | userList: [], |
| | | info: { |
| | | subModel: "", |
| | | removeId: "", |
| | | replace: false, |
| | | nextUser: "", |
| | | description: "", |
| | | }, |
| | | subList: [], |
| | | rules: { |
| | | subModel: [ |
| | | { |
| | | required: true, |
| | | message: "请选择要关联的产品子件", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | removeId: [ |
| | | { |
| | | required: true, |
| | | message: "请选择要解除关联的产品子件", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | nextUser: [ |
| | | { |
| | | required: true, |
| | |
| | | }; |
| | | }, |
| | | computed: { |
| | | subObj() { |
| | | const list = this.subList; |
| | | let res = null; |
| | | for (let i = 0, len = list.length; i < len; i++) { |
| | | if (list[i].subModel == this.info.subModel) { |
| | | res = list[i]; |
| | | break; |
| | | } |
| | | } |
| | | return res; |
| | | }, |
| | | linkList() { |
| | | if (this.isAdd) { |
| | | return []; |
| | | let { |
| | | comData: { mproductHistorys, products }, |
| | | isAdd, |
| | | } = this; |
| | | let _list = mproductHistorys.map((v) => v.materialId.toString()); |
| | | // 去重 |
| | | let list = [...new Set(_list)]; |
| | | if (isAdd) { |
| | | // 添加的时候 要取交集 (所有产品中都存在这个关联关系) |
| | | return list.filter((v) => { |
| | | return _list.filter((item) => v == item).length == products.length; |
| | | }); |
| | | } else { |
| | | return this.comData.mproductHistorys; |
| | | return list; |
| | | } |
| | | }, |
| | | ...mapGetters("account", [ |
| | |
| | | this.getAllMaterialNoLimit(); |
| | | }, |
| | | handleChange(targetKeys, direction, moveKeys) { |
| | | console.log(targetKeys, direction, moveKeys); |
| | | // console.log(targetKeys, direction, moveKeys); |
| | | this.targetKeys = targetKeys; |
| | | }, |
| | | getAllMaterialNoLimit() { |
| | |
| | | return { |
| | | ...v, |
| | | title: v.subModel, |
| | | key: "" + v.subCode, |
| | | key: "" + v.id, |
| | | }; |
| | | }); |
| | | } |
| | | if (this.isAdd) { |
| | | if (this.linkList.length) { |
| | | list.map((v) => { |
| | | if (this.linkList.some((val) => v.id == val)) { |
| | | v.disabled = true; |
| | | } |
| | | }); |
| | | } |
| | | } else { |
| | | if (this.linkList.length) { |
| | | list.map((v) => { |
| | | if (this.linkList.some((val) => v.id == val)) { |
| | | v.disabled = false; |
| | | } else { |
| | | v.disabled = true; |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | this.optionsData = [...list]; |
| | | this.targetKeys = components.map((v) => "" + v.subCode); |
| | | this.targetKeys = this.linkList.map((v) => v); |
| | | }); |
| | | }, |
| | | getUserByRoleId() { |
| | |
| | | } else { |
| | | this.userList = this.projectManagerList.map((item) => item); |
| | | } |
| | | }, |
| | | replaceChange(checked) { |
| | | // console.log(checked, 99) |
| | | this.info.replace = checked; |
| | | }, |
| | | checkForm() { |
| | | this.$refs.formRef.validate((valid) => { |
| | |
| | | }, |
| | | addLink() { |
| | | let { |
| | | subObj, |
| | | info: { replace }, |
| | | comData: { id }, |
| | | selectedRowKeys, |
| | | selectedRows, |
| | | targetKeys, |
| | | linkList, |
| | | info: { nextUser, description }, |
| | | comData: { subCode, subName }, |
| | | } = this; |
| | | let item = { |
| | | componentId: id, |
| | | parentModel: subObj.parentModel, |
| | | subName: subObj.subName, |
| | | quantity: subObj.quantity, |
| | | }; |
| | | if (!selectedRowKeys.length) { |
| | | this.$message.error("请选择要处理的产品"); |
| | | return false; |
| | | } |
| | | if (this.linkList.length == this.targetKeys.length) { |
| | | this.$message.error("请选择要添加关联关系的物料"); |
| | | return false; |
| | | } |
| | | let addedList = [], |
| | | removedList = [], |
| | | replacedList = []; |
| | | if (replace) { |
| | | replacedList = [item]; |
| | | } else { |
| | | addedList = [item]; |
| | | removedList = []; |
| | | selectedRows.forEach((v) => { |
| | | targetKeys |
| | | .filter((val) => !linkList.some((item) => item == val)) |
| | | .forEach((val) => { |
| | | if (!v.materialIds.some((item) => val == item)) { |
| | | addedList.push({ |
| | | parentCode: v.parentCode, |
| | | customCode: v.customCode, |
| | | materialId: val * 1, |
| | | subCode, |
| | | version: v.version, |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | if (!addedList.length) { |
| | | this.$message.warn('当前要添加的替换关系已存在,无需提交'); |
| | | return false; |
| | | } |
| | | let obj = { |
| | | addedList, |
| | | removedList, |
| | | replacedList, |
| | | main: { |
| | | nextUser: this.info.nextUser, |
| | | title: `对${subObj.parentModel}的修改`, |
| | | description: this.info.description, |
| | | nextUser, |
| | | title: `修改物料${subCode} ${subName}的替换关系`, |
| | | description, |
| | | }, |
| | | }; |
| | | componentRelatedSubmit(obj).then((res) => { |
| | | materialRelatedSubmit(obj).then((res) => { |
| | | res = res.data; |
| | | let { code, data, data2, msg } = res; |
| | | if (code && data) { |
| | |
| | | }, |
| | | removeLink() { |
| | | let { |
| | | selectedRowKeys, |
| | | selectedRows, |
| | | targetKeys, |
| | | linkList, |
| | | info: { removeId }, |
| | | comData: { id, subModel, subName }, |
| | | info: { nextUser, description }, |
| | | comData: { subCode, subName }, |
| | | } = this; |
| | | let removeO = linkList.filter((v) => removeId == v.id)[0]; |
| | | if (!selectedRowKeys.length) { |
| | | this.$message.error("请选择要处理的产品"); |
| | | return false; |
| | | } |
| | | if (this.linkList.length == this.targetKeys.length) { |
| | | this.$message.error("请选择要解除关联关系的物料"); |
| | | return false; |
| | | } |
| | | let addedList = [], |
| | | removedList = []; |
| | | selectedRows.forEach((v) => { |
| | | linkList |
| | | .filter((val) => !targetKeys.some((item) => item == val)) |
| | | .forEach((val) => { |
| | | if (v.materialIds.some((item) => val == item)) { |
| | | removedList.push({ |
| | | parentCode: v.parentCode, |
| | | customCode: v.customCode, |
| | | materialId: val * 1, |
| | | subCode, |
| | | version: v.version, |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | if (!removedList.length) { |
| | | this.$message.warn('当前要解除的替换关系不存在,无需解除'); |
| | | return false; |
| | | } |
| | | let obj = { |
| | | addedList: [], |
| | | removedList: [ |
| | | { |
| | | componentId: id, |
| | | parentModel: removeO.parentModel, |
| | | subName: removeO.subName, |
| | | quantity: removeO.quantity, |
| | | }, |
| | | ], |
| | | replacedList: [], |
| | | addedList, |
| | | removedList, |
| | | main: { |
| | | nextUser: this.info.nextUser, |
| | | title: `解除${subModel} ${subName} 与${removeO.parentModel} ${removeO.subName}的关联`, |
| | | description: this.info.description, |
| | | nextUser, |
| | | title: `修改物料${subCode} ${subName}的替换关系`, |
| | | description, |
| | | }, |
| | | }; |
| | | componentRelatedSubmit(obj).then((res) => { |
| | | materialRelatedSubmit(obj).then((res) => { |
| | | res = res.data; |
| | | let { code, data, data2, msg } = res; |
| | | if (code && data) { |
| | |
| | | this.spinning = true; |
| | | this.getAllMaterialNoLimit(); |
| | | this.getUserByRoleId(); |
| | | console.log(this.linkList, "90909"); |
| | | console.log(this.prodList, "909012129"); |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | removeLink(obj) { |
| | | this.isAdd = false; |
| | | this.component = obj; |
| | | this.prodList = obj.products; |
| | | this.editShow = true; |
| | | }, |
| | | // 删除散装件 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据母料型号查询子件信息及有关联的散装件信息 |
| | | * 批量修改关联关系 |
| | | * @returns |
| | | */ |
| | | export const componentRelatedSubmit = (data) => { |
| | | export const materialRelatedSubmit = (data) => { |
| | | return axios({ |
| | | method: "POST", |
| | | url: "worksheetMain/componentRelatedSubmit", |
| | | url: "worksheetMain/materialRelatedSubmit", |
| | | data |
| | | }) |
| | | } |
| | | /** |
| | | * 上传产品 |
| | | * @returns |
| | | */ |
| | | export const addProduct = (data) => { |
| | | return axios({ |
| | | method: "POST", |
| | | url: "worksheetMain/submit", |
| | | data |
| | | }) |
| | | } |
| | |
| | | <template slot="title"> |
| | | <span class="title">产品中心</span> |
| | | <a-space class="operator" style="margin-left: 1em"> |
| | | <a-button type="primary" @click="uploadProd">新增</a-button> |
| | | <a-upload |
| | | :before-upload="beforeUpload" |
| | | :showUploadList="false" |
| | | @change="pordUploadChange" |
| | | accept=".zip" |
| | | > |
| | | <a-button type="primary">新增</a-button> |
| | | </a-upload> |
| | | </a-space> |
| | | </template> |
| | | <template slot="action" slot-scope="{ record }"> |
| | | <a @click="upload(record)">上传软件</a> |
| | | <a-divider type="vertical"></a-divider> |
| | | <template v-if="downloadFlag"> |
| | | <a @click="download(record)">下载</a> |
| | | <a-divider type="vertical"></a-divider> |
| | | </template> |
| | | <a @click="edit(record)">编辑</a> |
| | | <a-divider type="vertical"></a-divider> |
| | | <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="downloadFlag" |
| | | type="primary" |
| | | @click="download(record)" |
| | | >下载</a-button |
| | | > |
| | | <a-button type="primary" @click="showCustom(record)" |
| | | >定制</a-button |
| | | > |
| | | </a-space> |
| | | <a>更多</a> |
| | | </a-popover> |
| | | </template> |
| | | </advance-table> |
| | | </a-card> |
| | |
| | | <a-modal |
| | | :visible="prodUploadShow" |
| | | :footer="null" |
| | | :width="500" |
| | | :width="960" |
| | | title="上传产品BOM" |
| | | :destroyOnClose="true" |
| | | :maskClosable="false" |
| | | @cancel="prodUploadCancel" |
| | | > |
| | | <prod-upload></prod-upload> |
| | | <draw-upload :list="resList" :y="320" :no-footer="true"></draw-upload> |
| | | <prod-upload |
| | | class="mt8" |
| | | @ok="submit" |
| | | @cancel="prodUploadCancel" |
| | | ></prod-upload> |
| | | </a-modal> |
| | | <!-- 定制 --> |
| | | <a-modal |
| | | :visible="customShow" |
| | | :footer="null" |
| | | :width="700" |
| | | title="产品定制" |
| | | :destroyOnClose="true" |
| | | :maskClosable="false" |
| | | @cancel="customCancel" |
| | | > |
| | | <prod-upload |
| | | class="mt8" |
| | | :prod-info="customProd" |
| | | @ok="custom" |
| | | @cancel="customCancel" |
| | | ></prod-upload> |
| | | </a-modal> |
| | | </div> |
| | | </template> |
| | |
| | | <script> |
| | | import AdvanceTable from "@/components/table/advance/AdvanceTable"; |
| | | import ChangeParts from "./changeParts"; |
| | | import ProdUpload from './prodUpload'; |
| | | import ProdUpload from "./prodUpload"; |
| | | import DrawUpload from "@/pages/components/drawUpload"; |
| | | |
| | | import getWebUrl from "@/assets/js/tools/getWebUrl"; |
| | | import { getList, downloadBom } from "./apis"; |
| | | import { addProduct, downloadBom } from "./apis"; |
| | | import { productSoftwareSubmit } from "../software/apis"; |
| | | import { zipParse } from "@/pages/workplace/myDraw/apis"; |
| | | import { mapGetters } from "vuex"; |
| | | |
| | | import createWs from "@/assets/js/websocket"; |
| | |
| | | prodData: {}, |
| | | userList: [], |
| | | file: null, |
| | | title: "", |
| | | fileUrl: "", |
| | | resList: [], |
| | | uploadShow: false, |
| | | customShow: false, |
| | | customProd: null, |
| | | editShow: false, |
| | | editObj: undefined, |
| | | selectedRowKeys: [], |
| | |
| | | components: { |
| | | AdvanceTable, |
| | | ChangeParts, |
| | | ProdUpload |
| | | ProdUpload, |
| | | DrawUpload, |
| | | }, |
| | | methods: { |
| | | onSearch(conditions, searchOptions) { |
| | |
| | | } |
| | | }, |
| | | // 新增产品 bom导入 |
| | | uploadProd() { |
| | | this.prodUploadShow = true; |
| | | pordUploadChange(data) { |
| | | let loading = this.$layer.loading(); |
| | | const formData = new FormData(); |
| | | formData.append("file", data.file); |
| | | zipParse(formData) |
| | | .then((res) => { |
| | | this.$layer.close(loading); |
| | | let { code, data, data2, data3, msg } = res.data; |
| | | if (code && data) { |
| | | this.resList = data2; |
| | | this.title = data3; |
| | | this.fileUrl = msg; |
| | | this.prodUploadShow = true; |
| | | this.$message.success("解析成功"); |
| | | } else { |
| | | this.$message.error(msg); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | this.$layer.close(loading); |
| | | console.log(error); |
| | | }); |
| | | }, |
| | | prodUploadCancel() { |
| | | this.prodUploadShow = false; |
| | | }, |
| | | submit(data) { |
| | | // console.log(data); |
| | | const { parentCode, parentModel, parentName } = this.resList[0]; |
| | | const param = { |
| | | nextUser: data.nextUser, |
| | | description: data.description, |
| | | title: this.title, |
| | | productApproving: { |
| | | bomApprovingList: this.resList.map((v) => ({ ...v, id: undefined })), |
| | | fileUrl: this.fileUrl, |
| | | customCode: data.customCode, |
| | | parentCode, |
| | | parentModel, |
| | | parentName, |
| | | }, |
| | | }; |
| | | addProduct(param).then((res) => { |
| | | const { code, data, msg } = res.data; |
| | | if (code && data) { |
| | | this.$message.success(msg); |
| | | this.prodUploadShow = false; |
| | | } else { |
| | | this.$message.error(msg); |
| | | } |
| | | }); |
| | | }, |
| | | showCustom(obj) { |
| | | this.customProd = obj; |
| | | this.customShow = true; |
| | | }, |
| | | custom(data) { |
| | | console.log(11); |
| | | const { id, parentCode, parentModel, parentName } = this.customProd; |
| | | const param = { |
| | | nextUser: data.nextUser, |
| | | description: data.description, |
| | | title: `对产品${parentName}的定制`, |
| | | productApproving: { |
| | | bomApprovingList: [ |
| | | { |
| | | id, |
| | | }, |
| | | ], |
| | | customCode: data.customCode, |
| | | parentCode, |
| | | parentModel, |
| | | parentName, |
| | | }, |
| | | }; |
| | | addProduct(param).then((res) => { |
| | | const { code, data, msg } = res.data; |
| | | if (code && data) { |
| | | this.$message.success(msg); |
| | | this.customShow = false; |
| | | } else { |
| | | this.$message.error(msg); |
| | | } |
| | | }); |
| | | }, |
| | | customCancel() { |
| | | this.customShow = false; |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | margin-left: 8px; |
| | | } |
| | | } |
| | | .mt8 { |
| | | margin-top: 8px; |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div class=""> |
| | | <a-row class="title"> |
| | | <a-col :span="6" class="text-right"> |
| | | <span>产品信息</span> |
| | | </a-col> |
| | | <a-col :span="15" :offset="1"> |
| | | <div class="lab"> |
| | | 母件编码: 123456 |
| | | 母件名称:123 |
| | | 母件型号:456 |
| | | 定制单号:无 |
| | | </div> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row class="upload"> |
| | | <a-col :span="15" :offset="7"> |
| | | <a-upload |
| | | :before-upload="beforeUpload" |
| | | @change="uploadChange" |
| | | accept=".zip" |
| | | > |
| | | <a-button type="primary">上传软件</a-button> |
| | | </a-upload> |
| | | </a-col> |
| | | <a-row v-if="prodInfo" class="row" type="flex"> |
| | | <a-col flex="8em" class="label">产品信息</a-col> |
| | | <a-col flex="1" |
| | | >{{ prodInfo.parentModel }} {{ prodInfo.parentName }}</a-col |
| | | > |
| | | </a-row> |
| | | <a-form-model |
| | | ref="formRef" |
| | |
| | | <a-row> |
| | | <a-col :span="24"> |
| | | <a-form-model-item |
| | | v-if="prodInfo" |
| | | class="ant-row-flex" |
| | | label="定制单号" |
| | | :labelCol="{ flex: '8em' }" |
| | | :wrapperCol="{ flex: 1 }" |
| | | prop="customCode1" |
| | | > |
| | | <a-input |
| | | placeholder="请输入定制单号" |
| | | v-model.trim="info.customCode1" |
| | | /> |
| | | </a-form-model-item> |
| | | <a-form-model-item |
| | | v-else |
| | | class="ant-row-flex" |
| | | label="定制单号" |
| | | :labelCol="{ flex: '8em' }" |
| | | :wrapperCol="{ flex: 1 }" |
| | | prop="customCode" |
| | | > |
| | | <a-input |
| | | placeholder="请输入定制单号" |
| | | v-model.trim="info.customCode" |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="10"> |
| | | <a-form-model-item |
| | | class="ant-row-flex" |
| | | label="审核人" |
| | | :labelCol="{ span: 6 }" |
| | | :wrapperCol="{ span: 15, offset: 1 }" |
| | | :labelCol="{ flex: '8em' }" |
| | | :wrapperCol="{ flex: 1 }" |
| | | prop="nextUser" |
| | | > |
| | | <a-select |
| | |
| | | </a-select> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="24"> |
| | | <a-col :span="14"> |
| | | <a-form-model-item |
| | | class="ant-row-flex" |
| | | label="工单描述" |
| | | :labelCol="{ span: 6 }" |
| | | :wrapperCol="{ span: 15, offset: 1 }" |
| | | :labelCol="{ flex: '8em' }" |
| | | :wrapperCol="{ flex: 1 }" |
| | | prop="description" |
| | | > |
| | | <a-textarea |
| | | placeholder="请输入工单描述" |
| | | v-model="info.description" |
| | | :rows="4" |
| | | :rows="2" |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | </a-form-model> |
| | | <div class="modal-footer"> |
| | | <a-button type="danger" @click="uploadCancel"> 取消 </a-button> |
| | | <a-button type="primary" @click="uploadCancel"> 提交审核 </a-button> |
| | | <a-button type="danger" @click="cancel"> 取消 </a-button> |
| | | <a-button type="primary" @click="ok"> 提交审核 </a-button> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | import { mapGetters } from "vuex"; |
| | | export default { |
| | | name: "", |
| | | |
| | | props: { |
| | | prodInfo: { |
| | | type: Object, |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | userList: [], |
| | | file: null, |
| | | info: { |
| | | nextUser: "", |
| | | description: "", |
| | | customCode: "", |
| | | customCode1: "", |
| | | }, |
| | | rules: { |
| | | nextUser: [ |
| | |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | customCode: [], |
| | | customCode1: [ |
| | | { |
| | | required: true, |
| | | message: "请输入定制单号", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | }; |
| | | }, |
| | | components: { |
| | | computed: { |
| | | ...mapGetters("account", [ |
| | | "roles", |
| | | "projectManagerList", |
| | |
| | | this.userList = this.projectManagerList.map((item) => item); |
| | | } |
| | | }, |
| | | beforeUpload() { |
| | | return false; |
| | | cancel() { |
| | | this.$emit("cancel"); |
| | | }, |
| | | uploadCancel() { |
| | | this.uploadShow = false; |
| | | }, |
| | | uploadSoftware() { |
| | | let obj = { |
| | | approving: { |
| | | parentModel: this.prodData.parentModel, |
| | | }, |
| | | main: { |
| | | nextUser: this.info.nextUser, |
| | | title: `为产品${this.prodData.parentModel}上传软件`, |
| | | description: this.info.description, |
| | | }, |
| | | }; |
| | | if (!this.file) { |
| | | this.$message.warning("请选择要上传的软件包"); |
| | | return false; |
| | | } |
| | | ok() { |
| | | this.$refs.formRef.validate((valid) => { |
| | | if (!valid) { |
| | | this.$message.error("存在未通过检验的表单项"); |
| | | return false; |
| | | } else { |
| | | const formData = new FormData(); |
| | | formData.append("multipartFile", this.file); |
| | | formData.append("mainDTOString", JSON.stringify(obj)); |
| | | // productSoftwareSubmit(formData) |
| | | // .then((res) => { |
| | | // // this.$layer.close(loadinobjobj |
| | | // let rs = res.data; |
| | | // if (rs.code == 1 && rs.data) { |
| | | // this.resList = rs.data2; |
| | | // this.title = rs.data3; |
| | | // this.resShow = true; |
| | | // this.$message.success(rs.msg); |
| | | // } else { |
| | | // this.$message.error(rs.msg); |
| | | // } |
| | | // }) |
| | | // .catch((error) => { |
| | | // // this.$layer.close(loading); |
| | | // console.log(error); |
| | | // }); |
| | | let { |
| | | info: { nextUser, description, customCode, customCode1 }, |
| | | prodInfo, |
| | | } = this; |
| | | let obj = prodInfo |
| | | ? { nextUser, description, customCode: customCode1 } |
| | | : { nextUser, description, customCode }; |
| | | this.$emit("ok", obj); |
| | | } |
| | | }); |
| | | }, |
| | | upload(record) { |
| | | this.prodData = record; |
| | | this.uploadShow = true; |
| | | }, |
| | | uploadChange(data) { |
| | | const { file, fileList } = data; |
| | | if (fileList.length > 1) { |
| | | fileList.shift(); |
| | | // console.log(file, fileList, "90909090"); |
| | | } |
| | | if (fileList.length) { |
| | | // this.file = fileList[0]; |
| | | // console.log(file == fileList[0], file == fileList[0].originFileObj) |
| | | this.file = fileList[0].originFileObj; |
| | | } else { |
| | | this.file = null; |
| | | } |
| | | }, |
| | | }, |
| | | |
| | |
| | | margin-left: 8px; |
| | | } |
| | | } |
| | | .row { |
| | | color: rgba(0, 0, 0, 0.85); |
| | | line-height: 30px; |
| | | .label { |
| | | text-align: right; |
| | | } |
| | | .label::after { |
| | | content: ":"; |
| | | position: relative; |
| | | top: -0.5px; |
| | | margin: 0 8px 0 2px; |
| | | } |
| | | } |
| | | </style> |
| | |
| | | // 设置审核表单 |
| | | this.formData.id = rsData.links[rsData.links.length-1].id; |
| | | this.formData.parentId = rsData.links[rsData.links.length-1].parentId, |
| | | this.formData.mainId = rsData.id; |
| | | this.formData.mainId = id; |
| | | }).catch(error=>{ |
| | | console.log(error); |
| | | this.$layer.close(loading); |