|
|
@@ -1,26 +1,26 @@
|
|
|
<!-- 添加商品-彩色钻石 -->
|
|
|
<template>
|
|
|
- <el-form ref="formRef" class="el-form--horizontal" label-width="100px" :model="formItem" :rules="formRules">
|
|
|
+ <el-form ref="formRef" class="el-form--horizontal" label-width="100px" :model="formData" :rules="formRules">
|
|
|
<el-form-item label="商品编号" prop="GoodsNo">
|
|
|
- <el-input placeholder="请输入" v-model="formItem.GoodsNo" />
|
|
|
+ <el-input placeholder="请输入" v-model="formData.GoodsNo" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="履约方式" prop="PerformanceTemplateID" v-if="code === 'warehousing_stock_sell'">
|
|
|
<component :is="components.performance" v-model="performanceId" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="货币类型" prop="ZSCurrencyType">
|
|
|
- <el-radio-group v-model="formItem.ZSCurrencyType">
|
|
|
+ <el-radio-group v-model="formData.ZSCurrencyType">
|
|
|
<el-radio :label="item.value" v-for="(item, index) in enums.currencyTypeList" :key="index">
|
|
|
{{ item.label }}
|
|
|
</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="价格" prop="Price">
|
|
|
- <el-input type="number" placeholder="请输入" v-model.number="formItem.Price">
|
|
|
+ <el-input type="number" placeholder="请输入" v-model.number="formData.Price">
|
|
|
<template #append>{{ currencyInfo?.enumitemvalue }}</template>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="克拉重量" prop="Weight">
|
|
|
- <el-input type="number" placeholder="请输入" v-model.number="formItem.Weight">
|
|
|
+ <el-input type="number" placeholder="请输入" v-model.number="formData.Weight">
|
|
|
<template #append>(克拉)</template>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
@@ -29,11 +29,11 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="尺寸" prop="Size">
|
|
|
<div class="el-form-item--col">
|
|
|
- <el-input-number type="number" v-model="formItem.Size1" :controls="false" />
|
|
|
+ <el-input-number type="number" v-model="formData.Size1" :controls="false" />
|
|
|
<span>×</span>
|
|
|
- <el-input-number type="number" v-model="formItem.Size2" :controls="false" />
|
|
|
+ <el-input-number type="number" v-model="formData.Size2" :controls="false" />
|
|
|
<span>×</span>
|
|
|
- <el-input-number type="number" v-model="formItem.Size3" :controls="false" />
|
|
|
+ <el-input-number type="number" v-model="formData.Size3" :controls="false" />
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="形状" prop="ZSShapeType">
|
|
|
@@ -44,79 +44,75 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="颜色" prop="ZSCZColorType">
|
|
|
<div class="el-form-item--col">
|
|
|
- <el-select v-model="formItem.ZSCZColor1Type">
|
|
|
+ <el-select v-model="formData.ZSCZColor1Type">
|
|
|
<el-option :label="item.label" :value="item.value"
|
|
|
v-for="(item, index) in enums.fancyColorType1List" :key="index" />
|
|
|
</el-select>
|
|
|
- <el-select v-model="formItem.ZSCZColor2Type">
|
|
|
+ <el-select v-model="formData.ZSCZColor2Type">
|
|
|
<el-option :label="item.label" :value="item.value"
|
|
|
v-for="(item, index) in enums.fancyColorType2List" :key="index" />
|
|
|
</el-select>
|
|
|
- <el-select v-model="formItem.ZSCZColor3Type">
|
|
|
+ <el-select v-model="formData.ZSCZColor3Type">
|
|
|
<el-option :label="item.label" :value="item.value"
|
|
|
v-for="(item, index) in enums.fancyColorType3List" :key="index" />
|
|
|
</el-select>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="净度" prop="ZSClarityType1">
|
|
|
- <el-select v-model="formItem.ZSClarityType1">
|
|
|
+ <el-select v-model="formData.ZSClarityType1">
|
|
|
<el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.clarityTypeList"
|
|
|
:key="index" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="抛光" prop="ZSPolishType1">
|
|
|
- <el-select v-model="formItem.ZSPolishType1" clearable>
|
|
|
+ <el-select v-model="formData.ZSPolishType1" clearable>
|
|
|
<el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.polishTypeList"
|
|
|
:key="index" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="对称" prop="ZSSymmetryType1">
|
|
|
- <el-select v-model="formItem.ZSSymmetryType1" clearable>
|
|
|
+ <el-select v-model="formData.ZSSymmetryType1" clearable>
|
|
|
<el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.symmetryTypeList"
|
|
|
:key="index" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="荧光" prop="ZSFluorescenceType1">
|
|
|
- <el-select v-model="formItem.ZSFluorescenceType1" clearable>
|
|
|
+ <el-select v-model="formData.ZSFluorescenceType1" clearable>
|
|
|
<el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.fluorescenceTypeList"
|
|
|
:key="index" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="仓库" prop="WarehouseID">
|
|
|
- <el-select v-model="formItem.WarehouseID">
|
|
|
+ <el-select v-model="formData.WarehouseID">
|
|
|
<el-option :label="item.warehousename" :value="item.autoid" v-for="(item, index) in warehouseList"
|
|
|
:key="index" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="市场价" prop="MarketPrice">
|
|
|
- <el-input type="number" placeholder="请输入" v-model.number="formItem.MarketPrice">
|
|
|
+ <el-input type="number" placeholder="请输入" v-model.number="formData.MarketPrice">
|
|
|
<template #append>{{ currencyInfo?.enumitemvalue }}</template>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="证书类型" prop="ZSCertType">
|
|
|
- <el-select v-model="formItem.ZSCertType" clearable>
|
|
|
+ <el-select v-model="formData.ZSCertType" clearable>
|
|
|
<el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.certTypeList"
|
|
|
:key="index" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="证书编号" prop="CerNo">
|
|
|
- <el-input placeholder="请输入" v-model="formItem.CerNo" />
|
|
|
+ <el-input placeholder="请输入" v-model="formData.CerNo" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="商品照片" prop="ImagePath">
|
|
|
<app-upload />
|
|
|
</el-form-item>
|
|
|
<el-form-item class="el-form-item--row" label="备注" prop="Remark">
|
|
|
- <el-input type="textarea" v-model="formItem.Remark" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item class="el-form-item--row">
|
|
|
- <el-button type="primary" :loading="loading" @click="onSubmit">提交</el-button>
|
|
|
- <el-button :loading="loading" @click="onCancel(false)" plain>取消</el-button>
|
|
|
+ <el-input type="textarea" v-model="formData.Remark" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { ref, PropType, defineAsyncComponent, watch } from 'vue'
|
|
|
+import { ref, PropType, defineAsyncComponent } from 'vue'
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
import type { FormInstance, FormRules } from 'element-plus'
|
|
|
import { Category } from '@/constants/enum/diamond'
|
|
|
@@ -135,8 +131,8 @@ const components = {
|
|
|
performance: defineAsyncComponent(() => import('@pc/components/modules/performance/index.vue')),
|
|
|
}
|
|
|
|
|
|
-const emit = defineEmits(['loading', 'cancel'])
|
|
|
-const { loading, formItem, performanceId, shapeId, caratUnit, enums, warehouseList, currencyInfo, formSubmit } = useDiamondForm(Category.Fancy)
|
|
|
+const emit = defineEmits(['cancel'])
|
|
|
+const { loading, formData, performanceId, shapeId, caratUnit, enums, warehouseList, currencyInfo, formSubmit } = useDiamondForm(Category.Fancy)
|
|
|
const formRef = ref<FormInstance>()
|
|
|
|
|
|
const formRules: FormRules = {
|
|
|
@@ -170,7 +166,7 @@ const formRules: FormRules = {
|
|
|
ZSCZColorType: [{
|
|
|
required: true,
|
|
|
validator: (rule, value, callback) => {
|
|
|
- if (formItem.ZSCZColor1Type && formItem.ZSCZColor2Type && formItem.ZSCZColor3Type) {
|
|
|
+ if (formData.ZSCZColor1Type && formData.ZSCZColor2Type && formData.ZSCZColor3Type) {
|
|
|
callback()
|
|
|
} else {
|
|
|
callback(new Error('请选择颜色'))
|
|
|
@@ -179,7 +175,7 @@ const formRules: FormRules = {
|
|
|
}],
|
|
|
Size: [{
|
|
|
validator: (rule, value, callback) => {
|
|
|
- const { Size1, Size2, Size3 } = formItem
|
|
|
+ const { Size1, Size2, Size3 } = formData
|
|
|
if ((!Size1 && !Size2 && !Size3) || (Size1 && Size2 && Size3)) {
|
|
|
callback()
|
|
|
} else {
|
|
|
@@ -192,22 +188,18 @@ const formRules: FormRules = {
|
|
|
// 选择形状
|
|
|
const shapeChange = (value: number) => {
|
|
|
if (value) {
|
|
|
- formItem.ZSShapeType = [value]
|
|
|
+ formData.ZSShapeType = [value]
|
|
|
} else {
|
|
|
- formItem.ZSShapeType = []
|
|
|
+ formData.ZSShapeType = []
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-const onCancel = (isRefresh = false) => {
|
|
|
- emit('cancel', isRefresh)
|
|
|
-}
|
|
|
-
|
|
|
const onSubmit = () => {
|
|
|
formRef.value?.validate((valid) => {
|
|
|
if (valid) {
|
|
|
formSubmit().then(() => {
|
|
|
ElMessage.success('提交成功')
|
|
|
- onCancel(true)
|
|
|
+ emit('cancel', true)
|
|
|
}).catch((err) => {
|
|
|
ElMessage.error('提交失败:' + err)
|
|
|
})
|
|
|
@@ -215,5 +207,9 @@ const onSubmit = () => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-watch(loading, (val) => emit('loading', val))
|
|
|
+// 暴露组件属性给父组件调用
|
|
|
+defineExpose({
|
|
|
+ loading,
|
|
|
+ submit: onSubmit
|
|
|
+})
|
|
|
</script>
|