|
@@ -0,0 +1,71 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <BasicForm @register="registerForm" layout="vertical">
|
|
|
|
|
+ <template #logo="{ model, field }">
|
|
|
|
|
+ <Upload
|
|
|
|
|
+ name="file"
|
|
|
|
|
+ @change="handleChange"
|
|
|
|
|
+ :action="uploadUrl"
|
|
|
|
|
+ :showUploadList="false"
|
|
|
|
|
+ accept=".jpg,.jpeg,.gif,.png,.webp"
|
|
|
|
|
+ >
|
|
|
|
|
+ <img :src="model[field]" class="img-avatar" />
|
|
|
|
|
+ </Upload>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </BasicForm>
|
|
|
|
|
+ <a-button @click="handleSubmit">提交</a-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script lang="ts" setup>
|
|
|
|
|
+ import { BasicForm, useForm } from '/@/components/Form';
|
|
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
|
|
+ import { dataFormSchema } from './data';
|
|
|
|
|
+ import { useGlobSetting } from '/@/hooks/setting';
|
|
|
|
|
+ import { Upload } from 'ant-design-vue';
|
|
|
|
|
+ import { sysSettingEdit, sysSettingDetail } from '/@/api/sys/sysSettingApi';
|
|
|
|
|
+ import { onMounted } from 'vue';
|
|
|
|
|
+
|
|
|
|
|
+ onMounted(async () => {
|
|
|
|
|
+ const res = await sysSettingDetail();
|
|
|
|
|
+ await setFieldsValue({ ...res });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ const { uploadUrl } = useGlobSetting();
|
|
|
|
|
+ const { createMessage } = useMessage();
|
|
|
|
|
+ const [registerForm, { setFieldsValue, validate }] = useForm({
|
|
|
|
|
+ labelWidth: 120,
|
|
|
|
|
+ schemas: dataFormSchema,
|
|
|
|
|
+ showActionButtonGroup: false,
|
|
|
|
|
+ actionColOptions: {
|
|
|
|
|
+ span: 23,
|
|
|
|
|
+ },
|
|
|
|
|
+ baseColProps: {
|
|
|
|
|
+ span: 8,
|
|
|
|
|
+ },
|
|
|
|
|
+ wrapperCol: {
|
|
|
|
|
+ span: 23,
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 提交按钮事件
|
|
|
|
|
+ async function handleSubmit() {
|
|
|
|
|
+ const values = await validate();
|
|
|
|
|
+ console.log('🚀 ~ file: sysConfig.vue:60 ~ handleSubmit ~ values:', values);
|
|
|
|
|
+ await sysSettingEdit(values);
|
|
|
|
|
+ createMessage.success('修改成功');
|
|
|
|
|
+ // await sysPosEdit({ ...values, id: rowId.value });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function handleChange(val) {
|
|
|
|
|
+ console.log('🚀 ~ file: sysConfig.vue:64 ~ handleChange ~ val:', val);
|
|
|
|
|
+ }
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style lang="less" scoped>
|
|
|
|
|
+ .img-avatar {
|
|
|
|
|
+ display: block;
|
|
|
|
|
+ width: 60px;
|
|
|
|
|
+ height: 60px;
|
|
|
|
|
+ }
|
|
|
|
|
+</style>
|