detailsPage.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  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"
  6. @click="goBack()">返回列表
  7. </el-button>
  8. </div>
  9. <div class="add-customer-btn">
  10. <el-button class="el-button--small-yh" style="margin-left: 6px;" type="primary" size="small"
  11. :disabled="selectionList.length == 0" @click="synchronous">箱动态同步
  12. </el-button>
  13. <!-- <el-button v-if="form.status == '审核提交'" class="el-button--small-yh" style="margin-left: 6px;" type="danger"
  14. size="small" @click="revokeApplication">撤销单据请核
  15. </el-button> -->
  16. <!-- <el-dropdown style="line-height: 0">
  17. <el-button class="el-button--small-yh" style="margin-left: 6px;" type="warning" :disabled="!form.id"
  18. size="small">
  19. 审 批<i class="el-icon-arrow-down el-icon--right"></i>
  20. </el-button>
  21. <el-dropdown-menu slot="dropdown">
  22. <el-dropdown-item @click.native="checkScheduleDialog = true, checkId = form.id">审核进度
  23. </el-dropdown-item>
  24. </el-dropdown-menu>
  25. </el-dropdown> -->
  26. </div>
  27. </div>
  28. <div style="margin-top: 50px">
  29. <!-- <trade-card title="基础信息">
  30. <avue-form :option="optionForm" v-model="form" ref="form">
  31. </avue-form>
  32. </trade-card> -->
  33. <trade-card title="基础明细">
  34. <avue-crud :option="option" :data="dataList" id="out-table" ref="crud" :header-cell-class-name="headerClassName"
  35. :row-style="{ height: '20px', padding: '0px' }" :cell-style="{ height: '20px', padding: '0px' }"
  36. @selection-change="selectionChange" @select="selectHandle" @row-update="rowUpdate"
  37. @resetColumn="resetColumn('crud', 'option', 'optionBack', 515)"
  38. @saveColumn="saveColumn('crud', 'option', 'optionBack', 515)">
  39. <template slot="menu" slot-scope="{ row, index }">
  40. <el-button size="small" type="text" @click="rowEdit(row)">
  41. {{ row.$cellEdit ? '保存' : '编辑' }}
  42. </el-button>
  43. </template>
  44. </avue-crud>
  45. </trade-card>
  46. </div>
  47. </div>
  48. </template>
  49. <script>
  50. import { detail, itemSubmit, synchronous } from "@/api/boxManagement/record/index.js";
  51. import dicSelect from "@/components/dicSelect/main";
  52. import checkSchedule from "@/components/checkH/checkSchedule.vue";
  53. import businessReports from "@/components/tradeAgency/businessReports.vue";
  54. import reports from "@/components/tradeAgency/reports.vue";
  55. import { dateFormat } from "@/util/date";
  56. import { bcurrencyGetExrate } from "@/api/iosBasicData/rateManagement";
  57. import { getToken } from "@/util/auth";
  58. import _ from "lodash";
  59. import { Header } from "element-ui";
  60. export default {
  61. name: "detailsPage",
  62. data() {
  63. return {
  64. selectionList: [],
  65. editButton: false,
  66. editDisabled: false,
  67. dataList: [],
  68. optionForm: {
  69. menuBtn: false,
  70. span: 6,
  71. disabled: false,
  72. labelWidth: 100,
  73. column: [
  74. {
  75. label: '起运港',
  76. prop: 'polCname',
  77. disabled: false,
  78. rules: [{
  79. required: true,
  80. message: " ",
  81. trigger: "blur"
  82. }],
  83. },
  84. {
  85. label: '目的港',
  86. prop: 'podCname',
  87. disabled: false,
  88. rules: [{
  89. required: true,
  90. message: " ",
  91. trigger: "blur"
  92. }],
  93. },
  94. {
  95. label: '备注',
  96. prop: 'remarks',
  97. type: 'textarea',
  98. minRows: 2,
  99. span: 12
  100. }]
  101. },
  102. option: {},
  103. optionBack: {
  104. // height: 'auto',
  105. maxHeight: 340,
  106. calcHeight: 30,
  107. menuWidth: 60,
  108. tip: false,
  109. border: true,
  110. addBtn: false,
  111. viewBtn: false,
  112. editBtn: false,
  113. delBtn: false,
  114. refreshBtn: false,
  115. selection: true,
  116. index: true,
  117. align: 'center',
  118. // menu: false,
  119. column: [
  120. {
  121. label: '是否同步',
  122. prop: 'whetherSynchronous',
  123. type: 'select',
  124. dicData: [{
  125. label: '否',
  126. value: '0'
  127. }, {
  128. label: '是',
  129. value: '1'
  130. }],
  131. overHidden: true,
  132. },
  133. {
  134. label: '放箱号',
  135. prop: 'containerNumber',
  136. overHidden: true,
  137. },
  138. {
  139. label: '箱号',
  140. prop: 'boxCode',
  141. overHidden: true,
  142. },
  143. {
  144. label: '箱型',
  145. prop: 'boxType',
  146. overHidden: true,
  147. },
  148. {
  149. label: '港口',
  150. prop: 'portCname',
  151. overHidden: true,
  152. },
  153. {
  154. label: '场站',
  155. prop: 'stationCname',
  156. overHidden: true,
  157. },
  158. {
  159. label: '提单号',
  160. prop: 'hblno',
  161. overHidden: true,
  162. },
  163. {
  164. label: '出场日期',
  165. prop: 'approachExitDate',
  166. overHidden: true,
  167. },
  168. {
  169. label: '出场目的',
  170. prop: 'objective',
  171. cell: true,
  172. type: 'select',
  173. dicUrl: "/api/blade-system/dict-biz/dictionary?code=exit_purpose",
  174. props: {
  175. label: "dictValue",
  176. value: "dictKey"
  177. },
  178. overHidden: true,
  179. },
  180. {
  181. label: '箱好坏',
  182. prop: 'boxStatus',
  183. overHidden: true,
  184. },
  185. {
  186. label: '备注',
  187. prop: 'remarks',
  188. cell: true,
  189. width: 150,
  190. overHidden: true,
  191. }]
  192. },
  193. roleName: [],
  194. }
  195. },
  196. components: {
  197. dicSelect,
  198. checkSchedule,
  199. businessReports,
  200. reports
  201. },
  202. props: {
  203. detailData: Object
  204. },
  205. async created() {
  206. this.option = await this.getColumnData(this.getColumnName(515), this.optionBack);
  207. if (this.detailData.id) {
  208. // this.editButton = true
  209. // this.editDisabled = true
  210. // this.optionForm.disabled = true
  211. this.getDetail(this.detailData.id)
  212. }
  213. },
  214. methods: {
  215. synchronous() {
  216. let ids = []
  217. for (let item of this.selectionList) {
  218. if (item.whetherSynchronous == 1) {
  219. return this.$message.error("请选择未同步的明细");
  220. }
  221. ids.push(item.id)
  222. }
  223. let obj = {
  224. id: this.detailData.id,
  225. ids: ids.join(',')
  226. }
  227. synchronous(obj).then(res => {
  228. this.$message.success("操作成功");
  229. this.getDetail(this.detailData.id)
  230. })
  231. },
  232. rowEdit(row) {
  233. if (row.$cellEdit == true) {
  234. this.$set(row, "$cellEdit", false);
  235. itemSubmit(row).then(res => {
  236. this.$message.success("保存成功");
  237. this.$set(row, "$cellEdit", false);
  238. this.getDetail(this.detailData.id)
  239. })
  240. } else {
  241. this.$set(row, "$cellEdit", true);
  242. }
  243. },
  244. selectionChange(list) {
  245. this.selectionList = list;
  246. },
  247. getDetail(id) {
  248. const loading = this.$loading({
  249. lock: true,
  250. text: '加载中',
  251. spinner: 'el-icon-loading',
  252. background: 'rgba(255,255,255,0.7)'
  253. });
  254. detail({ pid: id }).then(res => {
  255. this.dataList = res.data.data
  256. this.$nextTick(() => {
  257. this.$refs.crud.doLayout();
  258. this.$refs.crud.dicInit();
  259. });
  260. }).finally(() => {
  261. loading.close()
  262. })
  263. },
  264. submit(type) {
  265. const loading = this.$loading({
  266. lock: true,
  267. text: '加载中',
  268. spinner: 'el-icon-loading',
  269. background: 'rgba(255,255,255,0.7)'
  270. });
  271. itemSubmit(this.dataList).then(res => {
  272. this.$message.success("保存成功");
  273. this.getDetail(this.detailData.id)
  274. }).finally(() => {
  275. loading.close();
  276. })
  277. },
  278. //自定义列保存
  279. async saveColumn(ref, option, optionBack, code) {
  280. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  281. if (inSave) {
  282. this.$message.success("保存成功");
  283. //关闭窗口
  284. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  285. }
  286. },
  287. //自定义列重置
  288. async resetColumn(ref, option, optionBack, code) {
  289. this[option] = this[optionBack];
  290. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  291. if (inSave) {
  292. this.$message.success("重置成功");
  293. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  294. }
  295. },
  296. // 更改表格颜色
  297. headerClassName(tab) {
  298. //颜色间隔
  299. let back = ""
  300. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  301. if (tab.columnIndex % 2 === 0) {
  302. back = "back-one"
  303. } else if (tab.columnIndex % 2 === 1) {
  304. back = "back-two"
  305. }
  306. }
  307. return back;
  308. },
  309. goBack(type) {
  310. this.$emit("goBack");
  311. },
  312. }
  313. }
  314. </script>
  315. <style lang="scss" scoped>
  316. ::v-deep .el-form-item__error {
  317. display: none !important;
  318. }
  319. ::v-deep .el-form-item {
  320. margin-bottom: 8px !important;
  321. }
  322. ::v-deep .el-table .cell {
  323. padding: 0 2px !important;
  324. .el-form-item {
  325. margin-bottom: 0px !important;
  326. }
  327. }
  328. ::v-deep .avue-crud .el-table .el-form-item__label {
  329. left: -1px;
  330. }
  331. // ::v-deep#out-table .back-one {
  332. // background: #ecf5ff !important;
  333. // }
  334. // ::v-deep#out-table .back-two {
  335. // background: #ecf5ff !important;
  336. // }
  337. ::v-deep #out-table .back-one {
  338. background: #ecf5ff !important;
  339. text-align: center;
  340. padding: 4px 0;
  341. }
  342. ::v-deep #out-table .back-two {
  343. background: #ecf5ff !important;
  344. text-align: center;
  345. padding: 4px 0;
  346. }
  347. ::v-deep .el-table--small td,
  348. .el-table--small th {
  349. padding: 2px !important;
  350. }
  351. ::v-deep .el-card__body {
  352. padding: 3px 10px;
  353. }
  354. ::v-deep .box-card .el-card__body {
  355. padding: 4px !important;
  356. }
  357. .disabledBox {
  358. display: flex;
  359. align-items: center;
  360. }
  361. .meetSize {
  362. font-size: 16px;
  363. color: #54BCBD;
  364. }
  365. .fontSize {
  366. font-size: 16px;
  367. color: #81B337;
  368. }
  369. </style>