源文件

This commit is contained in:
gyq
2024-05-23 14:39:33 +08:00
commit a1128dd791
2997 changed files with 500069 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
<template>
<a-form v-if="vdata.deviceType == 2" ref="formRef" :model="vdata.bizConfig" layout="vertical" :rules="vdata.formRules">
<a-divider orientation="left">
<a-tag color="#FF4B33">其他配置</a-tag>
</a-divider>
<a-row justify="space-between" type="flex">
<a-col v-if="vdata.provider != 'fe'" :span="11">
<a-form-item label="打印机模式" name="printMode">
<a-radio-group v-model:value="vdata.bizConfig.printMode">
<a-radio :value="1">仅打印</a-radio>
<a-radio :value="2">仅播报</a-radio>
<a-radio :value="3">打印并播报</a-radio>
</a-radio-group>
</a-form-item>
</a-col>
<a-col :span="11">
<a-form-item label="打印联数" name="printNum">
<a-radio-group v-model:value="vdata.bizConfig.printNum">
<a-input v-model:value="vdata.bizConfig.printNum" placeholder="请输入打印联数" />
</a-radio-group>
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
<script lang="ts" setup>
import {reactive, ref, defineExpose} from 'vue'
// 当前的form
const formRef = ref()
const vdata = reactive({
isShow: false,
deviceType: 0, // 1-云喇叭 2-云打印 3-扫码POS
provider: '', // 厂商,飞鹅打印机无播报,特殊处理
// 配置对象
bizConfig: {} as any,
// 表单规则
formRules: {
printMode: [{ required: true, type: 'number', message: '请选择打印机模式', trigger: 'blur' }],
printNum: [{ required: true, message: '请输入打印联数', trigger: 'blur' }],
}
})
// 对外提供的页面的渲染函数 ifDefineArray = 接口的配置定义项数组, bizConfig = 当前配置项
function pageRender(bizConfig: any, deviceType: number, provider: string){
// 赋值
if (bizConfig) {
vdata.bizConfig = bizConfig
}
vdata.deviceType = deviceType
vdata.provider = provider
// 重置form验证
if (formRef.value !== undefined && formRef.value !== null) {
formRef.value.resetFields()
}
vdata.isShow = true
}
// 对外提供的获取配置参数函数 返回JSON类型
function getConfigParams(){
// 云喇叭 扫码POS 暂无业务配置,直接返回
if (vdata.deviceType == 1 || vdata.deviceType == 3) {
vdata.isShow = false
return Promise.resolve()
}
return formRef.value.validate().then( () => {
vdata.isShow = false
return vdata.bizConfig
})
}
defineExpose({ getConfigParams, pageRender })
</script>