123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393 |
- <template>
- <a-card size="small" :bordered="false" class="expenseReimbursementDetailList-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <!-- 搜索条件 -->
- <div ref="tableSearch" class="table-page-search-wrapper">
- <a-form layout="inline" ref="ruleForm">
- <a-row :gutter="15">
- <a-col :md="6" :sm="24">
- <a-form-item label="审核时间">
- <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="费用单号" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
- <a-input id="expenseReimbursementDetailList-expenseAccountNo" v-model.trim="queryParam.expenseAccountNo" allowClear placeholder="请输入销售单号"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="申请人" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
- <employee style="width: 100%;" id="expenseReimbursementDetailList-applyPersonSn" @change="employeeChange" v-model="queryParam.applyPersonSn"></employee>
- </a-form-item>
- </a-col>
- <template v-if="advanced">
- <a-col :md="6" :sm="24">
- <a-form-item label="申请部门" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
- <department style="width: 100%;" id="expenseReimbursementDetailList-applyDepartmentSn" @change="applyDepartmentChange" v-model="queryParam.applyDepartmentSn"></department>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="费用类型">
- <v-select
- v-model="queryParam.expenseType"
- ref="expenseType"
- id="expenseReimbursementDetailList-expenseType"
- code="EXPENSE_TYPE"
- placeholder="请选择费用类型"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="费用发生月份">
- <a-month-picker
- placeholder="请选择月份"
- v-model="queryParam.expenseDate"
- @change="onChange"
- locale="zh-cn"
- :disabled-date="disabledDate"
- style="width: 100%;"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="记账类型">
- <v-select
- v-model="queryParam.accountType"
- ref="accountType"
- id="expenseReimbursementDetailList-accountType"
- code="EXPENSE_ACCOUNT_TYPE"
- placeholder="请选择状态"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="记账名称">
- <!-- 部门 -->
- <department v-show="queryParam.accountType=='INNER_ACCOUNT'" @change="accountNameSnChange" v-model="queryParam.accountNameSn" placeholder="请选择记账名称(输入名称搜索)"></department>
- <!-- 经销商 -->
- <custList v-show="queryParam.accountType=='CUSTOMER'" ref="custList" @change="accountNameSnChange" placeholder="请选择记账名称(输入名称搜索)"></custList>
- <!-- 供应商 -->
- <supplier v-show="queryParam.accountType=='OUT_ACCOUNT'" @change="accountNameSnChange" v-model="queryParam.accountNameSn" placeholder="请选择记账名称(输入名称搜索)"></supplier>
- <a-select style="width: 100%" v-if="!queryParam.accountType" placeholder="请选择">
- <a-select-option value="" :disabled="true">
- 请先选择记账类型
- </a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="所属区域">
- <subarea id="expenseReimbursementDetailList-subarea" v-model="queryParam.subareaSn"></subarea>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-model-item label="所属省份">
- <Area id="expenseReimbursementDetailList-area" placeholder="请选择所属省份" v-model="queryParam.provinceSn"></Area>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-model-item label="所属城市">
- <Area id="expenseReimbursementDetailList-area" placeholder="请选择所属城市" leve="city" :parentId="queryParam.provinceSn" v-model="queryParam.citySn"></Area>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="费用承担方类型" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
- <v-select
- code="EXPENSE_ACCOUNT_DETAIL_SPLIT_OBJ_TYPE"
- allowClear
- style="width: 100%;"
- v-model="queryParam.splitObjType"
- placeholder="请选择承担方类型"
- ></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="费用承担方" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
- <!-- 部门 -->
- <department v-show="queryParam.splitObjType=='DEPARTMENT'" style="width: 100%;" placeholder="请选择承担方" v-model="queryParam.splitObjSn"></department>
- <!-- 经销商 -->
- <custList v-show="queryParam.splitObjType=='CUSTOMER'" @change="custChange" placeholder="请选择(输入名称搜索)"></custList>
- <a-select style="width: 100%" v-if="!queryParam.splitObjType" placeholder="请选择">
- <a-select-option value="" :disabled="true">
- 请先选择承担方类型
- </a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24" v-show="queryParam.splitObjType=='DEPARTMENT'">
- <a-form-item label="费用承担人" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
- <employee style="width: 100%;" placeholder="请选择承担人员" v-model="queryParam.childSplitObjSn"></employee>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24" v-show="queryParam.splitObjType==undefined">
- <a-form-item label="费用承担人" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
- <a-select style="width: 100%" placeholder="请选择">
- <a-select-option value="" :disabled="true">
- 请先选择承担方类型
- </a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- </template>
- <a-col :md="6" :sm="24">
- <span class="table-page-search-submitButtons">
- <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
- <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
- <a-button
- style="margin-left: 10px"
- type="primary"
- class="button-warning"
- @click="handleExport"
- :disabled="disabled"
- :loading="exportLoading"
- id="actualSalesReportList-export">导出</a-button>
- <a @click="advanced=!advanced" style="margin-left: 8px">
- {{ advanced ? '收起' : '展开' }}
- <a-icon :type="advanced ? 'up' : 'down'"/>
- </a>
- </span>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 列表 -->
- <s-table
- class="sTable fixPagination"
- ref="table"
- :style="{ height: tableHeight+70+'px' }"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :scroll="{ y: tableHeight,x:1770 }"
- :defaultLoadData="false"
- bordered>
- </s-table>
- </a-spin>
- </a-card>
- </template>
- <script>
- import locale from 'ant-design-vue/es/date-picker/locale/zh_CN'
- import moment from 'moment'
- import getDate from '@/libs/getDate.js'
- import rangeDate from '@/views/common/rangeDate.vue'
- import subarea from '@/views/common/subarea.js'
- import { STable, VSelect } from '@/components'
- import Area from '@/views/common/area.js'
- import department from '../expenseReimbursement/department.js'
- import employee from '../expenseReimbursement/employee.js'
- import custList from '@/views/common/custList.vue'
- import supplier from '@/views/common/supplier.js'
- import { expenseAccountDetailList, expenseAcctDetailReport } from '@/api/expenseManagement'
- import { hdExportExcel } from '@/libs/exportExcel'
- export default {
- name: 'TableList',
- components: { STable, VSelect, department, employee, subarea, rangeDate, Area, custList, supplier },
- data () {
- return {
- locale,
- spinning: false,
- advanced: false, // 高级搜索 展开/关闭
- disabled: false, // 查询、重置按钮是否可操作
- openModal: false, // 选择客户弹框是否显示
- exportLoading: false,
- tableHeight: 0,
- time: [
- moment(getDate.getCurrMonthDays().starttime, 'YYYY-MM-DD'),
- moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
- ],
- // 查询参数
- queryParam: {
- expenseDate: '', // 月份
- beginDate: getDate.getCurrMonthDays().starttime,
- endDate: getDate.getCurrMonthDays().endtime,
- expenseAccountNo: '', // 费用单号
- applyPersonSn: undefined, // 申请人
- applyDepartmentSn: undefined, // 申请部门
- expenseType: undefined, // 费用类型
- accountType: undefined, // 记账类型
- accountNameSn: undefined, // 记账名称
- splitObjType: undefined, // 费用承担方类型
- splitObjSn: undefined, // 费用承担方
- childSplitObjSn: undefined, // 费用承担人
- subareaSn: undefined,
- provinceName: '',
- cityName: '',
- provinceSn: undefined,
- citySn: undefined
- },
- addrProvinceList: [], // 省列表
- addrCityList: [], // 城市列表数据
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- delete parameter.tableId
- delete parameter.index
- const params = Object.assign(parameter, this.queryParam)
- if (params.expenseDate) {
- params.expenseDate = params.expenseDate + '-01'
- }
- return expenseAccountDetailList(params).then(res => {
- let data
- if (res.status == 200) {
- data = res.data
- const no = (data.pageNo - 1) * data.pageSize
- for (var i = 0; i < data.list.length; i++) {
- data.list[i].no = no + i + 1
- }
- this.disabled = false
- }
- this.spinning = false
- return data
- })
- },
- columns: [{ title: '序号', dataIndex: 'no', width: 60, align: 'center' },
- { title: '审核时间', dataIndex: 'finishDate', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '费用单号', dataIndex: 'expenseAccountNo', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '申请人', dataIndex: 'applyPersonName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '申请部门', dataIndex: 'applyDepartmentName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '费用类型', dataIndex: 'expenseTypeDictValue', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '费用发生月份', dataIndex: 'expenseDate', width: 90, align: 'center', customRender: function (text) { return moment(text).format('YYYY年MM月') || '--' } },
- { title: '主题', dataIndex: 'title', align: 'center', width: 150, customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '记账类型', dataIndex: 'accountTypeDictValue', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '记账名称', dataIndex: 'accountName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '所属区域', dataIndex: 'subareaNames', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '所属省份', dataIndex: 'provinceName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '所属城市', dataIndex: 'cityName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '记账费用', dataIndex: 'expense', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '费用承担方', dataIndex: 'splitObjName', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '费用承担金额', dataIndex: 'splitAmount', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '费用承担人', dataIndex: 'childSplitObjName', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '人员平摊费用', dataIndex: 'childSplitAmount', width: 120, align: 'center', customRender: function (text) { return text || '--' } }
- ]
- }
- },
- methods: {
- // 时间 change
- dateChange (date) {
- this.queryParam.beginDate = date[0]
- this.queryParam.endDate = date[1]
- },
- onChange (date, dateString) {
- this.queryParam.expenseDate = dateString
- },
- custChange (val) {
- this.queryParam.splitObjSn = val.key
- },
- disabledDate (current) {
- return current && current > moment().endOf('day')
- },
- employeeChange (v) {
- this.queryParam.employeeSn = v.key
- },
- applyDepartmentChange (v) {
- this.queryParam.applyDepartmentSn = v.key
- },
- // 记账名称变化时
- accountNameSnChange (v, row) {
- console.log(v, row)
- if (v) {
- this.queryParam.accountNameSn = v.key
- }
- },
- // 导出
- handleExport () {
- const _this = this
- const params = JSON.parse(JSON.stringify(_this.queryParam))
- if (params.expenseDate) {
- params.expenseDate = params.expenseDate + '-01'
- }
- _this.exportLoading = true
- _this.spinning = true
- hdExportExcel(expenseAcctDetailReport, params, '费用报销明细统计报表', function () {
- _this.exportLoading = false
- _this.spinning = false
- })
- },
- // 重置
- resetSearchForm () {
- this.$refs.rangeDate.resetDate(this.time)
- this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
- this.queryParam.endDate = getDate.getCurrMonthDays().endtime
- this.queryParam = {
- queryParam: {
- expenseDate: '', // 月份
- beginDate: getDate.getCurrMonthDays().starttime,
- endDate: getDate.getCurrMonthDays().endtime,
- expenseAccountNo: '', // 费用单号
- applyPersonSn: undefined, // 申请人
- applyDepartmentSn: undefined, // 申请部门
- expenseType: undefined, // 费用类型
- accountType: undefined, // 记账类型
- accountNameSn: undefined, // 记账名称
- splitObjType: undefined, // 费用承担方类型
- splitObjSn: undefined, // 费用承担方
- childSplitObjSn: undefined, // 费用承担人
- subareaSn: undefined,
- provinceName: '',
- cityName: '',
- provinceSn: undefined,
- citySn: undefined
- }
- }
- this.$refs.table.refresh(true)
- },
- pageInit () {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- },
- setTableH () {
- const tableSearchH = this.$refs.tableSearch.offsetHeight
- this.tableHeight = window.innerHeight - tableSearchH - 195
- }
- },
- watch: {
- advanced (newValue, oldValue) {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- },
- '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
- this.setTableH()
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.pageInit()
- this.resetSearchForm()
- }
- },
- activated () {
- // 如果是新页签打开,则重置当前页面
- if (this.$store.state.app.isNewTab) {
- this.pageInit()
- this.resetSearchForm()
- }
- // 仅刷新列表,不重置页面
- if (this.$store.state.app.updateList) {
- this.pageInit()
- this.$refs.table.refresh()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
- <style lang="less">
- .expenseReimbursementDetailList-wrap{
- .sTable{
- margin-top: 10px;
- .badge-con-t{
- .ant-badge-count{
- transform: scale(0.8);
- font-size: 13px;
- }
- }
- }
- }
- </style>
|