detailsPage.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. <template>
  2. <div>
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left" @click="goBack()">返回列表 </el-button>
  6. <el-button v-if="form.id && pageIds.length" type="text" @click="lastPage">上一票</el-button>
  7. <el-button v-if="form.id && pageIds.length" type="text" @click="nextPage">下一票</el-button>
  8. </div>
  9. <div class="add-customer-btn">
  10. <el-button
  11. class="el-button--small-yh"
  12. style="margin-left: 6px;"
  13. type="primary"
  14. size="small"
  15. :disabled="selectionList.length == 0"
  16. @click="synchronous"
  17. >箱动态同步
  18. </el-button>
  19. <!-- <el-button v-if="form.status == '审核提交'" class="el-button--small-yh" style="margin-left: 6px;" type="danger"
  20. size="small" @click="revokeApplication">撤销单据请核
  21. </el-button> -->
  22. <!-- <el-dropdown style="line-height: 0">
  23. <el-button class="el-button--small-yh" style="margin-left: 6px;" type="warning" :disabled="!form.id"
  24. size="small">
  25. 审 批<i class="el-icon-arrow-down el-icon--right"></i>
  26. </el-button>
  27. <el-dropdown-menu slot="dropdown">
  28. <el-dropdown-item @click.native="checkScheduleDialog = true, checkId = form.id">审核进度
  29. </el-dropdown-item>
  30. </el-dropdown-menu>
  31. </el-dropdown> -->
  32. </div>
  33. </div>
  34. <div style="margin-top: 50px">
  35. <!-- <trade-card title="基础信息">
  36. <avue-form :option="optionForm" v-model="form" ref="form">
  37. </avue-form>
  38. </trade-card> -->
  39. <trade-card title="基础明细">
  40. <avue-crud
  41. :option="option"
  42. :data="dataList"
  43. id="out-table"
  44. ref="crud"
  45. :header-cell-class-name="headerClassName"
  46. :row-style="{ height: '20px', padding: '0px' }"
  47. :cell-style="{ height: '20px', padding: '0px' }"
  48. @selection-change="selectionChange"
  49. @select="selectHandle"
  50. @row-update="rowUpdate"
  51. @resetColumn="resetColumn('crud', 'option', 'optionBack', 515)"
  52. @saveColumn="saveColumn('crud', 'option', 'optionBack', 515)"
  53. >
  54. <template slot="menu" slot-scope="{ row, index }">
  55. <el-button size="small" type="text" @click="rowEdit(row)" v-if="row.whetherSynchronous == 0">
  56. {{ row.$cellEdit ? "保存" : "编辑" }}
  57. </el-button>
  58. <el-button size="small" type="text" @click="rowRevoke(row, index)" v-if="row.whetherSynchronous == 1">
  59. 撤销
  60. </el-button>
  61. <el-button size="small" type="text" @click="rowDel(row, index)" v-if="row.whetherSynchronous == 0&&row.srcStatus == 1">
  62. 删除
  63. </el-button>
  64. <el-popover placement="left" width="400" trigger="click">
  65. <avue-crud :option="recordOption" :data="recordData"></avue-crud>
  66. <el-button slot="reference" size="small" type="text" @click="rowRecord(row)" style="margin-left: 6px;">记录</el-button>
  67. </el-popover>
  68. </template>
  69. <!-- <template slot="menuLeft">
  70. <el-button type="danger" size="small" @click="allClick('撤销')">一键撤销 </el-button>
  71. </template> -->
  72. <tempalte slot="portCname" slot-scope="{ row, index }">
  73. <dic-select
  74. v-if="row.$cellEdit"
  75. v-model="row.portCname"
  76. placeholder="港口"
  77. label="cnName"
  78. res="records"
  79. url="/blade-los/bports/list?status=0&current=1&size=5"
  80. :filterable="true"
  81. :remote="true"
  82. dataName="cnName"
  83. @selectChange="rowDicChange('portCname', $event, row)"
  84. :disabled="editDisabled"
  85. :slotRight="true"
  86. rightLabel="code"
  87. ></dic-select>
  88. <span v-else>{{ row.portCname }}</span>
  89. </tempalte>
  90. </avue-crud>
  91. </trade-card>
  92. </div>
  93. </div>
  94. </template>
  95. <script>
  96. import { detail, itemSubmit, synchronous, itemRemove, revokeSynchronous, getRecordlist } from "@/api/boxManagement/record/index.js";
  97. import dicSelect from "@/components/dicSelect/main";
  98. import checkSchedule from "@/components/checkH/checkSchedule.vue";
  99. import businessReports from "@/components/tradeAgency/businessReports.vue";
  100. import reports from "@/components/tradeAgency/reports.vue";
  101. import { dateFormat } from "@/util/date";
  102. import { bcurrencyGetExrate } from "@/api/iosBasicData/rateManagement";
  103. import { getToken } from "@/util/auth";
  104. import _ from "lodash";
  105. import { Header } from "element-ui";
  106. export default {
  107. name: "detailsPage",
  108. data() {
  109. return {
  110. selectionList: [],
  111. editButton: false,
  112. editDisabled: false,
  113. dataList: [],
  114. recordData: [],
  115. recordOption: {
  116. align: "center",
  117. menu: false,
  118. header: false,
  119. column: [
  120. {
  121. label: "操作类型",
  122. prop: "operatorType",
  123. overHidden: true
  124. },
  125. {
  126. label: "操作内容",
  127. prop: "operatorContent",
  128. overHidden: true
  129. },
  130. {
  131. label: "操作人",
  132. prop: "operatorName",
  133. overHidden: true
  134. },
  135. {
  136. label: "操作时间",
  137. prop: "operatorDate",
  138. overHidden: true
  139. }
  140. ]
  141. },
  142. optionForm: {
  143. menuBtn: false,
  144. span: 6,
  145. disabled: false,
  146. labelWidth: 100,
  147. column: [
  148. {
  149. label: "起运港",
  150. prop: "polCname",
  151. disabled: false,
  152. rules: [
  153. {
  154. required: true,
  155. message: " ",
  156. trigger: "blur"
  157. }
  158. ]
  159. },
  160. {
  161. label: "目的港",
  162. prop: "podCname",
  163. disabled: false,
  164. rules: [
  165. {
  166. required: true,
  167. message: " ",
  168. trigger: "blur"
  169. }
  170. ]
  171. },
  172. {
  173. label: "备注",
  174. prop: "remarks",
  175. type: "textarea",
  176. minRows: 2,
  177. span: 12
  178. }
  179. ]
  180. },
  181. option: {},
  182. optionBack: {
  183. // height: 'auto',
  184. maxHeight: 700,
  185. calcHeight: 30,
  186. menuWidth: 110,
  187. tip: false,
  188. border: true,
  189. addBtn: false,
  190. viewBtn: false,
  191. editBtn: false,
  192. delBtn: false,
  193. refreshBtn: false,
  194. selection: true,
  195. index: true,
  196. align: "center",
  197. // menu: false,
  198. column: [
  199. {
  200. label: "是否同步",
  201. prop: "whetherSynchronous",
  202. width: 80,
  203. sortable: true,
  204. type: "select",
  205. dicData: [
  206. {
  207. label: "否",
  208. value: "0"
  209. },
  210. {
  211. label: "是",
  212. value: "1"
  213. }
  214. ],
  215. overHidden: true
  216. },
  217. {
  218. label: "放箱号",
  219. prop: "containerNumber",
  220. cell: true,
  221. width: 150,
  222. sortable: true,
  223. overHidden: true
  224. },
  225. {
  226. label: "箱号",
  227. prop: "boxCode",
  228. width: 100,
  229. sortable: true,
  230. overHidden: true
  231. },
  232. {
  233. label: "箱型",
  234. prop: "boxType",
  235. width: 80,
  236. sortable: true,
  237. overHidden: true
  238. },
  239. {
  240. label: "港口",
  241. prop: "portCname",
  242. width: 150,
  243. sortable: true,
  244. overHidden: true
  245. },
  246. {
  247. label: "场站",
  248. prop: "stationCname",
  249. width: 100,
  250. sortable: true,
  251. overHidden: true
  252. },
  253. {
  254. label: "提单号",
  255. prop: "hblno",
  256. cell: true,
  257. width: 120,
  258. overHidden: true
  259. },
  260. {
  261. label: "出场日期",
  262. prop: "approachExitDate",
  263. width: 140,
  264. overHidden: true,
  265. cell: true,
  266. type: "datetime",
  267. format: "yyyy-MM-dd HH:mm:ss",
  268. valueFormat: "yyyy-MM-dd HH:mm:ss"
  269. },
  270. {
  271. label: "出场目的",
  272. prop: "objective",
  273. width: 120,
  274. cell: true,
  275. type: "select",
  276. dicUrl: "/api/blade-system/dict-biz/dictionary?code=exit_purpose",
  277. props: {
  278. label: "dictValue",
  279. value: "dictKey"
  280. },
  281. overHidden: true
  282. },
  283. {
  284. label: "箱好坏",
  285. prop: "boxStatus",
  286. width: 80,
  287. cell: true,
  288. overHidden: true,
  289. type: "select",
  290. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_status",
  291. props: {
  292. label: "dictValue",
  293. value: "dictValue"
  294. }
  295. },
  296. {
  297. label: "备注",
  298. prop: "remarks",
  299. cell: true,
  300. overHidden: true
  301. }
  302. ]
  303. },
  304. roleName: [],
  305. form: {}
  306. };
  307. },
  308. components: {
  309. dicSelect,
  310. checkSchedule,
  311. businessReports,
  312. reports
  313. },
  314. props: {
  315. detailData: Object,
  316. pageIds: {
  317. type: Array, // 指定 prop 的类型为 Array
  318. default: () => [] // 提供一个默认值,这里使用函数形式返回一个空数组
  319. }
  320. },
  321. async created() {
  322. this.option = await this.getColumnData(this.getColumnName(515), this.optionBack);
  323. if (this.detailData.id) {
  324. // this.editButton = true
  325. // this.editDisabled = true
  326. // this.optionForm.disabled = true
  327. this.getDetail(this.detailData.id);
  328. }
  329. },
  330. methods: {
  331. lastPage() {
  332. if (this.pageIds.length) {
  333. const index = this.pageIds.indexOf(this.form.id);
  334. if (index == 0) {
  335. return this.$message.error("没有上一票了");
  336. }
  337. const lastIndex = index - 1;
  338. this.getDetail(this.pageIds[lastIndex]);
  339. }
  340. },
  341. nextPage() {
  342. if (this.pageIds.length) {
  343. const index = this.pageIds.indexOf(this.form.id);
  344. if (this.pageIds[this.pageIds.length - 1] == this.form.id) {
  345. return this.$message.error("没有下一票了");
  346. }
  347. const nextIndex = index + 1;
  348. this.getDetail(this.pageIds[nextIndex]);
  349. }
  350. },
  351. rowDicChange(name, row, el) {
  352. if (name == "portCname") {
  353. if (row) {
  354. el.portId = row.id;
  355. el.portCode = row.code;
  356. el.portEname = row.enName;
  357. } else {
  358. el.portId = null;
  359. el.portCode = null;
  360. el.portEname = null;
  361. el.portCname = null;
  362. }
  363. }
  364. },
  365. synchronous() {
  366. let ids = [];
  367. for (let item of this.selectionList) {
  368. if (item.whetherSynchronous == 1) {
  369. return this.$message.error("请选择未同步的明细");
  370. }
  371. ids.push(item.id);
  372. }
  373. let obj = {
  374. id: this.detailData.id,
  375. ids: ids.join(",")
  376. };
  377. synchronous(obj).then(res => {
  378. this.$message.success("操作成功");
  379. this.getDetail(this.detailData.id);
  380. });
  381. },
  382. rowEdit(row) {
  383. if (row.$cellEdit == true) {
  384. this.$set(row, "$cellEdit", false);
  385. itemSubmit(row).then(res => {
  386. this.$message.success("保存成功");
  387. this.$set(row, "$cellEdit", false);
  388. this.getDetail(this.detailData.id);
  389. });
  390. } else {
  391. this.$set(row, "$cellEdit", true);
  392. }
  393. },
  394. rowRecord(row) {
  395. this.recordData = [];
  396. let obj = {
  397. pid: row.id
  398. };
  399. getRecordlist(1, 50, obj).then(res => {
  400. this.recordData = res.data.data.records;
  401. });
  402. },
  403. rowRevoke(row) {
  404. this.$confirm("是否撤销数据?", "提示", {
  405. confirmButtonText: "确定",
  406. cancelButtonText: "取消",
  407. type: "warning"
  408. }).then(() => {
  409. let obj = {
  410. id: this.detailData.id,
  411. ids: row.id
  412. };
  413. revokeSynchronous(obj).then(res => {
  414. this.$message.success("操作成功");
  415. this.getDetail(this.detailData.id);
  416. });
  417. });
  418. },
  419. rowDel(row, index) {
  420. this.$confirm("是否删除数据?", "提示", {
  421. confirmButtonText: "确定",
  422. cancelButtonText: "取消",
  423. type: "warning"
  424. }).then(() => {
  425. let obj = {
  426. ids: row.id,
  427. };
  428. itemRemove(obj).then(res => {
  429. this.$message.success("操作成功");
  430. this.getDetail(this.detailData.id);
  431. });
  432. });
  433. },
  434. selectionChange(list) {
  435. this.selectionList = list;
  436. },
  437. getDetail(id) {
  438. this.form.id = id;
  439. const loading = this.$loading({
  440. lock: true,
  441. text: "加载中",
  442. spinner: "el-icon-loading",
  443. background: "rgba(255,255,255,0.7)"
  444. });
  445. detail({ pid: id })
  446. .then(res => {
  447. this.dataList = res.data.data;
  448. this.$nextTick(() => {
  449. this.$refs.crud.doLayout();
  450. this.$refs.crud.dicInit();
  451. });
  452. })
  453. .finally(() => {
  454. loading.close();
  455. });
  456. },
  457. submit(type) {
  458. const loading = this.$loading({
  459. lock: true,
  460. text: "加载中",
  461. spinner: "el-icon-loading",
  462. background: "rgba(255,255,255,0.7)"
  463. });
  464. itemSubmit(this.dataList)
  465. .then(res => {
  466. this.$message.success("保存成功");
  467. this.getDetail(this.detailData.id);
  468. })
  469. .finally(() => {
  470. loading.close();
  471. });
  472. },
  473. //自定义列保存
  474. async saveColumn(ref, option, optionBack, code) {
  475. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  476. if (inSave) {
  477. this.$message.success("保存成功");
  478. //关闭窗口
  479. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  480. }
  481. },
  482. //自定义列重置
  483. async resetColumn(ref, option, optionBack, code) {
  484. this[option] = this[optionBack];
  485. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  486. if (inSave) {
  487. this.$message.success("重置成功");
  488. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  489. }
  490. },
  491. // 更改表格颜色
  492. headerClassName(tab) {
  493. //颜色间隔
  494. let back = "";
  495. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  496. if (tab.columnIndex % 2 === 0) {
  497. back = "back-one";
  498. } else if (tab.columnIndex % 2 === 1) {
  499. back = "back-two";
  500. }
  501. }
  502. return back;
  503. },
  504. goBack(type) {
  505. this.$emit("goBack");
  506. }
  507. }
  508. };
  509. </script>
  510. <style lang="scss" scoped>
  511. ::v-deep .el-form-item__error {
  512. display: none !important;
  513. }
  514. ::v-deep .el-form-item {
  515. margin-bottom: 8px !important;
  516. }
  517. ::v-deep .el-table .cell {
  518. padding: 0 2px !important;
  519. .el-form-item {
  520. margin-bottom: 0px !important;
  521. }
  522. }
  523. ::v-deep .avue-crud .el-table .el-form-item__label {
  524. left: -1px;
  525. }
  526. // ::v-deep#out-table .back-one {
  527. // background: #ecf5ff !important;
  528. // }
  529. // ::v-deep#out-table .back-two {
  530. // background: #ecf5ff !important;
  531. // }
  532. ::v-deep #out-table .back-one {
  533. background: #ecf5ff !important;
  534. text-align: center;
  535. padding: 4px 0;
  536. }
  537. ::v-deep #out-table .back-two {
  538. background: #ecf5ff !important;
  539. text-align: center;
  540. padding: 4px 0;
  541. }
  542. ::v-deep .el-table--small td,
  543. .el-table--small th {
  544. padding: 2px !important;
  545. }
  546. ::v-deep .el-card__body {
  547. padding: 3px 10px;
  548. }
  549. ::v-deep .box-card .el-card__body {
  550. padding: 4px !important;
  551. }
  552. .disabledBox {
  553. display: flex;
  554. align-items: center;
  555. }
  556. .meetSize {
  557. font-size: 16px;
  558. color: #54bcbd;
  559. }
  560. .fontSize {
  561. font-size: 16px;
  562. color: #81b337;
  563. }
  564. </style>