jiangping
2024-11-27 bc87b51e20a0adf0badf2033ede93cafeb5fc147
admin/src/views/finance/account.vue
@@ -6,15 +6,20 @@
        v-permissions="['business:ywpatrolline:create']">新建</el-button>
    </div>
    <el-table v-loading="loading" :data="list" stripe>
      <el-table-column prop="code" label="收支条目" min-width="100" show-overflow-tooltip />
      <el-table-column prop="name" label="收款公司" min-width="100" show-overflow-tooltip />
      <el-table-column prop="" label="账户类型" min-width="100" show-overflow-tooltip />
      <el-table-column prop="modelNo" label="账户名称" min-width="100" show-overflow-tooltip />
      <el-table-column prop="realName" label="开户银行" min-width="100" show-overflow-tooltip />
      <el-table-column prop="realName" label="银行账号" min-width="100" show-overflow-tooltip />
      <el-table-column prop="title" label="收支条目" min-width="100" show-overflow-tooltip />
      <el-table-column prop="companyName" label="收款公司" min-width="100" show-overflow-tooltip />
      <el-table-column label="账户类型" min-width="100" show-overflow-tooltip>
        <template v-slot="{row}">
          <span v-if="row.type == 0">对公</span>
          <span v-if="row.type == 1">个人</span>
        </template>
      </el-table-column>
      <el-table-column prop="name" label="账户名称" min-width="100" show-overflow-tooltip />
      <el-table-column prop="bankName" label="开户银行" min-width="100" show-overflow-tooltip />
      <el-table-column prop="bankNo" label="银行账号" min-width="100" show-overflow-tooltip />
      <el-table-column prop="status" label="状态" min-width="100" show-overflow-tooltip>
        <template v-slot="scope">
          <el-switch v-model="scope.row.status" active-value="0" inactive-value="1">
          <el-switch v-model="scope.row.status" @change="e =>changeStatus(scope.row)" :active-value="0" :inactive-value="1">
          </el-switch>
        </template>
      </el-table-column>
@@ -22,7 +27,7 @@
        <template slot-scope="{row}">
          <el-button type="text" @click="handleEdit(row)" icon="el-icon-edit"
            v-permissions="['business:category:update']">编辑</el-button>
          <el-button type="text" @click="deleteById(row)" icon="el-icon-delete"
          <el-button type="text" @click="handleDel(row)" icon="el-icon-delete"
            v-permissions="['business:category:delete']">删除</el-button>
        </template>
      </el-table-column>
@@ -38,7 +43,9 @@
import Pagination from '@/components/common/Pagination'
import QueryForm from '@/components/common/QueryForm'
import Edit from './components/accountEdit.vue'
import { companyGetList, deleteById } from '@/api/business/company'
import { fetchList, updateById, deleteById } from '@/api/business/ywAccount'
import { companyGetList } from '@/api/business/company'
import { Message } from 'element-ui'
export default {
  components: {
    Pagination,
@@ -60,14 +67,17 @@
      queryFormConfig: {
        formItems: [
          {
            filed: 'name',
            filed: 'title',
            type: 'input',
            label: '收支条目'
          },
          {
            filed: 'name',
            filed: 'companyId',
            type: 'select',
            label: '收款公司'
            label: '收款公司',
            labelCode: 'name',
            valueCode: 'id',
            options: []
          },
        ],
        online: true
@@ -76,15 +86,15 @@
  },
  created() {
    this.getList()
    this.getCompany()
  },
  methods: {
    getList(page) {
      const { pagination, filters } = this
      this.loading = true
      companyGetList({
      fetchList({
        model: {
          ...filters,
          type: 2
        },
        capacity: pagination.pageSize,
        page: page || pagination.page,
@@ -99,6 +109,23 @@
        this.loading = false
      })
    },
    changeStatus(row) {
      updateById(row).then(res => {
        this.getList()
        Message.success('更新状态成功')
      }, () => {
        this.getList()
      })
    },
    getCompany(){
      companyGetList({
        model: {type: 2},
        capacity: 9999,
        page: 1
      }).then(res => {
       this.queryFormConfig.formItems[1].options = res.records || []
      })
    },
    handleEdit(row) {
      this.showEdit = true
      this.$nextTick(() => {
@@ -110,10 +137,9 @@
    },
    handleDel(row) {
      let message = `确认删除该记录吗?`
      let message = `确认删除该账户吗?`
      this.$dialog.deleteConfirm(message)
        .then(() => {
          this.isWorking.delete = true
          deleteById(row.id)
            .then(() => {
              this.$tip.apiSuccess('删除成功')