index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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" label-width="200">
  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" 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>
  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:info: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:info: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="!infoList.length"
  64. v-hasPermi="['basicData:info: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="infoList" height="650" @selection-change="handleSelectionChange">
  80. <el-table-column type="selection" width="55" align="center"/>
  81. <el-table-column label="企业名称" align="center" prop="enterpriseName" :show-overflow-tooltip='true'/>
  82. <el-table-column label="统一社会信用代码" align="center" prop="unifiedSocialCreditCode" width="200"/>
  83. <el-table-column label="行业代码" align="center" prop="industryCode" :show-overflow-tooltip='true'/>
  84. <!-- <el-table-column label="国民经济行业分类" align="center" prop="nationalEconomicIndustryClassification" :show-overflow-tooltip='true'/>-->
  85. <!-- <el-table-column label="国标行业类型" align="center" prop="gbIndustryType" :show-overflow-tooltip='true'/>-->
  86. </el-table>
  87. <div style="position: fixed;bottom: 20px;right: 10px;">
  88. <pagination
  89. v-show="total>0"
  90. :total="total"
  91. v-model:page="queryParams.pageNum"
  92. v-model:limit="queryParams.pageSize"
  93. @pagination="getList"
  94. />
  95. </div>
  96. <el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
  97. <el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
  98. :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
  99. :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
  100. <el-icon class="el-icon--upload">
  101. <upload-filled/>
  102. </el-icon>
  103. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  104. <template #tip>
  105. <div class="el-upload__tip text-center">
  106. <span>仅允许导入xls、xlsx格式文件。</span>
  107. </div>
  108. </template>
  109. </el-upload>
  110. <template #footer>
  111. <div class="dialog-footer">
  112. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  113. <el-button @click="upload.open = false">取 消</el-button>
  114. </div>
  115. </template>
  116. </el-dialog>
  117. <!-- 添加或修改内资市场主体行业信息对话框 -->
  118. </div>
  119. </template>
  120. <script setup name="Info">
  121. import {
  122. listInfo,
  123. getInfo,
  124. delInfo,
  125. delInfoBatch
  126. } from "@/api/basicData/info18";
  127. import {reactive, ref, toRaw} from "vue";
  128. import {getToken} from "@/utils/auth";
  129. import {ElMessage} from "element-plus";
  130. import {likeQueryMethod} from "@/utils/likeQueryMethod";
  131. const {proxy} = getCurrentInstance();
  132. const infoList = ref([]);
  133. const open = ref(false);
  134. const loading = ref(true);
  135. const showSearch = ref(true);
  136. const ids = ref([]);
  137. const single = ref(true);
  138. const multiple = ref(true);
  139. const total = ref(0);
  140. const title = ref("");
  141. const upload = reactive({
  142. // 是否显示弹出层(用户导入)
  143. open: false,
  144. // 弹出层标题(用户导入)
  145. title: '',
  146. // 是否禁用上传
  147. isUploading: false,
  148. // 设置上传的请求头部
  149. headers: {Authorization: getToken()},
  150. // 上传的地址
  151. url: import.meta.env.VITE_APP_BASE_API + '/crmDomesticMarketEntityIndustryInfo/importData'
  152. })
  153. const handleFileSuccess = (e) => {
  154. if (e.code == 200) {
  155. ElMessage({
  156. type: "success",
  157. message: e.msg
  158. })
  159. getList()
  160. proxy.$refs['uploadRef']?.clearFiles()
  161. } else {
  162. ElMessage({
  163. type: "error",
  164. message: e.msg
  165. })
  166. proxy.$refs['uploadRef']?.clearFiles()
  167. }
  168. }
  169. function submitFileForm() {
  170. proxy.$refs['uploadRef']?.submit();
  171. upload.open = false;
  172. }
  173. function handleImport() {
  174. upload.open = true
  175. }
  176. const data = reactive({
  177. form: {},
  178. queryParams: {
  179. pageNum: 1,
  180. pageSize: 20,
  181. enterpriseName: null,
  182. unifiedSocialCreditCode: '',
  183. industryCode: null,
  184. nationalEconomicIndustryClassification: null,
  185. gbIndustryType: null
  186. },
  187. rules: {
  188. enterpriseName: [
  189. {
  190. required: true, message: "企业名称不能为空", trigger: "blur" }
  191. ],
  192. unifiedSocialCreditCode: [
  193. {
  194. required: true, message: "统一社会信用代码不能为空", trigger: "blur" }
  195. ],
  196. industryCode: [
  197. {
  198. required: true, message: "行业代码不能为空", trigger: "blur" }
  199. ],
  200. nationalEconomicIndustryClassification: [
  201. {
  202. required: true, message: "国民经济行业分类不能为空", trigger: "blur" }
  203. ],
  204. gbIndustryType: [
  205. {
  206. required: true, message: "国标行业类型不能为空", trigger: "change"
  207. }
  208. ],
  209. enterpriseScale: [
  210. {
  211. required: true, message: "企业规模不能为空", trigger: "blur" }
  212. ],
  213. businessPerformanceEvaluation: [
  214. {
  215. required: true, message: "企业绩效评价不能为空", trigger: "blur" }
  216. ]
  217. }
  218. });
  219. const {queryParams, form, rules} = toRefs(data);
  220. /** 查询内资市场主体行业信息列表 */
  221. function getList() {
  222. loading.value = true;
  223. let toServerObj = likeQueryMethod('unified_social_credit_code', queryParams.value.unifiedSocialCreditCode, queryParams.value.pageNum, queryParams.value.pageSize,'enterprise_name',queryParams.value.enterpriseName);
  224. listInfo(toServerObj).then(response => {
  225. infoList.value = response.records;
  226. total.value = response.total;
  227. loading.value = false;
  228. });
  229. }
  230. // 表单重置
  231. function reset() {
  232. form.value = {
  233. id: null,
  234. enterpriseName: null,
  235. unifiedSocialCreditCode: '',
  236. industryCode: null,
  237. nationalEconomicIndustryClassification: null,
  238. gbIndustryType: null
  239. };
  240. proxy.resetForm("infoRef");
  241. }
  242. /** 搜索按钮操作 */
  243. function handleQuery() {
  244. queryParams.value.pageNum = 1;
  245. getList();
  246. }
  247. /** 重置按钮操作 */
  248. function resetQuery() {
  249. proxy.resetForm("queryRef");
  250. handleQuery();
  251. }
  252. // 多选框选中数据
  253. function handleSelectionChange(selection) {
  254. ids.value = selection.map(item => item.id);
  255. single.value = selection.length != 1;
  256. multiple.value = !selection.length;
  257. }
  258. /** 删除按钮操作 */
  259. async function handleDelete(row) {
  260. const res = await delInfo();
  261. if(res.code == 200){
  262. ElMessage({
  263. type:'success',
  264. message:'删除成功'
  265. })
  266. getList();
  267. }
  268. }
  269. /** 批量删除*/
  270. const batchDelete = (row)=>{
  271. const idsToS = row.id || ids.value;
  272. (proxy.$modal).confirm('是否确认删除这' + idsToS.length+'条的数据项?').then(function() {
  273. return delInfoBatch(toRaw(idsToS));
  274. }).then(() => {
  275. getList();
  276. proxy.$modal.msgSuccess("删除成功");
  277. }).catch(() => {});
  278. }
  279. /** 导出按钮操作 */
  280. function handleExport() {
  281. proxy.download('crmDomesticMarketEntityIndustryInfo/exportData', {
  282. ...queryParams.value
  283. }, `内资市场主体行业信息_${new Date().getTime()}.xlsx`)
  284. }
  285. const downloadTemplate = ()=>{
  286. proxy.download('crmDomesticMarketEntityIndustryInfo/getUploadTemplate',{}, `内资市场主体行业信息模板.xlsx`)
  287. }
  288. getList();
  289. </script>