添加售票管理中证件类别和交易类型字典
This commit is contained in:
parent
8c3d81bf63
commit
d35742e5c8
@ -212,5 +212,7 @@ export enum DICT_TYPE {
|
||||
ERP_STOCK_RECORD_BIZ_TYPE = 'erp_stock_record_biz_type', // 库存明细的业务类型
|
||||
|
||||
// ========== TICKET - 票务系统模块 ==========
|
||||
ASSET_STATUS_TYPE = 'asset_status_type'
|
||||
ASSET_STATUS_TYPE = 'asset_status_type', // 设备状态
|
||||
TRANSACTION_TYPE_NO = 'transaction_type_no', // 交易类型(订单类型)
|
||||
CERTIFICATE_TYPE = 'certificate_type' // 证件类型
|
||||
}
|
||||
|
@ -1,12 +1,6 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px" v-loading="formLoading">
|
||||
<el-form-item label="数据id" prop="dataId">
|
||||
<el-input v-model="formData.dataId" placeholder="请输入数据id" />
|
||||
</el-form-item>
|
||||
@ -17,7 +11,11 @@
|
||||
<el-input v-model="formData.certificateno" placeholder="请输入证件号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="证件类别" prop="certificatetype">
|
||||
<el-input v-model="formData.certificatetype" placeholder="请输入证件类别" />
|
||||
<el-select v-model="formData.certificatetype" placeholder="请输入证件类别" clearable>
|
||||
<el-option
|
||||
v-for="dict in getStrDictOptions(DICT_TYPE.CERTIFICATE_TYPE)" :key="dict.value" :label="dict.label"
|
||||
:value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品ID" prop="item">
|
||||
<el-input v-model="formData.item" placeholder="请输入产品ID" />
|
||||
@ -38,26 +36,21 @@
|
||||
<el-input v-model="formData.quantity" placeholder="请输入数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="销售日期" prop="sddate">
|
||||
<el-date-picker
|
||||
v-model="formData.sddate"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="选择销售日期"
|
||||
/>
|
||||
<el-date-picker v-model="formData.sddate" type="date" value-format="x" placeholder="选择销售日期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="订单号" prop="sdno">
|
||||
<el-input v-model="formData.sdno" placeholder="请输入订单号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="销售时间" prop="sdtime">
|
||||
<el-date-picker
|
||||
v-model="formData.sdtime"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="选择销售时间"
|
||||
/>
|
||||
<el-date-picker v-model="formData.sdtime" type="date" value-format="x" placeholder="选择销售时间" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="交易类别(订单类型)" prop="transactiontypeno">
|
||||
<el-input v-model="formData.transactiontypeno" placeholder="请输入交易类别(订单类型)" />
|
||||
<el-select v-model="formData.transactiontypeno" placeholder="请选择交易类别(订单类型)" clearable>
|
||||
<el-option
|
||||
v-for="dict in getStrDictOptions(DICT_TYPE.TRANSACTION_TYPE_NO)" :key="dict.value" :label="dict.label"
|
||||
:value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="销售特征名称(票种名称)" prop="salepropetyvaluename">
|
||||
<el-input v-model="formData.salepropetyvaluename" placeholder="请输入销售特征名称(票种名称)" />
|
||||
@ -70,84 +63,19 @@
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { SaleDataApi, SaleDataVO } from '@/api/ticket/saledata'
|
||||
import { SaleDataApi, SaleDataVO } from '@/api/ticket/saledata'
|
||||
import { getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
/** 售票 表单 */
|
||||
defineOptions({ name: 'SaleDataForm' })
|
||||
|
||||
/** 售票 表单 */
|
||||
defineOptions({ name: 'SaleDataForm' })
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
dataId: undefined,
|
||||
amount: undefined,
|
||||
certificateno: undefined,
|
||||
certificatetype: undefined,
|
||||
item: undefined,
|
||||
itemname: undefined,
|
||||
itemtype: undefined,
|
||||
itemtypename: undefined,
|
||||
productbatchno: undefined,
|
||||
quantity: undefined,
|
||||
sddate: undefined,
|
||||
sdno: undefined,
|
||||
sdtime: undefined,
|
||||
transactiontypeno: undefined,
|
||||
salepropetyvaluename: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await SaleDataApi.getSaleData(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as SaleDataVO
|
||||
if (formType.value === 'create') {
|
||||
await SaleDataApi.createSaleData(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await SaleDataApi.updateSaleData(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
dataId: undefined,
|
||||
amount: undefined,
|
||||
certificateno: undefined,
|
||||
@ -163,7 +91,72 @@ const resetForm = () => {
|
||||
sdtime: undefined,
|
||||
transactiontypeno: undefined,
|
||||
salepropetyvaluename: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await SaleDataApi.getSaleData(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as SaleDataVO
|
||||
if (formType.value === 'create') {
|
||||
await SaleDataApi.createSaleData(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await SaleDataApi.updateSaleData(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
dataId: undefined,
|
||||
amount: undefined,
|
||||
certificateno: undefined,
|
||||
certificatetype: undefined,
|
||||
item: undefined,
|
||||
itemname: undefined,
|
||||
itemtype: undefined,
|
||||
itemtypename: undefined,
|
||||
productbatchno: undefined,
|
||||
quantity: undefined,
|
||||
sddate: undefined,
|
||||
sdno: undefined,
|
||||
sdtime: undefined,
|
||||
transactiontypeno: undefined,
|
||||
salepropetyvaluename: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
@ -198,7 +198,11 @@
|
||||
<el-table-column label="数据ID" align="center" prop="dataId" />
|
||||
<el-table-column label="金额" align="center" prop="amount" />
|
||||
<el-table-column label="证件号" align="center" prop="certificateno" />
|
||||
<el-table-column label="证件类别" align="center" prop="certificatetype" />
|
||||
<el-table-column label="证件类别" align="center" prop="certificatetype">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CERTIFICATE_TYPE" :value="scope.row.certificatetype" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品ID" align="center" prop="item" />
|
||||
<el-table-column label="产品名称" align="center" prop="itemname" />
|
||||
<el-table-column label="产品类型ID" align="center" prop="itemtype" />
|
||||
@ -208,7 +212,11 @@
|
||||
<el-table-column label="销售日期" align="center" prop="sddate" />
|
||||
<el-table-column label="订单号" align="center" prop="sdno" />
|
||||
<el-table-column label="销售时间" align="center" prop="sdtime" />
|
||||
<el-table-column label="交易类别(订单类型)" align="center" prop="transactiontypeno" />
|
||||
<el-table-column label="交易类别(订单类型)" align="center" prop="transactiontypeno">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.TRANSACTION_TYPE_NO" :value="scope.row.transactiontypeno" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="销售特征名称(票种名称)" align="center" prop="salepropetyvaluename" />
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
@ -248,6 +256,7 @@
|
||||
import download from '@/utils/download'
|
||||
import { SaleDataApi, SaleDataVO } from '@/api/ticket/saledata'
|
||||
import SaleDataForm from './SaleDataForm.vue'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
|
||||
/** 售票 列表 */
|
||||
defineOptions({ name: 'SaleData' })
|
||||
|
Loading…
Reference in New Issue
Block a user