index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <script setup lang="ts">
  2. import { useColumns } from "./columns";
  3. import { httpList } from "/@/api/InvoiceSales/invoiceApply";
  4. import { reactive, ref, onMounted } from "vue";
  5. import { TableProBar } from "/@/components/ReTable";
  6. import { type PaginationProps } from "@pureadmin/table";
  7. import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
  8. import { useNav } from "/@/layout/hooks/nav";
  9. import { statusList, inv_type_list } from "./status";
  10. import { useRouter } from "vue-router";
  11. import { responseHandle } from "/@/utils/responseHandle";
  12. import IntervalTime from "/@/components/IntervalTime";
  13. import { useUserStoreHook } from "/@/store/modules/user";
  14. const { logout } = useNav();
  15. defineOptions({
  16. name: "invoiceApply"
  17. });
  18. console.log(useUserStoreHook().getMenuActions("invoiceApply"));
  19. // const aa=ref([].push(useUserStoreHook().))
  20. const initform = {
  21. inv_in: "", //客户公司
  22. inv_out: "", //业务企业公司
  23. apply_name: "", //申请人
  24. // apply_id:'',//申请人ID
  25. status: "",
  26. inv_type: "",
  27. start: "",
  28. end: "",
  29. page: 1,
  30. size: 15
  31. };
  32. const form = reactive({ ...initform });
  33. const { push } = useRouter();
  34. const dataList = ref([]);
  35. const loading = ref(false);
  36. const { columns } = useColumns();
  37. const pagination = reactive<PaginationProps>({
  38. total: 0,
  39. pageSize: 15,
  40. currentPage: 1,
  41. background: true
  42. });
  43. async function handleCurrentChange(val: number) {
  44. form.page = val;
  45. await onSearch();
  46. }
  47. async function handleSizeChange(val: number) {
  48. form.size = val;
  49. form.page = 1;
  50. await onSearch();
  51. }
  52. function handleSelectionChange(val) {
  53. console.log("handleSelectionChange", val);
  54. }
  55. function timeChange(start, end) {
  56. console.log(start);
  57. console.log(end);
  58. }
  59. async function onSearch() {
  60. if (loading.value) return;
  61. loading.value = true;
  62. const { code, data, message } = await httpList(form);
  63. responseHandle({
  64. code,
  65. message,
  66. logout,
  67. handler: () => {
  68. const { list, count } = data;
  69. dataList.value = list ?? [];
  70. pagination.total = count ?? 0;
  71. pagination.pageSize = form.size;
  72. pagination.currentPage = form.page;
  73. }
  74. });
  75. loading.value = false;
  76. }
  77. async function resetSearch() {
  78. form.page = 1;
  79. await onSearch();
  80. }
  81. //新建/详情页面
  82. function editItem(id) {
  83. push({
  84. path: "/InvoiceSales/invoiceApplyDeatil",
  85. query: {
  86. id
  87. }
  88. });
  89. }
  90. async function resetForm() {
  91. Object.keys(form.value).forEach(key => {
  92. form.value[key] = initform[key];
  93. });
  94. await onSearch();
  95. }
  96. onMounted(() => {
  97. onSearch();
  98. });
  99. </script>
  100. <template>
  101. <div class="main">
  102. <div class="bg-white p-4">
  103. <el-row :gutter="10" class="pb-4">
  104. <el-col :span="5">
  105. <el-select
  106. v-model="form.status"
  107. style="width: 100%"
  108. placeholder="发票申请状态"
  109. clearable
  110. >
  111. <el-option
  112. v-for="(si, sii) in statusList"
  113. :key="'status' + si.value + sii"
  114. :label="si.label"
  115. :value="si.value"
  116. />
  117. </el-select>
  118. </el-col>
  119. <el-col :span="5">
  120. <el-select
  121. v-model="form.inv_type"
  122. style="width: 100%"
  123. placeholder="发票类型"
  124. clearable
  125. >
  126. <el-option
  127. v-for="(si, sii) in inv_type_list"
  128. :key="'status' + si.value + sii"
  129. :label="si.label"
  130. :value="si.value"
  131. />
  132. </el-select>
  133. </el-col>
  134. <el-col :span="10">
  135. <IntervalTime
  136. v-model:startValue="form.start"
  137. v-model:endValue="form.end"
  138. @timeChange="timeChange"
  139. /></el-col>
  140. <el-col :span="4">
  141. <el-input
  142. v-model="form.apply_name"
  143. placeholder="申请人"
  144. style="width: 100%"
  145. clearable
  146. />
  147. </el-col>
  148. </el-row>
  149. <el-row :gutter="10">
  150. <el-col :span="10">
  151. <el-input
  152. v-model="form.inv_in"
  153. placeholder="企业客户名称"
  154. style="width: 100%"
  155. clearable
  156. />
  157. </el-col>
  158. <el-col :span="10">
  159. <el-input
  160. v-model="form.inv_out"
  161. placeholder="业务企业公司"
  162. style="width: 100%"
  163. clearable
  164. />
  165. </el-col>
  166. <el-col :span="4">
  167. <el-button
  168. type="primary"
  169. :icon="useRenderIcon('search')"
  170. :loading="loading"
  171. class="fl"
  172. @click="resetSearch"
  173. >
  174. 搜索
  175. </el-button>
  176. <el-button
  177. :icon="useRenderIcon('refresh')"
  178. class="fl"
  179. @click="resetForm()"
  180. >
  181. 重置
  182. </el-button>
  183. </el-col>
  184. </el-row>
  185. </div>
  186. <TableProBar
  187. title="发票申请管理"
  188. :loading="loading"
  189. :dataList="dataList"
  190. @refresh="onSearch"
  191. >
  192. <template #buttons>
  193. <el-button
  194. type="primary"
  195. :icon="useRenderIcon('add')"
  196. @click="editItem('')"
  197. >
  198. 新增发票申请
  199. </el-button>
  200. </template>
  201. <template v-slot="{ size, checkList }">
  202. <PureTable
  203. border
  204. align="left"
  205. showOverflowTooltip
  206. table-layout="auto"
  207. :size="size"
  208. :data="dataList"
  209. :columns="columns"
  210. :checkList="checkList"
  211. :pagination="pagination"
  212. :paginationSmall="size === 'small' ? true : false"
  213. :header-cell-style="{ background: '#fafafa', color: '#606266' }"
  214. @selection-change="handleSelectionChange"
  215. @size-change="handleSizeChange"
  216. @current-change="handleCurrentChange"
  217. >
  218. <template #operation="{ row }">
  219. <el-button
  220. class="reset-margin"
  221. link
  222. type="primary"
  223. :size="size"
  224. @click="editItem(row.id)"
  225. :icon="useRenderIcon('eye-view')"
  226. />
  227. </template>
  228. </PureTable>
  229. </template>
  230. </TableProBar>
  231. </div>
  232. </template>
  233. <style scoped lang="scss">
  234. :deep(.el-dropdown-menu__item i) {
  235. margin: 0;
  236. }
  237. </style>