guhongwei 2 anni fa
parent
commit
8a6a00cc69

+ 20 - 0
src/router/module/admin.ts

@@ -88,5 +88,25 @@ export default [
     path: '/subscribe/order/detail',
     path: '/subscribe/order/detail',
     meta: { title: '信息管理' },
     meta: { title: '信息管理' },
     component: () => import('@/views/subscribe/order/detail.vue')
     component: () => import('@/views/subscribe/order/detail.vue')
+  },
+  {
+    path: '/project/notice',
+    meta: { title: '通知管理' },
+    component: () => import('@/views/project/notice/index.vue')
+  },
+  {
+    path: '/project/notice/detail',
+    meta: { title: '信息管理' },
+    component: () => import('@/views/project/notice/detail.vue')
+  },
+  {
+    path: '/project/info',
+    meta: { title: '通知管理' },
+    component: () => import('@/views/project/info/index.vue')
+  },
+  {
+    path: '/project/info/detail',
+    meta: { title: '信息管理' },
+    component: () => import('@/views/project/info/detail.vue')
   }
   }
 ];
 ];

+ 38 - 0
src/views/project/info/detail.vue

@@ -0,0 +1,38 @@
+<template>
+  <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>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+// 基础
+import type { Ref } from 'vue';
+// reactive,
+import { onMounted, ref, getCurrentInstance } from 'vue';
+// 接口
+//import { TestStore } from '@common/src/stores/test';
+//import type { IQueryResult } from '@/util/types.util';
+//const testAxios = TestStore();
+const { proxy } = getCurrentInstance() as any;
+// 加载中
+const loading: Ref<any> = ref(false);
+// 分页数据
+//  const skip = 0;
+//  const limit = proxy.limit;;
+// 请求
+onMounted(async () => {
+  loading.value = true;
+  //  await search({ skip, limit });
+  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);
+//};
+</script>
+<style scoped lang="scss"></style>

+ 38 - 0
src/views/project/info/index.vue

@@ -0,0 +1,38 @@
+<template>
+  <div id="index">
+    <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>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+// 基础
+import type { Ref } from 'vue';
+// reactive,
+import { onMounted, ref, getCurrentInstance } from 'vue';
+// 接口
+//import { TestStore } from '@common/src/stores/test';
+//import type { IQueryResult } from '@/util/types.util';
+//const testAxios = TestStore();
+const { proxy } = getCurrentInstance() as any;
+// 加载中
+const loading: Ref<any> = ref(false);
+// 分页数据
+//  const skip = 0;
+//  const limit = proxy.limit;;
+// 请求
+onMounted(async () => {
+  loading.value = true;
+  //  await search({ skip, limit });
+  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);
+//};
+</script>
+<style scoped lang="scss"></style>

+ 114 - 0
src/views/project/notice/detail.vue

@@ -0,0 +1,114 @@
+<template>
+  <div id="detail">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <el-col :span="24" class="one">
+          <cSearch :is_title="false" :is_back="true" @toBack="toBack"></cSearch>
+        </el-col>
+        <el-col :span="24" class="two">
+          <cForm :span="24" :fields="fields" :form="form" :rules="rules" @save="toSave">
+            <template #img_url="{ item }">
+              <cUpload
+                :model="item.model"
+                :limit="6"
+                url="/files/zkzx/project/upload"
+                :list="form[item.model]"
+                listType="picture-card"
+                @change="onUpload"
+              ></cUpload>
+            </template>
+            <template #file_url="{ item }">
+              <cUpload :model="item.model" :limit="1" url="/files/zkzx/project/upload" :list="form[item.model]" @change="onUpload"></cUpload>
+            </template>
+            <template #content>
+              <cEditor v-model="form.content" url="/files/zkzx/news/upload"></cEditor>
+            </template>
+            <template #is_use>
+              <el-option v-for="(i, index) in is_useList" :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';
+import { ref, reactive, onMounted } from 'vue';
+import { useRoute } from 'vue-router';
+import { ElMessage } from 'element-plus';
+import type { FormRules } from 'element-plus';
+// 接口
+import { ProjectNoticeStore } from '@common/src/stores/project/projectNotice';
+import { DictDataStore } from '@common/src/stores/system/dictData'; // 字典表
+import type { IQueryResult } from '@/util/types.util';
+const noticeAxios = ProjectNoticeStore();
+const dictAxios = DictDataStore();
+
+// 路由
+const route = useRoute();
+
+// 加载中
+const loading: Ref<any> = ref(false);
+
+// 表单
+let form: Ref<any> = ref({});
+let fields: Ref<any[]> = ref([
+  { label: '年度', model: 'year', type: 'year' },
+  { label: '标题', model: 'title' },
+  { label: '来源', model: 'origin' },
+  { label: '发布时间', model: 'create_date', type: 'date' },
+  { label: '信息简介', model: 'brief' },
+  { label: '图片文件', model: 'img_url', custom: true },
+  { label: '附件文件', model: 'file_url', custom: true },
+  { label: '内容', model: 'content', custom: true },
+  { label: '是否启用', model: 'is_use', type: 'select' }
+]);
+const rules = reactive<FormRules>({});
+
+// 字典表
+
+let is_useList: Ref<any> = ref([]);
+// 请求
+onMounted(async () => {
+  loading.value = true;
+  await searchOther();
+  await search();
+  loading.value = false;
+});
+const search = async () => {
+  if (route.query.id) {
+    let res: IQueryResult = await noticeAxios.fetch(route.query.id);
+    if (res.errcode == 0) form.value = res.data as {};
+  } else form.value = { is_use: '0' };
+};
+const onUpload = (e: { model: string; value: Array<[]> }) => {
+  const { model, value } = e;
+  form.value[model] = value;
+};
+// 提交
+const toSave = async (data) => {
+  let res: IQueryResult;
+  if (data._id) res = await noticeAxios.update(data);
+  else res = await noticeAxios.create(data);
+  if (res.errcode == 0) {
+    ElMessage({ type: `success`, message: `维护信息成功` });
+    toBack();
+  }
+};
+
+const searchOther = async () => {
+  let res: IQueryResult;
+  // 是否使用
+  res = await dictAxios.query({ type: 'common_use' });
+  if (res.errcode == 0) is_useList.value = res.data;
+};
+
+// 返回上一页
+const toBack = () => {
+  window.history.go(-1);
+};
+</script>
+<style scoped lang="scss"></style>

+ 125 - 0
src/views/project/notice/index.vue

@@ -0,0 +1,125 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <el-col :span="24" class="one">
+          <cSearch :is_title="false" :is_search="true" :fields="fields" @search="toSearch">
+            <template #is_use>
+              <el-option v-for="i in is_useList" :key="i.value" :label="i.label" :value="i.value"></el-option>
+            </template>
+          </cSearch>
+        </el-col>
+        <el-col :span="24" class="two">
+          <cButton @toAdd="toAdd"></cButton>
+        </el-col>
+        <el-col :span="24" class="thr">
+          <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @edit="toEdit" @del="toDel"> </cTable>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+// 基础
+import type { Ref } from 'vue';
+import { onMounted, ref, getCurrentInstance } from 'vue';
+import { useRouter } from 'vue-router';
+import { ElMessage } from 'element-plus';
+// 接口
+import { ProjectNoticeStore } from '@common/src/stores/project/projectNotice';
+import { DictDataStore } from '@common/src/stores/system/dictData'; // 字典表
+import type { IQueryResult } from '@/util/types.util';
+const noticeAxios = ProjectNoticeStore();
+const dictAxios = DictDataStore();
+
+const { proxy } = getCurrentInstance() as any;
+
+// 路由
+const router = useRouter();
+// 加载中
+const loading: Ref<any> = ref(false);
+
+let list: Ref<any> = ref([]);
+let total: Ref<number> = ref(0);
+let skip = 0;
+let limit: number = proxy.$limit;
+// 列表
+let fields: Ref<any[]> = ref([
+  { label: '年度', model: 'year', isSearch: true },
+  { label: '标题', model: 'title', isSearch: true },
+  { label: '来源', model: 'origin' },
+  { label: '发布时间', model: 'create_date' },
+  { label: '是否启用', model: 'is_use', format: (i: any) => getDict(i, 'is_use'), isSearch: true, type: 'select' }
+]);
+// 操作
+let opera: Ref<any[]> = ref([
+  { label: '修改', method: 'edit' },
+  { label: '删除', method: 'del', confirm: true, type: 'danger' }
+]);
+
+// 查询数据
+let searchForm: Ref<any> = ref({});
+
+// 字典表
+const is_useList: Ref<any> = ref([]);
+
+// 请求
+onMounted(async () => {
+  loading.value = true;
+  await searchOther();
+  await search({ skip, limit });
+  loading.value = false;
+});
+const search = async (e: { skip: number; limit: number }) => {
+  const info = { skip: e.skip, limit: e.limit, ...searchForm.value };
+  const res: IQueryResult = await noticeAxios.query(info);
+  if (res.errcode == '0') {
+    list.value = res.data;
+    total.value = res.total;
+  }
+};
+const toSearch = (query) => {
+  searchForm.value = query;
+  search({ skip, limit });
+};
+const getDict = (e, model) => {
+  if (model == 'is_use') {
+    let data: any = is_useList.value.find((i: any) => i.value == e);
+    if (data) return data.label;
+    else return '暂无';
+  }
+};
+// 添加
+const toAdd = () => {
+  router.push({ path: '/project/notice/detail' });
+};
+// 修改
+const toEdit = (data) => {
+  router.push({ path: '/project/notice/detail', query: { id: data._id } });
+};
+// 删除
+const toDel = async (data) => {
+  let res: IQueryResult = await noticeAxios.del(data._id);
+  if (res.errcode == '0') {
+    ElMessage({ message: '删除信息成功', type: 'success' });
+    search({ skip, limit });
+  } else {
+    ElMessage({ message: `${res.errmsg}`, type: 'error' });
+  }
+};
+// 查询其他信息
+const searchOther = async () => {
+  let res: IQueryResult;
+  // 是否使用
+  res = await dictAxios.query({ type: 'common_use' });
+  if (res.errcode == '0') is_useList.value = res.data;
+};
+</script>
+<style scoped lang="scss">
+.main {
+  .two {
+    margin: 0 0 10px 0;
+  }
+}
+</style>