From f7a2fcdda7f1120498c5c5f75c5a99955fc54b43 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期二, 16 十二月 2025 16:54:09 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/ERP_override
---
north-glass-erp/northglass-erp/src/views/sd/basicData/CreateBasicData.vue | 223 ++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 185 insertions(+), 38 deletions(-)
diff --git a/north-glass-erp/northglass-erp/src/views/sd/basicData/CreateBasicData.vue b/north-glass-erp/northglass-erp/src/views/sd/basicData/CreateBasicData.vue
index 3e131b6..0fe60ae 100644
--- a/north-glass-erp/northglass-erp/src/views/sd/basicData/CreateBasicData.vue
+++ b/north-glass-erp/northglass-erp/src/views/sd/basicData/CreateBasicData.vue
@@ -1,102 +1,111 @@
<script setup>
import request from "@/utils/request"
-import {onMounted, ref, watch} from "vue";
+import {onMounted, ref} from "vue";
import {useI18n} from "vue-i18n"
import {ElMessage} from "element-plus"
-import {useRouter,useRoute} from "vue-router"
+import {useRoute, useRouter} from "vue-router"
+
const { t } = useI18n()
const router = useRouter()
const route = useRoute()
+let iconWidth=ref(null)
+let iconHeight=ref(null)
let basic = ref({
basicType : ['',''],
- input:''
+ input:'',
+ nickname:null,
+ sort:''
})
let options=ref([
- { "label": "璁㈠崟",
+ { "label": t('orderBasicData.order'),
"value": "order",
"children": [
{
- "label": "璁㈠崟绫诲瀷",
+ "label": t('orderBasicData.orderType'),
"value": "orderType"
},
{
- "label": "璁㈠崟鍒嗙被",
+ "label": t('orderBasicData.orderClassify'),
"value": "orderClassify"
},
{
- "label": "鍟嗘爣閫夐」",
+ "label": t('orderBasicData.icon'),
"value": "icon"
},
{
- "label": "鍖呰鏂瑰紡",
+ "label": t('orderBasicData.packType'),
"value": "packType"
},
{
- "label": "閾濇潯鏂瑰紡",
+ "label": t('orderBasicData.alType'),
"value": "alType"
},
{
- "label": "涓氬姟鍛�",
+ "label": t('orderBasicData.saleMan'),
"value": "saleMan"
+ },
+ {
+ "label": t('order.edgingType'),
+ "value": "edgingType"
}
]
},
{
- "label": "浜у搧",
+ "label": t('orderBasicData.product'),
"value": "product",
"children": [
{
- "label": "鏉愭枡鍘氬害",
+ "label": t('orderBasicData.stuffThickness'),
"value": "stuffThickness"
},
{
- "label": "鏉愭枡棰滆壊",
+ "label": t('orderBasicData.stuffColor'),
"value": "stuffColor"
},
{
- "label": "宸ヨ壓灞炴��",
+ "label": t('orderBasicData.stuffCraft'),
"value": "stuffCraft"
},
{
- "label": "鐜荤拑浣嶇疆",
+ "label": t('orderBasicData.stuffPosition'),
"value": "stuffPosition"
},
{
- "label": "lowe",
+ "label": t('orderBasicData.stuffLowE'),
"value": "stuffLowE"
},
{
- "label": "澶硅兌鍘氬害",
+ "label": t('orderBasicData.InterlayerThickness'),
"value": "InterlayerThickness"
},
{
- "label": "澶硅兌绫诲瀷",
+ "label": t('orderBasicData.InterlayerType'),
"value": "InterlayerType"
},
{
- "label": "澶硅兌棰滆壊",
+ "label": t('orderBasicData.InterlayerColor'),
"value": "InterlayerColor"
},
{
- "label": "宸ヨ壓娴佺▼",
+ "label": t('orderBasicData.process'),
"value": "process"
},
{
- "label": "涓┖鍘氬害",
+ "label": t('orderBasicData.hollowThickness'),
"value": "hollowThickness"
},
{
- "label": "鍏呮皵鏂瑰紡",
+ "label": t('orderBasicData.hollowGasType'),
"value": "hollowGasType"
},
{
- "label": "灏佽兌",
+ "label": t('orderBasicData.hollowType'),
"value": "hollowType"
},
{
- "label": "榛樿鑳舵繁",
+ "label": t('orderBasicData.hollowGlueDepth'),
"value": "hollowGlueDepth"
}
]
@@ -104,15 +113,15 @@
{
"children": [
{
- "label": "浠樻鏉′欢",
+ "label": t('orderBasicData.paymentTerms'),
"value": "paymentTerms"
},
{
- "label": "鏀舵鏂瑰紡",
+ "label": t('orderBasicData.payMethod'),
"value": "payMethod"
}
],
- "label": "閫佽揣",
+ "label": t('orderBasicData.delivery'),
"value": "delivery"
}
])
@@ -127,27 +136,87 @@
if(props.rowIndex){
basic.value.basicType[0] = props.rowIndex.basicType
basic.value.basicType[1] = props.rowIndex.basicCategory
- basic.value.input = props.rowIndex.basicName
+ if(basic.value.basicType[1]==="icon"){
+ basic.value.input = props.rowIndex.basicName
+ if(props.rowIndex.nickname!=null){
+ basic.value.nickname = JSON.parse(props.rowIndex.nickname).data
+ iconWidth.value=JSON.parse(props.rowIndex.nickname).width
+ iconHeight.value=JSON.parse(props.rowIndex.nickname).height
+ }else{
+ basic.value.nickname = null
+ iconWidth.value=null
+ iconHeight.value=null
+ }
+ basic.value.sort = props.rowIndex.sort
+
+ }else{
+ basic.value.input = props.rowIndex.basicName
+ basic.value.nickname = props.rowIndex.nickname
+ basic.value.sort = props.rowIndex.sort
+ }
+
}
})
const emit = defineEmits(['gaveParent'])
const saveBasicData = () =>{
+ if(basic.value.basicType[1]==="hollowThickness"||basic.value.basicType[1]==="stuffThickness"||basic.value.basicType[1]==="InterlayerThickness"){
+ if(!basic.value.input.includes("mm")){
+ basic.value.input=basic.value.input+"mm"
+ }
+ }
+ if(basic.value.basicType[1]==="icon"){
+ const regex = /^(?:\d+|\d+\.\d)$/
+ if (!regex.test(iconWidth.value)||!regex.test(iconHeight.value) ) {
+ ElMessage.warning(t('basicData.msg.greater0Sec1'))
+ return
+ }
+ let nickname=basic.value.nickname
+ let data={
+ width: iconWidth.value,
+ height: iconHeight.value,
+ data: nickname
+ }
+ basic.value.nickname=JSON.stringify(data)
+ }
+ basic.value.input=basic.value.input.trim()
request.post(`/basicData/addBasicData`, basic.value).then(res => {
if (res.data) {
- ElMessage.success('淇濆瓨鎴愬姛')
+ ElMessage.success(t('basicData.msg.saveSuccess'))
emit('gaveParent', true)
}
})
}
const updateBasicData = () =>{
+ if(basic.value.basicType[1]==="hollowThickness"||basic.value.basicType[1]==="stuffThickness"||basic.value.basicType[1]==="InterlayerThickness"){
+ if(!basic.value.input.includes("mm")){
+ basic.value.input=basic.value.input+"mm"
+ }
+ }
+ if(basic.value.basicType[1]==="icon"){
+ const regex = /^(?:\d+|\d+\.\d)$/
+ if (!regex.test(iconWidth.value)||!regex.test(iconHeight.value) ) {
+ ElMessage.warning(t('basicData.msg.greater0Sec1'))
+ return
+ }
+ let nickname=basic.value.nickname
+ let data={
+ width: iconWidth.value,
+ height: iconHeight.value,
+ data: nickname
+ }
+ basic.value.nickname=JSON.stringify(data)
+ }
let submitArr = props.rowIndex
submitArr.basicType = basic.value.basicType[0]
submitArr.basicCategory = basic.value.basicType[1]
- submitArr.basicName = basic.value.input
+ submitArr.basicName = basic.value.input.trim()
+ submitArr.nickname = basic.value.nickname
+ submitArr.sort = basic.value.sort
+
request.post(`/basicData/updateBasicData`, submitArr).then(res => {
if (res.data) {
- ElMessage.success('淇敼鎴愬姛')
+ ElMessage.success(t('basicData.msg.saveSuccess'))
emit('gaveParent', true)
}
})
@@ -157,7 +226,29 @@
const handleChange = (value) => {
const filterArr = options.value.filter((item) =>item.value === value[0]
).map((item) =>item.children.filter((item) =>item.value === value[1]))
- console.log(filterArr)
+}
+
+const changeFile = (file) => {
+ const isJPG = file.raw.type === 'image/jpeg' || file.raw.type === 'image/png' ;
+ const isLt2M = file.size / 1024 / 1024 < 5;
+
+ if (!isJPG) {
+ ElMessage.warning(t('orderBasicData.msg2'))
+ return
+ }
+ if (!isLt2M) {
+ ElMessage.warning(t('orderBasicData.msg1'))
+ return
+ }
+
+ return new Promise((resolve, reject) => {
+ let reader = new FileReader();
+ reader.readAsDataURL(file.raw);
+ reader.onload = (e) => {
+ resolve(e.target.result);
+ basic.value.nickname=e.target.result;
+ };
+ });
}
@@ -166,29 +257,85 @@
<template>
<div>
<el-row>
- <el-col :span="4">鍩虹绫诲瀷:</el-col>
+ <el-col :span="4">{{ $t('orderBasicData.page.searchOrderBasicData') }}:</el-col>
<el-col :span="12">
<el-cascader
v-model="basic.basicType"
@change="handleChange"
:options="options"
- clearable
- placeholder=""
+ :placeholder="$t('processCard.pleaseSelect')"
:disabled="props.rowIndex"
/>
</el-col>
</el-row>
<el-row>
- <el-col :span="4">鍚嶇О:</el-col>
+ <el-col :span="4">{{ $t('orderBasicData.name') }}:</el-col>
<el-col :span="12">
<el-input v-model="basic.input"/>
</el-col>
</el-row>
<el-row>
+ <el-col :span="4">{{ $t('orderBasicData.alias') }}:</el-col>
+ <el-col :span="12">
+ <el-input v-if="basic.basicType.length>0 && basic.basicType[1]!=='process'" v-model="basic.nickname"/>
+ <el-select v-model="basic.nickname" v-else>
+ <el-option :label="$t('orderBasicData.commonProcess')" value="" />
+ <el-option :label="$t('orderBasicData.laminatingProcessA')" value="stepA" />
+ <el-option :label="$t('orderBasicData.laminatingProcessB')" value="stepB" />
+ <el-option :label="$t('orderBasicData.laminatingProcessC')" value="stepC" />
+ <el-option :label="$t('orderBasicData.laminatingProcessD')" value="stepD" />
+
+<!-- <el-option :label="$t('orderBasicData.laminatingProcessC')" value="stepA" />澶硅兌宸ュ簭-->
+<!-- <el-option :label="$t('orderBasicData.laminatingProcessA')" value="stepB" />-->
+<!-- <el-option :label="$t('orderBasicData.laminatingProcessD')" value="stepC" />-->
+<!-- <el-option :label="$t('orderBasicData.laminatingProcessB')" value="stepD" />-->
+ </el-select>
+ </el-col>
+ </el-row>
+ <el-row v-if="basic.basicType.length!==0 && basic.basicType[1]==='icon'" >
+ <el-col :span="4">
+ {{ $t('order.width') }}:
+ </el-col>
+ <el-col :span="12">
+ <el-input v-model="iconWidth"/>
+ </el-col>
+ </el-row>
+ <el-row v-if="basic.basicType.length!==0 && basic.basicType[1]==='icon'" >
+ <el-col :span="4">
+ {{ $t('order.height') }}:
+ </el-col>
+ <el-col :span="12">
+ <el-input v-model="iconHeight"/>
+ </el-col>
+ </el-row>
+ <el-row v-if="basic.basicType.length!==0 && basic.basicType[1]==='icon'" >
<el-col :span="4"></el-col>
<el-col :span="12">
- <el-button v-show="!props.rowIndex" @click="saveBasicData" type="primary">鏂板</el-button>
- <el-button v-show="props.rowIndex" @click="updateBasicData" type="primary">淇敼</el-button>
+ <el-upload
+ v-model="basic.nickname"
+ :limit="1"
+ :on-change="changeFile"
+ class="upload-demo"
+ ref="upload"
+ action="https://jsonplaceholder.typicode.com/posts/"
+ :file-list="fileList"
+ :auto-upload="false">
+ <el-button slot="trigger" size="small" type="primary" >{{ $t('orderBasicData.selectFile') }}</el-button>
+ <div slot="tip" class="el-upload__tip">{{ $t('orderBasicData.msg3') }}</div>
+ </el-upload>
+ </el-col>
+ </el-row>
+ <el-row v-show="props.rowIndex">
+ <el-col :span="4">{{ $t('processCard.sorting') }}:</el-col>
+ <el-col :span="12">
+ <el-input type="number" v-model="basic.sort"/>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="4"></el-col>
+ <el-col :span="12">
+ <el-button v-show="!props.rowIndex" @click="saveBasicData" type="primary">{{ $t('basicData.insert') }}</el-button>
+ <el-button v-show="props.rowIndex" @click="updateBasicData" type="primary">{{ $t('basicData.update') }}</el-button>
</el-col>
</el-row>
--
Gitblit v1.8.0