index.vue 8.2 KB

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