|
@@ -0,0 +1,262 @@
|
|
|
+<template>
|
|
|
+ <a-card size="small" :bordered="false" class="funAccountList-wrap">
|
|
|
+ <a-spin :spinning="spinning" tip="Loading...">
|
|
|
+ <!-- 搜索条件 -->
|
|
|
+ <div ref="tableSearch" class="funAccountList-page-search-wrapper">
|
|
|
+ <div>
|
|
|
+ 资金账户功能:<a-radio-group
|
|
|
+ v-model="enableFundAccount"
|
|
|
+ :options="[
|
|
|
+ { label: '启用', value: '1' },
|
|
|
+ { label: '禁用', value: '0' },
|
|
|
+ ]"
|
|
|
+ @change="onChange2" />
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ 开启资金账户功能后,在进行财务收款和付款时,需要从下面列表选择一个账户。
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 操作按钮 -->
|
|
|
+ <div class="table-operator">
|
|
|
+ <a-button id="funAccountList-add" type="primary" class="button-error" @click="handleEdit()">新增</a-button>
|
|
|
+ </div>
|
|
|
+ <!-- 列表 -->
|
|
|
+ <s-table
|
|
|
+ class="sTable fixPagination"
|
|
|
+ ref="table"
|
|
|
+ :style="{ height: tableHeight+84.5+'px' }"
|
|
|
+ size="small"
|
|
|
+ :rowKey="(record) => record.id"
|
|
|
+ :columns="columns"
|
|
|
+ :data="loadData"
|
|
|
+ :scroll="{ y: tableHeight }"
|
|
|
+ :defaultLoadData="false"
|
|
|
+ bordered>
|
|
|
+ <!-- 费用类别 -->
|
|
|
+ <template slot="expensesType" slot-scope="text, record">
|
|
|
+ {{ record.expensesTypeName1 }} <span v-if="record.expensesTypeName2">>{{ record.expensesTypeName2 }}</span> <span v-if="record.expensesTypeName3">>{{ record.expensesTypeName3 }}</span>
|
|
|
+ </template>
|
|
|
+ <!-- 费用单号 -->
|
|
|
+ <template slot="accountExpensesNo" slot-scope="text, record">
|
|
|
+ <span :class="$hasPermissions('B_expenseDetail')?'active':'common'" @click="handleDetail(record)">{{ text }}</span>
|
|
|
+ </template>
|
|
|
+ <!-- 审核 -->
|
|
|
+ <template slot="audit" slot-scope="text, record">
|
|
|
+ <stateIcon :title="record.stateDictValue" :state="record.state == 'AUDIT_PASS'?'1':'2'"></stateIcon>
|
|
|
+ </template>
|
|
|
+ <!-- 操作 -->
|
|
|
+ <template slot="action" slot-scope="text, record">
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_expenseAudit')"
|
|
|
+ class="button-primary"
|
|
|
+ @click="handleAudit(record)"
|
|
|
+ id="expenseManagement-audit-btn">审核</a-button>
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_expenseEdit')"
|
|
|
+ class="button-primary"
|
|
|
+ @click="handleEdit(record)"
|
|
|
+ id="expenseManagement-edit-btn">编辑</a-button>
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_expenseDel')"
|
|
|
+ class="button-error"
|
|
|
+ @click="handleDel(record)"
|
|
|
+ id="expenseManagement-del-btn">删除</a-button>
|
|
|
+ <span v-if="record.state != 'WAIT_AUDIT'||( !$hasPermissions('B_expenseAudit')&& !$hasPermissions('B_expenseEdit') && !$hasPermissions('B_expenseDel'))">--</span>
|
|
|
+ </template>
|
|
|
+ </s-table>
|
|
|
+ </a-spin>
|
|
|
+ <!-- 详情 -->
|
|
|
+ <addModal :openModal="openModal" :itemId="itemId" @close="closeDetail" />
|
|
|
+ </a-card>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { commonMixin } from '@/utils/mixin'
|
|
|
+import { STable, VSelect } from '@/components'
|
|
|
+import rangeDate from '@/views/common/rangeDate.vue'
|
|
|
+import { settleExpenseQuery, delExpense, auditExpense } from '@/api/settleExpense'
|
|
|
+import addModal from './addModal.vue'
|
|
|
+import stateIcon from '@/views/common/stateIcon'
|
|
|
+export default {
|
|
|
+ name: 'ExpenseManagementList',
|
|
|
+ components: { STable, VSelect, addModal, rangeDate, stateIcon },
|
|
|
+ mixins: [commonMixin],
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ spinning: false,
|
|
|
+ tableHeight: 0,
|
|
|
+ disabled: false, // 查询、重置按钮是否可操作
|
|
|
+ advanced: true, // 高级搜索 展开/关闭
|
|
|
+ enableFundAccount: '1',
|
|
|
+ // 查询参数
|
|
|
+ queryParam: {},
|
|
|
+ // 表头
|
|
|
+ columns: [
|
|
|
+ { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
|
|
|
+ { title: '账户类型', dataIndex: 'accountExpensesNo', width: '20%', align: 'center', scopedSlots: { customRender: 'accountExpensesNo' } },
|
|
|
+ { title: '账户名称', dataIndex: 'createDate', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '账户号码', scopedSlots: { customRender: 'expensesType' }, width: '20%', align: 'center' },
|
|
|
+ { title: '收入金额', dataIndex: 'settleAmount', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
|
|
|
+ { title: '支出金额', dataIndex: 'settleAmount', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
|
|
|
+ { title: '启用', scopedSlots: { customRender: 'enable' }, width: '3%', align: 'center' },
|
|
|
+ { title: '审核', scopedSlots: { customRender: 'audit' }, width: '3%', align: 'center' },
|
|
|
+ { title: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' }
|
|
|
+ ],
|
|
|
+ // 加载数据方法 必须为 Promise 对象
|
|
|
+ loadData: parameter => {
|
|
|
+ this.disabled = true
|
|
|
+ this.spinning = true
|
|
|
+ return settleExpenseQuery(Object.assign(parameter, this.queryParam)).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
|
|
|
+ })
|
|
|
+ },
|
|
|
+ openModal: false, // 查看详情 弹框
|
|
|
+ itemId: '' // 当前id
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ closeDetail () {
|
|
|
+ this.openModal = false
|
|
|
+ this.itemId = null
|
|
|
+ },
|
|
|
+ // 新增/编辑
|
|
|
+ handleEdit (row) {
|
|
|
+ },
|
|
|
+ // 资金明细
|
|
|
+ handleDetail (row) {
|
|
|
+ },
|
|
|
+ // 审核
|
|
|
+ handleAudit (row) {
|
|
|
+ const _this = this
|
|
|
+ this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '确定要审核吗?',
|
|
|
+ centered: true,
|
|
|
+ onOk () {
|
|
|
+ _this.spinning = true
|
|
|
+ auditExpense({
|
|
|
+ id: row.id
|
|
|
+ }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.$refs.table.refresh()
|
|
|
+ _this.spinning = false
|
|
|
+ } else {
|
|
|
+ _this.spinning = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 删除
|
|
|
+ handleDel (row) {
|
|
|
+ const _this = this
|
|
|
+ _this.itemId = row.id
|
|
|
+ _this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '删除后原数据不可恢复,是否删除?',
|
|
|
+ centered: true,
|
|
|
+ onOk () {
|
|
|
+ _this.spinning = true
|
|
|
+ delExpense({ id: _this.itemId }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.$refs.table.refresh()
|
|
|
+ _this.spinning = false
|
|
|
+ } else {
|
|
|
+ _this.spinning = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 重置
|
|
|
+ resetSearchForm () {
|
|
|
+ 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 - 270
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 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">
|
|
|
+ .funAccountList-wrap{
|
|
|
+ .funAccountList-page-search-wrapper{
|
|
|
+ padding: 0 10px 10px 10px;
|
|
|
+ border-bottom: 1px solid #eee;
|
|
|
+ margin-bottom: 15px;
|
|
|
+ > div{
|
|
|
+ padding: 5px 0;
|
|
|
+ &:last-child{
|
|
|
+ color: #999;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .sTable{
|
|
|
+ margin-top: 10px;
|
|
|
+ }
|
|
|
+ .active{
|
|
|
+ color: #ed1c24;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .common{
|
|
|
+ color: rgba(0, 0, 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|