index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. <template>
  2. <div>
  3. <basic-container>
  4. <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :search.sync="query"
  5. v-model="form" id="out-table" :header-cell-class-name="headerClassName" ref="crud" @search-change="searchChange"
  6. @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
  7. @size-change="sizeChange" @refresh-change="refreshChange"
  8. @resetColumn="resetColumn('crud', 'option', 'optionBack', 500)"
  9. @saveColumn="saveColumn('crud', 'option', 'optionBack', 500)" @on-load="onLoad">
  10. <template slot="menuLeft">
  11. <el-button type="success" size="small" :disabled="selectionList.length == 0"
  12. @click="allClick('批量修改POD场站')">批量修改POD场站
  13. </el-button>
  14. <el-button type="warning" size="small" @click="outExport">导 出
  15. </el-button>
  16. </template>
  17. </avue-crud>
  18. <el-dialog append-to-body title="批量修改POD场站" :visible.sync="podDialog" width="30%" v-dialog-drag>
  19. <span>
  20. <avue-form v-if='podDialog' ref="form2" v-model="podForm" :option="podOption">
  21. <tempalte slot="podStationCname">
  22. <dic-select v-model="podForm.podStationCname" placeholder="场站" label="cnName" res="records"
  23. :slotRight="true" rightLabel="code"
  24. url="/blade-los/bcorps/selectList?current=1&size=5&corpTypeName=场站&status=0" :filterable="true"
  25. :remote="true" dataName="cnName" @selectChange="dicChange('podStationCname', $event)"></dic-select>
  26. </tempalte>
  27. </avue-form>
  28. </span>
  29. <span slot="footer" class="dialog-footer">
  30. <el-button @click="podDialog = false" size="mini">取 消</el-button>
  31. <el-button type="primary" @click.stop="podSubmit" size="mini">确 定</el-button>
  32. </span>
  33. </el-dialog>
  34. </basic-container>
  35. </div>
  36. </template>
  37. <script>
  38. import { getList, batchUpdatePodStation } from "@/api/iosBasicData/podStation.js";
  39. import { defaultDate2 } from "@/util/date";
  40. import dicSelect from "@/components/dicSelect/main";
  41. import { getToken } from "@/util/auth";
  42. export default {
  43. data() {
  44. return {
  45. podDialog: false,
  46. podForm: {},
  47. podOption: {
  48. menuBtn: false,
  49. span: 24,
  50. labelWidth: 120,
  51. disabled: false,
  52. column: [
  53. {
  54. label: 'POD场站',
  55. prop: 'podStationCname',
  56. rules: [{
  57. required: true,
  58. message: " ",
  59. trigger: "blur"
  60. }],
  61. },
  62. {
  63. label: '还箱日期',
  64. prop: 'returnEmptyTime',
  65. type: "date",
  66. format: "yyyy-MM-dd",
  67. valueFormat: "yyyy-MM-dd 00:00:00",
  68. span: 24,
  69. rules: [{
  70. required: true,
  71. message: " ",
  72. trigger: "blur"
  73. }],
  74. },
  75. {
  76. label: '目的港场站地址',
  77. prop: 'podCyAddress',
  78. disabled: false
  79. },
  80. {
  81. label: '目的港场站联系人',
  82. prop: 'podCyContact',
  83. disabled: false
  84. },
  85. {
  86. label: '目的港场站邮箱',
  87. prop: 'podCyEmail',
  88. disabled: false
  89. },
  90. {
  91. label: '目的港场站电话',
  92. prop: 'podCyTel',
  93. disabled: false
  94. },
  95. ]
  96. },
  97. form: {},
  98. query: {
  99. whether: '0',
  100. businessType: "SE",
  101. boxBelongsTo: 'SOC',
  102. actualEtdList: defaultDate2()
  103. },
  104. loading: false,
  105. page: {
  106. pageSize: 10,
  107. currentPage: 1,
  108. total: 0
  109. },
  110. selectionList: [],
  111. option: {},
  112. optionBack: {
  113. height: 'auto',
  114. calcHeight: 30,
  115. menuWidth: 140,
  116. menu: false,
  117. tip: false,
  118. searchShow: true,
  119. searchMenuSpan: 6,
  120. border: true,
  121. index: true,
  122. addBtn: false,
  123. viewBtn: false,
  124. editBtn: false,
  125. delBtn: false,
  126. selection: true,
  127. searchIcon: true,
  128. align: 'center',
  129. searchIndex: 3,
  130. column: [
  131. {
  132. label: '客户',
  133. prop: 'corpName',
  134. overHidden: true,
  135. },
  136. {
  137. label: '箱号',
  138. prop: 'cntrNo',
  139. overHidden: true,
  140. search: true,
  141. },
  142. {
  143. label: '铅封号',
  144. prop: 'sealNo',
  145. overHidden: true,
  146. },
  147. {
  148. label: 'HB/L NO',
  149. prop: 'hblno',
  150. overHidden: true,
  151. search: true,
  152. },
  153. {
  154. label: 'POD场站',
  155. prop: 'podStationCname',
  156. overHidden: true,
  157. search: true,
  158. type: "select",
  159. filterable: true,
  160. remote: true,
  161. dicUrl: "/api/blade-los/bcorps/selectList?current=1&size=5&corpTypeName=场站&status=0&cnName={{key}}",
  162. props: {
  163. label: "cnName",
  164. value: "cnName",
  165. desc: 'code',
  166. res: "data.records"
  167. }
  168. },
  169. {
  170. label: 'MB/L NO',
  171. prop: 'mblno',
  172. overHidden: true,
  173. search: true,
  174. },
  175. {
  176. label: 'ETD',
  177. prop: 'etd',
  178. width: 120,
  179. search: true,
  180. searchProp: 'actualEtdList',
  181. overHidden: true,
  182. type: "date",
  183. searchRange: true,
  184. format: "yyyy-MM-dd",
  185. valueFormat: "yyyy-MM-dd"
  186. },
  187. // {
  188. // label: '单据类型',
  189. // prop: 'billType',
  190. // hide: true,
  191. // overHidden: true,
  192. // search: true,
  193. // type: 'select',
  194. // dicData: [
  195. // {
  196. // label: '直单',
  197. // value: 'DD'
  198. // },
  199. // {
  200. // label: '分单',
  201. // value: 'MH'
  202. // }
  203. // ]
  204. // },
  205. {
  206. label: '船名',
  207. prop: 'vesselCnName',
  208. overHidden: true,
  209. search: true,
  210. type: "select",
  211. filterable: true,
  212. remote: true,
  213. dicUrl: "/api/blade-los/bvessels/list?status=0&size=5&current=1&cnName={{key}}",
  214. props: {
  215. label: "cnName",
  216. value: "cnName",
  217. desc: 'code',
  218. res: "data.records"
  219. }
  220. },
  221. {
  222. label: '航次',
  223. prop: 'voyageNo',
  224. overHidden: true,
  225. search: true,
  226. },
  227. {
  228. label: '起运港',
  229. prop: 'polName',
  230. overHidden: true,
  231. search: true,
  232. type: "select",
  233. filterable: true,
  234. remote: true,
  235. dicUrl: "/api/blade-los/bports/list?status=0&size=5&current=1&cnName={{key}}",
  236. props: {
  237. label: "cnName",
  238. value: "cnName",
  239. desc: 'code',
  240. res: "data.records"
  241. }
  242. },
  243. {
  244. label: '卸货港',
  245. prop: 'podName',
  246. overHidden: true,
  247. search: true,
  248. type: "select",
  249. filterable: true,
  250. remote: true,
  251. dicUrl: "/api/blade-los/bports/list?status=0&size=5&current=1&cnName={{key}}",
  252. props: {
  253. label: "cnName",
  254. value: "cnName",
  255. desc: 'code',
  256. res: "data.records"
  257. }
  258. },
  259. {
  260. label: '放箱号',
  261. prop: 'containerNumber',
  262. overHidden: true,
  263. },
  264. {
  265. label: '箱属',
  266. prop: 'boxBelongsTo',
  267. overHidden: true,
  268. search: true,
  269. type: 'select',
  270. dicUrl: "/api/blade-system/dict-biz/dictionary?code=boxBelongsTo",
  271. props: {
  272. label: "dictValue",
  273. value: "dictValue"
  274. },
  275. },
  276. {
  277. label: '箱型',
  278. prop: 'cntrTypeCode',
  279. overHidden: true,
  280. },
  281. {
  282. label: '是否录入',
  283. prop: 'whether',
  284. hide: true,
  285. overHidden: true,
  286. search: true,
  287. type: 'select',
  288. dicData: [{
  289. label: '否',
  290. value: '0'
  291. }, {
  292. label: '是',
  293. value: '1'
  294. }]
  295. },
  296. ]
  297. },
  298. data: [],
  299. };
  300. },
  301. components: {
  302. dicSelect
  303. },
  304. async created() {
  305. this.option = await this.getColumnData(this.getColumnName(500), this.optionBack);
  306. },
  307. activated() {
  308. setTimeout(() => {
  309. }, 100);
  310. },
  311. methods: {
  312. allClick(name) {
  313. if (name == '批量修改POD场站') {
  314. this.podForm = {}
  315. this.podDialog = true
  316. }
  317. },
  318. dicChange(name, row) {
  319. if (name == 'podStationCname') {
  320. if (row) {
  321. this.podForm.podStationId = row.id
  322. this.podForm.podStationCode = row.code
  323. this.podForm.podStationEname = row.enName
  324. } else {
  325. this.podForm.podStationId = null
  326. this.podForm.podStationCode = null
  327. this.podForm.podStationEname = null
  328. this.podForm.podStationCname = null
  329. }
  330. }
  331. },
  332. podSubmit() {
  333. this.$refs["form2"].validate((valid, done) => {
  334. done();
  335. if (valid) {
  336. // let ids = []
  337. // for (let item of this.selectionList) {
  338. // ids.push(item.id)
  339. // }
  340. let obj = {
  341. // ids: ids.join(','),
  342. businessType: 'SE',
  343. list: this.selectionList,
  344. ...this.podForm,
  345. }
  346. const loading = this.$loading({
  347. lock: true,
  348. text: '加载中',
  349. spinner: 'el-icon-loading',
  350. background: 'rgba(255,255,255,0.7)'
  351. });
  352. batchUpdatePodStation(obj).then(res => {
  353. this.$message.success("操作成功!");
  354. this.refreshChange()
  355. this.podDialog = false
  356. }).finally(() => {
  357. loading.close();
  358. })
  359. } else {
  360. return false;
  361. }
  362. });
  363. },
  364. searchReset() {
  365. this.query = {
  366. businessType: "SE"
  367. };
  368. this.onLoad(this.page);
  369. },
  370. // 搜索按钮点击
  371. searchChange(params, done) {
  372. this.page.currentPage = 1;
  373. this.onLoad(this.page, this.query);
  374. done();
  375. },
  376. selectionChange(list) {
  377. this.selectionList = list;
  378. },
  379. currentChange(currentPage) {
  380. this.page.currentPage = currentPage;
  381. },
  382. sizeChange(pageSize) {
  383. this.page.pageSize = pageSize;
  384. },
  385. refreshChange() {
  386. this.onLoad(this.page, this.query);
  387. },
  388. onLoad(page, params = {}) {
  389. let obj = {}
  390. obj = {
  391. ...Object.assign(params, this.query),
  392. }
  393. this.loading = true;
  394. getList(page.currentPage, page.pageSize, obj).then(res => {
  395. this.data = res.data.data.records;
  396. this.page.total = res.data.data.total;
  397. this.$nextTick(() => {
  398. this.$refs.crud.doLayout();
  399. this.$refs.crud.dicInit();
  400. });
  401. }).finally(() => {
  402. this.loading = false;
  403. })
  404. },
  405. outExport() {
  406. let config = { params: { ...this.query } }
  407. if (config.params) {
  408. for (const propName of Object.keys(config.params)) {
  409. const value = config.params[propName];
  410. if (value !== null && typeof (value) !== "undefined") {
  411. if (value instanceof Array) {
  412. for (const key of Object.keys(value)) {
  413. let params = propName + '[' + key + ']';
  414. config.params[params] = value[key]
  415. }
  416. delete config.params[propName]
  417. }
  418. }
  419. }
  420. }
  421. const routeData = this.$router.resolve({
  422. path: '/api/blade-los/UpdatePodStation/listExport', //跳转目标窗口的地址
  423. query: {
  424. ...config.params, //括号内是要传递给新窗口的参数
  425. identification: this.url
  426. }
  427. })
  428. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  429. },
  430. //自定义列保存
  431. async saveColumn(ref, option, optionBack, code) {
  432. /**
  433. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  434. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  435. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  436. */
  437. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  438. if (inSave) {
  439. this.$message.success("保存成功");
  440. //关闭窗口
  441. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  442. }
  443. },
  444. //自定义列重置
  445. async resetColumn(ref, option, optionBack, code) {
  446. this[option] = this[optionBack];
  447. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  448. if (inSave) {
  449. this.$message.success("重置成功");
  450. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  451. }
  452. },
  453. // 更改表格颜色
  454. headerClassName(tab) {
  455. //颜色间隔
  456. let back = ""
  457. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  458. if (tab.columnIndex % 2 === 0) {
  459. back = "back-one"
  460. } else if (tab.columnIndex % 2 === 1) {
  461. back = "back-two"
  462. }
  463. }
  464. return back;
  465. },
  466. }
  467. }
  468. </script>
  469. <style lang="scss" scoped>
  470. ::v-deep #out-table .back-one {
  471. background: #ecf5ff !important;
  472. text-align: center;
  473. }
  474. ::v-deep #out-table .back-two {
  475. background: #ecf5ff !important;
  476. text-align: center;
  477. }
  478. .pointerClick {
  479. cursor: pointer;
  480. color: #1e9fff;
  481. }
  482. ::v-deep .el-col-md-8 {
  483. width: 24.33333%;
  484. }
  485. </style>