purchaseContract.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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.name" placeholder="请输入合同名称" style="width: 160px" />
  7. </div>
  8. <div class="form">
  9. <span class="formSpan">合同编号:</span>
  10. <el-input
  11. v-model="queryParams.contractNumber"
  12. placeholder="请输入合同编号"
  13. style="width: 160px"
  14. />
  15. </div>
  16. <div class="form">
  17. <span class="formSpan">签订状态:</span>
  18. <el-select width="160px" clearable v-model="queryParams.isSign" placeholder="请选择行业">
  19. <el-option
  20. v-for="item in isSignListAll"
  21. :key="item.value"
  22. :label="item.label"
  23. :value="item.value"
  24. />
  25. </el-select>
  26. </div>
  27. <div class="form">
  28. <span class="formSpan">签订方式:</span>
  29. <el-select width="160px" clearable v-model="queryParams.signWay" placeholder="请选择行业">
  30. <el-option
  31. v-for="item in signWayAllList"
  32. :key="item.value"
  33. :label="item.label"
  34. :value="item.value"
  35. />
  36. </el-select>
  37. </div>
  38. <div class="form">
  39. <span class="formSpan">合同主类型:</span>
  40. <el-select width="160px" clearable v-model="queryParams.mainType" placeholder="请选择行业">
  41. <el-option
  42. v-for="item in mainTypeAllList"
  43. :key="item.value"
  44. :label="item.label"
  45. :value="item.value"
  46. />
  47. </el-select>
  48. </div>
  49. <div class="form">
  50. <span class="formSpan">合同次类型:</span>
  51. <el-select
  52. width="160px"
  53. clearable
  54. v-model="queryParams.secondType"
  55. placeholder="请选择行业"
  56. >
  57. <el-option
  58. v-for="item in secondTypeAllList"
  59. :key="item.value"
  60. :label="item.label"
  61. :value="item.value"
  62. />
  63. </el-select>
  64. </div>
  65. <div class="form form-time-range">
  66. <span class="formSpan">拿回时间:</span>
  67. <el-date-picker
  68. v-model="lxsjObj"
  69. type="daterange"
  70. unlink-panels
  71. range-separator="To"
  72. start-placeholder="开始日期"
  73. end-placeholder="结束日期"
  74. />
  75. </div>
  76. <div class="from">
  77. <div class="btnBox">
  78. <el-button type="primary" style="background: #3485ff" @click="searchHandle">
  79. <img src="@/assets/imgs/OA/search.png" class="mr-8px" alt="" />
  80. 查询</el-button
  81. >
  82. <el-button type="primary">
  83. <img src="@/assets/imgs/OA/open.png" class="mr-8px" alt="" />
  84. 导出</el-button
  85. >
  86. </div>
  87. </div>
  88. </div>
  89. <div class="infoBox">
  90. <ul>
  91. <li v-for="(item, index) in infoList" :key="index" class="mr-40px">
  92. <img class="mr-8px" :src="getAssetURL(item.icon)" alt="" />
  93. <p>{{ item.name }}:</p>
  94. <h4 class="font-size-18px">{{ (contractListCalc[item.key] / 10000).toFixed(2) }}</h4>
  95. </li>
  96. </ul>
  97. </div>
  98. <div class="tableBox">
  99. <div class="table" ref="tableRef">
  100. <el-table
  101. :data="tableData"
  102. style="width: 100%; height: 100%"
  103. :style="{ height: tableHeight + 'px' }"
  104. stripe
  105. :header-cell-style="{
  106. background: '#E5F0FB',
  107. color: '#233755',
  108. height: '50px'
  109. }"
  110. >
  111. <el-table-column label="序号" width="60">
  112. <template #default="scope">{{ scope.$index + 1 }}</template>
  113. </el-table-column>
  114. <el-table-column prop="contractNumber" label="合同编号" width="180" />
  115. <el-table-column :show-overflow-tooltip="true" prop="name" label="合同名称" width="240" />
  116. <el-table-column prop="isSign" label="签订状态" width="100">
  117. <template #default="scope">
  118. {{ getDictLabel(DICT_TYPE.CONTRACT_SIGN_STATUS, scope.row.isSign) }}
  119. </template>
  120. </el-table-column>
  121. <el-table-column prop="areaManager" label="销售经理" width="120" />
  122. <el-table-column
  123. :show-overflow-tooltip="true"
  124. prop="clientName"
  125. label="委托方"
  126. width="180"
  127. />
  128. <el-table-column prop="mainType" label="合同主类型" width="200">
  129. <template #default="scope">
  130. {{ getDictLabel(DICT_TYPE.CONTRACT_MAIN_TYPE, scope.row.isSign) }}
  131. </template>
  132. </el-table-column>
  133. <el-table-column prop="amountStatus" label="合同状态" width="100">
  134. <template #default="scope">
  135. {{ getDictLabel(DICT_TYPE.CONTRACT_COST_STATUS, scope.row.amountStatus) }}
  136. </template>
  137. </el-table-column>
  138. <el-table-column prop="contractAmount" label="合同金额" width="100" align="center">
  139. <template #default="scope">{{ scope.row.contractAmount ?? 0 }}</template>
  140. </el-table-column>
  141. <el-table-column prop="returnAmount" label="已回款金额" width="200" align="center">
  142. <template #default="scope">{{ scope.row.returnAmount ?? 0 }}</template>
  143. </el-table-column>
  144. <el-table-column prop="receivableAmount" label="应收账款" width="100" align="center">
  145. <template #default="scope">{{ scope.row.receivableAmount ?? 0 }}</template>
  146. </el-table-column>
  147. <el-table-column prop="contractBalance" label="合同余额" width="100" align="center">
  148. <template #default="scope">{{ scope.row.contractBalance ?? 0 }}</template>
  149. </el-table-column>
  150. <el-table-column prop="contractOn" label="拿出日期" width="120" />
  151. <el-table-column prop="contractOff" label="拿回日期" width="120" />
  152. <el-table-column label="操作" fixed="right" width="80">
  153. <template #default="scope">
  154. <div class="operateBtn" @click="operateClick(scope.row)">
  155. <span>查看</span>
  156. </div>
  157. </template>
  158. </el-table-column>
  159. </el-table>
  160. </div>
  161. <div class="pageBox">
  162. <el-pagination
  163. v-model:current-page="queryParams.pageNo"
  164. :page-size="15"
  165. background
  166. layout="total, prev, pager, next, jumper"
  167. :total="total"
  168. @current-change="handleCurrentChange"
  169. />
  170. </div>
  171. </div>
  172. </div>
  173. </template>
  174. <script setup lang="ts">
  175. import moment from 'moment'
  176. import { useRouter } from 'vue-router'
  177. import request from '@/config/axios'
  178. import { DICT_TYPE, getDictLabel, getDictOptions } from '@/utils/dict'
  179. import { getAssetURL } from '@/utils/auth'
  180. defineOptions({ name: 'PurchaseContract' })
  181. const isSignListAll = getDictOptions(DICT_TYPE.CONTRACT_SIGN_STATUS)
  182. const signWayAllList = getDictOptions(DICT_TYPE.CONTRACT_SIGN_WAY)
  183. const mainTypeAllList = getDictOptions(DICT_TYPE.CONTRACT_MAIN_TYPE)
  184. const secondTypeAllList = getDictOptions(DICT_TYPE.CONTRACT_SECOND_TYPE)
  185. const router = useRouter()
  186. const tableRef: any = ref(null)
  187. const tableHeight: any = ref(0)
  188. const queryParams = reactive<{
  189. contractNumber: string
  190. name: string
  191. pageNo: number
  192. pageSize: number
  193. isSign: any
  194. signWay: any
  195. mainType: any
  196. secondType: any
  197. contractOn: string
  198. contractOff: string
  199. }>({
  200. contractNumber: '',
  201. name: '',
  202. pageNo: 1,
  203. pageSize: 15,
  204. isSign: '',
  205. signWay: '',
  206. mainType: '',
  207. secondType: '',
  208. contractOn: '',
  209. contractOff: ''
  210. })
  211. const lxsjObj = ref()
  212. const infoList: any = ref([
  213. {
  214. icon: 'xmzx/xmzcz',
  215. name: '总合同金额(万元)',
  216. key: 'contractAmount'
  217. },
  218. {
  219. icon: 'xmzx/xmzcb',
  220. name: '总开票金额(万元)',
  221. key: 'invoiceAmount'
  222. },
  223. {
  224. icon: 'xmzx/xmzlr',
  225. name: '总回款金额(万元)',
  226. key: 'returnAmount'
  227. },
  228. {
  229. icon: 'xmzx/xmzlr',
  230. name: '总应收款(万元)',
  231. key: 'receivableAmount'
  232. },
  233. {
  234. icon: 'xmzx/xmzlr',
  235. name: '总合同余额(万元)',
  236. key: 'contractBalance'
  237. }
  238. ])
  239. const handleCurrentChange = (pageNo: number) => {
  240. queryParams.pageNo = pageNo
  241. queryContractListAjax()
  242. }
  243. const operateClick = (row: any) => {
  244. router.push({
  245. path: '/projectDetail',
  246. query: { id: row.projectId, contractId: row.id }
  247. })
  248. }
  249. const tableData = ref<Array<any>>([])
  250. const total = ref<number>()
  251. const searchHandle: () => void = () => {
  252. queryContractListAjax()
  253. }
  254. const queryContractListAjax = async (): Promise<void> => {
  255. const urlApi = `/contract/page`
  256. if (lxsjObj.value && lxsjObj.value.length > 0) {
  257. queryParams.contractOn = moment(lxsjObj.value[0]).format('YYYY-MM-DD')
  258. queryParams.contractOff = moment(lxsjObj.value[1]).format('YYYY-MM-DD')
  259. }
  260. const sendData = {
  261. ...queryParams,
  262. pageSize: 15
  263. }
  264. const result = await request.get({ url: urlApi, params: sendData }, '/business')
  265. tableData.value = result['records']
  266. total.value = result['total']
  267. }
  268. queryContractListAjax()
  269. /**
  270. * 合同台账成本统计
  271. */
  272. const contractListCalc = ref({
  273. contractAmount: 0,
  274. contractBalance: 0,
  275. invoiceAmount: 19198840,
  276. returnAmount: 0,
  277. receivableAmount: 0
  278. })
  279. const queryContractListCalc = async (): Promise<void> => {
  280. const urlApi = `/contract/list/calc`
  281. if (lxsjObj.value && lxsjObj.value.length > 0) {
  282. queryParams.contractOn = moment(lxsjObj.value[0]).format('YYYY-MM-DD')
  283. queryParams.contractOff = moment(lxsjObj.value[1]).format('YYYY-MM-DD')
  284. }
  285. const sendData = {
  286. ...queryParams,
  287. pageSize: 15
  288. }
  289. const result = await request.get({ url: urlApi, params: sendData }, '/business')
  290. contractListCalc.value = result
  291. }
  292. queryContractListCalc()
  293. onMounted(() => {
  294. tableHeight.value = tableRef.value.clientHeight
  295. })
  296. </script>