廖井涛
2024-06-13 a447cbc8b560a5c99b2c3fb2e9066d66e045f950
north-glass-erp/northglass-erp/src/views/sd/product/CreateProduct.vue
@@ -7,17 +7,18 @@
import {useRouter,useRoute} from "vue-router"
import GlassType from "@/components/sd/product/GlassType.vue"
import useProductGlassTypeStore from "@/stores/sd/product/productGlassType"
import {useI18n} from "vue-i18n";
const { t } = useI18n()
const router = useRouter()
const route = useRoute()
let  userInfo = useUserInfo()
const disposeList = $ref([
  '彩釉',
  '蒙砂',
  '镀膜',
  '贴膜',
  '喷砂',
  '磨边'
  t('product.coloredGlaze'),
  t('product.frostedSand'),
  t('product.coating'),
  t('product.filmApplication'),
  t('product.sandblasting'),
  t('product.edgeGrinding')
])
let BasicData = ref({
  stuffColor:null,
@@ -106,13 +107,13 @@
const saveProduct = () => {
  if(productDetailList.value.length===0){
    ElMessage.warning("请添加产品详情")
    ElMessage.warning(t('product.msg.productLength'))
    return
  }else if(productDetailList.value[productDetailList.value.length-1].detailType!=='glass'){
    ElMessage.warning("产品详情最后一条不是玻璃,请完善")
    ElMessage.warning(t('product.msg.lastGlass'))
    return
  }else if(productGlassTypeStore.GlassType[1]==='' || productGlassTypeStore.GlassType[1]===null){
    ElMessage.warning("请选择产品类别")
    ElMessage.warning(t('product.msg.glassType'))
    return
  }
  productTotal.value.typeId =  productGlassTypeStore.GlassType[1]
@@ -141,7 +142,7 @@
  }
  request.post(`/product/saveProduct`,product).then((res) =>{
    if(res.code==200){
      ElMessage.success("创建成功")
      ElMessage.success(t('product.msg.saveSuccess'))
      router.push("/main/product/selectProduct")
    }
  })
@@ -151,11 +152,11 @@
const updateProductState =  (state) => {
  request.post(`/product/updateProductStateById/${productTotal.value.id}/${state}`).then((res) =>{
    if(res.code==200){
      ElMessage.success("操作成功")
      ElMessage.success(t('product.msg.operateSuccess'))
      //router.go(0)
      router.push({path:'/main/product/createProduct',query:{id:productTotal.value.id,random:Math.random()}})
    }else{
      ElMessage.error("操作失败")
      ElMessage.error(t('product.msg.operateFail'))
    }
  })
}
@@ -176,7 +177,7 @@
  })
  let rege = /^\s*$/
  if(rege.test(childName) || processChecked.value.length===0){
    ElMessage.warning('请输入产品材料属性与工艺属性')
    ElMessage.warning(t('product.msg.glassReview'))
    return
  }
  let productDetail = {
@@ -190,7 +191,7 @@
      productDetailList.value.push(productDetail)
    }else{
      if (productDetailList.value[productDetailList.value.length-1].detailType === 'glass') {
        ElMessage.warning('请先选择间隔物')
        ElMessage.warning(t('product.msg.glassRepeat'))
        return
      }
      productDetailList.value.push(productDetail)
@@ -209,7 +210,7 @@
  try {
    Object.keys(hollowBasic.value).forEach((item, index) => {
      if (hollowBasic.value[item] === '') {
        throw new Error("请选择全部中空间隔物下拉框")
        throw new Error(t('product.msg.HollowReview'))
      }
      childName += hollowBasic.value[item]
    })
@@ -225,10 +226,10 @@
  }
  if(hollowFlag.value.flag){
    if (productDetailList.value.length ===0) {
      ElMessage.warning('请先选择产品')
      ElMessage.warning(t('product.msg.firstGlass'))
      return
    }else if(productDetailList.value[productDetailList.value.length-1].detailType !== 'glass'){
      ElMessage.warning('请先选择产品')
      ElMessage.warning(t('product.msg.firstGlass'))
      return
    }
    productDetailList.value.push(Object.assign({},hollowDetail))
@@ -246,7 +247,7 @@
  try {
    Object.keys(InterlayerBasic.value).forEach((item, index) => {
      if (InterlayerBasic.value[item] === '') {
        throw new Error("请选择全部中空间隔物下拉框")
        throw new Error(t('product.msg.InterlayerReview'))
      }
      childName += InterlayerBasic.value[item]
    })
@@ -261,10 +262,10 @@
  }
  if(InterlayerFlag.value.flag){
    if (productDetailList.value.length ===0) {
      ElMessage.warning('请先选择产品')
      ElMessage.warning(t('product.msg.firstGlass'))
      return
    }else if(productDetailList.value[productDetailList.value.length-1].detailType !== 'glass'){
      ElMessage.warning('请先选择产品')
      ElMessage.warning(t('product.msg.firstGlass'))
      return
    }
    productDetailList.value.push(Object.assign({},InterlayerDetail))
@@ -420,12 +421,12 @@
      <div class="line"/>
      <div class="glass-type">
        <h5>材料属性</h5>
        <h5>{{ $t('product.msg.glassTypeTitle') }}</h5>
        <el-row :gutter="50">
<!--          <el-col :span="6"></el-col>-->
          <el-col :span="4">
            <div class="grid-content ep-bg-purple" >
              <el-select v-model="stuff.thickness" size="small" clearable placeholder="*厚度:" >
              <el-select v-model="stuff.thickness" size="small" clearable :placeholder="$t('product.msg.thickness')" >
                <el-option v-for="item in BasicData.stuffThickness"
                           :key="item.id"
                           :label="item.basicName"
@@ -436,7 +437,7 @@
          </el-col>
          <el-col :span="5">
            <div class="grid-content ep-bg-purple" >
              <el-select v-model="stuff.color" size="small" clearable placeholder="*颜色:"  filterable>
              <el-select v-model="stuff.color" size="small" clearable :placeholder="$t('product.msg.color')"  filterable>
                <el-option v-for="item in BasicData.stuffColor"
                           :key="item.id"
                           :label="item.basicName"
@@ -447,7 +448,7 @@
          </el-col>
          <el-col :span="4">
            <div class="grid-content ep-bg-purple" >
              <el-select v-model="stuff.craft" size="small" clearable placeholder="*工艺属性:" >
              <el-select v-model="stuff.craft" size="small" clearable :placeholder="$t('product.msg.craft')" >
                <el-option v-for="item in BasicData.stuffCraft"
                           :key="item.id"
                           :label="item.basicName"
@@ -458,7 +459,7 @@
          </el-col>
          <el-col :span="4">
            <div class="grid-content ep-bg-purple" >
              <el-select v-model="stuff.position" size="small"  clearable placeholder="位置:" >
              <el-select v-model="stuff.position" size="small"  clearable :placeholder="$t('product.msg.location')" >
                <el-option v-for="item in BasicData.stuffPosition"
                           :key="item.id"
                           :label="item.basicName"
@@ -469,7 +470,7 @@
          </el-col>
          <el-col :span="6">
            <div class="grid-content ep-bg-purple" >
              <el-select v-model="stuff.lowE" size="small"  clearable placeholder="LOW-E面:" >
              <el-select v-model="stuff.lowE" size="small"  clearable :placeholder="$t('product.msg.lowELocation')" >
                <el-option v-for="item in BasicData.stuffLowE"
                           :key="item.id"
                           :label="item.basicName"
@@ -483,7 +484,7 @@
      <div class="line"/>
      <div class="glass-process">
        <h5>工艺属性</h5>
        <h5>{{ $t('product.msg.processAttribute') }}</h5>
        <el-checkbox
            v-model="processChecked"
            v-for="item in BasicData.process"
@@ -498,7 +499,7 @@
              v-model="hollowBasic.thickness"
              size="small"
              style="width: 100px"
              clearable placeholder="*中空厚度:" >
              clearable :placeholder="$t('product.msg.hollowThickness')" >
            <el-option v-for="item in BasicData.hollowThickness"
                       :key="item.id"
                       :label="item.basicName"
@@ -509,7 +510,7 @@
              v-model="hollowBasic.gasType"
              size="small"
              style="width: 100px"
              clearable placeholder="*充气方式:" >
              clearable :placeholder="$t('product.msg.hollowGasType')" >
            <el-option v-for="item in BasicData.hollowGasType"
                       :key="item.id"
                       :label="item.basicName"
@@ -520,7 +521,7 @@
              v-model="hollowBasic.Type"
              size="small"
              style="width: 100px"
              clearable placeholder="*封胶:" >
              clearable :placeholder="$t('product.msg.hollowType')" >
            <el-option v-for="item in BasicData.hollowType"
                       :key="item.id"
                       :label="item.basicName"
@@ -531,7 +532,7 @@
              v-model="hollowBasic.GlueDepth"
              size="small"
              style="width: 100px"
              clearable placeholder="*默认胶深:" >
              clearable :placeholder="$t('product.msg.hollowGlueDepth')" >
            <el-option v-for="item in BasicData.hollowGlueDepth"
                       :key="item.id"
                       :label="item.basicName"
@@ -543,20 +544,20 @@
              @click="addHollow"
              size="small"
              type="primary"
              round>中空间隔物</el-button>
              round>{{ $t('product.msg.hollow') }}</el-button>
          <el-button
              v-else
              @click="updateHollowSure"
              size="small"
              type="primary"
              round>中空间隔物修改</el-button>
              round>{{ $t('product.msg.hollowUpdate') }}</el-button>
        </div>
        <div class="glass-spacer-zk">
          <el-select
              v-model="InterlayerBasic.thickness"
              size="small"
              style="width: 100px"
              clearable placeholder="*夹层厚度:" >
              clearable :placeholder="$t('product.msg.interlayerThickness')" >
            <el-option v-for="item in BasicData.InterlayerThickness"
                       :key="item.id"
                       :label="item.basicName"
@@ -567,7 +568,7 @@
              v-model="InterlayerBasic.type"
              size="small"
              style="width: 100px"
              clearable placeholder="*类型:" >
              clearable :placeholder="$t('product.msg.interlayerType')" >
            <el-option v-for="item in BasicData.InterlayerType"
                       :key="item.id"
                       :label="item.basicName"
@@ -578,7 +579,7 @@
              v-model="InterlayerBasic.color"
              size="small"
              style="width: 100px"
              clearable placeholder="*颜色:" >
              clearable :placeholder="$t('product.msg.interlayerColor')">
            <el-option v-for="item in BasicData.InterlayerColor"
                       :key="item.id"
                       :label="item.basicName"
@@ -591,14 +592,14 @@
              size="small"
              type="primary"
              style="margin-left: 100px"
              round>夹层间隔物</el-button>
              round>{{ $t('product.msg.interlayer') }}</el-button>
          <el-button
              v-else
              @click="updateInterlayerSure"
              size="small"
              type="primary"
              style="margin-left: 100px"
              round>夹层间隔物修改</el-button>
              round>{{ $t('product.msg.interlayerUpdate') }}</el-button>
        </div>
      </div>
      <div class="line"/>
@@ -607,7 +608,7 @@
          <el-row :gutter="20">
            <el-col :span="5">
              <div class="grid-content ep-bg-purple" >
                <el-text class="mx-1"  style="margin-left: 0.5rem" >单片玻璃属性:</el-text>
                <el-text class="mx-1"  style="margin-left: 0.5rem" >{{ $t('product.msg.glassAttribute') }}:</el-text>
              </div>
            </el-col>
            <el-col :span="13">
@@ -621,7 +622,7 @@
                    @click="reset"
                    size="small"
                    type="primary"
                    round>重置</el-button>
                    round>{{ $t('product.msg.reset') }}</el-button>
              </div>
            </el-col>
          </el-row>
@@ -630,7 +631,7 @@
          <el-row :gutter="20">
            <el-col :span="5">
              <div class="grid-content ep-bg-purple" >
                <el-text class="mx-1"  style="margin-left: 0.5rem"  >工艺流程属性:</el-text>
                <el-text class="mx-1"  style="margin-left: 0.5rem"  >{{ $t('product.msg.processFlowAttribute') }}:</el-text>
              </div>
            </el-col>
            <el-col :span="13">
@@ -644,12 +645,12 @@
                    @click="glassSure"
                    size="small"
                    type="primary"
                    round>确认</el-button>
                    round>{{ $t('product.msg.sure') }}</el-button>
                <el-button v-else
                           @click="updateGlassSure"
                           size="small"
                           type="primary"
                           round>修改</el-button>
                           round>{{ $t('product.msg.update') }}</el-button>
              </div>
            </el-col>
          </el-row>
@@ -661,7 +662,7 @@
            <div class="grid-content ep-bg-purple" >
              <el-text class="mx-1"
                       style="margin-left: 0.5rem;text-align: center">
                快速查询:
                {{ $t('product.msg.quickSearch') }}:
              </el-text>
              <el-input v-model="productTotal.query" size="small" disabled  />
            </div>
@@ -670,7 +671,7 @@
            <div class="grid-content ep-bg-purple" >
              <el-text class="mx-1"
                       style="margin-left: 0.5rem;text-align: center">
                计重厚度:
                {{ $t('product.msg.weightThickness') }}:
              </el-text>
              <el-input v-model="productTotal.thickness" size="small" disabled  />
            </div>
@@ -679,7 +680,7 @@
            <div class="grid-content ep-bg-purple" >
              <el-text class="mx-1"
                       style="margin-left: 0.5rem;text-align: center">
                厚度:
                {{ $t('product.msg.allThickness') }}:
              </el-text>
              <el-input v-model="productTotal.totalThickness"  size="small" disabled  />
            </div>
@@ -688,7 +689,7 @@
            <div class="grid-content ep-bg-purple" >
              <el-text class="mx-1"
                       style="margin-left: 0.5rem;text-align: center">
                备注:
                {{ $t('product.msg.remarks') }}:
              </el-text>
              <el-input v-model="productTotal.remarks"  size="small"   />
            </div>
@@ -707,7 +708,7 @@
        <el-row >
          <el-col :span="4">
            <div class="grid-content ep-bg-purple" >
              <el-text class="mx-1" size="large"  >产品名称:</el-text>
              <el-text class="mx-1" size="large"  >{{ $t('product.msg.product') }}:</el-text>
            </div>
          </el-col>
          <el-col :span="20">
@@ -724,19 +725,19 @@
            <el-button
                @click = "updateGlass(index)"
                size="small"
                type="primary">修改玻璃</el-button>
                type="primary">{{ $t('product.msg.updateGlass') }}</el-button>
          </el-col>
          <el-col :span="4" v-show="item.detailType === 'Interlayer'">
            <el-button
                @click = "updateInterlayer(index)"
                size="small"
                type="primary">修改夹层</el-button>
                type="primary">{{ $t('product.msg.updateHollow') }}</el-button>
          </el-col>
          <el-col :span="4" v-show="item.detailType === 'hollow'">
            <el-button
                @click = "updateHollow(index)"
                size="small"
                type="primary">修改中空</el-button>
                type="primary">{{ $t('product.msg.updateInterlayer') }}</el-button>
          </el-col>
          <el-col :span="16">
            <el-input
@@ -750,7 +751,7 @@
            <el-button
                @click="deleteProductDetail(index)"
                size="small"
                type="primary">删除</el-button>
                type="primary">{{ $t('product.msg.delete') }}</el-button>
          </el-col>
        </el-row>
@@ -762,7 +763,7 @@
          margin-right: 0.5rem;"
          size="large"
          type="primary"
          round>{{productTotal.id?'修改':'创建'}}</el-button>
          round>{{productTotal.id?$t('product.msg.update'):$t('product.msg.create')}}</el-button>
      <el-button
          v-if="productTotal.state===0"
          @click="updateProductState(1)"
@@ -770,7 +771,7 @@
          margin-right: 0.5rem;"
          size="large"
          type="primary"
          round>审核</el-button>
          round>{{ $t('product.msg.review') }}</el-button>
      <el-button
          v-else-if="productTotal.state===1"
          @click="updateProductState(0)"
@@ -778,7 +779,7 @@
          margin-right: 0.5rem;"
          size="large"
          type="primary"
          round>反审</el-button>
          round>{{ $t('product.msg.cancelReview') }}</el-button>
    </div>