projectBook.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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="queryParams.xmbh" placeholder="请输入项目名称" style="width: 160px" />
  7. </div>
  8. <div class="form">
  9. <span class="formSpan">项目名称:</span>
  10. <el-input v-model="queryParams.xmmc" placeholder="请输入项目名称" style="width: 210px" />
  11. </div>
  12. <div class="form">
  13. <span class="formSpan">项目经理:</span>
  14. <UserOrgTree v-model="queryParams['userId']" />
  15. </div>
  16. <div class="form">
  17. <span class="formSpan">责任部门:</span>
  18. <DeptTree v-model="queryParams['deptId']" />
  19. </div>
  20. <div class="form" style="width: unset">
  21. <span class="formSpan">合同状态:</span>
  22. <el-radio-group v-model="queryParams.isSign">
  23. <el-radio>全部</el-radio>
  24. <el-radio label="1">已签订</el-radio>
  25. <el-radio label="0">未签订</el-radio>
  26. </el-radio-group>
  27. </div>
  28. <div class="form" style="width: unset">
  29. <span class="formSpan">项目状态:</span>
  30. <el-radio-group v-model="queryParams.xmzt">
  31. <el-radio :label="1">进行中({{ process }})</el-radio>
  32. <el-radio :label="4">已验收({{ accepted }})</el-radio>
  33. <el-radio :label="2">已结项({{ finished }})</el-radio>
  34. <el-radio :label="9">已终止({{ terminated }})</el-radio>
  35. <el-radio>全部({{ totalNum }})</el-radio>
  36. </el-radio-group>
  37. </div>
  38. <div class="from">
  39. <div class="btnBox">
  40. <el-button type="primary" style="background: #3485ff" @click="searchHandle">
  41. <img src="@/assets/imgs/OA/search.png" class="mr-8px" alt="" />
  42. 查询</el-button
  43. >
  44. <el-button type="primary">
  45. <img src="@/assets/imgs/OA/open.png" class="mr-8px" alt="" />
  46. 导出</el-button
  47. >
  48. </div>
  49. </div>
  50. </div>
  51. <div class="infoBox">
  52. <ul>
  53. <li v-for="(item, index) in infoList" :key="index" class="mr-40px">
  54. <img class="mr-8px" :src="getAssetURL(item.icon)" alt="" />
  55. <p>{{ item.name }}:</p>
  56. <h4 class="font-size-18px">{{ item.num }}</h4>
  57. </li>
  58. </ul>
  59. </div>
  60. <div class="tableBox">
  61. <div class="table" ref="tableRef">
  62. <el-table
  63. stripe
  64. :data="tableData"
  65. style="width: 100%; height: 100%"
  66. :style="{ height: tableHeight + 'px' }"
  67. :header-cell-style="{
  68. background: '#E5F0FB',
  69. color: '#233755',
  70. height: '50px'
  71. }"
  72. >
  73. <el-table-column label="序号" width="80">
  74. <template #default="scope">{{ scope.$index + 1 }}</template>
  75. </el-table-column>
  76. <el-table-column :show-overflow-tooltip="true" prop="xmbh" label="项目编号" />
  77. <el-table-column :show-overflow-tooltip="true" prop="xmmc" label="项目名称" />
  78. <el-table-column prop="zrbm" label="责任部门" width="200" />
  79. <el-table-column prop="xmjl" label="项目经理" width="120" />
  80. <el-table-column prop="contractAmount" label="合同额" width="120" />
  81. <el-table-column prop="receivableAmount" label="应收款" width="120" />
  82. <el-table-column prop="contractBalance" label="合同余额" width="120" />
  83. <el-table-column prop="projectCost" label="项目总成本" width="120" />
  84. <el-table-column prop="xmzt" label="项目状态" width="120">
  85. <template #default="scope">
  86. {{ xmztMap[scope.row.xmzt] }}
  87. </template>
  88. </el-table-column>
  89. <el-table-column label="操作" width="80" fixed="right">
  90. <template #default="scope">
  91. <div class="operateBtn" @click="operateClick(scope.row)">
  92. <span>查看</span>
  93. </div>
  94. </template>
  95. </el-table-column>
  96. </el-table>
  97. </div>
  98. <div class="pageBox">
  99. <el-pagination
  100. v-model:current-page="queryParams.pageNo"
  101. :page-size="queryParams.pageSize"
  102. background
  103. layout="total, prev, pager, next, jumper"
  104. :total="total"
  105. @current-change="handleCurrentChange"
  106. />
  107. </div>
  108. </div>
  109. </div>
  110. </template>
  111. <script setup lang="ts">
  112. import moment from 'moment'
  113. import { useRouter } from 'vue-router'
  114. import request from '@/config/axios'
  115. import { getAssetURL } from '@/utils/auth'
  116. import UserOrgTree from '@/views/OaSystem/components/UserOrgTree/index.vue'
  117. import DeptTree from '@/views/OaSystem/components/DeptTree/index.vue'
  118. defineOptions({ name: 'ProjectBook' })
  119. const xmztMap: any = { 0: '立项申请中', 1: '进行中', 2: '已结项', 3: '中止' }
  120. const router = useRouter()
  121. const tableRef: any = ref(null)
  122. const tableHeight: any = ref(0)
  123. const queryParams = reactive<{
  124. xmbh: string
  125. xmmc: string
  126. xmlbId: string
  127. lxsjOn: string
  128. lxsjOff: string
  129. pageNo: number
  130. xzqdm: number | string
  131. pageSize: number
  132. isSign: any
  133. xmzt: any
  134. hyId: any
  135. }>({
  136. xmbh: '',
  137. xmmc: '',
  138. xmlbId: '15',
  139. lxsjOn: '',
  140. lxsjOff: '',
  141. pageNo: 1,
  142. xzqdm: '',
  143. pageSize: 15,
  144. isSign: '',
  145. xmzt: '',
  146. hyId: 0
  147. })
  148. const lxsjObj = ref()
  149. const infoList: any = reactive([
  150. {
  151. icon: 'xmzx/xmzcz',
  152. name: '项目总产值(元)',
  153. num: 0
  154. },
  155. {
  156. icon: 'xmzx/xmzcb',
  157. name: '项目总成本(元)',
  158. num: 0
  159. },
  160. {
  161. icon: 'xmzx/xmzlr',
  162. name: '项目总利润(元)',
  163. num: 0
  164. }
  165. ])
  166. const handleCurrentChange = (pageNo: number) => {
  167. queryParams.pageNo = pageNo
  168. queryProjectListAjax()
  169. }
  170. const operateClick = (row: any) => {
  171. router.push({
  172. path: '/projectDetail',
  173. query: { id: row.id }
  174. })
  175. }
  176. const tableData = ref<Array<any>>([])
  177. const total = ref<number>()
  178. const searchHandle: () => void = () => {
  179. queryXmztCount()
  180. queryProjectCalculate()
  181. queryProjectListAjax()
  182. }
  183. const setSearchParams = (): void => {
  184. if (lxsjObj.value && lxsjObj.value.length > 0) {
  185. queryParams.lxsjOn = moment(lxsjObj.value[0]).format('YYYY-MM-DD')
  186. queryParams.lxsjOff = moment(lxsjObj.value[1]).format('YYYY-MM-DD')
  187. } else {
  188. queryParams.lxsjOn = ''
  189. queryParams.lxsjOff = ''
  190. }
  191. if (queryParams.hyId == 0) {
  192. queryParams.hyId = null
  193. }
  194. }
  195. const queryProjectListAjax = async (): Promise<void> => {
  196. const urlApi = `/project/page`
  197. setSearchParams()
  198. const sendData = {
  199. ...queryParams,
  200. pageSize: 15
  201. }
  202. const result = await request.get({ url: urlApi, params: sendData }, '/business')
  203. tableData.value = result['records']
  204. total.value = result['total']
  205. }
  206. queryProjectListAjax()
  207. /**
  208. * 获取项目台账金额计算
  209. */
  210. const queryProjectCalculate = async (): Promise<void> => {
  211. const urlApi = `/project/calculate`
  212. setSearchParams()
  213. const sendData = {
  214. ...queryParams
  215. }
  216. const result = await request.get({ url: urlApi, params: sendData }, '/business')
  217. if (result) {
  218. infoList[0]['num'] = result.output ?? 0
  219. infoList[1]['num'] = result.cost ?? 0
  220. infoList[2]['num'] = infoList[1]['num'] - infoList[0]['num']
  221. }
  222. }
  223. queryProjectCalculate()
  224. /**
  225. * 项目状态数据统计
  226. */
  227. const totalNum = ref<number>(0)
  228. const process = ref<number>(0)
  229. const finished = ref<number>(0)
  230. const terminated = ref<number>(0)
  231. const accepted = ref<number>(0)
  232. const queryXmztCount = async (): Promise<void> => {
  233. const urlApi = `/project/xmzt/count`
  234. if (lxsjObj.value && lxsjObj.value.length > 0) {
  235. queryParams.lxsjOn = moment(lxsjObj.value[0]).format('YYYY-MM-DD')
  236. queryParams.lxsjOff = moment(lxsjObj.value[1]).format('YYYY-MM-DD')
  237. } else {
  238. queryParams.lxsjOn = ''
  239. queryParams.lxsjOff = ''
  240. }
  241. const sendData = {
  242. ...queryParams
  243. }
  244. if (sendData['hyId'] == 0) {
  245. sendData['hyId'] = null
  246. }
  247. const result = await request.get({ url: urlApi, params: sendData }, '/business')
  248. if (result) {
  249. totalNum.value = result['total']
  250. process.value = result['process']
  251. finished.value = result['finished']
  252. terminated.value = result['terminated']
  253. accepted.value = result['accepted']
  254. }
  255. }
  256. queryXmztCount()
  257. onMounted(() => {
  258. tableHeight.value = tableRef.value.clientHeight
  259. })
  260. </script>
  261. <style lang="scss" scoped>
  262. :deep(.el-radio) {
  263. margin-right: 10px;
  264. }
  265. </style>