detailsPage.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  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. },
  267. {
  268. label: "id字段",
  269. prop: "mainFieldId",
  270. cell: true,
  271. width: "100",
  272. overHidden: true
  273. },
  274. {
  275. label: "编码字段",
  276. prop: "mainFieldCode",
  277. cell: true,
  278. width: "100",
  279. overHidden: true
  280. },
  281. {
  282. label: "中文字段",
  283. prop: "mainFieldCname",
  284. cell: true,
  285. width: "100",
  286. overHidden: true
  287. },
  288. {
  289. label: "修改表",
  290. prop: "surface",
  291. overHidden: true,
  292. width: "170",
  293. cell: true,
  294. type: "select",
  295. dicUrl: "/api/blade-system/dict-biz/dictionary?code=modify_table",
  296. props: {
  297. label: "dictValue",
  298. value: "dictKey"
  299. },
  300. multiple: true,
  301. dataType: "string",
  302. tags: true,
  303. rules: [
  304. {
  305. required: true,
  306. message: '请选择商品类别',
  307. trigger: 'blur'
  308. }
  309. ]
  310. },
  311. {
  312. label: "状态(是否启用)",
  313. prop: "status",
  314. overHidden: true,
  315. width: "100",
  316. cell: true,
  317. type: 'select',
  318. dicData: [{
  319. label: '是',
  320. value: 1
  321. }, {
  322. label: '否',
  323. value: 0
  324. }],
  325. rules: [
  326. {
  327. required: true,
  328. message: '请选择商品类别',
  329. trigger: 'blur'
  330. }
  331. ]
  332. },
  333. {
  334. label: "英文字段",
  335. prop: "mainFieldEname",
  336. cell: true,
  337. width: "100",
  338. overHidden: true
  339. },
  340. {
  341. label: "amends id字段",
  342. prop: "amendsFieldId",
  343. width: "100",
  344. cell: true,
  345. overHidden: true
  346. },
  347. {
  348. label: "amends 编码字段",
  349. prop: "amendsFieldCode",
  350. width: "110",
  351. cell: true,
  352. overHidden: true
  353. },
  354. {
  355. label: "amends 中文字段",
  356. prop: "amendsFieldCname",
  357. width: "110",
  358. cell: true,
  359. overHidden: true
  360. },
  361. {
  362. label: "amends 英文字段",
  363. prop: "amendsFieldEname",
  364. width: "110",
  365. cell: true,
  366. overHidden: true
  367. },
  368. {
  369. label: "费用中心 id字段",
  370. prop: "feeCenterFieldId",
  371. width: "120",
  372. cell: true,
  373. overHidden: true
  374. },
  375. {
  376. label: "费用中心 编码字段",
  377. prop: "feeCenterFieldCode",
  378. width: "120",
  379. cell: true,
  380. overHidden: true
  381. },
  382. {
  383. label: "费用中心 中文字段",
  384. prop: "feeCenterFieldCname",
  385. width: "120",
  386. cell: true,
  387. overHidden: true
  388. },
  389. {
  390. label: "费用中心 英文字段",
  391. prop: "feeCenterFieldEname",
  392. width: "120",
  393. cell: true,
  394. overHidden: true
  395. },
  396. {
  397. label: "账单中心 id字段",
  398. prop: "finAccBillsFieldId",
  399. width: "120",
  400. cell: true,
  401. overHidden: true
  402. },
  403. {
  404. label: "账单中心 编码字段",
  405. prop: "finAccBillsFieldCode",
  406. width: "120",
  407. cell: true,
  408. overHidden: true
  409. },
  410. {
  411. label: "账单中心 中文字段",
  412. prop: "finAccBillsFieldCname",
  413. width: "120",
  414. cell: true,
  415. overHidden: true
  416. },
  417. {
  418. label: "账单中心 英文字段",
  419. prop: "finAccBillsFieldEname",
  420. width: "120",
  421. cell: true,
  422. overHidden: true
  423. },
  424. // {
  425. // label: "关联字段",
  426. // prop: "relationField",
  427. // cell: true,
  428. // overHidden: true,
  429. // },
  430. {
  431. label: "创建人",
  432. prop: "createUserName",
  433. width: "100",
  434. overHidden: true,
  435. },
  436. {
  437. label: "备注",
  438. prop: "remarks",
  439. width: "100",
  440. overHidden: true,
  441. }
  442. ]
  443. },
  444. }
  445. },
  446. components: {
  447. dicSelect,
  448. feeInfo,
  449. checkSchedule,
  450. businessReports,
  451. reports
  452. },
  453. props: {
  454. detailData: Object
  455. },
  456. async created() {
  457. this.roleName = localStorage.getItem('roleName').split(',')
  458. this.saberUserInfo = JSON.parse(localStorage.getItem("saber-userInfo")).content
  459. this.option = await this.getColumnData(this.getColumnName(417), this.optionBack);
  460. if (this.detailData.id) {
  461. this.getDetails(this.detailData.id)
  462. }
  463. },
  464. methods: {
  465. addRow() {
  466. this.$refs["form"].validate((valid, done) => {
  467. done();
  468. if (valid) {
  469. this.form.updateItemList.push({ $cellEdit: true })
  470. this.$refs.crud.dicInit();
  471. }
  472. })
  473. },
  474. rowEdit(row) {
  475. console.log(row)
  476. if (row.$cellEdit == true) {
  477. this.$set(row, "$cellEdit", false);
  478. } else {
  479. this.$set(row, "$cellEdit", true);
  480. }
  481. },
  482. getDetails(id) {
  483. const loading = this.$loading({
  484. lock: true,
  485. text: '加载中',
  486. spinner: 'el-icon-loading',
  487. background: 'rgba(255,255,255,0.7)'
  488. });
  489. getDetail({ id: id }).then(res => {
  490. this.form = res.data.data
  491. this.$refs.crud.dicInit();
  492. }).finally(() => {
  493. loading.close()
  494. })
  495. },
  496. rowDel(row, index) {
  497. this.$confirm("确定删除数据?", {
  498. confirmButtonText: "确定",
  499. cancelButtonText: "取消",
  500. type: "warning"
  501. }).then(() => {
  502. if (row.id) {
  503. removeItem({ ids: row.id }).then(res => {
  504. this.form.updateItemList.splice(index, 1);
  505. this.$message.success("成功删除");
  506. })
  507. } else {
  508. this.form.updateItemList.splice(index, 1);
  509. }
  510. });
  511. },
  512. submit(type) {
  513. this.$refs["form"].validate((valid, done) => {
  514. done();
  515. if (valid) {
  516. for (let row of this.form.updateItemList) {
  517. if (!row.fieldDescribe || !row.field || !row.fieldType || !row.fieldValueType) {
  518. this.$refs.crud.rowCell(row, row.$index)
  519. return this.$message.error("请完善字段明细");
  520. }
  521. if (row.fieldValueType == '选择器') {
  522. if (!row.fieldValueUrl || !row.fieldValueRetrieval || !row.queryType || !row.mainFieldId || !row.mainFieldCname) {
  523. return this.$message.error("请完善选择器类型的数据地址、选择器绑定值、查询类型、id字段、中文字段");
  524. }
  525. }
  526. }
  527. const loading = this.$loading({
  528. lock: true,
  529. text: '加载中',
  530. spinner: 'el-icon-loading',
  531. background: 'rgba(255,255,255,0.7)'
  532. });
  533. submit(this.form).then(res => {
  534. this.$message.success("保存成功");
  535. this.getDetails(res.data.data.id)
  536. }).finally(() => {
  537. loading.close();
  538. })
  539. } else {
  540. return false;
  541. }
  542. });
  543. },
  544. //自定义列保存
  545. async saveColumn(ref, option, optionBack, code) {
  546. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  547. if (inSave) {
  548. this.$message.success("保存成功");
  549. //关闭窗口
  550. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  551. }
  552. },
  553. //自定义列重置
  554. async resetColumn(ref, option, optionBack, code) {
  555. this[option] = this[optionBack];
  556. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  557. if (inSave) {
  558. this.$message.success("重置成功");
  559. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  560. }
  561. },
  562. goBack(type) {
  563. this.$emit("goBack", type);
  564. },
  565. }
  566. }
  567. </script>
  568. <style lang="scss" scoped>
  569. ::v-deep .el-form-item {
  570. margin-bottom: 8px !important;
  571. }
  572. ::v-deep .el-table .cell {
  573. padding: 0 2px !important;
  574. .el-form-item {
  575. margin-bottom: 0px !important;
  576. }
  577. }
  578. ::v-deep .avue-crud .el-table .el-form-item__label {
  579. left: -1px;
  580. }
  581. ::v-deep#out-table .back-one {
  582. background: #ecf5ff !important;
  583. }
  584. ::v-deep#out-table .back-two {
  585. background: #ecf5ff !important;
  586. }
  587. ::v-deep .el-table--small td,
  588. .el-table--small th {
  589. padding: 2px !important;
  590. }
  591. ::v-deep .el-card__body {
  592. padding: 3px 10px;
  593. }
  594. </style>