detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. <template>
  2. <div class="airportInfo">
  3. <div class="variable">
  4. <StatisticsHeader :title="titleTop" :items="formItems" :data="formData" :eledata="eledata" with-setting :withSetting="false" :withExport="true" :set="set" :action="action" :asShow="asShow" @getFormData="getFormData" @export="tableToExcel('table')" @upset="upset" @fore="fore"/>
  5. </div>
  6. <div v-loading="loading" element-loading-text="数据加载中..." class="echart">
  7. <!-- <Echarts :id="dataid" :option="tableData" v-if="picShow == true ? true : false" /> -->
  8. <Tableformbrs ref="table" :tableList="tableNewList" :action="action" :set="set" />
  9. </div>
  10. <div v-if="total > 0" class="pagination">
  11. <el-pagination background layout="prev, pager, next" @current-change="currentChange" :total="total" />
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. import Echarts from "../../components/echart/index.vue";
  17. import Tableformbrs from "../../components/echart/tableforms.vue";
  18. import StatisticsHeader from "../../components/echart/statisticsHeader.vue";
  19. import { export_json_to_excel, exportToExcel } from "@/utils/Export2Excel";
  20. import { Query } from "@/api/webApi";
  21. import _ from 'lodash'
  22. export default {
  23. name: "ChartsBar",
  24. data () {
  25. return {
  26. loading: false,
  27. asShow: false,
  28. optiondata: [],
  29. picShow: true, //图片表格切换
  30. action: 19,
  31. dataid: "collection_ecahrt1",
  32. listqueryTemplateID: DATACONTENT_ID.modeFlightvolume,
  33. eledata: 1,
  34. set: "",
  35. isShow: Echarts,
  36. tableList: [],
  37. tableListcop: [],
  38. tableNewList: [],
  39. listname: "",
  40. listHeader: [],
  41. total: 0,
  42. tableData: {
  43. time: [],
  44. data1: [],
  45. data2: [],
  46. kg: "",
  47. tyol: "",
  48. },
  49. formData: {
  50. fttp: "",
  51. flighttype: "",
  52. dateTime: "",
  53. },
  54. titleTop: "节点明细统计",
  55. levelList: [
  56. {
  57. name: "加货重量统计",
  58. },
  59. {
  60. name: "航班量统计",
  61. },
  62. {
  63. name: "特货统计",
  64. },
  65. {
  66. name: "货量统计",
  67. },
  68. {
  69. name: "拉货统计",
  70. },
  71. {
  72. name: "国内进港保障时间统计",
  73. },
  74. ],
  75. formItems: [
  76. {
  77. prop: "fttpId",
  78. inputType: "select",
  79. placeholder: "国内国际",
  80. requiredWarning: "请先选择国内国际",
  81. clearable: true,
  82. options: [
  83. {
  84. value: DATACONTENT_ID.detailGnDeparture,
  85. label: "国内出港",
  86. },
  87. {
  88. value: DATACONTENT_ID.detailGjDeparture,
  89. label: "国际出港",
  90. },
  91. {
  92. value: DATACONTENT_ID.detailGnArrival,
  93. label: "国内进港",
  94. },
  95. {
  96. value: DATACONTENT_ID.detailGjArrival,
  97. label: "国际进港",
  98. },
  99. ],
  100. },
  101. {
  102. prop: "fttp",
  103. inputType: "select",
  104. placeholder: "指标分类",
  105. clearable: true,
  106. options: [
  107. {
  108. value: "数据缺失",
  109. label: "数据缺失",
  110. },
  111. {
  112. value: "流程节点缺失",
  113. label: "流程节点缺失",
  114. },
  115. {
  116. value: "时间倒置",
  117. label: "时间倒置",
  118. },
  119. {
  120. value: "时间相同",
  121. label: "时间相同",
  122. },
  123. ],
  124. },
  125. {
  126. prop: "flighttype",
  127. inputType: "select",
  128. placeholder: "二级部门",
  129. clearable: true,
  130. options: [
  131. ],
  132. },
  133. {
  134. prop: "flightno",
  135. inputType: "input",
  136. placeholder: "请输入航班号",
  137. clearable: true,
  138. options: [
  139. ],
  140. },
  141. {
  142. prop: "dateTime",
  143. inputType: "erdatime",
  144. requiredWarning: "请先选择日期",
  145. clearable: true,
  146. width: "240px",
  147. options: [],
  148. haveDisabled: true,
  149. disabledDate: function (time) {
  150. return !(time.getTime() < Date.now() - 3600 * 1000 * 24)
  151. }
  152. },
  153. ],
  154. newObj: {}
  155. };
  156. },
  157. mounted () {
  158. // this.getQuery([]);
  159. },
  160. watch: {
  161. // 监听数据变化,重绘折线图
  162. newObj: {
  163. deep: true,
  164. handler (newVal) {
  165. const { fttpId, fttp, flighttype, flightno } = newVal
  166. if (flightno) {
  167. const datas = this.tableList.filter(item => item.flight_all_no == flightno)
  168. this.setTable(datas)
  169. } else {
  170. if (fttp && !flighttype) {
  171. const datas = this.tableList.filter(item => item.index_class == fttp)
  172. this.setTable(datas)
  173. } else if (!fttp && flighttype) {
  174. const datas = this.tableList.filter(item => item.second_department == flighttype)
  175. this.setTable(datas)
  176. } else if (fttp && flighttype) {
  177. const datas = this.tableList.filter(item => item.second_department == flighttype && item.index_class == fttp)
  178. this.setTable(datas)
  179. } else {
  180. const datas = this.tableList
  181. this.setTable(datas)
  182. }
  183. }
  184. },
  185. },
  186. },
  187. destroyed () { },
  188. methods: {
  189. getFormData (data) {
  190. this.newObj = data
  191. this.tableData.time = [];
  192. this.tableData.data1 = [];
  193. this.tableData.data2 = [];
  194. let option = [{
  195. fd1: data.dateTime,
  196. fd2: data.dateTime
  197. }]
  198. this.getQuery(data.fttpId, option, null);
  199. let typeName = null
  200. switch (data.fttpId) {
  201. case 52233:
  202. typeName = '国内出港'
  203. break;
  204. case 52234:
  205. typeName = '国内进港'
  206. break;
  207. case 52235:
  208. typeName = '国际出港'
  209. break;
  210. case 52236:
  211. typeName = '国际进港'
  212. break;
  213. default:
  214. typeName = '国内出港'
  215. break;
  216. }
  217. this.listname =
  218. "节点明细统计" + '-' +
  219. typeName + '-' +
  220. data.fttp + '-' +
  221. data.flighttype + '-' +
  222. data.dateTime;
  223. this.listHeader = ["序号", "时间", "航班(班)", "环比(%)"];
  224. },
  225. setTable (datas) {
  226. this.tableListcop = _.chunk(datas, 10)
  227. this.tableNewList = this.tableListcop[0]
  228. this.total = datas.length
  229. },
  230. fore (data) {
  231. switch (data.fttpId) {
  232. case 52233:
  233. this.formItems[2].options = [
  234. {
  235. label: '货邮检查一大队',
  236. value: '货邮检查一大队'
  237. },
  238. {
  239. label: '运输部(万事通)',
  240. value: '运输部(万事通)'
  241. },
  242. {
  243. label: '装卸部(美华)',
  244. value: '装卸部(美华)'
  245. }
  246. ]
  247. break;
  248. case 52234:
  249. this.formItems[2].options = [
  250. {
  251. label: '国内进港部',
  252. value: '国内进港部'
  253. },
  254. {
  255. label: '运输部(万事通)',
  256. value: '运输部(万事通)'
  257. },
  258. {
  259. label: '装卸部(美华)',
  260. value: '装卸部(美华)'
  261. }
  262. ]
  263. break;
  264. case 52235:
  265. this.formItems[2].options = [
  266. {
  267. label: '龙略',
  268. value: '龙略'
  269. }
  270. ]
  271. break;
  272. case 52236:
  273. this.formItems[2].options = [
  274. {
  275. label: '操作二部',
  276. value: '操作二部'
  277. },
  278. {
  279. label: '货机装载组',
  280. value: '货机装载组'
  281. },
  282. {
  283. label: '龙略',
  284. value: '龙略'
  285. }
  286. ]
  287. break;
  288. default:
  289. this.formItems[2].options = [
  290. {
  291. label: '货邮检查一大队',
  292. value: '货邮检查一大队'
  293. },
  294. {
  295. label: '运输部(万事通)',
  296. value: '运输部(万事通)'
  297. },
  298. {
  299. label: '装卸部(美华)',
  300. value: '装卸部(美华)'
  301. }
  302. ]
  303. break;
  304. }
  305. },
  306. //获取表格数据
  307. async getQuery (id, data, dat) {
  308. this.loading = true
  309. try {
  310. const { code, returnData } = await Query({
  311. id: id,
  312. pageSize:9999,
  313. dataContent: data,
  314. });
  315. if (code == 0) {
  316. this.tableData.time = [];
  317. this.tableData.data1 = [];
  318. this.tableData.data2 = [];
  319. this.total = returnData.length
  320. this.tableList = _.cloneDeep(returnData);
  321. this.tableListcop = _.chunk(_.cloneDeep(returnData), 10);
  322. this.tableNewList = this.tableListcop[0]
  323. this.loading = false
  324. } else {
  325. this.loading = false
  326. console.log(code)
  327. }
  328. } catch (error) {
  329. this.loading = false
  330. this.page--;
  331. }
  332. },
  333. //导出
  334. tableToExcel (refName) {
  335. if (this.tableList.length) {
  336. import("@/utils/Export2Excel").then((excel) => {
  337. const table = this.$refs[refName].$el.cloneNode(true);
  338. const fileName = `${this.listname}.xlsx`;
  339. exportToExcel(table, '节点明细统计', fileName);
  340. });
  341. } else {
  342. this.$message.error('暂无数据')
  343. }
  344. },
  345. //分页
  346. currentChange (page) {
  347. this.tableNewList = this.tableListcop[page - 1]
  348. },
  349. upset (data) {
  350. this.picShow = data;
  351. },
  352. },
  353. components: {
  354. Echarts,
  355. StatisticsHeader,
  356. Tableformbrs,
  357. },
  358. };
  359. </script>
  360. <style lang="scss" scoped>
  361. .airportInfo {
  362. position: relative;
  363. height: 100%;
  364. .header {
  365. width: 103%;
  366. height: 36px;
  367. display: flex;
  368. align-items: center;
  369. justify-content: center;
  370. background: #f7f7f7;
  371. position: relative;
  372. left: -23px;
  373. > .nav {
  374. padding: 0 30px 0 30px;
  375. cursor: pointer;
  376. font-size: 16px;
  377. font-family: Microsoft YaHei;
  378. font-weight: 400;
  379. color: #101116;
  380. }
  381. > .navs {
  382. height: 100%;
  383. padding: 0 30px 0 30px;
  384. cursor: pointer;
  385. display: flex;
  386. align-items: center;
  387. font-size: 16px;
  388. font-family: Microsoft YaHei;
  389. font-weight: bold;
  390. color: #ac014d;
  391. border-bottom: 2px solid #ac014d;
  392. }
  393. }
  394. .variable {
  395. width: 100%;
  396. height: 52px;
  397. }
  398. .echart {
  399. width: 100%;
  400. /*height: 746px;*/
  401. height: calc(100% - 110px);
  402. position: absolute;
  403. background: #ffffff;
  404. box-shadow: 0px 3px 3px 0px rgba(0, 0, 0, 0.1);
  405. border-radius: 4px;
  406. }
  407. .pagination {
  408. position: absolute;
  409. z-index: 10;
  410. bottom: 0;
  411. left: 0;
  412. display: flex;
  413. justify-content: flex-end;
  414. width: 100%;
  415. ::v-deep .el-pager li.is-active {
  416. background: #ac014d;
  417. }
  418. }
  419. }
  420. </style>