list.vue 18 KB

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