index.vue 5.3 KB

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