index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <template>
  2. <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title + '-列表', essential: true }]">
  3. <template slot-scope="{ activeKey, data }">
  4. <div
  5. :style="{
  6. width: '100%',
  7. height: activeKey == 'list' ? '100%' : '0px',
  8. overflow: 'hidden'
  9. }"
  10. >
  11. <template-page
  12. ref="pageRef"
  13. :get-list="getList"
  14. :table-attributes="tableAttributes"
  15. :table-events="tableEvents"
  16. :options-evens-group="optionsEvensGroup"
  17. :moreParameters="moreParameters"
  18. :column-parsing="columnParsing"
  19. :operationColumnWidth="180"
  20. :operation="operation()"
  21. >
  22. </template-page>
  23. </div>
  24. <div
  25. v-if="activeKey == 'view'"
  26. :style="{
  27. width: '100%',
  28. height: '100%',
  29. overflow: 'hidden'
  30. }"
  31. >
  32. <template-page
  33. ref="pageRef2"
  34. :operationColumnWidth="180"
  35. :table-attributes="tableAttributes2"
  36. :table-events="tableEvents2"
  37. :get-list="getList2"
  38. :exportList="exportList2"
  39. :options-evens-group="optionsEvensGroup2"
  40. :operation="operation2()"
  41. :moreParameters="moreParameters2"
  42. expCode="exp2"
  43. >
  44. </template-page>
  45. </div>
  46. </template>
  47. </zj-tab-page>
  48. </template>
  49. <script>
  50. import TemplatePage from '@/components/template/template-page-1.vue'
  51. import import_mixin from '@/components/template/import_mixin.js'
  52. import operation_mixin from '@/components/template/operation_mixin.js'
  53. import {
  54. dailySummaryReduceTotal,
  55. dailySummaryReduceDo,
  56. dailySummaryReduceDelete,
  57. dailySummaryReduceList,
  58. dailySummaryReduceListExport,
  59. dailySummaryReduceItemDo,
  60. dailySummaryReduceItemDelete
  61. } from '@/api/feesWillBeRefunded'
  62. import { dailySummaryOrderImport } from '@/api/settlementDataImport'
  63. export default {
  64. components: { TemplatePage },
  65. mixins: [import_mixin, operation_mixin],
  66. data() {
  67. return {
  68. // 表格属性
  69. tableAttributes: {
  70. // 启用勾选列
  71. selectColumn: true
  72. },
  73. // 表格事件
  74. tableEvents: {
  75. 'selection-change': this.selectionChange
  76. },
  77. // 勾选选中行
  78. recordSelected: [],
  79. // 表格属性
  80. tableAttributes2: {
  81. // 启用勾选列
  82. selectColumn: true
  83. },
  84. // 表格事件
  85. tableEvents2: {
  86. 'selection-change': this.selectionChange2
  87. },
  88. // 勾选选中行
  89. recordSelected2: [],
  90. // 表单
  91. formData: {},
  92. importBatchNo: ''
  93. }
  94. },
  95. computed: {
  96. // 更多参数
  97. moreParameters() {
  98. return [
  99. {
  100. name: '工单类型',
  101. key: 'doStatus',
  102. value: '',
  103. conditions: [
  104. {
  105. label: '全部',
  106. value: ''
  107. },
  108. {
  109. label: '未执行',
  110. value: '2'
  111. },
  112. {
  113. label: '已执行',
  114. value: '1'
  115. }
  116. ]
  117. }
  118. ]
  119. },
  120. moreParameters2() {
  121. return [
  122. {
  123. name: '工单类型',
  124. key: 'doStatus',
  125. value: '',
  126. conditions: [
  127. {
  128. label: '全部',
  129. value: ''
  130. },
  131. {
  132. label: '未执行',
  133. value: '2'
  134. },
  135. {
  136. label: '已执行',
  137. value: '1'
  138. }
  139. ]
  140. }
  141. ]
  142. },
  143. optionsEvensGroup() {
  144. return [
  145. [
  146. [
  147. this.optionsEvensAuth('import', ({ moduleName }) => {
  148. return {
  149. name: moduleName,
  150. render: () => {
  151. return this.importButton(dailySummaryOrderImport, moduleName, { type: 'reduce' })
  152. }
  153. }
  154. })
  155. ]
  156. ]
  157. ]
  158. },
  159. //
  160. optionsEvensGroup2() {
  161. return [
  162. [
  163. [
  164. this.optionsEvensAuth('batchExecute2', {
  165. click: () => {
  166. if (this.recordSelected2.length === 0) {
  167. this.$message.warning('请勾选')
  168. return
  169. }
  170. dailySummaryReduceItemDo({
  171. ids: this.recordSelected2.map(item => item.id).join(',')
  172. }).then(res => {
  173. this.$message({ type: 'success', message: '设置成功!' })
  174. this.$refs.pageRef2.refreshList()
  175. })
  176. }
  177. })
  178. ],
  179. [
  180. this.optionsEvensAuth('batchDel2', {
  181. click: () => {
  182. if (this.recordSelected2.length === 0) {
  183. this.$message.warning('请勾选')
  184. return
  185. }
  186. dailySummaryReduceItemDelete({
  187. ids: this.recordSelected2.map(item => item.id).join(',')
  188. }).then(res => {
  189. this.$message({ type: 'success', message: '删除成功!' })
  190. this.$refs.pageRef2.refreshList()
  191. })
  192. }
  193. })
  194. ]
  195. ]
  196. ]
  197. },
  198. formItems() {
  199. return []
  200. }
  201. },
  202. methods: {
  203. // 列表请求函数
  204. getList(p, cb) {
  205. var pam = JSON.parse(JSON.stringify(p))
  206. try {
  207. if (pam.doStatus) {
  208. pam.params.push({ param: 'a.do_status', compare: '=', value: pam.doStatus })
  209. }
  210. cb && cb(pam)
  211. return dailySummaryReduceTotal(pam)
  212. } catch (err) {}
  213. },
  214. getList2(p, cb) {
  215. var pam = JSON.parse(JSON.stringify(p))
  216. try {
  217. if (pam.doStatus) {
  218. pam.params.push({ param: 'a.do_status', compare: '=', value: pam.doStatus })
  219. }
  220. pam.params.push({ param: 'a.settlement_batch_no', compare: '=', value: this.importBatchNo })
  221. cb && cb(pam)
  222. return dailySummaryReduceList(pam)
  223. } catch (err) {}
  224. },
  225. // 列表导出函数
  226. exportList2: dailySummaryReduceListExport,
  227. // 表格列解析渲染数据更改
  228. columnParsing(item, defaultData) {
  229. return defaultData
  230. },
  231. // 监听勾选变化
  232. selectionChange(data) {
  233. this.recordSelected = data
  234. },
  235. selectionChange2(data) {
  236. this.recordSelected2 = data
  237. },
  238. operation() {
  239. return this.operationBtn({
  240. view: {
  241. click: ({ row, index, column }) => {
  242. this.importBatchNo = row.importBatchNo
  243. this.$refs.tabPage.addTab({
  244. // 对应显示的模块
  245. activeKey: 'view',
  246. // 唯一标识
  247. key: 'view',
  248. // 页签名称
  249. label: `明细-批次号:${this.importBatchNo}`,
  250. // 打开时事件
  251. triggerEvent: () => {},
  252. // 关闭时事件
  253. closeEvent: () => {}
  254. })
  255. }
  256. },
  257. execute: {
  258. conditions: ({ row, index, column }) => {
  259. return row.doStatus == '2'
  260. },
  261. prompt: '确定执行吗?',
  262. click: ({ row, index, column }) => {
  263. dailySummaryReduceDo({ importBatchNos: row.importBatchNo }).then(res => {
  264. this.$message({ type: 'success', message: '执行成功!' })
  265. this.$refs.pageRef.refreshList()
  266. })
  267. }
  268. },
  269. coverImport: {
  270. import: true,
  271. click: ({ row, index, column, file }) => {
  272. var formdata = new FormData()
  273. formdata.append('file', file)
  274. formdata.append('type', 'reduce')
  275. formdata.append('importBatchNo', row.importBatchNo)
  276. dailySummaryOrderImport({ formdata })
  277. .then(res => {
  278. this.$refs.pageRef.refreshList()
  279. this.$message({
  280. type: 'success',
  281. message: '导入成功!'
  282. })
  283. })
  284. .catch(err => {
  285. this.$message({
  286. type: 'error',
  287. message: err.message || '导入失败'
  288. })
  289. })
  290. }
  291. },
  292. del: {
  293. prompt: '确定删除吗?',
  294. click: ({ row, index, column }) => {
  295. dailySummaryReduceDelete({ importBatchNo: row.importBatchNo }).then(res => {
  296. this.$message({ type: 'success', message: '删除成功!' })
  297. this.$refs.pageRef.refreshList()
  298. })
  299. }
  300. }
  301. })
  302. },
  303. operation2() {
  304. return this.operationBtn({
  305. execute2: {
  306. conditions: ({ row, index, column }) => {
  307. return row.doStatus == '2'
  308. },
  309. prompt: '确定执行吗?',
  310. click: ({ row, index, column }) => {
  311. dailySummaryReduceItemDo({ ids: row.id }).then(res => {
  312. this.$message({ type: 'success', message: '设置成功!' })
  313. this.$refs.pageRef2.refreshList()
  314. })
  315. }
  316. },
  317. del2: {
  318. prompt: '确定删除吗?',
  319. click: ({ row, index, column }) => {
  320. dailySummaryReduceItemDelete({ ids: row.id }).then(res => {
  321. this.$message({ type: 'success', message: '删除成功!' })
  322. this.$refs.pageRef2.refreshList()
  323. })
  324. }
  325. }
  326. })
  327. }
  328. }
  329. }
  330. </script>
  331. <style lang="scss" scoped></style>