Browse Source

2025/7/31

java8
Aoi_Tori 6 months ago
parent
commit
0b30a2d723
  1. 1
      src/api/chooselist/chooselist.js
  2. 10
      src/api/part/partInformation.js
  3. 3
      src/api/part/quicklyCreateBom.js
  4. 136
      src/utils/directives.js
  5. 522
      src/views/modules/part/part_create.vue
  6. 1483
      src/views/modules/part/quicklyCreateBom.vue
  7. 301
      src/views/modules/part/routing_create.vue

1
src/api/chooselist/chooselist.js

@ -2,6 +2,7 @@ import { createAPI } from "@/utils/httpRequest.js";
export const getChooselist = data => createAPI(`/chooselist/getChooselist/${data.tagNo}`,'get',data)
export const getChooselist1 = data => createAPI(`/chooselist/getChooselist`,'post',data)
export const getChooselistData = data => createAPI(`/chooselist/getChooselistData`,'post',data)

10
src/api/part/partInformation.js

@ -143,6 +143,8 @@ export const deleteLocation = data => createAPI(`/part/partInformation/deleteLoc
* 修改物料属性值
*/
export const commitItemValue = data => createAPI(`/part/partInformation/commitItemValue`,'post',data)
export const commitItemsValue = data => createAPI(`/part/partInformation/commitItemsValue`,'post',data)
export const batchUpdateItem = data => createAPI(`/part/partInformation/batchUpdateItem`,'post',data)
/**
* 删除模板属性
@ -158,11 +160,13 @@ export const getItemLists = data => createAPI(`/part/partInformation/getItemList
* 新增物料属性
*/
export const addPartItem = data => createAPI(`/part/partInformation/addPartItem`,'post',data)
export const addPartsItem = data => createAPI(`/part/partInformation/addPartsItem`,'post',data)
/**
* 删除物料属性
*/
export const deletePartItem = data => createAPI(`/part/partInformation/deletePartItem`,'post',data)
export const deletePartsItem = data => createAPI(`/part/partInformation/deletePartsItem`,'post',data)
/**
* 查询未选择的物料属性
@ -201,3 +205,9 @@ export const handleQueryPartByPage = (data) => createAPI(`/part/partInformation/
export const getPreviousPartNo = data => createAPI(`/part/partInformation/getPreviousPartNo`,'post',data)
export const partInfoByMainPart = data => createAPI(`/part/partInformation/partInfoByMainPart`,'post',data)
export const batchUpdateCodeNo = data => createAPI(`/part/partInformation/batchUpdateCodeNo`,'post',data)
export const batchSavePartInfo = data => createAPI(`/part/partInformation/batchSavePartInfo`,'post',data)

3
src/api/part/quicklyCreateBom.js

@ -13,3 +13,6 @@ export const batchBuildInfo = data => createAPI(`/part/quicklyBom/batchBuildInfo
export const resetNodePartInfo = data => createAPI(`/part/quicklyBom/resetNodePartInfo`,'post',data)
export const getPartInfoByNo = data => createAPI(`/part/quicklyBom/getPartInfoByNo`,'post',data)
export const saveMainPartInfo = data => createAPI(`/part/quicklyBom/saveMainPartInfo`,'post',data)
export const templateAdd = data => createAPI(`/part/quicklyBom/templateAdd`,'post',data)
export const getTemplateList = data => createAPI(`/part/quicklyBom/getTemplateList`,'post',data)
export const chooseTemplate = data => createAPI(`/part/quicklyBom/chooseTemplate`,'post',data)

136
src/utils/directives.js

@ -1,3 +1,85 @@
// import Vue from 'vue';
//
// // v-dialogDrag: 弹窗拖拽属性
// Vue.directive('drag', {
// bind(el, binding, vnode, oldVnode) {
// const dialogHeaderEl = el.querySelector('.el-dialog__header');
// const dragDom = el.querySelector('.el-dialog');
//
// dialogHeaderEl.style.cssText += ';cursor:move;'
// dragDom.style.cssText += ';top:0px;'
//
// // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
// const sty = (() => {
// if (window.document.currentStyle) {
// return (dom, attr) => dom.currentStyle[attr];
// } else {
// return (dom, attr) => getComputedStyle(dom, false)[attr];
// }
// })()
//
// dialogHeaderEl.onmousedown = (e) => {
// // 鼠标按下,计算当前元素距离可视区的距离
// const disX = e.clientX - dialogHeaderEl.offsetLeft;
// const disY = e.clientY - dialogHeaderEl.offsetTop;
//
// const screenWidth = document.body.clientWidth; // body当前宽度
// const screenHeight = document.documentElement.clientHeight; // 可见区域高度(应为body高度,可某些环境下无法获取)
//
// const dragDomWidth = dragDom.offsetWidth; // 对话框宽度
// const dragDomheight = dragDom.offsetHeight; // 对话框高度
//
// const minDragDomLeft = dragDom.offsetLeft;
// const maxDragDomLeft = screenWidth - dragDom.offsetLeft - dragDomWidth;
//
// const minDragDomTop = dragDom.offsetTop;
// const maxDragDomTop = screenHeight - dragDom.offsetTop - dragDomheight;
//
//
// // 获取到的值带px 正则匹配替换
// let styL = sty(dragDom, 'left');
// let styT = sty(dragDom, 'top');
//
// // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
// if (styL.includes('%')) {
// styL = +document.body.clientWidth * (+styL.replace(/\%/g, '') / 100);
// styT = +document.body.clientHeight * (+styT.replace(/\%/g, '') / 100);
// } else {
// styL = +styL.replace(/\px/g, '');
// styT = +styT.replace(/\px/g, '');
// };
//
// document.onmousemove = function (e) {
// // 通过事件委托,计算移动的距离
// let left = e.clientX - disX;
// let top = e.clientY - disY;
//
// // 边界处理
// if (-(left) > minDragDomLeft) {
// left = -(minDragDomLeft);
// } else if (left > maxDragDomLeft) {
// left = maxDragDomLeft;
// }
//
// if (-(top) > minDragDomTop) {
// top = -(minDragDomTop);
// } else if (top > maxDragDomTop) {
// top = maxDragDomTop;
// }
//
// // 移动当前元素
// dragDom.style.cssText += `;left:${left + styL}px;top:${top + styT}px;`;
// };
//
// document.onmouseup = function (e) {
// document.onmousemove = null;
// document.onmouseup = null;
// };
// }
// }
// })
import Vue from 'vue';
// v-dialogDrag: 弹窗拖拽属性
@ -19,6 +101,8 @@ Vue.directive('drag', {
})()
dialogHeaderEl.onmousedown = (e) => {
// 获取鼠标按下时的坐标
e.preventDefault();
// 鼠标按下,计算当前元素距离可视区的距离
const disX = e.clientX - dialogHeaderEl.offsetLeft;
const disY = e.clientY - dialogHeaderEl.offsetTop;
@ -50,25 +134,56 @@ Vue.directive('drag', {
};
document.onmousemove = function (e) {
// 移动时禁止默认事件
e.preventDefault();
// 通过事件委托,计算移动的距离
let left = e.clientX - disX;
let top = e.clientY - disY;
// 边界处理
if (-(left) > minDragDomLeft) {
left = -(minDragDomLeft);
} else if (left > maxDragDomLeft) {
left = maxDragDomLeft;
/* if (-(left) > minDragDomLeft) {
left = -(minDragDomLeft);
} else if (left > maxDragDomLeft) {
left = maxDragDomLeft;
}
if (-(top) > minDragDomTop) {
top = -(minDragDomTop);
} else if (top > maxDragDomTop) {
top = maxDragDomTop;
}*/
// 设置最大和最小可拖动范围
const viewportWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
const viewportHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
let minLeft = 0;
let maxLeft = viewportWidth - dragDom.offsetWidth;
let minTop = 0;
let maxTop = viewportHeight - dragDom.offsetHeight;
if (dragDom.offsetHeight > viewportHeight) {
// 只有当内容过高时才放宽顶部限制
minTop = Math.max(
-(dragDom.offsetHeight - 100), // 至少保留 100px 高度可见
-(dragDom.offsetHeight - viewportHeight)
);
maxTop = 0;
}
if (-(top) > minDragDomTop) {
top = -(minDragDomTop);
} else if (top > maxDragDomTop) {
top = maxDragDomTop;
}
// 应用边界限制
// left = Math.max(minLeft, Math.min(left, maxLeft));
top = Math.max(minTop, Math.min(top, maxTop));
// 应用新的边界限制
// left = Math.max(minLeft, Math.min(left, maxLeft));
top = Math.max(minTop, Math.min(top, maxTop));
// 移动当前元素
dragDom.style.cssText += `;left:${left + styL}px;top:${top + styT}px;`;
// dragDom.style.cssText += `;left:${left + styL}px;top:${top + styT}px;`;
dragDom.style.transform = `translate(${left + styL}px, ${top + styT}px)`;
// 让拖动更平滑
// dragDom.style.cssText += ';top:0px;position:relative;transition: transform 0.2s ease;';
};
document.onmouseup = function (e) {
@ -78,3 +193,4 @@ Vue.directive('drag', {
}
}
})

522
src/views/modules/part/part_create.vue

@ -1,22 +1,22 @@
<template>
<div>
<!-- 物料新增/编辑模态框 -->
<el-dialog :title="modalData.title" top="18vh" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="1000px">
<el-dialog :title="modalData.title" top="18vh" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="1100px">
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules">
<el-form-item label="物料编码" prop="partNo">
<el-input v-model="modalData.partNo" disabled style="width: 128px"></el-input>
</el-form-item>
<el-form-item label="物料描述" prop="partDesc" style="margin-left: -10px">
<el-input v-model="modalData.partDesc" clearable style="width: 346px"></el-input>
<el-input v-model="modalData.partDesc" clearable style="width: 396px"></el-input>
</el-form-item>
<el-form-item label="物料描述(英文)">
<el-input v-model="modalData.partDesceEn" style="width: 477px"></el-input>
<el-input v-model="modalData.partDesceEn" style="width: 527px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
<el-form-item prop="spec" label="规格">
<el-input v-model="modalData.spec" style="width: 477px"></el-input>
<el-input v-model="modalData.spec" style="width: 527px"></el-input>
</el-form-item>
<el-form-item label="BU" prop="bu">
<el-select v-model="modalData.bu" placeholder="请选择" @change="getPreviousPartNo" :disabled="modalDisableFlag" style="width: 90px">
@ -41,6 +41,17 @@
<el-option label="原材料" value="Purchased (raw)"></el-option>
</el-select>
</el-form-item>
<el-form-item label="模板(新增)">
<span style="cursor: pointer" slot="label" @click="handleTemplateAdd"><a herf="#">模板(新增)</a></span>
<el-select v-model="modalData.tempNo" @change="chooseTemplate" style="width: 105px">
<el-option
v-for="option in templateList"
:key="option.templateNo"
:label="option.templateName"
:value="option.templateNo">
</el-option>
</el-select>
</el-form-item>
<el-form-item v-if="modalData.flag === '1'" style="margin-top: 23px">
<el-checkbox v-model="modalData.tblBaseFlag" true-label="Y">复制属性({{previousPartNo}})</el-checkbox>
</el-form-item>
@ -52,64 +63,75 @@
<el-form-item prop="umId2">
<span style="cursor: pointer" slot="label" @click="getBaseList(510)"><a herf="#">计量单位</a></span>
<el-input v-model="modalData.umId2" @blur="umIdBlur(510)" style="width: 128px"></el-input>
<el-input v-model="modalData.umName" disabled style="width: 330px"></el-input>
<el-input v-model="modalData.umName" disabled style="width: 380px"></el-input>
</el-form-item>
<el-form-item v-if="modalData.partType2 === 'Purchased (raw)'" prop="familyID">
<span style="cursor: pointer" slot="label" @click="getBaseList(214)"><a herf="#">物料分类</a></span>
<el-input v-model="modalData.familyID" @blur="partFamilyBlur(214)" style="width: 128px"></el-input>
<el-input v-model="modalData.familyName" disabled style="width: 330px"></el-input>
<el-input v-model="modalData.familyName" disabled style="width: 380px"></el-input>
</el-form-item>
<el-form-item v-else>
<span style="cursor: pointer" slot="label" @click="getBaseList(214)"><a herf="#">物料分类</a></span>
<el-input v-model="modalData.familyID" @blur="partFamilyBlur(214)" style="width: 128px"></el-input>
<el-input v-model="modalData.familyName" disabled style="width: 330px"></el-input>
<el-input v-model="modalData.familyName" disabled style="width: 380px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
<el-form-item v-if="modalData.partType2 === 'Purchased (raw)'">
<span style="cursor: pointer" slot="label" @click="getBaseList(211)"><a herf="#">商品组1</a></span>
<el-input v-model="modalData.productGroupId1" @blur="productGroupId1Blur(211)" style="width: 128px"></el-input>
<el-input v-model="modalData.productGroupName1" disabled style="width: 330px"></el-input>
<el-input v-model="modalData.productGroupName1" disabled style="width: 380px"></el-input>
</el-form-item>
<el-form-item v-else prop="productGroupId1">
<span style="cursor: pointer" slot="label" @click="getBaseList(211)"><a herf="#">商品组1</a></span>
<el-input v-model="modalData.productGroupId1" @blur="productGroupId1Blur(211)" style="width: 128px"></el-input>
<el-input v-model="modalData.productGroupName1" disabled style="width: 330px"></el-input>
<el-input v-model="modalData.productGroupName1" disabled style="width: 380px"></el-input>
</el-form-item>
<el-form-item v-if="modalData.partType2 === 'Purchased (raw)'">
<span style="cursor: pointer" slot="label" @click="getBaseList(212)"><a herf="#">商品组2</a></span>
<el-input v-model="modalData.productGroupId2" @blur="productGroupId2Blur(212)" style="width: 128px"></el-input>
<el-input v-model="modalData.productGroupName2" disabled style="width: 330px"></el-input>
<el-input v-model="modalData.productGroupName2" disabled style="width: 380px"></el-input>
</el-form-item>
<el-form-item v-else prop="productGroupId2">
<span style="cursor: pointer" slot="label" @click="getBaseList(212)"><a herf="#">商品组2</a></span>
<el-input v-model="modalData.productGroupId2" @blur="productGroupId2Blur(212)" style="width: 128px"></el-input>
<el-input v-model="modalData.productGroupName2" disabled style="width: 330px"></el-input>
<el-input v-model="modalData.productGroupName2" disabled style="width: 380px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
<el-form-item>
<span style="cursor: pointer" slot="label" @click="getBaseList(213)"><a herf="#">商品组3</a></span>
<el-input v-model="modalData.productGroupId3" @blur="productGroupId3Blur(213)" style="width: 128px"></el-input>
<el-input v-model="modalData.productGroupName3" disabled style="width: 330px"></el-input>
<el-input v-model="modalData.productGroupName3" disabled style="width: 380px"></el-input>
</el-form-item>
<el-form-item prop="codeNo">
<span style="cursor: pointer" v-if="!modalDisableFlag" slot="label" @click="getBaseList(219)"><a herf="#">属性模板</a></span>
<span v-else slot="label">属性模板</span>
<el-input v-model="modalData.codeNo" :disabled="modalDisableFlag" @blur="modelBlur(219)" style="width: 128px"></el-input>
<el-input v-model="modalData.codeDesc" disabled style="width: 330px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
<el-form-item>
<span style="cursor: pointer" slot="label" @click="getBaseList(518)"><a herf="#">BOM模板</a></span>
<el-input v-model="modalData.templateNo" @blur="bomTemplateBlur(518)" style="width: 128px"></el-input>
<el-input v-model="modalData.templateName" disabled style="width: 330px"></el-input>
<el-input v-model="modalData.codeDesc" disabled style="width: 380px"></el-input>
</el-form-item>
</el-form>
<div v-show="modalData.partType2==='Manufactured'" >
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
<el-form-item prop="templateNo">
<span style="cursor: pointer" slot="label" @click="getBaseList(518)"><a herf="#">BOM模板</a></span>
<el-input v-model="modalData.templateNo" @blur="bomTemplateBlur(518)" style="width: 128px"></el-input>
<el-input v-model="modalData.templateName" disabled style="width: 380px"></el-input>
</el-form-item>
</el-form>
</div>
<div v-show="modalData.partType2!=='Manufactured'">
<el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">
<el-form-item>
<span style="cursor: pointer" slot="label" @click="getBaseList(518)"><a herf="#">BOM模板</a></span>
<el-input v-model="modalData.templateNo" @blur="bomTemplateBlur(518)" style="width: 128px"></el-input>
<el-input v-model="modalData.templateName" disabled style="width: 380px"></el-input>
</el-form-item>
</el-form>
</div>
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
<el-form-item label="备注" style="height: 135px">
<el-input type="textarea" v-model="modalData.remark" :rows="5" resize='none' show-word-limit style="width: 939px"></el-input>
<el-input type="textarea" v-model="modalData.remark" :rows="5" resize='none' show-word-limit style="width: 1039px"></el-input>
</el-form-item>
</el-form>
</el-tab-pane>
@ -744,6 +766,67 @@
</el-footer>
</el-dialog>
<el-dialog :title="'模板新增'" top="18vh" :close-on-click-modal="false" v-drag :visible.sync="templateAddFlag" width="850px">
<el-form :inline="true" :rules="tempRules" label-position="top" :model="tempData" style="margin-top: -5px;">
<el-form-item label="BU" prop="bu">
<el-select v-model="tempData.bu" placeholder="请选择" @change="getPreviousPartNo" style="width: 127px">
<el-option
v-for = "i in userBuList"
:key = "i.buNo"
:label = "i.buDesc"
:value = "i.buNo">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="模板编码" prop="templateNo">
<el-input v-model="tempData.templateNo" clearable style="width: 240px"></el-input>
</el-form-item>
<el-form-item label="模板名称" prop="templateName">
<el-input v-model="tempData.templateName" clearable style="width: 380px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" :rules="tempRules" label-position="top" :model="tempData" style="margin-top: -5px;">
<el-form-item prop="umId">
<span style="cursor: pointer" slot="label" @click="getBaseList(510)"><a herf="#">计量单位</a></span>
<el-input v-model="tempData.umName" disabled style="width: 380px"></el-input>
</el-form-item>
<el-form-item prop="familyId">
<span style="cursor: pointer" slot="label" @click="getBaseList(214)"><a herf="#">物料分类</a></span>
<el-input v-model="tempData.familyName" disabled style="width: 380px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" :rules="tempRules" label-position="top" :model="tempData" style="margin-top: -5px;">
<el-form-item prop="productGroupId1">
<span style="cursor: pointer" slot="label" @click="getBaseList(211)"><a herf="#">商品组1</a></span>
<el-input v-model="tempData.productGroupName1" disabled style="width: 380px"></el-input>
</el-form-item>
<el-form-item prop="productGroupId2">
<span style="cursor: pointer" slot="label" @click="getBaseList(212)"><a herf="#">商品组2</a></span>
<el-input v-model="tempData.productGroupName2" disabled style="width: 380px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" :rules="tempRules" label-position="top" :model="tempData" style="margin-top: -5px;">
<el-form-item prop="productGroupId3">
<span style="cursor: pointer" slot="label" @click="getBaseList(213)"><a herf="#">商品组3</a></span>
<el-input v-model="tempData.productGroupName3" disabled style="width: 380px"></el-input>
</el-form-item>
<el-form-item prop="codeNo">
<span style="cursor: pointer" slot="label" @click="getBaseList(219)"><a herf="#">属性模板</a></span>
<el-input v-model="tempData.codeDesc" disabled style="width: 380px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" :rules="tempRules" label-position="top" :model="tempData" style="margin-top: -5px;">
<el-form-item prop="bomTemplateNo">
<span style="cursor: pointer" slot="label" @click="getBaseList(518)"><a herf="#">BOM模板</a></span>
<el-input v-model="tempData.bomTemplateName" disabled style="width: 380px"></el-input>
</el-form-item>
</el-form>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="templateAdd">保存</el-button>
<el-button type="primary" @click="templateAddFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- chooseList模态框 -->
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
@ -799,6 +882,8 @@ import Chooselist from '@/views/modules/common/Chooselist_eam'
import partUploadFile from "./part_upload_file"
import {updateInquiryDetailStatusAndPart} from "../../../api/inquiry/inquiryDetail";
import {EventBus} from "../../../main";
import {getChooselist1} from "../../../api/chooselist/chooselist";
import {chooseTemplate, getTemplateList, templateAdd} from "../../../api/part/quicklyCreateBom";
export default {
name: 'partCreate',
components: {
@ -812,6 +897,45 @@ export default {
this.modalData.partNo = this.modalData.partNo.toUpperCase()
}
},
'modalData.bu': {
deep: true,
handler: function (newV, oldV) {
this.getTemplateList()
}
},
templateAddFlag: {
deep: true,
handler: function (newV, oldV) {
if (newV===false) {
this.tempData = {
site: this.$store.state.user.site,
bu: '',
templateNo: '',
templateName: '',
umId: '',
umName: '',
familyId: '',
familyName: '',
productGroupId1: '',
productGroupName1: '',
productGroupId2: '',
productGroupName2: '',
productGroupId3: '',
productGroupName3: '',
codeNo: '',
codeDesc: '',
bomTemplateNo: '',
bomTemplateName: '',
}
}
}
},
'tempData.bu': {
deep: true,
handler: function (newV, oldV) {
this.tempData.buNo = newV.split('_')[1]
}
}
},
props: {
initData:{
@ -850,10 +974,11 @@ export default {
flag: '',
title: '',
site: '',
buNo: '',
buNo: this.initData.buNo,
bu: '',
partNo: '',
partDesc: '',
tempNo: '',
umId2: '',
umName: '',
spec: '',
@ -881,6 +1006,28 @@ export default {
partBomStatus: '',
updateBy: ''
},
// tempData
tempData: {
site: this.$store.state.user.site,
bu: '',
buNo: '',
templateNo: '',
templateName: '',
umId: '',
umName: '',
familyId: '',
familyName: '',
productGroupId1: '',
productGroupName1: '',
productGroupId2: '',
productGroupName2: '',
productGroupId3: '',
productGroupName3: '',
codeNo: '',
codeDesc: '',
bomTemplateNo: '',
bomTemplateName: '',
},
itemData: {
site: this.$store.state.user.site,
partNo: '',
@ -958,6 +1105,7 @@ export default {
routingAlternativeList: [],
copyAttributeList: [],
fileList: [],
templateList: [],
// ======== ========
columnList: [
{
@ -1947,6 +2095,85 @@ export default {
trigger: ['blur','change']
}
],
templateNo: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
]
},
tempRules: {
bu: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
templateNo: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
templateName: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
umId: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
familyId: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
productGroupId1: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
productGroupId2: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
productGroupId3: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
codeNo: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
bomTemplateNo: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
]
},
// ======== ========
partSelections: [],
@ -1976,7 +2203,8 @@ export default {
uploadDialog: false,
menuId: this.$route.meta.menuId,
previousPartNo: '',
saveLoading: false
saveLoading: false,
templateAddFlag: false,
}
},
@ -2359,6 +2587,7 @@ export default {
commitItemValue(tempData).then(({data}) => {
if (data && data.code === 0) {
this.getPartItem()
this.$emit('update-part-item')
this.attributeDialog = true
this.$message({
message: '操作成功',
@ -3160,72 +3389,207 @@ export default {
this.$nextTick(() => {
let strVal = ''
let conSql = ''
if (this.modalData.bu === null || this.modalData.bu === '') {
this.$message.warning("请选择BU!")
return
if (!this.templateAddFlag){
if (this.modalData.bu === null || this.modalData.bu === '') {
this.$message.warning("请选择BU!")
return
} else {
conSql = " and site = '" + this.modalData.bu.split('_')[0] + "'" + " and bu_no = '" + this.modalData.bu.split('_')[1] + "'"
}
if (val === 510) {
strVal = this.modalData.umId2
conSql = " and site = '" + this.modalData.bu.split('_')[0] + "'"
} else if (val === 211) {
strVal = this.modalData.productGroupId1
} else if (val === 212) {
strVal = this.modalData.productGroupId2
} else if (val === 213) {
strVal = this.modalData.productGroupId3
} else if (val === 214) {
strVal = this.modalData.familyID
} else if (val === 219) {
strVal = this.modalData.codeNo
} else if (val === 518) {
strVal = this.modalData.templateNo
conSql = " and site = '" + this.modalData.bu.split('_')[0] + "'"
}
} else {
conSql = " and site = '" + this.modalData.bu.split('_')[0] + "'" + " and bu_no = '" + this.modalData.bu.split('_')[1] + "'"
}
if (val === 510) {
strVal = this.modalData.umId2
conSql = " and site = '" + this.modalData.bu.split('_')[0] + "'"
} else if (val === 211) {
strVal = this.modalData.productGroupId1
} else if (val === 212) {
strVal = this.modalData.productGroupId2
} else if (val === 213) {
strVal = this.modalData.productGroupId3
} else if (val === 214) {
strVal = this.modalData.familyID
} else if (val === 219) {
strVal = this.modalData.codeNo
} else if (val === 518) {
strVal = this.modalData.templateNo
conSql = " and site = '" + this.modalData.bu.split('_')[0] + "'"
if (this.tempData.bu === null || this.tempData.bu === '') {
this.$message.warning("请选择BU!")
return
} else {
conSql = " and site = '" + this.tempData.bu.split('_')[0] + "'" + " and bu_no = '" + this.tempData.bu.split('_')[1] + "'"
}
if (val === 510) {
strVal = this.tempData.umId
conSql = " and site = '" + this.tempData.bu.split('_')[0] + "'"
} else if (val === 211) {
strVal = this.tempData.productGroupId1
} else if (val === 212) {
strVal = this.tempData.productGroupId2
} else if (val === 213) {
strVal = this.tempData.productGroupId3
} else if (val === 214) {
strVal = this.tempData.familyID
} else if (val === 219) {
strVal = this.tempData.codeNo
} else if (val === 518) {
strVal = this.tempData.bomTemplateNo
conSql = " and site = '" + this.tempData.bu.split('_')[0] + "'"
}
}
this.$refs.baseList.init(val, strVal, conSql)
})
},
//
getBaseData (val) {
if (this.tagNo === 510) {
this.modalData.umId2 = val.UMID
this.modalData.umName = val.UMName
} else if (this.tagNo === 211) {
this.modalData.productGroupId1 = val.product_group_id
this.modalData.productGroupName1 = val.product_group_name
} else if (this.tagNo === 212) {
this.modalData.productGroupId2 = val.product_group_id
this.modalData.productGroupName2 = val.product_group_name
} else if (this.tagNo === 213) {
this.modalData.productGroupId3 = val.product_group_id
this.modalData.productGroupName3 = val.product_group_name
} else if (this.tagNo === 214) {
this.modalData.familyID = val.family_id
this.modalData.familyName = val.family_name
} else if (this.tagNo === 219) {
if (this.modalData.flag === '2') {
if (val.code_no != this.tempCodeNo) {
this.$confirm(`更换属性模板将替换下方物料属性数据,请确认?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.modalData.codeNo = val.code_no
this.$set(this.modalData, 'codeDesc', val.code_desc)
}).catch(() => {
})
if(!this.templateAddFlag){
if (this.tagNo === 510) {
this.modalData.umId2 = val.UMID
this.modalData.umName = val.UMName
} else if (this.tagNo === 211) {
this.modalData.productGroupId1 = val.product_group_id
this.modalData.productGroupName1 = val.product_group_name
} else if (this.tagNo === 212) {
this.modalData.productGroupId2 = val.product_group_id
this.modalData.productGroupName2 = val.product_group_name
} else if (this.tagNo === 213) {
this.modalData.productGroupId3 = val.product_group_id
this.modalData.productGroupName3 = val.product_group_name
} else if (this.tagNo === 214) {
this.modalData.familyID = val.family_id
this.modalData.familyName = val.family_name
} else if (this.tagNo === 219) {
if (this.modalData.flag === '2') {
if (val.code_no != this.tempCodeNo) {
this.$confirm(`更换属性模板将替换下方物料属性数据,请确认?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.modalData.codeNo = val.code_no
this.$set(this.modalData, 'codeDesc', val.code_desc)
}).catch(() => {
})
}
} else {
this.modalData.codeNo = val.code_no
this.$set(this.modalData, 'codeDesc', val.code_desc)
}
} else {
this.modalData.codeNo = val.code_no
this.$set(this.modalData, 'codeDesc', val.code_desc)
} else if (this.tagNo === 518) {
this.modalData.templateNo = val.template_no
this.modalData.templateName = val.template_name
}
} else {
if (this.tagNo === 510) {
this.tempData.umId = val.UMID
this.tempData.umName = val.UMName
} else if (this.tagNo === 211) {
this.tempData.productGroupId1 = val.product_group_id
this.tempData.productGroupName1 = val.product_group_name
} else if (this.tagNo === 212) {
this.tempData.productGroupId2 = val.product_group_id
this.tempData.productGroupName2 = val.product_group_name
} else if (this.tagNo === 213) {
this.tempData.productGroupId3 = val.product_group_id
this.tempData.productGroupName3 = val.product_group_name
} else if (this.tagNo === 214) {
this.tempData.familyId = val.family_id
this.tempData.familyName = val.family_name
} else if (this.tagNo === 219) {
this.tempData.codeNo = val.code_no
this.$set(this.tempData, 'codeDesc', val.code_desc)
} else if (this.tagNo === 518) {
this.tempData.bomTemplateNo = val.template_no
this.$set(this.tempData, 'bomTemplateName', val.template_name)
}
} else if (this.tagNo === 518) {
this.modalData.templateNo = val.template_no
this.modalData.templateName = val.template_name
}
},
templateAdd() {
if (this.tempData.bu === null || this.tempData.bu === ''){
this.$message.warning("请选择BU!")
return
}
if (this.tempData.templateNo === null || this.tempData.templateNo === ''){
this.$message.warning("请填写模板编码!")
return
}
if (this.tempData.templateName === null || this.tempData.templateName === ''){
this.$message.warning("请填写模板名称!")
return
}
if (this.tempData.umId === null || this.tempData.umId === ''){
this.$message.warning("请选择计量单位!")
return
}
if (this.tempData.familyId === null || this.tempData.familyId === ''){
this.$message.warning("请选择物料分类!")
return
}
if (this.tempData.productGroupId1 === null || this.tempData.productGroupId1 === ''){
this.$message.warning("请选择商品组1!")
return
}
if (this.tempData.productGroupId2 === null || this.tempData.productGroupId2 === ''){
this.$message.warning("请选择商品组2!")
return
}
if (this.tempData.productGroupId3 === null || this.tempData.productGroupId3 === ''){
this.$message.warning("请选择商品组3!")
return
}
if (this.tempData.codeNo === null || this.tempData.codeNo === ''){
this.$message.warning("请选择属性模板!")
return
}
if (this.tempData.bomTemplateNo === null || this.tempData.bomTemplateNo === ''){
this.$message.warning("请选择BOM模板!")
return
}
templateAdd(this.tempData).then(({data}) => {
if (data&&data.code===0){
this.getTemplateList()
this.templateAddFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
getTemplateList() {
this.modalData.buNo = this.modalData.bu.split('_')[1]
getTemplateList(this.modalData).then(({data}) => {
if (data && data.code === 0) {
this.templateList = data.rows
}
})
},
chooseTemplate(){
chooseTemplate(this.modalData).then(({data}) => {
if (data&&data.code===0) {
Object.keys(data.data).forEach(key => {
if (key !== 'tempNo') {
this.modalData[key] = data.data[key];
}
});
this.modalData.umId2 = data.data.umId
this.modalData.familyID = data.data.familyId
this.modalData.templateNo = data.data.bomTemplateNo
this.modalData.templateName = data.data.bomTemplateName
}
})
},
saveQuicklyCreate(){
let inData = {
id: this.initData.id,
@ -3244,6 +3608,10 @@ export default {
})
}
})
},
handleTemplateAdd() {
this.templateAddFlag = true
}
}
}

1483
src/views/modules/part/quicklyCreateBom.vue
File diff suppressed because it is too large
View File

301
src/views/modules/part/routing_create.vue

@ -400,6 +400,16 @@ export default {
components: {
ChooseList
},
watch: {
'subDetailList': {
deep: true,
handler: function (newV, oldV) {
newV.forEach(item => {
item.formula = this.getFormula(item.operationName)
})
}
}
},
name: 'routingCreate',
data() {
return {
@ -906,18 +916,18 @@ export default {
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
columnWidth: 120
},
{
userId: this.$store.state.user.name,
functionId: 601003,
serialNumber: '104003Table2RunTimeCodeDesc',
serialNumber: '104003Table2MachCycleTime',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'runTimeCodeDesc',
columnProp: 'machCycleTime',
headerAlign: 'center',
align: 'center',
columnLabel: '产出单位',
align: 'right',
columnLabel: '机器处理时间',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -929,13 +939,31 @@ export default {
{
userId: this.$store.state.user.name,
functionId: 601003,
serialNumber: '104003Table2MachSetupTime',
serialNumber: '104003Table2OperationName',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'machSetupTime',
columnProp: 'formula',
headerAlign: 'center',
align: 'right',
columnLabel: '机器调机时间',
align: 'left',
columnLabel: '计算公式',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 260
},
{
userId: this.$store.state.user.name,
functionId: 601003,
serialNumber: '104003Table2OperationName',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'crewSize',
headerAlign: 'center',
align: 'center',
columnLabel: '人数',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -947,13 +975,13 @@ export default {
{
userId: this.$store.state.user.name,
functionId: 601003,
serialNumber: '104003Table2SetupCrewSize',
serialNumber: '104003Table2OperationName',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'setupCrewSize',
columnProp: 'refSpeed',
headerAlign: 'center',
align: 'right',
columnLabel: '调机过程人数',
align: 'center',
columnLabel: '速度',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -965,13 +993,13 @@ export default {
{
userId: this.$store.state.user.name,
functionId: 601003,
serialNumber: '104003Table2SetupLaborClassDesc',
serialNumber: '104003Table2OperationName',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'setupLaborClassDesc',
columnProp: 'refTime',
headerAlign: 'center',
align: 'center',
columnLabel: '调机时人员等级',
columnLabel: '时间',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -983,13 +1011,13 @@ export default {
{
userId: this.$store.state.user.name,
functionId: 601003,
serialNumber: '104003Table2MachCycleTime',
serialNumber: '104003Table2OperationName',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'machCycleTime',
columnProp: 'refEfficiency',
headerAlign: 'center',
align: 'right',
columnLabel: '机器处理时间',
align: 'center',
columnLabel: '效率',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -998,16 +1026,52 @@ export default {
fixed: '',
columnWidth: 100
},
// {
// userId: this.$store.state.user.name,
// functionId: 601003,
// serialNumber: '104003Table2RunTimeCodeDesc',
// tableId: '104003Table2',
// tableName: 'Routing',
// columnProp: 'runTimeCodeDesc',
// headerAlign: 'center',
// align: 'center',
// columnLabel: '',
// columnHidden: false,
// columnImage: false,
// columnSortable: false,
// sortLv: 0,
// status: true,
// fixed: '',
// columnWidth: 100
// },
// {
// userId: this.$store.state.user.name,
// functionId: 601003,
// serialNumber: '104003Table2MachSetupTime',
// tableId: '104003Table2',
// tableName: 'Routing',
// columnProp: 'machSetupTime',
// headerAlign: 'center',
// align: 'right',
// columnLabel: '',
// columnHidden: false,
// columnImage: false,
// columnSortable: false,
// sortLv: 0,
// status: true,
// fixed: '',
// columnWidth: 100
// },
{
userId: this.$store.state.user.name,
functionId: 601003,
serialNumber: '104003Table2MachRunFactor',
serialNumber: '104003Table2SetupCrewSize',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'machRunFactor',
columnProp: 'setupCrewSize',
headerAlign: 'center',
align: 'right',
columnLabel: '机器单位产出',
columnLabel: '调机过程人数',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -1016,16 +1080,34 @@ export default {
fixed: '',
columnWidth: 100
},
// {
// userId: this.$store.state.user.name,
// functionId: 601003,
// serialNumber: '104003Table2SetupLaborClassDesc',
// tableId: '104003Table2',
// tableName: 'Routing',
// columnProp: 'setupLaborClassDesc',
// headerAlign: 'center',
// align: 'center',
// columnLabel: '',
// columnHidden: false,
// columnImage: false,
// columnSortable: false,
// sortLv: 0,
// status: true,
// fixed: '',
// columnWidth: 100
// },
{
userId: this.$store.state.user.name,
functionId: 601003,
serialNumber: '104003Table2CrewSize',
serialNumber: '104003Table2MachRunFactor',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'crewSize',
columnProp: 'machRunFactor',
headerAlign: 'center',
align: 'right',
columnLabel: '生产过程人数',
columnLabel: '机器单位产出',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -1037,13 +1119,13 @@ export default {
{
userId: this.$store.state.user.name,
functionId: 601003,
serialNumber: '104003Table2LaborClassNo',
serialNumber: '104003Table2CrewSize',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'laborClassDesc',
columnProp: 'crewSize',
headerAlign: 'center',
align: 'center',
columnLabel: '人员等级',
align: 'right',
columnLabel: '生产过程人数',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -1055,13 +1137,13 @@ export default {
{
userId: this.$store.state.user.name,
functionId: 601003,
serialNumber: '104003Table2LaborSetupTime',
serialNumber: '104003Table2LaborClassNo',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'laborSetupTime',
columnProp: 'laborClassDesc',
headerAlign: 'center',
align: 'right',
columnLabel: '人工调机时间',
align: 'center',
columnLabel: '人员等级',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -1070,6 +1152,24 @@ export default {
fixed: '',
columnWidth: 100
},
// {
// userId: this.$store.state.user.name,
// functionId: 601003,
// serialNumber: '104003Table2LaborSetupTime',
// tableId: '104003Table2',
// tableName: 'Routing',
// columnProp: 'laborSetupTime',
// headerAlign: 'center',
// align: 'right',
// columnLabel: '',
// columnHidden: false,
// columnImage: false,
// columnSortable: false,
// sortLv: 0,
// status: true,
// fixed: '',
// columnWidth: 100
// },
{
userId: this.$store.state.user.name,
functionId: 601003,
@ -1142,60 +1242,60 @@ export default {
fixed: '',
columnWidth: 100
},
{
userId: this.$store.state.user.name,
functionId: 601003,
serialNumber: '104003Table2WorkCenterDesc',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'workCenterDesc',
headerAlign: 'center',
align: 'center',
columnLabel: '加工中心名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},
{
userId: this.$store.state.user.name,
functionId: 601003,
serialNumber: '601003Table2WorkCenterType',
tableId: '601003Table2',
tableName: 'Routing工序表',
columnProp: 'workCenterType',
headerAlign: 'center',
align: 'center',
columnLabel: '加工中心类型',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},
{
userId: this.$store.state.user.name,
functionId: 601003,
serialNumber: '104003Table2OutsideOpItem',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'outsideOpItem',
headerAlign: 'center',
align: 'center',
columnLabel: '外协采购料号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},
// {
// userId: this.$store.state.user.name,
// functionId: 601003,
// serialNumber: '104003Table2WorkCenterDesc',
// tableId: '104003Table2',
// tableName: 'Routing',
// columnProp: 'workCenterDesc',
// headerAlign: 'center',
// align: 'center',
// columnLabel: '',
// columnHidden: false,
// columnImage: false,
// columnSortable: false,
// sortLv: 0,
// status: true,
// fixed: '',
// columnWidth: 120
// },
// {
// userId: this.$store.state.user.name,
// functionId: 601003,
// serialNumber: '601003Table2WorkCenterType',
// tableId: '601003Table2',
// tableName: 'Routing',
// columnProp: 'workCenterType',
// headerAlign: 'center',
// align: 'center',
// columnLabel: '',
// columnHidden: false,
// columnImage: false,
// columnSortable: false,
// sortLv: 0,
// status: true,
// fixed: '',
// columnWidth: 100
// },
// {
// userId: this.$store.state.user.name,
// functionId: 601003,
// serialNumber: '104003Table2OutsideOpItem',
// tableId: '104003Table2',
// tableName: 'Routing',
// columnProp: 'outsideOpItem',
// headerAlign: 'center',
// align: 'center',
// columnLabel: '',
// columnHidden: false,
// columnImage: false,
// columnSortable: false,
// sortLv: 0,
// status: true,
// fixed: '',
// columnWidth: 100
// },
{
userId: this.$store.state.user.name,
functionId: 601003,
@ -2567,6 +2667,31 @@ export default {
this.componentData.laborClassDesc = ''
},
getFormula(value) {
switch (value) {
case '一复': case '熟化': case 'RFID前道检品':
return '人数/(速度x时间x效率)'
case '印刷': case 'RFID-蚀刻': case 'RFID-分切':
return '人数/(速度x时间x效率)/Printing lanes'
case '绑定': case 'RFID编码': case 'RFID编码打印':
return '人数/(UPH(每小时产量)*效率)*1KCT'
case 'RFID多条检测':
return '人数/(速度x时间xCDx效率)*1KCT'
case 'RFID复合模切检测':
return '人数/(速度x时间x效率x(CDx复合列数))*1KCT'
case 'RFID后道检品':
return '人数/UPH(每小时产量)*100%*1KCT'
case 'RFID自动贴标':
return '人数/(速度x时间x效率x(CDx贴标列数))*1KCT'
case 'Voyantic在线检测':
return '人数/(速度x时间x效率x(CDx检测列数))*1KCT'
case 'RFID包装':
return '人数/(日产量/8小时/17人均摊)*1KCT'
default:
return ''
}
}
}
}
</script>

Loading…
Cancel
Save