123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315 |
- <template>
- <a-card size="small" :bordered="false" class="expenseManagementList-wrap">
- <!-- 搜索条件 -->
- <div class="table-page-search-wrapper">
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
- <a-row :gutter="15">
- <a-col :md="6" :sm="24">
- <a-form-item label="费用单号">
- <a-input id="expenseManagementList-accountExpensesNo" v-model.trim="queryParam.accountExpensesNo" allowClear placeholder="请输入费用单号"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="创建时间">
- <a-range-picker v-model="createDate" id="expenseManagementList-creatDate"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="费用类型">
- <a-cascader
- @change="changeCostType"
- change-on-select
- v-model="costType"
- :options="costTypeList"
- :fieldNames="{ label: 'name', value: 'costTypeSn', children: 'children' }"
- id="productInfoList-costType"
- placeholder="请选择费用类型"
- allowClear />
- </a-form-item>
- </a-col>
- <template v-if="advanced">
- <a-col :md="6" :sm="24">
- <a-form-item label="单据状态">
- <v-select
- v-model="queryParam.billStatus"
- ref="billStatus"
- id="expenseManagementList-billStatus"
- code="BILL_STATUS"
- placeholder="请选择单据状态"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="结算状态">
- <v-select
- v-model="queryParam.settleState"
- ref="billStatus"
- id="expenseManagementList-billStatus"
- code="FINANCIAL_STATUS"
- placeholder="请选择结算状态"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- </template>
- <a-col :md="6" :sm="24">
- <span class="table-page-search-submitButtons">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="expenseManagementList-refresh">查询</a-button>
- <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="expenseManagementList-reset">重置</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>
- <!-- 操作按钮 -->
- <div class="table-operator">
- <a-button id="expenseManagementList-add" type="primary" class="button-error" @click="handleEdit()">新增</a-button>
- </div>
- <!-- alert -->
- <a-alert type="info" showIcon style="margin-bottom:15px">
- <div slot="message">共 <strong>{{ totalData.count }}</strong> 条记录,金额共计 <strong>¥{{ totalData.totalAmount }}</strong></div>
- </a-alert>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="default"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :scroll="{ x: 1120, y: tableHeight }"
- bordered>
- <!-- 状态 -->
- <template slot="state" slot-scope="text, record">
- <span>{{ record.state == 1 ? '已启用' : '已禁用' }}</span>
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button
- size="small"
- type="link"
- v-if="record.state != 'AUDIT_PASS'"
- class="button-primary"
- @click="handleEdit(record)"
- id="expenseManagement-edit-btn">编辑</a-button>
- <a-button
- size="small"
- type="link"
- v-if="record.state != 'AUDIT_PASS'"
- class="button-error"
- @click="handleDel(record)"
- id="expenseManagement-del-btn">删除</a-button>
- <a-button
- size="small"
- type="link"
- v-if="record.state == 'AUDIT_PASS'"
- class="button-success"
- @click="handleDetail(record)"
- id="expenseManagement-detail-btn">详情</a-button>
- </template>
- </s-table>
- <!-- 详情 -->
- <expense-management-detail-modal :openModal="openModal" :itemId="itemId" @close="openModal=false" />
- </a-card>
- </template>
- <script>
- import { STable, VSelect } from '@/components'
- import { settleExpenseQuery, delExpense, settleExpenseQuerySum } from '@/api/settleExpense'
- import { costTypeAllQuery } from '@/api/costType'
- import expenseManagementDetailModal from './detailModal.vue'
- import moment from 'moment'
- export default {
- components: { STable, VSelect, expenseManagementDetailModal },
- data () {
- return {
- tableHeight: 0,
- disabled: false, // 查询、重置按钮是否可操作
- advanced: false, // 高级搜索 展开/关闭
- costTypeList: [], // 费用类型
- costType: [],
- createDate: [],
- // 查询参数
- queryParam: {
- accountExpensesNo: '',
- expensesTypeSn1: '',
- expensesTypeSn2: '',
- expensesTypeSn3: '',
- billStatus: '',
- settleState: '',
- beginDate: '',
- endDate: ''
- },
- // 汇总
- totalData: {
- count: 0,
- totalAmount: 0
- },
- // 表头
- columns: [
- { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
- { title: '费用单号', dataIndex: 'accountExpensesSn', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '费用类型', dataIndex: 'name', align: 'center', customRender: function (text, record) { return [record.expensesTypeName1, record.expensesTypeName2, record.expensesTypeName3].join(' > ') } },
- { title: '金额', dataIndex: 'settleAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
- { title: '单据状态', dataIndex: 'stateDictValue', width: 110, align: 'center' },
- { title: '结算状态', dataIndex: 'settleStateDictValue', width: 110, align: 'center' },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center', fixed: 'right' }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- if (this.tableHeight == 0) {
- this.tableHeight = window.innerHeight - 300
- }
- if (this.createDate.length > 0) {
- this.queryParam.beginDate = moment(this.createDate[0]).format('YYYY-MM-DD')
- this.queryParam.endDate = moment(this.createDate[1]).format('YYYY-MM-DD')
- }
- return settleExpenseQuery(Object.assign(parameter, this.queryParam)).then(res => {
- const 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
- // 费用类型
- if (this.costTypeList.length == 0) {
- this.getCostTypeList()
- }
- // 汇总
- this.totalData.count = data.count
- this.settleExpenseQuerySum(Object.assign(parameter, this.queryParam))
- return data
- })
- },
- openModal: false, // 查看详情 弹框
- itemId: '' // 当前id
- }
- },
- methods: {
- // 递归函数
- recursionFun (data) {
- if (data) {
- data.map((item, index) => {
- if (item.children && item.children.length == 0) {
- delete item.children
- } else {
- this.recursionFun(item.children)
- }
- })
- }
- },
- // 获取费用类型数据
- getCostTypeList () {
- costTypeAllQuery({}).then(res => {
- // 递归去除空children
- this.recursionFun(res.data)
- this.costTypeList = res.data
- })
- },
- // 费用类型 change
- changeCostType (val, opt) {
- this.queryParam.expensesTypeSn1 = val[0] ? val[0] : ''
- this.queryParam.expensesTypeSn2 = val[1] ? val[1] : ''
- this.queryParam.expensesTypeSn3 = val[2] ? val[2] : ''
- },
- // 新增/编辑
- handleEdit (row) {
- this.$router.push({ name: 'expenseManagementEdit', params: { id: row.id } })
- },
- // 提交
- handleSubmit (row) {
- const _this = this
- _this.itemId = item.id
- _this.$confirm({
- title: '提示',
- content: '确定要进行提交操作吗?',
- centered: true,
- onOk () {
- // dealerProductTypeDel({ id: _this.itemId }).then(res => {
- // if (res.status == 200) {
- // _this.$message.success(res.message)
- // _this.$refs.table.refresh()
- // }
- // })
- }
- })
- },
- // 详情
- handleDetail (row) {
- this.itemId = row.id
- this.openModal = true
- // this.$router.push({ path: `/financialManagement/expenseManagement/detail/${row.id}`})
- },
- // 审核
- handleExamine (row, type) {
- const _this = this
- this.$confirm({
- title: '提示',
- content: '操作后不可恢复,确定要进行' + (type == 1 ? ' 通过 ' : ' 不通过 ') + '操作吗?',
- centered: true,
- onOk () {
- // delectRolePower({
- // id: row.id
- // }).then(res => {
- // console.log(res, 'res1111')
- // if (res.status == 200) {
- // _this.$message.success(res.message)
- // _this.$refs.table.refresh()
- // }
- // })
- }
- })
- },
- // 删除
- handleDel (row) {
- const _this = this
- _this.itemId = row.id
- _this.$confirm({
- title: '提示',
- content: '删除后原数据不可恢复,是否删除?',
- centered: true,
- onOk () {
- delExpense({ id: _this.itemId }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$refs.table.refresh()
- }
- })
- }
- })
- },
- // 汇总
- settleExpenseQuerySum (params) {
- settleExpenseQuerySum(params).then(res => {
- this.totalData.totalAmount = res.data.settleAmount || 0
- })
- },
- // 重置
- resetSearchForm () {
- this.queryParam.accountExpensesNo = ''
- this.queryParam.expensesTypeSn1 = ''
- this.queryParam.expensesTypeSn2 = ''
- this.queryParam.expensesTypeSn3 = ''
- this.queryParam.billStatus = ''
- this.queryParam.settleState = ''
- this.queryParam.beginDate = ''
- this.queryParam.endDate = ''
- this.costType = []
- this.createDate = []
- this.$refs.table.refresh(true)
- }
- }
- }
- </script>
- <style lang="less">
- .expenseManagementList-wrap{
- .sTable{
- margin-top: 15px;
- }
- }
- </style>
|