|
@@ -6,12 +6,17 @@
|
|
|
@visible-change="handleVisibleChange"
|
|
|
@cancel="resetFields"
|
|
|
@ok="handleSubmit"
|
|
|
- >
|
|
|
+ >Checkbox
|
|
|
<div class="pt-2px pr-3px">
|
|
|
<BasicForm @register="registerForm" :model="model" >
|
|
|
<template #text="{ model, field }">
|
|
|
{{ model[field] }}
|
|
|
</template>
|
|
|
+ <template #Checkbox="{ model, field }">
|
|
|
+ <div>
|
|
|
+ <Checkbox v-model:checked="model[field]">(勾选此项,将在四维看看官网置顶)</Checkbox>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</BasicForm>
|
|
|
</div>
|
|
|
</BasicModal>
|
|
@@ -20,13 +25,14 @@
|
|
|
import { defineComponent, ref, nextTick, onMounted, reactive } from 'vue';
|
|
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
|
|
import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
|
|
|
+ import { Checkbox } from 'ant-design-vue';
|
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
- import { EditAndUpload, } from '/@/api/product/index';
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
+ import { uploadApi, SpaceSdkUpdate } from '/@/api/product/index';
|
|
|
|
|
|
const { t } = useI18n();
|
|
|
export default defineComponent({
|
|
|
- components: { BasicModal, BasicForm },
|
|
|
+ components: { BasicModal, BasicForm, Checkbox },
|
|
|
props: {
|
|
|
userData: { type: Object },
|
|
|
},
|
|
@@ -39,6 +45,14 @@
|
|
|
const { createMessage } = useMessage();
|
|
|
const schemas: FormSchema[] = [
|
|
|
{
|
|
|
+ field: 'fileUrl',
|
|
|
+ component: 'Input',
|
|
|
+ label: t('routes.product.types'),
|
|
|
+ show: false,
|
|
|
+ colProps: {
|
|
|
+ span: 24,
|
|
|
+ },
|
|
|
+ },{
|
|
|
field: 'id',
|
|
|
component: 'Input',
|
|
|
label: t('routes.product.types'),
|
|
@@ -47,7 +61,7 @@
|
|
|
span: 24,
|
|
|
},
|
|
|
},{
|
|
|
- field: 'type',
|
|
|
+ field: 'platformType',
|
|
|
component: 'Input',
|
|
|
label: t('routes.product.types'),
|
|
|
show: false,
|
|
@@ -55,14 +69,13 @@
|
|
|
span: 24,
|
|
|
},
|
|
|
},{
|
|
|
- field: 'name',
|
|
|
+ field: 'type',
|
|
|
component: 'Input',
|
|
|
label: t('routes.product.types'),
|
|
|
slot: 'text',
|
|
|
colProps: {
|
|
|
span: 24,
|
|
|
},
|
|
|
- // required: true,
|
|
|
},
|
|
|
{
|
|
|
field: 'version',
|
|
@@ -97,63 +110,37 @@
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
- field: 'minVersion',
|
|
|
- component: 'Input',
|
|
|
- label: t('routes.product.minVersion'),
|
|
|
+ field: 'imprintCh',
|
|
|
+ component: 'InputTextArea',
|
|
|
required: true,
|
|
|
- rules: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- // @ts-ignore
|
|
|
- validator: async (rule, value) => {
|
|
|
- const regPos = /.*[\u4e00-\u9fa5]+.*$/; // 非中文
|
|
|
- if (!value) {
|
|
|
- return Promise.reject(t('common.inputText')+t('routes.product.minVersion'));
|
|
|
- }
|
|
|
- if (regPos.test(value)) {
|
|
|
- /* eslint-disable-next-line */
|
|
|
- return Promise.reject('不支持中文字符');
|
|
|
- }
|
|
|
- return Promise.resolve();
|
|
|
- },
|
|
|
- trigger: 'change',
|
|
|
- },
|
|
|
- ],
|
|
|
+ label: t('routes.product.description_zh'),
|
|
|
colProps: {
|
|
|
span: 24,
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
- field: 'description',
|
|
|
+ field: 'imprintEn',
|
|
|
component: 'InputTextArea',
|
|
|
required: true,
|
|
|
- label: t('routes.product.description'),
|
|
|
+ label: t('routes.product.description_en'),
|
|
|
+ colProps: {
|
|
|
+ span: 24,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'isTop',
|
|
|
+ component: 'CheckboxGroup',
|
|
|
+ label: '官网置顶',
|
|
|
+ slot:'Checkbox',
|
|
|
+ componentProps: {
|
|
|
+ options: [
|
|
|
+ { label: '(勾选此项,将在四维看看官网置顶)', value: 1 },
|
|
|
+ ],
|
|
|
+ },
|
|
|
colProps: {
|
|
|
span: 24,
|
|
|
},
|
|
|
},
|
|
|
- // {
|
|
|
- // field: 'file',
|
|
|
- // component: 'Upload',
|
|
|
- // label: t('routes.product.file'),
|
|
|
- // required: true,
|
|
|
- // rules: [{ required: true, message: t('common.uploadMessge') }],
|
|
|
- // itemProps: {
|
|
|
- // validateTrigger: 'onBlur',
|
|
|
- // },
|
|
|
- // componentProps: {
|
|
|
- // api: uploadApi,
|
|
|
- // maxNumber: 1,
|
|
|
- // maxSize: 1000,
|
|
|
- // fileFlow:true,
|
|
|
- // accept: ['4dage'],
|
|
|
- // afterFetch: function (data) {
|
|
|
- // console.log('uploadApi',data)
|
|
|
- // Reflect.set(data, 'url', data.file);
|
|
|
- // fileFlow.file = data.file
|
|
|
- // return data;
|
|
|
- // },
|
|
|
- // },
|
|
|
];
|
|
|
const [registerForm, { validate, resetFields, setFieldsValue }] = useForm({
|
|
|
labelWidth: 120,
|
|
@@ -166,14 +153,15 @@
|
|
|
onMounted(() => {});
|
|
|
let addListFunc = () => {};
|
|
|
const [register, { closeModal }] = useModalInner((data) => {
|
|
|
+ console.log('useModalInner',data)
|
|
|
data && onDataReceive(data);
|
|
|
});
|
|
|
function renderOwnTypeLabel(type: number): string {
|
|
|
switch (type) {
|
|
|
case 2:
|
|
|
- return t('routes.product.type.2');
|
|
|
+ return t('routes.product.sdkType.2');
|
|
|
case 1:
|
|
|
- return t('routes.product.type.1');
|
|
|
+ return t('routes.product.sdkType.1');
|
|
|
case 3:
|
|
|
return t('routes.product.type.3');
|
|
|
default:
|
|
@@ -198,12 +186,13 @@
|
|
|
}
|
|
|
function onDataReceive(data) {
|
|
|
modelRef.value = data
|
|
|
- console.log('onDataReceive',data)
|
|
|
- resetFields();
|
|
|
- setFieldsValue({
|
|
|
+ let setData = {
|
|
|
...data,
|
|
|
type:renderOwnTypeLabel(Number(data.type)),
|
|
|
- });
|
|
|
+ }
|
|
|
+ console.log('onDataReceive',data,setData)
|
|
|
+ resetFields();
|
|
|
+ setFieldsValue(setData);
|
|
|
}
|
|
|
const handleSubmit = async () => {
|
|
|
try {
|
|
@@ -212,9 +201,10 @@
|
|
|
const apiData = {
|
|
|
// ...modelRef.value,
|
|
|
...params as any,
|
|
|
+ isTop:params.isTop?1:0
|
|
|
}
|
|
|
console.log('res', apiData);
|
|
|
- const res = await EditAndUpload(apiData);
|
|
|
+ const res = await SpaceSdkUpdate(apiData);
|
|
|
console.log('res', res);
|
|
|
closeModal();
|
|
|
resetFields();
|