Bläddra i källkod

fix:广告管理

刘恒 1 år sedan
förälder
incheckning
76eaf31c16

+ 2 - 2
.env.development

@@ -5,9 +5,9 @@ VITE_APP_TITLE = 掌柜运营平台
 # 接口请求地址,会设置到 axios 的 baseURL 参数上
 # VITE_APP_API_BASEURL = https://test.baoxianzhanggui.com/web-api #默认地址
 # VITE_APP_API_BASEURL = http://192.168.0.253:8001  #田智
-VITE_APP_API_BASEURL = http://192.168.0.55:8001  #董鑫
+# VITE_APP_API_BASEURL = http://192.168.0.55:8001  #董鑫
 # VITE_APP_API_BASEURL = http://192.168.0.106:8001  #屈晨
-# VITE_APP_API_BASEURL = http://192.168.0.59:8001  #徐强
+VITE_APP_API_BASEURL = http://192.168.0.59:8001  #徐强
 
 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
 VITE_APP_DEBUG_TOOL =

+ 7 - 0
package-lock.json

@@ -36,6 +36,7 @@
         "scule": "^1.3.0",
         "vconsole": "^3.15.1",
         "vue": "^3.5.13",
+        "vue-cropper": "^1.1.4",
         "vue-m-message": "^4.0.2",
         "vue-router": "^4.5.0"
       },
@@ -21467,6 +21468,12 @@
         }
       }
     },
+    "node_modules/vue-cropper": {
+      "version": "1.1.4",
+      "resolved": "https://registry.npmmirror.com/vue-cropper/-/vue-cropper-1.1.4.tgz",
+      "integrity": "sha512-5m98vBsCEI9rbS4JxELxXidtAui3qNyTHLHg67Qbn7g8cg+E6LcnC+hh3SM/p94x6mFh6KRxT1ttnta+wCYqWA==",
+      "license": "ISC"
+    },
     "node_modules/vue-demi": {
       "version": "0.14.10",
       "resolved": "https://registry.npmmirror.com/vue-demi/-/vue-demi-0.14.10.tgz",

+ 1 - 0
package.json

@@ -50,6 +50,7 @@
     "scule": "^1.3.0",
     "vconsole": "^3.15.1",
     "vue": "^3.5.13",
+    "vue-cropper": "^1.1.4",
     "vue-m-message": "^4.0.2",
     "vue-router": "^4.5.0"
   },

+ 3 - 1
src/api/index.ts

@@ -16,6 +16,7 @@ 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 advertisementApi from "@/api/modules/advertisement.ts"
 // import { useRouter } from 'vue-router'
 // const router = useRouter()
 import router from "@/router"
@@ -111,6 +112,7 @@ const api = {
   commonApi: commonApi(axiosInstance),
   teamApi: teamApi(axiosInstance),
   representativeApi: representativeApi(axiosInstance),
-  contentApi:contentApi(axiosInstance)
+  contentApi:contentApi(axiosInstance),
+  advertisementApi:advertisementApi(axiosInstance)
 }
 export default api

+ 29 - 0
src/api/modules/advertisement.ts

@@ -0,0 +1,29 @@
+import { ApiInstance } from '../type'
+interface contentData {
+  [key: string]: any; // 允许其他任意字段
+}
+const advertisementApi = (axiosInstance: ApiInstance) => ({
+  // 广告列表
+  posterQuery: (data: contentData) => axiosInstance.post('/poster/queryPage', data, {}),
+
+  // 添加广告
+  posterAdd: (data: contentData) => axiosInstance.post('/poster/save', data, {}),
+
+   // 删除逛逛
+  posterDelet: (data: contentData) => axiosInstance.post('/poster/delete/'+data,{},{}),
+
+  // 编辑广告
+  posterEdit: (data: contentData) => axiosInstance.post('/poster/updateById', data, {}),
+
+  // 广告详情
+  getById: (params: contentData) => axiosInstance.get('/poster/getById', {params},),
+
+
+  
+  
+})
+
+export default advertisementApi
+
+
+

+ 6 - 6
src/api/modules/content.ts

@@ -4,22 +4,22 @@ interface contentData {
 }
 const contentApi = (axiosInstance: ApiInstance) => ({
   // 消息通知列表
-  noticeList: (data: contentData) => axiosInstance.post('/msssageNotice/noticeList', data, {}),
+  noticeList: (data: contentData) => axiosInstance.post('/messageNotice/noticeList', data, {}),
 
   // 添加消息通知
-  noticeAdd: (data: contentData) => axiosInstance.post('/msssageNotice/noticeAdd', data, {}),
+  noticeAdd: (data: contentData) => axiosInstance.post('/messageNotice/noticeAdd', data, {}),
 
    // 消息详情
-  noticeGet: (params: contentData) => axiosInstance.get('/msssageNotice/noticeGet', {params}),
+  noticeGet: (params: contentData) => axiosInstance.get('/messageNotice/noticeGet', {params}),
 
   //编辑消息通知
-  noticeEdit: (data: contentData) => axiosInstance.post('/msssageNotice/noticeEdit', data, {}),
+  noticeEdit: (data: contentData) => axiosInstance.post('/messageNotice/noticeEdit', data, {}),
 
   //删除消息通知
-  noticeDelete: (data: contentData) => axiosInstance.delete('/msssageNotice/noticeDelete?ids='+data,),
+  noticeDelete: (data: contentData) => axiosInstance.delete('/messageNotice/noticeDelete?ids='+data,),
 
   //通知消息人员分页列表
-  contentUserList: (data: contentData) => axiosInstance.post('/msssageNotice/userList', data, {}),
+  contentUserList: (data: contentData) => axiosInstance.post('/messageNotice/userList', data, {}),
 
   //消息列表
   messageList: (data: contentData) => axiosInstance.post('/message/messageList', data, {}),

+ 5 - 1
src/api/modules/institution.ts

@@ -17,8 +17,12 @@ const institutionApi = (axiosInstance: ApiInstance) => ({
   institutionDel: (data: institutionData) => axiosInstance.post('/dept/delete', data, {}),
 
   //设置机构负责人
-  setDeptLeader: (data: institutionData) => axiosInstance.post('/dept/setDeptLeader', data, {})
+  setDeptLeader: (data: institutionData) => axiosInstance.post('/dept/setDeptLeader', data, {}),
 
+  //获取机构信息
+  deptGet: (params: institutionData) => axiosInstance.get('/dept/deptGet', {params})
+
+  
 })
 
 export default institutionApi

+ 4 - 7
src/api/modules/representative.ts

@@ -42,7 +42,7 @@ export interface Request {
    * 用户类型
    */
   typeAttr?: string;
-  [property: string]: any;
+  [key: string]: any;
 }
 
 /**
@@ -60,13 +60,10 @@ const representativeApi = (axiosInstance: ApiInstance) => ({
   //审核不通过-业务员
   salesmanAuthFailed: (data:  Request ) => axiosInstance.post('/userInfo/salesmanAuthFailed', data), 
 
-  //  salesmanAuthSuccess: (data: { userInfoId: string }) => axiosInstance.post('/userInfo/salesmanAuthSuccess', data), // 审核通过
+  //代办数量
+  getAuditCount: (data:  Request ) => axiosInstance.post('/userInfo/getAuditCount', data), 
 
-  // salesmanAuthSuccess: (data: { userInfoId: string }) => axiosInstance.post('/userInfo/salesmanAuthSuccess', data), // 审核通过
-  // salesmanAuthFailed: (data: {
-  //   userInfoId: string,
-  //   approvalOpinion: string
-  // }) => axiosInstance.post('/userInfo/salesmanAuthFailed', data), // 审核不通过
+  
 })
 
 export default representativeApi

+ 208 - 0
src/components/ImgCropper/index.vue

@@ -0,0 +1,208 @@
+<script lang="ts" setup>
+import 'vue-cropper/dist/index.css'
+import { VueCropper } from 'vue-cropper'
+import {ref,defineEmits} from "vue"
+import api from '@/api'
+
+interface Props{
+  imgUrl: string;
+  imgName:string;
+  
+}
+const props = withDefaults(defineProps<Props>(),{
+  imgUrl:'',
+  imgName:''
+})
+
+const emit = defineEmits(['uploadImg']);
+const cropper = ref<InstanceType<typeof VueCropper>>()
+const inputRef = ref<HTMLInputElement>()
+  
+const loading = ref<boolean>(false)
+const isReady = ref<boolean>(false)
+// vue-cropper的基本配置
+// console.log(props.imgUrl,666)
+const option = ref({
+  img: props.imgUrl, //裁剪图片的地址
+  outputSize: 1, //裁剪生成图片的质量(可选0.1 - 1)
+  outputType: 'jpeg', //裁剪生成图片的格式(jpeg || png || webp)
+  info: true, //图片大小信息
+  canScale: true, //图片是否允许滚轮缩放
+  autoCrop: true, //是否默认生成截图框
+  autoCropWidth: 150, //默认生成截图框宽度
+  autoCropHeight: 150, //默认生成截图框高度
+  fixed: true, //是否开启截图框宽高固定比例
+  fixedNumber: [1, 1], //截图框的宽高比例
+  full: false, //false按原比例裁切图片,不失真
+  fixedBox: false, //固定截图框大小,不允许改变
+  canMove: false, //上传图片是否可以移动
+  canMoveBox: true, //截图框能否拖动
+  original: false, //上传图片按照原始比例渲染
+  centerBox: false, //截图框是否被限制在图片里面
+  height: true, //是否按照设备的dpr 输出等比例图片
+  infoTrue: false, //true为展示真实输出图片宽高,false展示看到的截图框宽高
+  maxImgSize: 3000, //限制图片最大宽度和高度
+  enlarge: 1, //图片根据截图框输出比例倍数
+  mode: '300px 300px' //图片默认渲染方式
+})
+const previewURL = ref<string>('')
+// 实时的刷新
+const realTime = () => {
+  if (loading.value) return
+  loading.value = true
+  // 节流
+  setTimeout(() => {
+    cropper.value.getCropBlob((data: Blob) => {
+      previewURL.value = URL.createObjectURL(data)
+      console.log(previewURL.value)
+      loading.value = false
+    })
+  }, 500)
+}
+// 初始化
+const imgLoad = (msg: string) => {
+  
+  if (msg === 'success') {
+    isReady.value = true
+  }
+}
+//选择图片
+const img=ref()
+const selectImg = (e: Event) => {
+  const eTarget = e.target as HTMLInputElement
+  if (!eTarget.files) return
+  const file = eTarget.files[0]
+  if (!/\.(jpg|jpeg|png|JPG|PNG)$/.test(eTarget.value)) {
+    alert('图片格式错误')
+    return false
+  }
+  img.value=file
+  // console.log(file)
+  const reader = new FileReader()
+  reader.readAsDataURL(file) //将文件转化为base64
+  reader.onload = e => {
+    let data
+    if (!e.target) return
+    if (typeof e.target.result === 'object') {
+      data = URL.createObjectURL(new Blob([e.target.result ?? '']))
+    } else {
+      data = e.target.result
+    }
+    option.value.img = data
+  }
+}
+//图片缩放
+const changeScale = (num: number) => {
+  num = num || 1
+  cropper.value.changeScale(num)
+}
+//向左旋转
+const rotateLeft = () => {
+  cropper.value.rotateLeft()
+}
+//向右旋转
+const rotateRight = () => {
+  cropper.value.rotateRight()
+}
+//上传图片
+const imgUpload = () => {
+  //获取截图的blob数据
+  // console.log(cropper.value)
+  
+  // console.log(cropper.value.scaleImg)
+
+  cropper.value.getCropBlob(async (data: File) => {
+    let formData = new FormData();
+    const files = new File([data],img.value?.name || props.imgName,{
+      type:data.type
+    }); // 声明formData数据类型
+ 
+   
+    formData.append('file',files)
+    // console.log(img.value.size)
+    // console.log(data)
+    // params.append("file", );
+  
+    api.areaApi.fileUpload(formData).then((res: any) => {
+      
+        if (res.code === 200) {
+          // console.log(res)
+          emit("uploadImg", res.data);
+        }
+    });
+    // 上传到服务器
+  })
+}
+//选择图片
+const selectClick = () => {
+  inputRef.value?.click()
+}
+</script>
+<template>
+  <div class="h-[40vh] w-[100vw] ">
+    <div class="w-[800px] h-[300px]">
+      <div class="w-[800px] h-[300px] flex items-center justify-between">
+        <!-- 给组件固定宽高 -->
+        <div class="h-[300px] w-[510px]" style="display: 300px; width: 500px">
+          <VueCropper
+            ref="cropper"
+            :img="option.img"
+            :outputSize="option.outputSize"
+            :outputType="option.outputType"
+            :info="option.info"
+            :canScale="option.canScale"
+            :autoCrop="option.autoCrop"
+            :autoCropWidth="option.autoCropWidth"
+            :autoCropHeight="option.autoCropHeight"
+            :fixed="option.fixed"
+            :fixedNumber="option.fixedNumber"
+            :full="option.full"
+            :fixedBox="option.fixedBox"
+            :canMove="option.canMove"
+            :canMoveBox="option.canMoveBox"
+            :original="option.original"
+            :centerBox="option.centerBox"
+            :height="option.height"
+            :infoTrue="option.infoTrue"
+            :maxImgSize="option.maxImgSize"
+            :enlarge="option.enlarge"
+            :mode="option.mode"
+            @realTime="realTime"
+            @imgLoad="imgLoad"
+          ></VueCropper>
+        </div>
+        <!-- <div class="ml-[60px]">
+          <div class="text-center text-[#409EFF] mb-[20px] text-[20px] font-medium">预览</div>
+          <div class="flex items-center">
+            <div v-if="isReady">
+              <el-image class="rounded-[50%] w-[150px] h-[150px]" :src="previewURL" />
+            </div>
+          </div>
+        </div> -->
+      </div>
+      <div class="flex items-center mt-[30px]">
+        <div class="relative">
+          <div
+            class="mr-[15px] cursor-pointer text-[20px] text-[#409EFF] font-semibold"
+            @click="selectClick"
+          >
+            选择图片
+          </div>
+          <input
+            ref="inputRef"
+            type="file"
+            style="position: absolute; clip: rect(0 0 0 0)"
+            accept="image/png, image/jpeg, image/gif, image/jpg"
+            @change="selectImg"
+          />
+        </div>
+        <el-button style="width: 96px" type="primary" @click="changeScale(1)">放大</el-button>
+        <el-button style="width: 96px" type="primary" @click="changeScale(-1)">缩小</el-button>
+        <el-button style="width: 96px" type="primary" @click="rotateLeft">↺ 左旋转</el-button>
+        <el-button style="width: 96px" type="primary" @click="rotateRight">↻ 右旋转</el-button>
+        <el-button type="primary" plain @click="imgUpload">上传图片</el-button>
+      </div>
+    </div>
+  </div>
+</template>
+<style scoped lang="scss"></style>

+ 4 - 0
src/main.ts

@@ -27,6 +27,9 @@ import 'virtual:uno.css'
 // 全局样式
 import '@/assets/styles/globals.css'
 
+import VueCropper from "vue-cropper";
+import "vue-cropper/dist/index.css";
+
 const app = createApp(App)
 for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
   app.component(key, component)
@@ -38,6 +41,7 @@ app.use(FloatingVue, {
 app.use(Message)
 app.use(pinia)
 app.use(router)
+app.use(VueCropper)
 app.use(ui)
 
 directive(app)

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

@@ -43,6 +43,29 @@ const routes: RouteRecordRaw = {
       
       
     },
+    {
+      path: 'advertisement',
+      name: 'advertisement',
+      component: () => import('@/views/contentManagement/advertisement.vue'),
+      meta: {
+        title: '广告位管理',
+        
+      },
+      children:[
+        {
+          path: 'advertisementEdit',
+          name: 'advertisementEdit',
+          component: () => import('@/views/contentManagement/modules/addAdvertisement.vue'),
+          meta: {
+            title: '广告',
+            menu:false
+          }, 
+        },
+        
+      ]
+      
+      
+    },
     
     
    

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

@@ -49,6 +49,17 @@ const routes: RouteRecordRaw = {
       meta: {
         title: '机构管理',
       },
+      children:[
+        {
+          path: 'institutionEdit',
+          name: 'personnelInstitutionEdit',
+          component: () => import('@/views/personnel/modules/editInstitution.vue'),
+          meta: {
+            title: '机构管理',
+            menu:false
+          }, 
+        },
+      ]
     },
     {
       path: 'role',

+ 2 - 2
src/settings.default.ts

@@ -10,7 +10,7 @@ const globalSettingsDefault: RecursiveRequired<Settings.all> = {
     enablePermission: false,
     enableProgress: true,
     enableDynamicTitle: false,
-    routeBaseOn: 'backend',
+    routeBaseOn: 'frontend',
   },
   home: {
     enable: true,
@@ -21,7 +21,7 @@ const globalSettingsDefault: RecursiveRequired<Settings.all> = {
     enableMobileAdaptation: false,
   },
   menu: {
-    baseOn: 'backend',
+    baseOn: 'frontend',
     mode: 'side',
     switchMainMenuAndPageJump: false,
     subMenuUniqueOpened: true,

+ 1 - 0
src/types/components.d.ts

@@ -26,6 +26,7 @@ declare module 'vue' {
     ImagePreview: typeof import('./../components/ImagePreview/index.vue')['default']
     ImagesUpload: typeof import('./../components/ImagesUpload/index.vue')['default']
     ImageUpload: typeof import('./../components/ImageUpload/index.vue')['default']
+    ImgCropper: typeof import('./../components/ImgCropper/index.vue')['default']
     LoginForm: typeof import('./../components/LoginForm/index.vue')['default']
     NotAllowed: typeof import('./../components/NotAllowed/index.vue')['default']
     PageHeader: typeof import('./../components/PageHeader/index.vue')['default']

+ 409 - 0
src/views/contentManagement/advertisement.vue

@@ -0,0 +1,409 @@
+<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="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" @click="getContentList">查询</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"
+        :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/advertisement/advertisementEdit' })"
+              ><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 { Plus, Search, Position } from "@element-plus/icons-vue";
+import { useRouter } from "vue-router";
+
+// import universalTable from "../"
+import { ElMessageBox, ElTree, ElMessage } from "element-plus";
+import api from "@/api";
+import { h } from "vue";
+
+
+const router = useRouter();
+
+const filterText = ref("");
+const treeRef = ref<InstanceType<typeof ElTree>>();
+const dialogVisible = ref(false);
+//批量设置负责人
+
+watch(filterText, (val) => {
+  treeRef.value!.filter(val);
+});
+
+let form = reactive({
+  searchValue: "", //信息
+  sendDeptId: "", //机构id
+});
+
+interface PageInfo {
+  pageNum: number;
+  pageSize: number;
+  sizes: number[];
+  total: number;
+  show: boolean;
+}
+
+// import Select from "@/components/select/selectMain.vue";
+// import TestTable from "@/components/Table/index.vue";
+//业务员列表
+type tableType = {
+  id: string;
+  name: string;
+};
+const tableData = ref<tableType[]>([]);
+const userTableData = ref<tableType[]>([]);
+const tableProps = ref({
+  value: "id",
+  label: "name",
+  children: "children",
+  checkStrictly: true,
+});
+const typeformatter = (row: any, column: any, cellValue: any) => {
+  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: "发布消息", formatter: typeformatter, width: 500 },
+  { prop: "deptName", label: "广告图",
+    formatter: (row: any, column: any, cellValue: any) => {
+      return () => h("img", {src:row.previewUrl}, );
+    },
+   },
+
+  { prop: "deptName", label: "发布机构" },
+  // { prop: "id", label: "工号" },
+  {
+    prop: "isLevel",
+    label: "下级机构是否发布",
+    formatter: (row: any, column: any, cellValue: any) => {
+      return () => h("div", {}, row.isLevel == "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
+  //       );
+  //   },
+  // },
+];
+
+const userColumns = [
+  { prop: "name", label: "业务员姓名" },
+  { prop: "mobile", label: "业务员手机号" },
+  // { prop: "id", label: "工号" },
+  {
+    prop: "userId",
+    label: "工号",
+  },
+  {
+    prop: "deptName",
+    label: "所属机构",
+  },
+  {
+    prop: "createTime",
+    label: "查看时间",
+  },
+];
+const contentId = ref("");
+
+
+
+const pageInfo = {
+  pageNum: 1,
+  pageSize: 10,
+  sizes: [10, 20, 30, 40, 50],
+  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;
+  getContentList();
+};
+
+//分页列表功能
+const userGetList = (item: PageInfo) => {
+  userPageInfo.pageNum = item.pageNum;
+  userPageInfo.pageSize = item.pageSize;
+  // getContenUser();
+};
+
+const checkTableIdList = ref([]);
+//表格选择事件
+function selectAllChange(list: any) {
+  checkTableIdList.value = list;
+}
+
+function selectChange(list: any) {
+  checkTableIdList.value = list;
+}
+
+//机构列表
+const institutionList = ref([]);
+const getInstitutionList = () => {
+  api.institutionApi.institutionList({}).then((res: any) => {
+    if (res.code === 200) institutionList.value = res.data;
+  });
+};
+const getContentList = () => {
+  api.advertisementApi
+    .posterQuery({
+      ...form,
+      ...pageInfo,
+    })
+    .then((res: any) => {
+      if (res.code === 200) {
+        tableData.value = res.data.records;
+        pageInfo.total = res.data.total;
+      }
+    });
+  // pageInfo.pageSize=item.pageSize
+};
+
+function editor(item: any) {
+  router.push({
+    path: "/content/advertisement/advertisementEdit",
+    query: {
+      id: item.id,
+    },
+  });
+}
+
+function del(item: any) {
+  
+  ElMessageBox.confirm("确认要删除当前数据吗?", "提示", {
+    confirmButtonText: "确认",
+    cancelButtonText: "取消",
+    type: "warning",
+    center: true,
+  })
+    .then(() => {
+      api.advertisementApi.posterDelet(item.id).then((res) => {
+        if (res.code === 200) {
+          ElMessage.success("操作成功");
+          getContentList();
+        }
+      });
+    })
+    .catch(() => {
+      ElMessage.warning("用户取消操作");
+    });
+}
+
+const reset = (item: any) => {
+  // ElMessage({})
+};
+
+onMounted(() => {
+  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;
+  justify-content: space-between;
+  > div {
+    display: flex;
+  }
+}
+.institution {
+  background: #fff;
+  width: 100%;
+  // height: 100%;
+  // padding: 20px;
+  box-sizing: border-box;
+  display: flex;
+
+  .institution-main {
+    flex: 1;
+    // width: 80%;
+    padding: 20px;
+    box-sizing: border-box;
+  }
+}
+:deep(.el-dropdown-link) {
+  cursor: pointer;
+  color: var(--el-color-primary);
+  display: flex;
+  align-items: center;
+  margin-left: 15px;
+}
+.custom-tree-node {
+  flex: 1;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  font-size: 14px;
+  padding-right: 8px;
+}
+:deep(.el-message-box__container) {
+  width: 100% !important;
+  .el-message-box__message {
+    width: 100% !important;
+  }
+}
+</style>

+ 1 - 1
src/views/contentManagement/message.vue

@@ -26,7 +26,7 @@
 
           <el-col :span="4">
             <el-form-item label="">
-              <el-button type="primary">查询</el-button>
+              <el-button type="primary" @click="getContentList">查询</el-button>
               <el-button type="primary" plain @click="reset">重置</el-button>
             </el-form-item>
           </el-col>

+ 278 - 0
src/views/contentManagement/modules/addAdvertisement.vue

@@ -0,0 +1,278 @@
+<template>
+  <div class="message-main">
+    <h4>基本信息</h4>
+    <el-form
+      ref="ruleFormRef"
+      :model="ruleForm"
+      :rules="rules"
+      label-width="auto"
+      class="demo-ruleForm"
+      :size="formSize"
+      :inline="true"
+      status-icon
+    >
+      <el-row :gutter="24">
+        <el-col :span="9">
+          <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="orgId">
+            <el-cascader
+              filterable
+              clearable
+              style="width: 400px"
+              v-model="ruleForm.orgId"
+              :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="URL" prop="">
+            <el-input v-model="ruleForm.url" clearable style="width: 400px" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="9">
+          <el-form-item label="子机构是否发布" prop="isLevel">
+            <el-radio-group v-model="ruleForm.isLevel">
+              <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="image">
+        <ImgCropper @uploadImg="uploadImg" :imgUrl="imgUrl" :imgName="imgName" v-if="imgUrl"></ImgCropper>
+        <ImgCropper @uploadImg="uploadImg" :imgUrl="imgUrl" :imgName="imgName" v-else></ImgCropper>
+        <!-- <el-upload
+          class="avatar-uploader"
+          action="#"
+          :show-file-list="false"
+          :on-success="handleAvatarSuccess"
+          :before-upload="beforeAvatarUpload"
+        >
+          <img v-if="imageUrl" :src="imageUrl" class="avatar" />
+          <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
+        </el-upload> -->
+      </el-form-item>
+      <el-row style="justify-content: center">
+        <el-form-item>
+          <el-button @click="resetForm(ruleFormRef)">取消</el-button>
+
+          <el-button type="primary" @click="submitForm(ruleFormRef)">
+            保存
+          </el-button>
+        </el-form-item>
+      </el-row>
+    </el-form>
+  </div>
+</template>
+
+<script setup lang="ts">
+import { ref, reactive, onMounted } from "vue";
+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";
+
+
+
+
+function uploadImg(file:any){
+ 
+  ruleForm.image=file.id
+}
+
+const imgUrl=ref('')
+const imgName=ref('')
+
+interface RuleForm {
+  title: string;
+  orgId: string;
+  sendDeptName: string;
+  image: string;
+  isLevel: string | number;
+  isForce: string;
+  url:string;
+}
+const tableProps = ref({
+  value: "id",
+  label: "name",
+  children: "children",
+  checkStrictly: true,
+});
+const route=useRoute()
+onMounted(() => {
+  getInstitutionList(); //机构列表
+  // console.log(route)
+  if(route.query?.id){
+    api.advertisementApi.getById({id:route.query?.id}).then(res=>{
+      
+      if(res.code===200){
+        ruleForm.title=res.data.title
+        ruleForm.orgId=res.data.orgId
+        orgId.value=res.data.orgId
+        ruleForm.isLevel=res.data.isLevel
+        ruleForm.url=res.data.url
+        imgUrl.value=res.data.previewUrl
+        ruleForm.image=res.data.uploadFiles.id
+        imgName.value=res.data.uploadFiles.fileName
+      }
+    })
+  }
+});
+
+const formSize = ref<ComponentSize>("default");
+const ruleFormRef = ref<FormInstance>();
+const ruleForm = reactive<RuleForm>({
+  title: "",
+  orgId: "",
+  sendDeptName: "",
+  isLevel: 0,
+  isForce: "",
+  image: "",
+  url:"",
+});
+
+const rules = reactive<FormRules<RuleForm>>({
+  title: [
+    { required: true, message: "请输入标题", trigger: "blur" },
+    { max: 50, message: "最大长度不可以超过50个字符", trigger: "blur" },
+  ],
+  orgId: [
+    {
+      required: true,
+      message: "请选择发布机构",
+      trigger: "change",
+    },
+  ],
+  image: [
+    {
+      required: true,
+      message: "请上传图片",
+      trigger: "blur",
+    },
+  ],
+});
+
+const orgId=ref('')
+//机构选择
+function deptChange(e:any){
+  if(e){
+    orgId.value=e[e.length-1]
+
+    ruleForm.sendDeptName=getID(institutionList.value,orgId.value).name
+    // console.log(getID(institutionList.value,orgId.value))
+  }else{
+    orgId.value=''
+  }
+}
+
+const submitForm = async (formEl: FormInstance | undefined) => {
+ 
+  if (!formEl) return;
+  await formEl.validate((valid, fields) => {
+    if (valid) {
+      if(route.query?.id){
+        api.advertisementApi.posterEdit({
+          ...ruleForm,
+          orgId:orgId.value,
+          id:route.query?.id
+        }).then(res=>{
+          if(res.code===200){
+            ElMessage.success(res.msg)
+            router.back()
+          }
+        })
+      }else{
+        api.advertisementApi.posterAdd({
+          ...ruleForm,
+          orgId:orgId.value
+        }).then(res=>{
+          if(res.code===200){
+            ElMessage.success(res.msg)
+            router.back()
+          }
+        })
+      }
+
+      
+    } 
+  });
+};
+
+const resetForm = (formEl: FormInstance | undefined) => {
+  if (!formEl) return;
+  formEl.resetFields();
+};
+
+//机构列表
+const institutionList = ref([]);
+const getInstitutionList = () => {
+  api.institutionApi.institutionList({}).then((res: any) => {
+    if (res.code === 200) institutionList.value = res.data;
+  });
+};
+
+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 {
+  flex: 1;
+  width: 100%;
+  height: 100%;
+  background: #fff;
+  padding: 15px;
+  box-sizing: border-box;
+}
+.avatar-uploader {
+  width: 178px;
+  height: 178px;
+  display: block;
+  border: 1px dashed #8c939d !important;
+}
+.avatar-uploader .el-upload {
+
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+  // transition: var(--el-transition-duration-fast);
+}
+
+.avatar-uploader .el-upload:hover {
+  border-color: var(--el-color-primary);
+}
+
+.el-icon.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 178px;
+  height: 178px;
+  text-align: center;
+}
+</style>

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

@@ -47,6 +47,7 @@ const load = () => {
   // count.value += 2
   pageInfo.pageSize += 10;
   getMessageList();
+  
 };
 //消息tab切换
 

+ 6 - 6
src/views/login.vue

@@ -26,12 +26,12 @@ onBeforeMount(() => {
 
   treeData.value = convertToTreeData(0, processedRoutes);
 
-  api.roleApi
-    .updateConfig({
-      sysConfig: JSON.stringify(processedRoutes),
-      sysPerms: JSON.stringify(treeData.value),
-    })
-    .then((res) => {});
+  // api.roleApi
+  //   .updateConfig({
+  //     sysConfig: JSON.stringify(processedRoutes),
+  //     sysPerms: JSON.stringify(treeData.value),
+  //   })
+  //   .then((res) => {});
 });
 
 const route = useRoute();

+ 46 - 144
src/views/personnel/institutionManage.vue

@@ -82,129 +82,7 @@
       </Table>
     </div>
 
-    <el-dialog v-model="dialogVisible" title="基本信息" width="800" draggable>
-      <el-form
-        label-position="top"
-        label-width="auto"
-        :rules="rules"
-        :model="form"
-        ref="ruleFormRef"
-      >
-        <el-row :gutter="24">
-          <el-col :span="12">
-            <el-form-item label="机构名称" prop="name">
-              <el-input
-                v-model.trim="form.name"
-                maxlength="50"
-                placeholder="输入机构名称"
-                clearable
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="上级机构" prop="parentId">
-              <el-cascader
-                clearable
-                style="width: 100%"
-                v-model="form.parentId"
-                :options="tableData"
-                :props="tableProps"
-                @change="handleChange"
-              />
-              <!-- <el-select v-model="form.parentId" placeholder="选择上级机构" clearable>
-                <el-option
-                  v-for="item in tableData"
-                  :key="item.id"
-                  :label="item.name"
-                  :value="item.id"
-                />
-
-              </el-select> -->
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="机构类型" prop="comType">
-              <el-select
-                v-model="form.comType"
-                placeholder="选择机构类型"
-                clearable
-              >
-                <el-option
-                  v-for="item in comTypeList"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
-                />
-              </el-select>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="地区" prop="area">
-              <el-cascader
-                clearable
-                style="width: 100%"
-                v-model="form.area"
-                :options="areaOptins"
-                :props="areaProps"
-                @change="handleChange"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="展业范围" prop="exhibitionScope">
-              <el-select
-                v-model="form.exhibitionScope"
-                placeholder="选择展业范围"
-                multiple
-                clearable
-              >
-                <el-option
-                  v-for="item in exhibitionScopeTypeList"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
-                />
-              </el-select>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="机构地址" prop="address">
-              <el-input
-                v-model.trim="form.address"
-                maxlength="50"
-                placeholder="请输入机构地址"
-                type="textarea"
-                clearable
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="机构负责人" prop="leaderId">
-              <el-select
-                v-model="form.leaderId"
-                placeholder="选择机构负责人"
-                clearable
-              >
-                <el-option
-                  v-for="item in memberList"
-                  :key="item.id"
-                  :label="item.name"
-                  :value="item.id"
-                />
-              </el-select>
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-form>
-      <template #footer>
-        <div class="dialog-footer">
-          <el-button @click="dialogVisible = false">取 消</el-button>
-          <el-button type="primary" @click="confirm(ruleFormRef)">
-            保 存
-          </el-button>
-        </div>
-      </template>
-    </el-dialog>
+    
     <setDept 
     :dialogVisible="deptDialogVisible"
       :dept-list="tableData"
@@ -227,6 +105,10 @@ import { ElMessage, ElMessageBox, ElPopconfirm, ElTree } from "element-plus";
 import api from "@/api";
 import { h } from "vue";
 import setDept from "@/components/DialogSetDeptLeader/index.vue"
+// import router from "@/router";
+import { useRouter } from "vue-router";
+
+const router=useRouter()
 interface Tree {
   [key: string]: any;
 }
@@ -392,26 +274,40 @@ function selectChange(list:any){
 const isDisabledId = ref("");
 const addChild = (item: any) => {
   // form.id=item.id
-  console.log(item)
-  form.parentId = item.id;
-  isDisabledId.value = item.id;
-  dialogVisible.value = true;
-  operationType.value = "add";
-  disabledTree(tableData.value);
+  // console.log(item)
+  // form.parentId = item.id;
+  // isDisabledId.value = item.id;
+  // dialogVisible.value = true;
+  // operationType.value = "add";
+  // disabledTree(tableData.value);
+  router.push({
+    path:'/personnel/institution/institutionEdit',
+    query:{
+      type:"add",
+      id:item.id
+    }
+  })
   // pageInfo.pageNum=item.pageNum
   // pageInfo.pageSize=item.pageSize
 };
 const editor = (item: any) => {
   
-  // form={...item}
-  for (let key in item) {
-    form[key] = item[key];
-  }
-  isDisabledId.value=''
-  // form.area=[item.province,item.city,item.area]
-  dialogVisible.value = true;
-  operationType.value = "edit";
-  disabledTree(tableData.value)
+  // // form={...item}
+  // for (let key in item) {
+  //   form[key] = item[key];
+  // }
+  // isDisabledId.value=''
+  // // form.area=[item.province,item.city,item.area]
+  // dialogVisible.value = true;
+  // operationType.value = "edit";
+  // disabledTree(tableData.value)
+  router.push({
+    path:'/personnel/institution/institutionEdit',
+    query:{
+      type:"edit",
+      id:item.id
+    }
+  })
 
   // pageInfo.pageNum=item.pageNum
   // pageInfo.pageSize=item.pageSize
@@ -443,11 +339,17 @@ const del = (item: any) => {
 //添加的弹框
 let operationType = ref("");
 const add = (formEl: FormInstance | undefined) => {
-  dialogVisible.value = true;
-  operationType.value = "add";
+  // dialogVisible.value = true;
+  // operationType.value = "add";
+  router.push({
+    path:'/personnel/institution/institutionEdit',
+    query:{
+      type:"add"
+    }
+  })
 
-  if (!formEl) return;
-  formEl.resetFields();
+  // if (!formEl) return;
+  // formEl.resetFields();
   // pageInfo.pageNum=item.pageNum
   // pageInfo.pageSize=item.pageSize
 };
@@ -623,9 +525,9 @@ const reset = (item: any) => {
 onMounted(() => {
   // 对 asyncRoutes 进行预处理并转换为树形结构
   getInstitutionList(); //机构列表
-  getAreaList(); //省市区级联数据
+  // getAreaList(); //省市区级联数据
   getSystemList(); //机构类型字典
-  getExhibitionScopeSystemList(); //展业范围字段
+  // getExhibitionScopeSystemList(); //展业范围字段
   getAllMemberList();//成员列表
 });
 </script>

+ 1 - 0
src/views/personnel/modules/addOperation.vue

@@ -915,6 +915,7 @@ const uploadImage = (file, type) => {
   let url = window.URL.createObjectURL(files); //转临时路径
   const params = new FormData(); // 声明formData数据类型
   params.append("file", files);
+  console.log(files)
 
   // params.append("multipartFile", files);
   // params.append("type", "image");

+ 378 - 0
src/views/personnel/modules/editInstitution.vue

@@ -0,0 +1,378 @@
+<template>
+  <div class="institution">
+    <el-form
+      label-position="top"
+      label-width="auto"
+      :rules="rules"
+      :model="form"
+      ref="ruleFormRef"
+    >
+      <el-row :gutter="24">
+        <el-col :span="12">
+          <el-form-item label="机构名称" prop="name">
+            <el-input
+              v-model.trim="form.name"
+              maxlength="50"
+              placeholder="输入机构名称"
+              clearable
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="上级机构" prop="parentId">
+            <el-cascader
+              clearable
+              style="width: 100%"
+              v-model="form.parentId"
+              :options="tableData"
+              :props="tableProps"
+              @change="handleChange"
+            />
+            <!-- <el-select v-model="form.parentId" placeholder="选择上级机构" clearable>
+                <el-option
+                  v-for="item in tableData"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
+                />
+
+              </el-select> -->
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="机构类型" prop="comType">
+            <el-select
+              v-model="form.comType"
+              placeholder="选择机构类型"
+              clearable
+            >
+              <el-option
+                v-for="item in comTypeList"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              />
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="地区" prop="area">
+            <el-cascader
+              clearable
+              style="width: 100%"
+              v-model="form.area"
+              :options="areaOptins"
+              :props="areaProps"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="展业范围" prop="exhibitionScope">
+            <el-select
+              v-model="form.exhibitionScope"
+              placeholder="选择展业范围"
+              multiple
+              clearable
+            >
+              <el-option
+                v-for="item in exhibitionScopeTypeList"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              />
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="机构地址" prop="address">
+            <el-input
+              v-model.trim="form.address"
+              maxlength="50"
+              placeholder="请输入机构地址"
+              type="textarea"
+              clearable
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="机构负责人" prop="leaderId">
+            <el-select
+              v-model="form.leaderId"
+              placeholder="选择机构负责人"
+              clearable
+            >
+              <el-option
+                v-for="item in memberList"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              />
+            </el-select>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+
+    <div class="dialog-footer">
+      <el-button @click="router.back()">取 消</el-button>
+      <el-button type="primary" @click="confirm(ruleFormRef)">
+        保 存
+      </el-button>
+      
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+import { ref, reactive, onMounted } from "vue";
+import type { ComponentSize, FormInstance, FormRules } from "element-plus";
+import api from "@/api";
+import { useRoute, useRouter } from "vue-router";
+const route = useRoute();
+const router = useRouter();
+import { ElMessage } from "element-plus";
+onMounted(() => {
+  // 对 asyncRoutes 进行预处理并转换为树形结构
+  getInstitutionList(); //机构列表
+  getAreaList(); //省市区级联数据
+  getSystemList(); //机构类型字典
+  getExhibitionScopeSystemList(); //展业范围字段
+  getAllMemberList(); //成员列表
+  if (route.query.type == "edit") {
+    api.institutionApi
+      .deptGet({
+        id: route.query.id,
+      })
+      .then((res: any) => {
+        console.log(res);
+        if (res.code === 200) {
+          for (let key in res.data) {
+            form[key] = res.data[key];
+          }
+          form.area = [res.data.province, res.data.city, res.data.area];
+        }
+      });
+  }else{
+    // form.parentId=[route.query.id]
+  }
+
+  setTimeout(() => {
+    disabledTree(tableData.value);
+  }, 1000);
+});
+
+//禁用机构选择
+function disabledTree(list: tableType) {
+  for (let i = 0; i < list.length; i++) {
+    const node = list[i];
+    if (route.query.id) {
+      if (list[i].id != route.query.id) {
+        list[i].disabled = true;
+      }
+    } else {
+      list[i].disabled = false;
+    }
+
+    if (node.children && node.children.length > 0) {
+      disabledTree(node.children);
+    }
+  }
+}
+interface institutionData {
+  name: string;
+  system: string;
+}
+const info = ref<institutionData>({
+  name: "",
+  system: "",
+});
+const ruleFormRef = ref<FormInstance>();
+let form = reactive({
+  name: "", //机构名称
+  parentId: "", //上级机构id
+  comType: "", //机构类型
+  exhibitionScope: "", //展业范围
+  address: "", //地址
+  leaderId: "", //负责人id
+  area: [], //地区
+});
+
+interface RuleForm {
+  name: string; //机构名称
+  parentId: string; //上级机构id
+  comType: string; //机构类型
+  exhibitionScope: string[]; //展业范围
+  address: string; //地址
+  leaderId: string; //负责人id
+  area: string[]; //地区
+  id: string;
+}
+interface PageInfo {
+  pageNum: number;
+  pageSize: number;
+  sizes: number[];
+  total: number;
+  show: boolean;
+}
+const value = ref("");
+const dialogVisible = ref(false);
+
+const rules = reactive<FormRules<RuleForm>>({
+  name: [
+    { required: true, message: "请输入机构名称", trigger: "blur" },
+    { min: 1, max: 50, message: "请输入机构名称", trigger: "blur" },
+  ],
+  parentId: [{ required: true, message: "请选择上级机构", trigger: "change" }],
+  comType: [{ required: true, message: "请选择机构类型", trigger: "change" }],
+  exhibitionScope: [
+    { required: true, message: "请选择展业范围", trigger: "change" },
+  ],
+  address: [
+    { required: true, message: "请输入机构地址", trigger: "blur" },
+    { min: 1, max: 50, message: "请输入机构地址", trigger: "blur" },
+  ],
+  area: [{ required: true, message: "请选择机构所在地区", trigger: "change" }],
+});
+
+//成员列表
+const memberList = ref([]);
+const getAllMemberList = () => {
+  // pageInfo.pageNum=item.pageNum
+  api.userApi.AllMemberList({}).then((res: any) => {
+    if (res.code === 200) memberList.value = res.data;
+  });
+  // pageInfo.pageSize=item.pageSize
+};
+
+//获取全国省市区级联数据
+const areaOptins = ref([]);
+const areaProps = ref({
+  value: "areaCode",
+  label: "areaCname",
+  children: "child",
+});
+const tableProps = ref({
+  value: "id",
+  label: "name",
+  children: "children",
+  checkStrictly: true,
+});
+
+const getAreaList = () => {
+  api.areaApi.areaList({}).then((res) => {
+    areaOptins.value = res.data;
+  });
+};
+
+//获取机构类型字典值
+type comType = {
+  value: string;
+  label: string;
+};
+let comTypeList = ref<comType[]>([]);
+const getSystemList = () => {
+  api.areaApi
+    .systemList({
+      dictCode: "com_type",
+    })
+    .then((res) => {
+      comTypeList.value = res.data;
+    });
+};
+
+//展业范围
+type exhibitionScopeType = {
+  value: string;
+  label: string;
+};
+let exhibitionScopeTypeList = ref<exhibitionScopeType[]>([]);
+const getExhibitionScopeSystemList = () => {
+  api.areaApi
+    .systemList({
+      dictCode: "exhibition_scope",
+    })
+    .then((res) => {
+      exhibitionScopeTypeList.value = res.data;
+    });
+};
+type tableType = {
+  id: string;
+  name: string;
+};
+const tableData = ref<tableType[]>([]);
+//获取机构列表
+const getInstitutionList = () => {
+  // pageInfo.pageNum=item.pageNum
+  api.institutionApi.institutionList(info.value).then((res) => {
+    // if(res.code===200){
+
+    // }
+    tableData.value = res.data;
+  });
+  // pageInfo.pageSize=item.pageSize
+};
+
+const confirm = async (formEl: FormInstance | undefined) => {
+  if (!formEl) return;
+  await formEl.validate((valid, fields) => {
+    if (valid) {
+      const obj = { ...form };
+      delete obj.area;
+      // console.log(obj)
+      if (route.query.type == "add") {
+        api.institutionApi
+          .institutionAdd({
+            ...obj,
+            system: localStorage.getItem("login_system") || "",
+            province: form.area[0],
+            city: form.area[1],
+            area: form.area[2],
+            parentId:
+              typeof obj.parentId == "string"
+                ? obj.parentId
+                : obj.parentId[obj.parentId.length - 1],
+          })
+          .then((res) => {
+            if (res.code === 200) {
+              ElMessage.success("操作成功");
+              dialogVisible.value = false;
+              router.back();
+            }
+          });
+      } else {
+        api.institutionApi
+          .institutionEdit({
+            ...obj,
+            system: localStorage.getItem("login_system") || "",
+            province: form.area[0],
+            city: form.area[1],
+            area: form.area[2],
+            parentId:
+              typeof obj.parentId == "string"
+                ? obj.parentId
+                : obj.parentId[obj.parentId.length - 1],
+          })
+          .then((res) => {
+            if (res.code === 200) {
+              ElMessage.success("操作成功");
+              dialogVisible.value = false;
+              router.back();
+            }
+          });
+      }
+    }
+  });
+};
+</script>
+<style lang="scss" scoped>
+.institution {
+  padding: 15px;
+  box-sizing: border-box;
+  background: #fff;
+  .dialog-footer {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
+}
+</style>

+ 2 - 1
src/views/personnel/modules/memberMessage.vue

@@ -940,10 +940,11 @@ function editMember(e: any) {
 // 上传图片
 const uploadImage = (file: any, type: number) => {
   let files = file.raw;
+  console.log(files)
   let url = window.URL.createObjectURL(files); //转临时路径
   const params = new FormData(); // 声明formData数据类型
   params.append("file", files);
-
+ 
   // params.append("multipartFile", files);
   // params.append("type", "image");
   api.areaApi.fileUpload(params).then((res: any) => {

+ 17 - 22
src/views/representative/member.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="institution">
     <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
-      <el-tab-pane label="待审核" name="hold">
+      <el-tab-pane :label="'待审核'+'('+countObj?.noAuditCount +')'" name="hold">
         <div class="institution-main">
           <el-form label-position="left" label-width="auto">
             <el-row :gutter="24">
@@ -99,7 +99,7 @@
           </Table>
         </div>
       </el-tab-pane>
-      <el-tab-pane label="审核不通过" name="pass">
+      <el-tab-pane :label="'审核不通过'+'('+countObj?.failAuditCount +')'" name="pass">
         <div class="institution-main">
           <el-form label-position="left" label-width="auto">
             <el-row :gutter="24">
@@ -240,16 +240,7 @@ const formAccessibility = reactive({
   lastName: "",
   phone: "",
 });
-const ruleFormRef = ref<FormInstance>();
-let form = reactive({
-  name: "", //机构名称
-  parentId: "", //上级机构id
-  comType: "", //机构类型
-  exhibitionScope: "", //展业范围
-  address: "", //地址
-  leaderId: "", //负责人id
-  area: [], //地区
-});
+
 
 interface PageInfo {
   pageNum: number;
@@ -275,16 +266,7 @@ const tableProps = ref({
   children: "children",
   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);
-};
 const columns = [
   { prop: "name", label: "姓名" },
   { prop: "mobile", label: "手机号" },
@@ -428,7 +410,7 @@ type comType = {
   value: string;
   label: string;
 };
-let comTypeList = ref<comType[]>([]);
+
 
 const handleClick = (tab: TabsPaneContext, event: Event) => {
   // console.log(tab.props.name);
@@ -456,11 +438,24 @@ const salesmanAuth = () => {
 };
 
 //成员列表
+
+const countObj=ref({
+  noAuditCount:'',
+  failAuditCount:"",
+})
 const institutionList = ref([]);
 const getAllMemberList = () => {
   api.institutionApi.institutionList({}).then((res: any) => {
     if (res.code === 200) institutionList.value = res.data;
   });
+  api.representativeApi.getAuditCount({
+    typeAttr:'2'
+  }).then((res:any)=>{
+    // console.log(res)
+    if(res.code===200){
+      countObj.value=res.data
+    }
+  })
   // pageInfo.pageSize=item.pageSize
 };
 

+ 14 - 2
src/views/representative/salesman.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="institution">
     <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
-      <el-tab-pane label="待审核" name="hold">
+      <el-tab-pane :label="'待审核'+'('+countObj?.noAuditCount +')'" name="hold">
         <div class="institution-main">
           <el-form label-position="left" label-width="auto">
             <el-row :gutter="24">
@@ -102,7 +102,7 @@
           </Table>
         </div>
       </el-tab-pane>
-      <el-tab-pane label="审核不通过" name="pass">
+      <el-tab-pane :label="'审核不通过'+'('+countObj?.failAuditCount +')'" name="pass">
         <div class="institution-main">
           <el-form label-position="left" label-width="auto">
             <el-row :gutter="24">
@@ -457,11 +457,23 @@ const salesmanAuth = () => {
 };
 
 //成员列表
+const countObj=ref({
+  noAuditCount:'',
+  failAuditCount:"",
+})
 const memberList = ref([]);
 const getAllMemberList = () => {
   api.userApi.AllMemberList({}).then((res: any) => {
     if (res.code === 200) memberList.value = res.data;
   });
+  api.representativeApi.getAuditCount({
+    typeAttr:'1'
+  }).then((res:any)=>{
+    // console.log(res)
+    if(res.code===200){
+      countObj.value=res.data
+    }
+  })
   // pageInfo.pageSize=item.pageSize
 };