Browse Source

品牌制造商界面和导入优化

zhh 3 years ago
parent
commit
e4f96fb7cb

+ 2 - 2
kmall-admin/src/main/java/com/kmall/admin/controller/BrandController.java

@@ -250,8 +250,8 @@ public class BrandController {
         }
         try {
             if (brandEntityList == null || brandEntityList.size() == 0) {
-                logger.error("读取数据为空!");
-                return R.error("读取数据为空!");
+                logger.error("品牌名称不能为空!");
+                return R.error("品牌名称不能为空!");
             }
 
             brandService.uploadExcel(brandEntityList);

+ 88 - 35
kmall-admin/src/main/java/com/kmall/admin/service/impl/BrandServiceImpl.java

@@ -6,6 +6,7 @@ import com.kmall.admin.dto.CateStoreDto;
 import com.kmall.admin.dto.CopyBrandDto;
 import com.kmall.admin.entity.*;
 import com.kmall.admin.service.BrandService;
+import com.kmall.admin.utils.ValidateUtils;
 import com.kmall.common.utils.MapBeanUtil;
 import com.kmall.common.utils.R;
 import com.kmall.common.utils.RRException;
@@ -59,37 +60,63 @@ public class BrandServiceImpl implements BrandService {
     @Override
     public int save(BrandEntity brand) {
 
-//        // 品牌唯一标识符正则校验
-//        String uniqueIdentifier = brand.getUniqueIdentifier();
-//        String regex = "(^[0-9a-zA-Z_&]{1,10}$)";
-//        if(!Pattern.matches(regex,uniqueIdentifier)){
-//            throw new RuntimeException("请输入正确的品牌唯一简码,有问题的简码:"+uniqueIdentifier);
-//        }
-//
-//        // 如果是正确的,根据唯一简码查询该简码是否存在
-//        BrandEntity brandEntity = brandDao.queryByUniqueIdentifier(uniqueIdentifier);
-//        if(brandEntity != null ){
-//            throw new RuntimeException("该唯一简码已存在,请检查唯一简码,唯一简码:"+uniqueIdentifier);
-//        }
+        // 品牌唯一标识符正则校验
+        String uniqueIdentifier = brand.getUniqueIdentifier();
+        String regex = "(^[0-9a-zA-Z_&]{1,10}$)";
+        if (StringUtils.isNotBlank(uniqueIdentifier)) {
+            if (!Pattern.matches(regex, uniqueIdentifier)) {
+                throw new RuntimeException("请输入正确的品牌唯一简码,有问题的简码:" + uniqueIdentifier);
+            }
+
+            // 如果是正确的,根据唯一简码查询该简码是否存在
+            BrandEntity brandEntity = brandDao.queryByUniqueIdentifier(uniqueIdentifier);
+            if (brandEntity != null) {
+                throw new RuntimeException("该唯一简码已存在,请检查唯一简码,唯一简码:" + uniqueIdentifier);
+            }
+        }
+
+        // 品牌名称正则校验
+        if (!ValidateUtils.validateSpecialAllowChinese(brand.getName())) {
+            throw new RuntimeException("请输入正确的品牌名称,有问题的品牌名称:" + brand.getName());
+        }
+
+        // 根据名称查询该名称是否存在
+        BrandEntity nameEntity = brandDao.queryByName(brand.getName());
+        if (nameEntity != null) {
+            throw new RuntimeException("该品牌名称已存在,请检查品牌名称,品牌名称:" + brand.getName());
+        }
 
         return brandDao.save(brand);
     }
 
     @Override
     public int update(BrandEntity brand) {
-//
-//        // 品牌唯一标识符正则校验
-//        String uniqueIdentifier = brand.getUniqueIdentifier();
-//        String regex = "(^[0-9a-zA-Z_&]{1,10}$)";
-//        if(!Pattern.matches(regex,uniqueIdentifier)){
-//            throw new RuntimeException("请输入正确的品牌唯一简码,有问题的简码:"+uniqueIdentifier);
-//        }
-//
-//        // 如果是正确的,根据唯一简码查询该简码是否存在
-//        BrandEntity brandEntity = brandDao.queryByUniqueIdentifier(uniqueIdentifier);
-//        if(brandEntity != null && brand.getId().compareTo(brandEntity.getId()) != 0){
-//            throw new RuntimeException("该唯一简码已存在,请检查唯一简码,唯一简码:"+uniqueIdentifier);
-//        }
+
+        // 品牌唯一标识符正则校验
+        String uniqueIdentifier = brand.getUniqueIdentifier();
+        String regex = "(^[0-9a-zA-Z_&]{1,10}$)";
+        if (StringUtils.isNotBlank(uniqueIdentifier)) {
+            if (!Pattern.matches(regex, uniqueIdentifier)) {
+                throw new RuntimeException("请输入正确的品牌唯一简码,有问题的简码:" + uniqueIdentifier);
+            }
+
+            // 如果是正确的,根据唯一简码查询该简码是否存在
+            BrandEntity brandEntity = brandDao.queryByUniqueIdentifier(uniqueIdentifier);
+            if (brandEntity != null && brand.getId().compareTo(brandEntity.getId()) != 0) {
+                throw new RuntimeException("该唯一简码已存在,请检查唯一简码,唯一简码:" + uniqueIdentifier);
+            }
+        }
+
+        // 品牌名称正则校验
+        if (!ValidateUtils.validateSpecialAllowChinese(brand.getName())) {
+            throw new RuntimeException("请输入正确的品牌名称,有问题的品牌名称:" + brand.getName());
+        }
+
+        // 根据名称查询该名称是否存在
+        BrandEntity nameEntity = brandDao.queryByName(brand.getName());
+        if (nameEntity != null && !nameEntity.getId().equals(brand.getId())) {
+            throw new RuntimeException("该品牌名称已存在,请检查品牌名称,品牌名称:" + brand.getName());
+        }
 
         return brandDao.update(brand);
     }
@@ -241,19 +268,31 @@ public class BrandServiceImpl implements BrandService {
             String name = brandEntity.getName();
             Integer isShow = brandEntity.getIsShow();
             Integer isNew = brandEntity.getIsNew();
-            // 品牌唯一标识符正则校验
             String uniqueIdentifier = brandEntity.getUniqueIdentifier();
+            String simpleDesc = brandEntity.getSimpleDesc();
 
-            if (isShow.intValue() != 0 && isShow.intValue() != 1 && isNew.intValue() != 0 && isNew != 1) {
-                throw new ServiceException("第" + (i + 1) + "行的是否显示或者是否新品牌只可填(0:否 1:是)");
+            if (isShow != 0 && isShow != 1) {
+                throw new ServiceException("第" + (i + 1) + "行的是否显示只可填(0:否 1:是)");
             }
-
+            if (isNew != 0 && isNew != 1) {
+                throw new ServiceException("第" + (i + 1) + "行的是否新品牌只可填(0:否 1:是)");
+            }
+            // 品牌唯一标识符正则校验
             if (StringUtils.isNotBlank(uniqueIdentifier)) {
                 String regex = "(^[0-9a-zA-Z_&]{1,10}$)";
                 if (!Pattern.matches(regex, uniqueIdentifier)) {
-                    throw new RuntimeException("请输入正确的品牌唯一简码,有问题的简码:" + uniqueIdentifier);
+                    throw new ServiceException("第" + (i + 1) + "行的品牌唯一简码包含特殊字符或长度过长");
                 }
             }
+            if (!ValidateUtils.validateSpecialAllowChinese(name)) {
+                throw new ServiceException("第" + (i + 1) + "行的品牌名称包含特殊字符或长度过长");
+            }
+            if (StringUtils.isBlank(simpleDesc)) {
+                throw new ServiceException("第" + (i + 1) + "行的描述不能为空");
+            }
+            if (!ValidateUtils.validateSpecialAllowChinese(simpleDesc)) {
+                throw new ServiceException("第" + (i + 1) + "行的描述包含特殊字符或长度过长");
+            }
 
             // 数据库查询是否存在对应名字的对象
             BrandEntity isExist = brandDao.queryByName(name);
@@ -261,9 +300,11 @@ public class BrandServiceImpl implements BrandService {
             // 不存在则添加
             if (isExist == null) {
                 // 如果是正确的,根据唯一简码查询该简码是否存在
-                BrandEntity queryBrandEntity = brandDao.queryByUniqueIdentifier(uniqueIdentifier);
-                if (Objects.nonNull(queryBrandEntity)) {
-                    throw new ServiceException("第" + (i + 1) + "行的该品牌:【" + queryBrandEntity.getName() + "】已存在!");
+                if (StringUtils.isNotBlank(uniqueIdentifier)) {
+                    BrandEntity queryBrandEntity = brandDao.queryByUniqueIdentifier(uniqueIdentifier);
+                    if (Objects.nonNull(queryBrandEntity)) {
+                        throw new ServiceException("第" + (i + 1) + "行的品牌唯一简码:【" + queryBrandEntity.getUniqueIdentifier() + "】已存在!");
+                    }
                 }
 
                 BrandEntity insertBrandEntity = new BrandEntity();
@@ -272,12 +313,24 @@ public class BrandServiceImpl implements BrandService {
                 insertBrandEntity.setUniqueIdentifier(uniqueIdentifier);
                 insertBrandEntity.setIsShow(isShow);
                 insertBrandEntity.setIsNew(isNew);
-                this.save(insertBrandEntity);
+                brandDao.save(insertBrandEntity);
 
             } else {
                 // 存在则修改
+
+                // 判断品牌唯一简码是否存在
+                if (StringUtils.isNotBlank(uniqueIdentifier)) {
+                    BrandEntity queryBrandEntity = brandDao.queryByUniqueIdentifier(uniqueIdentifier);
+                    if (Objects.nonNull(queryBrandEntity) && !queryBrandEntity.getName().equals(name)) {
+                        throw new ServiceException("第" + (i + 1) + "行的品牌唯一简码:【" + queryBrandEntity.getUniqueIdentifier() + "】已存在!");
+                    }
+                }
+
+                Integer id = isExist.getId();
                 BeanUtils.copyProperties(brandEntity, isExist);
-                this.update(isExist);
+                isExist.setId(id);
+                isExist.setUniqueIdentifier(uniqueIdentifier == null ? "" : uniqueIdentifier);
+                brandDao.update(isExist);
             }
         }
     }

+ 102 - 102
kmall-admin/src/main/webapp/WEB-INF/page/shop/brand.html

@@ -71,29 +71,29 @@
             <Form-item label="品牌唯一简码" prop="uniqueIdentifier">
                 <i-input v-model="brand.uniqueIdentifier" placeholder="品牌唯一简码,限制只能为字母数字下划线,长度不能超过10位"/>
             </Form-item>
-            <Row>
-                <i-col span="16">
-                    <Form-item label="图片" prop="listPicUrl">
-                        <i-input v-model="brand.listPicUrl" placeholder="图片尺寸建议760*484像素以内,大小100k以下" readonly/>
-                    </Form-item>
-                </i-col>
-                <i-col span="4">
-                    <Form-item :label-width="1">
-                        <Upload style="width: 300px;" action="../sys/oss/upload" :format="['jpg','jpeg','png']"
-                                max-size="100"
-                                :on-success="handleSuccessListPicUrl" :on-format-error="handleFormatError"
-                                :show-upload-list="false"
-                                :on-exceeded-size="handleMaxSize">
-                            <i-button icon="ios-cloud-upload-outline">上传图片</i-button>
-                        </Upload>
-                    </Form-item>
-                </i-col>
-                <i-col span="4">
-                    <Form-item :label-width="1">
-                        <i-button icon="eye" @click="eyeImageListPicUrl">预览图片</i-button>
-                    </Form-item>
-                </i-col>
-            </Row>
+<!--            <Row>-->
+<!--                <i-col span="16">-->
+<!--                    <Form-item label="图片" prop="listPicUrl">-->
+<!--                        <i-input v-model="brand.listPicUrl" placeholder="图片尺寸建议760*484像素以内,大小100k以下" readonly/>-->
+<!--                    </Form-item>-->
+<!--                </i-col>-->
+<!--                <i-col span="4">-->
+<!--                    <Form-item :label-width="1">-->
+<!--                        <Upload style="width: 300px;" action="../sys/oss/upload" :format="['jpg','jpeg','png']"-->
+<!--                                max-size="100"-->
+<!--                                :on-success="handleSuccessListPicUrl" :on-format-error="handleFormatError"-->
+<!--                                :show-upload-list="false"-->
+<!--                                :on-exceeded-size="handleMaxSize">-->
+<!--                            <i-button icon="ios-cloud-upload-outline">上传图片</i-button>-->
+<!--                        </Upload>-->
+<!--                    </Form-item>-->
+<!--                </i-col>-->
+<!--                <i-col span="4">-->
+<!--                    <Form-item :label-width="1">-->
+<!--                        <i-button icon="eye" @click="eyeImageListPicUrl">预览图片</i-button>-->
+<!--                    </Form-item>-->
+<!--                </i-col>-->
+<!--            </Row>-->
             <!--<Row>-->
                 <!--<i-col span="16" style="margin-top: -30px;"  placeholder="图片尺寸建议760*484像素以内,大小100k以下">-->
                     <!--&lt;!&ndash;<span style="margin-left: 100px;color: red;font-size: 12px;">* 图片尺寸建议760*484像素以内,大小100k以下</span>&ndash;&gt;-->
@@ -102,37 +102,37 @@
             <Form-item label="描述" prop="simpleDesc">
                 <i-input type="textarea" v-model="brand.simpleDesc" placeholder="描述"/>
             </Form-item>
-            <Row>
-                <i-col span="16">
-                    <Form-item label="图片" prop="picUrl">
-                        <i-input v-model="brand.picUrl" placeholder="图片尺寸建议760*484像素以内,大小100k以下" readonly/>
-                    </Form-item>
-                </i-col>
-                <i-col span="4">
-                    <Form-item :label-width="1">
-                        <Upload style="width: 300px;" action="../sys/oss/upload" :format="['jpg','jpeg','png']"
-                                max-size="100"
-                                :on-success="handleSuccessPicUrl" :on-format-error="handleFormatError"
-                                :show-upload-list="false"
-                                :on-exceeded-size="handleMaxSize">
-                            <i-button icon="ios-cloud-upload-outline">上传图片</i-button>
-                        </Upload>
-                    </Form-item>
-                </i-col>
-                <i-col span="4">
-                    <Form-item :label-width="1">
-                        <i-button icon="eye" @click="eyeImagePicUrl">预览图片</i-button>
-                    </Form-item>
-                </i-col>
-            </Row>
+<!--            <Row>-->
+<!--                <i-col span="16">-->
+<!--                    <Form-item label="图片" prop="picUrl">-->
+<!--                        <i-input v-model="brand.picUrl" placeholder="图片尺寸建议760*484像素以内,大小100k以下" readonly/>-->
+<!--                    </Form-item>-->
+<!--                </i-col>-->
+<!--                <i-col span="4">-->
+<!--                    <Form-item :label-width="1">-->
+<!--                        <Upload style="width: 300px;" action="../sys/oss/upload" :format="['jpg','jpeg','png']"-->
+<!--                                max-size="100"-->
+<!--                                :on-success="handleSuccessPicUrl" :on-format-error="handleFormatError"-->
+<!--                                :show-upload-list="false"-->
+<!--                                :on-exceeded-size="handleMaxSize">-->
+<!--                            <i-button icon="ios-cloud-upload-outline">上传图片</i-button>-->
+<!--                        </Upload>-->
+<!--                    </Form-item>-->
+<!--                </i-col>-->
+<!--                <i-col span="4">-->
+<!--                    <Form-item :label-width="1">-->
+<!--                        <i-button icon="eye" @click="eyeImagePicUrl">预览图片</i-button>-->
+<!--                    </Form-item>-->
+<!--                </i-col>-->
+<!--            </Row>-->
             <!--<Row>
                 <i-col span="16" style="margin-top: -30px;">
                     <span style="margin-left: 100px;color: red;font-size: 12px;">* 图片尺寸建议760*484像素以内,大小100k以下</span>
                 </i-col>
             </Row>-->
-            <Form-item label="排序" prop="sortOrder">
-                <Input-number :min="0" :step="1" v-model="brand.sortOrder" placeholder="排序" style="width: 188px;"/>
-            </Form-item>
+<!--            <Form-item label="排序" prop="sortOrder">-->
+<!--                <Input-number :min="0" :step="1" v-model="brand.sortOrder" placeholder="排序" style="width: 188px;"/>-->
+<!--            </Form-item>-->
             <Form-item label="显示" prop="isShow">
                 <Radio-group v-model="brand.isShow">
                     <Radio label="1">
@@ -143,32 +143,32 @@
                     </Radio>
                 </Radio-group>
             </Form-item>
-            <Form-item label="展示价格" prop="floorPrice">
-                <Input-number :min="0" v-model="brand.floorPrice" placeholder="展示价格" style="width: 188px;"/>
-            </Form-item>
-            <Row>
-                <i-col span="16">
-                    <Form-item label="app显示图片" prop="appListPicUrl">
-                        <i-input v-model="brand.appListPicUrl" placeholder="图片尺寸建议760*484像素以内,大小100k以下" readonly/>
-                    </Form-item>
-                </i-col>
-                <i-col span="4">
-                    <Form-item :label-width="1">
-                        <Upload style="width: 300px;" action="../sys/oss/upload" :format="['jpg','jpeg','png']"
-                                max-size="100"
-                                :on-success="handleSuccessAppListPicUrl" :on-format-error="handleFormatError"
-                                :show-upload-list="false"
-                                :on-exceeded-size="handleMaxSize">
-                            <i-button icon="ios-cloud-upload-outline">上传图片</i-button>
-                        </Upload>
-                    </Form-item>
-                </i-col>
-                <i-col span="4">
-                    <Form-item :label-width="1">
-                        <i-button icon="eye" @click="eyeImageAppListPicUrl">预览图片</i-button>
-                    </Form-item>
-                </i-col>
-            </Row>
+<!--            <Form-item label="展示价格" prop="floorPrice">-->
+<!--                <Input-number :min="0" v-model="brand.floorPrice" placeholder="展示价格" style="width: 188px;"/>-->
+<!--            </Form-item>-->
+<!--            <Row>-->
+<!--                <i-col span="16">-->
+<!--                    <Form-item label="app显示图片" prop="appListPicUrl">-->
+<!--                        <i-input v-model="brand.appListPicUrl" placeholder="图片尺寸建议760*484像素以内,大小100k以下" readonly/>-->
+<!--                    </Form-item>-->
+<!--                </i-col>-->
+<!--                <i-col span="4">-->
+<!--                    <Form-item :label-width="1">-->
+<!--                        <Upload style="width: 300px;" action="../sys/oss/upload" :format="['jpg','jpeg','png']"-->
+<!--                                max-size="100"-->
+<!--                                :on-success="handleSuccessAppListPicUrl" :on-format-error="handleFormatError"-->
+<!--                                :show-upload-list="false"-->
+<!--                                :on-exceeded-size="handleMaxSize">-->
+<!--                            <i-button icon="ios-cloud-upload-outline">上传图片</i-button>-->
+<!--                        </Upload>-->
+<!--                    </Form-item>-->
+<!--                </i-col>-->
+<!--                <i-col span="4">-->
+<!--                    <Form-item :label-width="1">-->
+<!--                        <i-button icon="eye" @click="eyeImageAppListPicUrl">预览图片</i-button>-->
+<!--                    </Form-item>-->
+<!--                </i-col>-->
+<!--            </Row>-->
             <!--<Row>
                 <i-col span="16" style="margin-top: -30px;">
                     <span style="margin-left: 100px;color: red;font-size: 12px;">* app显示图片尺寸建议760*484像素以内,大小100k以下</span>
@@ -184,38 +184,38 @@
                     </Radio>
                 </Radio-group>
             </Form-item>
-            <Row>
-                <i-col span="16">
-                    <Form-item label="新品牌图片" prop="newPicUrl">
-                        <i-input v-model="brand.newPicUrl" placeholder="图片尺寸建议760*484像素以内,大小100k以下" readonly/>
-                    </Form-item>
-                </i-col>
-                <i-col span="4">
-                    <Form-item :label-width="1">
-                        <Upload style="width: 300px;" action="../sys/oss/upload" :format="['jpg','jpeg','png']"
-                                max-size="100"
-                                :on-success="handleSuccessNewPicUrl" :on-format-error="handleFormatError"
-                                :show-upload-list="false"
-                                :on-exceeded-size="handleMaxSize">
-                            <i-button icon="ios-cloud-upload-outline">上传图片</i-button>
-                        </Upload>
-                    </Form-item>
-                </i-col>
-                <i-col span="4">
-                    <Form-item :label-width="1">
-                        <i-button icon="eye" @click="eyeImageNewPicUrl">预览图片</i-button>
-                    </Form-item>
-                </i-col>
-            </Row>
+<!--            <Row>-->
+<!--                <i-col span="16">-->
+<!--                    <Form-item label="新品牌图片" prop="newPicUrl">-->
+<!--                        <i-input v-model="brand.newPicUrl" placeholder="图片尺寸建议760*484像素以内,大小100k以下" readonly/>-->
+<!--                    </Form-item>-->
+<!--                </i-col>-->
+<!--                <i-col span="4">-->
+<!--                    <Form-item :label-width="1">-->
+<!--                        <Upload style="width: 300px;" action="../sys/oss/upload" :format="['jpg','jpeg','png']"-->
+<!--                                max-size="100"-->
+<!--                                :on-success="handleSuccessNewPicUrl" :on-format-error="handleFormatError"-->
+<!--                                :show-upload-list="false"-->
+<!--                                :on-exceeded-size="handleMaxSize">-->
+<!--                            <i-button icon="ios-cloud-upload-outline">上传图片</i-button>-->
+<!--                        </Upload>-->
+<!--                    </Form-item>-->
+<!--                </i-col>-->
+<!--                <i-col span="4">-->
+<!--                    <Form-item :label-width="1">-->
+<!--                        <i-button icon="eye" @click="eyeImageNewPicUrl">预览图片</i-button>-->
+<!--                    </Form-item>-->
+<!--                </i-col>-->
+<!--            </Row>-->
             <!--<Row>
                 <i-col span="16" style="margin-top: -30px;" placeholder="* 新品牌图片尺寸建议760*484像素以内,大小100k以下">
                     &lt;!&ndash;<span style="margin-left: 100px;color: red;font-size: 12px;"></span>&ndash;&gt;
                 </i-col>
             </Row>-->
-            <Form-item label="新品牌排序" prop="newSortOrder">
-                <Input-number :min="0" :step="1" v-model="brand.newSortOrder" placeholder="新品牌排序"
-                              style="width: 188px;"/>
-            </Form-item>
+<!--            <Form-item label="新品牌排序" prop="newSortOrder">-->
+<!--                <Input-number :min="0" :step="1" v-model="brand.newSortOrder" placeholder="新品牌排序"-->
+<!--                              style="width: 188px;"/>-->
+<!--            </Form-item>-->
             <Form-item>
                 <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                 <i-button type="warning" @click="reload" style="margin-left: 8px"/>

+ 68 - 65
kmall-admin/src/main/webapp/js/shop/brand.js

@@ -2,39 +2,44 @@ $(function () {
     $("#jqGrid").jqGrid({
         url: '../brand/list',
         datatype: "json",
-        colModel: [{
-            label: 'id', name: 'id', index: 'id', key: true, width: 140, align: 'center'
-        },
+        colModel: [
+            {label: 'id', name: 'id', index: 'id', key: true, width: 140, align: 'center', hidden: true},
             // {label: '所属商户', name: 'merchName', index: 'merchName', width: 180, align: 'center'},
             // {label: '所属门店', name: 'storeName', index: 'storeName', width: 180, align: 'center'},
             // {label: '所属分类', name: 'categoryName', index: 'categoryName', width: 180, align: 'center'},
             {
                 label: '品牌名称', name: 'name', index: 'name', width: 300
-            },{
+            },
+            {
                 label: '品牌唯一简码', name: 'uniqueIdentifier', index: 'name', width: 100
-            }, {
-                label: '图片',
-                name: 'listPicUrl',
-                index: 'list_pic_url',
-                width: 100,
-                align: 'center',
-                formatter: function (value) {
-                    return transImg(value);
-                }
-            }, {
+            },
+            // {
+            //     label: '图片',
+            //     name: 'listPicUrl',
+            //     index: 'list_pic_url',
+            //     width: 100,
+            //     align: 'center',
+            //     formatter: function (value) {
+            //         return transImg(value);
+            //     }
+            // },
+            {
                 label: '描述', name: 'simpleDesc', index: 'simple_desc', width: 250
-            }, {
-                label: '图片',
-                name: 'picUrl',
-                index: 'pic_url',
-                width: 100,
-                align: 'center',
-                formatter: function (value) {
-                    return transImg(value);
-                }
-            }, {
-                label: '排序', name: 'sortOrder', index: 'sort_order', width: 100, align: 'center'
-            }, {
+            },
+            // {
+            //     label: '图片',
+            //     name: 'picUrl',
+            //     index: 'pic_url',
+            //     width: 100,
+            //     align: 'center',
+            //     formatter: function (value) {
+            //         return transImg(value);
+            //     }
+            // },
+            // {
+            //     label: '排序', name: 'sortOrder', index: 'sort_order', width: 100, align: 'center'
+            // },
+            {
                 label: '显示',
                 name: 'isShow',
                 index: 'is_show',
@@ -43,33 +48,36 @@ $(function () {
                 formatter: function (value) {
                     return transIsNot(value)
                 }
-            }, {
-                label: '展示价格', name: 'floorPrice', index: 'floor_Price', width: 100, align: 'right'
-            }, {
-                label: 'app显示图片',
-                name: 'appListPicUrl',
-                index: 'app_list_pic_url',
-                align: 'center',
-                width: 100,
-                formatter: function (value) {
-                    return transImg(value);
-                }
-            }, {
+            },
+            // {
+            //     label: '展示价格', name: 'floorPrice', index: 'floor_Price', width: 100, align: 'right'
+            // }, {
+            //     label: 'app显示图片',
+            //     name: 'appListPicUrl',
+            //     index: 'app_list_pic_url',
+            //     align: 'center',
+            //     width: 100,
+            //     formatter: function (value) {
+            //         return transImg(value);
+            //     }
+            // },
+            {
                 label: '新品牌', name: 'isNew', index: 'is_new', align: 'center', width: 100, formatter: function (value) {
                     return transIsNot(value)
                 }
-            }, {
-                label: '新品牌图片',
-                name: 'newPicUrl',
-                index: 'new_pic_url',
-                align: 'center',
-                width: 100,
-                formatter: function (value) {
-                    return transImg(value);
-                }
-            }, {
-                label: '新品牌排序', name: 'newSortOrder', index: 'new_sort_order', align: 'center', width: 80
             }
+            // {
+            //     label: '新品牌图片',
+            //     name: 'newPicUrl',
+            //     index: 'new_pic_url',
+            //     align: 'center',
+            //     width: 100,
+            //     formatter: function (value) {
+            //         return transImg(value);
+            //     }
+            // }, {
+            //     label: '新品牌排序', name: 'newSortOrder', index: 'new_sort_order', align: 'center', width: 80
+            // }
             // ,
             //     {label: '操作', width: 150, align: 'center', sortable: false,
             //         formatter: function (value, col, row) {
@@ -113,7 +121,7 @@ $(function () {
 
 
 var category_ztree;
-var exportMsg;
+
 var category_setting = {
     data: {
         simpleData: {
@@ -146,16 +154,19 @@ var vm = new Vue({
         brand: {listPicUrl: '', picUrl: '', appListPicUrl: '', newPicUrl: '', isShow: 1, isNew: 0},
         ruleValidate: {
             name: [
-                {required: true, message: '品牌名称不能为空', trigger: 'blur'}
+                {required: true, message: '品牌名称不能为空', trigger: 'blur'},
+                {max: 64, message: '品牌名称长度不能超过64', trigger: 'blur'}
             ],
             uniqueIdentifier: [
-                {required: true, message: '品牌唯一简码不能为空', trigger: 'blur'}
+                // {required: true, message: '品牌唯一简码不能为空', trigger: 'blur'},
+                {max: 10, message: '品牌唯一简码长度不能超过10', trigger: 'blur'}
             ],
             // listPicUrl: [
             //     {required: true, message: '品牌图片不能为空', trigger: 'blur'}
             // ],
             simpleDesc: [
-                {required: true, message: '品牌描述不能为空', trigger: 'blur'}
+                {required: true, message: '品牌描述不能为空', trigger: 'blur'},
+                {max: 200, message: '品牌描述长度不能超过200', trigger: 'blur'}
             ],
             // picUrl: [
             //     {required: true, message: '品牌图片不能为空', trigger: 'blur'}
@@ -289,9 +300,10 @@ var vm = new Vue({
 
             // 校验品牌唯一简码
             var uniqueIdentifier = vm.brand.uniqueIdentifier;
-            var uniqueReg = /^[0-9a-zA-Z_]{1,10}$/;
+            var uniqueReg = /^[0-9a-zA-Z_]{0,10}$/;
             if(!uniqueReg.test(uniqueIdentifier)){
                 alert("请输入正确的唯一简码");
+                return;
             }
 
 
@@ -475,7 +487,6 @@ var vm = new Vue({
             });
         },
         uploadExcelSuccess: function (data) {
-            // console.log(data);
             if (data.code == 0) {
                 alert('导入成功', function (index) {
                     $("#jqGrid").trigger("reloadGrid");
@@ -483,30 +494,22 @@ var vm = new Vue({
             } else {
                 alert(data.msg);
             }
-            setTimeout(exportMsg, 100);
         },
         uploadExcelError: function () {
             alert('上传出现异常,请重试!');
-            setTimeout(exportMsg, 100);
         },
         uploadExcelProgress: function (event, file, fileList) {
-            console.log("上传中")
-            console.log(event)
-            console.log(file)
-            console.log(fileList)
-            console.log("上传中")
-            exportMsg = this.$Message.loading({
+            const msg = this.$Message.loading({
                 content: 'Loading...',
                 duration: 0
             });
-            // setTimeout(msg, 3000);
+            setTimeout(msg, 1000);
         },
         uploadExcelFormatError: function (file) {
             this.$Notice.warning({
                 title: '文件格式不正确',
                 desc: '文件 ' + file.name + ' 格式不正确,请上传 xls 或 xlsx 格式的文件。'
             });
-            setTimeout(exportMsg, 100);
         }
     },
     mounted() {

BIN
kmall-admin/src/main/webapp/statics/file/brand_export_yyyy_mm_dd_v1.0.0.xls