From a6e5c0dc4945125eea36c4c291ad12705fd96a38 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期五, 23 二月 2024 17:13:09 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override
---
north-glass-erp/northglass-erp/src/views/sd/product/CreateProduct.vue | 374 +++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 319 insertions(+), 55 deletions(-)
diff --git a/north-glass-erp/northglass-erp/src/views/sd/product/CreateProduct.vue b/north-glass-erp/northglass-erp/src/views/sd/product/CreateProduct.vue
index 5aa506f..9b3b751 100644
--- a/north-glass-erp/northglass-erp/src/views/sd/product/CreateProduct.vue
+++ b/north-glass-erp/northglass-erp/src/views/sd/product/CreateProduct.vue
@@ -1,8 +1,10 @@
<script setup>
import request from "@/utils/request"
-import deepClone from "@/utils/deepClone";
-import {ElMessage} from "element-plus";
-import {ref} from "vue";
+import deepClone from "@/utils/deepClone"
+import {ElMessage} from "element-plus"
+import {computed, ref} from "vue"
+import useUserInfo from "@/stores/userInfo"
+let userInfo = useUserInfo()
const disposeList = $ref([
'褰╅噳',
'钂欑爞',
@@ -10,22 +12,6 @@
'璐磋啘',
'鍠风爞',
'纾ㄨ竟'
-])
-let processList = $ref([
- '纾ㄨ竟',
- '闀�鑶�',
- '鍊掕',
- '娓呮礂',
- '鎵撳瓟',
- '鎸栫己',
- '鎸栨Ы',
- '姘村垏鍓�',
- '涓濆嵃',
- '鍗婇挗鍖�',
- '閽㈠寲',
- '澶瑰眰',
- '涓┖',
- '鍖呰'
])
let BasicData = ref({
stuffColor:null,
@@ -56,15 +42,66 @@
lowE:''
})
let processChecked = ref([])
-
+let hollowBasic = ref({
+ thickness:"",
+ gasType:"",
+ Type:"",
+ GlueDepth:""
+})
+let InterlayerBasic = ref({
+ thickness:"",
+ color:"",
+ type:""
+})
+let productDetailList = ref([])
+let productTotal = ref({
+ productName:'',
+ creator:userInfo.user.userName
+})
+//椤甸潰鍔犺浇璇锋眰
request.get(`/basicData/BasicDataByType/product`).then((res) => {
if(res.code==200){
- console.log(res.data)
BasicData.value = res.data
}else{
ElMessage.warning(res.msg)
}
})
+
+const saveProduct = () => {
+ if(productDetailList.value.length===0){
+ ElMessage.warning("璇锋坊鍔犱骇鍝佽鎯�")
+ return
+ }else if(productDetailList.value[productDetailList.value.length-1].detailType!=='glass'){
+ ElMessage.warning("浜у搧璇︽儏鏈�鍚庝竴鏉′笉鏄幓鐠冿紝璇峰畬鍠�")
+ return
+ }
+ let productName = ""
+ productDetailList.value.forEach(item =>{
+ switch(item.detailType){
+ case 'glass' :{
+ productName+=item.detail
+ break
+ }
+ case 'Interlayer' :{
+ productName+='+'+item.detail
+ }
+ case 'hollow' :{
+ productName+='*'+item.detail
+ }
+ }
+ })
+ productTotal.value.productName=productName
+ let product = {
+ title: productTotal.value,
+ detail:productDetailList.value
+ }
+ request.post(`/product/saveProduct`,product).then((res) =>{
+ if(res.code==200){
+ ElMessage.success(res.msg)
+ }
+ })
+}
+
const reset = () => {
processChecked.value=[]
@@ -72,6 +109,211 @@
stuff.value[item]=''
})
}
+
+
+
+const glassSure = () => {
+ let childName = ''
+ Object.keys(stuff.value).forEach((item,index)=>{
+ childName+=stuff.value[item]
+ })
+ let rege = /^\s*$/
+ if(rege.test(childName) || processChecked.value.length===0){
+ ElMessage.warning('璇疯緭鍏ヤ骇鍝佹潗鏂欏睘鎬т笌宸ヨ壓灞炴��')
+ return
+ }
+ let productDetail = {
+ detailType:'glass',
+ detail:childName,
+ process:processChecked.value.join('->'),
+ separation:Object.assign({}, stuff.value)
+ }
+ if(glassFlag.value.flag){
+ if(productDetailList.value.length ===0 ){
+ productDetailList.value.push(productDetail)
+ }else{
+ if (productDetailList.value[productDetailList.value.length-1].detailType === 'glass') {
+ ElMessage.warning('璇峰厛閫夋嫨闂撮殧鐗�')
+ return
+ }
+ productDetailList.value.push(productDetail)
+ }
+ }else{
+ productDetailList.value[glassFlag.value.index] = productDetail
+ }
+ reset()
+
+
+}
+
+//娣诲姞涓┖闂撮殧鐗�
+const addHollow = () => {
+ let childName = ''
+ try {
+ Object.keys(hollowBasic.value).forEach((item, index) => {
+ if (hollowBasic.value[item] === '') {
+ throw new Error("璇烽�夋嫨鍏ㄩ儴涓┖闂撮殧鐗╀笅鎷夋")
+ }
+ childName += hollowBasic.value[item]
+ })
+ }catch (e){
+ ElMessage.warning(e.message)
+ return
+ }
+
+ let hollowDetail = {
+ detailType:'hollow',
+ detail:childName,
+ separation:Object.assign({}, hollowBasic.value)
+ }
+ if(hollowFlag.value.flag){
+ if (productDetailList.value.length ===0) {
+ ElMessage.warning('璇峰厛閫夋嫨浜у搧')
+ return
+ }else if(productDetailList.value[productDetailList.value.length-1].detailType !== 'glass'){
+ ElMessage.warning('璇峰厛閫夋嫨浜у搧')
+ return
+ }
+ productDetailList.value.push(Object.assign({},hollowDetail))
+ }else {
+ productDetailList.value[hollowFlag.value.index] = hollowDetail
+ }
+ Object.keys(hollowBasic.value).forEach((item,index)=>{
+ hollowBasic.value[item]=''
+ })
+
+}
+//娣诲姞澶瑰眰闂撮殧鐗�
+const addInterlayer = () => {
+ let childName = ''
+ try {
+ Object.keys(InterlayerBasic.value).forEach((item, index) => {
+ if (InterlayerBasic.value[item] === '') {
+ throw new Error("璇烽�夋嫨鍏ㄩ儴涓┖闂撮殧鐗╀笅鎷夋")
+ }
+ childName += InterlayerBasic.value[item]
+ })
+ }catch (e){
+ ElMessage.warning(e.message)
+ return
+ }
+ let InterlayerDetail = {
+ detailType:'Interlayer',
+ detail:childName,
+ separation:Object.assign({}, InterlayerBasic.value)
+ }
+ if(InterlayerFlag.value.flag){
+ if (productDetailList.value.length ===0) {
+ ElMessage.warning('璇峰厛閫夋嫨浜у搧')
+ return
+ }else if(productDetailList.value[productDetailList.value.length-1].detailType !== 'glass'){
+ ElMessage.warning('璇峰厛閫夋嫨浜у搧')
+ return
+ }
+ productDetailList.value.push(Object.assign({},InterlayerDetail))
+ }else{
+ productDetailList.value[InterlayerFlag.value.index] = InterlayerDetail
+ }
+ Object.keys(InterlayerBasic.value).forEach((item,index)=>{
+ InterlayerBasic.value[item]=''
+ })
+}
+
+
+const deleteProductDetail = (index) => {
+ const detailType = productDetailList.value[index].detailType
+ switch (detailType) {
+ case 'glass':{
+ glassFlag.value = {
+ flag:true,
+ index:null
+ }
+ break
+ }
+ case 'Interlayer':{
+ InterlayerFlag.value = {
+ flag:true,
+ index:null
+ }
+ break
+ }
+ case 'hollow':{
+ hollowFlag.value = {
+ flag:true,
+ index:null
+ }
+ }
+ }
+ productDetailList.value.splice(index,1)
+}
+
+let glassFlag = ref({
+ flag:true,
+ index:null
+})
+const updateGlass = (index) => {
+ stuff.value = productDetailList.value[index].separation
+ processChecked.value = productDetailList.value[index].process.split("->")
+ glassFlag.value.flag=false
+ glassFlag.value.index=index
+}
+const updateGlassSure = ()=> {
+ glassSure()
+ glassFlag.value.flag=true
+ glassFlag.value.index=null
+}
+
+
+let InterlayerFlag = ref({
+ flag:true,
+ index:null
+})
+const updateInterlayer = (index) => {
+ InterlayerBasic.value = productDetailList.value[index].separation
+ InterlayerFlag.value.flag=false
+ InterlayerFlag.value.index=index
+}
+
+const updateInterlayerSure = () => {
+ addInterlayer()
+ InterlayerFlag.value.flag=true
+ InterlayerFlag.value.index=null
+}
+
+let hollowFlag = ref({
+ flag:true,
+ index:null
+})
+const updateHollow = (index) => {
+ hollowBasic.value = productDetailList.value[index].separation
+ hollowFlag.value.flag=false
+ hollowFlag.value.index=index
+}
+
+const updateHollowSure = () => {
+ addHollow()
+ hollowFlag.value.flag=true
+ hollowFlag.value.index=null
+}
+const productName = computed(() =>{
+ let productName = ""
+ productDetailList.value.forEach(item =>{
+ switch(item.detailType){
+ case 'glass' :{
+ productName+=item.detail
+ break
+ }
+ case 'Interlayer' :{
+ productName+='+'+item.detail
+ }
+ case 'hollow' :{
+ productName+='*'+item.detail
+ }
+ }
+ })
+ return productName
+})
+
</script>
<template>
@@ -180,6 +422,7 @@
<div class="glass-spacer">
<div class="glass-spacer-jc">
<el-select
+ v-model="hollowBasic.thickness"
size="small"
style="width: 100px"
clearable placeholder="*涓┖鍘氬害:" >
@@ -190,6 +433,7 @@
/>
</el-select>
<el-select
+ v-model="hollowBasic.gasType"
size="small"
style="width: 100px"
clearable placeholder="*鍏呮皵鏂瑰紡:" >
@@ -200,6 +444,7 @@
/>
</el-select>
<el-select
+ v-model="hollowBasic.Type"
size="small"
style="width: 100px"
clearable placeholder="*灏佽兌:" >
@@ -210,6 +455,7 @@
/>
</el-select>
<el-select
+ v-model="hollowBasic.GlueDepth"
size="small"
style="width: 100px"
clearable placeholder="*榛樿鑳舵繁:" >
@@ -220,13 +466,21 @@
/>
</el-select>
<el-button
+ v-if="hollowFlag.flag"
+ @click="addHollow"
size="small"
type="primary"
round>涓┖闂撮殧鐗�</el-button>
-
+ <el-button
+ v-else
+ @click="updateHollowSure"
+ size="small"
+ type="primary"
+ round>澶瑰眰闂撮殧鐗╀慨鏀�</el-button>
</div>
<div class="glass-spacer-zk">
<el-select
+ v-model="InterlayerBasic.thickness"
size="small"
style="width: 100px"
clearable placeholder="*澶瑰眰鍘氬害:" >
@@ -237,6 +491,7 @@
/>
</el-select>
<el-select
+ v-model="InterlayerBasic.type"
size="small"
style="width: 100px"
clearable placeholder="*绫诲瀷:" >
@@ -247,6 +502,7 @@
/>
</el-select>
<el-select
+ v-model="InterlayerBasic.color"
size="small"
style="width: 100px"
clearable placeholder="*棰滆壊:" >
@@ -257,10 +513,19 @@
/>
</el-select>
<el-button
+ v-if="InterlayerFlag.flag"
+ @click="addInterlayer"
size="small"
type="primary"
style="margin-left: 100px"
round>澶瑰眰闂撮殧鐗�</el-button>
+ <el-button
+ v-else
+ @click="updateInterlayerSure"
+ size="small"
+ type="primary"
+ style="margin-left: 100px"
+ round>澶瑰眰闂撮殧鐗╀慨鏀�</el-button>
</div>
</div>
<div class="line"/>
@@ -302,10 +567,16 @@
</el-col>
<el-col :span="3">
<div class="grid-content ep-bg-purple" >
- <el-button
+ <el-button v-if="glassFlag.flag"
+ @click="glassSure"
size="small"
type="primary"
round>纭</el-button>
+ <el-button v-else
+ @click="updateGlassSure"
+ size="small"
+ type="primary"
+ round>淇敼</el-button>
</div>
</el-col>
</el-row>
@@ -368,64 +639,57 @@
</el-col>
<el-col :span="20">
<div class="grid-content ep-bg-purple" >
- <el-input size="large" disabled />
+ <el-input :value="productName" size="large" disabled />
</div>
</el-col>
</el-row>
</div>
<div class="glass-part-detail">
- <el-row style="width: 90%" >
- <el-col :span="4">
+ <el-row style="width: 90%" v-for="(item,index) in productDetailList">
+ <el-col :span="4" v-show="item.detailType === 'glass'">
<el-button
+ @click = "updateGlass(index)"
size="small"
- type="primary"
- round>淇敼鐜荤拑</el-button>
+ type="primary">淇敼鐜荤拑</el-button>
+ </el-col>
+ <el-col :span="4" v-show="item.detailType === 'Interlayer'">
+ <el-button
+ @click = "updateInterlayer(index)"
+ size="small"
+ type="primary">淇敼澶瑰眰</el-button>
+ </el-col>
+ <el-col :span="4" v-show="item.detailType === 'hollow'">
+ <el-button
+ @click = "updateHollow(index)"
+ size="small"
+ type="primary">淇敼涓┖</el-button>
</el-col>
<el-col :span="16">
<el-input
+ :value="item.detail"
value="5mm鐧界幓"
size="small"
disabled />
</el-col>
- </el-row>
- <el-row style="width: 90%" >
- <el-col :span="4">
+ <el-col
+ v-show="index+1 === productDetailList.length"
+ :span="4">
<el-button
+ @click="deleteProductDetail(index)"
size="small"
- type="primary"
- round>淇敼澶瑰眰</el-button>
- </el-col>
- <el-col :span="16">
- <el-input
- value="5mmPVB閫忔槑"
- size="small"
- disabled />
- </el-col>
- </el-row>
- <el-row style="width: 90%" >
- <el-col :span="4">
- <el-button
- size="small"
- type="primary"
- round>淇敼鐜荤拑</el-button>
- </el-col>
- <el-col :span="16">
- <el-input
- value="5mm鐧界幓"
- size="small"
- disabled />
+ type="primary">鍒犻櫎</el-button>
</el-col>
</el-row>
</div>
<el-button
+ @click="saveProduct"
style="float: right;
margin-right: 0.5rem;"
-
size="large"
type="primary"
- round>閲嶇疆</el-button>
+ round>鍒涘缓</el-button>
</div>
</div>
</template>
--
Gitblit v1.8.0