detailsPage.vue 22 KB

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