detailsPage.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  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="backToList(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="info" size="small"
  11. :disabled="isSave || form.status != 1" @click="inRevoke">撤 销
  12. </el-button>
  13. <el-button class="el-button--small-yh" style="margin-left: 6px;" type="success" size="small"
  14. :disabled="isSave || form.status != 0 || !form.id" @click="inConfirm">确 认
  15. </el-button>
  16. <el-button class="el-button&#45;&#45;small-yh" style="margin-left: 6px;" type="primary" size="small"
  17. v-if="isSave" @click="inEdit">编 辑
  18. </el-button>
  19. <el-button class="el-button--small-yh" v-else style="margin-left: 6px;" type="primary" size="small"
  20. :disabled="isSave" @click="submit">保 存
  21. </el-button>
  22. </div>
  23. </div>
  24. <div style="margin-top: 50px">
  25. <trade-card title="基础信息">
  26. <avue-form :option="optionForm" v-model="form" ref="form">
  27. </avue-form>
  28. </trade-card>
  29. </div>
  30. </div>
  31. </template>
  32. <script>
  33. import {
  34. getDetails,
  35. submit, confirming, revoke
  36. } from "@/api/tirePartsMall/financingManagement/balanceRecharge";
  37. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  38. import dicSelect from "@/components/dicSelect/main";
  39. import _ from "lodash";
  40. export default {
  41. name: "detailsPage",
  42. data() {
  43. return {
  44. isSave: false,
  45. editButton: false,
  46. loading: false,
  47. // 商品列表数据合计
  48. tableData: [],
  49. // tabs切换
  50. data: [],
  51. isStatus: 1,
  52. goodsIdoptions: [],
  53. dataList: [],
  54. key: 0,
  55. form: {
  56. status: 0
  57. },
  58. customerData: [], // 客户数据
  59. optionForm: {
  60. menuBtn: false,
  61. span: 8,
  62. disabled: false,
  63. column: [
  64. {
  65. label: '金额',
  66. prop: "amount",
  67. overHidden: true,
  68. },
  69. {
  70. label: '单号',
  71. prop: "sysNo",
  72. disabled: true,
  73. },
  74. {
  75. label: '状态',
  76. prop: "status",
  77. type: 'select',
  78. dicData: [{
  79. label: '已确认',
  80. value: 1
  81. }, {
  82. label: '录入',
  83. value: 0
  84. }],
  85. disabled: true
  86. },
  87. {
  88. label: '确认人',
  89. prop: "confirmingPersonName",
  90. search: true,
  91. overHidden: true,
  92. type: 'select',
  93. filterable: true,
  94. remote: true,
  95. props: {
  96. label: 'cname',
  97. value: 'cname',
  98. res: 'data.records'
  99. },
  100. dicUrl: '/api/blade-sales-part/corpsDesc/list?current=1&size=20&corpType=GYS&cname={{key}}',
  101. disabled: true,
  102. },
  103. {
  104. label: "确认时间",
  105. prop: "confirmingPersonDate",
  106. type: "date",
  107. format: "yyyy-MM-dd",
  108. valueFormat: "yyyy-MM-dd HH:mm:ss",
  109. disabled: true,
  110. },
  111. {
  112. label: "制单人",
  113. prop: "createUserName",
  114. disabled: true
  115. },
  116. {
  117. label: "制单日期",
  118. prop: "createTime",
  119. type: "date",
  120. format: "yyyy-MM-dd",
  121. valueFormat: "yyyy-MM-dd HH:mm:ss",
  122. disabled: true
  123. },
  124. {
  125. label: "更新人",
  126. prop: "updateUserName",
  127. disabled: true
  128. },
  129. {
  130. label: "更新日期",
  131. prop: "updateTime",
  132. type: "date",
  133. format: "yyyy-MM-dd",
  134. valueFormat: "yyyy-MM-dd HH:mm:ss",
  135. disabled: true
  136. },
  137. {
  138. label: '备注',
  139. prop: "remarks",
  140. type: 'textarea',
  141. disabled: false,
  142. span: 24,
  143. minRows: 2
  144. }]
  145. },
  146. optionContacts: {},
  147. optionContactsBack: {
  148. disabled: false,
  149. border: true,
  150. align: 'center',
  151. index: true,
  152. height: 500,
  153. addRowBtn: false,
  154. addBtn: false,
  155. editBtn: false,
  156. delBtn: false,
  157. column: [
  158. {
  159. label: '来源类型',
  160. prop: 'type',
  161. overHidden: true,
  162. },
  163. {
  164. label: '来源单号',
  165. prop: 'srcNo',
  166. overHidden: true,
  167. },
  168. {
  169. label: '金额',
  170. prop: 'amount',
  171. overHidden: true,
  172. },
  173. {
  174. label: '配资比例',
  175. prop: 'proportion',
  176. overHidden: true,
  177. },
  178. {
  179. label: "制单人",
  180. prop: "createUserName",
  181. overHidden: true,
  182. },
  183. {
  184. label: "制单日期",
  185. prop: "createTime",
  186. type: "date",
  187. format: "yyyy-MM-dd",
  188. valueFormat: "yyyy-MM-dd HH:mm:ss",
  189. overHidden: true,
  190. },
  191. {
  192. label: "更新人",
  193. prop: "updateUserName",
  194. overHidden: true,
  195. },
  196. {
  197. label: "更新日期",
  198. prop: "updateTime",
  199. type: "date",
  200. format: "yyyy-MM-dd",
  201. valueFormat: "yyyy-MM-dd HH:mm:ss",
  202. overHidden: true,
  203. },
  204. {
  205. label: "备注",
  206. prop: "remarks",
  207. overHidden: true,
  208. }
  209. ]
  210. }
  211. }
  212. },
  213. components: { SearchQuery, dicSelect },
  214. props: {
  215. onLoad: Object,
  216. detailData: Object
  217. },
  218. async created() {
  219. this.optionContacts = await this.getColumnData(this.getColumnName(404), this.optionContactsBack);
  220. if (this.detailData.id) {
  221. this.editButton = true
  222. this.optionForm.disabled = true
  223. this.isSave = true
  224. this.getDetail(this.detailData.id)
  225. }
  226. if (this.$route.query.srcId) {
  227. this.editButton = true
  228. this.optionForm.disabled = true
  229. this.isSave = true
  230. this.getDetail(this.$route.query.srcId)
  231. }
  232. },
  233. methods: {
  234. inEdit() {
  235. this.editButton = false
  236. if (this.form.status == 1) {
  237. this.optionForm.disabled = true
  238. } else {
  239. this.optionForm.disabled = false
  240. }
  241. this.isSave = false
  242. },
  243. dicChange(name, row) {
  244. if (name == 'confirmingPersonName') {
  245. if (row) {
  246. this.form.confirmingPersonId = row.id
  247. } else {
  248. this.form.confirmingPersonId = null
  249. }
  250. }
  251. },
  252. //修改提交触发
  253. submit() {
  254. this.$refs["form"].validate((valid, done) => {
  255. done();
  256. if (valid) {
  257. this.mingxibaocun = true
  258. const loading = this.$loading({
  259. lock: true,
  260. text: '加载中',
  261. spinner: 'el-icon-loading',
  262. background: 'rgba(255,255,255,0.7)'
  263. });
  264. submit({ ...this.form }).then(res => {
  265. this.$message.success("保存成功");
  266. this.getDetail(res.data.data.id)
  267. }).finally(() => {
  268. loading.close();
  269. })
  270. } else {
  271. return false;
  272. }
  273. });
  274. },
  275. getDetail(id, type) {
  276. const loading = this.$loading({
  277. lock: true,
  278. text: '加载中',
  279. spinner: 'el-icon-loading',
  280. background: 'rgba(255,255,255,0.7)'
  281. })
  282. getDetails({ id: id }).then(res => {
  283. this.form = res.data.data
  284. if (res.data.data.status == 1) {
  285. this.optionForm.disabled = true
  286. } else {
  287. this.optionForm.disabled = false
  288. }
  289. }).finally(() => {
  290. loading.close();
  291. })
  292. },
  293. inRevoke() {
  294. revoke(this.form).then(res => {
  295. this.editButton = false
  296. this.optionForm.disabled = false
  297. this.$message.success("撤销成功");
  298. this.getDetail(this.form.id)
  299. })
  300. },
  301. inConfirm() {
  302. confirming(this.form).then(res => {
  303. this.editButton = true
  304. this.optionForm.disabled = true
  305. this.$message.success("确认成功");
  306. this.getDetail(this.form.id)
  307. })
  308. },
  309. //自定义列保存
  310. async saveColumnTwo(ref, option, optionBack, code) {
  311. /**
  312. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  313. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  314. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  315. */
  316. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  317. if (inSave) {
  318. this.$message.success("保存成功");
  319. //关闭窗口
  320. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  321. }
  322. },
  323. //自定义列重置
  324. async resetColumnTwo(ref, option, optionBack, code) {
  325. this[option] = this[optionBack];
  326. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  327. if (inSave) {
  328. this.$message.success("重置成功");
  329. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  330. }
  331. },
  332. backToList(type) {
  333. this.$emit("backToList", type);
  334. },
  335. }
  336. }
  337. </script>
  338. <style lang="scss" scoped>
  339. ::v-deep .el-form-item {
  340. margin-bottom: 8px !important;
  341. }
  342. </style>