|
|
@@ -54,7 +54,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="ts" setup name="business-management-schoolOpen">
|
|
|
- import { TypographyTitle, Divider, QRCode } from 'ant-design-vue';
|
|
|
+ import { TypographyTitle, Divider, QRCode, message } from 'ant-design-vue';
|
|
|
import { BasicForm, useForm, ApiSelect } from '/@/components/Form/index';
|
|
|
import ZtCustomTable from '/@/components/ZtCustomTable/index.vue';
|
|
|
import { Business } from '../gymnasiumBag/gymnasiumBag.api';
|
|
|
@@ -64,6 +64,7 @@
|
|
|
import { ref, unref } from 'vue';
|
|
|
import { useRouter } from 'vue-router';
|
|
|
import { storeToRefs } from 'pinia';
|
|
|
+ import { areAllItemsAllFieldsFilled } from '@/utils';
|
|
|
|
|
|
const { userInfo, getIsMerchant } = storeToRefs(useUserStore());
|
|
|
const router = useRouter();
|
|
|
@@ -81,30 +82,41 @@
|
|
|
await validate();
|
|
|
isSubmit.value = true;
|
|
|
const form = await getFieldsValue();
|
|
|
- console.log(form, 'formData');
|
|
|
+ console.log(form.noTeachingDay, 'form', form.teachingDay);
|
|
|
+ const newNoTeachingDay = form.noTeachingDay.map((it) => {
|
|
|
+ return {
|
|
|
+ ticketNum: it.editValueRefs.ticketNum ? unref(it.editValueRefs.ticketNum) : null,
|
|
|
+ startTime: it.editValueRefs.time ? unref(it.editValueRefs.time)[0] : null,
|
|
|
+ endTime: it.editValueRefs.time ? unref(it.editValueRefs.time)[1] : null,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ const newTeachingDay = form.teachingDay.map((it) => {
|
|
|
+ return {
|
|
|
+ ticketNum: it.editValueRefs.ticketNum ? unref(it.editValueRefs.ticketNum) : null,
|
|
|
+ startTime: it.editValueRefs.time ? unref(it.editValueRefs.time)[0] : null,
|
|
|
+ endTime: it.editValueRefs.time ? unref(it.editValueRefs.time)[1] : null,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ if (!areAllItemsAllFieldsFilled(newTeachingDay)) {
|
|
|
+ isSubmit.value = false;
|
|
|
+ return message.error('请填写完整的教学日信息');
|
|
|
+ }
|
|
|
+ if (!areAllItemsAllFieldsFilled(newNoTeachingDay)) {
|
|
|
+ isSubmit.value = false;
|
|
|
+
|
|
|
+ return message.error('请填写完整的非教学日信息');
|
|
|
+ }
|
|
|
|
|
|
const newObj = {
|
|
|
...form,
|
|
|
noTeachingDay: JSON.stringify({
|
|
|
- data: form.noTeachingDay.map((it) => {
|
|
|
- return {
|
|
|
- ticketNum: unref(it.editValueRefs.ticketNum),
|
|
|
- startTime: unref(it.editValueRefs.time)[0],
|
|
|
- endTime: unref(it.editValueRefs.time)[1],
|
|
|
- };
|
|
|
- }),
|
|
|
+ data: newNoTeachingDay,
|
|
|
}),
|
|
|
teachingDay: JSON.stringify({
|
|
|
- data: form.teachingDay.map((it) => {
|
|
|
- return {
|
|
|
- ticketNum: unref(it.editValueRefs.ticketNum),
|
|
|
- startTime: unref(it.editValueRefs.time)[0],
|
|
|
- endTime: unref(it.editValueRefs.time)[1],
|
|
|
- };
|
|
|
- }),
|
|
|
+ data: newTeachingDay,
|
|
|
}),
|
|
|
};
|
|
|
- // console.log(form);
|
|
|
+ console.log(newObj, 'newObj');
|
|
|
try {
|
|
|
await saveOrUpdate(newObj);
|
|
|
isSubmit.value = false;
|
|
|
@@ -117,6 +129,7 @@
|
|
|
}
|
|
|
|
|
|
const qrcodeCanvasRef = ref();
|
|
|
+
|
|
|
async function downloadImage() {
|
|
|
const url = await qrcodeCanvasRef.value.toDataURL();
|
|
|
const a = document.createElement('a');
|
|
|
@@ -151,14 +164,15 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- const siteId=ref()
|
|
|
+ const siteId = ref();
|
|
|
+
|
|
|
function handleCommonSet(res) {
|
|
|
// console.log( res,'获取数据')
|
|
|
- siteId.value=res.siteId
|
|
|
- console.log( `https://api.qlapp.cn/school/?placeId=${siteId.value}`,'获取到的siteid')
|
|
|
+ siteId.value = res.siteId;
|
|
|
+ console.log(`https://api.qlapp.cn/school/?placeId=${siteId.value}`, '获取到的siteid');
|
|
|
setFieldsValue({
|
|
|
...res,
|
|
|
- insureIds: res.insureIds.split(','),
|
|
|
+ insureIds: res.insureIds ? res.insureIds.split(',') : '',
|
|
|
noTeachingDay: res.noTeachingDay
|
|
|
? JSON.parse(res.noTeachingDay).data.map((it) => {
|
|
|
return { ...it, time: [it.startTime, it.endTime] };
|