index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. <template>
  2. <div class="bg-img" id="fullScreen" style="box-sizing: border-box">
  3. <div style="padding: 0 1.042vw 0 1.042vw">
  4. <div class="justify-style">
  5. <div class="select-style">
  6. <el-cascader :placeholder="$t('部门')" class="inline-16" ref="selectdep" size="small" v-model="depment" :options="deplist" :append-to-body="false" placement="bottom"
  7. :props="{emitPath:true,expandTrigger:'hover',checkStrictly:true,label:'label',value:'departmentid',children:'children'}" @change="selectDep" ></el-cascader>
  8. <el-select v-model="person" filterable :placeholder="$t('请选择')" size="small" @change="selectPerson" :popper-append-to-body="false" class="inline-16">
  9. <el-option
  10. v-for="item in personnelList"
  11. :key="item.index"
  12. :label="$t(item.name)"
  13. :value="item.userid">
  14. </el-option>
  15. </el-select>
  16. <el-select v-model="isleave" clearable class="inline-16" size="small" :placeholder="$t('请选择状态')" @change="leaveChange" :popper-append-to-body="false">
  17. <el-option :label="$t('在职')" value="1"></el-option>
  18. <el-option :label="$t('离职')" value="2"></el-option>
  19. </el-select>
  20. </div>
  21. <div class="title-style">{{$t(`营销管理平台`)}}</div>
  22. <div class="time-style">
  23. <div>
  24. <span class="span">{{ymd}}</span>
  25. <spna class="span">{{week}}</spna>
  26. <span>{{nowTime}}</span>
  27. </div>
  28. <div>
  29. <el-button size="small" class="button" type="primary" icon="el-icon-s-home" style="background-color: #144894" @click="$router.push('/message')">{{$t(`返回首页`)}}</el-button>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="content-style justify-style">
  35. <div>
  36. <div class="justify-style">
  37. <!-- 业务员账户 -->
  38. <salesmanAccount ref="accountRef" @dialog="detailClick"></salesmanAccount>
  39. <!-- 作业数据 -->
  40. <jobData ref="jobRef" @dialog="detailClick"></jobData>
  41. </div>
  42. <div class="inline-top-20">
  43. <!-- 销售面板 -->
  44. <salesPanel ref="panelRef" style="position: relative;z-index: 900"></salesPanel>
  45. </div>
  46. </div>
  47. <div>
  48. <!-- 销售漏斗 -->
  49. <salesFunnel ref="funnelRef" style="position: relative;z-index: 900"></salesFunnel>
  50. <div class="justify-style inline-top-20">
  51. <!-- 营销费用 -->
  52. <marketingExpenses ref="expensesRef"></marketingExpenses>
  53. <!-- 营销费用统计 -->
  54. <marketingExpenseStatistics ref="exStatisticsRef"></marketingExpenseStatistics>
  55. </div>
  56. </div>
  57. <div>
  58. <!-- 应收账款 -->
  59. <accountsReceivable ref="receivableRef"></accountsReceivable>
  60. <!-- 数据概况 -->
  61. <dataProfile ref="profileRef" class="inline-top-20"></dataProfile>
  62. </div>
  63. </div>
  64. <fullScreen ref="fullRef" class="inline-16" domId="fullScreen" style="visibility: hidden" @backFull="backFull"></fullScreen>
  65. <el-dialog
  66. title="提示"
  67. :visible.sync="dialogVisible"
  68. :showClose="false"
  69. width="500px"
  70. >
  71. <span>暂无权限,请开通权限</span>
  72. <span slot="footer" class="dialog-footer">
  73. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  74. </span>
  75. </el-dialog>
  76. <el-dialog
  77. :title="$t('提示')"
  78. style="margin-top: calc(28vh)"
  79. :visible.sync="dialogVisible"
  80. width="500px"
  81. :before-close="handleClose"
  82. >
  83. <span>{{$t('当前密码为初始密码,请前往修改密码')}}</span>
  84. <span slot="footer" class="dialog-footer">
  85. <el-button size="small" @click="onClose">{{$t('取 消')}}</el-button>
  86. <el-button size="small" type="primary" @click="goPassword">{{$t('确 定')}}</el-button>
  87. </span>
  88. </el-dialog>
  89. </div>
  90. </template>
  91. <script>
  92. import fullScreen from "@/views/salesData/components/fullScreen";
  93. import salesmanAccount from './modules/salesmanAccount';
  94. import jobData from './modules/jobData'
  95. import salesPanel from './modules/salesPanel'
  96. import salesFunnel from './modules/salesFunnel'
  97. import marketingExpenses from './modules/marketingExpenses'
  98. import marketingExpenseStatistics from './modules/marketingExpenseStatistics'
  99. import accountsReceivable from './modules/accountsReceivable'
  100. import dataProfile from './modules/dataProfile'
  101. export default {
  102. name: "index",
  103. components:{fullScreen,salesmanAccount,jobData,salesPanel,salesFunnel,marketingExpenses,marketingExpenseStatistics,accountsReceivable,dataProfile},
  104. data(){
  105. return {
  106. timer: "", // 定义一个定时器
  107. nowTime: "",
  108. ymd:"",
  109. week:"",
  110. isleave:'1',
  111. depment:'',
  112. person:'',
  113. departmentid:'',
  114. deplist:[],
  115. personnelList:[],
  116. depmentParam:{
  117. "id": 20230620102004,
  118. "content": {
  119. "isleave":'1'
  120. }
  121. },
  122. windowWidth: document.documentElement.clientWidth, //实时屏幕宽度
  123. windowHeight: document.documentElement.clientHeight,
  124. dialogVisible:false,
  125. dialogPaw:false
  126. }
  127. },
  128. mounted() {
  129. this.$refs.fullRef.enterFullscreen()
  130. this.departmentrtment()
  131. console.log(this.windowWidth,'获取宽度')
  132. console.log(this.windowHeight,'获取高度')
  133. var that = this;
  134. // <!--把window.onresize事件挂在到mounted函数上-->
  135. window.onresize = () => {
  136. return (() => {
  137. window.fullWidth = document.documentElement.clientWidth;
  138. that.windowWidth = window.fullWidth; // 宽
  139. window.fullHeight = document.documentElement.clientHeight;
  140. that.windowWidth = window.fullHeight
  141. })()
  142. };
  143. },
  144. watch: {
  145. windowWidth (val) {
  146. console.log("实时屏幕宽度:",val );
  147. this.$refs.panelRef.progressWidth = (9.65 * document.documentElement.clientWidth) / 100
  148. },
  149. windowHeight (val) {
  150. console.log("实时屏幕高度:",val );
  151. }
  152. },
  153. methods:{
  154. getTime() {
  155. this.timer = setInterval(() => {
  156. // 获取当前时间的各个部分
  157. let timeDate = new Date();
  158. let year = timeDate.getFullYear();
  159. let mounth = timeDate.getMonth() + 1;
  160. let day = timeDate.getDate();
  161. let hours = timeDate.getHours();
  162. // 格式化小时
  163. hours = hours >= 10 ? hours : "0" + hours;
  164. let minutes = timeDate.getMinutes();
  165. // 格式化分钟
  166. minutes = minutes >= 10 ? minutes : "0" + minutes;
  167. let seconds = timeDate.getSeconds();
  168. // 格式化秒钟
  169. seconds = seconds >= 10 ? seconds : "0" + seconds;
  170. let week = timeDate.getDay();
  171. let weekArr = [
  172. "星期日",
  173. "星期一",
  174. "星期二",
  175. "星期三",
  176. "星期四",
  177. "星期五",
  178. "星期六"
  179. ];
  180. // 将获取的时间信息赋值给nowTime
  181. // this.nowTime = `${year}-${mounth}-${day} ${weekArr[week]} ${hours}:${minutes}:${seconds}`;
  182. this.ymd = `${year}年${mounth}月${day}日`
  183. this.week = `${weekArr[week]}`
  184. this.nowTime = `${hours}:${minutes}:${seconds}`
  185. }, 1000); // 每隔一秒更新时间
  186. },
  187. backFull(){
  188. this.$router.push('/message')
  189. if (JSON.parse(sessionStorage.getItem('active_password')) == '1' && JSON.parse(sessionStorage.getItem('password')) != '1' && JSON.parse(sessionStorage.getItem('active_account')).usertype != 0 && JSON.parse(sessionStorage.getItem('active_account')).usertype != 1){
  190. this.dialogPaw = true
  191. }
  192. },
  193. onClose() {
  194. this.dialogVisible = false;
  195. sessionStorage.setItem("password", "1");
  196. sessionStorage.setItem("isPassword", "0");
  197. },
  198. handleClose() {
  199. this.dialogVisible = false;
  200. sessionStorage.setItem("password", "1");
  201. sessionStorage.setItem("isPassword", "0");
  202. },
  203. goPassword(){
  204. this.dialogPaw = false
  205. this.$router.push('/user_center')
  206. sessionStorage.setItem('password','1')
  207. sessionStorage.setItem('isPassword','1')
  208. },
  209. leaveChange(){
  210. const type = this.depment?'1':'0'
  211. this.person = ''
  212. const dataid = type == '0'?-1:this.departmentid
  213. this.personData()
  214. },
  215. /*获取新的业务员列表*/
  216. async personData(){
  217. let param = {
  218. id: 20230620102004,
  219. content: {
  220. isleave:this.isleave
  221. },
  222. }
  223. const res = await this.$api.requested(param)
  224. this.personnelList = res.data.hr
  225. },
  226. async departmentrtment() {
  227. const res = await this.$api.requested(this.depmentParam)
  228. this.deplist = this.createMenu(res.data.dep)
  229. this.personnelList = res.data.hr
  230. this.person = JSON.parse(window.sessionStorage.getItem('active_account')).name
  231. this.depment = ''
  232. this.departmentid = ''
  233. const userid = JSON.parse(sessionStorage.getItem('active_account')).userid
  234. this.queryAllData(userid)
  235. },
  236. createMenu (array) {
  237. var that = this
  238. let arr = []
  239. function convertToElementTree(node) {
  240. // 新节点
  241. if (node.subdep.length === 0){
  242. var elNode = {
  243. label: node["depname"],
  244. parentid:node['parentid'],
  245. parentname:node['parentname'],
  246. departmentid:node["departmentid"],
  247. value:node["departmentid"],
  248. remarks:node["remarks"],
  249. isused:node["isused"],
  250. changedate:node['changedate'],
  251. changeby:node['changeby'],
  252. createdate:node['createdate'],
  253. createby:node['createby'],
  254. depno:node['depno'],
  255. disabled:that.pageOnlyRead,
  256. }
  257. }else {
  258. var elNode = {
  259. label: node["depname"],
  260. parentid:node['parentid'],
  261. parentname:node['parentname'],
  262. departmentid:node["departmentid"],
  263. value:node["departmentid"],
  264. remarks:node["remarks"],
  265. isused:node["isused"],
  266. changedate:node['changedate'],
  267. changeby:node['changeby'],
  268. createdate:node['createdate'],
  269. createby:node['createby'],
  270. depno:node['depno'],
  271. disabled:that.pageOnlyRead,
  272. children: []
  273. }
  274. }
  275. if (node.subdep && node.subdep.length > 0) {
  276. // 如果存在子节点
  277. for (var index = 0; index < node.subdep.length; index++) {
  278. // 遍历子节点, 把每个子节点看做一颗独立的树, 传入递归构造子树, 并把结果放回到新node的children中
  279. elNode.children.push(convertToElementTree(node.subdep[index]));
  280. }
  281. }
  282. return elNode;
  283. }
  284. array.forEach((element) => {
  285. arr.push(convertToElementTree(element))
  286. });
  287. return arr
  288. },
  289. selectDep(val) {
  290. if (val.length === 0){
  291. const userid = JSON.parse(sessionStorage.getItem('active_account')).userid
  292. this.queryAllData(userid)
  293. }else {
  294. this.person = ''
  295. this.dataid = ''
  296. this.departmentid = val[val.length -1]
  297. this.queryAllData(this.departmentid)
  298. }
  299. },
  300. selectPerson(val){
  301. this.depment = ''
  302. this.departmentid = ''
  303. this.dataid = val
  304. this.queryAllData(val)
  305. },
  306. queryAllData(id){
  307. /*业务员账户*/
  308. this.$refs.accountRef.param.content.dataid = id
  309. this.$refs.accountRef.param.content.type = this.departmentid !== ''?1:0
  310. this.$refs.accountRef.param.content.where.isleave = this.isleave
  311. this.$refs.accountRef.listData()
  312. /*作业数据*/
  313. this.$refs.jobRef.param.content.dataid = id
  314. this.$refs.jobRef.param.content.type = this.departmentid !== ''?1:0
  315. this.$refs.jobRef.param.content.where.isleave = this.isleave
  316. this.$refs.jobRef.listData()
  317. /*销售面板*/
  318. this.$refs.panelRef.param.content.dataid = id
  319. this.$refs.panelRef.param.content.type = this.departmentid !== ''?1:0
  320. this.$refs.panelRef.param.content.where.isleave = this.isleave
  321. this.$refs.panelRef.paramChart.content.dataid = id
  322. this.$refs.panelRef.paramChart.content.type = this.departmentid !== ''?1:0
  323. this.$refs.panelRef.paramChart.content.where.isleave = this.isleave
  324. let year = new Date().getFullYear()
  325. this.$refs.panelRef.$refs.pickerRef.value = String(year)
  326. this.$refs.panelRef.listData(true)
  327. /*销售漏斗*/
  328. this.$refs.funnelRef.param.content.dataid = id
  329. this.$refs.funnelRef.param.content.type = this.departmentid !== ''?1:0
  330. this.$refs.funnelRef.param.content.where.isleave = this.isleave
  331. this.$refs.funnelRef.listData()
  332. /*营销费用*/
  333. this.$refs.expensesRef.param.content.dataid = id
  334. this.$refs.expensesRef.param.content.type = this.departmentid !== ''?1:0
  335. this.$refs.expensesRef.param.content.where.isleave = this.isleave
  336. this.$refs.expensesRef.listData()
  337. /*营销费用统计*/
  338. this.$refs.exStatisticsRef.param.content.dataid = id
  339. this.$refs.exStatisticsRef.param.content.type = this.departmentid !== ''?1:0
  340. this.$refs.exStatisticsRef.param.content.where.isleave = this.isleave
  341. this.$refs.exStatisticsRef.cusInit(true)
  342. this.$refs.exStatisticsRef.proInit(true)
  343. /*应收账款*/
  344. this.$refs.receivableRef.param.content.dataid = id
  345. this.$refs.receivableRef.param.content.type = this.departmentid !== ''?1:0
  346. this.$refs.receivableRef.param.content.where.isleave = this.isleave
  347. this.$refs.receivableRef.listData()
  348. /*数据概况*/
  349. this.$refs.profileRef.param.content.dataid = id
  350. this.$refs.profileRef.param.content.type = this.departmentid !== ''?1:0
  351. this.$refs.profileRef.param.content.where.isleave = this.isleave
  352. this.$refs.profileRef.listData()
  353. this.$refs.profileRef.$refs.proTypRef.param.content.dataid = id
  354. this.$refs.profileRef.$refs.proTypRef.param.content.type = this.departmentid !== ''?1:0
  355. this.$refs.profileRef.$refs.proTypRef.param.content.where.isleave = this.isleave
  356. let currentDate = new Date(); // 获取当前日期
  357. let startDate = new Date(currentDate.getFullYear(), currentDate.getMonth() ) // 计算起始日期
  358. let endDate = currentDate.getFullYear() +'-' + 12 // 计算起始日期
  359. this.$refs.profileRef.$refs.startRef.value = startDate
  360. this.$refs.profileRef.$refs.endRef.value = endDate
  361. this.$refs.profileRef.$refs.proTypRef.typeInit(true,'项目类型分析')
  362. this.$refs.profileRef.$refs.proFowRef.typeInit(true,'项目跟进情况')
  363. this.$refs.profileRef.$refs.cusFowRef.typeInit(true,'客户跟进情况')
  364. this.$refs.profileRef.$refs.analyzeRef.param.content.dataid = id
  365. this.$refs.profileRef.$refs.analyzeRef.param.content.type = this.departmentid !== ''?1:0
  366. this.$refs.profileRef.$refs.analyzeRef.param.content.where.isleave = this.isleave
  367. this.$refs.profileRef.$refs.analyzeDateRef.value = new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + new Date().getDate()
  368. this.$refs.profileRef.$refs.analyzeRef.lineInit(true)
  369. },
  370. detailClick(){
  371. this.dialogVisible = true
  372. }
  373. },
  374. created() {
  375. this.getTime()
  376. },
  377. beforeDestroy() {
  378. if (this.timer) {
  379. clearInterval(this.timer);
  380. }
  381. },
  382. }
  383. </script>
  384. <style scoped>
  385. .bg-img {
  386. background: url("../../assets/icons/bgScreen.jpg") no-repeat;
  387. background-size: 100% 100%;
  388. width: 100vw;
  389. height: 100vh;
  390. margin: 0;
  391. padding: 0;
  392. }
  393. .select-style{
  394. width: 30%;
  395. padding-top: 0.625vw;
  396. }
  397. .title-style {
  398. width: 30%;
  399. font-family: Microsoft YaHei, Microsoft YaHei;
  400. font-weight: bold;
  401. font-size: 2.292vw;
  402. color: #E6F4FF;
  403. text-shadow: 0.000vw 0.104vw 0.208vw #A9D7F9;
  404. margin: auto;
  405. font-style: normal;
  406. text-transform: none;
  407. padding-top: 1.042vh
  408. }
  409. .time-style{
  410. font-family: Microsoft YaHei, Microsoft YaHei;
  411. font-weight: 400;
  412. font-size: 0.938vw;
  413. color: #E6F4FF;
  414. text-align: right;
  415. font-style: normal;
  416. text-transform: none;
  417. padding-top: 0.938vw;
  418. }
  419. .time-style .span {
  420. margin-right: 1.042vw;
  421. }
  422. .time-style .button {
  423. font-family: Microsoft YaHei, Microsoft YaHei;
  424. font-weight: 400;
  425. font-size: 0.938vw;
  426. color: #E6F4FF;
  427. text-align: left;
  428. font-style: normal;
  429. text-transform: none;
  430. margin-top: 0.538vw;
  431. border-radius: 0.313vw 0.313vw 0.313vw 0.313vw;
  432. border: none;
  433. }
  434. .justify-style{
  435. display: flex;
  436. justify-content: space-between
  437. }
  438. .content-style{
  439. margin: 1.804vw 1.042vw 1.042vw 1.042vw;
  440. /*border: 0.052vw solid #5daf34;*/
  441. height: calc(100vh - 7.458vw);
  442. }
  443. .inline-left-20{
  444. margin-left: 1.042vw;
  445. }
  446. .inline-top-20{
  447. margin-top: 1.042vw;
  448. }
  449. /deep/ .el-input {
  450. position: relative;
  451. font-size: 14px;
  452. display: inline-block;
  453. width: 140px;
  454. }
  455. /deep/ .el-input__inner {
  456. -webkit-appearance: none;
  457. background-color: #061a31;
  458. background-image: none;
  459. box-sizing: border-box;
  460. color: #c6d6e4;
  461. display: inline-block;
  462. font-size: inherit;
  463. height: 40px;
  464. line-height: 40px;
  465. outline: 0;
  466. padding: 0 15px;
  467. transition: border-color .2s cubic-bezier(.645, .045, .355, 1);
  468. width: 100%;
  469. box-shadow: 0px 3px 6px 1px rgba(0,0,0,0.16);
  470. border-radius: 6px 6px 6px 6px;
  471. border: 1px solid #CFDCE5;
  472. }
  473. </style>