1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <style>
- .checked {
- width: 100%;
- }
- .checked .ant-checkbox-wrapper {
- width: 20%;
- }
- </style>
- <template>
- <div>
- <a-modal title="账户选择" v-model="showEdit" @ok="handleOk" @cancel="close" width="60%">
- <a-checkbox :indeterminate="indeterminate" @change="onCheckAllChange" :checked="checkAll">全选</a-checkbox>
- <br />
- <a-checkbox-group :options="showList" v-model="dataValue" class="checked" @change="onChange" />
- </a-modal>
- </div>
- </template>
- <script>
- import { deleteAction, getAction } from '@/api/manage'
- // import lifting from './components/lifting'
- export default {
- name: 'modules',
- components: {},
- data: function() {
- return {
- showEdit: false,
- dataList: [],
- showList: null,
- dataValue: [],
- indeterminate: false,
- checkAll: false
- }
- },
- methods: {
- handleOk(e) {
- console.log(e)
- this.showEdit = false
- this.$emit('synchro', this.dataValue)
- },
- close() {
- this.showEdit = false
- this.dataList = []
- this.showList = null
- this.dataValue = []
- this.indeterminate = false
- this.checkAll = false
- },
- onCheckAllChange(e) {
- Object.assign(this, {
- dataValue: e.target.checked
- ? this.showList.map(item => {
- return item.value
- })
- : [],
- indeterminate: false,
- checkAll: e.target.checked
- })
- },
- onChange(checkedList) {
- this.indeterminate = !!this.dataValue.length && this.dataValue.length < this.showList.length
- this.checkAll = this.dataValue.length === this.showList.length
- },
- getData(url, item) {
- this.showEdit = true
- this.dataList = []
- this.showList = null
- this.dataValue = []
- this.indeterminate = false
- this.checkAll = false
- console.log(url, item)
- getAction(url, item).then(res => {
- if (res.code == 0) {
- this.showList = res.result.map(item => {
- return {
- label: item.authName,
- value: item.accountId
- }
- })
- }
- console.log(res)
- })
- }
- },
- computed: {}
- }
- </script>
|