jinlin
2024-09-26 089b302259e03ce52fc102bcf168d1fa048fffe9
web/src/views/modules/basicInfo/ProductModelTree.vue
@@ -7,8 +7,14 @@
       size="small"
       clearable
     ></el-input>-->
    <el-button v-if="isShow" type="primary" @click="add()"
               style="margin: 10px 0 0 10px;padding: 9px 18px !important;">新增型号
        <el-button v-if="isShow" type="primary" size="mini" @click="add()"
                   style="margin: 10px 0 0 7px;padding: 8px 17px !important;">新增型号
        </el-button>
        <el-button v-if="isShow" type="primary" size="mini" @click="updateXh()"
                   style="margin: 10px 0 0 7px;padding: 8px 17px !important;">修改型号
        </el-button>
        <el-button v-if="isShow" type="primary" size="mini" @click="deleteXh()"
                   style="margin: 10px 0 0 7px;padding: 8px 17px !important;">删除型号
    </el-button>
    <el-divider></el-divider>
    <el-tree
@@ -58,6 +64,7 @@
        filterText: '',
        productList: [],
        defaultId: '',
                id: '',
        defaultProps: {
          children: 'children',
          label: 'name'
@@ -110,11 +117,34 @@
      add() {
        this.$refs.AddOrUpdate.$refs.dialog.init(null, {id: null, type: 'xh'})
      },
            updateXh() {
                this.$refs.AddOrUpdate.$refs.dialog.init(this.id, {id: null, type: 'xh'})
            },
            async deleteXh() {
                if (this.id) {
                    this.$tip.alert(this.$t('prompt.deleteBatch'))
                    if (await this.$tip.confirm(this.$t('', {'handle': this.$t('delete')}))) {
                        let res = await this.$http.delete(
                            '/basicInfo/XhProductModel/',
                            {
                                'data': [this.id]
                            }
                        )
                        if (res.success) {
                            await this.$tip.success()
                            await this.getProductList()
                        }
                    }
                } else {
                    this.$tip.alert('未选择型号')
                }
            },
      filterNode(value, data) {
        if (!value) return true
        return data.name.indexOf(value) !== -1
      },
      handleNodeClick(data) {
                this.id = data.id
        this.$emit('on-selected', data)
      },
    }