list.vue 20 KB

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