index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
  3. :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
  4. :operation="operation()" :exportList="exportList">
  5. <el-dialog title="" width="500px" custom-class="diy-dialog" append-to-body :modal="true" :visible.sync="formDialog"
  6. :show-close="true" :close-on-click-modal="false" :modal-append-to-body="false" :before-close="formCancel">
  7. <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
  8. <zj-form-module :title="formDialogTitles[formDialogType]" label-width="100px" :showPackUp="false"
  9. :form-data="formData" :form-items="formItems">
  10. </zj-form-module>
  11. </zj-form-container>
  12. <div slot="footer" class="dialog-footer">
  13. <el-button size="mini" @click="formCancel">取 消</el-button>
  14. <el-button size="mini" @click="formConfirm" type="primary">确 定</el-button>
  15. </div>
  16. </el-dialog>
  17. </template-page>
  18. </template>
  19. <script>
  20. import TemplatePage from '@/components/template/template-page-1.vue'
  21. import import_mixin from '@/components/template/import_mixin.js'
  22. import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
  23. import { orderShareListPageV2, orderSharePageExport, settlement, saveRemark } from "@/api/settlement";
  24. import operation_mixin from '@/components/template/operation_mixin.js'
  25. export default {
  26. components: { TemplatePage },
  27. mixins: [import_mixin,operation_mixin],
  28. data() {
  29. return {
  30. // 事件组合
  31. optionsEvensGroup: [],
  32. // 表格属性
  33. tableAttributes: {
  34. // 启用勾选列
  35. selectColumn: false
  36. },
  37. // 表格事件
  38. tableEvents: {
  39. 'selection-change': this.selectionChange
  40. },
  41. // 勾选选中行
  42. recordSelected: [],
  43. /** 表单变量 */
  44. formDialogType: 0,
  45. formDialogTitles: ["备注"],
  46. formDialog: false,
  47. formData: {
  48. remark: '',
  49. },
  50. }
  51. },
  52. computed: {
  53. // 更多参数
  54. moreParameters() {
  55. return []
  56. },
  57. formItems() {
  58. return [{
  59. md: 24,
  60. isShow: true,
  61. name: 'el-input',
  62. attributes: { placeholder: '请输入', type: "textarea", maxlength: "100" },
  63. formItemAttributes: {
  64. label: '备注',
  65. prop: 'remark',
  66. rules: [...required]
  67. }
  68. }]
  69. }
  70. },
  71. methods: {
  72. // 列表请求函数
  73. getList: orderShareListPageV2,
  74. // 列表导出函数
  75. exportList: orderSharePageExport,
  76. // 表格列解析渲染数据更改
  77. columnParsing(item, defaultData) {
  78. return defaultData
  79. },
  80. // 监听勾选变化
  81. selectionChange(data) {
  82. this.recordSelected = data
  83. },
  84. // 表格操作列
  85. operation() {
  86. return this.operationBtn({
  87. remark: {
  88. btnType: 'text',
  89. click: ({ row, index, column }) => {
  90. Object.assign(this.formData, row)
  91. this.formDialogType = 0
  92. this.openForm()
  93. }
  94. },
  95. account: {
  96. conditions: ({ row, index, column }) => {
  97. return row.orderStatus === 'OVER' && ~["EXCEPTION", "ING"].indexOf(row.status)
  98. },
  99. btnType: 'text',
  100. prompt: '是否确定结算?',
  101. click: ({ row, index, column }) => {
  102. settlement({
  103. orderId: row.orderId
  104. }).then(res => {
  105. this.$message({ type: 'success', message: `结算成功!` })
  106. this.$refs.pageRef.refreshList()
  107. })
  108. }
  109. },
  110. })
  111. },
  112. openForm() {
  113. this.formDialog = true;
  114. },
  115. formCancel() {
  116. this.$refs.formRef.$refs.inlineForm.clearValidate()
  117. this.$data.formData = this.$options.data().formData
  118. this.formDialog = false
  119. },
  120. formConfirm() {
  121. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  122. if (valid) {
  123. ([saveRemark][this.formDialogType])(this.formData).then(res => {
  124. this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
  125. this.formCancel()
  126. this.$refs.pageRef.refreshList()
  127. })
  128. }
  129. })
  130. }
  131. }
  132. }
  133. </script>
  134. <style lang="scss" scoped></style>