| | |
| | | import request from "@/utils/request" |
| | | import deepClone from "@/utils/deepClone" |
| | | import {ElMessage} from "element-plus" |
| | | import {computed, ref} from "vue" |
| | | import {computed, onMounted, ref} from "vue" |
| | | import useUserInfo from "@/stores/userInfo" |
| | | import {useRouter,useRoute} from "vue-router" |
| | | import GlassType from "@/components/sd/product/GlassType.vue" |
| | | import useProductGlassTypeStore from "@/stores/sd/product/productGlassType" |
| | | |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | | let userInfo = useUserInfo() |
| | | const disposeList = $ref([ |
| | | '彩釉', |
| | |
| | | let productDetailList = ref([]) |
| | | let productTotal = ref({ |
| | | productName:'', |
| | | query:'', |
| | | remarks:'', |
| | | thickness:'', |
| | | totalThickness:'', |
| | | typeId:'', |
| | | creator:userInfo.user.userName |
| | | }) |
| | | |
| | | let productGlassTypeStore = useProductGlassTypeStore() |
| | | productGlassTypeStore.GlassType=['',''] |
| | | |
| | | //页面加载请求 |
| | | request.get(`/basicData/BasicDataByType/product`).then((res) => { |
| | | if(res.code==200){ |
| | |
| | | } |
| | | }) |
| | | |
| | | |
| | | onMounted(()=>{ |
| | | const str = route.query.id |
| | | if (typeof str === 'undefined' || str === null || str === '' || str === '\n' || str === '\r'){ |
| | | return |
| | | } |
| | | request.post(`/product/selectProductById/${str}`).then((res) => { |
| | | if(res.code==200){ |
| | | productDetailList.value = res.data.detail |
| | | productDetailList.value.forEach((item)=>{ |
| | | item.separation = JSON.parse(item.separation) |
| | | }) |
| | | productTotal.value = res.data.title |
| | | //BasicData.value = res.data |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | |
| | | }) |
| | | |
| | | const saveProduct = () => { |
| | | if(productDetailList.value.length===0){ |
| | | ElMessage.warning("请添加产品详情") |
| | |
| | | }else if(productDetailList.value[productDetailList.value.length-1].detailType!=='glass'){ |
| | | ElMessage.warning("产品详情最后一条不是玻璃,请完善") |
| | | return |
| | | }else if(productGlassTypeStore.GlassType[1]==='' || productGlassTypeStore.GlassType[1]===null){ |
| | | ElMessage.warning("请选择产品类别") |
| | | return |
| | | } |
| | | productTotal.value.typeId = productGlassTypeStore.GlassType[1] |
| | | |
| | | let productName = "" |
| | | productDetailList.value.forEach(item =>{ |
| | | switch(item.detailType){ |
| | |
| | | break |
| | | } |
| | | case 'Interlayer' :{ |
| | | productName+='+'+item.detail |
| | | productName+='+'+item.detail+"+" |
| | | break |
| | | } |
| | | case 'hollow' :{ |
| | | productName+='*'+item.detail |
| | | productName+='*'+item.detail+"*" |
| | | break |
| | | } |
| | | } |
| | | }) |
| | |
| | | } |
| | | request.post(`/product/saveProduct`,product).then((res) =>{ |
| | | if(res.code==200){ |
| | | ElMessage.success(res.msg) |
| | | ElMessage.success("创建成功") |
| | | router.push("/main/product/selectProduct") |
| | | } |
| | | }) |
| | | } |
| | | |
| | | //审核产品状态 |
| | | const updateProductState = (state) => { |
| | | request.post(`/product/updateProductStateById/${productTotal.value.id}/${state}`).then((res) =>{ |
| | | if(res.code==200){ |
| | | ElMessage.success("操作成功") |
| | | //router.go(0) |
| | | router.push({path:'/main/product/createProduct',query:{id:productTotal.value.id,random:Math.random()}}) |
| | | }else{ |
| | | ElMessage.error("操作失败") |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const reset = () => { |
| | | processChecked.value=[] |
| | |
| | | index:null |
| | | }) |
| | | const updateGlass = (index) => { |
| | | stuff.value = productDetailList.value[index].separation |
| | | Object.keys(stuff.value).forEach((item)=>{ |
| | | stuff.value[item]=productDetailList.value[index].separation[item] |
| | | }) |
| | | processChecked.value = productDetailList.value[index].process.split("->") |
| | | glassFlag.value.flag=false |
| | | glassFlag.value.index=index |
| | |
| | | index:null |
| | | }) |
| | | const updateInterlayer = (index) => { |
| | | InterlayerBasic.value = productDetailList.value[index].separation |
| | | Object.keys(InterlayerBasic.value).forEach((item)=>{ |
| | | InterlayerBasic.value[item]=productDetailList.value[index].separation[item] |
| | | }) |
| | | |
| | | InterlayerFlag.value.flag=false |
| | | InterlayerFlag.value.index=index |
| | | } |
| | |
| | | index:null |
| | | }) |
| | | const updateHollow = (index) => { |
| | | hollowBasic.value = productDetailList.value[index].separation |
| | | Object.keys(hollowBasic.value).forEach((item)=>{ |
| | | hollowBasic.value[item]=productDetailList.value[index].separation[item] |
| | | }) |
| | | |
| | | hollowFlag.value.flag=false |
| | | hollowFlag.value.index=index |
| | | } |
| | |
| | | break |
| | | } |
| | | case 'Interlayer' :{ |
| | | productName+='+'+item.detail |
| | | productName+='+'+item.detail+"+" |
| | | break |
| | | } |
| | | case 'hollow' :{ |
| | | productName+='*'+item.detail |
| | | productName+='*'+item.detail+"*" |
| | | break |
| | | } |
| | | } |
| | | }) |
| | | return productName |
| | | }) |
| | | |
| | | |
| | | |
| | | </script> |
| | | |
| | |
| | | boxShadow: `var(--el-box-shadow-lighter)`, |
| | | }" |
| | | > |
| | | |
| | | <div class="glass-dispose"> |
| | | <!-- <h5>表面处理</h5>--> |
| | | <!-- <h5>玻璃类别</h5>--> |
| | | <div class="glass-dispose-detail"> |
| | | <glass-type style="float: left;margin-left: -0.5rem" /> |
| | | <!-- <div v-for="n in 2" class="glass-dispose-detail-1"> |
| | | <p style="writing-mode: vertical-rl;"> |
| | | {{n===1?'第一面':'第二面'}} |
| | | </p> |
| | | <div class="glass-dispose-detail-list" |
| | | v-for="(item,index) in disposeList" |
| | | > |
| | | <el-checkbox |
| | | :label="item" size="large" /> |
| | | <el-input |
| | | v-if="index==0 && n==1" |
| | | class="dispose-input" |
| | | size="small" |
| | | clearable /> |
| | | </div> |
| | | |
| | | </div>--> |
| | | </div> |
| | | </div> |
| | | <div class="line"/> |
| | | |
| | | <div class="glass-type"> |
| | | <h5>材料属性</h5> |
| | | <el-row :gutter="50"> |
| | |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <div class="line"/> |
| | | <div class="glass-dispose"> |
| | | <h5>表面处理</h5> |
| | | <div class="glass-dispose-detail"> |
| | | <div v-for="n in 2" class="glass-dispose-detail-1"> |
| | | <p style="writing-mode: vertical-rl;"> |
| | | {{n===1?'第一面':'第二面'}} |
| | | </p> |
| | | <div class="glass-dispose-detail-list" |
| | | v-for="(item,index) in disposeList" |
| | | > |
| | | <el-checkbox |
| | | :label="item" size="large" /> |
| | | <el-input |
| | | v-if="index==0 && n==1" |
| | | class="dispose-input" |
| | | size="small" |
| | | clearable /> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | <div class="line"/> |
| | | <div class="glass-process"> |
| | | <h5>工艺属性</h5> |
| | |
| | | style="margin-left: 0.5rem;text-align: center"> |
| | | 快速查询: |
| | | </el-text> |
| | | <el-input size="small" disabled /> |
| | | <el-input v-model="productTotal.query" size="small" disabled /> |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="5"> |
| | |
| | | style="margin-left: 0.5rem;text-align: center"> |
| | | 计重厚度: |
| | | </el-text> |
| | | <el-input size="small" disabled /> |
| | | <el-input v-model="productTotal.thickness" size="small" disabled /> |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="5"> |
| | |
| | | style="margin-left: 0.5rem;text-align: center"> |
| | | 厚度: |
| | | </el-text> |
| | | <el-input size="small" disabled /> |
| | | <el-input v-model="productTotal.totalThickness" size="small" disabled /> |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="5"> |
| | |
| | | style="margin-left: 0.5rem;text-align: center"> |
| | | 备注: |
| | | </el-text> |
| | | <el-input size="small" disabled /> |
| | | <el-input v-model="productTotal.remarks" size="small" /> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | |
| | | </div> |
| | | <el-button |
| | | :disabled="productTotal.state===1" |
| | | @click="saveProduct" |
| | | style="float: right; |
| | | margin-right: 0.5rem;" |
| | | size="large" |
| | | type="primary" |
| | | round>创建</el-button> |
| | | round>{{productTotal.id?'修改':'创建'}}</el-button> |
| | | <el-button |
| | | v-if="productTotal.state===0" |
| | | @click="updateProductState(1)" |
| | | style="float: right; |
| | | margin-right: 0.5rem;" |
| | | size="large" |
| | | type="primary" |
| | | round>审核</el-button> |
| | | <el-button |
| | | v-else-if="productTotal.state===1" |
| | | @click="updateProductState(0)" |
| | | style="float: right; |
| | | margin-right: 0.5rem;" |
| | | size="large" |
| | | type="primary" |
| | | round>反审</el-button> |
| | | |
| | | </div> |
| | | |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | } |
| | | .glass-dispose{ |
| | | width: 100%; |
| | | height: 20%; |
| | | height: 5%; |
| | | } |
| | | .glass-dispose-detail{ |
| | | margin-top: 0.5rem; |