list.vue 23 KB

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