YY 1 anno fa
parent
commit
b72a6e0ecb

+ 7 - 2
src/views/dock/parts/c-achieve.vue

@@ -66,13 +66,18 @@ onMounted(async () => {
 });
 const search = async () => {
   let res: IQueryResult = await dock.fetch(user.value._id);
-  if (res.errcode == 0) form.value = res.data as {};
+  if (res.errcode == 0) {
+    form.value = res.data as {};
+    if (form.value.province) dataChange({ model: 'province', value: form.value.province });
+  }
 };
 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;
+    if (data && data.children.length > 0) {
+      cityList.value = data.children;
+    }
   }
 };
 // 提交

+ 65 - 21
src/views/dock/parts/c-channel.vue

@@ -1,38 +1,82 @@
 <template>
-  <div id="c-channel">
+  <div id="detail">
     <el-row>
-      <el-col :span="24" class="main" v-loading="loading">
-        <el-col :span="24" class="one">系统首页</el-col>
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <el-col :span="24" class="two">
+          <cForm :span="24" :fields="formFields" :form="form" :rules="rules" @save="onSubmit">
+            <template #channel_type>
+              <el-option v-for="(i, index) in typeList" :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, getCurrentInstance } 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 { TestStore } from '@common/src/stores/test';
-//import type { IQueryResult } from '@/util/types.util';
-//const testAxios = TestStore();
-const { proxy } = getCurrentInstance() as any;
+import { DictDataStore } from '@common/src/stores/system/dictData'; // 字典表
+import { ChannelStore } from '@common/src/stores/allAdmin/channel';
+
+import type { IQueryResult } from '@/util/types.util';
+const channel = ChannelStore();
+const dictData = DictDataStore();
+
 // 加载中
-const loading: Ref<any> = ref(false);
-// 分页数据
-//  const skip = 0;
-//  const limit = proxy.limit;;
-// 请求
+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: 'channel_type', type: 'select' },
+  { label: '标题', model: 'title' },
+  { label: '来源', model: 'origin' },
+  { label: '更新时间', model: 'create_date', type: 'date' },
+  { label: '简介', model: 'brief', type: 'textarea' },
+  { label: '状态', model: 'status', type: 'select' }
+]);
+const rules = reactive<FormRules>({});
+
+// 字典表
+let statusList: Ref<any> = ref([]);
+let typeList: Ref<any> = ref([]);
+
 onMounted(async () => {
   loading.value = true;
-  //  await search({ skip, limit });
+  user.value = store.state.user;
+  await searchOther();
+  await search();
   loading.value = false;
 });
-//const search = async (e: { skip: number; limit: number }) => {
-//  const info = { skip: e.skip, limit: e.limit, ...searchInfo.value  };
-//  const res: IQueryResult = await testAxios.query(info);
-//  console.log(res);
-//};
+const search = async () => {
+  let res: IQueryResult = await channel.fetch(user.value._id);
+  if (res.errcode == 0) form.value = res.data as {};
+};
+// 提交
+const onSubmit = async (data) => {
+  let res: IQueryResult = await channel.update(data);
+  if (res.errcode == 0) ElMessage({ type: `success`, message: `维护信息成功` });
+};
+
+const searchOther = async () => {
+  let res: IQueryResult;
+  // 状态
+  res = await dictData.query({ type: 'channel_status' });
+  if (res.errcode == 0) statusList.value = res.data;
+  // 类别
+  res = await dictData.query({ type: 'channel_type' });
+  if (res.errcode == 0) typeList.value = res.data;
+};
 </script>
 <style scoped lang="scss"></style>

+ 82 - 21
src/views/dock/parts/c-train.vue

@@ -1,38 +1,99 @@
 <template>
-  <div id="c-train">
+  <div id="detail">
     <el-row>
-      <el-col :span="24" class="main" v-loading="loading">
-        <el-col :span="24" class="one">系统首页</el-col>
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <el-col :span="24" class="two">
+          <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, getCurrentInstance } 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 { TestStore } from '@common/src/stores/test';
-//import type { IQueryResult } from '@/util/types.util';
-//const testAxios = TestStore();
-const { proxy } = getCurrentInstance() as any;
+import { DictDataStore } from '@common/src/stores/system/dictData'; // 字典表
+import { TrainStore } from '@common/src/stores/allAdmin/train';
+import type { IQueryResult } from '@/util/types.util';
+const train = TrainStore();
+const dictData = DictDataStore();
+
 // 加载中
-const loading: Ref<any> = ref(false);
-// 分页数据
-//  const skip = 0;
-//  const limit = proxy.limit;;
-// 请求
+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: 'brief', type: 'textarea' },
+  { 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;
-  //  await search({ skip, limit });
+  user.value = store.state.user;
+  await searchOther();
+  await search();
   loading.value = false;
 });
-//const search = async (e: { skip: number; limit: number }) => {
-//  const info = { skip: e.skip, limit: e.limit, ...searchInfo.value  };
-//  const res: IQueryResult = await testAxios.query(info);
-//  console.log(res);
-//};
+const search = async () => {
+  let res: IQueryResult = await train.fetch(user.value._id);
+  if (res.errcode == 0) {
+    form.value = res.data as {};
+    if (form.value.province) dataChange({ model: 'province', value: form.value.province });
+  }
+};
+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 train.update(data);
+  if (res.errcode == 0) ElMessage({ type: `success`, message: `维护信息成功` });
+};
+
+const searchOther = async () => {
+  let res: IQueryResult;
+  // 状态
+  res = await dictData.query({ type: 'train_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>