|
@@ -1,26 +1,94 @@
|
|
|
<template>
|
|
|
- <div id="c-achieve">
|
|
|
+ <div id="detail">
|
|
|
<el-row>
|
|
|
- <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
|
|
|
- <el-col :span="24" class="one">系统首页</el-col>
|
|
|
+ <el-col :span="24" class="main" v-loading="loading">
|
|
|
+ <el-col :span="24" class="one">
|
|
|
+ <cForm :span="24" :fields="formFields" :form="form" :rules="rules" @save="onSubmit" @dataChange="dataChange">
|
|
|
+ <template #province>
|
|
|
+ <el-option v-for="(i, index) in provinceList" :key="index" :label="i.label" :value="i.value"></el-option>
|
|
|
+ </template>
|
|
|
+ <template #city>
|
|
|
+ <el-option v-for="(i, index) in cityList" :key="index" :label="i.label" :value="i.value"></el-option>
|
|
|
+ </template>
|
|
|
+ <template #status>
|
|
|
+ <el-option v-for="(i, index) in statusList" :key="index" :label="i.label" :value="i.value"></el-option>
|
|
|
+ </template>
|
|
|
+ </cForm>
|
|
|
+ </el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-// 基础
|
|
|
import type { Ref } from 'vue';
|
|
|
-// reactive,
|
|
|
-import { onMounted, ref } from 'vue';
|
|
|
+import { ref, reactive, onMounted } from 'vue';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
+import type { FormRules } from 'element-plus';
|
|
|
+import store from '@/stores/counter';
|
|
|
// 接口
|
|
|
+import { DictDataStore } from '@common/src/stores/system/dictData'; // 字典表
|
|
|
+import { DockStore } from '@common/src/stores/allAdmin/dock';
|
|
|
+import type { IQueryResult } from '@/util/types.util';
|
|
|
+const dock = DockStore();
|
|
|
+const dictData = DictDataStore();
|
|
|
+
|
|
|
// 加载中
|
|
|
-const loading: Ref<any> = ref(false);
|
|
|
+const loading = ref(false);
|
|
|
+let user: Ref<any> = ref({});
|
|
|
+// 表单
|
|
|
+let form: Ref<any> = ref({});
|
|
|
+let formFields: Ref<any[]> = ref([
|
|
|
+ { label: '房间号', model: 'room_id', options: { disabled: true } },
|
|
|
+ { label: '标题', model: 'title' },
|
|
|
+ { label: '开始时间', model: 'start_time', type: 'datetime' },
|
|
|
+ { label: '结束时间', model: 'end_time', type: 'datetime' },
|
|
|
+ { label: '省份', model: 'province', type: 'select' },
|
|
|
+ { label: '市区', model: 'city', type: 'select' },
|
|
|
+ { label: '负责人', model: 'contact' },
|
|
|
+ { label: '手机号', model: 'phone' },
|
|
|
+ { label: '主办方', model: 'sponsor' },
|
|
|
+ { label: '承办方', model: 'organizer' },
|
|
|
+ { label: '状态', model: 'status', type: 'select' }
|
|
|
+]);
|
|
|
+const rules = reactive<FormRules>({});
|
|
|
|
|
|
-// 请求
|
|
|
+// 字典表
|
|
|
+let statusList: Ref<any> = ref([]);
|
|
|
+let provinceList: Ref<any> = ref([]);
|
|
|
+let cityList: Ref<any> = ref([]);
|
|
|
onMounted(async () => {
|
|
|
loading.value = true;
|
|
|
+ user.value = store.state.user;
|
|
|
+ await searchOther();
|
|
|
+ await search();
|
|
|
loading.value = false;
|
|
|
});
|
|
|
+const search = async () => {
|
|
|
+ let res: IQueryResult = await dock.fetch(user.value._id);
|
|
|
+ if (res.errcode == 0) form.value = res.data as {};
|
|
|
+};
|
|
|
+const dataChange = (e: { model: string; value: any }) => {
|
|
|
+ const { model, value } = e;
|
|
|
+ if (model == 'province') {
|
|
|
+ let data = provinceList.value.find((i) => i.value == value);
|
|
|
+ if (data && data.children.length > 0) cityList.value = data.children;
|
|
|
+ }
|
|
|
+};
|
|
|
+// 提交
|
|
|
+const onSubmit = async (data) => {
|
|
|
+ let res: IQueryResult = await dock.update(data);
|
|
|
+ if (res.errcode == 0) ElMessage({ type: `success`, message: `维护信息成功` });
|
|
|
+};
|
|
|
+
|
|
|
+const searchOther = async () => {
|
|
|
+ let res: IQueryResult;
|
|
|
+ // 状态
|
|
|
+ res = await dictData.query({ type: 'dock_status' });
|
|
|
+ if (res.errcode == 0) statusList.value = res.data;
|
|
|
+ // 省市
|
|
|
+ res = await dictData.query({ type: 'common_city' });
|
|
|
+ if (res.errcode == 0) provinceList.value = res.data;
|
|
|
+};
|
|
|
</script>
|
|
|
<style scoped lang="scss"></style>
|