apply.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <div class="card-search">
  3. <a-form
  4. ref="formRef"
  5. name="advanced_search"
  6. class="ant-advanced-search-form"
  7. :model="formState"
  8. @finish="onFinish"
  9. >
  10. <a-row :gutter="24">
  11. <a-col :span="6">
  12. <a-form-item
  13. name="studentCode"
  14. label="申请人"
  15. :label-col="{span:6}">
  16. <a-input v-model:value="formState.applyUserName" style="width: 200px"></a-input>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :span="8">
  20. <a-form-item label="申请时间区间" :label-col="{span:8}" name="name">
  21. <a-range-picker format="YYYY-MM-DD" :placeholder="['开始日期', '结束日期']" @change="onRangeChange"/>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :span="6" style="text-align: left">
  25. <a-button type="primary" html-type="submit" @click="onFinish">查询</a-button>
  26. <a-button style="margin: 0 8px" @click="() => {formRef.resetFields();loadData()}">重置</a-button>
  27. </a-col>
  28. </a-row>
  29. <a-row>
  30. <a-col :span="24" style="text-align: right">
  31. </a-col>
  32. </a-row>
  33. </a-form>
  34. <div class="search-result-list">
  35. <a-table :columns="columns" :data-source="data" :pagination="pagination"
  36. :loading="loading"
  37. :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  38. @change="handleTableChange" :row-key="record=>record.applyId"
  39. bordered>
  40. <template #bodyCell="{ column,record }">
  41. <template v-if="column.key === 'operation'">
  42. <a-button type="link" size="small" @click="showFile(record.applyId)">查看文件
  43. </a-button>
  44. </template>
  45. </template>
  46. </a-table>
  47. </div>
  48. <a-modal style="width:700px;" :footer="null" v-model:visible="visible" title="查看文件">
  49. <div style="overflow: auto;height: 500px;">
  50. <a-list item-layout="horizontal" :data-source="docList">
  51. <template #renderItem="{ item,index }">
  52. <a-list-item>
  53. <template #actions>
  54. <filePreview :fileName="item.file_name" :filePath="item.storage_path" :title="item.well_common_name"></filePreview>
  55. <a-button type="link" @click="downFile(item)" v-if="item.status==2" danger>下载</a-button>
  56. </template>
  57. <a-list-item-meta
  58. :description="item.file_business_type">
  59. <template #title>
  60. {{ item.file_name }}
  61. </template>
  62. <template #avatar>
  63. <img src="~@/assets/images/file.png"/>
  64. </template>
  65. </a-list-item-meta>
  66. <div>{{item.well_common_name}}</div>
  67. </a-list-item>
  68. </template>
  69. </a-list>
  70. </div>
  71. </a-modal>
  72. </div>
  73. </template>
  74. <script lang="ts">
  75. import {reactive, ref, defineComponent, computed} from 'vue';
  76. import type {FormInstance} from 'ant-design-vue';
  77. import type {TableColumnsType, TableProps} from 'ant-design-vue';
  78. import {get} from '@/api/common';
  79. import dayjs from "dayjs";
  80. import {DownOutlined, UpOutlined} from "@ant-design/icons-vue";
  81. import {getPaginationTotalTitle} from "@/utils/common";
  82. import filePreview from '@/components/basic/file-preview/index.vue'
  83. import {download} from "@/utils/downloadFile";
  84. export default defineComponent({
  85. name: 'applyformList',
  86. components: {DownOutlined, UpOutlined, filePreview},
  87. setup() {
  88. const expand = ref(false);
  89. const formRef = ref<FormInstance>();
  90. const selectedRowKeys = ref([]);
  91. const visible = ref(false);
  92. const docList = ref([]);
  93. const formState = reactive({
  94. page: 1, rows: 10, endDate: '',
  95. beginDate: '',
  96. applyUserName: '', total: 0,
  97. });
  98. const columns: TableColumnsType = [
  99. {
  100. title: '序号',
  101. width: 80,
  102. dataIndex: 'index',
  103. key: 'index',
  104. align: "center",
  105. customRender: ({index}) => {
  106. return `${index + 1}`;
  107. }
  108. },
  109. {title: '申请人', dataIndex: 'applyUserName', width: 100, key: '1',},
  110. {
  111. title: '申请时间',
  112. dataIndex: 'applyDate',
  113. width: 200,
  114. align: "center",
  115. key: 'applyDate',
  116. customRender: ({record}) => dayjs(record.applyDate).format('YYYY-MM-DD')
  117. },
  118. {title: '申请原因', dataIndex: 'reason', key: '1', align: "center"},
  119. {title: '状态', dataIndex: 'statusName', key: '1', align: "center"},
  120. {
  121. title: '操作', key: 'operation', width: 60, align: "center"
  122. },
  123. ];
  124. const onRangeChange = (dateString) => {
  125. formState.beginDate = dateString ? dateString[0].format("YYYY-MM-DD") : '';
  126. formState.endDate = dateString ? dateString[1].format("YYYY-MM-DD") : '';
  127. loadData();
  128. };
  129. const data = ref([]);
  130. const pagination = computed(() => ({
  131. total: formState.total,
  132. current: formState.page,
  133. pageSize: formState.rows,
  134. showSizeChanger: true,
  135. showTotal: total => getPaginationTotalTitle(total)
  136. }));
  137. const loading = ref(false);
  138. const handleTableChange: TableProps['onChange'] = (
  139. pag: { pageSize: number; current: number },
  140. ) => {
  141. formState.page = pag.current;
  142. formState.rows = pag.pageSize;
  143. loadData();
  144. };
  145. const onFinish = () => {
  146. loadData();
  147. }
  148. const loadData = async function () {
  149. loading.value = true;
  150. const result: any = await get('applyForm/getApplyFormList', formState);
  151. data.value = result.list;
  152. formState.total = result.total;
  153. loading.value = false;
  154. }
  155. const dicModalClosed = (d) => {
  156. if (d) {
  157. loadData();
  158. }
  159. }
  160. const showFile = async (applyId) => {
  161. visible.value = true;
  162. const result: any = await get('applyForm/getApplyFormFileList', {applyId: applyId});
  163. docList.value = result;
  164. };
  165. const onSelectChange = (keys: any) => {
  166. selectedRowKeys.value = keys;
  167. };
  168. const downFile = (record: any) => {
  169. download(record.storage_path, record.file_name);
  170. };
  171. return {
  172. formRef,
  173. expand,
  174. data,
  175. loadData, loading, selectedRowKeys,
  176. onSelectChange, onRangeChange,
  177. formState,
  178. columns, visible,
  179. pagination, docList,
  180. showFile, dicModalClosed,
  181. handleTableChange,
  182. onFinish, downFile
  183. };
  184. },
  185. created() {
  186. this.loadData();
  187. }
  188. });
  189. </script>