avue页面布局 api 引用

展示 

 

index.vue 


<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               :page="page"
               :permission="permissionList"
           
               :search.sync="search"
               :before-close='beforeClose'
               v-model="form"
               ref="crud"
               @row-update="rowUpdate"
               @row-save="rowSave"
               @row-del="rowDel"
               @search-change="searchChange"
          @search-reset="resetChange"
               @selection-change="selectionChange"
            
               @on-load="onLoad">
    </avue-crud>
 
  </basic-container>
</template>

<script>
  import {getList,  add, update, remove} from "@/api/budget/budget";
  import {mapGetters} from "vuex";
 
  import Cookies from 'js-cookie'
  export default {

    data() {
      return {
        excelBox: false,
        val: {
          id:'',
          houseNumber:'',
          name:'budget',
        },
        selectHouseNumber:false,
        form: {},  //存储返回值
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        selectionList: [],
        search:{},
        option: {
       
          indexLabel:'序号',
          align:'center',
          column: [
          {
              label: '基本情况',
              children: [
                {
                  label: "资产编号",
                  prop: "houseNumber",
                  width:140,
                  search: true,
                },
                {
                  label: "资产名称",
                  prop: "assetName",
                  search: true,
                },
              ],
            },
            {
                  label: "使用状态",
                  prop: "zsStatus",
                  formatter:(val,value,label)=>{
                    if(val.zsStatus==1){
                      return  '出租'
                    }
                    if(val.zsStatus==2){
                      return  '出售'
                    }
                  },
                },
  

            {
              label: '支出预算',
              children: [

                {
                  label: "税费",
                  prop: "taxation",
                  value:0
                },
                {
                  label: "暂列金",
                  prop: "provisionalSums",
                  value:0
                }, {
                  label: "支出合计",
                  prop: "expenditureTotal",
                  value:0
                }
                , {
                  label: "relet",
                  prop: "relet",
                  value:0
                },
              ]

            },
            {
              label: "备注",
              prop: "remarks",
            },
          ]
        },
      };
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {

      },
  
    },
    mounted(){
      
    },
    watch: {
      // 有的值 是需要多个值 进行计算的  我们获取值进行计算 然后在进行渲染
      'form.relet' (val) {
        this.form.incomeTotal=parseFloat(val)+parseFloat(this.form.newLease)+parseFloat(this.form.incomeOther)
      },
      

      // 税费
      'form.taxation' (val) {
        this.form.expenditureTotal=parseFloat(val)+
          parseFloat(this.form.upkeepDismantle)+
          parseFloat(this.form.estimateIdentify)+
          parseFloat(this.form.provisionalSums)+
          parseFloat(this.form.expenditureOther)
      },
    
      // 暂列金
      'form.provisionalSums' (val) {
        this.form.expenditureTotal=parseFloat(val)+
          parseFloat(this.form.taxation)+
          parseFloat(this.form.upkeepDismantle)+
          parseFloat(this.form.estimateIdentify)+
          parseFloat(this.form.expenditureOther)
      },
    
      'form'(val){
        if(val.houseNumber!=''){
          val.realitySurplus=val.realityIncome-val.realityExpenditure
          // 合计
          val.expenditureTotal=parseFloat(val.taxation)+parseFloat(val.upkeepDismantle)+parseFloat(val.estimateIdentify)+parseFloat(val.provisionalSums)+parseFloat(val.expenditureOther)
          val.incomeTotal=parseFloat(val.incomeOther)+parseFloat(val.relet)+parseFloat(val.newLease)
        }
      },
    },
    methods: {
      getCookie(){
        if(Cookies.get('username') == ''){
          return false
        }
        else{
          return true
        }
      },
      beforeClose(done,type){
        this.$refs.crud.$refs.dialogForm.boxType=''
        done();
      },
  
  
      budgetDetails(row){
        this.$router.push({path:'/details/budgetDetails',query: {row}});
      },

      // 清空了
      resetChange (item) {
      this.$message.success('清空回调')
    },


 
      // 新增保存提示
      rowSave(row, done, loading) {
        add(row).then(() => {
          done();
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
        }, error => {
          window.console.log(error);
          loading();
        });
      },
      // 点击编辑 提示
      rowUpdate(row, index, done, loading) {
        update(row).then(() => {
          done();
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "编辑操作成功!"
          });
        }, error => {
          window.console.log(error);
          loading();
        });
      },
      // 删除
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
      },
    // 搜索
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
     
   
      onLoad(page, params = {}) {
        this.loading = true;
        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();

          if(Cookies.get('username')!=''){
            this.option.editBtn=false
            this.option.delBtn=false
            this.option.addBtn=false
          }

        });
      }
    }
  };
</script>

<style>
</style>



 "@/api/budget/budget";

import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/budget/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}



export const remove = (ids) => {
  return request({
    url: '/api/budget/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/budget/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/budget/submit',
    method: 'post',
    data: row
  })
}

vue.config.js 

module.exports = {
  lintOnSave: true,
  productionSourceMap: false,
  chainWebpack: (config) => {
    //忽略的打包文件
    config.externals({
      'vue': 'Vue',
      'vue-router': 'VueRouter',
      'vuex': 'Vuex',
      'axios': 'axios',
      'element-ui': 'ELEMENT',
    })
    const entry = config.entry('app')
    entry
      .add('babel-polyfill')
      .end()
    entry
      .add('classlist-polyfill')
      .end()
    entry
      .add('@/mock')
      .end()
  },
  devServer: {
    // 端口配置
    port: 1999,
    // 反向代理配置
    proxy: {
      '/api': {
        target: 'http://192.168.56.1:7777',
        ws: true,
        pathRewrite: {
          '^/api': '/'
        }
      }
    },
  }
}

 数值参考

 

文档参考 

搜索 | Avue (avuejs.com)

avue-crud属性配置项参数笔记分享 - 小金子J - 博客园 (cnblogs.com)

  • 9
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
如果你想在 Avue 中使用 `user.vue` 组件,可以按照以下步骤进行: 1. 在你的 Vue 项目中,找到你想要使用 `user.vue` 的 Avue 页面或组件。 2. 在该页面或组件的 `<template>` 中,使用 `<keep-alive>` 标签来包裹 `router-view` 标签,以保持路由状态。例如: ```html <template> <div> <h1>Welcome to my Avue app!</h1> <keep-alive> <router-view></router-view> </keep-alive> </div> </template> ``` 3. 在你的 Vue 项目中,打开 `router/index.js` 文件,找到 `routes` 数组。 4. 在 `routes` 数组中添加一个新的路由对象,用于匹配 `user.vue` 的路由路径。例如: ```javascript import User from '@/components/User.vue' // ... const routes = [ // ... { path: '/user', name: 'User', component: User, meta: { requiresAuth: true // 如果需要登录验证,可以添加该 meta 字段 } } ] ``` 5. 现在,在你的 Avue 页面或组件中,可以通过使用 `<router-link>` 标签来创建一个链接,指向 `user.vue` 所在的路由路径。例如: ```html <template> <div> <h1>Welcome to my Avue app!</h1> <keep-alive> <router-view></router-view> </keep-alive> <router-link to="/user">Go to User Page</router-link> </div> </template> ``` 6. 如果 `user.vue` 需要进行登录验证,你可以在 Avue 中使用 `beforeEach` 导航守卫来进行验证。例如: ```javascript import router from '@/router' import store from '@/store' // ... router.beforeEach((to, from, next) => { // 如果需要登录验证,并且用户未登录,则跳转到登录页面 if (to.meta.requiresAuth && !store.getters.isLoggedIn) { next('/login') } else { next() } }) ``` 7. 现在,你就可以在 Avue 中使用 `user.vue` 组件了。在 `user.vue` 中,你可以使用 Avue 中提供的各种组件和功能,例如表单组件、表格组件、弹窗组件等。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值