detailsPage.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  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(0)">返回列表
  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. @click="submit">保 存
  12. </el-button>
  13. </div>
  14. </div>
  15. <div style="margin-top: 50px">
  16. <trade-card title="基础信息">
  17. <avue-form :option="optionForm" v-model="form" ref="form">
  18. </avue-form>
  19. </trade-card>
  20. <trade-card title="字段明细">
  21. <avue-crud :option="option" :data="form.updateItemList" id="out-table" ref="crud"
  22. @selection-change="selectionChange" @select="selectHandle" @row-update="rowUpdate"
  23. @resetColumn="resetColumn('crud', 'option', 'optionBack', 417)"
  24. @saveColumn="saveColumn('crud', 'option', 'optionBack', 417)">
  25. <template slot="indexHeader" slot-scope="{row,index}">
  26. <el-button type="primary" size="mini" icon="el-icon-plus" :disabled="editDisabled" circle
  27. @click="addRow()">
  28. </el-button>
  29. </template>
  30. <template slot="index" slot-scope="{row,index}">
  31. <span>{{ index + 1 }}</span>
  32. </template>
  33. <template slot-scope="{row,index}" slot="menu">
  34. <el-button size="small" type="text" icon="el-icon-edit" @click.stop="rowEdit(row)">编 辑
  35. </el-button>
  36. <el-button size="small" icon="el-icon-delete" type="text" @click.stop="rowDel(row, index)">删
  37. 除</el-button>
  38. </template>
  39. </avue-crud>
  40. </trade-card>
  41. </div>
  42. </div>
  43. </template>
  44. <script>
  45. import { getDetail, submit, getUpdate, checkUpdate, removeItem } from "@/api/serviceConfiguration/modifyData"; import feeInfo from "@/components/tradeAgency/fee-info";
  46. import dicSelect from "@/components/dicSelect/main";
  47. import checkSchedule from "@/components/checkH/checkSchedule.vue";
  48. import businessReports from "@/components/tradeAgency/businessReports.vue";
  49. import reports from "@/components/tradeAgency/reports.vue";
  50. import { getDicinit } from "@/api/dicSelect/index";
  51. import _ from "lodash";
  52. export default {
  53. name: "detailsPage",
  54. data() {
  55. return {
  56. data: [],
  57. selectionList: [],
  58. form: {
  59. type: 1,
  60. updateItemList: []
  61. },
  62. optionForm: {
  63. // menuBtn: false,
  64. submitBtn: false,
  65. emptyBtn: false,
  66. span: 8,
  67. disabled: false,
  68. column: [
  69. {
  70. label: "业务类型",
  71. prop: "businessType",
  72. type: 'select',
  73. dicData: [{
  74. value: 'SE',
  75. label: '海运出口'
  76. }, {
  77. value: 'SI',
  78. label: '海运进口'
  79. }, {
  80. value: 'AE',
  81. label: '空运出口'
  82. }, {
  83. value: 'AI',
  84. label: '空运进口'
  85. }, {
  86. value: 'BGSE',
  87. label: '海运报关出口'
  88. }, {
  89. value: 'BGSI',
  90. label: '海运报关进口'
  91. }, {
  92. value: 'BGAE',
  93. label: '空运报关出口'
  94. }, {
  95. value: 'BGAI',
  96. label: '空运报关进口'
  97. }],
  98. rules: [{
  99. required: true,
  100. message: " ",
  101. trigger: "blur"
  102. }]
  103. },
  104. {
  105. label: "创建日期",
  106. prop: "createTime",
  107. disabled: true,
  108. },
  109. {
  110. label: "创建人",
  111. prop: "createUserName",
  112. disabled: true,
  113. },
  114. {
  115. label: "备注",
  116. prop: "remarks",
  117. }
  118. ]
  119. },
  120. option: {},
  121. optionBack: {
  122. height: 'auto',
  123. calcHeight: 30,
  124. menuWidth: 150,
  125. tip: false,
  126. border: true,
  127. addBtn: false,
  128. viewBtn: false,
  129. editBtn: false,
  130. delBtn: false,
  131. refreshBtn: false,
  132. selection: true,
  133. align: 'center',
  134. column: [
  135. {
  136. label: "index",
  137. prop: "index",
  138. width: "55",
  139. headerslot: true,
  140. },
  141. {
  142. label: "字段描述",
  143. prop: "fieldDescribe",
  144. overHidden: true,
  145. width: "100",
  146. cell: true,
  147. rules: [
  148. {
  149. required: true,
  150. message: '',
  151. trigger: 'blur'
  152. }
  153. ]
  154. },
  155. {
  156. label: "字段",
  157. prop: "field",
  158. overHidden: true,
  159. width: "100",
  160. cell: true,
  161. rules: [
  162. {
  163. required: true,
  164. message: '',
  165. trigger: 'blur'
  166. }
  167. ]
  168. },
  169. {
  170. label: "字段类型",
  171. prop: "fieldType",
  172. overHidden: true,
  173. width: "100",
  174. cell: true,
  175. type: "select",
  176. dicUrl: "/api/blade-system/dict-biz/dictionary?code=field_type",
  177. props: {
  178. label: "dictValue",
  179. value: "dictKey"
  180. },
  181. rules: [
  182. {
  183. required: true,
  184. message: '请选择商品类别',
  185. trigger: 'blur'
  186. }
  187. ]
  188. },
  189. {
  190. label: "字段值类型",
  191. prop: "fieldValueType",
  192. cell: true,
  193. overHidden: true,
  194. width: "100",
  195. type: 'select',
  196. dicData: [{
  197. label: '输入框',
  198. value: '输入框'
  199. }, {
  200. label: '选择器',
  201. value: '选择器'
  202. }],
  203. rules: [
  204. {
  205. required: true,
  206. message: '请选择商品类别',
  207. trigger: 'blur'
  208. }
  209. ]
  210. },
  211. {
  212. label: "数据地址",
  213. prop: "fieldValueUrl",
  214. cell: true,
  215. width: "100",
  216. overHidden: true
  217. },
  218. {
  219. label: "选择器绑定值",
  220. prop: "fieldValueRetrieval",
  221. cell: true,
  222. width: "100",
  223. overHidden: true
  224. },
  225. {
  226. label: "查询类型",
  227. prop: "queryType",
  228. cell: true,
  229. width: "100",
  230. overHidden: true,
  231. type: 'select',
  232. dicData: [{
  233. label: '字典',
  234. value: '字典'
  235. }, {
  236. label: '客户',
  237. value: '客户'
  238. }, {
  239. label: '国家',
  240. value: '国家'
  241. }, {
  242. label: '船名',
  243. value: '船名'
  244. }, {
  245. label: '包装',
  246. value: '包装'
  247. }, {
  248. label: '费用',
  249. value: '费用'
  250. }, {
  251. label: '箱型',
  252. value: '箱型'
  253. }, {
  254. label: '服务条款',
  255. value: '服务条款'
  256. }, {
  257. label: '成交方式',
  258. value: '成交方式'
  259. }, {
  260. label: '航线',
  261. value: '航线'
  262. }, {
  263. label: '货物',
  264. value: '货物'
  265. }, {
  266. label: '港口',
  267. value: '港口'
  268. }, {
  269. label: '业务员',
  270. value: '业务员'
  271. }, {
  272. label: '业务来源',
  273. value: '业务来源'
  274. }],
  275. },
  276. {
  277. label: "id字段",
  278. prop: "mainFieldId",
  279. cell: true,
  280. width: "100",
  281. overHidden: true
  282. },
  283. {
  284. label: "编码字段",
  285. prop: "mainFieldCode",
  286. cell: true,
  287. width: "100",
  288. overHidden: true
  289. },
  290. {
  291. label: "中文字段",
  292. prop: "mainFieldCname",
  293. cell: true,
  294. width: "100",
  295. overHidden: true
  296. },
  297. {
  298. label: "id字段",
  299. prop: "mainFieldId",
  300. cell: true,
  301. width: "100",
  302. overHidden: true
  303. },
  304. {
  305. label: "编码字段",
  306. prop: "mainFieldCode",
  307. cell: true,
  308. width: "100",
  309. overHidden: true
  310. },
  311. {
  312. label: "修改表",
  313. prop: "surface",
  314. overHidden: true,
  315. width: "170",
  316. cell: true,
  317. type: "select",
  318. dicUrl: "/api/blade-system/dict-biz/dictionary?code=modify_table",
  319. props: {
  320. label: "dictValue",
  321. value: "dictKey"
  322. },
  323. multiple: true,
  324. dataType: "string",
  325. tags: true,
  326. rules: [
  327. {
  328. required: true,
  329. message: '请选择商品类别',
  330. trigger: 'blur'
  331. }
  332. ]
  333. },
  334. {
  335. label: "状态(是否启用)",
  336. prop: "status",
  337. overHidden: true,
  338. width: "100",
  339. cell: true,
  340. type: 'select',
  341. dicData: [{
  342. label: '是',
  343. value: 1
  344. }, {
  345. label: '否',
  346. value: 0
  347. }],
  348. rules: [
  349. {
  350. required: true,
  351. message: '请选择商品类别',
  352. trigger: 'blur'
  353. }
  354. ]
  355. },
  356. {
  357. label: "英文字段",
  358. prop: "mainFieldEname",
  359. cell: true,
  360. width: "100",
  361. overHidden: true
  362. },
  363. {
  364. label: "amends id字段",
  365. prop: "amendsFieldId",
  366. width: "100",
  367. cell: true,
  368. overHidden: true
  369. },
  370. {
  371. label: "amends 编码字段",
  372. prop: "amendsFieldCode",
  373. width: "110",
  374. cell: true,
  375. overHidden: true
  376. },
  377. {
  378. label: "amends 中文字段",
  379. prop: "amendsFieldCname",
  380. width: "110",
  381. cell: true,
  382. overHidden: true
  383. },
  384. {
  385. label: "amends 英文字段",
  386. prop: "amendsFieldEname",
  387. width: "110",
  388. cell: true,
  389. overHidden: true
  390. },
  391. {
  392. label: "费用中心 id字段",
  393. prop: "feeCenterFieldId",
  394. width: "120",
  395. cell: true,
  396. overHidden: true
  397. },
  398. {
  399. label: "费用中心 编码字段",
  400. prop: "feeCenterFieldCode",
  401. width: "120",
  402. cell: true,
  403. overHidden: true
  404. },
  405. {
  406. label: "费用中心 中文字段",
  407. prop: "feeCenterFieldCname",
  408. width: "120",
  409. cell: true,
  410. overHidden: true
  411. },
  412. {
  413. label: "费用中心 英文字段",
  414. prop: "feeCenterFieldEname",
  415. width: "120",
  416. cell: true,
  417. overHidden: true
  418. },
  419. {
  420. label: "账单中心 id字段",
  421. prop: "finAccBillsFieldId",
  422. width: "120",
  423. cell: true,
  424. overHidden: true
  425. },
  426. {
  427. label: "账单中心 编码字段",
  428. prop: "finAccBillsFieldCode",
  429. width: "120",
  430. cell: true,
  431. overHidden: true
  432. },
  433. {
  434. label: "账单中心 中文字段",
  435. prop: "finAccBillsFieldCname",
  436. width: "120",
  437. cell: true,
  438. overHidden: true
  439. },
  440. {
  441. label: "账单中心 英文字段",
  442. prop: "finAccBillsFieldEname",
  443. width: "120",
  444. cell: true,
  445. overHidden: true
  446. },
  447. // {
  448. // label: "关联字段",
  449. // prop: "relationField",
  450. // cell: true,
  451. // overHidden: true,
  452. // },
  453. {
  454. label: "创建人",
  455. prop: "createUserName",
  456. width: "100",
  457. overHidden: true,
  458. },
  459. {
  460. label: "备注",
  461. prop: "remarks",
  462. width: "100",
  463. cell: true,
  464. overHidden: true,
  465. }
  466. ]
  467. },
  468. }
  469. },
  470. components: {
  471. dicSelect,
  472. feeInfo,
  473. checkSchedule,
  474. businessReports,
  475. reports
  476. },
  477. props: {
  478. detailData: Object
  479. },
  480. async created() {
  481. this.roleName = localStorage.getItem('roleName').split(',')
  482. this.saberUserInfo = JSON.parse(localStorage.getItem("saber-userInfo")).content
  483. this.option = await this.getColumnData(this.getColumnName(417), this.optionBack);
  484. if (this.detailData.id) {
  485. this.getDetails(this.detailData.id)
  486. }
  487. },
  488. methods: {
  489. addRow() {
  490. this.$refs["form"].validate((valid, done) => {
  491. done();
  492. if (valid) {
  493. this.form.updateItemList.push({ $cellEdit: true })
  494. this.$refs.crud.dicInit();
  495. }
  496. })
  497. },
  498. rowEdit(row) {
  499. console.log(row)
  500. if (row.$cellEdit == true) {
  501. this.$set(row, "$cellEdit", false);
  502. } else {
  503. this.$set(row, "$cellEdit", true);
  504. }
  505. },
  506. getDetails(id) {
  507. const loading = this.$loading({
  508. lock: true,
  509. text: '加载中',
  510. spinner: 'el-icon-loading',
  511. background: 'rgba(255,255,255,0.7)'
  512. });
  513. getDetail({ id: id }).then(res => {
  514. this.form = res.data.data
  515. this.$refs.crud.dicInit();
  516. }).finally(() => {
  517. loading.close()
  518. })
  519. },
  520. rowDel(row, index) {
  521. this.$confirm("确定删除数据?", {
  522. confirmButtonText: "确定",
  523. cancelButtonText: "取消",
  524. type: "warning"
  525. }).then(() => {
  526. if (row.id) {
  527. removeItem({ ids: row.id }).then(res => {
  528. this.form.updateItemList.splice(index, 1);
  529. this.$message.success("成功删除");
  530. })
  531. } else {
  532. this.form.updateItemList.splice(index, 1);
  533. }
  534. });
  535. },
  536. submit(type) {
  537. this.$refs["form"].validate((valid, done) => {
  538. done();
  539. if (valid) {
  540. for (let row of this.form.updateItemList) {
  541. if (!row.fieldDescribe || !row.field || !row.fieldType || !row.fieldValueType) {
  542. this.$refs.crud.rowCell(row, row.$index)
  543. return this.$message.error("请完善字段明细");
  544. }
  545. if (row.fieldValueType == '选择器') {
  546. if (!row.fieldValueUrl || !row.fieldValueRetrieval || !row.queryType || !row.mainFieldId || !row.mainFieldCname) {
  547. return this.$message.error("请完善选择器类型的数据地址、选择器绑定值、查询类型、id字段、中文字段");
  548. }
  549. }
  550. }
  551. const loading = this.$loading({
  552. lock: true,
  553. text: '加载中',
  554. spinner: 'el-icon-loading',
  555. background: 'rgba(255,255,255,0.7)'
  556. });
  557. submit(this.form).then(res => {
  558. this.$message.success("保存成功");
  559. this.getDetails(res.data.data.id)
  560. }).finally(() => {
  561. loading.close();
  562. })
  563. } else {
  564. return false;
  565. }
  566. });
  567. },
  568. //自定义列保存
  569. async saveColumn(ref, option, optionBack, code) {
  570. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  571. if (inSave) {
  572. this.$message.success("保存成功");
  573. //关闭窗口
  574. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  575. }
  576. },
  577. //自定义列重置
  578. async resetColumn(ref, option, optionBack, code) {
  579. this[option] = this[optionBack];
  580. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  581. if (inSave) {
  582. this.$message.success("重置成功");
  583. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  584. }
  585. },
  586. goBack(type) {
  587. this.$emit("goBack", type);
  588. },
  589. }
  590. }
  591. </script>
  592. <style lang="scss" scoped>
  593. ::v-deep .el-form-item {
  594. margin-bottom: 8px !important;
  595. }
  596. ::v-deep .el-table .cell {
  597. padding: 0 2px !important;
  598. .el-form-item {
  599. margin-bottom: 0px !important;
  600. }
  601. }
  602. ::v-deep .avue-crud .el-table .el-form-item__label {
  603. left: -1px;
  604. }
  605. ::v-deep#out-table .back-one {
  606. background: #ecf5ff !important;
  607. }
  608. ::v-deep#out-table .back-two {
  609. background: #ecf5ff !important;
  610. }
  611. ::v-deep .el-table--small td,
  612. .el-table--small th {
  613. padding: 2px !important;
  614. }
  615. ::v-deep .el-card__body {
  616. padding: 3px 10px;
  617. }
  618. </style>