123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <style>
- .checked-account {
- width: 100%;
- }
- .checked-account .ant-checkbox-wrapper {
- width: 20%;
- min-width: 300px;
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- }
- </style>
- <template>
- <div>
- <a-modal title="账户选择" v-model="showEdit" @ok="handleOk" @cancel="close" width="80%">
- <a-checkbox :indeterminate="indeterminate" @change="onCheckAllChange" :checked="checkAll">全选</a-checkbox>
- <br />
- <a-checkbox-group :options="showList" v-model="dataValue" class="checked-account" @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>
|