index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <div class="page-container list-container">
  3. <!-- 功能按钮区 -->
  4. <div class="list-btns-container">
  5. <el-button type="primary" size="small" icon="Finished" :disabled="multiple" @click="handleUpdate"
  6. v-hasPermi="['business:bin:restore']">还原</el-button>
  7. <el-button type="danger" size="small" icon="Delete" :disabled="multiple" @click="handleDelete"
  8. v-hasPermi="['business:bin:remove']">删除</el-button>
  9. <el-button type="info" size="small" icon="Download" @click="handleExport"
  10. v-hasPermi="['business:bin:export']">导出</el-button>
  11. <!--<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>-->
  12. </div>
  13. <!-- 搜索区 -->
  14. <el-form class="list-search-container" size="small" :model="queryParams" ref="queryRef" :inline="true"
  15. label-width="68px">
  16. <el-form-item label="客户名称:" prop="sourceTableName">
  17. <el-input v-model="queryParams.sourceValue" placeholder="请输入客户名称" style="width: 150px" clearable
  18. @keyup.enter="handleQuery" />
  19. </el-form-item>
  20. <el-form-item>
  21. <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
  22. <el-button icon="Refresh" @click="resetQuery">重置</el-button>
  23. </el-form-item>
  24. </el-form>
  25. <!-- 列表区 -->
  26. <el-table v-loading="loading" :data="binList" size="small" border height="100%"
  27. @selection-change="handleSelectionChange">
  28. <el-table-column type="selection" width="55" align="center" />
  29. <!-- <el-table-column label="序号" align="center" type="index" /> -->
  30. <el-table-column label="客户名称" align="center" prop="sourceValue" />
  31. <!-- <el-table-column label="来源表" align="center" prop="sourceTableName" /> -->
  32. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  33. <template #default="scope">
  34. <el-button link type="primary" size="small" @click="handleUpdate(scope.row)"
  35. v-hasPermi="['business:bin:restore']">还原</el-button>
  36. <el-button link type="danger" size="small" @click="handleDelete(scope.row)"
  37. v-hasPermi="['business:bin:remove']">删除</el-button>
  38. </template>
  39. </el-table-column>
  40. </el-table>
  41. <!-- 分页 -->
  42. <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
  43. @pagination="getList" />
  44. <!-- 表单 -->
  45. <bin-form ref="binRef" :get-list="getList"></bin-form>
  46. </div>
  47. </template>
  48. <script setup name="Bin">
  49. import { listBin, delBin, restoreBin } from "@/api/business/bin";
  50. import binForm from "./form";
  51. const { proxy } = getCurrentInstance();
  52. /** 字典数组区 */
  53. /** 查询 对象 */
  54. const binList = ref([]);
  55. const loading = ref(true);
  56. const ids = ref([]);
  57. const single = ref(true);
  58. const multiple = ref(true);
  59. const total = ref(0);
  60. /** 查询对象 */
  61. const queryParams = ref({
  62. pageNum: 1,
  63. pageSize: 20,
  64. orderByColumn: "create_time",
  65. sourceTableName: null,
  66. sourceValue: null,
  67. isClean: null,
  68. isReturn: null,
  69. });
  70. /*********************** 方法区 ****************************/
  71. /** 查询回收站列表 */
  72. function getList() {
  73. loading.value = true;
  74. listBin(queryParams.value).then((response) => {
  75. binList.value = response.rows;
  76. total.value = response.total;
  77. loading.value = false;
  78. });
  79. }
  80. /** 搜索按钮操作 */
  81. function handleQuery() {
  82. queryParams.value.pageNum = 1;
  83. getList();
  84. }
  85. /** 重置按钮操作 */
  86. function resetQuery() {
  87. proxy.resetForm("queryRef");
  88. handleQuery();
  89. }
  90. // 多选框选中数据
  91. function handleSelectionChange(selection) {
  92. ids.value = selection.map((item) => item.id);
  93. single.value = selection.length != 1;
  94. multiple.value = !selection.length;
  95. }
  96. /** 新增按钮操作 */
  97. function handleAdd() {
  98. proxy.$refs.binRef.open();
  99. }
  100. /** 修改按钮操作 */
  101. function handleUpdate(row) {
  102. const _ids = row.id || ids.value;
  103. proxy.$modal
  104. .confirm("是否确认还原选中的数据项?")
  105. .then(function () {
  106. loading.value = true;
  107. return restoreBin(_ids);
  108. })
  109. .then(() => {
  110. getList();
  111. proxy.$modal.msgSuccess("还原成功!");
  112. })
  113. .catch(() => { });
  114. }
  115. /** 删除按钮操作 */
  116. function handleDelete(row) {
  117. const _ids = row.id || ids.value;
  118. proxy.$modal
  119. .confirm("删除数据项后不可恢复,是否确认删除选中的数据项?")
  120. .then(function () {
  121. return delBin(_ids);
  122. })
  123. .then(() => {
  124. getList();
  125. proxy.$modal.msgSuccess("删除成功!");
  126. })
  127. .catch(() => { });
  128. }
  129. /** 导出按钮操作 */
  130. function handleExport() {
  131. proxy.download(
  132. "business/bin/export",
  133. {
  134. ...queryParams.value,
  135. },
  136. `bin_${new Date().getTime()}.xlsx`
  137. );
  138. }
  139. getList();
  140. </script>