xiaohaizhao 2 bulan lalu
induk
melakukan
244aa5be7f

+ 3 - 50
src/MAR/noticeManage/detail/index.vue

@@ -19,12 +19,10 @@
       <template #tab1>
         <span class="normal-title">基本信息</span>
         <defaultInfo :data="baseInfo"></defaultInfo>
-        <block v-if="viewRange.length > 0">
-          <span class="normal-title">浏览范围</span>
-          <defaultInfo :data="viewRange"></defaultInfo>
-        </block>
         <span class="normal-title">系统信息</span>
         <defaultInfo :data="systemInfo"></defaultInfo>
+        <div style="height: 20px;"></div>
+        <view-range :satNoticeId="mainData.sat_noticeid" />
       </template>
       <template #tab2>
         <fileTable ref="file" :disabled="true" :data="mainData.attinfos" :isHanle="false"></fileTable>
@@ -41,6 +39,7 @@ import defaultInfo from '@/template/defaultInfo/index.vue'
 import customBtn from '@/components/customHandleBtn/index.vue'
 import editNotive from '../modules/editNotice.vue'
 import fileTable from '../modules/fileTable.vue'
+import viewRange from './viewRange.vue'
 
 import { useRouter } from "vue-router";
 import { ref, defineProps, createVNode, defineComponent, onMounted, provide } from 'vue'
@@ -50,7 +49,6 @@ const router = useRouter()
 const mainAreaData = ref([])
 const mainData = ref({})
 let baseInfo = ref([])
-let viewRange = ref([])
 let systemInfo = ref([])
 let classList = ref([])
 provide('classList', () => classList.value)
@@ -79,53 +77,8 @@ const mianData = async () => {
     { label: '发布人', value: mainData.value.checkby },
     { label: '发布时间', value: mainData.value.checkdate },
   ]
-  getViewRange()
 }
 
-function getViewRange() {
-  let params = [
-    { type: "角色", "classname": "sysmanage.develop.optiontype.optiontype", "method": "optiontypeselect", "content": { "pageNumber": 1, "pageSize": 1000, "typename": "role", "parameter": {} } },
-    { type: "部门", "id": 20240402101602, "content": { "ownertable": "sat_notice", "pageNumber": 1, "pageSize": 20, "where": {} } },
-    { type: "人员", "id": 20240402101702, "content": { "ownertable": "sat_notice", "pageNumber": 1, "where": {} } },
-    { type: "区域", "id": 20240402101802, "content": { "ownertable": "sat_notice", "pageNumber": 1, "where": {} } },
-    { type: "经销商", "id": 20240402101902, "content": { "ownertable": "sat_notice", "pageNumber": 1, "where": {} } }
-  ];
-  Promise.all(params.map(item => {
-    item.content.ownerid = router.currentRoute.value.query.id;
-    item.content.pageSize = 9999
-    return Api.requested(item)
-  })).then(results => {
-    results.forEach((res, index) => {
-      if (res.code == 1) {
-        let value = ''
-        switch (params[index].type) {
-          case '角色':
-            let roleids = mainData.value.role;
-            value = res.data.filter(item => roleids.includes(item.roleid)).map(item => item.rolename).join(',')
-            break;
-          case '部门':
-            value = res.data.map(item => item.depname).join(',')
-            break;
-          case '人员':
-            value = res.data.map(item => item.name).join(',')
-            break;
-          case '区域':
-            value = res.data.map(item => item.areaname).join(',')
-            break;
-          case '经销商':
-            value = res.data.map(item => item.enterprisename).join(',')
-            break;
-        }
-        viewRange.value.push({ label: params[index].type, value: value || "--" })
-      } else {
-        typeMap[params[index].type] = '获取失败'
-        viewRange.value.push({ label: params[index].type, value: '获取失败' })
-      }
-    })
-  })
-}
-
-
 const getClassList = async () => {
   let res = await Api.requested({
     'id': 20221101094603,

+ 149 - 0
src/MAR/noticeManage/detail/viewRange.vue

@@ -0,0 +1,149 @@
+<template>
+    <div>
+        <a-card title="可浏览范围" :bordered="false">
+            <a-row>
+                <span class="normal-title">角色</span>
+                <a-col :span="24" style="margin:10px 0 10px 10px;padding-right: 10px;">
+                    <div class="flex-center">
+                        <a-tag v-for="item in roleList" :key="item.roleid" style="margin-right: 5px;">
+                            {{ item.rolename }}-{{ item.remarks }}
+                        </a-tag>
+                        <span v-if="!roleList.length" style="color: #999;">无</span>
+                    </div>
+                </a-col>
+                <span class="normal-title">部门</span>
+                <a-col :span="24">
+                    <div class="flex-center mt-10">
+                        <normalTable is-select="false" ref="depTable" style="width:100%" size="small"
+                            :columns="utils.TBLayout('depTable').slice(0, -1)"
+                            :param="{ id: 20240402101602, content: { ownertable: 'sat_notice', ownerid: ownerId, pageNumber: 1, pageSize: 20, where: {} } }">
+                        </normalTable>
+                    </div>
+                </a-col>
+                <span class="normal-title">人员</span>
+                <a-col :span="24">
+                    <div class="flex-center mt-10">
+                        <normalTable is-select="false" ref="hridTable" style="width:100%" size="small"
+                            :columns="utils.TBLayout('staffTable').slice(0, -1)"
+                            :param="{ id: 20240402101702, content: { ownertable: 'sat_notice', ownerid: ownerId, pageNumber: 1, pageSize: 20, where: {} } }">
+                        </normalTable>
+                    </div>
+                </a-col>
+                <span class="normal-title">区域</span>
+                <a-col :span="24">
+                    <div class="flex-center mt-10">
+                        <normalTable is-select="false" ref="areaTable" style="width:100%" size="small"
+                            :columns="utils.TBLayout('areaTable').slice(0, -1)"
+                            :param="{ id: 20240402101802, content: { ownertable: 'sat_notice', ownerid: ownerId, pageNumber: 1, pageSize: 20, where: {} } }">
+                        </normalTable>
+                    </div>
+                </a-col>
+                <span class="normal-title">经销商</span>
+                <a-col :span="24">
+                    <div class="flex-center mt-10">
+                        <normalTable is-select="false" ref="enterpriseTable" style="width:100%" size="small"
+                            :columns="utils.TBLayout('enterpriseTable').slice(0, -1)"
+                            :param="{ id: 20240402101902, content: { ownertable: 'sat_notice', ownerid: ownerId, pageNumber: 1, pageSize: 20, where: {} } }">
+                        </normalTable>
+                    </div>
+                </a-col>
+            </a-row>
+        </a-card>
+    </div>
+</template>
+
+<script setup>
+import { ref, watch, onMounted, computed } from 'vue'
+import Api from '@/api/api'
+import utils from '@/utils/utils'
+import normalTable from '@/template/MARnormalTable/index.vue'
+
+const props = defineProps({
+    // 通告ID,用于获取权限数据
+    satNoticeId: {
+        type: String,
+        default: ''
+    }
+})
+
+// 计算属性:ownerId
+const ownerId = computed(() => props.satNoticeId)
+
+// 角色列表
+const roleList = ref([])
+// 所有角色选项(用于角色名映射)
+const allRoleOptions = ref([])
+
+// 加载角色权限数据
+const loadRoleData = async () => {
+    if (!props.satNoticeId) return
+
+    // 先获取所有角色选项
+    await fetchAllRoles()
+
+    // 获取当前通告的角色ID列表
+    const res = await Api.requested({
+        "id": "20221101095003",
+        "content": {
+            "sat_noticeid": props.satNoticeId
+        }
+    })
+
+    // 将角色ID映射为角色详情
+    if (res.data && res.data.role && res.data.role.length) {
+        roleList.value = res.data.role.map(roleId => {
+            return allRoleOptions.value.find(item => item.roleid === roleId) || { roleid: roleId, rolename: roleId, remarks: '' }
+        })
+    } else {
+        roleList.value = []
+    }
+}
+
+// 获取所有角色选项
+const fetchAllRoles = async () => {
+    const res = await Api.requested({
+        "classname": "sysmanage.develop.optiontype.optiontype",
+        "method": "optiontypeselect",
+        "content": {
+            "pageNumber": 1,
+            "pageSize": 1000,
+            "typename": "role",
+            "parameter": {}
+        }
+    })
+    allRoleOptions.value = res.data || []
+}
+
+// 监听 satNoticeId 变化,重新加载数据
+watch(() => props.satNoticeId, (newVal) => {
+    if (newVal) {
+        loadRoleData()
+    }
+}, { immediate: true })
+
+onMounted(() => {
+    if (props.satNoticeId) {
+        loadRoleData()
+    }
+})
+</script>
+
+<style scoped>
+.ant-select {
+    width: 100%;
+}
+
+.flex-center {
+    display: flex;
+    align-items: center;
+}
+
+.redlitt {
+    color: #ff4d4f;
+    font-size: 14px;
+}
+
+.mt-10 {
+    margin-top: 10px;
+}
+</style>

+ 18 - 18
src/MAR/noticeManage/modules/dataAnalysis.vue

@@ -6,12 +6,12 @@
             <a-tab-pane key="2" tab="团队内部分析"></a-tab-pane>
         </a-tabs>
 
-        <view class="row-box">
-            <view class="chart">
+        <div class="row-box">
+            <div class="chart">
                 <div class="chart-title">{{ activeKey == '1' ? '浏览数据' : '学习数据' }}</div>
-                <view :id="`LearningCondition_${props.id}`" class="chart-content" />
-            </view>
-            <view class="right" v-if="activeKey == '1'">
+                <div :id="`LearningCondition_${props.id}`" class="chart-content" />
+            </div>
+            <div class="right" v-if="activeKey == '1'">
                 <div class="normal-margin">
                     <p class="title">未浏览业务员</p>
                     <exportExcel :param="params[0]" type="button" tableName="tableUnstudy" />
@@ -26,8 +26,8 @@
                 <normalTable @listData="handleData" rowKey="rowindex" :is-select="false" ref="table" size="small"
                     :columns="utils.TBLayout('tableStudy')" :param='params[1]'>
                 </normalTable>
-            </view>
-            <view v-else class="right">
+            </div>
+            <div v-else class="right">
                 <div class="normal-margin">
                     <p class="title">未浏览业务员</p>
                     <exportExcel :param="params[2]" type="button" tableName="groupUNTableStudy" />
@@ -42,14 +42,14 @@
                 <normalTable @listData="handleData" rowKey="rowindex" :is-select="false" ref="table" size="small"
                     :columns="utils.TBLayout('groupTableStudy')" :param='params[3]'>
                 </normalTable>
-            </view>
-        </view>
-        <view class="row-box" style="margin-top: 80px;">
-            <view class="chart">
+            </div>
+        </div>
+        <div class="row-box" style="margin-top: 80px;">
+            <div class="chart">
                 <div class="chart-title">下载数据</div>
-                <view :id="`DownloadStatus_${props.id}`" class="chart-content" />
-            </view>
-            <view class="right" v-if="activeKey == '1'">
+                <div :id="`DownloadStatus_${props.id}`" class="chart-content" />
+            </div>
+            <div class="right" v-if="activeKey == '1'">
                 <div class="normal-margin">
                     <p class="title">未下载经销商</p>
                     <exportExcel :param="params[4]" type="button" tableName="tableUnstudy" />
@@ -64,8 +64,8 @@
                 <normalTable @listData="handleData" rowKey="rowindex" :is-select="false" ref="table" size="small"
                     :columns="utils.TBLayout('tableDownload')" :param='params[5]'>
                 </normalTable>
-            </view>
-            <view v-else class="right">
+            </div>
+            <div v-else class="right">
                 <div class="normal-margin">
                     <p class="title">未下载业务员</p>
                     <exportExcel :param="params[6]" type="button" tableName="groupUNTableStudy" />
@@ -80,8 +80,8 @@
                 <normalTable @listData="handleData" rowKey="rowindex" :is-select="false" ref="table" size="small"
                     :columns="utils.TBLayout('groupTableDownload')" :param='params[7]'>
                 </normalTable>
-            </view>
-        </view>
+            </div>
+        </div>
     </a-drawer>
 </template>