|
@@ -116,6 +116,37 @@
|
|
|
<el-button type="primary" @click="submit" :loading="btnLoading">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+ <!-- <el-table
|
|
|
+ ref="multipleTable"
|
|
|
+ :data="option"
|
|
|
+ tooltip-effect="dark"
|
|
|
+ style="width: 100%"
|
|
|
+ @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column
|
|
|
+ type="selection"
|
|
|
+ width="55">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="日期"
|
|
|
+ width="120">
|
|
|
+ <template slot-scope="scope">{{ scope.row.date }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="name"
|
|
|
+ label="姓名"
|
|
|
+ width="120">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="address"
|
|
|
+ label="地址"
|
|
|
+ show-overflow-tooltip>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div style="margin-top: 20px">
|
|
|
+ <el-button @click="toggleSelection([option[1], option[2]])">切换第二、第三行的选中状态</el-button>
|
|
|
+ <el-button @click="toggleSelection()">取消选择</el-button>
|
|
|
+ </div> -->
|
|
|
+ <el-button @click="toggleSelection([tableData[1], tableData[0]])">切换第二、第三行的选中状态</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -136,6 +167,35 @@ export default {
|
|
|
data() {
|
|
|
name: 'DataPermission'
|
|
|
return {
|
|
|
+ option: [{
|
|
|
+ date: '2016-05-03',
|
|
|
+ name: '王小虎',
|
|
|
+ address: '上海市普陀区金沙江路 1518 弄'
|
|
|
+ }, {
|
|
|
+ date: '2016-05-02',
|
|
|
+ name: '王小虎',
|
|
|
+ address: '上海市普陀区金沙江路 1518 弄'
|
|
|
+ }, {
|
|
|
+ date: '2016-05-04',
|
|
|
+ name: '王小虎',
|
|
|
+ address: '上海市普陀区金沙江路 1518 弄'
|
|
|
+ }, {
|
|
|
+ date: '2016-05-01',
|
|
|
+ name: '王小虎',
|
|
|
+ address: '上海市普陀区金沙江路 1518 弄'
|
|
|
+ }, {
|
|
|
+ date: '2016-05-08',
|
|
|
+ name: '王小虎',
|
|
|
+ address: '上海市普陀区金沙江路 1518 弄'
|
|
|
+ }, {
|
|
|
+ date: '2016-05-06',
|
|
|
+ name: '王小虎',
|
|
|
+ address: '上海市普陀区金沙江路 1518 弄'
|
|
|
+ }, {
|
|
|
+ date: '2016-05-07',
|
|
|
+ name: '王小虎',
|
|
|
+ address: '上海市普陀区金沙江路 1518 弄'
|
|
|
+ }],
|
|
|
options:[{label:'你好',value:1},{label:'你好1',value:2},{label:'你好2',value:3}],
|
|
|
visible: false,
|
|
|
loading: false,
|
|
@@ -168,10 +228,11 @@ export default {
|
|
|
|
|
|
},
|
|
|
|
|
|
- mounted() {
|
|
|
- this.getList()
|
|
|
+ async mounted() {
|
|
|
+ await this.getList()
|
|
|
this.getFunctionList()
|
|
|
console.log(this.fun)
|
|
|
+ // this.func=this.fun
|
|
|
// this.funId = 6
|
|
|
// this.$emit('getPremissData', this.funId)
|
|
|
},
|
|
@@ -186,14 +247,34 @@ export default {
|
|
|
},
|
|
|
watch:{
|
|
|
fun(val,oldval){
|
|
|
- if(val!=oldval){
|
|
|
- this.$refs.dataTable.clearSelection()
|
|
|
+ console.log(val,oldval)
|
|
|
+ // this.$refs.dataTable.clearSelection()
|
|
|
this.func = val
|
|
|
- this.getList()
|
|
|
- }
|
|
|
- }
|
|
|
+ this.getList()
|
|
|
+
|
|
|
+ },
|
|
|
+ // func(val,oldval){
|
|
|
+ // if(val!=oldval){
|
|
|
+ // this.getList()
|
|
|
+ // }
|
|
|
+
|
|
|
+ // }
|
|
|
},
|
|
|
methods: {
|
|
|
+ toggleSelection(rows) {
|
|
|
+ console.log(rows)
|
|
|
+ if (rows) {
|
|
|
+ rows.forEach(row => {
|
|
|
+ console.log(row)
|
|
|
+ this.$refs.dataTable.toggleRowSelection(row);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$refs.multipleTable.clearSelection();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleSelectionChange(val) {
|
|
|
+ this.multipleSelection = val;
|
|
|
+ },
|
|
|
changeData(selection,row){
|
|
|
if (selection.length > 1) {
|
|
|
const del_row = selection.shift()
|
|
@@ -201,7 +282,7 @@ export default {
|
|
|
// console.log(del_row)
|
|
|
}
|
|
|
this.multipleSelection = selection[0]
|
|
|
- this.$emit('getPremissData', this.fun.id, this.fun.name,this.multipleSelection)
|
|
|
+ this.$emit('getPremissData', this.fun.fun.id, this.fun.fun.name,this.multipleSelection)
|
|
|
console.log(this.multipleSelection)
|
|
|
|
|
|
},
|
|
@@ -321,12 +402,17 @@ export default {
|
|
|
this.queryParams.current = val;
|
|
|
this.getList();
|
|
|
},
|
|
|
- getList() {
|
|
|
+ async getList() {
|
|
|
this.loading = true
|
|
|
- this.queryParams.functionId = this.func.id
|
|
|
+ this.queryParams.functionId = this.func.fun.id
|
|
|
console.log(this.queryParams)
|
|
|
this.$api.getDataList(this.queryParams).then(response => {
|
|
|
this.tableData = response.data
|
|
|
+ console.log(this.func)
|
|
|
+ // rows.forEach(row => {
|
|
|
+ // this.$refs.multipleTable.toggleRowSelection(row);
|
|
|
+ // });
|
|
|
+ this.toggleSelection([this.tableData[1]])
|
|
|
console.log(response.data)
|
|
|
this.loading = false
|
|
|
}).catch(error => {
|