list.vue 20 KB

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