马宇豪
2024-08-01 81e6577d11920a45284936f591bd8d076006a919
修改通讯录
已修改5个文件
120 ■■■■■ 文件已修改
src/util/request.js 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/Admin/contactBook/contactors.vue 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/Admin/contactBook/structure.vue 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/Admin/massSend.vue 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/Admin/msgRecord.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/util/request.js
@@ -3,6 +3,7 @@
import { Session } from '@/util/storage';
import {message} from "ant-design-vue";
import { loginOut } from "@/api/login";
import JSONBig from 'json-bigint';
//用来拦截用的
axios.defaults.headers.post["Content-Type"] = "application/json;charset=utf-8";
//创建一个单例
@@ -11,6 +12,16 @@
const http= axios.create({
    baseURL: baseUrl,
    timeout: 50000,//响应时间
    transformResponse: [
        function (data) {
            // 对 data 进行任意转换处理
            try {
                return JSONBig.parse(data)
            } catch (err) {
                return data
            }
        }
    ]
    // headers:{"Content-Type":"application/json;charset=utf-8"},
})
src/views/Admin/contactBook/contactors.vue
@@ -28,13 +28,13 @@
          <a-button  type="primary" @click="massImport()">批量导入</a-button>
        </div>
        <div class="table-cont">
          <a-table :columns="columns" :data-source="tableData" :pagination="pagination" :rowKey="record=>record.id" bordered>
          <a-table :columns="columns" :data-source="tableData" :pagination="pagination" :rowKey="record=>record.id.toString()" bordered>
            <template #index="text,record,index">
              {{ index + 1 }}
            </template>
            <template #orgName="text,record,index">
              {{currentKey.length>0?currentKey[0].split('-')[1]: ''}}
            </template>
<!--            <template #orgStructureName="text,record,index">-->
<!--              {{currentKey.length>0?currentKey[0].split('-')[1]: ''}}-->
<!--            </template>-->
            <template #orgUserTypes="text,record,index">
              {{record.orgUserTypes?record.orgUserTypes.map(i=>i.typeName + '(' + i.orgUserTags.map(j=>j.tagName).join('/') +')').join(','): ''}}
            </template>
@@ -82,8 +82,7 @@
import contactorsMod from "@/views/Admin/components/contactorsMod"
import {importUser} from "@/api/user";
import importNew from "@/assets/importNew.xlsx";
import exampleFile from "@/assets/example.xlsx";
import JSONBig from 'json-bigint'
export default {
  name: 'sameLevel',
  components: {
@@ -128,10 +127,8 @@
        },
        {
          title: '所属组织架构',
          dataIndex: 'orgName',
          scopedSlots: {
            customRender: 'orgName'
          }
          dataIndex: 'orgStructureName',
          key: 'orgStructureName'
        },
        {
          title: '所属单位',
@@ -192,9 +189,9 @@
    const t = this
    t.unittype = getUserInfo().unittype
    t.districtId = getUserInfo().districtId
    t.getStructure()
    t.getUserList()
    t.getUpdataData()
    t.getStructure()
  },
  mounted() {
@@ -207,7 +204,7 @@
  methods:{
    downloadFile(){
      const link = document.createElement('a')
      link.href = exampleFile
      link.href = importNew
      link.target = '_blank'
      link.download = '通讯录导入模板.xlsx'
      link.click()
@@ -262,20 +259,31 @@
      const t = this
      const res = await getStructure()
      if(res.data.code == 100){
        t.treeData = res.data.data
        const firstItem = this.firstIdWithOrgStructures(res.data.data[0])
        if(firstItem){
          t.openKeys =  [firstItem.id +'-'+  firstItem.name]
          t.currentId = firstItem.id
          t.currentKey = [firstItem.orgStructures[0].id +'-'+  firstItem.orgStructures[0].orgName]
        }else{
          t.$message.warning('暂无可操作的单位,请先进入“组织架构维护页面”新建相应的本级单位')
        }
        t.treeData = t.filterBranches(res.data.data,['自治区直辖县级行政区划'])
        // const firstItem = this.firstIdWithOrgStructures(res.data.data[0])
        // if(firstItem){
        //   t.openKeys =  [firstItem.id +'-'+  firstItem.name]
        //   t.currentId = firstItem.id
        //   t.currentKey = [firstItem.orgStructures[0].id +'-'+  firstItem.orgStructures[0].orgName]
        // }else{
        //   t.$message.warning('暂无可操作的单位,请先进入“组织架构维护页面”新建相应的本级单位')
        // }
      }else{
        t.$message.warning(res.data.msg)
      }
    },
    filterBranches(branches, targetNames) {
      return branches.filter(branch => {
        if (targetNames.includes(branch.name)) {
          return false; // 过滤掉当前分支
        }
        if (branch.children && branch.children.length > 0) {
          branch.children = this.filterBranches(branch.children, targetNames);
        }
        return true; // 保留当前分支
      });
    },
    firstIdWithOrgStructures(node) {
      if (node.orgStructures && node.orgStructures.length > 0) {
@@ -349,14 +357,19 @@
    editData(type,data){
      const t = this
      if(type == 'add' && (!t.currentId || !t.currentKey)){
        t.$message.warning('暂无可操作的单位,请先进入“组织架构维护页面”新建相应的本级单位')
        return
      if(type == 'add'){
        if(!t.currentId || !t.currentKey){
          t.$message.warning('请先在左侧选择单位再进行新增')
          return
        }else {
          const areaId = t.currentId
          const orgName = t.currentKey.length>0?t.currentKey[0].split('-')[1]: ''
          const orgId = t.currentKey.length>0?t.currentKey[0].split('-')[0]: null
          t.$refs.contactMod.openDialog(type,data,areaId,orgName,orgId)
        }
      }else{
        t.$refs.contactMod.openDialog(type,data,data.districtId,data.orgStructureName,data.orgStructureId)
      }
      const areaId = t.currentId
      const orgName = t.currentKey.length>0?t.currentKey[0].split('-')[1]: ''
      const orgId = t.currentKey.length>0?t.currentKey[0].split('-')[0]: null
      t.$refs.contactMod.openDialog(type,data,areaId,orgName,orgId)
    },
    async delData(row){
src/views/Admin/contactBook/structure.vue
@@ -125,12 +125,24 @@
      const t = this
      const res = await getStructure();
      if(res.data.code == 100){
        t.tableData = res.data.data
        t.tableData = t.filterBranches(res.data.data,['自治区直辖县级行政区划'])
      }else{
        t.$message.warning(res.data.msg);
      }
    },
    filterBranches(branches, targetNames) {
      return branches.filter(branch => {
        if (targetNames.includes(branch.name)) {
          return false; // 过滤掉当前分支
        }
        if (branch.children && branch.children.length > 0) {
          branch.children = this.filterBranches(branch.children, targetNames);
        }
        return true; // 保留当前分支
      });
    },
    openAdd(type,row){
      if(type == 'add'){
        this.editTitle = '新增'
src/views/Admin/massSend.vue
@@ -41,14 +41,14 @@
        <a-col :span="12" style="display: flex;align-items: center;justify-content: right">
          <a-form-model-item prop="disasterType" style="margin-right: 20px">
            <a-select placeholder="请选择相关灾种" v-model="form.disasterType" style="width: 240px" allowClear @change="handleRisk">
              <a-select-option v-for="item in riskOptions" :key="item.value" :value="item.value">
              <a-select-option v-for="(item,index) in riskOptions" :key="item.id" :value="item.value">
                {{ item.name }}
              </a-select-option>
            </a-select>
          </a-form-model-item>
          <a-form-model-item prop="warningLevel">
            <a-select placeholder="请选择预警级别" v-model="form.warningLevel" style="width: 240px" allowClear @change="handleLevel">
              <a-select-option v-for="item in levelOptions" :key="item.value" :value="item.value">
              <a-select-option v-for="(item,index) in levelOptions" :key="item.id" :value="item.value">
                {{ item.name }}
              </a-select-option>
            </a-select>
@@ -271,17 +271,17 @@
        },
        areaUsers: [],
        riskOptions: [
          {name: '地震',value: 1},
          {name: '气象',value: 3},
          {name: '地质灾害',value: 4},
          {name: '水旱',value: 5},
          {name: '森林草原火灾',value: 6}
          {id: 1,name: '地震',value: 1},
          {id: 2,name: '气象',value: 3},
          {id: 3,name: '地质灾害',value: 4},
          {id: 4,name: '水旱',value: 5},
          {id: 5,name: '森林草原火灾',value: 6}
        ],
        levelOptions: [
          {name: '红色预警',value: 1},
          {name: '橙色预警',value: 2},
          {name: '黄色预警',value: 3},
          {name: '蓝色预警',value: 4}
          {id: 6,name: '红色预警',value: 1},
          {id: 7,name: '橙色预警',value: 2},
          {id: 8,name: '黄色预警',value: 3},
          {id: 9,name: '蓝色预警',value: 4}
        ],
        rules: {
          emergType: [{ required: true, message: '请选择紧急类型', trigger: 'change'}],
src/views/Admin/msgRecord.vue
@@ -27,14 +27,14 @@
            <div class="tit">
              任务ID:<span>{{item.id}}</span>   
            </div>
                  发送人数:{{item.recipients.length}}
                  发送人数:{{item.recipients?item.recipients.length:0}}
          </template>
          <p>
            {{item.content}}
          </p>
          <template #actions>
            <div>
              接收号码:<span>{{item.recipients.map(i=>i.realName + '(' + i.phone.replace(/(\d{3})\d{4}(\d+)/, "$1****$2") + ')').join('、')}}</span>
              接收号码:<span>{{item.recipients?item.recipients.map(i=>i.realName + '(' + i.phone.replace(/(\d{3})\d{4}(\d+)/, "$1****$2") + ')').join('、'):'暂无'}}</span>
            </div>
            <div>
              <a-button type="primary" @click="viewDetails(item)">查看详情</a-button>