index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <template-page
  3. ref="pageRef"
  4. :getList="getList"
  5. :exportList="exportList"
  6. :columnParsing="columnParsing"
  7. :optionsEvensGroup="optionsEvensGroup"
  8. :tableAttributes="tableAttributes"
  9. :tableEvents="tableEvents"
  10. :operation="operation()"
  11. :operationColumnWidth="140"
  12. :moreParameters="moreParameters"
  13. :defaultSearchData="defaultSearchData"
  14. >
  15. <website-outside-new-parts-to-sales-information
  16. v-if="showFromBool"
  17. v-bind="fromPm"
  18. @success="$refs.pageRef.refreshList"
  19. @goBack="
  20. bool => {
  21. showFromBool = false
  22. if (bool === true) {
  23. this.$refs.pageRef.refreshList()
  24. }
  25. }
  26. "
  27. />
  28. </template-page>
  29. </template>
  30. <script>
  31. import TemplatePage from '@/components/template/template-page-1.vue'
  32. import WebsiteOutsideNewPartsToSalesInformation from './components/website-outside-new-parts-to-sales-information.vue'
  33. import {
  34. workerOldRefundList,
  35. workerOldRefundRefund,
  36. WorkerOldRefundListExport,
  37. workerOldRefundTransferFlag
  38. } from '@/api/material-system/website/website-parts-worker-refund-manage'
  39. import { importSettlementStateImport } from '@/api/material-system/center/center-shop-settlement-record'
  40. import { commonTemplateDownload } from '@/api/common.js'
  41. import import_mixin from '@/components/template/import_mixin.js'
  42. import operation_mixin from '@/components/template/operation_mixin.js'
  43. export default {
  44. components: { TemplatePage, WebsiteOutsideNewPartsToSalesInformation },
  45. mixins: [import_mixin, operation_mixin],
  46. data() {
  47. return {
  48. // 表格属性
  49. tableAttributes: {},
  50. // 表格事件
  51. tableEvents: {},
  52. showFromBool: false,
  53. fromPm: {},
  54. defaultSearchData: []
  55. }
  56. },
  57. computed: {
  58. moreParameters() {
  59. return [
  60. {
  61. name: '单据状态',
  62. key: 'flag',
  63. value: this?.$route?.params?.pageCode || '',
  64. conditions: [
  65. {
  66. label: '全部',
  67. value: ''
  68. },
  69. {
  70. label: '驳回',
  71. value: 'REJECT'
  72. },
  73. {
  74. label: '已复核',
  75. value: 'REVIEWED'
  76. },
  77. {
  78. label: '已返还',
  79. value: 'REFUNDED'
  80. },
  81. {
  82. label: '待复核',
  83. value: 'WAIT_REVIEW'
  84. },
  85. {
  86. label: '提交',
  87. value: 'SUBMIT'
  88. },
  89. {
  90. label: '未返还',
  91. value: 'NOTREFUND'
  92. },
  93. {
  94. label: '通过',
  95. value: 'AGREE'
  96. },
  97. {
  98. label: '保存',
  99. value: 'SAVE'
  100. }
  101. ]
  102. }
  103. ]
  104. },
  105. optionsEvensGroup() {
  106. return [
  107. [
  108. [
  109. this.optionsEvensAuth('add', ({ moduleName }) => {
  110. return {
  111. name: moduleName,
  112. render: () => {
  113. return this.importButton(importSettlementStateImport, moduleName, {
  114. flag: 1
  115. })
  116. }
  117. }
  118. })
  119. ],
  120. [
  121. this.optionsEvensAuth('daorude', {
  122. click: () => {
  123. commonTemplateDownload({ name: '更新配件结算状态模板.xlsx' }, `更新配件结算状态模板`)
  124. .then(res => {
  125. this.$message({
  126. message: '下载成功',
  127. type: 'success'
  128. })
  129. })
  130. .catch(err => {
  131. this.$message.error('下载失败')
  132. })
  133. }
  134. })
  135. ]
  136. ]
  137. ]
  138. }
  139. },
  140. created() {
  141. if (this?.$route?.params?.pageType == 'flag' && this?.$route?.params?.pageCode) {
  142. this.defaultSearchData = [
  143. {
  144. param: `a.${this?.$route?.params?.pageType}`,
  145. compare: '=',
  146. value: this?.$route?.params?.pageCode,
  147. label: this?.$route?.params?.pageName
  148. }
  149. ]
  150. }
  151. },
  152. methods: {
  153. // 列表请求函数
  154. getList(p, cb) {
  155. var pam = JSON.parse(JSON.stringify(p))
  156. try {
  157. if (pam.flag) {
  158. var item = pam.params.find(item => item.param == 'a.flag')
  159. if (item) {
  160. item.compare = '='
  161. item.value = pam.flag
  162. } else {
  163. pam.params.push({ param: 'a.flag', compare: '=', value: pam.flag })
  164. }
  165. }
  166. pam.params.push({ param: 'a.repair_flag', compare: '=', value: 'OUTSIDE' })
  167. cb && cb(pam)
  168. return workerOldRefundList(pam)
  169. } catch (err) {}
  170. },
  171. // 列表导出函数
  172. exportList(data, name) {
  173. var p = JSON.parse(JSON.stringify(data))
  174. p.params.push({
  175. compare: '=',
  176. param: 'a.repair_flag',
  177. value: 'OUTSIDE'
  178. })
  179. return WorkerOldRefundListExport(p, name)
  180. },
  181. // 表格列解析渲染数据更改
  182. columnParsing(item, defaultData) {
  183. return defaultData
  184. },
  185. operation() {
  186. return this.operationBtn({
  187. view: {
  188. click: ({ row, index, column }) => {
  189. this.fromPm = {
  190. type: 2,
  191. item: { ...row }
  192. }
  193. this.showFromBool = true
  194. }
  195. },
  196. convert: {
  197. conditions: ({ row, index, column }) => {
  198. return ~['SAVE'].indexOf(row.flag)
  199. },
  200. click: ({ row, index, column }) => {
  201. this.transferFlag(row)
  202. }
  203. },
  204. edit: {
  205. conditions: ({ row, index, column }) => {
  206. return ~['SUBMIT', 'WAIT_REVIEW'].indexOf(row.flag)
  207. },
  208. click: ({ row, index, column }) => {
  209. this.fromPm = {
  210. type: 1,
  211. apiType: ~['SUBMIT'].indexOf(row.flag) ? 1 : ~['WAIT_REVIEW'].indexOf(row.flag) ? 2 : null,
  212. item: { ...row }
  213. }
  214. this.showFromBool = true
  215. }
  216. }
  217. })
  218. },
  219. // 确认返还
  220. confirmBack(row) {
  221. workerOldRefundRefund({
  222. applyNo: row.applyNo,
  223. flag: 'AGREE'
  224. })
  225. .then(res => {
  226. this.$message({
  227. type: 'success',
  228. message: `设置成功!`
  229. })
  230. this.$refs.pageRef.refreshList()
  231. })
  232. .catch(err => {
  233. console.log(err)
  234. })
  235. },
  236. transferFlag(row) {
  237. workerOldRefundTransferFlag({
  238. applyNo: row.applyNo
  239. })
  240. .then(res => {
  241. this.$message({
  242. type: 'success',
  243. message: `转换成功,请到“旧件返还管理”检查差价!`
  244. })
  245. this.$refs.pageRef.refreshList()
  246. })
  247. .catch(err => {
  248. console.log(err)
  249. })
  250. }
  251. }
  252. }
  253. </script>
  254. <style lang="scss" scoped></style>