index.vue 7.9 KB

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