index.vue 9.2 KB

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