showOld.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>派单统计面板</title>
  6. <link rel="stylesheet" href="/static/elementui2.15.5/index.css"/>
  7. <script src="/static/hplus/js/jquery.min.js?v=2.1.4"></script>
  8. <script src="/static/layer3.2.0/layer.js"></script>
  9. <script src="/static/elementui2.15.5/vue-2.6.14.js"></script>
  10. <script src="/static/elementui2.15.5/index.js"></script>
  11. <script src="/static/echarts.js"></script>
  12. <style>
  13. body { background:#f3f3f4; font-family:"Microsoft YaHei",sans-serif; margin:20px;}
  14. .container { display:flex; gap:15px;}
  15. .panel{
  16. padding: 20px;
  17. background:#fff;
  18. border-radius: 10px;
  19. }
  20. .card-group { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:15px; }
  21. .stat-card {
  22. flex:1 1 100px;
  23. padding:12px;
  24. border-radius: 8px;
  25. color:#333333FF;
  26. background-repeat: no-repeat;
  27. background-size: cover;
  28. background-position: center;
  29. width: 100%;
  30. height: 50px;
  31. cursor: pointer;
  32. }
  33. .white{
  34. color: #ffffff;
  35. }
  36. .stat-card h3 { margin:0;font-size:16px; }
  37. .stat-card p { margin:5px 0 0;font-size:20px; font-weight: bold}
  38. .el-table{
  39. width: 100%;
  40. }
  41. .el-table th, .el-table td { text-align:center;color: #333333FF }
  42. .status-dispatch { color:#7000FBFF; font-weight:600; } /* 紫色 */
  43. .status-pending { color:#fa8c16; font-weight:600; } /* 橙色 */
  44. .status-inprogress { color:#7000FBFF; font-weight:600; } /* 蓝色 */
  45. .status-fail { color: #da0727; font-weight:600; } /* 蓝色 */
  46. .video-container {
  47. width: 100%;
  48. height: 280px;
  49. background: #fff;
  50. border-radius: 8px;
  51. display: flex;
  52. justify-content: center;
  53. align-items: center;
  54. margin-top: 10px;
  55. }
  56. .video-container video {
  57. width: 100%;
  58. height: 100%;
  59. display: block;
  60. }
  61. .loading-ico{
  62. margin-top: 4px;
  63. position: absolute;
  64. margin-left: -25px;
  65. animation: rotate 3s linear infinite;
  66. }
  67. .page{
  68. margin-top:15px;
  69. margin-bottom:15px;
  70. text-align: center;
  71. }
  72. @keyframes rotate {
  73. from{transform: rotate(0deg)}
  74. to{transform: rotate(360deg)}
  75. }
  76. </style>
  77. </head>
  78. <body>
  79. <div id="app" >
  80. <el-row :gutter="40" type="flex" ref="mainContent" style="margin-right: 25px">
  81. <!-- 左侧 已派单面板 -->
  82. <el-col :span="12" class="panel">
  83. <div v-loading="loading3" class="card-group" >
  84. <div class="stat-card white" style='background-image: url("/static/ai/img/done.png")' @click="handleModeChange(0)">
  85. <h3>AI派单总数</h3><p>{{done.total}}</p>
  86. </div>
  87. <div class="stat-card" style='background-image: url("/static/ai/img/bj.png")' @click="handleModeChange(2)">
  88. <h3>保洁派单数</h3><p style="color: #0983E2FF">{{done.bj}}</p>
  89. </div>
  90. <div class="stat-card" style='background-image: url("/static/ai/img/bx.png")' @click="handleModeChange(1)">
  91. <h3>维修派单数</h3><p style="color: #00905DFF">{{done.bx}}</p>
  92. </div>
  93. <div class="stat-card" style='background-image: url("/static/ai/img/ys.png")' @click="handleModeChange(3)">
  94. <h3>运送工单数</h3><p style="color: #E68417FF">{{done.ys}}</p>
  95. </div>
  96. <div class="stat-card" style='background-image: url("/static/ai/img/ab.png")' @click="handleModeChange(4)">
  97. <h3>安保待派单数</h3><p style="color: #8943DDFF">{{done.ab}}</p>
  98. </div>
  99. </div>
  100. <div v-loading="loading3" id="chart" style="height:200px;"></div>
  101. <div style="margin-top: 40px;display: flex">
  102. <img src="/ai/img/triangle-right.png" style="width: 10px;height: 10px">
  103. <h4 style="margin-top: -7px;margin-left: 10px">今日已派单看板</h4>
  104. </div>
  105. <el-table v-loading="loading"
  106. ref="dispatchedTable"
  107. :data="dispatchedList"
  108. style="width:100%;">
  109. <el-table-column prop="sn" label="编号">
  110. <template slot-scope="scope">
  111. <a href="javascript:;"
  112. data-title="详情"
  113. @click="layerOpen(scope.row.id)"
  114. data-title="详情"
  115. style="color:#0056DBFF;text-decoration: none">
  116. {{ scope.row.sn }}
  117. </a>
  118. </template>
  119. </el-table-column>
  120. <el-table-column prop="type" label="类型"></el-table-column>
  121. <el-table-column prop="status" label="状态">
  122. <template slot-scope="scope">
  123. <span class="status-dispatch">已派单</span>
  124. </template>
  125. </el-table-column>
  126. <el-table-column prop="user" label="发起人"></el-table-column>
  127. <el-table-column prop="create_time" label="派单时间"></el-table-column>
  128. <el-table-column prop="toUser" label="指派员工"></el-table-column>
  129. <el-table-column label="操作">
  130. <template slot-scope="scope">
  131. <a href="javascript:;"
  132. data-title="重新派单"
  133. @click="send(scope.row.todo_id,scope.row.mode,0)"
  134. style="color:#0056DBFF;text-decoration: none">
  135. 重新派单
  136. </a>
  137. </template>
  138. </el-table-column>
  139. </el-table>
  140. <!-- 分页 -->
  141. <div class="page">
  142. <el-pagination
  143. background
  144. layout="prev, pager, next, sizes, total"
  145. :total="total"
  146. :page-size="pageSize"
  147. :current-page.sync="currentPage"
  148. @size-change="handleSizeChange"
  149. @current-change="handlePageChange">
  150. </el-pagination>
  151. </div>
  152. </el-col>
  153. <!-- 右侧 待派单面板 -->
  154. <el-col :span="12" class="panel" style="margin-left: 10px">
  155. <div v-loading="loading3" class="card-group">
  156. <div class="stat-card white" style='background-image: url("/static/ai/img/undo.png")' @click="handleModeChange2(0)">
  157. <h3>待派单总数</h3><p>{{undo.total}}</p>
  158. </div>
  159. <div class="stat-card" style='background-image: url("/static/ai/img/bj.png")' @click="handleModeChange2(2)">
  160. <h3>保洁待派单数</h3><p style="color: #0983E2FF">{{undo.bj}}</p>
  161. </div>
  162. <div class="stat-card" style='background-image: url("/static/ai/img/bx.png")' @click="handleModeChange2(1)">
  163. <h3>维修待派单数</h3><p style="color: #00905DFF">{{undo.bx}}</p>
  164. </div>
  165. <div class="stat-card" style='background-image: url("/static/ai/img/ys.png")' @click="handleModeChange2(3)">
  166. <h3>运送待派单数</h3><p style="color: #E68417FF">{{undo.ys}}</p>
  167. </div>
  168. <div class="stat-card" style='background-image: url("/static/ai/img/ab.png")' @click="handleModeChange2(4)">
  169. <h3>安保待派单数</h3><p style="color: #8943DDFF">{{undo.ab}}</p>
  170. </div>
  171. <div class="stat-card" @click="handleModeChange2(-1)">
  172. <h3>异常单数</h3><p style="color: #8943DDFF">{{undo.fail}}</p>
  173. </div>
  174. </div>
  175. <div class="video-container">
  176. <video
  177. class="video"
  178. src="/ai/img/ai2.mp4"
  179. autoplay
  180. loop
  181. muted
  182. playsinline
  183. webkit-playsinline
  184. x5-playsinline
  185. disablePictureInPicture
  186. >
  187. 您的浏览器不支持视频播放
  188. </video>
  189. </div>
  190. <el-table v-loading="loading2" ref="pendingTable" :data="pendingList" style="width:100%;">
  191. <el-table-column prop="sn" label="编号">
  192. <template slot-scope="scope">
  193. <a href="javascript:;"
  194. @click="layerOpen(scope.row.id)"
  195. style="color:#0056DBFF;text-decoration: none">
  196. {{ scope.row.sn }}
  197. </a>
  198. </template>
  199. </el-table-column>
  200. <el-table-column prop="type" label="类型"></el-table-column>
  201. <el-table-column prop="user" label="发起人"></el-table-column>
  202. <el-table-column prop="status" label="状态">
  203. <template slot-scope="scope">
  204. <div v-if="fail == 0">
  205. <img v-if="scope.row.flag" src="/static/ai/img/wait.png" class="loading-ico">
  206. <span :class="scope.row.flag ? 'status-inprogress':'status-pending'">{{ scope.row.flag && ai == 1 ? 'Ai派单中...':'待派单' }}</span>
  207. </div>
  208. <div v-else>
  209. <span class="status-fail">派单未匹配</span>
  210. </div>
  211. </template>
  212. </el-table-column>
  213. <el-table-column v-if="fail" prop="fail" label="操作">
  214. <template slot-scope="scope">
  215. <a href="javascript:;"
  216. data-title="手动派单"
  217. @click="send(scope.row.id,scope.row.work_type_mode,1)"
  218. style="color:#0056DBFF;text-decoration: none">
  219. 手动派单
  220. </a>
  221. </template>
  222. </el-table-column>
  223. </el-table>
  224. <!-- 分页 -->
  225. <div class="page">
  226. <el-pagination
  227. background
  228. layout="prev, pager, next, sizes, total"
  229. :total="total2"
  230. :page-size="pageSize2"
  231. :current-page.sync="currentPage2"
  232. @size-change="handleSizeChange2"
  233. @current-change="handlePageChange2">
  234. </el-pagination>
  235. </div>
  236. </el-col>
  237. </el-row>
  238. </div>
  239. <script>
  240. new Vue({
  241. el:'#app',
  242. data: function() {
  243. return {
  244. ai:{$ai},
  245. aiList:[0,0,0,0,0,0,0],
  246. userList:[0,0,0,0,0,0,0],
  247. done: {'total':0,'bx':0, 'bj': 0, 'ys' : 0, 'ab' : 0,},
  248. undo: {'total':0,'bx':0, 'bj': 0, 'ys' : 0, 'ab' : 0,},
  249. dateList:[],
  250. currentPage: 1,
  251. pageSize: 10,
  252. total: 0,
  253. mode: 0,
  254. dispatchedList:[],
  255. currentPage2: 1,
  256. pageSize2: 10,
  257. total2: 0,
  258. mode2: 0,
  259. pendingList:[],
  260. loading:true,
  261. loading2:true,
  262. loading3:true,
  263. fail:0,
  264. }
  265. },
  266. mounted(){
  267. this.getData();
  268. setInterval(() => {
  269. this.getData();
  270. }, 1000 * 60);
  271. },
  272. methods: {
  273. getData(){
  274. this.fetchEchart();
  275. this.fetchTodo();
  276. this.fetchOrder();
  277. },
  278. layerOpen(id){
  279. layer.open({
  280. type: 2,
  281. title: "详情",
  282. shadeClose: true,
  283. shade: 0.3,
  284. maxmin: true,
  285. area: ['80%', '80%'],
  286. content: "{:url('orders/detail2',[],'')}/id/"+id,
  287. end: function () {
  288. // window.location.reload();
  289. }
  290. });
  291. },
  292. send(id,mode,type){
  293. const self = this;
  294. layer.open({
  295. type: 2,
  296. title: "派单",
  297. shadeClose: true,
  298. shade: 0.3,
  299. maxmin: true,
  300. area: ['80%', '80%'],
  301. content: "{:url('send',[],'')}/id/"+id+"/mode/"+mode+"/type/"+type,
  302. end: function () {
  303. if (type === 0){
  304. self.fetchTodo();
  305. }else{
  306. self.fetchOrder();
  307. }
  308. }
  309. });
  310. },
  311. fetchEchart() {
  312. const url = "{:url('show')}";
  313. $.ajax({
  314. url: url,
  315. type: 'POST',
  316. dataType: 'json',
  317. success: (res) => { // 使用箭头函数
  318. this.aiList = res.ai;
  319. console.log(this.aiList);
  320. this.userList = res.user;
  321. this.date = res.date;
  322. this.done = res.done;
  323. this.undo = res.undo;
  324. this.initEchart();
  325. },
  326. error: function(xhr, status, error) {
  327. console.error('请求失败:', error);
  328. }
  329. });
  330. },
  331. fetchTodo() {
  332. const url = "{:url('todoList')}";
  333. $.ajax({
  334. url: url,
  335. type: 'POST',
  336. dataType: 'json',
  337. data:{
  338. page:this.currentPage,
  339. size:this.pageSize,
  340. mode:this.mode
  341. },
  342. success: (res) => { // 使用箭头函数
  343. this.dispatchedList = res.data;
  344. this.total = res.total;
  345. this.loading = false;
  346. },
  347. error: function(xhr, status, error) {
  348. console.error('请求失败:', error);
  349. }
  350. });
  351. },
  352. handlePageChange(page) {
  353. this.currentPage = page;
  354. this.loading = true;
  355. this.fetchTodo();
  356. },
  357. handleSizeChange(val) {
  358. this.pageSize = val;
  359. this.loading = true;
  360. this.fetchTodo();
  361. },
  362. handleModeChange(val) {
  363. layer.open({
  364. type: 2,
  365. title: "历史派单",
  366. shadeClose: true,
  367. shade: 0.3,
  368. maxmin: true,
  369. area: ['90%', '90%'],
  370. content: "{:url('history',[],'')}/mode/"+val,
  371. end: function () {
  372. // window.location.reload();
  373. }
  374. });
  375. },
  376. fetchOrder() {
  377. const url = "{:url('orderList')}";
  378. $.ajax({
  379. url: url,
  380. type: 'POST',
  381. dataType: 'json',
  382. data:{
  383. page:this.currentPage2,
  384. size:this.pageSize2,
  385. mode:this.mode2,
  386. },
  387. success: (res) => { // 使用箭头函数
  388. this.pendingList = res.data;
  389. this.total2 = res.total;
  390. this.loading2 = false;
  391. this.fail = res.fail;
  392. },
  393. error: function(xhr, status, error) {
  394. console.error('请求失败:', error);
  395. }
  396. });
  397. },
  398. handlePageChange2(page) {
  399. this.currentPage2 = page;
  400. this.loading2 = true;
  401. this.fetchOrder();
  402. },
  403. handleSizeChange2(val) {
  404. this.pageSize2 = val;
  405. this.loading2 = true;
  406. this.fetchOrder();
  407. },
  408. handleModeChange2(val) {
  409. this.mode2 = val;
  410. this.loading2 = true;
  411. this.fetchOrder();
  412. },
  413. initEchart() {
  414. // 左侧折线图
  415. var chart = echarts.init(document.getElementById('chart'));
  416. window.addEventListener('resize', () => {
  417. this.$nextTick(() => {
  418. // 给主内容容器强制触发重绘
  419. const main = this.$refs.mainContent; // 主面板容器
  420. main.style.width = main.offsetWidth + 'px';
  421. // 延迟刷新表格
  422. setTimeout(() => {
  423. this.$refs.dispatchedTable.doLayout();
  424. this.$refs.pendingTable.doLayout();
  425. chart.resize();
  426. }, 50);
  427. });
  428. });
  429. var option = {
  430. backgroundColor: '#F6FAFFFF',
  431. tooltip:{trigger:'axis'},
  432. legend:{data:['AI派单','人工派单']},
  433. xAxis:{type:'category', splitLine: {show: false}, data:this.date},
  434. yAxis:{type:'value',splitLine: {show: false},name:'派单趋势分析'} ,
  435. series:[
  436. { name:'AI派单', type:'line',symbolSize: 10, data:this.aiList, smooth:false , itemStyle:{color:'#7000FBFF'}, areaStyle:{color: {
  437. type: 'linear',
  438. x: 0, y: 0,
  439. x2: 0, y2: 1, // 从左到右
  440. colorStops: [
  441. { offset: 0, color: '#eee0ffFF' },
  442. { offset: 1, color: '#7000fb03' }
  443. ]
  444. }}},
  445. { name:'人工派单', type:'line',symbolSize: 10, data:this.userList, smooth:false, itemStyle:{color:'#0062FBFF'},areaStyle: {
  446. color: {
  447. type: 'linear',
  448. x: 0, y: 0,
  449. x2: 0, y2: 1, // 从左到右
  450. colorStops: [
  451. { offset: 0, color: '#a9cbffFF' },
  452. { offset: 1, color: '#ffffff03' }
  453. ]
  454. }
  455. }}
  456. ]
  457. };
  458. chart.setOption(option);
  459. this.loading3 = false;
  460. }
  461. },
  462. });
  463. </script>
  464. </body>
  465. </html>