add-or-update.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <div>
  3. <el-dialog
  4. title="提示"
  5. :visible.sync="dialogVisible"
  6. width="80%"
  7. @close="close"
  8. >
  9. <span>
  10. <el-table
  11. :data="tableData"
  12. style="width: 100%"
  13. @selection-change="selectionChange"
  14. >
  15. <el-table-column
  16. type="selection"
  17. width="50"
  18. :selectable="selectable"
  19. />
  20. <el-table-column label="序号" type="index" width="50" />
  21. <el-table-column
  22. v-for="(item, index) in tableOption"
  23. :key="index"
  24. :label="item.name"
  25. :width="item.width"
  26. :prop="item.label"
  27. align="center"
  28. :fixed="item.fixed"
  29. :show-overflow-tooltip="true"
  30. >
  31. </el-table-column>
  32. </el-table>
  33. <pagination
  34. v-show="page.total > 0"
  35. :total="page.total"
  36. :page.sync="page.pageNum"
  37. :limit.sync="page.pageSize"
  38. @pagination="getList"
  39. />
  40. </span>
  41. <span slot="footer" class="dialog-footer">
  42. <el-button @click="dialogVisible = false">取 消</el-button>
  43. <el-button type="primary" @click="importDate">导 入</el-button>
  44. </span>
  45. </el-dialog>
  46. </div>
  47. </template>
  48. <script>
  49. import { tableOption2 } from "./js/index";
  50. import { contrastList } from "@/api/finance/kaihe/payment";
  51. export default {
  52. data() {
  53. return {
  54. form: {},
  55. dialogVisible: false,
  56. tableOption: tableOption2,
  57. page: {
  58. pageNum: 1,
  59. pageSize: 10,
  60. total: 0,
  61. },
  62. selectionList: [],
  63. tableData: [],
  64. checkList: [],
  65. };
  66. },
  67. components: {},
  68. created() {},
  69. methods: {
  70. selectable(row) {
  71. if (this.checkList.some((e) => e.fSrcid == row.fSrcid)) {
  72. return false;
  73. } else {
  74. return true;
  75. }
  76. },
  77. init(data, list) {
  78. this.checkList = list;
  79. this.dialogVisible = true;
  80. this.form = data;
  81. this.getList();
  82. },
  83. getList() {
  84. const data = {
  85. ...this.form,
  86. pageNum: this.page.pageNum,
  87. pageSize: this.page.pageSize,
  88. };
  89. contrastList(data).then((res) => {
  90. res.rows.map((e) => {
  91. e.srcBillNo = e.fMblno;
  92. });
  93. this.tableData = res.rows;
  94. this.page.total = res.total;
  95. });
  96. },
  97. selectionChange(rows) {
  98. this.selectionList = rows;
  99. },
  100. importDate() {
  101. if (this.selectionList.length == 0) {
  102. return this.$message.error("请选择数据");
  103. }
  104. this.dialogVisible = false;
  105. this.$emit("imporData", this.selectionList);
  106. },
  107. close() {
  108. this.form = this.$options.data().form;
  109. this.tableData = this.$options.data().tableData;
  110. this.page = this.$options.data().page;
  111. },
  112. },
  113. };
  114. </script>
  115. <style lang="scss" scoped></style>