credentials.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <div>
  3. <basic-container style="width: 25%;float: left">
  4. <avue-tree :option="getList" :data="accountList" @node-click="nodeClickTwo"/>
  5. </basic-container>
  6. <basic-container style="width: 15%;float: left">
  7. <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick"/>
  8. </basic-container>
  9. <basic-container style="width: 60%;float: right">
  10. <avue-crud
  11. :data="data"
  12. :option="option"
  13. :page.sync="page"
  14. @on-load="onLoad"
  15. @row-del="rowDel"
  16. @row-save="rowSave"
  17. @row-update="rowUpdate"
  18. @search-change="searchChange"
  19. @search-reset="searchReset"
  20. @refresh-change="refreshChange"
  21. ></avue-crud>
  22. </basic-container>
  23. </div>
  24. </template>
  25. <script>
  26. import {
  27. customerList,
  28. getAccountList,
  29. getDeptLazyTree,
  30. jdmoduleDelete,
  31. jdmoduleSave,
  32. jdmoduleUpdate
  33. } from '@/api/base/credentials'
  34. export default {
  35. name: "credentials",
  36. data() {
  37. return {
  38. page: {
  39. size: 10,
  40. current: 1
  41. },
  42. treeData: [],
  43. accountList: [],
  44. treeOption: {
  45. nodeKey: 'id',
  46. lazy: true,
  47. treeLoad: function (node, resolve) {
  48. const parentId = (node.level === 0) ? 0 : node.data.id;
  49. getDeptLazyTree(parentId).then(res => {
  50. resolve(res.data.data.map(item => {
  51. return {
  52. ...item,
  53. leaf: !item.hasChildren
  54. }
  55. }))
  56. });
  57. },
  58. addBtn: false,
  59. menu: false,
  60. size: 'small',
  61. props: {
  62. labelText: '标题',
  63. label: 'dictValue',
  64. value: 'dictValue',
  65. children: 'children'
  66. }
  67. },
  68. getList: {
  69. nodeKey: 'id',
  70. lazy: true,
  71. treeLoad: function (node, resolve) {
  72. const parentId = (node.level === 0) ? 0 : node.data.id;
  73. getAccountList(parentId).then(res => {
  74. resolve(res.data.data.map(item => {
  75. return {
  76. ...item,
  77. leaf: !item.hasChildren
  78. }
  79. }))
  80. });
  81. },
  82. addBtn: false,
  83. menu: false,
  84. size: 'small',
  85. props: {
  86. labelText: '标题',
  87. label: 'accountName',
  88. value: 'accountId',
  89. children: 'children'
  90. }
  91. },
  92. data: [],
  93. treeDeptName: '',
  94. accountId: '',
  95. option: {
  96. searchMenuPosition: "right",
  97. searchMenuSpan: 18,
  98. height:500,
  99. index: true,
  100. align: 'center',
  101. menuAlign: 'center',
  102. column: [
  103. {
  104. label: '模块名称',
  105. prop: 'module',
  106. type: "select",
  107. dicUrl: "/api/blade-system/dict-biz/dictionary?code=voucher_type",
  108. props: {
  109. label: "dictValue",
  110. value: "dictValue"
  111. }
  112. },
  113. {
  114. label: '业务币种',
  115. display: false,
  116. children: [{
  117. label: '币种代码',
  118. prop: 'currencyCode',
  119. type: "select",
  120. dicUrl: "/api/blade-system/dict-biz/dictionary?code=currency",
  121. props: {
  122. label: "dictValue",
  123. value: "dictValue"
  124. },
  125. rules: [{
  126. required: true,
  127. message: " ",
  128. trigger: "change"
  129. }],
  130. search: true
  131. }, {
  132. label: '币种名称',
  133. prop: 'currency',
  134. rules: [{
  135. required: true,
  136. message: " ",
  137. trigger: "blur"
  138. }]
  139. }]
  140. }, {
  141. label: '凭证类型',
  142. display: false,
  143. children: [{
  144. label: '凭证类型',
  145. prop: 'voucherType',
  146. rules: [{
  147. required: true,
  148. message: " ",
  149. trigger: "blur"
  150. }]
  151. }, {
  152. label: '凭证名称',
  153. prop: 'voucher',
  154. rules: [{
  155. required: true,
  156. message: " ",
  157. trigger: "blur"
  158. }]
  159. }]
  160. }, {
  161. label: '分录',
  162. display: false,
  163. children: [{
  164. label: '分录类型',
  165. prop: 'projectType',
  166. rules: [{
  167. required: true,
  168. message: " ",
  169. trigger: "blur"
  170. }]
  171. }, {
  172. label: '科目代码',
  173. prop: 'projectCode',
  174. rules: [{
  175. required: true,
  176. message: " ",
  177. trigger: "blur"
  178. }]
  179. }, {
  180. label: '科目名称',
  181. prop: 'projectName',
  182. rules: [{
  183. required: true,
  184. message: " ",
  185. trigger: "blur"
  186. }]
  187. }]
  188. }, {
  189. label: '金额方向',
  190. prop: 'accountName',
  191. rules: [{
  192. required: true,
  193. message: " ",
  194. trigger: "blur"
  195. }]
  196. }, {
  197. label: '摘要',
  198. display: false,
  199. children: [{
  200. label: '静态值',
  201. prop: 'abstractStatic',
  202. rules: [{
  203. required: true,
  204. message: " ",
  205. trigger: "blur"
  206. }]
  207. }, {
  208. label: '附加公式',
  209. prop: 'abstractFormula'
  210. }]
  211. }
  212. ]
  213. }
  214. }
  215. },
  216. methods: {
  217. //列表查询
  218. onLoad(page, params) {
  219. if (!this.accountId) return this.$message.warning('请选择套账')
  220. customerList({...params, size: page.size, current: page.current}, this.treeDeptName, this.accountId).then(res => {
  221. this.data = res.data.data.records
  222. this.page.total = res.data.data.total
  223. })
  224. },
  225. // 模块名称选中后触发列表查询
  226. nodeClick(data) {
  227. this.treeDeptName = data.dictValue;
  228. this.page.currentPage = 1;
  229. this.onLoad(this.page);
  230. },
  231. // 套账选中后触发列表查询
  232. nodeClickTwo(data) {
  233. this.accountId = data.accountId
  234. this.page.currentPage = 1;
  235. this.onLoad(this.page);
  236. },
  237. //刷新按钮触发
  238. refreshChange() {
  239. this.onLoad(this.page);
  240. },
  241. //表单搜索按钮触发
  242. searchChange(params, done) {
  243. this.page.currentPage = 1;
  244. this.onLoad(this.page, params);
  245. done()
  246. },
  247. //清空
  248. searchReset() {
  249. this.page.currentPage = 1;
  250. this.treeDeptName = this.accountId = ''
  251. this.onLoad(this.page);
  252. },
  253. //新增
  254. rowSave(row, done, loading) {
  255. jdmoduleSave(row).then(() => {
  256. this.$message.success('新增成功');
  257. loading()
  258. done()
  259. })
  260. },
  261. //编辑
  262. rowUpdate(row, index, done, loading) {
  263. jdmoduleUpdate(row).then(() => {
  264. this.$message.success('修改成功');
  265. this.onLoad(this.page);
  266. loading()
  267. done()
  268. })
  269. },
  270. //删除
  271. rowDel(row, index, done) {
  272. jdmoduleDelete(row.id).then(() => {
  273. this.$message.success('删除成功');
  274. done()
  275. })
  276. }
  277. }
  278. }
  279. </script>
  280. <style scoped>
  281. </style>