123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <template>
- <a-modal
- centered
- class="chooseClassify-modal"
- :footer="null"
- :maskClosable="false"
- title="选择产品分类"
- v-model="isShow"
- @cancel="isShow=false"
- :width="680">
- <a-spin :spinning="spinning" tip="Loading...">
- <div class="checkboxAllBtn">
- <a-checkbox :indeterminate="indeterminate" :checked="checkAll" @change="onCheckAllChange">
- 全选
- </a-checkbox>
- </div>
- <a-checkbox-group v-model="checkedList" :options="plainOptions" @change="onChange" />
- <div class="btn-cont">
- <a-button type="primary" id="product-category-edit-modal-save" @click="handleSave">保存</a-button>
- <a-button id="product-category-edit-modal-back" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
- </div>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { bindRelation } from '@/api/dealerRelation'
- export default {
- name: 'ChooseClassifyModal',
- mixins: [commonMixin],
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- }
- },
- data () {
- return {
- isShow: this.openModal, // 是否打开弹框
- spinning: false,
- checkedList: [],
- plainOptions: ['欧司朗', '优志旺', '阪东BANDO', '东洋', '盖达', '欧皮特(Optibelt)'],
- checkAll: false,
- indeterminate: false
- }
- },
- methods: {
- getData () {
- },
- onChange () {
- this.indeterminate = !!this.checkedList.length && this.checkedList.length < this.plainOptions.length
- this.checkAll = this.checkedList.length === this.plainOptions.length
- },
- onCheckAllChange (e) {
- Object.assign(this, {
- checkedList: e.target.checked ? this.plainOptions : [],
- indeterminate: false,
- checkAll: e.target.checked
- })
- },
- // 保存
- handleSave () {
- const _this = this
- _this.$emit('ok', _this.checkedList)
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- this.indeterminate = false
- this.checkAll = false
- this.checkedList = []
- } else {
- this.getData()
- }
- }
- }
- }
- </script>
- <style lang="less">
- .chooseClassify-modal{
- .ant-modal-body {
- padding: 20px 30px;
- .checkboxAllBtn{
- border-bottom:1px solid #E9E9E9;
- padding-bottom:20px;
- margin-bottom:20px;
- }
- }
- .btn-cont {
- text-align: center;
- margin: 35px 0 10px;
- }
- }
- </style>
|