index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041
  1. <template>
  2. <div class="app-container home">
  3. <!-- <div>-->
  4. <!-- 文件上传测试调用 -->
  5. <!-- <button @click="upload.open = true">上传</button>-->
  6. <!-- <el-select v-model="filetype" placeholder="请选择">-->
  7. <!-- <el-option label="文件形式" value="filePattern"/>-->
  8. <!-- <el-option label="字节形式" value="bytes"/>-->
  9. <!-- <el-option label="编码形式" value="base64"/>-->
  10. <!-- </el-select>-->
  11. <!-- &lt;!&ndash; :action="upload.url"&ndash;&gt;-->
  12. <!-- <el-upload-->
  13. <!-- action="#"-->
  14. <!-- :http-request="customUpload"-->
  15. <!-- :visible.sync="upload.open"-->
  16. <!-- :on-success="handleSuccess"-->
  17. <!-- :on-error="handleError"-->
  18. <!-- :before-upload="beforeUpload"-->
  19. <!-- :headers="upload.headers"-->
  20. <!-- :auto-upload="false"-->
  21. <!-- multiple-->
  22. <!-- ref="upload">-->
  23. <!-- <el-button slot="trigger" size="small" type="primary">选取文件</el-button>-->
  24. <!-- <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>-->
  25. <!-- </el-upload>-->
  26. <!-- &lt;!&ndash; <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>&ndash;&gt;-->
  27. <!-- &lt;!&ndash; &lt;!&ndash; :on-progress="handleFileUploadProgress"&ndash;&gt;-->
  28. <!-- &lt;!&ndash; :on-success="handleFileSuccess"&ndash;&gt;&ndash;&gt;-->
  29. <!-- &lt;!&ndash; <el-upload ref="upload" :headers="upload.headers"&ndash;&gt;-->
  30. <!-- &lt;!&ndash; :action="upload.url" :disabled="upload.isUploading"&ndash;&gt;-->
  31. <!-- &lt;!&ndash; :auto-upload="false"&ndash;&gt;-->
  32. <!-- &lt;!&ndash; :file-list="upload.fileList"&ndash;&gt;-->
  33. <!-- &lt;!&ndash; multiple drag>&ndash;&gt;-->
  34. <!-- &lt;!&ndash; <i class="el-icon-upload"></i>&ndash;&gt;-->
  35. <!-- &lt;!&ndash; <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>&ndash;&gt;-->
  36. <!-- &lt;!&ndash; <div class="el-upload__tip text-center" slot="tip"></div>&ndash;&gt;-->
  37. <!-- &lt;!&ndash; </el-upload>&ndash;&gt;-->
  38. <!-- &lt;!&ndash; <div slot="footer" class="dialog-footer">&ndash;&gt;-->
  39. <!-- &lt;!&ndash; <el-button type="primary" @click="submitFileForm">确 定</el-button>&ndash;&gt;-->
  40. <!-- &lt;!&ndash; <el-button @click="upload.open = false">取 消</el-button>&ndash;&gt;-->
  41. <!-- &lt;!&ndash; </div>&ndash;&gt;-->
  42. <!-- &lt;!&ndash; </el-dialog>&ndash;&gt;-->
  43. <!-- </div>-->
  44. <!-- <el-row :gutter="20"></el-row>
  45. <el-row :gutter="20"></el-row>
  46. <el-divider/>
  47. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  48. <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
  49. :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
  50. :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
  51. <i class="el-icon-upload"></i>
  52. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  53. <div class="el-upload__tip text-center" slot="tip">
  54. <div class="el-upload__tip" slot="tip">
  55. <el-checkbox v-model="upload.updateSupport"/>
  56. 是否更新已经存在的用户数据
  57. </div>
  58. <span>仅允许导入xls、xlsx格式文件。</span>
  59. <el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
  60. @click="importTemplate">下载模板
  61. </el-link>
  62. </div>
  63. </el-upload>
  64. <div slot="footer" class="dialog-footer">
  65. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  66. <el-button @click="upload.open = false">取 消</el-button>
  67. </div>
  68. </el-dialog>
  69. <button @click="upload.open = true">上传文件</button>
  70. <el-row :gutter="20">
  71. <el-col :xs="24" :sm="24" :md="12" :lg="8"></el-col>
  72. <el-col :xs="24" :sm="24" :md="12" :lg="8">
  73. <el-card class="update-log">
  74. <div slot="header" class="clearfix">
  75. <span>更新日志</span>
  76. </div>
  77. <el-collapse accordion> 123123</el-collapse>
  78. </el-card>
  79. </el-col>
  80. <el-col :xs="24" :sm="24" :md="12" :lg="8">
  81. <el-card class="update-log">
  82. <div slot="header" class="clearfix">
  83. <span>捐赠支持</span>
  84. </div>
  85. <div class="body"></div>
  86. </el-card>
  87. </el-col>
  88. </el-row> -->
  89. <div class="info-content">
  90. <!-- <div class="header" @click="toPersonalCenter"> -->
  91. <!-- <img :src="avatar" class="user-avatar" /> -->
  92. <!-- </div> -->
  93. <!-- <div class="name">{{ nickName }}</div> -->
  94. <!-- <div class="tenant-name">{{ tenantName }}</div> -->
  95. <!-- <div class="date">{{ date }}</div> -->
  96. <!-- <div class="title">欢迎登录Mec OS 工业应用操作系统</div> -->
  97. <!-- <div class="title">欢迎登录Mec OS 化纤行业生产管理系统</div> -->
  98. <div class="echarts1">
  99. <div class="pieChart" ref="pieChart"></div>
  100. <div
  101. :class="'describe' + (parseInt(index) + 1)"
  102. v-for="(item, index) in processList"
  103. :key="index"
  104. >
  105. <P class="text">{{ item.name }}</P>
  106. <P class="num">{{ item.value }}</P>
  107. </div>
  108. </div>
  109. <div class="echarts2">
  110. <div class="lineChart" ref="lineChart"></div>
  111. </div>
  112. <div class="echarts3">
  113. <p class="title">操作日志</p>
  114. <div class="text">
  115. <span class="peo">操作人</span>
  116. <span class="add">ip</span>
  117. </div>
  118. <div class="swiper-container">
  119. <div class="swiper-scrollbar"></div>
  120. <div class="swiper-wrapper">
  121. <div class="swiper-slide" v-for="(item, index) in swiperList" :key="index">
  122. <div>
  123. <span class="name">{{ item.operName }}</span>
  124. <span class="ip">{{ item.operIp }}</span>
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. </div>
  130. <div class="echarts4">
  131. <div class="gaugeChart" ref="gaugeChart"></div>
  132. </div>
  133. <div class="echarts5">
  134. <div class="barChart" ref="barChart"></div>
  135. </div>
  136. </div>
  137. </div>
  138. </template>
  139. <script>
  140. import {formatDate} from "@/utils";
  141. import {getToken} from "@/utils/auth";
  142. import {mapGetters, mapState} from "vuex";
  143. import "swiper/css/swiper.css";
  144. import Swiper from "swiper";
  145. import {
  146. getTask,
  147. getPipeline,
  148. getOperation,
  149. getMaterial,
  150. getLogin, uploadFilesTenant,
  151. } from "@/api/homePage/index";
  152. export default {
  153. name: "Index",
  154. data() {
  155. return {
  156. filetype: "",
  157. chartObj: {
  158. myChart1: null,
  159. myChart2: null,
  160. myChart3: null,
  161. myChart4: null,
  162. },
  163. processList: [],
  164. swiperList: [],
  165. // 用户导入参数
  166. upload: {
  167. formData: {},
  168. // 文件列表
  169. fileList: [],
  170. // 是否显示弹出层(用户导入)
  171. open: true,
  172. // 弹出层标题(用户导入)
  173. title: "",
  174. // 是否禁用上传
  175. isUploading: false,
  176. // 是否更新已经存在的用户数据
  177. updateSupport: 0,
  178. // 设置上传的请求头部
  179. headers: {Authorization: "Bearer " + getToken()},
  180. // 上传的地址
  181. url: process.env.VUE_APP_BASE_API1 + "system/fileManagement/tenantUploadFiles",
  182. },
  183. // 版本号
  184. version: "3.8.5",
  185. };
  186. },
  187. mounted() {
  188. // 初始化 echarts
  189. this.initChart1();
  190. this.initChart2();
  191. this.initChart3();
  192. this.initChart4();
  193. this.initData();
  194. },
  195. methods: {
  196. // 自定义上传
  197. customUpload(options) {
  198. const formData = new FormData();
  199. for (const file of this.$refs.upload.uploadFiles) {
  200. formData.append('files', file.raw);
  201. }
  202. formData.append('fileManagement', this.upload.formData.fileManagement);
  203. // 上传文件
  204. uploadFilesTenant(formData).then(response => {
  205. options.onSuccess(response.data, options.file);
  206. }).catch(error => {
  207. options.onError(error);
  208. });
  209. },
  210. handleSuccess(response, file, fileList) {
  211. console.log('上传成功', response);
  212. },
  213. handleError(err, file, fileList) {
  214. console.log('上传失败', err);
  215. },
  216. beforeUpload(file) {
  217. console.log('上传文件之前', file);
  218. return true; // 返回false会取消上传
  219. },
  220. submitUpload() {
  221. this.upload.formData.fileManagement = JSON.stringify({fileType: this.filetype});
  222. // 手动触发上传
  223. this.$refs.upload.submit();
  224. },
  225. initData() {
  226. //任务统计
  227. getTask().then((response) => {
  228. if (response.code == 200) {
  229. this.processList = response.data;
  230. // console.log(this.processList);
  231. this.chartObj.myChart1.setOption({
  232. series: [
  233. {
  234. data: response.data,
  235. },
  236. ],
  237. });
  238. } else {
  239. console.log(response);
  240. this.$message.error("获取数据失败");
  241. }
  242. });
  243. //管道统计
  244. getPipeline().then((response) => {
  245. if (response.code == 200) {
  246. // console.log(response.data);
  247. // console.log(response.data[0].date);
  248. let xAxisData = response.data[0].date;
  249. xAxisData = xAxisData.map(function (dateStr) {
  250. var date = new Date(dateStr);
  251. return date.getMonth() + 1 + "月" + date.getDate() + "日";
  252. });
  253. let loginList = response.data.map((item) => item.name);
  254. this.chartObj.myChart2.setOption({
  255. legend: {
  256. data: loginList,
  257. },
  258. xAxis: {
  259. data: xAxisData,
  260. },
  261. series: response.data,
  262. });
  263. } else {
  264. console.log(response);
  265. this.$message.error("获取数据失败");
  266. }
  267. });
  268. //操作日志
  269. getOperation().then((response) => {
  270. if (response.code == 200) {
  271. this.swiperList = response.data;
  272. this.$nextTick(() => {
  273. var swiper = new Swiper(".swiper-container", {
  274. direction: "vertical",
  275. loop: true,
  276. autoplay: {
  277. delay: 1000,
  278. disableOnInteraction: false,
  279. },
  280. scrollbar: {
  281. el: ".swiper-scrollbar",
  282. },
  283. slidesPerView: 3,
  284. freeMode: true,
  285. // spaceBetween: 1,
  286. });
  287. });
  288. } else {
  289. console.log(response);
  290. this.$message.error("获取数据失败");
  291. }
  292. });
  293. //原材料统计
  294. getMaterial().then((response) => {
  295. if (response.code == 200) {
  296. // console.log(response.data);
  297. let tabularList = response.data;
  298. // tabularList.push({ name: "多表数量", value: 30 });
  299. let labelList = response.data.map((item) => item.name);
  300. this.chartObj.myChart3.setOption({
  301. yAxis: {
  302. data: labelList,
  303. },
  304. series: [
  305. {
  306. data: response.data,
  307. },
  308. ],
  309. });
  310. } else {
  311. console.log(response);
  312. this.$message.error("获取数据失败");
  313. }
  314. });
  315. //用户登录统计
  316. getLogin().then((response) => {
  317. if (response.code == 200) {
  318. let modelData = response.data;
  319. // console.log(modelData);
  320. this.chartObj.myChart4?.setOption({
  321. series: [
  322. {
  323. data: [modelData],
  324. },
  325. ],
  326. });
  327. } else {
  328. console.log(response);
  329. this.$message.error("获取数据失败");
  330. }
  331. });
  332. },
  333. initChart1() {
  334. this.chartObj.myChart1 = this.$echarts.init(this.$refs.pieChart);
  335. let option = {
  336. color: ["#9370db", "#ffd700", "#00ccff", "#ff6600", "#ff9900"],
  337. title: {
  338. text: "任务统计",
  339. left: "left",
  340. textStyle: {
  341. fontSize: 16,
  342. fontWeight: "normal",
  343. color: "#696969",
  344. },
  345. },
  346. tooltip: {
  347. trigger: "item",
  348. },
  349. legend: {
  350. left: "60%",
  351. top: "60%",
  352. },
  353. series: [
  354. {
  355. // name: 'Access From',
  356. type: "pie",
  357. radius: ["40%", "100%"],
  358. avoidLabelOverlap: false,
  359. itemStyle: {
  360. // borderRadius: 10,
  361. borderColor: "#fff",
  362. borderWidth: 2,
  363. },
  364. right: "40%",
  365. top: "50%",
  366. data: [
  367. {value: 10, name: "工艺流"},
  368. {value: 20, name: "审批流"},
  369. ],
  370. label: {
  371. show: false,
  372. position: "center",
  373. },
  374. labelLine: {
  375. show: false,
  376. },
  377. emphasis: {
  378. label: {
  379. show: true,
  380. fontSize: 20,
  381. fontWeight: "bold",
  382. },
  383. },
  384. },
  385. ],
  386. };
  387. this.chartObj.myChart1.setOption(option);
  388. },
  389. initChart2() {
  390. this.chartObj.myChart2 = this.$echarts.init(this.$refs.lineChart);
  391. let option = {
  392. color: ["#FF88E0", "#9FE080"],
  393. title: {
  394. text: "管道统计",
  395. textStyle: {
  396. fontSize: 16,
  397. fontWeight: "normal",
  398. color: "#696969",
  399. },
  400. },
  401. tooltip: {
  402. trigger: "axis",
  403. },
  404. legend: {
  405. data: ["在产生产任务", "完成数量"],
  406. },
  407. grid: {
  408. left: "3%",
  409. right: "4%",
  410. top: "20%",
  411. bottom: "0%",
  412. containLabel: true,
  413. },
  414. xAxis: {
  415. type: "category",
  416. boundaryGap: false,
  417. data: [
  418. "01\nMon",
  419. "02\nTue",
  420. "03\nWed",
  421. "04\nThu",
  422. "05\nFri",
  423. "06\nSat",
  424. "07\nSun",
  425. "08\nMon",
  426. "09\nTue",
  427. "10\nWed",
  428. "11\nThu",
  429. "12\nFri",
  430. "13\nSat",
  431. "14\nSun",
  432. "15\nMon",
  433. "16\nTue",
  434. "17\nWed",
  435. "18\nThu",
  436. "19\nFri",
  437. "20\nSat",
  438. "21\nSun",
  439. "22\nMon",
  440. "23\nTue",
  441. "24\nWed",
  442. "25\nThu",
  443. "26\nFri",
  444. "27\nSat",
  445. "28\nSun",
  446. "29\nMon",
  447. "30\nTue",
  448. ],
  449. },
  450. yAxis: {
  451. type: "value",
  452. },
  453. series: [
  454. {
  455. name: "客户端",
  456. type: "line",
  457. smooth: true,
  458. data: [
  459. 10, 23, 42, 13, 30, 25, 40, 30, 42, 55, 40, 28, 20, 30, 45, 25,
  460. 20, 30, 40, 33, 35, 40, 46, 31, 13, 34, 20, 10, 36, 43,
  461. ],
  462. },
  463. {
  464. name: "工具端",
  465. type: "line",
  466. smooth: true,
  467. data: [
  468. 20, 30, 29, 40, 55, 33, 30, 26, 36, 45, 50, 34, 38, 25, 28, 43,
  469. 16, 30, 45, 52, 40, 46, 33, 57, 50, 33, 40, 59, 56, 56,
  470. ],
  471. },
  472. ],
  473. };
  474. this.chartObj.myChart2.setOption(option);
  475. },
  476. initChart3() {
  477. this.chartObj.myChart3 = this.$echarts.init(this.$refs.gaugeChart);
  478. let option = {
  479. color: ["#00ccff", "#ff6600", "#ff9900", "#9370db", "#ffd700"],
  480. title: {
  481. text: "原材料统计",
  482. left: "left",
  483. textStyle: {
  484. fontSize: 16,
  485. fontWeight: "normal",
  486. color: "#696969",
  487. },
  488. },
  489. tooltip: {
  490. trigger: "axis",
  491. axisPointer: {
  492. type: "shadow",
  493. },
  494. },
  495. grid: {
  496. left: "0%",
  497. right: "3%",
  498. top: "20%",
  499. bottom: "0%",
  500. containLabel: true,
  501. },
  502. xAxis: {
  503. type: "value",
  504. nameLocation: "middle",
  505. nameTextStyle: {
  506. align: "center",
  507. },
  508. splitLine: {
  509. show: false,
  510. },
  511. },
  512. yAxis: {
  513. type: "category",
  514. data: ["总数", "入库数量", "出库数量"],
  515. inverse: true, // 使类目从右向左排列
  516. },
  517. series: [
  518. {
  519. type: "bar",
  520. barWidth: "18",
  521. orientation: "horizontal",
  522. data: [
  523. {value: 88, name: "表单"},
  524. {value: 66, name: "表格"},
  525. {value: 33, name: "三级联动"},
  526. ],
  527. showBackground: true,
  528. backgroundStyle: {
  529. color: "#F0F8FF",
  530. },
  531. },
  532. ],
  533. };
  534. this.chartObj.myChart3.setOption(option);
  535. },
  536. initChart4() {
  537. this.chartObj.myChart4 = this.$echarts.init(this.$refs.barChart);
  538. let option = {
  539. color: ["#5D84FE"],
  540. title: {
  541. text: "用户登录统计",
  542. textStyle: {
  543. fontSize: 16,
  544. fontWeight: "normal",
  545. color: "#696969",
  546. },
  547. },
  548. tooltip: {
  549. trigger: "axis",
  550. axisPointer: {
  551. type: "shadow",
  552. },
  553. },
  554. xAxis: {
  555. type: "category",
  556. data: [
  557. "1月",
  558. "2月",
  559. "3月",
  560. "4月",
  561. "5月",
  562. "6月",
  563. "7月",
  564. "8月",
  565. "9月",
  566. "10月",
  567. "11月",
  568. "12月",
  569. ],
  570. },
  571. yAxis: {
  572. type: "value",
  573. min: 0,
  574. max: 100,
  575. interval: 20,
  576. splitLine: {
  577. show: false, // 关闭y轴的水平分割线
  578. },
  579. },
  580. grid: {
  581. left: "5%",
  582. right: "5%",
  583. top: "30%",
  584. bottom: "0%",
  585. containLabel: true,
  586. },
  587. series: [
  588. {
  589. data: [0],
  590. type: "bar",
  591. barWidth: "30", // 设置柱体宽度
  592. showBackground: true,
  593. backgroundStyle: {
  594. color: "#E8EFFF",
  595. },
  596. },
  597. ],
  598. };
  599. this.chartObj.myChart4.setOption(option);
  600. },
  601. /** 导入按钮操作 */
  602. handleImport() {
  603. this.upload.title = "用户导入";
  604. this.upload.open = true;
  605. },
  606. /** 下载模板操作 */
  607. importTemplate() {
  608. this.download(
  609. "system/user/importTemplate",
  610. {},
  611. `user_template_${new Date().getTime()}.xlsx`
  612. );
  613. },
  614. // 文件上传中处理
  615. handleFileUploadProgress(event, file, fileList) {
  616. this.upload.isUploading = true;
  617. },
  618. // 文件上传成功处理
  619. handleFileSuccess(response, file, fileList) {
  620. this.upload.open = false;
  621. this.upload.isUploading = false;
  622. this.$refs.upload.clearFiles();
  623. this.$alert(
  624. "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
  625. response.msg +
  626. "</div>",
  627. "导入结果",
  628. {dangerouslyUseHTMLString: true}
  629. );
  630. this.getList();
  631. },
  632. // 提交上传文件
  633. submitFileForm() {
  634. console.log(this.$refs.upload);
  635. let {uploadFiles, action, data} = this.$refs.upload
  636. console.log("uploadFiles", uploadFiles)
  637. console.log("action", action)
  638. console.log("data", data)
  639. data = {}
  640. uploadFiles.map(file => {
  641. data[file.name.split(".")[0]] = true
  642. });
  643. data.WechatIMG379 = false;
  644. this.uploadFiles({
  645. uploadFiles,
  646. data,
  647. action,
  648. success: (response) => {
  649. console.log(response)
  650. // 上传成功后,将里面的内容删除
  651. this.$refs.uploadFile.clearFiles();
  652. this.$refs.uploadPicture.clearFiles();
  653. },
  654. error: (error) => {
  655. console.log('失败了', error)
  656. }
  657. })
  658. // this.$refs.upload.submit();
  659. },
  660. uploadFiles({uploadFiles, headers, data, action, success, error}) {
  661. let form = new FormData();
  662. uploadFiles.map(file => form.append("files", file.raw))
  663. for (let key in data) {
  664. form.append(key, data[key])
  665. }
  666. let xhr = new XMLHttpRequest()
  667. xhr.open("post", action, true)
  668. xhr.setRequestHeader("Authorization", getToken());
  669. xhr.onreadystatechange = function () {
  670. if (xhr.readyState == 4) {
  671. if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304) {
  672. success && success(xhr.responseText)
  673. } else {
  674. error && error(xhr.status)
  675. }
  676. }
  677. }
  678. xhr.send(form)
  679. // let fileVoList = [];
  680. // let form = new FormData();
  681. //
  682. // // 文件对象
  683. // uploadFiles.map(file => {
  684. // let fileVo = {
  685. // "file": file.raw,
  686. // "isBase64": false
  687. // }
  688. // fileVoList.push(fileVo);
  689. // })
  690. //
  691. // 附件参数
  692. // for (let key in data) {
  693. // form.append(key, data[key])
  694. // }
  695. // let xhr = new XMLHttpRequest()
  696. // // 异步请求
  697. // xhr.open("post", action, true)
  698. // // 设置请求头
  699. // xhr.setRequestHeader("Authorization", getToken());
  700. // xhr.onreadystatechange = function () {
  701. // if (xhr.readyState == 4) {
  702. // if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304) {
  703. // success && success(xhr.responseText)
  704. // } else {
  705. // error && error(xhr.status)
  706. // }
  707. // }
  708. // }
  709. // console.log("form内容:", fileVoList)
  710. // xhr.send({
  711. // "fileVoList": fileVoList
  712. // })
  713. },
  714. goTarget(href) {
  715. window.open(href, "_blank");
  716. },
  717. toPersonalCenter() {
  718. this.$router.push("/user/profile");
  719. },
  720. },
  721. computed: {
  722. ...mapState({
  723. username: (state) => state.user.name,
  724. owner: (state) => state.user?.tenant.owner,
  725. tenantName: (state) => state.user?.tenant.tenantName,
  726. nickName: (state) => state.user?.nickName,
  727. }),
  728. ...mapGetters(["avatar"]),
  729. date: () => {
  730. return formatDate(new Date());
  731. },
  732. },
  733. };
  734. </script>
  735. <style lang="scss" scoped>
  736. .home {
  737. position: relative;
  738. width: 100%;
  739. /* height: 500px; */
  740. background-color: #eff2f7;
  741. .info-content {
  742. width: 100%;
  743. height: 100%;
  744. display: flex;
  745. flex-direction: row;
  746. flex-wrap: wrap;
  747. .echarts1 {
  748. position: relative;
  749. width: 20%;
  750. height: 280px;
  751. margin: auto;
  752. padding: 20px 15px;
  753. box-shadow: 10px 10px 5px #e0e0e0;
  754. background-color: #fff;
  755. border-radius: 10px;
  756. .pieChart {
  757. width: 100%;
  758. height: 100%;
  759. }
  760. .describe1 {
  761. .text {
  762. position: absolute;
  763. left: 50px;
  764. top: 90px;
  765. }
  766. .num {
  767. position: absolute;
  768. font-size: 20px;
  769. color: black;
  770. left: 63px;
  771. top: 55px;
  772. }
  773. }
  774. .describe2 {
  775. .text {
  776. position: absolute;
  777. left: 157px;
  778. top: 90px;
  779. }
  780. .num {
  781. position: absolute;
  782. font-size: 20px;
  783. color: black;
  784. left: 170px;
  785. top: 55px;
  786. }
  787. }
  788. }
  789. .echarts2 {
  790. width: 76%;
  791. height: 280px;
  792. margin: auto;
  793. padding: 20px 15px;
  794. box-shadow: 10px 10px 5px #e0e0e0;
  795. background-color: #fff;
  796. border-radius: 10px;
  797. margin-right: 30px;
  798. .lineChart {
  799. width: 100%;
  800. height: 100%;
  801. }
  802. }
  803. .echarts3 {
  804. width: 23%;
  805. height: 200px;
  806. margin: auto;
  807. padding: 20px 15px;
  808. box-shadow: 10px 10px 5px #e0e0e0;
  809. background-color: #fff;
  810. border-radius: 10px;
  811. margin-top: 20px;
  812. p {
  813. margin: 0;
  814. }
  815. .title {
  816. font-size: 16px;
  817. color: "#696969";
  818. }
  819. .text {
  820. display: flex;
  821. flex-direction: row;
  822. margin-top: 10px;
  823. .peo {
  824. font-size: 14px;
  825. color: black;
  826. font-weight: bold;
  827. margin-left: 20px;
  828. margin-right: 120px;
  829. }
  830. .add {
  831. font-size: 14px;
  832. color: black;
  833. font-weight: bold;
  834. }
  835. }
  836. .swiper-container {
  837. display: flex;
  838. flex-direction: row;
  839. flex-wrap: wrap;
  840. width: 90%;
  841. height: 80px;
  842. /* overflow: auto; */
  843. margin-top: 10px;
  844. .name {
  845. text-align: center;
  846. font-size: 16px;
  847. margin-left: 2px;
  848. margin-right: 59px;
  849. }
  850. .ip {
  851. text-align: center;
  852. font-size: 16px;
  853. }
  854. }
  855. }
  856. .echarts4 {
  857. width: 20%;
  858. height: 200px;
  859. margin: auto;
  860. padding: 20px 15px;
  861. box-shadow: 10px 10px 5px #e0e0e0;
  862. background-color: #fff;
  863. border-radius: 10px;
  864. margin-top: 20px;
  865. .gaugeChart {
  866. width: 100%;
  867. height: 100%;
  868. }
  869. }
  870. .echarts5 {
  871. width: 53%;
  872. height: 200px;
  873. margin: auto;
  874. padding: 20px 15px;
  875. box-shadow: 10px 10px 5px #e0e0e0;
  876. background-color: #fff;
  877. border-radius: 10px;
  878. margin-top: 20px;
  879. margin-right: 30px;
  880. .barChart {
  881. width: 100%;
  882. height: 100%;
  883. }
  884. }
  885. /* .header {
  886. white-space: nowrap;
  887. margin-bottom: 5px;
  888. cursor: pointer;
  889. .user-avatar {
  890. width: 160px;
  891. border-radius: 50%;
  892. }
  893. } */
  894. .name {
  895. font-size: 30px;
  896. margin-bottom: 5px;
  897. }
  898. .tenant-name {
  899. font-size: 20px;
  900. }
  901. .date {
  902. margin-bottom: 10px;
  903. }
  904. .title {
  905. font-size: 16px;
  906. }
  907. }
  908. }
  909. .home {
  910. blockquote {
  911. padding: 10px 20px;
  912. margin: 0 0 20px;
  913. font-size: 17.5px;
  914. /* border-left: 5px solid #eee; */
  915. }
  916. hr {
  917. margin-top: 20px;
  918. margin-bottom: 20px;
  919. border: 0;
  920. border-top: 1px solid #eee;
  921. }
  922. .col-item {
  923. margin-bottom: 20px;
  924. }
  925. ul {
  926. padding: 0;
  927. margin: 0;
  928. }
  929. font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  930. font-size: 13px;
  931. color: #676a6c;
  932. overflow-x: hidden;
  933. ul {
  934. list-style-type: none;
  935. }
  936. h4 {
  937. margin-top: 0px;
  938. }
  939. h2 {
  940. margin-top: 10px;
  941. font-size: 26px;
  942. font-weight: 100;
  943. }
  944. p {
  945. margin-top: 10px;
  946. b {
  947. font-weight: 700;
  948. }
  949. }
  950. .update-log {
  951. ol {
  952. display: block;
  953. list-style-type: decimal;
  954. margin-block-start: 1em;
  955. margin-block-end: 1em;
  956. margin-inline-start: 0;
  957. margin-inline-end: 0;
  958. padding-inline-start: 40px;
  959. }
  960. }
  961. }
  962. </style>