Procházet zdrojové kódy

Merge branch 'liuheng' into dev

刘恒 před 1 rokem
rodič
revize
b4f1b71ea2

+ 2 - 0
src/api/index.ts

@@ -15,6 +15,7 @@ import menuApi from './modules/menu.ts'
 import commonApi from "./modules/common.ts";
 import teamApi from "@/api/modules/team.ts";
 import representativeApi from "@/api/modules/representative.ts"
+import contentApi from "@/api/modules/content.ts"
 // import { useRouter } from 'vue-router'
 // const router = useRouter()
 import router from "@/router"
@@ -113,5 +114,6 @@ const api = {
   teamApi: teamApi(axiosInstance),
   representativeApi: representativeApi(axiosInstance),
   lotteryApi: lotteryApi(axiosInstance)
+  contentApi:contentApi(axiosInstance)
 }
 export default api

+ 40 - 0
src/api/modules/content.ts

@@ -0,0 +1,40 @@
+import { ApiInstance } from '../type'
+interface contentData {
+  [key: string]: any; // 允许其他任意字段
+}
+const contentApi = (axiosInstance: ApiInstance) => ({
+  // 消息通知列表
+  noticeList: (data: contentData) => axiosInstance.post('/msssageNotice/noticeList', data, {}),
+
+  // 添加消息通知
+  noticeAdd: (data: contentData) => axiosInstance.post('/msssageNotice/noticeAdd', data, {}),
+
+   // 消息详情
+  noticeGet: (params: contentData) => axiosInstance.get('/msssageNotice/noticeGet', {params}),
+
+  //编辑消息通知
+  noticeEdit: (data: contentData) => axiosInstance.post('/msssageNotice/noticeEdit', data, {}),
+
+  //删除消息通知
+  noticeDelete: (data: contentData) => axiosInstance.delete('/msssageNotice/noticeDelete?ids='+data,),
+
+  //通知消息人员分页列表
+  contentUserList: (data: contentData) => axiosInstance.post('/msssageNotice/userList', data, {}),
+
+  //消息列表
+  messageList: (data: contentData) => axiosInstance.post('/message/messageList', data, {}),
+
+  // 消息数量
+  noticeCount: (params: contentData) => axiosInstance.get('/message/getMessageCount', {params}),
+
+  // 阅读消息
+  readMessage: (data: contentData) => axiosInstance.post('/message/readEdit', data, {}),
+
+  
+  
+})
+
+export default contentApi
+
+
+

+ 7 - 3
src/components/Table/index.vue

@@ -48,7 +48,7 @@
             
           </template>
         </el-table-column>
-        <el-table-column label="操作">
+        <el-table-column label="操作" v-if="showOperation">
           <template #default="scope">
             <slot name="operation" :operationData="scope"></slot>
           </template>
@@ -88,7 +88,7 @@ interface TagTypes {
   [key: string]: string;
 }
 const emit = defineEmits(['getList', 'selectAllChange','selectChange']);
-const props = defineProps<{
+interface Props{
   tableData: Array<TableRow>;
   columns: {
     prop: string;
@@ -107,8 +107,12 @@ const props = defineProps<{
   };
   showSelect: boolean;
   showIndex: boolean;
+  showOperation:boolean;
   treeProps:{}
-}>();
+}
+const props = withDefaults(defineProps<Props>(),{
+  showOperation:true,
+})
 const multipleTableRef = ref<TableInstance>();
 const TableData = ref<TableRow[]>();
 onMounted(() => {

+ 13 - 9
src/layouts/components/Topbar/Toolbar/rightSide.vue

@@ -2,11 +2,12 @@
 import useSettingsStore from '@/store/modules/settings'
 import useUserStore from '@/store/modules/user'
 import eventBus from '@/utils/eventBus'
-import ColorScheme from './ColorScheme/index.vue'
-import Fullscreen from './Fullscreen/index.vue'
-import NavSearch from './NavSearch/index.vue'
-import PageReload from './PageReload/index.vue'
-
+// import ColorScheme from './ColorScheme/index.vue'
+// import Fullscreen from './Fullscreen/index.vue'
+// import NavSearch from './NavSearch/index.vue'
+// import PageReload from './PageReload/index.vue'
+import {Bell} from "@element-plus/icons-vue"
+import {useRouter} from "vue-router"
 defineOptions({
   name: 'Tools',
 })
@@ -26,10 +27,13 @@ watch(() => userStore.avatar, () => {
 
 <template>
   <div class="flex items-center">
-    <NavSearch v-if="settingsStore.settings.toolbar.navSearch" />
-    <Fullscreen v-if="settingsStore.settings.toolbar.fullscreen" />
-    <PageReload v-if="settingsStore.settings.toolbar.pageReload" />
-    <ColorScheme v-if="settingsStore.settings.toolbar.colorScheme" />
+    <el-icon @click="router.push({
+      path:'/content/notice',
+    })"><Bell /></el-icon>
+    <!-- <NavSearch v-if="settingsStore.settings.toolbar.navSearch" /> -->
+    <!-- <Fullscreen v-if="settingsStore.settings.toolbar.fullscreen" /> -->
+    <!-- <PageReload v-if="settingsStore.settings.toolbar.pageReload" /> -->
+    <!-- <ColorScheme v-if="settingsStore.settings.toolbar.colorScheme" /> -->
     <HDropdownMenu
       :items="[
         [

+ 11 - 0
src/router/modules/content.ts

@@ -32,6 +32,17 @@ const routes: RouteRecordRaw = {
         
       ]
     },
+    {
+      path: 'notice',
+      name: 'contentNotice',
+      component: () => import('@/views/contentManagement/notice.vue'),
+      meta: {
+        title: '消息提醒',
+        menu:false
+      },
+      
+      
+    },
     
     
    

+ 1 - 1
src/router/modules/personnel.ts

@@ -56,7 +56,7 @@ const routes: RouteRecordRaw = {
       component: () => import('@/views/personnel/roleManagement.vue'),
       meta: {
         title: '角色管理',
-        auth:['role.add','role.view','role.delete','role.edit']
+        // auth:['role.add','role.view','role.delete','role.edit']
       },
     },
   ],

+ 268 - 248
src/views/contentManagement/message.vue

@@ -1,128 +1,120 @@
 <template>
   <div class="institution">
     <div class="institution-main">
-          <el-form label-position="left" label-width="auto">
-            <el-row :gutter="24">
-              <el-col :span="6">
-                <el-form-item label="成员信息">
-                  <el-input
-                    v-model="formAccessibility.firstName"
-                    placeholder="输入成员信息查找"
-                    :prefix-icon="Search"
-                  />
-                </el-form-item>
-              </el-col>
-              <el-col :span="6">
-                <el-form-item label="归属机构">
-                  <el-cascader
-                    clearable
-                    style="width: 100%"
-                    v-model="info.deptId"
-                    :options="institutionList"
-                    :props="tableProps"
-                    
-                  />
-                </el-form-item>
-              </el-col>
+      <el-form label-position="left" label-width="auto">
+        <el-row :gutter="24">
+          <el-col :span="6">
+            <el-form-item label="成员信息">
+              <el-input
+                v-model="form.searchValue"
+                placeholder="输入成员信息查找"
+                :prefix-icon="Search"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="归属机构">
+              <el-cascader
+                clearable
+                style="width: 100%"
+                v-model="form.sendDeptId"
+                :options="institutionList"
+                :props="tableProps"
+              />
+            </el-form-item>
+          </el-col>
 
-              <el-col :span="4">
-                <el-form-item label="">
-                  <el-button type="primary">查询</el-button>
-                  <el-button type="primary" plain @click="reset"
-                    >重置</el-button
-                  >
-                </el-form-item>
-              </el-col>
-            </el-row>
-          </el-form>
+          <el-col :span="4">
+            <el-form-item label="">
+              <el-button type="primary">查询</el-button>
+              <el-button type="primary" plain @click="reset">重置</el-button>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
 
-          <Table
-            :tableData="tableData"
-            :columns="columns"
-            :showIndex="false"
-            :showSelect="true"
-            :pageInfo="pageInfo"
-            @getList="getList"
-            :treeProps="{ children: 'children', hasChildren: 'hasChildren' }"
-            @select-all-change="selectAllChange"
-            @select-change="selectChange"
-          >
-            <template v-slot:table-title-btn>
-              <div>
-                <!-- <el-button type="primary" @click="add(ruleFormRef)">
+      <Table
+        :tableData="tableData"
+        :columns="columns"
+        :showIndex="false"
+        :showSelect="true"
+        :showOperation="true"
+        :pageInfo="pageInfo"
+        @getList="getList"
+        :treeProps="{ children: 'children', hasChildren: 'hasChildren' }"
+        @select-all-change="selectAllChange"
+        @select-change="selectChange"
+      >
+        <template v-slot:table-title-btn>
+          <div>
+            <!-- <el-button type="primary" @click="add(ruleFormRef)">
               <el-icon><Plus /></el-icon>添加机构</el-button
             > -->
-                <el-button @click="router.push({path:'/content/message/messageEdit'})"><el-icon><Position /></el-icon>发布新的通知</el-button>
-              </div>
-            </template>
-            <template v-slot:operation="scope">
-              <el-button
-                type="primary"
-                link
-                @click="editor(scope.operationData.row)"
-              >
-                详情
-              </el-button>
-            </template>
-            <template v-slot:search="scope">
-              {{ scope.slotData.label }}
-            </template>
-          </Table>
-        </div>
-
-    
+            <el-button
+              @click="router.push({ path: '/content/message/messageEdit' })"
+              ><el-icon><Position /></el-icon>发布新的通知</el-button
+            >
+          </div>
+        </template>
+        <template v-slot:operation="scope">
+          <el-button
+            type="primary"
+            link
+            @click="editor(scope.operationData.row)"
+          >
+            编辑
+          </el-button>
+          <el-button type="primary" link @click="del(scope.operationData.row)">
+            删除
+          </el-button>
+        </template>
+        <template v-slot:search="scope">
+          {{ scope.slotData.label }}
+        </template>
+      </Table>
+    </div>
+    <el-dialog v-model="dialogVisible" title="查看人数" width="1000">
+      <Table
+        :tableData="userTableData"
+        :columns="userColumns"
+        :showIndex="false"
+        :showSelect="false"
+        :showOperation="false"
+        :pageInfo="userPageInfo"
+        @getList="userGetList"
+        :treeProps="{ children: 'children', hasChildren: 'hasChildren' }"
+      >
+      </Table>
+    </el-dialog>
   </div>
 </template>
 
 <script setup lang="ts">
 import { ref, reactive, watch, onMounted } from "vue";
-import type {
-  ComponentSize,
-  FormInstance,
-  FormRules,
-  TabsPaneContext,
-} from "element-plus";
-import { Plus, Search,Position } from "@element-plus/icons-vue";
+
+import { Plus, Search, Position } from "@element-plus/icons-vue";
 import { useRouter } from "vue-router";
 
 // import universalTable from "../"
-import { ElMessage, ElMessageBox, ElPopconfirm, ElTree } from "element-plus";
+import { ElMessageBox, ElTree, ElMessage } from "element-plus";
 import api from "@/api";
 import { h } from "vue";
-import setDept from "@/components/DialogSetDeptLeader/index.vue";
-interface Tree {
-  [key: string]: any;
-}
+
+
+const router = useRouter();
 
 const filterText = ref("");
 const treeRef = ref<InstanceType<typeof ElTree>>();
-const activeName = ref("hold");
-const defaultProps = {
-  children: "children",
-  label: "label",
-};
-
+const dialogVisible = ref(false);
 //批量设置负责人
 
 watch(filterText, (val) => {
   treeRef.value!.filter(val);
 });
 
-const formAccessibility = reactive({
-  fullName: "",
-  firstName: "",
-  lastName: "",
-  phone: "",
-});
-const ruleFormRef = ref<FormInstance>();
 let form = reactive({
-  name: "", //机构名称
-  parentId: "", //上级机构id
-  comType: "", //机构类型
-  exhibitionScope: "", //展业范围
-  address: "", //地址
-  leaderId: "", //负责人id
-  area: [], //地区
+  searchValue: "", //信息
+  sendDeptId: "", //机构id
 });
 
 interface PageInfo {
@@ -133,8 +125,6 @@ interface PageInfo {
   show: boolean;
 }
 
-const dialogVisible = ref(false);
-
 // import Select from "@/components/select/selectMain.vue";
 // import TestTable from "@/components/Table/index.vue";
 //业务员列表
@@ -143,6 +133,7 @@ type tableType = {
   name: string;
 };
 const tableData = ref<tableType[]>([]);
+const userTableData = ref<tableType[]>([]);
 const tableProps = ref({
   value: "id",
   label: "name",
@@ -150,27 +141,98 @@ const tableProps = ref({
   checkStrictly: true,
 });
 const typeformatter = (row: any, column: any, cellValue: any) => {
-  let comType = "";
-  comTypeList.value.map((ele) => {
-    if (ele.value == row.comType) {
-      comType = ele.label;
-    }
-  });
-
-  return () => h("div", {}, comType);
+  return () =>
+    h("div", null, [
+      h(
+        "h4",
+        {
+          onClick: () =>
+            router.push({
+              path: "/content/message/messageEdit",
+              query: {
+                id: row.id,
+              },
+            }),
+        },
+        row.title
+      ),
+      h("p", { class: "content" }, row.content),
+      h("p", { class: "time" }, [
+        h("span", null, row.createBy),
+        h("span", null, "|"),
+        h("span", null, row.createTime),
+      ]),
+    ]);
 };
 const columns = [
-  { prop: "name", label: "发布消息" },
-  { prop: "mobile", label: "发布机构" },
+  { prop: "name", label: "发布消息", formatter: typeformatter, width: 500 },
+  { prop: "sendDeptName", label: "发布机构" },
   // { prop: "id", label: "工号" },
-  { prop: "deptName", label: "下级机构是否发布" },
+  {
+    prop: "isChildren",
+    label: "下级机构是否发布",
+    formatter: (row: any, column: any, cellValue: any) => {
+      return () => h("div", {}, row.isChildren == "1" ? "是" : "否");
+    },
+  },
   {
     prop: "username",
     label: "是否强制查看",
+    formatter: (row: any, column: any, cellValue: any) => {
+      return () => h("div", {}, row.isForce == "1" ? "是" : "否");
+    },
+  },
+  {
+    prop: "viewCount",
+    label: "查看人数",
+    formatter: (row: any, column: any, cellValue: any) => {
+      return () =>
+        h(
+          "h4",
+          { class: "count", onClick: () => openDialog(row) },
+          row.viewCount
+        );
+    },
   },
-  { prop: "createTime", label: "查看人数" },
+];
 
+const userColumns = [
+  { prop: "name", label: "业务员姓名" },
+  { prop: "mobile", label: "业务员手机号" },
+  // { prop: "id", label: "工号" },
+  {
+    prop: "userId",
+    label: "工号",
+  },
+  {
+    prop: "deptName",
+    label: "所属机构",
+  },
+  {
+    prop: "createTime",
+    label: "查看时间",
+  },
 ];
+const contentId = ref("");
+function openDialog(item: any) {
+  contentId.value = item.id;
+  dialogVisible.value = true;
+  userTableData.value=[]
+  getContenUser();
+}
+function getContenUser() {
+  api.contentApi
+    .contentUserList({
+      id: contentId.value,
+      ...userPageInfo,
+    })
+    .then((res: any) => {
+      if (res.code === 200) {
+        userTableData.value = res.data.records;
+        userPageInfo.total = res.data.total;
+      }
+    });
+}
 
 const pageInfo = {
   pageNum: 1,
@@ -179,11 +241,26 @@ const pageInfo = {
   total: 0,
   show: true,
 };
+
+const userPageInfo = {
+  pageNum: 1,
+  pageSize: 10,
+  sizes: [10, 20, 30, 40, 50],
+  total: 0,
+  show: true,
+};
 //分页列表功能
 const getList = (item: PageInfo) => {
   pageInfo.pageNum = item.pageNum;
   pageInfo.pageSize = item.pageSize;
-  salesmanAuth();
+  getContentList();
+};
+
+//分页列表功能
+const userGetList = (item: PageInfo) => {
+  userPageInfo.pageNum = item.pageNum;
+  userPageInfo.pageSize = item.pageSize;
+  getContenUser();
 };
 
 const checkTableIdList = ref([]);
@@ -195,163 +272,106 @@ function selectAllChange(list: any) {
 function selectChange(list: any) {
   checkTableIdList.value = list;
 }
-//审核
-const userInfoId = ref("");
-const toExamine = (item: any, type: string) => {
-  if (type == "success") {
-    ElMessageBox.confirm(`确定审核通过${item.name}账号吗?`, "审核通过", {
-      confirmButtonText: "确认",
-      cancelButtonText: "取消",
-      type: "warning",
-      center: true,
-    })
-      .then(() => {
-        api.representativeApi
-          .salesmanAuthSuccess({
-            userInfoId: item.id,
-          })
-          .then((res: any) => {
-            if (res.code == 200) {
-              ElMessage.success("操作成功");
-              salesmanAuth(); //业务员列表
-            } else {
-              ElMessage.error(res.msg);
-              // salesmanAuth(); //业务员列表
-            }
-          });
-      })
-      .catch(() => {
-        ElMessage.warning("用户取消操作");
-      });
-  } else {
-    dialogVisible.value = true;
-    userInfoId.value = item.id;
-    // ElMessageBox.confirm(`<textarea placeholder='请输入审核不通过原因' oninput='handleText()' style="width:300px"></textarea>`, "审核不通过", {
-    //   confirmButtonText: "确认",
-    //   cancelButtonText: "取消",
-    //   dangerouslyUseHTMLString: true ,
-    //   type: "warning",
-    //   center: true,
 
-    // })
-    //   .then(() => {
-    //     api.representativeApi.salesmanAuthFailed({}).then((res: any) => {
-    //       if (res.code == 200) {
-    //         ElMessage.success("操作成功");
-    //         salesmanAuth(); //业务员列表
-    //       } else {
-    //         ElMessage.error(res.msg);
-    //         // salesmanAuth(); //业务员列表
-    //       }
-    //     });
-    //   })
-    //   .catch(() => {
-    //     ElMessage.warning("用户取消操作");
-    //   });
-  }
+//机构列表
+const institutionList = ref([]);
+const getInstitutionList = () => {
+  api.institutionApi.institutionList({}).then((res: any) => {
+    if (res.code === 200) institutionList.value = res.data;
+  });
 };
-function cancel() {
-  ElMessage.warning("用户取消操作");
-  dialogVisible.value = false;
-}
-const textValue = ref("");
-//审核不通过
-function confirm() {
-  api.representativeApi
-    .salesmanAuthFailed({
-      userInfoId: userInfoId.value,
-      approvalOpinion: textValue.value,
+const getContentList = () => {
+  api.contentApi
+    .noticeList({
+      ...form,
+      ...pageInfo,
     })
     .then((res: any) => {
-      if (res.code == 200) {
-        ElMessage.success("操作成功");
-        salesmanAuth(); //业务员列表
-        dialogVisible.value = false;
+      if (res.code === 200) {
+        tableData.value = res.data.records;
+        pageInfo.total = res.data.total;
       }
     });
-}
-
-interface institutionData {
-  typeAttr: string;
-  deptId: string;
-  status: number;
-}
-const info = ref<institutionData>({
-  typeAttr: "2",
-  deptId: "",
-  status: 4,
-});
-
-const router = useRouter();
+  // pageInfo.pageSize=item.pageSize
+};
 
-//详情
-const editor = (item: any) => {
-  console.log(item);
+function editor(item: any) {
   router.push({
-    path: "/representative/member/memberMessage",
+    path: "/content/message/messageEdit",
     query: {
-      id: item.userId,
+      id: item.id,
     },
   });
-  // pageInfo.pageNum=item.pageNum
-  // pageInfo.pageSize=item.pageSize
-};
-
-//获取机构类型字典值
-type comType = {
-  value: string;
-  label: string;
-};
-let comTypeList = ref<comType[]>([]);
-
-const handleClick = (tab: TabsPaneContext, event: Event) => {
-  // console.log(tab.props.name);
-  if (tab.props.name == "pass") {
-    info.value.status = 5;
-    salesmanAuth();
-  } else {
-    info.value.status = 4;
-    salesmanAuth();
-  }
-};
+}
 
-//获取成员员列表
-const salesmanAuth = () => {
-  api.representativeApi
-    .getUserInfoList({
-      ...info.value,
-      pages: pageInfo.pageNum,
-      size: pageInfo.pageSize,
+function del(item: any) {
+  ElMessageBox.confirm("确认要删除当前数据吗?", "提示", {
+    confirmButtonText: "确认",
+    cancelButtonText: "取消",
+    type: "warning",
+    center: true,
+  })
+    .then(() => {
+      api.contentApi.noticeDelete([item.id]).then((res) => {
+        if (res.code === 200) {
+          ElMessage.success("操作成功");
+          getContentList();
+        }
+      });
     })
-    .then((res) => {
-      tableData.value = res.data.records;
-      pageInfo.total = res.data.total;
+    .catch(() => {
+      ElMessage.warning("用户取消操作");
     });
-};
-
-//机构列表
-const institutionList = ref([]);
-const getAllMemberList = () => {
-  api.institutionApi.institutionList({}).then((res: any) => {
-    if (res.code === 200) institutionList.value = res.data;
-  });
-  // pageInfo.pageSize=item.pageSize
-};
+}
 
 const reset = (item: any) => {
   // ElMessage({})
 };
 
 onMounted(() => {
-  // 对 asyncRoutes 进行预处理并转换为树形结构
-  salesmanAuth(); //业务员列表
-  // getAreaList(); //省市区级联数据
-  // getSystemList(); //机构类型字典
-  // getExhibitionScopeSystemList(); //展业范围字段
-  getAllMemberList(); //机构列表
+  getContentList();
+  getInstitutionList(); //机构列表
 });
 </script>
 <style lang="scss" scoped>
+:deep(.count) {
+  margin: 0 !important;
+  color: #409eff;
+  cursor: pointer;
+}
+:deep(.routerlick) {
+  h4 {
+    margin: 0 !important;
+    color: #409eff;
+    cursor: pointer;
+  }
+
+  p {
+    margin: 0 !important;
+  }
+  .content {
+    // width: 200px;
+    // background-color: hotpink;
+    // padding: 5px 10px;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    display: -webkit-box;
+    -webkit-line-clamp: 2;
+    line-clamp: 2;
+    -webkit-box-orient: vertical;
+  }
+  .time {
+    display: flex;
+    > span {
+      flex: none;
+      display: flex;
+    }
+    > span:nth-child(2) {
+      margin: 0 20px;
+    }
+  }
+}
+
 :deep(.table-title-btn) {
   display: flex;
   align-items: center;
@@ -367,7 +387,7 @@ onMounted(() => {
   // padding: 20px;
   box-sizing: border-box;
   display: flex;
- 
+
   .institution-main {
     flex: 1;
     // width: 80%;

+ 119 - 92
src/views/contentManagement/modules/addMessage.vue

@@ -13,49 +13,52 @@
     >
       <el-row :gutter="24">
         <el-col :span="9">
-          <el-form-item label="标题" prop="name">
-            <el-input v-model="ruleForm.name" clearable style="width: 400px" />
+          <el-form-item label="标题" prop="title">
+            <el-input v-model="ruleForm.title" clearable style="width: 400px" />
           </el-form-item>
         </el-col>
         <el-col :span="9">
-          <el-form-item label="发布机构" prop="region">
+          <el-form-item label="发布机构" prop="sendDeptId">
             <el-cascader
+              filterable
               clearable
               style="width: 400px"
-              v-model="ruleForm.deptId"
+              v-model="ruleForm.sendDeptId"
               :options="institutionList"
               :props="tableProps"
+              @change="deptChange"
             />
           </el-form-item>
         </el-col>
       </el-row>
       <el-row :gutter="24">
         <el-col :span="9">
-          <el-form-item label="子机构是否发布" prop="resource">
-            <el-radio-group v-model="ruleForm.resource">
-              <el-radio value="是">是</el-radio>
-              <el-radio value="否">否</el-radio>
+          <el-form-item label="子机构是否发布" prop="isChildren">
+            <el-radio-group v-model="ruleForm.isChildren">
+              <el-radio :value="1">是</el-radio>
+              <el-radio :value="0">否</el-radio>
             </el-radio-group>
           </el-form-item>
         </el-col>
         <el-col :span="9">
-          <el-form-item label="是否强制查看" prop="resource">
-            <el-radio-group v-model="ruleForm.resource">
-              <el-radio value="是">是</el-radio>
-              <el-radio value="否">否</el-radio>
+          <el-form-item label="是否强制查看" prop="isForce">
+            <el-radio-group v-model="ruleForm.isForce">
+              <el-radio :value="1">是</el-radio>
+              <el-radio :value="0">否</el-radio>
             </el-radio-group>
           </el-form-item>
         </el-col>
       </el-row>
 
-      <el-form-item label="消息内容" prop="desc">
+      <el-form-item label="消息内容" prop="content">
         <el-input
           style="width: 400px"
-          v-model="ruleForm.desc"
+          v-model="ruleForm.content"
           type="textarea"
+          clearable
         />
       </el-form-item>
-      <el-row style="justify-content: center;">
+      <el-row style="justify-content: center">
         <el-form-item>
           <el-button @click="resetForm(ruleFormRef)">取消</el-button>
 
@@ -70,19 +73,19 @@
 
 <script setup lang="ts">
 import { ref, reactive, onMounted } from "vue";
-import type { ComponentSize, FormInstance, FormRules } from "element-plus";
+import {ElMessage} from "element-plus"
+import type { ComponentSize, FormInstance, FormRules, } from "element-plus";
 import api from "@/api";
+import router from "@/router";
+import { useRoute } from "vue-router";
+
 interface RuleForm {
-  name: string;
-  region: string;
-  count: string;
-  date1: string;
-  date2: string;
-  delivery: boolean;
-  location: string;
-  type: string[];
-  resource: string;
-  desc: string;
+  title: string;
+  sendDeptId: string;
+  sendDeptName: string;
+  content: string;
+  isChildren: string;
+  isForce: string;
 }
 const tableProps = ref({
   value: "id",
@@ -90,95 +93,102 @@ const tableProps = ref({
   children: "children",
   checkStrictly: true,
 });
+const route=useRoute()
 onMounted(() => {
-  getAllMemberList(); //机构列表
+  getInstitutionList(); //机构列表
+  console.log(route)
+  if(route.query?.id){
+    api.contentApi.noticeGet({id:route.query?.id}).then(res=>{
+      
+      if(res.code===200){
+        ruleForm.title=res.data.title
+        ruleForm.sendDeptId=res.data.sendDeptId
+        sendDeptId.value=res.data.sendDeptId
+        ruleForm.isChildren=res.data.isChildren
+        ruleForm.sendDeptName=res.data.sendDeptName
+        ruleForm.isForce=res.data.isForce
+        ruleForm.content=res.data.content
+        
+      }
+    })
+  }
 });
 
 const formSize = ref<ComponentSize>("default");
 const ruleFormRef = ref<FormInstance>();
 const ruleForm = reactive<RuleForm>({
-  name: "",
-  region: "",
-  count: "",
-  date1: "",
-  date2: "",
-  delivery: false,
-  location: "",
-  type: [],
-  resource: "",
-  desc: "",
+  title: "",
+  sendDeptId: "",
+  sendDeptName: "",
+  isChildren: "",
+  isForce: "",
+  content: "",
 });
 
 const rules = reactive<FormRules<RuleForm>>({
-  name: [
-    { required: true, message: "Please input Activity name", trigger: "blur" },
-    { min: 3, max: 5, message: "Length should be 3 to 5", trigger: "blur" },
-  ],
-  region: [
-    {
-      required: true,
-      message: "Please select Activity zone",
-      trigger: "change",
-    },
-  ],
-  count: [
-    {
-      required: true,
-      message: "Please select Activity count",
-      trigger: "change",
-    },
-  ],
-  date1: [
-    {
-      type: "date",
-      required: true,
-      message: "Please pick a date",
-      trigger: "change",
-    },
-  ],
-  date2: [
-    {
-      type: "date",
-      required: true,
-      message: "Please pick a time",
-      trigger: "change",
-    },
+  title: [
+    { required: true, message: "请输入标题", trigger: "blur" },
+    { max: 50, message: "最大长度不可以超过50个字符", trigger: "blur" },
   ],
-  location: [
+  sendDeptId: [
     {
       required: true,
-      message: "Please select a location",
+      message: "请选择发布机构",
       trigger: "change",
     },
   ],
-  type: [
+  content: [
     {
-      type: "array",
       required: true,
-      message: "Please select at least one activity type",
-      trigger: "change",
+      message: "请输入消息内容",
+      trigger: "blur",
     },
   ],
-  resource: [
-    {
-      required: true,
-      message: "Please select activity resource",
-      trigger: "change",
-    },
-  ],
-  desc: [
-    { required: true, message: "Please input activity form", trigger: "blur" },
-  ],
 });
 
+const sendDeptId=ref('')
+//机构选择
+function deptChange(e:any){
+  if(e){
+    sendDeptId.value=e[e.length-1]
+
+    ruleForm.sendDeptName=getID(institutionList.value,sendDeptId.value).name
+    // console.log(getID(institutionList.value,sendDeptId.value))
+  }else{
+    sendDeptId.value=''
+  }
+}
+
 const submitForm = async (formEl: FormInstance | undefined) => {
+ 
   if (!formEl) return;
   await formEl.validate((valid, fields) => {
     if (valid) {
-      console.log("submit!");
-    } else {
-      console.log("error submit!", fields);
-    }
+      if(route.query?.id){
+        api.contentApi.noticeEdit({
+          ...ruleForm,
+          sendDeptId:sendDeptId.value,
+          id:route.query?.id
+        }).then(res=>{
+          if(res.code===200){
+            ElMessage.success(res.msg)
+            router.back()
+          }
+        })
+      }else{
+        api.contentApi.noticeAdd({
+          ...ruleForm,
+          sendDeptId:sendDeptId.value
+        }).then(res=>{
+          if(res.code===200){
+            ElMessage.success(res.msg)
+            router.back()
+          }
+        })
+      }
+
+      
+    } 
   });
 };
 
@@ -189,12 +199,29 @@ const resetForm = (formEl: FormInstance | undefined) => {
 
 //机构列表
 const institutionList = ref([]);
-const getAllMemberList = () => {
+const getInstitutionList = () => {
   api.institutionApi.institutionList({}).then((res: any) => {
     if (res.code === 200) institutionList.value = res.data;
   });
-  // pageInfo.pageSize=item.pageSize
 };
+
+function getID(json:any, id:string) {
+    var o = {}; //专门用来保存筛选后的数组
+    //定义一个函数getID(json,id),形参json用来接受传入的数组,形参id用来接受id号
+    //核心:利用arry.forEach(function(currentValue),index,arr)遍历数组
+    json.forEach(function(item:any) {
+    //if用来判断外层,else if用来判断里层,调用递归函数的有2个判断条件在“有goods属性并且不为空”情况下才调用
+    
+        if (item.id == id) {
+     
+          return  o = item;
+          
+        } else if (item.children && item.children.length > 0) {
+            o = getID(item.children, id)//递归
+        }
+    });
+    return o; //全部遍历完之后返回对象o
+}
 </script>
 <style lang="scss" scoped>
 .message-main {

+ 183 - 0
src/views/contentManagement/notice.vue

@@ -0,0 +1,183 @@
+<template>
+  <div class="notice-main">
+    <div class="list">
+      <div :class="type==0 ?'on':''" @click="tabChange(0)">
+        <el-badge :value="countObj[0]" class="item" > 增员消息 </el-badge>
+      </div>
+      <div :class="type==1 ?'on':''" @click="tabChange(1)">
+        <el-badge :value="countObj[1]" class="item" > 待我审批 </el-badge>
+      </div>
+    </div>
+    <div class="message">
+      <ul v-infinite-scroll="load" class="infinite-list" style="overflow: auto">
+        <li
+          v-for="item in messageList"
+          :key="item.id"
+          class="infinite-list-item"
+          @click="readMessage(item)"
+        >
+          <p>
+            <span>{{ item.createTime.split(" ")[1] }}</span>
+            <b>{{ item.title }}</b>
+          </p>
+          <p :class="item.isRead == 1 ? 'onRead' : 'notRead'">
+            <span>{{ item.createTime.split(" ")[0] }}</span>
+            <b>{{ item.content }}</b>
+          </p>
+        </li>
+      </ul>
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+import { ref, reactive, onMounted } from "vue";
+import api from "@/api";
+import { ElMessage } from "element-plus";
+
+onMounted(() => {
+  getMessageList();
+  getCount();
+});
+const pageInfo = reactive({
+  pageSize: 10,
+  pageNum: 1,
+});
+const load = () => {
+  // count.value += 2
+  pageInfo.pageSize += 10;
+  getMessageList();
+};
+//消息tab切换
+
+
+
+//获取消息列表
+interface Message {
+  [key: string]: any;
+}
+const type=ref(0)
+
+
+function tabChange(num:number){
+  type.value=num
+  getMessageList();
+}
+
+const messageList = ref<Message>([]);
+function getMessageList() {
+  api.contentApi
+    .messageList({
+      type: type.value,
+      pages: pageInfo.pageNum,
+      size: pageInfo.pageSize,
+    })
+    .then((res: any) => {
+      if (res.code === 200) {
+        messageList.value = res.data.records;
+      }
+    });
+}
+//统计消息数量
+interface Count {
+  [key: string]: any;
+}
+const countObj = ref<Count>({});
+function getCount() {
+  api.contentApi.noticeCount({}).then((res: any) => {
+    // console.log(res)
+    if (res.code === 200) {
+      countObj.value = res.data;
+    }
+  });
+}
+//阅读消息
+function readMessage(item: any) {
+  api.contentApi
+    .readMessage({
+      id: item.id,
+    })
+    .then((res: any) => {
+      if (res.code === 200) {
+        ElMessage.success(res.msg);
+        getMessageList();
+      }
+    });
+}
+</script>
+<style lang="scss" scoped>
+.notice-main {
+  display: flex;
+  min-height: 740px;
+  // background: #fff;
+  padding: 15px;
+  box-sizing: border;
+  > div {
+    flex: none;
+    background: #fff;
+    min-height: 800px;
+  }
+  > div.list {
+    width: 15%;
+    border-right: 1px solid #ccc;
+    > div {
+      padding: 15px; 
+      box-sizing: border-box;
+      cursor: pointer;
+
+    }
+    .on{
+      background: #ccc;
+    }
+  }
+  > div.message {
+    flex: 1;
+  }
+}
+.infinite-list {
+  height: 800px;
+  padding: 0;
+  margin: 0;
+  list-style: none;
+}
+.infinite-list .infinite-list-item {
+  // display: flex;
+  align-items: center;
+  justify-content: center;
+  height: auto;
+  // background: var(--el-color-primary-light-9);
+  margin: 10px;
+  // color: var(--el-color-primary);
+  border-bottom: 1px solid #ccc;
+  p {
+    display: flex;
+    align-items: center;
+    > span {
+      display: flex;
+      width: 100px;
+      justify-content: flex-end;
+      color: #ccc;
+      font-size: 12px;
+    }
+    > b {
+      display: flex;
+      font-weight: normal;
+      padding-left: 50px;
+      box-sizing: border-box;
+    }
+  }
+  .onRead {
+    b {
+      color: #ccc;
+    }
+  }
+  .ontRead {
+    b {
+      color: #000;
+    }
+  }
+}
+.infinite-list .infinite-list-item + .list-item {
+  margin-top: 10px;
+}
+</style>

+ 2 - 2
src/views/personnel/institutionManage.vue

@@ -6,7 +6,7 @@
           <el-col :span="6">
             <el-form-item label="">
               <el-input
-                v-model="formAccessibility.firstName"
+                v-model="info.name"
                 placeholder="输入机构名称查找"
                 :prefix-icon="Search"
               />
@@ -15,7 +15,7 @@
 
           <el-col :span="4">
             <el-form-item label="">
-              <el-button type="primary">查询</el-button>
+              <el-button type="primary" @click="getInstitutionList">查询</el-button>
               <el-button type="primary" plain @click="reset">重置</el-button>
             </el-form-item>
           </el-col>

+ 4 - 3
src/views/personnel/modules/addOperation.vue

@@ -82,7 +82,7 @@
                 <el-form-item prop="identity" label="证件号">
                   <el-input
                     v-model.trim="operationForm.identity"
-                    placeholder="请填写证号"
+                    placeholder="请填写身份证号"
                   ></el-input>
                 </el-form-item>
               </el-col>
@@ -664,7 +664,7 @@
         </el-descriptions-item>
       </el-descriptions>
       <div style="display: flex; justify-content: flex-end">
-        <el-button @click="onSubmit(0)">取消</el-button>
+        <el-button @click="router.back()">取消</el-button>
         <el-button type="primary" @click="onSubmit(OperationFormRef, 1)"
           >确定</el-button
         >
@@ -828,7 +828,7 @@ const operationRules = ref<FormRules>({
   ],
   deptId: [{ required: true, trigger: "change", message: "请选择所属机构" }],
   identity: [
-    { required: true, trigger: "blur", message: "请填写证号" },
+    { required: true, trigger: "blur", message: "请填写身份证号" },
     {
       pattern:
         /^[1-9]\d{5}(19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9X]$/,
@@ -1002,6 +1002,7 @@ const onSubmit = async (OperationFormRef: FormInstance, type: number) => {
   }
   await OperationFormRef.validate((valid) => {
     if (valid) {
+      
       if(!route.query.id){
       api.operationApi.addOperation({
         ...operationForm.value,

+ 2 - 2
src/views/personnel/roleManagement.vue

@@ -104,7 +104,7 @@
             >
               <el-tab-pane label="菜单/操作权限">
                 <ElTree
-                  style="max-height: 500px; overflow-y: auto"
+                  style="max-height: 440px; overflow-y: auto"
                   :data="treeData"
                   :props="defaultProps"
                   show-checkbox
@@ -126,7 +126,7 @@
                   <el-radio value="3" size="large">指定机构</el-radio>
                 </el-radio-group>
                 <ElTree
-                  style="max-height: 500px; overflow-y: auto"
+                  style="max-height: 440px; overflow-y: auto"
                   :data="deptTreeData"
                   :props="deptProps"
                   show-checkbox