index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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="unifiedSocialCreditCode" label-width="200">
  5. <el-input
  6. v-model="queryParams.unifiedSocialCreditCode"
  7. placeholder="请输入企业代码"
  8. clearable
  9. @keyup.enter="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="企业名称" prop="enterpriseName" label-width="200">
  13. <el-input
  14. v-model="queryParams.enterpriseName"
  15. placeholder="请输入企业名称"
  16. clearable
  17. @keyup.enter="handleQuery"
  18. />
  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. <el-row :gutter="10" class="mb8">
  26. <!-- <el-col :span="1.5">-->
  27. <!-- <el-popconfirm-->
  28. <!-- title="你确定清除所有数据?"-->
  29. <!-- confirm-button-text="是的"-->
  30. <!-- cancel-button-text="不是"-->
  31. <!-- :icon="InfoFilled"-->
  32. <!-- icon-color="#626AEF"-->
  33. <!-- @confirm="handleDelete"-->
  34. <!-- >-->
  35. <!-- <template #reference>-->
  36. <!-- <el-button-->
  37. <!-- type="danger"-->
  38. <!-- plain-->
  39. <!-- icon="Delete"-->
  40. <!-- v-hasPermi="['basicData:reporting:remove']"-->
  41. <!-- >清除全表-->
  42. <!-- </el-button>-->
  43. <!-- </template>-->
  44. <!-- </el-popconfirm>-->
  45. <!-- </el-col>-->
  46. <el-col :span="1.5">
  47. <el-button
  48. type="danger"
  49. plain
  50. icon="Delete"
  51. @click="batchDelete"
  52. v-hasPermi="['basicData:reporting:remove']"
  53. :disabled="ids.length === 0"
  54. >批量删除
  55. </el-button>
  56. </el-col>
  57. <!-- <el-col :span="1.5">-->
  58. <!-- <el-button-->
  59. <!-- type="warning"-->
  60. <!-- plain-->
  61. <!-- icon="Download"-->
  62. <!-- @click="handleExport"-->
  63. <!-- :disabled="!reportingList.length"-->
  64. <!-- v-hasPermi="['basicData:reporting:export']"-->
  65. <!-- >导出-->
  66. <!-- </el-button>-->
  67. <!-- </el-col>-->
  68. <!-- <el-col :span="1.5">-->
  69. <!-- <el-button type="info" plain icon="Upload" @click="handleImport"-->
  70. <!-- v-hasPermi="['system:user:import']">导入-->
  71. <!-- </el-button>-->
  72. <!-- </el-col>-->
  73. <!-- <el-col :span="1.5">-->
  74. <!-- <el-button type="success" plain icon="Download" @click="downloadTemplate">-->
  75. <!-- 下载导入模板-->
  76. <!-- </el-button>-->
  77. <!-- </el-col>-->
  78. </el-row>
  79. <el-table v-loading="loading" :data="reportingList" height="650" @selection-change="handleSelectionChange">
  80. <el-table-column type="selection" width="55" align="center"/>
  81. <el-table-column label="企业代码" align="center" prop="unifiedSocialCreditCode" width="200"/>
  82. <el-table-column label="企业名称" align="center" prop="enterpriseName" :show-overflow-tooltip='true'/>
  83. <el-table-column label="联系人" align="center" prop="contacts" :show-overflow-tooltip='true'/>
  84. <el-table-column label="联系方式" align="center" prop="contactInformation" :show-overflow-tooltip='true'/>
  85. <el-table-column label="上报人身份证号" align="center" prop="complainantIdNumber" :show-overflow-tooltip='true'/>
  86. <el-table-column label="操作" align="center">
  87. <!-- <template #default="scope">-->
  88. <!-- <el-popover placement="bottom" :width="400" trigger="click">-->
  89. <!-- <template #reference>-->
  90. <!-- <el-button style="margin-right: 16px">查看文件</el-button>-->
  91. <!-- </template>-->
  92. <!-- <div v-for="(item,index) in scope.row.files" :key="index">-->
  93. <!-- <div style="display: flex;justify-content: space-between">-->
  94. <!-- <div style="width: 80%">{{item.fileOriginalName}}</div>-->
  95. <!-- <div style="cursor: pointer">下载</div>-->
  96. <!-- </div>-->
  97. <!-- </div>-->
  98. <!-- </el-popover>-->
  99. <!-- </template>-->
  100. <template #default="scope">
  101. <el-button type="primary" @click="checkDownloadFile(scope.row.files)">查看文件</el-button>
  102. </template>
  103. </el-table-column>
  104. </el-table>
  105. <el-dialog v-model="dialogTableVisible" title="查看文件" width="500px" :align-center="true">
  106. <template #default>
  107. <el-table :data="downloadFileList" border>
  108. <el-table-column prop="fileOriginalName" label="文件名" width="380"/>
  109. <el-table-column label="下载" width="80">
  110. <template #default="scope">
  111. <el-button type="primary" @click="downloadFile(scope.row)" size="small">下载</el-button>
  112. </template>
  113. </el-table-column>
  114. </el-table>
  115. </template>
  116. </el-dialog>
  117. <div style="position: fixed;bottom: 20px;right: 10px;">
  118. <pagination
  119. v-show="total>0"
  120. :total="total"
  121. v-model:page="queryParams.pageNum"
  122. v-model:limit="queryParams.pageSize"
  123. @pagination="getList"
  124. />
  125. </div>
  126. <el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
  127. <el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
  128. :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
  129. :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
  130. <el-icon class="el-icon--upload">
  131. <upload-filled/>
  132. </el-icon>
  133. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  134. <template #tip>
  135. <div class="el-upload__tip text-center">
  136. <span>仅允许导入xls、xlsx格式文件。</span>
  137. </div>
  138. </template>
  139. </el-upload>
  140. <template #footer>
  141. <div class="dialog-footer">
  142. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  143. <el-button @click="upload.open = false">取 消</el-button>
  144. </div>
  145. </template>
  146. </el-dialog>
  147. <!-- 添加或修改官网自主上报对话框 -->
  148. </div>
  149. </template>
  150. <script setup name="Reporting">
  151. import {
  152. listReporting,
  153. getReporting,
  154. delReporting,
  155. delReportingBatch
  156. } from "@/api/basicData/reporting";
  157. import {reactive, ref, toRaw} from "vue";
  158. import {getToken} from "@/utils/auth";
  159. import {ElMessage} from "element-plus";
  160. import {likeQueryMethod} from "@/utils/likeQueryMethod";
  161. import {downloadFileMethod} from "@/utils/request";
  162. const {proxy} = getCurrentInstance();
  163. const downloadFileList = ref([]);
  164. const dialogTableVisible = ref(false);
  165. const reportingList = ref([]);
  166. const open = ref(false);
  167. const loading = ref(true);
  168. const showSearch = ref(true);
  169. const ids = ref([]);
  170. const single = ref(true);
  171. const multiple = ref(true);
  172. const total = ref(0);
  173. const title = ref("");
  174. const BASE_URL = import.meta.env.VITE_APP_BASE_URL;
  175. const checkDownloadFile = (fileList)=>{
  176. dialogTableVisible.value = true;
  177. downloadFileList.value = fileList;
  178. }
  179. const downloadFile = (file)=>{
  180. downloadFileMethod(BASE_URL+file.fileUrl,file.fileOriginalName)
  181. }
  182. const upload = reactive({
  183. // 是否显示弹出层(用户导入)
  184. open: false,
  185. // 弹出层标题(用户导入)
  186. title: '',
  187. // 是否禁用上传
  188. isUploading: false,
  189. // 设置上传的请求头部
  190. headers: {Authorization: getToken()},
  191. // 上传的地址
  192. url: import.meta.env.VITE_APP_BASE_API + '/owSelfReporting/importData'
  193. })
  194. const handleFileSuccess = (e) => {
  195. if (e.code == 200) {
  196. ElMessage({
  197. type: "success",
  198. message: e.msg
  199. })
  200. getList()
  201. proxy.$refs['uploadRef']?.clearFiles()
  202. } else {
  203. ElMessage({
  204. type: "error",
  205. message: e.msg
  206. })
  207. proxy.$refs['uploadRef']?.clearFiles()
  208. }
  209. }
  210. function submitFileForm() {
  211. proxy.$refs['uploadRef']?.submit();
  212. upload.open = false;
  213. }
  214. function handleImport() {
  215. upload.open = true
  216. }
  217. const data = reactive({
  218. form: {},
  219. queryParams: {
  220. pageNum: 1,
  221. pageSize: 20,
  222. unifiedSocialCreditCode: '',
  223. enterpriseName: null,
  224. contacts: null,
  225. contactInformation: null,
  226. complainantIdNumber: null,
  227. },
  228. rules: {
  229. }
  230. });
  231. const {queryParams, form, rules} = toRefs(data);
  232. /** 查询官网自主上报列表 */
  233. function getList() {
  234. loading.value = true;
  235. let toServerObj = likeQueryMethod('unified_social_credit_code', queryParams.value.unifiedSocialCreditCode, queryParams.value.pageNum, queryParams.value.pageSize);
  236. listReporting(toServerObj).then(response => {
  237. reportingList.value = response.records;
  238. total.value = response.total;
  239. loading.value = false;
  240. });
  241. }
  242. // 表单重置
  243. function reset() {
  244. form.value = {
  245. id: null,
  246. unifiedSocialCreditCode: '',
  247. enterpriseName: null,
  248. contacts: null,
  249. contactInformation: null,
  250. complainantIdNumber: null,
  251. createTime: null,
  252. updateTime: null
  253. };
  254. proxy.resetForm("reportingRef");
  255. }
  256. /** 搜索按钮操作 */
  257. function handleQuery() {
  258. queryParams.value.pageNum = 1;
  259. getList();
  260. }
  261. /** 重置按钮操作 */
  262. function resetQuery() {
  263. proxy.resetForm("queryRef");
  264. handleQuery();
  265. }
  266. // 多选框选中数据
  267. function handleSelectionChange(selection) {
  268. ids.value = selection.map(item => item.id);
  269. single.value = selection.length != 1;
  270. multiple.value = !selection.length;
  271. }
  272. /** 删除按钮操作 */
  273. async function handleDelete(row) {
  274. const res = await delReporting();
  275. if(res.code == 200){
  276. ElMessage({
  277. type:'success',
  278. message:'删除成功'
  279. })
  280. getList();
  281. }
  282. }
  283. /** 批量删除*/
  284. const batchDelete = (row)=>{
  285. const idsToS = row.id || ids.value;
  286. (proxy.$modal).confirm('是否确认删除这' + idsToS.length+'条的数据项?').then(function() {
  287. return delReportingBatch(toRaw(idsToS));
  288. }).then(() => {
  289. getList();
  290. proxy.$modal.msgSuccess("删除成功");
  291. }).catch(() => {});
  292. }
  293. /** 导出按钮操作 */
  294. function handleExport() {
  295. proxy.download('owSelfReporting/exportData', {
  296. ...queryParams.value
  297. }, `官网自主上报_${new Date().getTime()}.xlsx`)
  298. }
  299. const downloadTemplate = ()=>{
  300. proxy.download('owSelfReporting/getUploadTemplate',{}, `官网自主上报模板.xlsx`)
  301. }
  302. getList();
  303. </script>