index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  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="enterpriseName">
  5. <el-input
  6. v-model="queryParams.enterpriseName"
  7. placeholder="请输入企业名称"
  8. clearable
  9. @keyup.enter="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="统一社会信用代码" prop="unifiedSocialCreditCode">
  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="gasUserInformation">-->
  21. <!-- <el-input-->
  22. <!-- v-model="queryParams.gasUserInformation"-->
  23. <!-- placeholder="请输入燃气用户信息"-->
  24. <!-- clearable-->
  25. <!-- @keyup.enter="handleQuery"-->
  26. <!-- />-->
  27. <!-- </el-form-item>-->
  28. <!-- <el-form-item label="近3个月月均燃气用量" prop="last3MonthsAverageGasConsumption">-->
  29. <!-- <el-input-->
  30. <!-- v-model="queryParams.last3MonthsAverageGasConsumption"-->
  31. <!-- placeholder="请输入近3个月月均燃气用量"-->
  32. <!-- clearable-->
  33. <!-- @keyup.enter="handleQuery"-->
  34. <!-- />-->
  35. <!-- </el-form-item>-->
  36. <!-- <el-form-item label="近6个月月均燃气用量" prop="last6MonthsAverageGasConsumption">-->
  37. <!-- <el-input-->
  38. <!-- v-model="queryParams.last6MonthsAverageGasConsumption"-->
  39. <!-- placeholder="请输入近6个月月均燃气用量"-->
  40. <!-- clearable-->
  41. <!-- @keyup.enter="handleQuery"-->
  42. <!-- />-->
  43. <!-- </el-form-item>-->
  44. <!-- <el-form-item label="当前是否欠费" prop="isOverdue">-->
  45. <!-- <el-input-->
  46. <!-- v-model="queryParams.isOverdue"-->
  47. <!-- placeholder="请输入当前是否欠费"-->
  48. <!-- clearable-->
  49. <!-- @keyup.enter="handleQuery"-->
  50. <!-- />-->
  51. <!-- </el-form-item>-->
  52. <!-- <el-form-item label="缴纳燃气费明细" prop="gasFeePaymentDetails">-->
  53. <!-- <el-input-->
  54. <!-- v-model="queryParams.gasFeePaymentDetails"-->
  55. <!-- placeholder="请输入缴纳燃气费明细"-->
  56. <!-- clearable-->
  57. <!-- @keyup.enter="handleQuery"-->
  58. <!-- />-->
  59. <!-- </el-form-item>-->
  60. <el-form-item>
  61. <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
  62. <el-button icon="Refresh" @click="resetQuery">重置</el-button>
  63. </el-form-item>
  64. <el-form-item>
  65. <el-row :gutter="10" class="mb8">
  66. <!-- <el-col :span="1.5">-->
  67. <!-- <el-button-->
  68. <!-- type="primary"-->
  69. <!-- plain-->
  70. <!-- icon="Plus"-->
  71. <!-- @click="handleAdd"-->
  72. <!-- v-hasPermi="['basicData:information:add']"-->
  73. <!-- >新增</el-button>-->
  74. <!-- </el-col>-->
  75. <!-- <el-col :span="1.5">-->
  76. <!-- <el-button-->
  77. <!-- type="success"-->
  78. <!-- plain-->
  79. <!-- icon="Edit"-->
  80. <!-- :disabled="single"-->
  81. <!-- @click="handleUpdate"-->
  82. <!-- v-hasPermi="['basicData:information:edit']"-->
  83. <!-- >修改</el-button>-->
  84. <!-- </el-col>-->
  85. <el-col :span="1.5">
  86. <el-popconfirm
  87. title="你确定清除所有数据?"
  88. confirm-button-text="是的"
  89. cancel-button-text="不是"
  90. :icon="InfoFilled"
  91. icon-color="#626AEF"
  92. @confirm="handleDelete"
  93. >
  94. <template #reference>
  95. <el-button
  96. type="danger"
  97. plain
  98. icon="Delete"
  99. v-hasPermi="['basicData:ggxyjl:jnlyxx:rqfqj:remove']"
  100. >清除全表</el-button>
  101. </template>
  102. </el-popconfirm>
  103. </el-col>
  104. <el-col :span="1.5">
  105. <el-button
  106. type="danger"
  107. plain
  108. icon="Delete"
  109. @click="batchDelete"
  110. v-hasPermi="['basicData:ggxyjl:jnlyxx:rqfqj:remove']"
  111. :disabled="ids.length === 0"
  112. >批量删除</el-button>
  113. </el-col>
  114. <el-col :span="1.5">
  115. <el-button
  116. type="warning"
  117. plain
  118. icon="Download"
  119. :disabled="!informationList.length"
  120. @click="handleExport"
  121. v-hasPermi="['basicData:ggxyjl:jnlyxx:rqfqj:export']"
  122. >导出</el-button>
  123. </el-col>
  124. <el-col :span="1.5">
  125. <el-button type="info" plain icon="Upload" @click="handleImport"
  126. v-hasPermi="['basicData:ggxyjl:jnlyxx:rqfqj:import']">导入
  127. </el-button>
  128. </el-col>
  129. <el-col :span="1.5">
  130. <el-button type="success" plain icon="Download" @click="downloadTemplate" v-hasPermi="['basicData:ggxyjl:jnlyxx:rqfqj:download']">
  131. 下载导入模版
  132. </el-button>
  133. </el-col>
  134. <!-- <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>-->
  135. </el-row>
  136. </el-form-item>
  137. </el-form>
  138. <el-table v-loading="loading" :data="informationList" height="650" @selection-change="handleSelectionChange">
  139. <el-table-column type="selection" width="55" align="center" />
  140. <!-- <el-table-column label="主键" align="center" prop="id" />-->
  141. <el-table-column label="企业名称" align="center" prop="enterpriseName" :show-overflow-tooltip="true" />
  142. <el-table-column label="统一社会信用代码" align="center" prop="unifiedSocialCreditCode" width="200" />
  143. <el-table-column label="燃气用户信息" align="center" prop="gasUserInformation" :show-overflow-tooltip="true" />
  144. <el-table-column label="近3个月月均燃气用量" align="center" prop="lastThreeMonthsAverageGasConsumption" :show-overflow-tooltip="true" />
  145. <el-table-column label="近6个月月均燃气用量" align="center" prop="lastSixMonthsAverageGasConsumption" :show-overflow-tooltip="true" />
  146. <el-table-column label="当前是否欠费" align="center" prop="isOverdue" :show-overflow-tooltip="true" />
  147. <el-table-column label="缴纳燃气费明细" align="center" prop="gasFeePaymentDetails" :show-overflow-tooltip="true" width="300" >
  148. <template #default="scope">
  149. <img :src="baseUrl+ scope.row.gasFeePaymentDetails" style="width: 250px" />
  150. </template>
  151. </el-table-column>
  152. <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
  153. <!-- <template #default="scope">-->
  154. <!-- <el-button-->
  155. <!-- type="text"-->
  156. <!-- icon="Edit"-->
  157. <!-- @click="handleUpdate(scope.row)"-->
  158. <!-- v-hasPermi="['basicData:information:edit']"-->
  159. <!-- >修改</el-button>-->
  160. <!-- <el-button-->
  161. <!-- type="text"-->
  162. <!-- icon="Delete"-->
  163. <!-- @click="handleDelete(scope.row)"-->
  164. <!-- v-hasPermi="['basicData:information:remove']"-->
  165. <!-- >删除</el-button>-->
  166. <!-- </template>-->
  167. <!-- </el-table-column>-->
  168. </el-table>
  169. <div style="position: fixed;bottom: 20px;right: 10px;">
  170. <pagination
  171. v-show="total>0"
  172. :total="total"
  173. v-model:page="queryParams.pageNum"
  174. v-model:limit="queryParams.pageSize"
  175. @pagination="getList"
  176. />
  177. </div>
  178. <el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
  179. <el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
  180. :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
  181. :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
  182. <el-icon class="el-icon--upload"><upload-filled /></el-icon>
  183. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  184. <template #tip>
  185. <div class="el-upload__tip text-center">
  186. <span>仅允许导入xls、xlsx格式文件。</span>
  187. </div>
  188. </template>
  189. </el-upload>
  190. <template #footer>
  191. <div class="dialog-footer">
  192. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  193. <el-button @click="upload.open = false">取 消</el-button>
  194. </div>
  195. </template>
  196. </el-dialog>
  197. </div>
  198. </template>
  199. <script setup name="Information">
  200. import {
  201. listInformation,
  202. getInformation,
  203. delInformation,
  204. addInformation,
  205. updateInformation,
  206. delInformationBatch
  207. } from "@/api/basicData/information18";
  208. import {reactive} from "vue";
  209. import {getToken} from "@/utils/auth";
  210. import {ElMessage} from "element-plus";
  211. import {likeQueryMethod} from "@/utils/likeQueryMethod";
  212. const { proxy } = getCurrentInstance();
  213. const informationList = ref([]);
  214. const open = ref(false);
  215. const loading = ref(true);
  216. const showSearch = ref(true);
  217. const ids = ref([]);
  218. const single = ref(true);
  219. const multiple = ref(true);
  220. const total = ref(0);
  221. const title = ref("");
  222. const baseUrl = import.meta.env.VITE_APP_BASE_API;
  223. const upload = reactive({
  224. // 是否显示弹出层(用户导入)
  225. open: false,
  226. // 弹出层标题(用户导入)
  227. title: '',
  228. // 是否禁用上传
  229. isUploading: false,
  230. // 设置上传的请求头部
  231. headers: {Authorization: getToken()},
  232. // 上传的地址
  233. url: import.meta.env.VITE_APP_BASE_API + '/crmGasFeeInformation/importData'
  234. })
  235. const handleFileSuccess = (e)=>{
  236. if(e.code == 200){
  237. ElMessage({
  238. type:"success",
  239. message:e.msg
  240. })
  241. getList()
  242. proxy.$refs['uploadRef']?.clearFiles()
  243. }else {
  244. ElMessage({
  245. type:"error",
  246. message:e.msg
  247. })
  248. proxy.$refs['uploadRef']?.clearFiles()
  249. }
  250. }
  251. function submitFileForm() {
  252. proxy.$refs['uploadRef'].submit()
  253. upload.open = false;
  254. // setTimeout(getList,1000)
  255. }
  256. function handleImport() {
  257. upload.open = true
  258. // let toServerObj = likeQueryMethod('unified_social_credit_code', queryParams.value.unifiedSocialCreditCode, queryParams.value.pageNum, queryParams.value.pageSize,'enterprise_name',queryParams.value.enterpriseName);
  259. // listInformation(toServerObj).then(res=>{
  260. // if(res.records.length >0){
  261. // ElMessage({
  262. // type:'warning',
  263. // message:'当前已经有数据,请删除后再导入'
  264. // })
  265. // return
  266. // }else {
  267. // upload.title = '用户导入'
  268. // upload.open = true
  269. // }
  270. // })
  271. }
  272. const data = reactive({
  273. form: {},
  274. queryParams: {
  275. pageNum: 1,
  276. pageSize: 20,
  277. enterpriseName: null,
  278. unifiedSocialCreditCode: '',
  279. gasUserInformation: null,
  280. lastThreeMonthsAverageGasConsumption: null,
  281. lastSixMonthsAverageGasConsumption: null,
  282. isOverdue: null,
  283. gasFeePaymentDetails: null,
  284. },
  285. rules: {
  286. enterpriseName: [
  287. { required: true, message: "企业名称不能为空", trigger: "blur" }
  288. ],
  289. }
  290. });
  291. const { queryParams, form, rules } = toRefs(data);
  292. /** 查询企业燃气费信息列表 */
  293. function getList() {
  294. loading.value = true;
  295. let toServerObj = likeQueryMethod('unified_social_credit_code', queryParams.value.unifiedSocialCreditCode, queryParams.value.pageNum, queryParams.value.pageSize,'enterprise_name',queryParams.value.enterpriseName);
  296. listInformation(toServerObj).then(response => {
  297. informationList.value = response.records;
  298. total.value = response.total;
  299. loading.value = false;
  300. });
  301. }
  302. // 取消按钮
  303. function cancel() {
  304. open.value = false;
  305. reset();
  306. }
  307. // 表单重置
  308. function reset() {
  309. form.value = {
  310. id: null,
  311. enterpriseName: null,
  312. unifiedSocialCreditCode: '',
  313. gasUserInformation: null,
  314. lastThreeMonthsAverageGasConsumption: null,
  315. lastSixMonthsAverageGasConsumption: null,
  316. isOverdue: null,
  317. gasFeePaymentDetails: null,
  318. createTime: null,
  319. updateTime: null
  320. };
  321. proxy.resetForm("informationRef");
  322. }
  323. /** 搜索按钮操作 */
  324. function handleQuery() {
  325. queryParams.value.pageNum = 1;
  326. getList();
  327. }
  328. /** 重置按钮操作 */
  329. function resetQuery() {
  330. proxy.resetForm("queryRef");
  331. handleQuery();
  332. }
  333. // 多选框选中数据
  334. function handleSelectionChange(selection) {
  335. ids.value = selection.map(item => item.id);
  336. single.value = selection.length != 1;
  337. multiple.value = !selection.length;
  338. }
  339. /** 新增按钮操作 */
  340. function handleAdd() {
  341. reset();
  342. open.value = true;
  343. title.value = "添加企业燃气费信息";
  344. }
  345. /** 修改按钮操作 */
  346. function handleUpdate(row) {
  347. reset();
  348. const id = row.id || ids.value
  349. getInformation(id).then(response => {
  350. form.value = response.data;
  351. open.value = true;
  352. title.value = "修改企业燃气费信息";
  353. });
  354. }
  355. /** 提交按钮 */
  356. function submitForm() {
  357. proxy.$refs["informationRef"].validate(valid => {
  358. if (valid) {
  359. if (form.value.id != null) {
  360. updateInformation(form.value).then(response => {
  361. proxy.$modal.msgSuccess("修改成功");
  362. open.value = false;
  363. getList();
  364. });
  365. } else {
  366. addInformation(form.value).then(response => {
  367. proxy.$modal.msgSuccess("新增成功");
  368. open.value = false;
  369. getList();
  370. });
  371. }
  372. }
  373. });
  374. }
  375. /** 删除按钮操作 */
  376. async function handleDelete(row) {
  377. const res = await delInformation();
  378. if(res.code == 200){
  379. ElMessage({
  380. type:'success',
  381. message:'删除成功'
  382. })
  383. getList();
  384. }
  385. // const ids = row.id || ids.value;
  386. // proxy.$modal.confirm('是否确认删除企业燃气费信息编号为"' + ids + '"的数据项?').then(function() {
  387. // return delInformation(ids);
  388. // }).then(() => {
  389. // getList();
  390. // proxy.$modal.msgSuccess("删除成功");
  391. // }).catch(() => {});
  392. }
  393. /**
  394. * 批量删除
  395. */
  396. const batchDelete = (row)=>{
  397. const idsToS = row.id || ids.value;
  398. proxy.$modal.confirm('是否确认删除这'+idsToS.length+'条的数据项?').then(function() {
  399. return delInformationBatch(toRaw(idsToS));
  400. }).then(() => {
  401. getList();
  402. proxy.$modal.msgSuccess("删除成功");
  403. }).catch(() => {});
  404. }
  405. /** 导出按钮操作 */
  406. function handleExport() {
  407. proxy.download('crmGasFeeInformation/exportData', {
  408. ...queryParams.value
  409. }, `企业燃气费信息_${new Date().getTime()}.xlsx`)
  410. }
  411. const downloadTemplate = ()=>{
  412. proxy.download('crmGasFeeInformation/getUploadTemplate',{}, `企业燃气费信息模板.xlsx`)
  413. }
  414. getList();
  415. </script>