廖井涛
2025-11-24 ff1be3b4ed56b84848ad34ea2383788c220bff64
north-glass-erp/northglass-erp/src/views/sd/product/CreateProduct.vue
@@ -14,6 +14,14 @@
const router = useRouter()
const route = useRoute()
let  userInfo = useUserInfo()
let props = defineProps({
  productFlag:null
})
let emit = defineEmits([
  'getProductRow'
])
const disposeList = $ref([
  t('product.coloredGlaze'),
  t('product.frostedSand'),
@@ -99,7 +107,12 @@
        item.separation = JSON.parse(item.separation)
      })
      productTotal.value = res.data.title
      productGlassTypeStore.GlassType =[res.data.title.typeId.substring(0,2),res.data.title.typeId]
      if(res.data.title.typeId.length===2){
        productGlassTypeStore.GlassType =[res.data.title.typeId.substring(0,2)]
      }else{
        productGlassTypeStore.GlassType =[res.data.title.typeId.substring(0,2),res.data.title.typeId]
      }
      //BasicData.value = res.data
    }else{
      ElMessage.warning(res.msg)
@@ -119,7 +132,12 @@
    ElMessage.warning(t('product.msg.glassType'))
    return
  }
  productTotal.value.typeId =  productGlassTypeStore.GlassType[1]
  if(productGlassTypeStore.GlassType[1]!==undefined){
    productTotal.value.typeId =  productGlassTypeStore.GlassType[1]
  }else{
    productTotal.value.typeId =  productGlassTypeStore.GlassType[0]
  }
  let productName = ""
  productDetailList.value.forEach(item =>{
@@ -144,6 +162,14 @@
    productTotal.value.id = null
    productTotal.value.state = 0
  }
  if(productTotal.value.id != null
      &&
          productTotal.value.creator !== userInfo.user.userName
          & company.notChangeProduct
      ){
    ElMessage.warning(t('product.msg.msg1')+productTotal.value.creator+t('product.msg.msg2'))
    return;
  }
  let product = {
    title: productTotal.value,
@@ -162,17 +188,28 @@
}
const  saveProducts=(product)=>{
  request.post(`/product/saveProduct`,product).then((res) =>{
  if(props.productFlag===false){
    product.title.state = 1
  }
  request.post(`/product/saveProduct/${userInfo.user.userName}`,product).then((res) =>{
    if(res.code==200){
      ElMessage.success(t('product.msg.saveSuccess'))
      router.push("/main/product/selectProduct")
      if(props.productFlag===false){
        emit('changePage')
      }else{
        router.push("/main/product/selectProduct")
      }
    }
  })
}
//审核产品状态
const updateProductState =  (state) => {
  request.post(`/product/updateProductStateById/${productTotal.value.id}/${state}`).then((res) =>{
  if(productTotal.value.id!==null && productTotal.value.creator!==userInfo.user.userName && company.notChangeProduct){
    ElMessage.warning(t('product.msg.msg1')+productTotal.value.creator+t('product.msg.msg2'))
    return;
  }
  request.post(`/product/updateProductStateById/${productTotal.value.id}/${state}/${userInfo.user.userName}`).then((res) =>{
    if(res.code==200){
      ElMessage.success(t('product.msg.operateSuccess'))
      //router.go(0)
@@ -199,7 +236,10 @@
const glassSure =  () => {
  let childName = ''
  Object.keys(stuff.value).forEach((item,index)=>{
    childName+=stuff.value[item]
    if(stuff.value[item]!==undefined){
      childName+=stuff.value[item]
    }
  })
  let rege = /^\s*$/
  if(rege.test(childName) || processChecked.value.length===0){
@@ -235,10 +275,13 @@
  let childName = ''
  try {
    Object.keys(hollowBasic.value).forEach((item, index) => {
      if (hollowBasic.value[item] === '' && item !== 'GlueDepth')  {
      if ((hollowBasic.value[item] === ''||hollowBasic.value[item]===undefined) && item !== 'GlueDepth')  {
        throw new Error(t('product.msg.HollowReview'))
      }
      childName += hollowBasic.value[item]
      if(hollowBasic.value[item]!==undefined){
        childName += hollowBasic.value[item] || ''
      }
    })
  }catch (e){
    ElMessage.warning(e.message)
@@ -272,10 +315,13 @@
  let childName = ''
  try {
    Object.keys(InterlayerBasic.value).forEach((item, index) => {
      if (InterlayerBasic.value[item] === '') {
      if ((InterlayerBasic.value[item] === ''||InterlayerBasic.value[item]===undefined) && item !== 'color') {
        throw new Error(t('product.msg.InterlayerReview'))
      }
      childName += InterlayerBasic.value[item]
      if(InterlayerBasic.value[item]!==undefined){
        childName += InterlayerBasic.value[item]
      }
    })
  }catch (e){
    ElMessage.warning(e.message)
@@ -401,7 +447,7 @@
        break
      }
      case 'hollow' :{
        productName+='*'+item.detail+"*"
        productName+=company.hollow + item.detail + company.hollow
        break
      }
    }
@@ -641,7 +687,13 @@
            </el-col>
            <el-col :span="13">
              <div class="grid-content ep-bg-purple" >
                <el-input :value="stuff.thickness+stuff.color+stuff.craft+stuff.position+stuff.lowE" size="small" disabled  />
                <el-input :value="Object.values({...stuff,
                  thickness: stuff.thickness,
                  color: stuff.color,
                  craft: stuff.craft,
                  position: stuff.position,
                  lowE: stuff.lowE
                }).filter(val => val !== null && val !== '').join('')" size="small" disabled  />
              </div>
            </el-col>
            <el-col :span="3">
@@ -751,7 +803,7 @@
          </el-col>
          <el-col :span="20">
            <div class="grid-content ep-bg-purple" >
              <el-input :value="productName" size="large" disabled  />
              <el-input :value="productName" size="large" readonly  />
            </div>
          </el-col>
        </el-row>
@@ -801,7 +853,7 @@
          margin-left: 0.5rem;"
          size="large"
          type="primary"
          round>{{"复制"}}</el-button>
          round>{{$t('basicData.copy')}}</el-button>
      <el-button
          :disabled="productTotal.state===1"
          @click="saveProduct(null)"