|
@@ -1,110 +1,117 @@
|
|
|
|
|
|
<script setup>
|
|
|
-// import { ref,reactive,nextTick } from "vue";
|
|
|
-// import moment from "moment";
|
|
|
-// import $ from "jquery"
|
|
|
-// import { ArrowLeft,ArrowRight } from '@element-plus/icons-vue'
|
|
|
+import { ref,reactive,nextTick } from "vue";
|
|
|
+import moment from "moment";
|
|
|
+import $ from "jquery"
|
|
|
+import { ArrowLeft,ArrowRight } from '@element-plus/icons-vue'
|
|
|
|
|
|
-// import { roadshowInterence } from "@/api/api.js";
|
|
|
-// import {bussinessTripH} from '@/views/business_trip_manage/hooks/bussinessTripH.js'
|
|
|
+import { roadshowInterence } from "@/api/api.js";
|
|
|
+import {bussinessTripH} from '@/views/business_trip_manage/hooks/bussinessTripH.js'
|
|
|
|
|
|
-// const bussinessTripCom = bussinessTripH()
|
|
|
+const bussinessTripCom = bussinessTripH()
|
|
|
|
|
|
-// const daysArr=['周一','周二','周三','周四','周五','周六','周日']
|
|
|
+const daysArr=['周一','周二','周三','周四','周五','周六','周日']
|
|
|
|
|
|
-// const researcherList=ref([]) // 研究员列表
|
|
|
-// const defaultSalesProps=reactive({
|
|
|
-// children: "ResearcherList",
|
|
|
-// value: "AdminId",
|
|
|
-// emitPath: false,
|
|
|
-// }) //研究员级联配置
|
|
|
-// const tableDayColumns=ref([])
|
|
|
-// const researcher=ref('')
|
|
|
-// const datalist=ref([])
|
|
|
-// const weekQuery=ref(0)
|
|
|
+const researcherList=ref([]) // 研究员列表
|
|
|
+const defaultSalesProps=reactive({
|
|
|
+ children: "ResearcherList",
|
|
|
+ value: "AdminId",
|
|
|
+ emitPath: false,
|
|
|
+}) //研究员级联配置
|
|
|
+const tableDayColumns=ref([])
|
|
|
+const researcher=ref('')
|
|
|
+const datalist=ref([])
|
|
|
|
|
|
-// // 获取研究员列表
|
|
|
-// const getResearcherList=async()=>{
|
|
|
-// // 发送请求
|
|
|
-// const res = await roadshowInterence.getResearcherList();
|
|
|
-// if (res.Ret === 200) {
|
|
|
-// researcherList.value = formatResearcherList(res.Data);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// // 对获取到的研究员列表做处理
|
|
|
-// const formatResearcherList=(list)=>{
|
|
|
-// list.forEach((group) => {
|
|
|
-// // 对组做处理
|
|
|
-// group.label = group.GroupName;
|
|
|
-// // 如果有列表
|
|
|
-// group.ResearcherList &&
|
|
|
-// group.ResearcherList.forEach((item) => {
|
|
|
-// // 对研究员做处理
|
|
|
-// item.label = item.RealName;
|
|
|
-// });
|
|
|
-// });
|
|
|
-// // 去掉ficc全体选项
|
|
|
-// return list.filter((group) => group.GroupName !== "ficc全体");
|
|
|
-// }
|
|
|
-// const getWeekDays=(weeknum,dateList)=>{
|
|
|
-// // dateList 日期数组 weeknum 周数
|
|
|
-// let arrList=[]
|
|
|
+// 获取研究员列表
|
|
|
+const getResearcherList=async()=>{
|
|
|
+ // 发送请求
|
|
|
+ const res = await roadshowInterence.getResearcherList();
|
|
|
+ if (res.Ret === 200) {
|
|
|
+ // researcherList.value = formatResearcherList(res.Data);
|
|
|
+ const ficcList = formatResearcherList(res.Data.find(i=>i.GroupName==='ficc').ResearcherList||[]);
|
|
|
+ const raiList = formatResearcherList(res.Data.find(i=>i.GroupName==='权益').ResearcherList||[]);
|
|
|
+ researcherList.value = [{
|
|
|
+ label:'ficc',
|
|
|
+ ResearcherList:ficcList
|
|
|
+ },{
|
|
|
+ label:'权益',
|
|
|
+ ResearcherList:raiList
|
|
|
+ }]
|
|
|
+ }
|
|
|
+}
|
|
|
+// 对获取到的研究员列表做处理
|
|
|
+const formatResearcherList=(list)=>{
|
|
|
+ list.forEach((group) => {
|
|
|
+ // 对组做处理
|
|
|
+ group.label = group.GroupName;
|
|
|
+ // 如果有列表
|
|
|
+ group.ResearcherList &&
|
|
|
+ group.ResearcherList.forEach((item) => {
|
|
|
+ // 对研究员做处理
|
|
|
+ item.label = item.RealName;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ // 去掉ficc全体选项
|
|
|
+ return list.filter((group) => group.GroupName !== "ficc全体");
|
|
|
+}
|
|
|
+const getWeekDays=(weeknum,dateList)=>{
|
|
|
+ // dateList 日期数组 weeknum 周数
|
|
|
+ let arrList=[]
|
|
|
|
|
|
-// for (let i = 0; i < weeknum; i++) {
|
|
|
-// arrList[i]=[]
|
|
|
-// if(dateList && dateList.length>0){
|
|
|
-// // 有数据返回 能拿到后端返回的日期数组
|
|
|
-// for (let j = 0; j < 7; j++) {
|
|
|
-// let momentItem=moment(dateList[(i*7+j)])
|
|
|
-// arrList[i].push(momentItem.format('MM/DD')+daysArr[momentItem.weekday()])
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return arrList;
|
|
|
-// }
|
|
|
-// /* 获取表格数据 */
|
|
|
-// const getTableData=()=>{
|
|
|
-// let param={
|
|
|
-// AdminId:researcher.value||0,
|
|
|
-// WeekQuery:weekQuery.value,
|
|
|
-// BaseQueryDate:bussinessTripCom.BaseDate.value
|
|
|
-// }
|
|
|
-// roadshowInterence.getResearcherBusinessTrip(param).then((res) => {
|
|
|
-// if (res.Ret !== 200) return;
|
|
|
-// bussinessTripCom.BaseDate.value = res.Data.BaseDate
|
|
|
-// const Data = res.Data.GroupList || []
|
|
|
+ for (let i = 0; i < weeknum; i++) {
|
|
|
+ arrList[i]=[]
|
|
|
+ if(dateList && dateList.length>0){
|
|
|
+ // 有数据返回 能拿到后端返回的日期数组
|
|
|
+ for (let j = 0; j < 7; j++) {
|
|
|
+ let momentItem=moment(dateList[(i*7+j)])
|
|
|
+ arrList[i].push(momentItem.format('MM/DD')+daysArr[momentItem.weekday()])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return arrList;
|
|
|
+}
|
|
|
+/* 获取表格数据 */
|
|
|
+const getTableData=()=>{
|
|
|
+ let param={
|
|
|
+ AdminId:researcher.value||0,
|
|
|
+ WeekQuery:bussinessTripCom.weekQuery.value,
|
|
|
+ BaseQueryDate:bussinessTripCom.BaseDate.value
|
|
|
+ }
|
|
|
+ roadshowInterence.getResearcherBusinessTrip(param).then((res) => {
|
|
|
+ if (res.Ret !== 200) return;
|
|
|
+ bussinessTripCom.BaseDate.value = res.Data.BaseDate
|
|
|
+ const Data = res.Data.GroupList || []
|
|
|
|
|
|
-// //处理数据结构
|
|
|
-// let tempData=Data.filter(it => it.ResearcherList && it.ResearcherList.length > 0)
|
|
|
-// tempData.forEach((item)=>{
|
|
|
-// item.showDetail=true
|
|
|
-// })
|
|
|
-// // 取出出差表所有的日期
|
|
|
-// let weekDateList = tempData[0]?tempData[0].ResearcherList[0].BusinessTripList.map(item => item.WeekDate):[]
|
|
|
-// // 获取表格头文本
|
|
|
-// tableDayColumns.value= getWeekDays(2,weekDateList)
|
|
|
+ //处理数据结构
|
|
|
+ let tempData=Data.filter(it => it.ResearcherList && it.ResearcherList.length > 0)
|
|
|
+ tempData.forEach((item)=>{
|
|
|
+ item.showDetail=true
|
|
|
+ })
|
|
|
+ // 取出出差表所有的日期
|
|
|
+ let weekDateList = tempData[0]?tempData[0].ResearcherList[0].BusinessTripList.map(item => item.WeekDate):[]
|
|
|
+ // 获取表格头文本
|
|
|
+ tableDayColumns.value= getWeekDays(2,weekDateList)
|
|
|
|
|
|
-// datalist.value = tempData;
|
|
|
-// nextTick(()=>{
|
|
|
-// $("table")
|
|
|
-// .find("td")
|
|
|
-// .css({ width: '5.556%' });
|
|
|
-// $("table")
|
|
|
-// .find(".thead-rs")
|
|
|
-// .css({ width: '11.111%' });
|
|
|
-// })
|
|
|
-// });
|
|
|
-// }
|
|
|
+ datalist.value = tempData;
|
|
|
+ nextTick(()=>{
|
|
|
+ $("table")
|
|
|
+ .find("td")
|
|
|
+ .css({ width: '5.556%' });
|
|
|
+ $("table")
|
|
|
+ .find(".thead-rs")
|
|
|
+ .css({ width: '11.111%' });
|
|
|
+ })
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
-// getResearcherList()
|
|
|
-// getTableData()
|
|
|
+getResearcherList()
|
|
|
+getTableData()
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div class="statistic-container">
|
|
|
- 研究员出差表
|
|
|
- <!-- <div class="statistic-select">
|
|
|
+ <div class="statistic-select">
|
|
|
<el-cascader
|
|
|
v-model="researcher"
|
|
|
placeholder="请选择研究员"
|
|
@@ -120,10 +127,10 @@
|
|
|
>
|
|
|
</el-cascader>
|
|
|
<div class="center">
|
|
|
- <el-button type="primary" @click="bussinessTripCom.toogelDate(1)" style="width: 140px;"
|
|
|
+ <el-button type="primary" @click="bussinessTripCom.toogelDate(1,getTableData)" style="width: 140px;"
|
|
|
size="large" ><el-icon :size="14" style="margin-right: 4px;"><ArrowLeft /></el-icon> 上两周</el-button>
|
|
|
- <el-button type="primary" @click="bussinessTripCom.toogelDate(0)" style="width: 140px;" size="large">本期</el-button>
|
|
|
- <el-button type="primary" @click="bussinessTripCom.toogelDate(2)" style="width: 140px;"
|
|
|
+ <el-button type="primary" @click="bussinessTripCom.toogelDate(0,getTableData)" style="width: 140px;" size="large">本期</el-button>
|
|
|
+ <el-button type="primary" @click="bussinessTripCom.toogelDate(2,getTableData)" style="width: 140px;"
|
|
|
size="large" >下两周 <el-icon :size="14" style="margin-left: 4px;"><ArrowRight /></el-icon></el-button>
|
|
|
</div>
|
|
|
<div style="width: 230px;"></div>
|
|
@@ -175,7 +182,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</div>
|
|
|
- </div> -->
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<style lang="scss" scoped>
|