list.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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. <v-select
  32. v-model="queryParam.expenseType"
  33. ref="expenseType"
  34. id="expenseReimbursementDetailList-expenseType"
  35. code="EXPENSE_TYPE"
  36. placeholder="请选择费用类型"
  37. allowClear></v-select>
  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. <!-- 列表 -->
  154. <s-table
  155. class="sTable fixPagination"
  156. ref="table"
  157. :style="{ height: tableHeight+70+'px' }"
  158. size="small"
  159. :rowKey="(record) => record.id"
  160. :columns="columns"
  161. :data="loadData"
  162. :scroll="{ y: tableHeight,x:2010 }"
  163. :defaultLoadData="false"
  164. bordered>
  165. </s-table>
  166. </a-spin>
  167. </a-card>
  168. </template>
  169. <script>
  170. import moment from 'moment'
  171. import 'moment/locale/zh-cn'
  172. import getDate from '@/libs/getDate.js'
  173. import rangeDate from '@/views/common/rangeDate.vue'
  174. import subarea from '@/views/common/subarea.js'
  175. import { STable, VSelect } from '@/components'
  176. import Area from '@/views/common/area.js'
  177. import department from '../expenseReimbursement/department.js'
  178. import employee from '../expenseReimbursement/employee.js'
  179. import custList from '@/views/common/custList.vue'
  180. import supplier from '@/views/common/supplier.js'
  181. import { expenseAccountDetailList, expenseAcctDetailReport } from '@/api/expenseManagement'
  182. import { hdExportExcel } from '@/libs/exportExcel'
  183. moment.locale('zh-cn')
  184. export default {
  185. name: 'TableList',
  186. components: { STable, VSelect, department, employee, subarea, rangeDate, Area, custList, supplier },
  187. data () {
  188. return {
  189. spinning: false,
  190. advanced: true, // 高级搜索 展开/关闭
  191. disabled: false, // 查询、重置按钮是否可操作
  192. openModal: false, // 选择客户弹框是否显示
  193. exportLoading: false,
  194. tableHeight: 0,
  195. time: [
  196. moment(getDate.getCurrMonthDays().starttime, 'YYYY-MM-DD'),
  197. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  198. ],
  199. // 查询参数
  200. queryParam: {
  201. expenseDate: undefined, // 月份
  202. beginDate: getDate.getCurrMonthDays().starttime,
  203. endDate: getDate.getCurrMonthDays().endtime,
  204. expenseAccountNo: '', // 费用单号
  205. applyPersonSn: undefined, // 申请人
  206. applyDepartmentSn: undefined, // 申请部门
  207. expenseType: undefined, // 费用类型
  208. accountType: undefined, // 记账类型
  209. accountNameSn: undefined, // 记账名称
  210. splitObjType: undefined, // 费用承担方类型
  211. splitObjSn: undefined, // 费用承担方
  212. childSplitObjSn: undefined, // 费用承担人
  213. subareaSn: undefined,
  214. provinceName: '',
  215. cityName: '',
  216. provinceSn: undefined,
  217. citySn: undefined
  218. },
  219. addrProvinceList: [], // 省列表
  220. addrCityList: [], // 城市列表数据
  221. // 加载数据方法 必须为 Promise 对象
  222. loadData: parameter => {
  223. this.disabled = true
  224. this.spinning = true
  225. delete parameter.tableId
  226. delete parameter.index
  227. const params = Object.assign(parameter, this.queryParam)
  228. if (params.expenseDate) {
  229. params.expenseDate = params.expenseDate + '-01'
  230. }
  231. return expenseAccountDetailList(params).then(res => {
  232. let data
  233. if (res.status == 200) {
  234. data = res.data
  235. const no = (data.pageNo - 1) * data.pageSize
  236. for (var i = 0; i < data.list.length; i++) {
  237. data.list[i].no = no + i + 1
  238. }
  239. this.disabled = false
  240. }
  241. this.spinning = false
  242. return data
  243. })
  244. },
  245. columns: [{ title: '序号', dataIndex: 'no', width: 60, align: 'center' },
  246. { title: '审核时间', dataIndex: 'finishDate', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  247. { title: '费用单号', dataIndex: 'expenseAccountNo', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  248. { title: '申请人', dataIndex: 'applyPersonName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
  249. { title: '申请部门', dataIndex: 'applyDepartmentName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
  250. { title: '费用类型', dataIndex: 'expenseTypeDictValue', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
  251. { title: '费用发生月份', dataIndex: 'expenseDate', width: 90, align: 'center', customRender: function (text) { return moment(text).format('YYYY年MM月') || '--' } },
  252. { title: '主题', dataIndex: 'title', align: 'center', width: 150, customRender: function (text) { return text || '--' }, ellipsis: true },
  253. { title: '记账类型', dataIndex: 'accountTypeDictValue', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
  254. { title: '记账名称', dataIndex: 'accountName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  255. { title: '财务编码', dataIndex: 'accountNameFnumber', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  256. { title: '所属区域', dataIndex: 'subareaNames', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  257. { title: '所属省份', dataIndex: 'provinceName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
  258. { title: '所属城市', dataIndex: 'cityName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
  259. { title: '记账费用', dataIndex: 'expense', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  260. { title: '费用承担方', dataIndex: 'splitObjName', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  261. { title: '财务编码', dataIndex: 'splitObjFnumber', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  262. { title: '费用承担金额', dataIndex: 'splitAmount', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  263. { title: '费用承担人', dataIndex: 'childSplitObjName', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  264. { title: '人员平摊费用', dataIndex: 'childSplitAmount', width: 120, align: 'center', customRender: function (text) { return text || '--' } }
  265. ]
  266. }
  267. },
  268. methods: {
  269. // 时间 change
  270. dateChange (date) {
  271. this.queryParam.beginDate = date[0]
  272. this.queryParam.endDate = date[1]
  273. },
  274. onChange (date, dateString) {
  275. this.queryParam.expenseDate = dateString
  276. },
  277. custChange (val) {
  278. this.queryParam.splitObjSn = val.key
  279. },
  280. disabledDate (current) {
  281. return current && current > moment().endOf('day')
  282. },
  283. employeeChange (v) {
  284. this.queryParam.employeeSn = v.key
  285. },
  286. applyDepartmentChange (v) {
  287. this.queryParam.applyDepartmentSn = v.key
  288. },
  289. // 记账名称变化时
  290. accountNameSnChange (v, row) {
  291. console.log(v, row)
  292. if (v) {
  293. this.queryParam.accountNameSn = v.key
  294. }
  295. },
  296. splitObjTypeChange (v) {
  297. this.queryParam.splitObjSn = undefined
  298. this.queryParam.childSplitObjSn = undefined
  299. this.$refs.custList.dealerName = []
  300. },
  301. // 导出
  302. handleExport () {
  303. const _this = this
  304. const params = JSON.parse(JSON.stringify(_this.queryParam))
  305. if (params.expenseDate) {
  306. params.expenseDate = params.expenseDate + '-01'
  307. }
  308. _this.exportLoading = true
  309. _this.spinning = true
  310. hdExportExcel(expenseAcctDetailReport, params, '费用报销明细统计报表', function () {
  311. _this.exportLoading = false
  312. _this.spinning = false
  313. })
  314. },
  315. // 重置
  316. resetSearchForm () {
  317. this.$refs.rangeDate.resetDate(this.time)
  318. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  319. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  320. this.queryParam = {
  321. queryParam: {
  322. expenseDate: '', // 月份
  323. beginDate: getDate.getCurrMonthDays().starttime,
  324. endDate: getDate.getCurrMonthDays().endtime,
  325. expenseAccountNo: '', // 费用单号
  326. applyPersonSn: undefined, // 申请人
  327. applyDepartmentSn: undefined, // 申请部门
  328. expenseType: undefined, // 费用类型
  329. accountType: undefined, // 记账类型
  330. accountNameSn: undefined, // 记账名称
  331. splitObjType: undefined, // 费用承担方类型
  332. splitObjSn: undefined, // 费用承担方
  333. childSplitObjSn: undefined, // 费用承担人
  334. subareaSn: undefined,
  335. provinceName: '',
  336. cityName: '',
  337. provinceSn: undefined,
  338. citySn: undefined
  339. }
  340. }
  341. this.$refs.table.refresh(true)
  342. },
  343. pageInit () {
  344. const _this = this
  345. this.$nextTick(() => { // 页面渲染完成后的回调
  346. _this.setTableH()
  347. })
  348. },
  349. setTableH () {
  350. const tableSearchH = this.$refs.tableSearch.offsetHeight
  351. this.tableHeight = window.innerHeight - tableSearchH - 195
  352. }
  353. },
  354. watch: {
  355. advanced (newValue, oldValue) {
  356. const _this = this
  357. this.$nextTick(() => { // 页面渲染完成后的回调
  358. _this.setTableH()
  359. })
  360. },
  361. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  362. this.setTableH()
  363. }
  364. },
  365. mounted () {
  366. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  367. this.pageInit()
  368. this.resetSearchForm()
  369. }
  370. },
  371. activated () {
  372. // 如果是新页签打开,则重置当前页面
  373. if (this.$store.state.app.isNewTab) {
  374. this.pageInit()
  375. this.resetSearchForm()
  376. }
  377. // 仅刷新列表,不重置页面
  378. if (this.$store.state.app.updateList) {
  379. this.pageInit()
  380. this.$refs.table.refresh()
  381. }
  382. },
  383. beforeRouteEnter (to, from, next) {
  384. next(vm => {})
  385. }
  386. }
  387. </script>
  388. <style lang="less">
  389. .expenseReimbursementDetailList-wrap{
  390. .sTable{
  391. margin-top: 10px;
  392. .badge-con-t{
  393. .ant-badge-count{
  394. transform: scale(0.8);
  395. font-size: 13px;
  396. }
  397. }
  398. }
  399. }
  400. </style>