| | |
| | | <el-radio :label="2">其他</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item>--> |
| | | <el-form-item label="选择分类:" prop="type"> |
| | | <el-cascader v-model="form.cateId" @change="changeSel" :options="cateList" :props="{ |
| | | <el-form-item label="选择分类:" prop="cateId"> |
| | | <!-- <el-cascader v-model="form.cateId" @change="changeSel" :options="cateList" :props="{ |
| | | label: 'name', |
| | | value: 'id', |
| | | children: 'childCategoryList', |
| | | checkStrictly: true |
| | | }"></el-cascader> |
| | | }"></el-cascader>--> |
| | | <treeselect |
| | | @select="cateChange" |
| | | v-model="form.cateId" |
| | | placeholder="请选择" |
| | | :options="cateList" |
| | | :normalizer="normalizeOptions1" |
| | | :default-expand-level="1" |
| | | noChildrenText="没有子选项" |
| | | noOptionsText="没有可选项" |
| | | noResultsText="没有匹配的结果" /> |
| | | </el-form-item> |
| | | <el-form-item label="选择组织:" prop="groupId"> |
| | | <el-select v-model="form.groupId" @change="changeSel" clearable filterable placeholder="请选择"> |
| | | <treeselect |
| | | @input="changeSel" |
| | | v-model="form.groupId" |
| | | placeholder="请选择" |
| | | :options="companyTree" |
| | | :normalizer="normalizeOptions" |
| | | :default-expand-level="1" |
| | | noChildrenText="没有子选项" |
| | | noOptionsText="没有可选项" |
| | | noResultsText="没有匹配的结果" /> |
| | | <!-- <el-select v-model="form.groupId" @change="changeSel" clearable filterable placeholder="请选择"> |
| | | <template v-for="item in companyList"> |
| | | <el-option v-if="item.countNum && item.countNum>0" :key="item.id" :label="item.name" :value="item.id"> |
| | | </el-option> |
| | | </template> |
| | | </el-select> |
| | | </el-select>--> |
| | | </el-form-item> |
| | | <el-form-item label="选择车主:" prop="memberId"> |
| | | <el-select v-model="form.memberId" clearable filterable placeholder="请选择"> |
| | |
| | | import { allList } from '@/api/business/member' |
| | | import { fetchList } from '@/api/business/category.js' |
| | | import { create, updateById } from '@/api/business/cars' |
| | | import { companyGetList } from '@/api/business/company' |
| | | import { companyGetList, fetchList as companyTree } from '@/api/business/company' |
| | | import { Message } from 'element-ui' |
| | | export default { |
| | | name: 'OperaInternalCompanyWindow', |
| | |
| | | memberId: null, |
| | | // type: 0, |
| | | groupId: null, |
| | | cateId: [] |
| | | cateId: null |
| | | }, |
| | | selectCate: null, |
| | | cateList: [], |
| | | companyList: [], |
| | | companyTree: [], |
| | | // 验证规则 |
| | | rules: { |
| | | code: [{ required: true, message: '请输入车牌号' }], |
| | |
| | | this.title = title |
| | | this.visible = true |
| | | this.getCate() |
| | | this.getCompany() |
| | | this.getfindCompanyTreePage() |
| | | // 新建组织 |
| | | if (target == null) { |
| | | this.$nextTick(() => { |
| | |
| | | // } |
| | | // }) |
| | | }, |
| | | cateChange(node){ |
| | | this.selectCate = node |
| | | }, |
| | | // 规范化选项数据的方法 |
| | | normalizeOptions1 (node) { |
| | | if (!node.childCategoryList || !node.childCategoryList.length) { |
| | | // 去掉children=[]的children属性 |
| | | delete node.childCategoryList |
| | | } |
| | | var node1 = { |
| | | id: node.id, |
| | | label: node.name, |
| | | parentId: node.parentId, |
| | | children: node.childCategoryList, |
| | | } |
| | | return node1 |
| | | }, |
| | | normalizeOptions (node) { |
| | | if (!node.childList || !node.childList.length) { |
| | | // 去掉children=[]的children属性 |
| | | delete node.childList |
| | | } |
| | | return { |
| | | id: node.id, |
| | | label: node.name, |
| | | children: node.childList |
| | | } |
| | | }, |
| | | changeSel () { |
| | | const { form } = this |
| | | if (form.groupId) { |
| | |
| | | confirm () { |
| | | console.log('form', this.form.cateId) |
| | | const { form } = this |
| | | if (form.cateId && form.cateId.length == 2) { |
| | | |
| | | } else { |
| | | if(this.selectCate && this.selectCate.childCategoryList && this.selectCate.childCategoryList.length) { |
| | | return Message.error('请选择二级分类') |
| | | } |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | const fn = form.id ? updateById : create |
| | | fn({ |
| | | ...form, |
| | | cateId: form.cateId[1] |
| | | ...form |
| | | // cateId: form.cateId[1] |
| | | }).then(res => { |
| | | Message.success('保存成功') |
| | | this.visible = false |
| | |
| | | capacity: 1000, |
| | | page: 1 |
| | | }).then(res => { |
| | | this.cateList = res.records || [] |
| | | if (res && res.records && res.records.length > 0) { |
| | | res.records[0].fsStatus = 1 |
| | | this.cateList = res.records || [] |
| | | |
| | | } |
| | | }) |
| | | }, |
| | | getCompany () { |
| | |
| | | this.companyList = res.records || [] |
| | | }) |
| | | }, |
| | | getfindCompanyTreePage () { |
| | | companyTree() |
| | | .then(res => { |
| | | if (res && res.length > 0) { |
| | | res[0].fsStatus = 1 |
| | | this.companyTree = res |
| | | } |
| | | }) |
| | | }, |
| | | loadMember () { |
| | | const { form } = this |
| | | allList({ |
| | |
| | | <el-table :height="tableHeightNew" row-key="id" :tree-props="{ children: 'childCategoryList' }" v-loading="isWorking.search" |
| | | :data="dataList" stripe @selection-change="handleSelectionChange"> |
| | | <el-table-column prop="name" label="分类名称" min-width="100px"></el-table-column> |
| | | <el-table-column prop="remark" label="备注" min-width="100px"></el-table-column> |
| | | <!-- <el-table-column prop="status" label="状态" min-width="100px"> |
| | | <el-table-column prop="bizType" label="业务类型" min-width="100px"> |
| | | <template slot-scope="{row}"> |
| | | <span v-if="row.status === 0">启用</span> |
| | | <span v-if="row.status === 1">禁用</span> |
| | | <span v-if="row.bizType ==0">访客车辆</span> |
| | | <span v-else-if="row.bizType ==1">外协运输车辆</span> |
| | | <span v-else-if="row.bizType ==2">市公司卸货车辆</span> |
| | | <span v-else-if="row.bizType ==3">加工烟卸货车辆</span> |
| | | <span v-else-if="row.bizType ==4">安泰物流公务用车</span> |
| | | <span v-else-if="row.bizType ==5">安泰物流货运车辆</span> |
| | | <span v-else >-</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remark" label="备注" min-width="100px"></el-table-column> |
| | | <!-- <el-table-column prop="status" label="状态" min-width="100px"> |
| | | <template slot-scope="{row}"> |
| | | <span v-if="row.status === 0">启用</span> |
| | | <span v-if="row.status === 1">禁用</span> |
| | | </template> |
| | | </el-table-column> --> |
| | | <el-table-column prop="createDate" label="创建时间" min-width="100px"></el-table-column> |
| | | <el-table-column v-if="containPermissions(['business:category:update', 'business:category:delete'])" |
| | |
| | | <GlobalWindow :title="title" :visible.sync="visible" :confirm-working="isWorking" width="600px" @close="close" @confirm="confirm"> |
| | | <el-form :model="form" ref="form" :rules="rules"> |
| | | <el-form-item label="所属分类" prop="parentId"> |
| | | <el-select :disabled="form.id" clearable v-model="form.parentId" placeholder="不填为则一级分类"> |
| | | <el-select :disabled="form.id && form.id!=null" clearable v-model="form.parentId" placeholder="不选择为则一级分类"> |
| | | <el-option v-for="op in dataList" :key="op.id" :label="op.name" :value="op.id"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="分类名称" prop="name"> |
| | | <el-input v-model="form.name" placeholder="请输入分类名称" v-trim /> |
| | | </el-form-item> |
| | | <el-form-item label="业务类型" prop="bizType"> |
| | | <el-radio-group v-model="form.bizType"> |
| | | <el-radio :label="0">访客车辆</el-radio> |
| | | <el-radio :label="1">外协运输车辆</el-radio> |
| | | <el-radio :label="2">市公司卸货车辆</el-radio> |
| | | <el-radio :label="3">加工烟卸货车辆</el-radio> |
| | | <el-radio :label="4">安泰物流公务用车</el-radio> |
| | | <el-radio :label="5">安泰物流货运车辆</el-radio> |
| | | </el-radio-group> |
| | | <el-form-item label="业务类型" prop="bizType" > |
| | | <el-select v-model="form.bizType" clearable placeholder="选择业务类型"> |
| | | <el-option v-for="op in bizTypeList" :key="op.key" :label="op.name" :value="op.key"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="状态" prop="status"> |
| | | <el-select v-model="form.status" placeholder="请选择"> |
| | |
| | | name: 'OperaCategoryWindow', |
| | | extends: BaseOpera, |
| | | components: { GlobalWindow }, |
| | | data() { |
| | | data () { |
| | | return { |
| | | // 表单数据 |
| | | form: { |
| | | parentId: null, |
| | | name: '', |
| | | bizType, |
| | | bizType: null, |
| | | remark: '', |
| | | status: '', |
| | | type: 1 |
| | | }, |
| | | bizTypeList: [{ key: 0, name: '访客车辆' }, |
| | | { key: 1, name: '外协运输车辆' }, |
| | | { key: 2, name: '市公司卸货车辆' }, |
| | | { key: 3, name: '加工烟卸货车辆' }, |
| | | { key: 4, name: '安泰物流公务用车' }, |
| | | { key: 5, name: '安泰物流货运车辆' } |
| | | ], |
| | | // 验证规则 |
| | | rules: { |
| | | name: [ |
| | | { required: true, message: '请输入二级分类名称', trigger: 'blur' } |
| | | ], |
| | | bizType: [ |
| | | { required: false, message: '请输入二级分类名称', trigger: 'blur' } |
| | | ], |
| | | status: [ |
| | | { required: true, message: '请选择是否启用', trigger: 'change' } |
| | |
| | | dataList: [] |
| | | } |
| | | }, |
| | | created() { |
| | | created () { |
| | | this.config({ |
| | | api: '/business/category', |
| | | 'field.id': 'id' |
| | | }) |
| | | }, |
| | | methods: { |
| | | getList() { |
| | | getList () { |
| | | fetchCateList({}).then(res => { |
| | | this.dataList = res || [] |
| | | |
| | | }) |
| | | }, |
| | | close() { |
| | | close () { |
| | | this.visible = false |
| | | this.$emit('close') |
| | | }, |
| | | getDetail(id) { |
| | | getDetail (id) { |
| | | getInfoById(id).then(res => { |
| | | this.form = res |
| | | }) |
| | | }, |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | @ApiModelProperty(value = "类型 0公司类型 1车辆类型") |
| | | //@ExcelColumn(name="类型 0公司类型 1车辆类型") |
| | | private Integer type; |
| | | @ApiModelProperty(value = "业务类型 业务类型 0=访客车辆-访客车辆 ;1=wms推送的物流车辆(非自有车):货运车辆-外协运输车辆 ;2=wms市公司的预约入园车辆:货运车辆-市公司卸货车辆;3=wms、安泰的预约入园车辆:货运车辆-加工烟卸货车辆 ;4=wms安泰公务车:公务车-安泰物流公务用车;5=wms安泰自有车:货运车辆-安泰物流货运车辆' ") |
| | | @ApiModelProperty(value = "业务类型 业务类型 0=访客车辆-访客车辆 ;" + |
| | | "1=wms推送的物流车辆(非自有车):货运车辆-外协运输车辆 ;" + |
| | | "2=wms市公司的预约入园车辆:货运车辆-市公司卸货车辆;" + |
| | | "3=wms、安泰的预约入园车辆:货运车辆-加工烟卸货车辆 ;" + |
| | | "4=wms安泰公务车:公务车-安泰物流公务用车;" + |
| | | "5=wms安泰自有车:货运车辆-安泰物流货运车辆' ") |
| | | private Integer bizType; |
| | | |
| | | @ApiModelProperty(value = "父级编码(自关联)") |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.checkerframework.checker.units.qual.C; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.validation.BindException; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | |
| | | private CategoryMapper categoryMapper; |
| | | |
| | | @Override |
| | | public Integer create(Category category) { |
| | | @Transactional(rollbackFor = {Exception.class, BindException.class}) |
| | | public Integer create(Category category){ |
| | | checkUnique(category); |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(loginUserInfo ==null){ |
| | |
| | | insert.setType(category.getType()); |
| | | insert.setParentId(category.getParentId()); |
| | | categoryMapper.insert(insert); |
| | | if(insert.getBizType()!=null){ |
| | | //清空其他bizType,只保留当前新增记录唯一有效 |
| | | categoryMapper.update(null,new UpdateWrapper<Category>().lambda() |
| | | .set(Category::getBizType,null) |
| | | .ne(Category::getId,insert.getId()) |
| | | ); |
| | | } |
| | | return insert.getId(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class, BindException.class}) |
| | | public void updateById(Category category) { |
| | | checkUnique(category); |
| | | categoryMapper.updateById(category); |
| | | if(category.getBizType()!=null){ |
| | | //清空其他该bizType属性,只保留当前记录唯一有效 |
| | | categoryMapper.update(null,new UpdateWrapper<Category>().lambda() |
| | | .set(Category::getBizType,null) |
| | | .ne(Category::getId,category.getId()) |
| | | ); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | wrapper.lambda() |
| | | .eq(Category::getIsdeleted,Constants.ZERO) |
| | | .eq(Category::getType,category.getType()) |
| | | .eq(Category::getName,category.getName()); |
| | | .eq(Category::getName,category.getName()) |
| | | .ne(category.getId()!=null, Category::getId,category.getId()) |
| | | ; |
| | | |
| | | List<Category> categories = categoryMapper.selectList(wrapper); |
| | | |
| | | if (org.apache.commons.collections.CollectionUtils.isNotEmpty(categories)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"分类信息已存在"); |
| | | } |