chenlu
2025-03-20 9b9fdcb4711279a303cf8da9ce9e3ff30b1bf6e0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<script setup>
import glass from './pages/Glass.vue'
import Interlayer from './pages/Interlayer.vue'
import Hollow from './pages/Hollow.vue'
import Process from './pages/Process.vue'
import {onMounted, ref} from "vue";
import request from "@/utils/request";
import {ElMessage} from "element-plus";
import {useRouter,useRoute} from "vue-router"
import {useI18n} from "vue-i18n";
const { t } = useI18n()
let BasicData = ref({
  stuffColor:null,
  stuffCraft:null,
  stuffLowE:null,
  stuffPosition:null,
  stuffThickness:null,
  //夹层数据
  InterlayerType:null,
  InterlayerThickness:null,
  InterlayerColor:null,
  //中空数据
  hollowGasType:null,
  hollowGlueDepth:null,
  hollowThickness:null,
  hollowType:null,
  //流程
  process:null
 
})
let tabsValue = ref(1)
const router = useRouter()
const route = useRoute()
 
onMounted( async () => {
  await request.get(`/basicData/BasicDataByType/product`).then((res) => {
    if(res.code==200){
      BasicData.value = res.data
    }else{
      ElMessage.warning(res.msg)
    }
  })
})
 
const getChild = (value) =>{
  for (let key in value) {
    if(!value[key]){
      ElMessage.warning(t('glassPrice.msg.error1'))
      return
    }
  }
 
  request.post(`/glassPriceBasic/save`,value).then((res) => {
    if(res.code==='200' && res.data===true){
      ElMessage.success(t('glassPrice.msg.success'))
      router.push({path:'/main/glassPrice/glassPriceList'})
    }else{
      ElMessage.warning(t('glassPrice.msg.error1'))
    }
  })
}
 
</script>
 
<template>
  <div id="main-div">
    <el-tabs v-model="tabsValue" type="border-card" style="width: 100%;height: 100%">
      <el-tab-pane :name="1" :label="t('glassPrice.glass')" >
        <glass @getChild="getChild" v-if="tabsValue===1" :basicData="BasicData"/>
      </el-tab-pane>
      <el-tab-pane :name="2" :label="t('glassPrice.interlayer')">
        <interlayer @getChild="getChild" v-if="tabsValue===2" :basicData="BasicData"/>
      </el-tab-pane>
      <el-tab-pane :name="3" :label="t('glassPrice.hollow')">
        <hollow @getChild="getChild" v-if="tabsValue===3" :basicData="BasicData"/>
      </el-tab-pane>
      <el-tab-pane :name="4" :label="t('glassPrice.process')">
        <process @getChild="getChild" v-if="tabsValue===4" :basicData="BasicData"/>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
 
<style scoped>
#main-div{
  width: 100%;
  height: 100%;
}
:deep(.el-tabs__content) {
  width: 100%;
}
.el-tab-pane{
  width: 100%;
  height: 100%;
}
 
</style>