detailsPage.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  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;" size="small" @click="submit">提 交
  11. </el-button>
  12. <el-button class="el-button--small-yh" style="margin-left: 6px;" type="primary" size="small"
  13. @click="save" :disabled="form.approvalStatus == '审核提交'">保 存
  14. </el-button>
  15. </div>
  16. </div>
  17. <div style="margin-top: 50px">
  18. <trade-card title="基础信息">
  19. <avue-form :option="optionForm" v-model="form" ref="form">
  20. <template slot="menuForm">
  21. <el-button icon="el-icon-search" type="primary"
  22. :disabled="data.length > 0 || form.approvalStatus == '审核提交'"
  23. @click="searchChange">获取配置信息</el-button>
  24. <el-button icon="el-icon-search" type="success"
  25. :disabled="data.length == 0 || form.approvalStatus == '审核提交'"
  26. @click="getData">获取原始信息</el-button>
  27. </template>
  28. </avue-form>
  29. </trade-card>
  30. <trade-card title="字段明细">
  31. <avue-crud :option="option" :data="data" id="out-table" ref="crud" @selection-change="selectionChange"
  32. v-model="rowFrom" @row-update="rowUpdate"
  33. @resetColumn="resetColumn('crud', 'option', 'optionBack', 415)"
  34. @saveColumn="saveColumn('crud', 'option', 'optionBack', 415)">
  35. <template slot-scope="{type,size,row,index}" slot="menu">
  36. <el-button size="small" type="text" icon="el-icon-edit"
  37. @click.stop="$refs.crud.rowEdit(row, index)" :disabled="form.approvalStatus == '审核提交'">编 辑
  38. </el-button>
  39. <el-button size="small" icon="el-icon-delete" type="text" @click.stop="rowDel(row, index)"
  40. :disabled="form.approvalStatus == '审核提交'">删
  41. 除</el-button>
  42. </template>
  43. <template slot-scope="{type,disabled}" slot="fieldValueNewNameForm">
  44. <el-input v-if="rowFrom.fieldValueType == '输入框'" :disabled="disabled"
  45. v-model="rowFrom.fieldValueNewName"></el-input>
  46. <dic-select v-if="rowFrom.fieldValueType == '选择器' && rowFrom.queryType != '字典'"
  47. v-model="rowFrom.fieldValueNewName" key="id" res="records"
  48. :label="rowFrom.fieldValueRetrieval" :url="rowFrom.fieldValueUrl" :filterable="true"
  49. :remote="true" :dataName="rowFrom.fieldValueRetrieval" placeholder=""
  50. @selectChange="dicChange(rowFrom.fieldValueNewName, $event)"></dic-select>
  51. <dic-select v-if="rowFrom.fieldValueType == '选择器' && rowFrom.queryType == '字典'"
  52. v-model="rowFrom.fieldValueNewName" key="id" label="dictValue" keyValue="dictKey"
  53. :url="rowFrom.fieldValueUrl" placeholder=""
  54. @selectChange="dicChange('字典', $event)"></dic-select>
  55. </template>
  56. </avue-crud>
  57. </trade-card>
  58. </div>
  59. </div>
  60. </template>
  61. <script>
  62. import { getDetail, submit, getUpdate, removeItem, getItemDetail, checkUpdate } from "@/api/serviceConfiguration/modifyData"; import feeInfo from "@/components/tradeAgency/fee-info";
  63. import dicSelect from "@/components/dicSelect/main";
  64. import checkSchedule from "@/components/checkH/checkSchedule.vue";
  65. import businessReports from "@/components/tradeAgency/businessReports.vue";
  66. import reports from "@/components/tradeAgency/reports.vue";
  67. import { getDicinit } from "@/api/dicSelect/index";
  68. import _ from "lodash";
  69. export default {
  70. name: "detailsPage",
  71. data() {
  72. return {
  73. data: [],
  74. selectionList: [],
  75. form: {
  76. type: 2,
  77. updateItemList: []
  78. },
  79. rowFrom: {
  80. },
  81. optionForm: {
  82. // menuBtn: false,
  83. submitBtn: false,
  84. emptyBtn: false,
  85. span: 8,
  86. disabled: false,
  87. column: [
  88. {
  89. label: "业务类型",
  90. prop: "businessType",
  91. type: 'select',
  92. dicData: [{
  93. value: 'SE',
  94. label: '海运出口'
  95. }, {
  96. value: 'SI',
  97. label: '海运进口'
  98. }, {
  99. value: 'AE',
  100. label: '空运出口'
  101. }, {
  102. value: 'AI',
  103. label: '空运进口'
  104. }, {
  105. value: 'BGSE',
  106. label: '海运报关出口'
  107. }, {
  108. value: 'BGSI',
  109. label: '海运报关进口'
  110. }, {
  111. value: 'BGAE',
  112. label: '空运报关出口'
  113. }, {
  114. value: 'BGAI',
  115. label: '空运报关进口'
  116. }],
  117. rules: [{
  118. required: true,
  119. message: " ",
  120. trigger: "blur"
  121. }]
  122. },
  123. {
  124. label: "检索类型",
  125. prop: "retrievalType",
  126. type: 'select',
  127. dicData: [{
  128. value: '1',
  129. label: '业务单号'
  130. }, {
  131. value: '2',
  132. label: '提单号'
  133. }],
  134. rules: [{
  135. required: true,
  136. message: " ",
  137. trigger: "blur"
  138. }]
  139. },
  140. {
  141. label: "源单据单号",
  142. prop: "retrievalValue",
  143. rules: [{
  144. required: true,
  145. message: " ",
  146. trigger: "blur"
  147. }]
  148. },
  149. {
  150. label: "创建日期",
  151. prop: "createTime",
  152. disabled: true,
  153. },
  154. {
  155. label: "创建人",
  156. prop: "createUserName",
  157. disabled: true,
  158. },
  159. {
  160. label: "备注",
  161. prop: "remarks",
  162. }
  163. ]
  164. },
  165. option: {},
  166. optionBack: {
  167. height: 'auto',
  168. calcHeight: 30,
  169. menuWidth: 150,
  170. tip: false,
  171. border: true,
  172. addBtn: false,
  173. viewBtn: false,
  174. editBtn: false,
  175. delBtn: false,
  176. refreshBtn: false,
  177. selection: true,
  178. align: 'center',
  179. index: true,
  180. column: [
  181. {
  182. label: "更改时间",
  183. prop: "updateTime",
  184. overHidden: true,
  185. editDisplay: false,
  186. },
  187. {
  188. label: "字段描述",
  189. prop: "fieldDescribe",
  190. overHidden: true,
  191. editDisplay: false,
  192. },
  193. {
  194. label: "字段原值",
  195. prop: "fieldValueName",
  196. overHidden: true,
  197. editDisplay: false,
  198. rules: [
  199. {
  200. required: true,
  201. message: '',
  202. trigger: 'blur'
  203. }
  204. ]
  205. },
  206. {
  207. label: "字段新值",
  208. prop: "fieldValueNewName",
  209. span: 24,
  210. overHidden: true,
  211. rules: [
  212. {
  213. required: true,
  214. message: '',
  215. trigger: 'blur'
  216. }
  217. ]
  218. }
  219. ]
  220. },
  221. }
  222. },
  223. components: {
  224. dicSelect,
  225. feeInfo,
  226. checkSchedule,
  227. businessReports,
  228. reports
  229. },
  230. props: {
  231. detailData: Object
  232. },
  233. async created() {
  234. this.roleName = localStorage.getItem('roleName').split(',')
  235. this.saberUserInfo = JSON.parse(localStorage.getItem("saber-userInfo")).content
  236. this.option = await this.getColumnData(this.getColumnName(415), this.optionBack);
  237. if (this.$route.query.billId) {
  238. this.getDetails(this.$route.query.billId)
  239. }
  240. console.log(this.detailData.id, 123123)
  241. if (this.detailData.id) {
  242. this.getDetails(this.detailData.id)
  243. }
  244. },
  245. methods: {
  246. rowUpdate(row, index, done, loading) {
  247. done()
  248. console.log(row)
  249. if (row.fieldValueType == "选择器") {
  250. this.data[index].fieldValueNew = row.fieldValueNew
  251. this.data[index].fieldValueNewName = row.fieldValueNewName
  252. } else {
  253. this.data[index].fieldValueNew = row.fieldValueNewName
  254. this.data[index].fieldValueNewName = row.fieldValueNewName
  255. }
  256. },
  257. searchChange() {
  258. this.form.updateItemList = []
  259. getUpdate(this.form).then(res => {
  260. this.data = res.data.data.updateItemList
  261. })
  262. },
  263. getData() {
  264. this.$refs["form"].validate((valid, done) => {
  265. done();
  266. if (valid) {
  267. let obj = {
  268. ...this.form
  269. }
  270. delete obj.updateItemList
  271. getItemDetail(obj).then(res => {
  272. let obj = res.data.data
  273. this.data.forEach(row => {
  274. if (row.fieldValueType == '选择器') {
  275. row.fieldValue = obj[row.mainFieldId]
  276. row.fieldValueName = obj[row.mainFieldCname]
  277. } else {
  278. row.fieldValue = obj[row.field]
  279. row.fieldValueName = obj[row.field]
  280. }
  281. })
  282. })
  283. } else {
  284. return false;
  285. }
  286. });
  287. },
  288. dicChange(name, row) {
  289. if (name!='字典') {
  290. if (row) {
  291. this.rowFrom.fieldValueNew = row.id
  292. this.rowFrom.fieldValueNewName = row.cnName
  293. } else {
  294. this.rowFrom.fieldValueNew = null
  295. this.rowFrom.fieldValueNewName = null
  296. }
  297. }
  298. if (name == '字典') {
  299. if (row) {
  300. this.rowFrom.fieldValueNew = row.dictKey
  301. this.rowFrom.fieldValueNewName = row.dictValue
  302. } else {
  303. this.rowFrom.fieldValueNew = null
  304. this.rowFrom.fieldValueNewName = null
  305. }
  306. }
  307. },
  308. rowDel(row, index) {
  309. this.$confirm("确定删除数据?", {
  310. confirmButtonText: "确定",
  311. cancelButtonText: "取消",
  312. type: "warning"
  313. }).then(() => {
  314. if (row.id) {
  315. removeItem({ ids: row.id }).then(res => {
  316. this.data.splice(index, 1);
  317. this.$message.success("成功删除");
  318. })
  319. } else {
  320. this.data.splice(index, 1);
  321. }
  322. });
  323. },
  324. getDetails(id) {
  325. const loading = this.$loading({
  326. lock: true,
  327. text: '加载中',
  328. spinner: 'el-icon-loading',
  329. background: 'rgba(255,255,255,0.7)'
  330. });
  331. getDetail({ id: id }).then(res => {
  332. this.form = res.data.data
  333. this.data = res.data.data.updateItemList
  334. if (res.data.data.approvalStatus == "审核提交") {
  335. this.optionForm.disabled = true
  336. }
  337. }).finally(() => {
  338. loading.close()
  339. })
  340. },
  341. inEdit() {
  342. },
  343. save(type) {
  344. this.$refs["form"].validate((valid, done) => {
  345. done();
  346. if (valid) {
  347. const loading = this.$loading({
  348. lock: true,
  349. text: '加载中',
  350. spinner: 'el-icon-loading',
  351. background: 'rgba(255,255,255,0.7)'
  352. });
  353. this.form.updateItemList = this.data
  354. submit(this.form).then(res => {
  355. this.$message.success("保存成功");
  356. this.getDetails(res.data.data.id)
  357. }).finally(() => {
  358. loading.close();
  359. })
  360. } else {
  361. return false;
  362. }
  363. });
  364. },
  365. submit() {
  366. this.$refs["form"].validate((valid, done) => {
  367. done();
  368. if (valid) {
  369. for (let row of this.data) {
  370. if (!row.fieldValueNewName) {
  371. this.$refs.crud.rowCell(row, row.$index)
  372. return this.$message.error("请完善字段明细");
  373. }
  374. }
  375. this.$confirm('是否提交数据?', '提示', {
  376. confirmButtonText: '确定',
  377. cancelButtonText: '取消',
  378. type: 'warning'
  379. }).then(() => {
  380. let obj = {
  381. ...this.form,
  382. updateItemList: this.data,
  383. url: '/serviceConfiguration/modifyData/index',
  384. pageStatus: '',
  385. pageLabel: '修改数据',
  386. }
  387. const loading = this.$loading({
  388. lock: true,
  389. text: '加载中',
  390. spinner: 'el-icon-loading',
  391. background: 'rgba(255,255,255,0.7)'
  392. });
  393. checkUpdate(obj).then(res => {
  394. this.$message.success("保存成功");
  395. this.getDetails(res.data.data.id)
  396. }).finally(() => {
  397. loading.close();
  398. })
  399. })
  400. } else {
  401. return false;
  402. }
  403. });
  404. },
  405. //自定义列保存
  406. async saveColumn(ref, option, optionBack, code) {
  407. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  408. if (inSave) {
  409. this.$message.success("保存成功");
  410. //关闭窗口
  411. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  412. }
  413. },
  414. //自定义列重置
  415. async resetColumn(ref, option, optionBack, code) {
  416. this[option] = this[optionBack];
  417. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  418. if (inSave) {
  419. this.$message.success("重置成功");
  420. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  421. }
  422. },
  423. goBack(type) {
  424. this.$emit("goBack", type);
  425. },
  426. }
  427. }
  428. </script>
  429. <style lang="scss" scoped>
  430. ::v-deep .el-form-item {
  431. margin-bottom: 8px !important;
  432. }
  433. ::v-deep .el-table .cell {
  434. padding: 0 2px !important;
  435. .el-form-item {
  436. margin-bottom: 0px !important;
  437. }
  438. }
  439. ::v-deep .avue-crud .el-table .el-form-item__label {
  440. left: -1px;
  441. }
  442. ::v-deep#out-table .back-one {
  443. background: #ecf5ff !important;
  444. }
  445. ::v-deep#out-table .back-two {
  446. background: #ecf5ff !important;
  447. }
  448. ::v-deep .el-table--small td,
  449. .el-table--small th {
  450. padding: 2px !important;
  451. }
  452. ::v-deep .el-card__body {
  453. padding: 3px 10px;
  454. }
  455. </style>