index.vue 13 KB

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