Mr.Shi
2023-09-19 a5e6e7061cbef6912f294dcfd2cb88f472f8ca6f
company_admin/src/components/business/OperaCategoryWindow.vue
@@ -9,7 +9,7 @@
      <h3 style="margin: 20px 0 10px 0;">基本信息</h3>
      <el-form :model="form" ref="form" :rules="rules">
        <el-form-item label="类别来源" prop="type">
          <el-radio-group v-model="form.type" @change="changeRadio">
          <el-radio-group v-model="form.type" :disabled="form.id ? true : false" @change="changeRadio">
            <el-radio :label="1">从平台库选择</el-radio>
            <el-radio :label="0">企业自建</el-radio>
          </el-radio-group>
@@ -65,6 +65,7 @@
                v-model="scope.row.isselect"
                active-color="#13ce66"
                inactive-color="#ff4949"
                @change="changeIsselect($event, scope.row)"
                :active-value="1"
                :inactive-value="0">
              </el-switch>
@@ -133,7 +134,7 @@
  <script>
  import BaseOpera from '@/components/base/BaseOpera'
  import GlobalWindow from '@/components/common/GlobalWindow'
  import { create, updateById, baseCategoryList, companyCreate, companyUpdateById } from '@/api/business/category.js'
  import { baseCategoryList, companyCreate, companyUpdateById } from '@/api/business/category.js'
  export default {
    name: 'OperaCategoryWindow',
    extends: BaseOpera,
@@ -187,6 +188,18 @@
      })
    },
    methods: {
      changeIsselect(e, item) {
        let num = 0
        this.form.tableData.forEach(row => {
          if (row.isselect === 1) {
            num += 1
          }
        })
        if (num > 2) {
          item.isselect = 0
          this.$message.warning({ message: '只能设置两个选项' })
        }
      },
      addItem() {
        this.form.tableData.push({ name: '', isselect: 0, isshow: 1 })
      },
@@ -264,7 +277,7 @@
            this.form.sortnum = item.sortnum
            let arr = []
            item.baseCateParamList.forEach((row, index) => {
              arr.push({ name: row.name, isselect: index <= 1 ? 1 : 0, isshow: 1 })
              arr.push({ name: row.name, baseCateParamId: row.id, isselect: index <= 1 ? 1 : 0, isshow: 1 })
            })
            this.form.tableData = arr
            this.form.imgurl = item.imgurl