index.vue 8.6 KB

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