廖井涛
12 小时以前 f7a2fcdda7f1120498c5c5f75c5a99955fc54b43
north-glass-erp/northglass-erp/src/views/sd/basicData/CreateBasicData.vue
@@ -1,18 +1,22 @@
<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:'',
  nickname:''
  nickname:null,
  sort:''
})
let options=ref([
  { "label": t('orderBasicData.order'),
@@ -41,6 +45,10 @@
      {
        "label": t('orderBasicData.saleMan'),
        "value": "saleMan"
      },
      {
        "label": t('order.edgingType'),
        "value": "edgingType"
      }
    ]
  },
@@ -128,8 +136,25 @@
  if(props.rowIndex){
    basic.value.basicType[0] =  props.rowIndex.basicType
    basic.value.basicType[1] =  props.rowIndex.basicCategory
    basic.value.input =  props.rowIndex.basicName
    basic.value.nickname =  props.rowIndex.nickname
    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
    }
  }
})
@@ -139,6 +164,20 @@
    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 => {
@@ -154,11 +193,27 @@
      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.trim()
  submitArr.nickname = basic.value.nickname
  submitArr.sort = basic.value.sort
  request.post(`/basicData/updateBasicData`, submitArr).then(res => {
    if (res.data) {
      ElMessage.success(t('basicData.msg.saveSuccess'))
@@ -238,6 +293,22 @@
      </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-upload
@@ -254,6 +325,12 @@
        </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">