index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="统一社会信用代码" prop="uniCode" label-width="200">
  5. <el-input
  6. v-model="queryParams.uniCode"
  7. placeholder="请输入统一社会信用代码"
  8. clearable
  9. @keyup.enter="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item>
  13. <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
  14. <el-button icon="Refresh" @click="resetQuery">重置</el-button>
  15. </el-form-item>
  16. </el-form>
  17. <el-row :gutter="10" class="mb8">
  18. <el-col :span="1.5">
  19. <el-button
  20. type="warning"
  21. plain
  22. icon="Download"
  23. @click="handleExport"
  24. :disabled="!xcrPersonalRevokeRecordList.length"
  25. v-hasPermi="['basicData:xcrPersonalRevokeRecord:export']"
  26. >导出
  27. </el-button>
  28. </el-col>
  29. </el-row>
  30. <el-table v-loading="loading" :data="xcrPersonalRevokeRecordList" height="650" @selection-change="handleSelectionChange">
  31. <el-table-column label="统一社会信用代码" align="center" prop="uniCode" width="200"/>
  32. <el-table-column label="主体身份代码" align="center" prop="peId" :show-overflow-tooltip='true' width="150"/>
  33. <el-table-column label="${comment}" align="center" prop="PRIPID" :show-overflow-tooltip='true' width="150"/>
  34. <el-table-column label="吊销原因" align="center" prop="REVREA" :show-overflow-tooltip='true' width="150"/>
  35. <el-table-column label="吊销日期" align="center" prop="REVDATE" width="180">
  36. <template #default="scope">
  37. <span>{{ parseTime(scope.row.REVDATE, '{y}-{m}-{d}') }}</span>
  38. </template>
  39. </el-table-column>
  40. <el-table-column label="数据更新时间" align="center" prop="sExtDatatime" width="180">
  41. <template #default="scope">
  42. <span>{{ parseTime(scope.row.sExtDatatime, '{y}-{m}-{d}') }}</span>
  43. </template>
  44. </el-table-column>
  45. </el-table>
  46. <div style="position: fixed;bottom: 20px;right: 10px;">
  47. <pagination
  48. v-show="total>0"
  49. :total="total"
  50. v-model:page="queryParams.pageNum"
  51. v-model:limit="queryParams.pageSize"
  52. @pagination="getList"
  53. />
  54. </div>
  55. <el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
  56. <el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
  57. :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
  58. :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
  59. <el-icon class="el-icon--upload">
  60. <upload-filled/>
  61. </el-icon>
  62. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  63. <template #tip>
  64. <div class="el-upload__tip text-center">
  65. <span>仅允许导入xls、xlsx格式文件。</span>
  66. </div>
  67. </template>
  68. </el-upload>
  69. <template #footer>
  70. <div class="dialog-footer">
  71. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  72. <el-button @click="upload.open = false">取 消</el-button>
  73. </div>
  74. </template>
  75. </el-dialog>
  76. </div>
  77. </template>
  78. <script setup name="Record">
  79. import {
  80. listRecord,
  81. getRecord,
  82. delRecord,
  83. delRecordBatch
  84. } from "@/api/basicData/xcrPersonalRevokeRecord";
  85. import {reactive, ref, toRaw} from "vue";
  86. import {getToken} from "@/utils/auth";
  87. import {ElMessage} from "element-plus";
  88. import {likeQueryMethod} from "@/utils/likeQueryMethod";
  89. const {proxy} = getCurrentInstance();
  90. const xcrPersonalRevokeRecordList = ref([]);
  91. const open = ref(false);
  92. const loading = ref(true);
  93. const showSearch = ref(true);
  94. const ids = ref([]);
  95. const single = ref(true);
  96. const multiple = ref(true);
  97. const total = ref(0);
  98. const title = ref("");
  99. const upload = reactive({
  100. // 是否显示弹出层(用户导入)
  101. open: false,
  102. // 弹出层标题(用户导入)
  103. title: '',
  104. // 是否禁用上传
  105. isUploading: false,
  106. // 设置上传的请求头部
  107. headers: {Authorization: getToken()},
  108. // 上传的地址
  109. url: import.meta.env.VITE_APP_BASE_API + '/xcrPersonalRevokeRecord/importData'
  110. })
  111. const handleFileSuccess = (e) => {
  112. if (e.code == 200) {
  113. ElMessage({
  114. type: "success",
  115. message: e.msg
  116. })
  117. getList()
  118. proxy.$refs['uploadRef']?.clearFiles()
  119. } else {
  120. ElMessage({
  121. type: "error",
  122. message: e.msg
  123. })
  124. proxy.$refs['uploadRef']?.clearFiles()
  125. }
  126. }
  127. function submitFileForm() {
  128. proxy.$refs['uploadRef']?.submit();
  129. upload.open = false;
  130. }
  131. function handleImport() {
  132. upload.open = true
  133. }
  134. const data = reactive({
  135. form: {},
  136. queryParams: {
  137. pageNum: 1,
  138. pageSize: 20,
  139. peId: null,
  140. PRIPID: null,
  141. REVREA: null,
  142. REVDATE: null,
  143. sExtDatatime: null,
  144. uniCode: ''
  145. },
  146. rules: {
  147. }
  148. });
  149. const {queryParams, form, rules} = toRefs(data);
  150. /** 查询个体吊销信息列表 */
  151. function getList() {
  152. loading.value = true;
  153. let toServerObj = likeQueryMethod('uni_code', queryParams.value.uniCode, queryParams.value.pageNum, queryParams.value.pageSize);
  154. listRecord(toServerObj).then(response => {
  155. xcrPersonalRevokeRecordList.value = response.records;
  156. total.value = response.total;
  157. loading.value = false;
  158. });
  159. }
  160. // 表单重置
  161. function reset() {
  162. form.value = {
  163. xhCodeId: null,
  164. peId: null,
  165. PRIPID: null,
  166. REVREA: null,
  167. REVDATE: null,
  168. sExtDatatime: null,
  169. uniCode: ''
  170. };
  171. proxy.resetForm("xcrPersonalRevokeRecordRef");
  172. }
  173. /** 搜索按钮操作 */
  174. function handleQuery() {
  175. queryParams.value.pageNum = 1;
  176. getList();
  177. }
  178. /** 重置按钮操作 */
  179. function resetQuery() {
  180. proxy.resetForm("queryRef");
  181. handleQuery();
  182. }
  183. // 多选框选中数据
  184. function handleSelectionChange(selection) {
  185. ids.value = selection.map(item => item.xhCodeId);
  186. single.value = selection.length != 1;
  187. multiple.value = !selection.length;
  188. }
  189. /** 删除按钮操作 */
  190. async function handleDelete(row) {
  191. const res = await delRecord();
  192. if(res.code == 200){
  193. ElMessage({
  194. type:'success',
  195. message:'删除成功'
  196. })
  197. getList();
  198. }
  199. }
  200. /** 批量删除*/
  201. const batchDelete = (row)=>{
  202. const idsToS = row.xhCodeId || ids.value;
  203. (proxy.$modal).confirm('是否确认删除这' + idsToS.length+'条的数据项?').then(function() {
  204. return delRecordBatch(toRaw(idsToS));
  205. }).then(() => {
  206. getList();
  207. proxy.$modal.msgSuccess("删除成功");
  208. }).catch(() => {});
  209. }
  210. /** 导出按钮操作 */
  211. function handleExport() {
  212. proxy.download('basicData/xcrPersonalRevokeRecord/export', {
  213. ...queryParams.value
  214. }, `个体吊销信息_${new Date().getTime()}.xlsx`)
  215. }
  216. getList();
  217. </script>