index.vue 10.0 KB

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