index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. <template>
  2. <div class="tenant">
  3. <div class="query bck" style="padding-bottom: 0px">
  4. <el-form :inline="true" :model="queryForm">
  5. <el-form-item label="查看用户">
  6. <el-select
  7. v-model="selectUser"
  8. multiple
  9. placeholder="请选择用户"
  10. @change="changeUser"
  11. >
  12. <el-option
  13. v-for="item in userList"
  14. :key="item.value"
  15. :label="item.label"
  16. :value="item.value"
  17. :disabled="item.value !== 'all' && selectUser.includes('all')"
  18. />
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item label="日期">
  22. <el-date-picker
  23. v-model="queryForm.timeArr"
  24. type="daterange"
  25. unlink-panels
  26. range-separator="-"
  27. start-placeholder="开始日期"
  28. end-placeholder="结束日期"
  29. value-format="YYYY-MM-DD"
  30. @change="onQuery"
  31. />
  32. </el-form-item>
  33. <el-form-item>
  34. <el-button @click="clickBtn(1)" :class="{ btnBck: selectBtn === 1 }"
  35. >近30天</el-button
  36. >
  37. <el-button @click="clickBtn(2)" :class="{ btnBck: selectBtn === 2 }"
  38. >本月</el-button
  39. >
  40. <el-button @click="clickBtn(3)" :class="{ btnBck: selectBtn === 3 }"
  41. >上月</el-button
  42. >
  43. <el-button @click="clickBtn(4)" :class="{ btnBck: selectBtn === 4 }"
  44. >近一年</el-button
  45. >
  46. <el-button @click="clickBtn(5)" :class="{ btnBck: selectBtn === 5 }"
  47. >去年</el-button
  48. >
  49. <el-button @click="clickBtn(6)" :class="{ btnBck: selectBtn === 6 }"
  50. >今年</el-button
  51. >
  52. </el-form-item>
  53. </el-form>
  54. </div>
  55. <div v-loading="loading">
  56. <div style="display: flex; margin-top: 15px">
  57. <div class="bck">
  58. <TitleInfo :content="titleList[0]"></TitleInfo>
  59. <div class="one-row" style="margin-top: 15px">
  60. <div class="one-row-item first" style="margin-right: 15px">
  61. <div class="label">存量客户(人)</div>
  62. <div class="value">
  63. {{ allData.customerSituation.customerCount }}
  64. </div>
  65. </div>
  66. <div class="one-row-item other" style="margin-right: 15px">
  67. <div class="label">新增客户(人)</div>
  68. <div class="value">
  69. {{ allData.customerSituation.customerAddCount }}
  70. </div>
  71. </div>
  72. <div class="one-row-item other" style="margin-right: 15px">
  73. <div class="label">报价客户(人)</div>
  74. <div class="value">
  75. {{ allData.customerSituation.saleQuotationCustomerCount }}
  76. </div>
  77. </div>
  78. <div class="one-row-item other">
  79. <div class="label">成交客户(人)</div>
  80. <div class="value">
  81. {{ allData.customerSituation.contractCustomerCount }}
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. <div class="bck" style="margin-left: 20px">
  87. <TitleInfo :content="titleList[1]"></TitleInfo>
  88. <div class="one-row" style="margin-top: 15px">
  89. <div class="one-row-item first" style="margin-right: 15px">
  90. <div class="label">存量产品</div>
  91. <div class="value">
  92. {{ allData.productSituation.productCount }}
  93. </div>
  94. </div>
  95. <div class="one-row-item other">
  96. <div class="label">新增产品</div>
  97. <div class="value">
  98. {{ allData.productSituation.productAddCount }}
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. <div class="bck" style="margin-left: 20px; flex: 1">
  104. <TitleInfo :content="titleList[2]"></TitleInfo>
  105. <div class="one-row" style="margin-top: 15px">
  106. <div class="one-row-item first" style="margin-right: 15px">
  107. <div class="label">发件</div>
  108. <div class="value">{{ allData.commMail.sentMailCount }}</div>
  109. </div>
  110. <div class="one-row-item other">
  111. <div class="label">收件</div>
  112. <div class="value">{{ allData.commMail.receiveMailCount }}</div>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. <div style="margin-top: 15px">
  118. <div class="bck scroll">
  119. <TitleInfo :content="titleList[3]"></TitleInfo>
  120. <div class="two-row" style="margin-top: 15px">
  121. <div class="two-row-item first" style="margin-right: 15px">
  122. <div class="label">报价</div>
  123. <div class="value">
  124. <div style="margin-right: 15px">
  125. <div class="child-value">
  126. {{ allData.saleSituation.quotationAddStatistics.count }}
  127. </div>
  128. <div class="text">订单数</div>
  129. </div>
  130. <div>
  131. <div class="child-value color-blue">
  132. CNY
  133. {{
  134. moneyFormat(
  135. allData.saleSituation.quotationAddStatistics.sumAmount,
  136. 2
  137. )
  138. }}
  139. </div>
  140. <div class="text">金额</div>
  141. </div>
  142. </div>
  143. </div>
  144. <div class="two-row-item other" style="margin-right: 15px">
  145. <div class="label">成交</div>
  146. <div class="value">
  147. <div style="margin-right: 15px">
  148. <div class="child-value">
  149. {{ allData.saleSituation.contractAddStatistics.count }}
  150. </div>
  151. <div class="text">订单数</div>
  152. </div>
  153. <div>
  154. <div class="child-value color-blue">
  155. CNY
  156. {{
  157. moneyFormat(
  158. allData.saleSituation.contractAddStatistics.sumAmount,
  159. 2
  160. )
  161. }}
  162. </div>
  163. <div class="text">金额</div>
  164. </div>
  165. </div>
  166. </div>
  167. <div class="two-row-item other" style="margin-right: 15px">
  168. <div class="label">到账</div>
  169. <div class="value">
  170. <div style="margin-right: 15px">
  171. <div class="child-value">
  172. {{ allData.saleSituation.claimAddStatistics.count }}
  173. </div>
  174. <div class="text">笔</div>
  175. </div>
  176. <div>
  177. <div class="child-value color-blue">
  178. CNY
  179. {{
  180. moneyFormat(
  181. allData.saleSituation.claimAddStatistics.sumAmount,
  182. 2
  183. )
  184. }}
  185. </div>
  186. <div class="text">金额</div>
  187. </div>
  188. </div>
  189. </div>
  190. <div class="two-row-item other">
  191. <div class="label">创建单证</div>
  192. <div class="value">
  193. <div style="margin-right: 15px">
  194. <div class="child-value">
  195. {{ allData.saleSituation.documentsCount }}
  196. </div>
  197. <div class="text">套</div>
  198. </div>
  199. </div>
  200. </div>
  201. </div>
  202. </div>
  203. </div>
  204. <div style="margin-top: 15px">
  205. <div class="bck scroll">
  206. <TitleInfo :content="titleList[4]"></TitleInfo>
  207. <div class="two-row" style="margin-top: 15px">
  208. <div class="two-row-item first" style="margin-right: 15px">
  209. <div class="label">报价</div>
  210. <div class="value">
  211. <div style="margin-right: 15px">
  212. <div class="child-value">
  213. {{ allData.saleAddSituation.quotationAddStatistics.count }}
  214. </div>
  215. <div class="text">订单数</div>
  216. </div>
  217. <div>
  218. <div class="child-value color-blue">
  219. CNY
  220. {{
  221. moneyFormat(
  222. allData.saleAddSituation.quotationAddStatistics
  223. .sumAmount,
  224. 2
  225. )
  226. }}
  227. </div>
  228. <div class="text">金额</div>
  229. </div>
  230. </div>
  231. </div>
  232. <div class="two-row-item other" style="margin-right: 15px">
  233. <div class="label">成交</div>
  234. <div class="value">
  235. <div style="margin-right: 15px">
  236. <div class="child-value">
  237. {{ allData.saleAddSituation.contractAddStatistics.count }}
  238. </div>
  239. <div class="text">订单数</div>
  240. </div>
  241. <div>
  242. <div class="child-value color-blue">
  243. CNY
  244. {{
  245. moneyFormat(
  246. allData.saleAddSituation.contractAddStatistics
  247. .sumAmount,
  248. 2
  249. )
  250. }}
  251. </div>
  252. <div class="text">金额</div>
  253. </div>
  254. </div>
  255. </div>
  256. <div class="two-row-item other" style="margin-right: 15px">
  257. <div class="label">到账</div>
  258. <div class="value">
  259. <div style="margin-right: 15px">
  260. <div class="child-value">
  261. {{ allData.saleAddSituation.claimAddStatistics.count }}
  262. </div>
  263. <div class="text">笔</div>
  264. </div>
  265. <div>
  266. <div class="child-value color-blue">
  267. CNY
  268. {{
  269. moneyFormat(
  270. allData.saleAddSituation.claimAddStatistics.sumAmount,
  271. 2
  272. )
  273. }}
  274. </div>
  275. <div class="text">金额</div>
  276. </div>
  277. </div>
  278. </div>
  279. <div class="two-row-item other">
  280. <div class="label">创建单证</div>
  281. <div class="value">
  282. <div style="margin-right: 15px">
  283. <div class="child-value">
  284. {{ allData.saleAddSituation.documentsCount }}
  285. </div>
  286. <div class="text">套</div>
  287. </div>
  288. </div>
  289. </div>
  290. </div>
  291. </div>
  292. </div>
  293. <div style="display: flex; margin-top: 15px">
  294. <div class="bck" style="width: 100%">
  295. <TitleInfo :content="titleList[5]"></TitleInfo>
  296. <div class="two-row" style="margin-top: 15px; width: 100%">
  297. <div class="two-row-item first" style="margin-right: 15px">
  298. <div class="label">待采购</div>
  299. <div class="value">
  300. <div style="margin-right: 15px">
  301. <div class="child-value">
  302. {{
  303. allData.purchaseStatistics.waitPurchaseStatistics
  304. .contractProductCount
  305. }}
  306. </div>
  307. <div class="text">交接单</div>
  308. </div>
  309. <div>
  310. <div class="child-value color-blue">
  311. {{
  312. allData.purchaseStatistics.waitPurchaseStatistics
  313. .subscribeDetailCount
  314. }}
  315. </div>
  316. <div class="text">申购</div>
  317. </div>
  318. </div>
  319. </div>
  320. <div class="two-row-item other" style="margin-right: 15px">
  321. <div class="label">采购订单</div>
  322. <div class="value">
  323. <div style="margin-right: 15px">
  324. <div class="child-value">
  325. {{ allData.purchaseStatistics.purchaseOrder.purchaseCount }}
  326. </div>
  327. <div class="text">订单数</div>
  328. </div>
  329. <div style="margin-right: 15px">
  330. <div class="child-value color-blue">
  331. CNY
  332. {{
  333. moneyFormat(
  334. allData.purchaseStatistics.purchaseOrder.purchaseAmount,
  335. 2
  336. )
  337. }}
  338. </div>
  339. <div class="text">金额</div>
  340. </div>
  341. <div>
  342. <div class="child-value color-blue">
  343. CNY
  344. {{
  345. moneyFormat(
  346. allData.purchaseStatistics.purchaseOrder
  347. .purchasePayAmount,
  348. 2
  349. )
  350. }}
  351. </div>
  352. <div class="text">已付款</div>
  353. </div>
  354. </div>
  355. </div>
  356. </div>
  357. </div>
  358. <!-- <div class="bck" style="margin-left: 20px">
  359. <TitleInfo :content="titleList[6]"></TitleInfo>
  360. <div class="one-row" style="margin-top: 15px">
  361. <div class="one-row-item first" style="margin-right: 15px">
  362. <div class="label">发起</div>
  363. <div class="value">
  364. {{ allData.flowStatistics.flowExampleCount }}
  365. </div>
  366. </div>
  367. <div class="one-row-item other">
  368. <div class="label">待处理</div>
  369. <div class="value">
  370. {{ allData.flowStatistics.waitFlowExampleCount }}
  371. </div>
  372. </div>
  373. </div>
  374. </div> -->
  375. </div>
  376. </div>
  377. </div>
  378. </template>
  379. <script setup>
  380. import TitleInfo from "@/components/TitleInfo/index.vue";
  381. import useUserStore from "@/store/modules/user";
  382. import moment from "moment";
  383. const titleList = [
  384. "客户情况",
  385. "产品情况",
  386. "往来邮件",
  387. "销售行为(存量客户)",
  388. "销售行为(新增客户)",
  389. "采购行为",
  390. "流程统计",
  391. ];
  392. const userList = ref([]);
  393. const selectUser = ref(["all"]);
  394. const { proxy } = getCurrentInstance();
  395. const loading = ref(false);
  396. const queryForm = reactive({
  397. userIds: [],
  398. beginTime: "",
  399. endTime: "",
  400. timeArr: "",
  401. });
  402. const allData = ref({
  403. customerSituation: {},
  404. productSituation: {},
  405. commMail: {},
  406. flowStatistics: {},
  407. saleSituation: {
  408. quotationAddStatistics: {},
  409. contractAddStatistics: {},
  410. claimAddStatistics: {},
  411. },
  412. saleAddSituation: {
  413. quotationAddStatistics: {},
  414. contractAddStatistics: {},
  415. claimAddStatistics: {},
  416. },
  417. purchaseStatistics: {
  418. waitPurchaseStatistics: {},
  419. purchaseOrder: {},
  420. },
  421. });
  422. const getData = () => {
  423. loading.value = true;
  424. proxy.post("/employeeAnalysis/info", queryForm).then((res) => {
  425. allData.value = res;
  426. loading.value = false;
  427. });
  428. };
  429. const getDict = () => {
  430. proxy
  431. .get("/tenantUser/list", {
  432. pageNum: 1,
  433. pageSize: 10000,
  434. tenantId: useUserStore().user.tenantId,
  435. })
  436. .then((res) => {
  437. userList.value = res.rows.map((item) => {
  438. return {
  439. label: item.nickName,
  440. value: item.userId,
  441. };
  442. });
  443. userList.value.unshift({
  444. label: "全部",
  445. value: "all",
  446. });
  447. });
  448. };
  449. const onQuery = () => {
  450. if (queryForm.timeArr.length > 1) {
  451. queryForm.beginTime = queryForm.timeArr[0];
  452. queryForm.endTime = queryForm.timeArr[1];
  453. } else {
  454. queryForm.beginTime = "";
  455. queryForm.endTime = "";
  456. }
  457. getData();
  458. };
  459. const changeUser = (val) => {
  460. selectUser.value = val.includes("all") ? ["all"] : val;
  461. queryForm.userIds = val.includes("all") ? [] : val;
  462. onQuery();
  463. };
  464. const selectBtn = ref(1);
  465. const clickBtn = (val) => {
  466. selectBtn.value = val;
  467. let today = new Date();
  468. let startDate = null;
  469. let endDate = null;
  470. let year = null;
  471. let month = null;
  472. switch (val) {
  473. case 1:
  474. startDate = new Date(today);
  475. startDate.setDate(today.getDate() - 29);
  476. endDate = new Date(today);
  477. break;
  478. case 2:
  479. year = today.getFullYear();
  480. month = today.getMonth();
  481. startDate = new Date(year, month, 1);
  482. endDate = new Date(year, month + 1, 0);
  483. break;
  484. case 3:
  485. year = today.getFullYear();
  486. month = today.getMonth() - 1;
  487. startDate = new Date(year, month, 1);
  488. endDate = new Date(year, month + 1, 0);
  489. break;
  490. case 4:
  491. year = today.getFullYear();
  492. startDate = new Date(year - 1, today.getMonth(), today.getDate());
  493. endDate = new Date(year, today.getMonth(), today.getDate());
  494. break;
  495. case 5:
  496. year = today.getFullYear();
  497. startDate = new Date(year - 1, 0, 1);
  498. endDate = new Date(year - 1, 11, 31);
  499. break;
  500. case 6:
  501. year = today.getFullYear();
  502. startDate = new Date(year, 0, 1);
  503. endDate = new Date(year, 11, 31);
  504. break;
  505. default:
  506. startDate = new Date(today);
  507. startDate.setDate(today.getDate() - 29);
  508. endDate = new Date(today);
  509. break;
  510. }
  511. queryForm.timeArr = [
  512. moment(startDate).format("yyyy-MM-DD"),
  513. moment(endDate).format("yyyy-MM-DD"),
  514. ];
  515. onQuery();
  516. };
  517. getDict();
  518. clickBtn(1);
  519. </script>
  520. <style lang="scss" scoped>
  521. .tenant {
  522. padding: 20px;
  523. }
  524. .bck {
  525. background-color: #fff;
  526. padding: 15px;
  527. }
  528. .one-row {
  529. display: flex;
  530. .one-row-item {
  531. min-width: 160px;
  532. max-width: 180px;
  533. padding: 15px;
  534. border-radius: 10px;
  535. .label {
  536. margin-bottom: 10px;
  537. font-size: 14px;
  538. color: #333333;
  539. }
  540. .value {
  541. font-size: 24px;
  542. font-weight: 700;
  543. }
  544. }
  545. .first {
  546. background: #fff1e1;
  547. .value {
  548. color: #333333;
  549. }
  550. .label::before {
  551. content: "";
  552. display: inline-block;
  553. width: 10px;
  554. height: 10px;
  555. background: #ff9315;
  556. border-radius: 50%;
  557. margin-right: 10px;
  558. }
  559. }
  560. .other {
  561. background: #eff6ff;
  562. .value {
  563. color: #333333;
  564. }
  565. .label::before {
  566. content: "";
  567. display: inline-block;
  568. width: 10px;
  569. height: 10px;
  570. background: #0084ff;
  571. border-radius: 50%;
  572. margin-right: 10px;
  573. }
  574. }
  575. }
  576. .two-row {
  577. display: flex;
  578. .two-row-item {
  579. min-width: 320px;
  580. max-width: 320px;
  581. padding: 15px;
  582. border-radius: 10px;
  583. .label {
  584. margin-bottom: 10px;
  585. font-size: 14px;
  586. font-weight: 700;
  587. color: #333333;
  588. }
  589. .value {
  590. display: flex;
  591. font-size: 14px;
  592. justify-content: space-between;
  593. padding-right: 30px;
  594. .child-value {
  595. font-size: 16px;
  596. font-weight: 700;
  597. }
  598. .text {
  599. // color: #333333;
  600. font-size: 14px;
  601. margin-top: 10px;
  602. }
  603. }
  604. }
  605. .first {
  606. background: #fff1e1;
  607. // .child-value {
  608. // color: #333333;
  609. // }
  610. }
  611. .other {
  612. background: #eff6ff;
  613. // .child-value {
  614. // color: #0084ff;
  615. // }
  616. }
  617. .color-blue {
  618. color: #0084ff;
  619. }
  620. }
  621. .btnBck {
  622. background: #0084ff;
  623. color: #fff;
  624. }
  625. .scroll {
  626. overflow-x: auto;
  627. }
  628. </style>