ludc
2023-06-16 6fd8516d5ebc7f237431b974c793d28a64ab59e7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<template>
  <basic-container>
    <div class="headbox">
      <sapn>组合方式:</sapn>
      <el-select v-model="formInline.region" placeholder="活动区域" @change="selectchange">
        <el-option label="大写字母" value="0"></el-option>
        <el-option label="小写字母" value="1"></el-option>
        <el-option label="特殊字符" value="2"></el-option>
        <el-option label="数字" value="3"></el-option>
      </el-select>
    </div>
    <avue-crud ref="crud" v-model="form" :option="option" :data="data"  @row-save="rowSave" @row-update="rowUpdate" @row-del="rowDel" :page.sync="page" >
 
    </avue-crud>
  </basic-container>
</template>
 
<script>
import {getPage} from "@/api/system/passwordvalue";
 
export default {
  name: "passwords.vue",
  data() {
    return {
      form:{},
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 100
      },
      formInline:{
        user: '',
        region: ''
      },
      data: [],
      option:{
        headerAlign: 'center',
        align: 'center',
        border: true,
        index: true,
        rowKey:'id',
        column:[
          {
            label: '名称',
            prop: 'name',
            align: 'left',
          },
          {
            label: '描述',
            prop: 'text',
          }
        ]
      }
      // option:{},
      // option1:{
      //   column:[
      //     {
      //       label:'姓名',
      //       prop:'name',
      //       search:true
      //     }
      //   ]
      // },
      // option2:{
      //   column:[
      //     {
      //       label:'用户名',
      //       prop:'username',
      //       search:true
      //     }, {
      //       label:'密码',
      //       prop:'password',
      //       type:'password',
      //       search:true
      //     }, {
      //       label:'姓名',
      //       prop:'name',
      //       search:true
      //     }
      //   ]
      // },
    }
  },
 
 
  created() {
    this.onLoad()
  },
  methods:{
    rowDel(row,index,done){
      done(row)
      console.log(row,index,done)
      console.log(done)
    },
    rowSave(row,done){
      console.log(row,done)
    },
    rowUpdate(row,index,done){
      done(row)
    },
    //下拉菜单切换,显示不同的密码取值方式
    selectchange(){
      if(this.formInline.region=="shanghai"){
        this.option=this.option1;
      }else{
        this.option=this.option2;
      }
      this.$refs.crud.refreshTable()
    },
    onLoad(page, params = {}) {
      // this.loading = true;
      getPage(this.page.currentPage, this.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();
        console.log(res)
        // this.data=res.data.data.content
      });
    }
  }
 
}
</script>
 
<style lang="scss">
.headbox{
  margin-bottom: 20px;
}
</style>