index.vue 7.9 KB

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