list.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. <template>
  2. <div>
  3. <a-card size="small" :bordered="false" class="searchBoxNormal">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline" ref="ruleForm">
  7. <a-row :gutter="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="审核时间">
  10. <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="费用单号" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  15. <a-input id="expenseReimbursementDetailList-expenseAccountNo" v-model.trim="queryParam.expenseAccountNo" allowClear placeholder="请输入费用单号"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="申请人" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  20. <employee style="width: 100%;" id="expenseReimbursementDetailList-applyPersonSn" @change="employeeChange" v-model="queryParam.applyPersonSn"></employee>
  21. </a-form-item>
  22. </a-col>
  23. <template v-if="advanced">
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="申请部门" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  26. <department style="width: 100%;" id="expenseReimbursementDetailList-applyDepartmentSn" @change="applyDepartmentChange" v-model="queryParam.applyDepartmentSn"></department>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="6" :sm="24">
  30. <a-form-item label="费用类型">
  31. <expenseType
  32. id="expenseReimbursementDetailList-expenseType"
  33. v-model="expenseTypes"
  34. :changeOnSelect="true"
  35. @change="expenseChange"
  36. placeholder="请选择费用类型"
  37. ></expenseType>
  38. </a-form-item>
  39. </a-col>
  40. <a-col :md="6" :sm="24">
  41. <a-form-item label="费用发生月份">
  42. <a-month-picker
  43. placeholder="请选择月份"
  44. v-model="queryParam.expenseDate"
  45. @change="onChange"
  46. :disabled-date="disabledDate"
  47. style="width: 100%;"/>
  48. </a-form-item>
  49. </a-col>
  50. <a-col :md="6" :sm="24">
  51. <a-form-item label="记账类型">
  52. <v-select
  53. v-model="queryParam.accountType"
  54. ref="accountType"
  55. id="expenseReimbursementDetailList-accountType"
  56. code="EXPENSE_ACCOUNT_TYPE"
  57. placeholder="请选择记账类型"
  58. allowClear></v-select>
  59. </a-form-item>
  60. </a-col>
  61. <a-col :md="6" :sm="24">
  62. <a-form-item label="记账名称">
  63. <!-- 部门 -->
  64. <department v-show="queryParam.accountType=='INNER_ACCOUNT'" @change="accountNameSnChange" v-model="queryParam.accountNameSn" placeholder="请选择记账名称(输入名称搜索)"></department>
  65. <!-- 经销商 -->
  66. <custList v-show="queryParam.accountType=='CUSTOMER'" ref="custList" @change="accountNameSnChange" placeholder="请选择记账名称(输入名称搜索)"></custList>
  67. <!-- 供应商 -->
  68. <supplier v-show="queryParam.accountType=='OUT_ACCOUNT'" @change="accountNameSnChange" v-model="queryParam.accountNameSn" placeholder="请选择记账名称(输入名称搜索)"></supplier>
  69. <!-- 其它往来 -->
  70. <otherTransactions v-show="queryParam.accountType=='OTHER_ACCOUNT'" v-model="queryParam.accountNameSn" placeholder="请选择记账名称(输入名称搜索)"></otherTransactions>
  71. <a-select style="width: 100%" v-if="!queryParam.accountType" placeholder="请选择记账名称">
  72. <a-select-option value="" :disabled="true">
  73. 请先选择记账类型
  74. </a-select-option>
  75. </a-select>
  76. </a-form-item>
  77. </a-col>
  78. <a-col :md="6" :sm="24">
  79. <a-form-item label="所属区域">
  80. <a-input id="expenseReimbursementDetailList-subarea" v-model.trim="queryParam.subareaArea.subareaName" allowClear placeholder="请输入所属区域"/>
  81. </a-form-item>
  82. </a-col>
  83. <a-col :md="6" :sm="24">
  84. <a-form-item label="所属分区">
  85. <a-input id="expenseReimbursementDetailList-subareaArea" v-model.trim="queryParam.subareaArea.subareaAreaName" allowClear placeholder="请输入所属分区"/>
  86. </a-form-item>
  87. </a-col>
  88. <a-col :md="6" :sm="24">
  89. <a-form-model-item label="所属省份">
  90. <Area id="expenseReimbursementDetailList-area" placeholder="请选择所属省份" v-model="queryParam.provinceSn"></Area>
  91. </a-form-model-item>
  92. </a-col>
  93. <a-col :md="6" :sm="24">
  94. <a-form-model-item label="所属城市">
  95. <Area id="expenseReimbursementDetailList-area" placeholder="请选择所属城市" leve="city" :parentId="queryParam.provinceSn" v-model="queryParam.citySn"></Area>
  96. </a-form-model-item>
  97. </a-col>
  98. <a-col :md="6" :sm="24">
  99. <a-form-item label="费用承担方类型" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  100. <v-select
  101. code="EXPENSE_ACCOUNT_DETAIL_SPLIT_OBJ_TYPE"
  102. allowClear
  103. style="width: 100%;"
  104. v-model="queryParam.splitObjType"
  105. @change="splitObjTypeChange"
  106. placeholder="请选择承担方类型"
  107. ></v-select>
  108. </a-form-item>
  109. </a-col>
  110. <a-col :md="6" :sm="24">
  111. <a-form-item label="费用承担方" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  112. <!-- 部门 -->
  113. <department v-show="queryParam.splitObjType=='DEPARTMENT'" style="width: 100%;" placeholder="请选择承担方" v-model="queryParam.splitObjSn"></department>
  114. <!-- 经销商 -->
  115. <custList v-show="queryParam.splitObjType=='CUSTOMER'" ref="custList" @change="custChange" placeholder="请选择(输入名称搜索)"></custList>
  116. <a-select style="width: 100%" v-if="!queryParam.splitObjType" placeholder="请选择">
  117. <a-select-option value="" :disabled="true">
  118. 请先选择承担方类型
  119. </a-select-option>
  120. </a-select>
  121. </a-form-item>
  122. </a-col>
  123. <a-col :md="6" :sm="24" v-show="queryParam.splitObjType=='DEPARTMENT'">
  124. <a-form-item label="费用承担人" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  125. <employee style="width: 100%;" placeholder="请选择承担人员" v-model="queryParam.childSplitObjSn"></employee>
  126. </a-form-item>
  127. </a-col>
  128. <a-col :md="6" :sm="24" v-show="queryParam.splitObjType==undefined">
  129. <a-form-item label="费用承担人" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  130. <a-select style="width: 100%" placeholder="请选择">
  131. <a-select-option value="" :disabled="true">
  132. 请先选择承担方类型
  133. </a-select-option>
  134. </a-select>
  135. </a-form-item>
  136. </a-col>
  137. <a-col :md="6" :sm="24" v-show="isShowCustomerSearch">
  138. <a-form-item label="客服">
  139. <customerService ref="customerName" v-model="queryParam.bizUserSn"></customerService>
  140. </a-form-item>
  141. </a-col>
  142. </template>
  143. <a-col :md="isShowCustomerSearch?24:6" :sm="24" :style="{textAlign:isShowCustomerSearch?'center':''}">
  144. <div class="table-page-search-submitButtons">
  145. <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
  146. <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  147. <a-button
  148. style="margin-left: 10px"
  149. type="primary"
  150. class="button-warning"
  151. @click="handleExport"
  152. :disabled="disabled"
  153. :loading="exportLoading"
  154. v-if="$hasPermissions('B_expenseAcctDetailReport')"
  155. id="expenseAcctDetail-export">导出</a-button>
  156. <a @click="advanced=!advanced" style="margin-left: 8px">
  157. {{ advanced ? '收起' : '展开' }}
  158. <a-icon :type="advanced ? 'up' : 'down'"/>
  159. </a>
  160. </div>
  161. </a-col>
  162. </a-row>
  163. </a-form>
  164. </div>
  165. </a-card>
  166. <a-card size="small" :bordered="false" class="expenseReimbursementDetailList-wrap">
  167. <a-spin :spinning="spinning" tip="Loading...">
  168. <!-- alert -->
  169. <div>
  170. 总单数:<strong>{{ countData&&(countData.detailNum || countData.detailNum==0) ? countData.detailNum : '--' }}</strong>;
  171. 总费用金额:<strong>{{ countData&&(countData.expense || countData.expense==0) ? toThousands(countData.expense) : '--' }}</strong>;
  172. </div>
  173. <!-- 列表 -->
  174. <s-table
  175. class="sTable fixPagination"
  176. ref="table"
  177. :style="{ height: tableHeight+80+'px' }"
  178. size="small"
  179. rowKeyName="no"
  180. :rowKey="(record) => record.no"
  181. :columns="columns"
  182. :data="loadData"
  183. :pageSize="30"
  184. :scroll="{ y: tableHeight,x:2250 }"
  185. :defaultLoadData="false"
  186. bordered>
  187. </s-table>
  188. </a-spin>
  189. </a-card>
  190. </div>
  191. </template>
  192. <script>
  193. import { commonMixin } from '@/utils/mixin'
  194. import moment from 'moment'
  195. import 'moment/locale/zh-cn'
  196. import getDate from '@/libs/getDate.js'
  197. import rangeDate from '@/views/common/rangeDate.vue'
  198. import subarea from '@/views/common/subarea.js'
  199. import { STable, VSelect } from '@/components'
  200. import Area from '@/views/common/area.js'
  201. import department from '../expenseReimbursement/department.js'
  202. import employee from '../expenseReimbursement/employee.js'
  203. import custList from '@/views/common/custList.vue'
  204. import supplier from '@/views/common/supplier.js'
  205. import expenseType from '@/views/common/expenseType.js'
  206. import customerService from '@/views/common/customerService'
  207. import { expenseAccountDetailList, expenseAcctDetailReport, expenseAccountDetailCount } from '@/api/expenseManagement'
  208. import otherTransactions from '@/views/common/otherTransactions.js'
  209. import { hdExportExcel } from '@/libs/exportExcel'
  210. moment.locale('zh-cn')
  211. export default {
  212. name: 'ExpenseReimbursementDetailList',
  213. mixins: [commonMixin],
  214. components: { STable, VSelect, department, employee, subarea, rangeDate, Area, custList, supplier, expenseType, otherTransactions, customerService },
  215. data () {
  216. const _this = this
  217. return {
  218. spinning: false,
  219. advanced: true, // 高级搜索 展开/关闭
  220. disabled: false, // 查询、重置按钮是否可操作
  221. openModal: false, // 选择客户弹框是否显示
  222. exportLoading: false,
  223. tableHeight: 0,
  224. time: [
  225. moment(getDate.getCurrMonthDays().starttime, 'YYYY-MM-DD'),
  226. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  227. ],
  228. countData: null,
  229. expenseTypes: [],
  230. // 查询参数
  231. queryParam: {
  232. expenseDate: undefined, // 月份
  233. beginDate: getDate.getCurrMonthDays().starttime,
  234. endDate: getDate.getCurrMonthDays().endtime,
  235. expenseAccountNo: '', // 费用单号
  236. applyPersonSn: undefined, // 申请人
  237. applyDepartmentSn: undefined, // 申请部门
  238. expenseType: undefined, // 费用类型
  239. xpenseType2: undefined, // 费用类型1
  240. xpenseType3: undefined, // 费用类型2
  241. accountType: undefined, // 记账类型
  242. accountNameSn: undefined, // 记账名称
  243. splitObjType: undefined, // 费用承担方类型
  244. splitObjSn: undefined, // 费用承担方
  245. childSplitObjSn: undefined, // 费用承担人
  246. subareaArea: {
  247. subareaName: '',
  248. subareaAreaName: ''
  249. },
  250. provinceName: '',
  251. cityName: '',
  252. provinceSn: undefined,
  253. citySn: undefined,
  254. bizUserSn: undefined
  255. },
  256. addrProvinceList: [], // 省列表
  257. addrCityList: [], // 城市列表数据
  258. // 加载数据方法 必须为 Promise 对象
  259. loadData: parameter => {
  260. this.disabled = true
  261. this.spinning = true
  262. delete parameter.tableId
  263. delete parameter.index
  264. const params = Object.assign(parameter, this.queryParam)
  265. if (params.expenseDate) {
  266. params.expenseDate = params.expenseDate + '-01'
  267. }
  268. // 统计
  269. this.getDetailCount(params)
  270. return expenseAccountDetailList(params).then(res => {
  271. let data
  272. if (res.status == 200) {
  273. data = res.data
  274. const no = (data.pageNo - 1) * data.pageSize
  275. for (var i = 0; i < data.list.length; i++) {
  276. data.list[i].no = no + i + 1
  277. }
  278. this.disabled = false
  279. }
  280. this.spinning = false
  281. return data
  282. })
  283. },
  284. columns: [{ title: '序号', dataIndex: 'no', width: 60, align: 'center' },
  285. { title: '审核时间', dataIndex: 'finishDate', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  286. { title: '费用单号', dataIndex: 'expenseAccountNo', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  287. { title: '申请人', dataIndex: 'applyPersonName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
  288. { title: '申请部门', dataIndex: 'applyDepartmentName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
  289. { title: '费用类型(一级)', dataIndex: 'expenseTypeName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
  290. { title: '费用类型(二级)', dataIndex: 'expenseTypeName2', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
  291. { title: '费用发生月份', dataIndex: 'expenseDate', width: 90, align: 'center', customRender: function (text) { return moment(text).format('YYYY年MM月') || '--' } },
  292. { title: '主题', dataIndex: 'title', align: 'center', width: 150, customRender: function (text) { return text || '--' }, ellipsis: true },
  293. { title: '详细说明', dataIndex: 'content', align: 'center', width: 150, customRender: function (text) { return text || '--' }, ellipsis: true },
  294. { title: '记账类型', dataIndex: 'accountTypeDictValue', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
  295. { title: '记账名称', dataIndex: 'accountName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  296. { title: '财务编码', dataIndex: 'accountNameFnumber', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  297. { title: '所属区域', dataIndex: 'subareaArea.subareaName', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
  298. { title: '所属分区', dataIndex: 'subareaArea.subareaAreaName', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
  299. { title: '所属省份', dataIndex: 'provinceName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
  300. { title: '所属城市', dataIndex: 'cityName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
  301. { title: '记账费用', dataIndex: 'expense', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  302. { title: '费用承担方', dataIndex: 'splitObjName', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  303. { title: '财务编码', dataIndex: 'splitObjFnumber', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  304. { title: '费用承担金额', dataIndex: 'splitAmount', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  305. { title: '费用承担人', dataIndex: 'childSplitObjName', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  306. { title: '人员平摊费用', dataIndex: 'childSplitAmount', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
  307. ]
  308. }
  309. },
  310. methods: {
  311. // 时间 change
  312. dateChange (date) {
  313. this.queryParam.beginDate = date[0]
  314. this.queryParam.endDate = date[1]
  315. },
  316. onChange (date, dateString) {
  317. this.queryParam.expenseDate = dateString
  318. },
  319. expenseChange (val, opts) {
  320. console.log(val, opts)
  321. this.expenseTypes = val || []
  322. this.queryParam.expenseType = val && val[0] ? val[0] : ''
  323. this.queryParam.expenseType2 = val && val[1] ? val[1] : ''
  324. this.queryParam.expenseType3 = val && val[2] ? val[2] : ''
  325. },
  326. custChange (val) {
  327. this.queryParam.splitObjSn = val.key
  328. },
  329. disabledDate (current) {
  330. return current && current > moment().endOf('day')
  331. },
  332. employeeChange (v) {
  333. this.queryParam.employeeSn = v.key
  334. },
  335. applyDepartmentChange (v) {
  336. this.queryParam.applyDepartmentSn = v.key
  337. },
  338. // 记账名称变化时
  339. accountNameSnChange (v, row) {
  340. console.log(v, row)
  341. if (v) {
  342. this.queryParam.accountNameSn = v.key
  343. }
  344. },
  345. splitObjTypeChange (v) {
  346. this.queryParam.splitObjSn = undefined
  347. this.queryParam.childSplitObjSn = undefined
  348. this.$refs.custList.dealerName = []
  349. },
  350. getDetailCount (params) {
  351. expenseAccountDetailCount(params).then(res => {
  352. this.countData = res.data || null
  353. })
  354. },
  355. // 导出
  356. handleExport () {
  357. const _this = this
  358. const params = JSON.parse(JSON.stringify(_this.queryParam))
  359. if (params.expenseDate) {
  360. params.expenseDate = params.expenseDate + '-01'
  361. }
  362. _this.exportLoading = true
  363. _this.spinning = true
  364. hdExportExcel(expenseAcctDetailReport, params, '费用报销明细统计报表', function () {
  365. _this.exportLoading = false
  366. _this.spinning = false
  367. })
  368. },
  369. // 重置
  370. resetSearchForm () {
  371. this.$refs.rangeDate.resetDate(this.time)
  372. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  373. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  374. this.queryParam = {
  375. expenseDate: '', // 月份
  376. beginDate: getDate.getCurrMonthDays().starttime,
  377. endDate: getDate.getCurrMonthDays().endtime,
  378. expenseAccountNo: '', // 费用单号
  379. applyPersonSn: undefined, // 申请人
  380. applyDepartmentSn: undefined, // 申请部门
  381. expenseType: undefined, // 费用类型
  382. expenseType2: undefined, // 费用类型2
  383. expenseType3: undefined, // 费用类型3
  384. accountType: undefined, // 记账类型
  385. accountNameSn: undefined, // 记账名称
  386. splitObjType: undefined, // 费用承担方类型
  387. splitObjSn: undefined, // 费用承担方
  388. childSplitObjSn: undefined, // 费用承担人
  389. subareaArea: {
  390. subareaName: '',
  391. subareaAreaName: ''
  392. },
  393. provinceName: '',
  394. cityName: '',
  395. provinceSn: undefined,
  396. citySn: undefined,
  397. bizUserSn: undefined
  398. }
  399. this.expenseTypes = []
  400. this.$refs.table.refresh(true)
  401. },
  402. pageInit () {
  403. const _this = this
  404. this.$nextTick(() => { // 页面渲染完成后的回调
  405. _this.setTableH()
  406. })
  407. },
  408. setTableH () {
  409. const tableSearchH = this.$refs.tableSearch.offsetHeight
  410. this.tableHeight = window.innerHeight - tableSearchH - 235
  411. }
  412. },
  413. watch: {
  414. advanced (newValue, oldValue) {
  415. const _this = this
  416. this.$nextTick(() => { // 页面渲染完成后的回调
  417. _this.setTableH()
  418. })
  419. },
  420. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  421. this.setTableH()
  422. }
  423. },
  424. mounted () {
  425. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  426. this.pageInit()
  427. this.resetSearchForm()
  428. }
  429. },
  430. activated () {
  431. // 如果是新页签打开,则重置当前页面
  432. if (this.$store.state.app.isNewTab) {
  433. this.pageInit()
  434. this.resetSearchForm()
  435. }
  436. // 仅刷新列表,不重置页面
  437. if (this.$store.state.app.updateList) {
  438. this.pageInit()
  439. this.$refs.table.refresh()
  440. }
  441. },
  442. beforeRouteEnter (to, from, next) {
  443. next(vm => {})
  444. }
  445. }
  446. </script>
  447. <style lang="less">
  448. .expenseReimbursementDetailList-wrap{
  449. .sTable{
  450. margin-top: 10px;
  451. .badge-con-t{
  452. .ant-badge-count{
  453. transform: scale(0.8);
  454. font-size: 13px;
  455. }
  456. }
  457. }
  458. }
  459. </style>