deptPurchase.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <div class="oa-sys-list-view">
  3. <div class="searchBox">
  4. <div class="form">
  5. <span class="formSpan">申请人:</span>
  6. <el-input v-model="qrs.userId" placeholder="请输入申请人" style="width: 160px" />
  7. </div>
  8. <div class="form">
  9. <span class="formSpan">申请时间:</span>
  10. <el-date-picker
  11. v-model="applyDateObj"
  12. type="daterange"
  13. unlink-panels
  14. range-separator="To"
  15. start-placeholder="开始日期"
  16. end-placeholder="结束日期"
  17. />
  18. </div>
  19. <div class="form">
  20. <span class="formSpan">采购单号:</span>
  21. <el-input v-model="qrs.procureNo" placeholder="请输入采购单号" style="width: 160px" />
  22. </div>
  23. <div class="from">
  24. <div class="btnBox">
  25. <el-button type="primary" style="background: #3485ff" @click="searchHandle">
  26. <img src="@/assets/imgs/OA/search.png" class="mr-8px" alt="" />
  27. 查询</el-button
  28. >
  29. <el-button type="primary">
  30. <img src="@/assets/imgs/OA/open.png" class="mr-8px" alt="" />
  31. 导出</el-button
  32. >
  33. </div>
  34. </div>
  35. </div>
  36. <div class="tableBox">
  37. <TableLayout :is-loading="loading" :data="tableData">
  38. <el-table-column label="序号" width="60">
  39. <template #default="scope">{{ scope.$index + 1 }}</template>
  40. </el-table-column>
  41. <el-table-column prop="userNickname" label="申请人" width="80" />
  42. <el-table-column
  43. show-overflow-tooltip="true"
  44. prop="workerDept"
  45. label="申请部门"
  46. width="250"
  47. />
  48. <el-table-column
  49. show-overflow-tooltip="true"
  50. prop="applyTime"
  51. label="申请时间"
  52. width="180"
  53. />
  54. <el-table-column
  55. show-overflow-tooltip="true"
  56. prop="projectName"
  57. label="项目名称"
  58. width="350"
  59. />
  60. <el-table-column
  61. show-overflow-tooltip="true"
  62. prop="procureNo"
  63. label="采购单号"
  64. width="240"
  65. />
  66. <el-table-column
  67. show-overflow-tooltip="true"
  68. prop="totalAmount"
  69. label="采购总金额"
  70. width="150"
  71. />
  72. <el-table-column
  73. show-overflow-tooltip="true"
  74. prop="procureType"
  75. label="采购类型"
  76. width="150"
  77. >
  78. <template #default="scope">
  79. {{ procureTypeMap[scope.row.procureType] }}
  80. </template>
  81. </el-table-column>
  82. <el-table-column
  83. show-overflow-tooltip="true"
  84. prop="commonCostStatus"
  85. label="报销状态"
  86. width="150"
  87. >
  88. <template #default="scope">
  89. {{ costStatusMap[scope.row.commonCostStatus] }}
  90. </template>
  91. </el-table-column>
  92. <el-table-column label="操作" width="80" fixed="right">
  93. <template #default="scope">
  94. <div class="operateBtn" @click="operateClick(scope.row)">
  95. <span>查看</span>
  96. </div>
  97. </template>
  98. </el-table-column>
  99. </TableLayout>
  100. <div class="pageBox">
  101. <el-pagination
  102. v-model:current-page="qrs.pageNo"
  103. :page-size="10"
  104. background
  105. layout="total, prev, pager, next, jumper"
  106. :total="total"
  107. @current-change="handleCurrentChange"
  108. />
  109. </div>
  110. </div>
  111. </div>
  112. </template>
  113. <script setup lang="ts">
  114. import moment from 'moment'
  115. import { useRouter } from 'vue-router'
  116. import request from '@/config/axios'
  117. import * as DeptApi from '@/api/system/dept'
  118. import { handleTree } from '@/utils/tree'
  119. import { arrFlatten } from '../../attendanceCenter/attendAuth'
  120. import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
  121. import TableLayout from '../../oaViews/layout/TableLayout.vue'
  122. defineOptions({ name: 'DeptPurchase' })
  123. const { wsCache } = useCache()
  124. const user = wsCache.get(CACHE_KEY.USER)
  125. const costStatusMap: any = { 0: '未报销', 1: '报销中', 90: '已报销' }
  126. const procureTypeMap: any = { 1: '正常', 2: '直接录入', 3: '采购(代办)' }
  127. const router = useRouter()
  128. const tableRef: any = ref(null)
  129. const tableHeight: any = ref(0)
  130. const deptId = user.user.deptId ? user.user.deptId : ''
  131. const qrs: any = ref({
  132. state: '',
  133. projectDept: '',
  134. userId: '',
  135. deptId: deptId,
  136. applyDateOn: '',
  137. applyDateOff: '',
  138. procureNo: '',
  139. assetNo: '',
  140. assetName: '',
  141. assetType: '',
  142. pageNo: 1,
  143. pageSize: 10,
  144. custodianDept: '',
  145. custodian: '',
  146. assetModel: ''
  147. })
  148. const deptList = ref<Tree[]>([]) // 树形结构
  149. const deptSort: any = ref([])
  150. const loading = ref(true) // 列表的加载中
  151. const initTreeDeps = async () => {
  152. DeptApi.getSimpleDeptList().then((res) => {
  153. deptList.value = handleTree(res)
  154. deptSort.value = arrFlatten(res, 'children')
  155. })
  156. }
  157. const handleCurrentChange = (pageNo: number) => {
  158. qrs.pageNo = pageNo
  159. queryProjectListAjax()
  160. }
  161. const operateClick = (row: any) => {
  162. router.push({
  163. path: '/processLook',
  164. query: {
  165. url:
  166. `${
  167. import.meta.env.VITE_PROCESS_DETAIL_URI
  168. }/IFlowInstance/redirectFlowPage?flowInstanceId=` + row.instanceId
  169. }
  170. })
  171. }
  172. const applyDateObj = ref()
  173. const tableData = ref<Array<any>>([])
  174. const total = ref<number>()
  175. const searchHandle: () => void = () => {
  176. queryProjectListAjax()
  177. }
  178. const queryProjectListAjax = async () => {
  179. loading.value = true
  180. const urlApi = `/purchase/page`
  181. if (applyDateObj.value && applyDateObj.value.length > 0) {
  182. qrs.applyDateOn = moment(applyDateObj.value[0]).format('YYYY-MM-DD')
  183. qrs.applyDateOff = moment(applyDateObj.value[1]).format('YYYY-MM-DD')
  184. }
  185. const sendData = {
  186. ...qrs,
  187. pageSize: 10
  188. }
  189. const result = await request.get({ url: urlApi, params: sendData._rawValue }, '/business')
  190. tableData.value = result['records']
  191. total.value = result['total']
  192. loading.value = false
  193. }
  194. queryProjectListAjax()
  195. /**
  196. * 获取行政区tree结构数据
  197. */
  198. const areaTree = ref<Array<any>>()
  199. const queryAreaTreeAjax = async (): Promise<void> => {
  200. const urlApi = `/system/area/tree`
  201. const result = await request.get({ url: urlApi })
  202. areaTree.value = result
  203. }
  204. queryAreaTreeAjax()
  205. onMounted(() => {
  206. initTreeDeps()
  207. //tableHeight.value = tableRef.value.clientHeight
  208. })
  209. </script>