From 568e60d0eeecb947fd0f7aa8b8806b017334ff76 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期一, 28 四月 2025 16:22:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java | 26 +++++
admin/src/views/vehicle/category.vue | 19 +++-
admin/src/views/vehicle/components/OperaCategoryWindow.vue | 40 +++++----
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/Category.java | 7 +
admin/src/components/business/OperaCarsWindow.vue | 89 ++++++++++++++++++---
5 files changed, 141 insertions(+), 40 deletions(-)
diff --git a/admin/src/components/business/OperaCarsWindow.vue b/admin/src/components/business/OperaCarsWindow.vue
index c278d1b..2b59642 100644
--- a/admin/src/components/business/OperaCarsWindow.vue
+++ b/admin/src/components/business/OperaCarsWindow.vue
@@ -12,21 +12,41 @@
<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="璇烽�夋嫨">
@@ -44,7 +64,7 @@
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',
@@ -60,10 +80,12 @@
memberId: null,
// type: 0,
groupId: null,
- cateId: []
+ cateId: null
},
+ selectCate: null,
cateList: [],
companyList: [],
+ companyTree: [],
// 楠岃瘉瑙勫垯
rules: {
code: [{ required: true, message: '璇疯緭鍏ヨ溅鐗屽彿' }],
@@ -85,7 +107,7 @@
this.title = title
this.visible = true
this.getCate()
- this.getCompany()
+ this.getfindCompanyTreePage()
// 鏂板缓缁勭粐
if (target == null) {
this.$nextTick(() => {
@@ -101,6 +123,34 @@
// }
// })
},
+ cateChange(node){
+ this.selectCate = node
+ },
+ // 瑙勮寖鍖栭�夐」鏁版嵁鐨勬柟娉�
+ normalizeOptions1 (node) {
+ if (!node.childCategoryList || !node.childCategoryList.length) {
+ // 鍘绘帀children=[]鐨刢hildren灞炴��
+ 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=[]鐨刢hildren灞炴��
+ delete node.childList
+ }
+ return {
+ id: node.id,
+ label: node.name,
+ children: node.childList
+ }
+ },
changeSel () {
const { form } = this
if (form.groupId) {
@@ -111,17 +161,15 @@
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
@@ -143,7 +191,11 @@
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 () {
@@ -155,6 +207,15 @@
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({
diff --git a/admin/src/views/vehicle/category.vue b/admin/src/views/vehicle/category.vue
index 0a6737f..cd83835 100644
--- a/admin/src/views/vehicle/category.vue
+++ b/admin/src/views/vehicle/category.vue
@@ -24,12 +24,23 @@
<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'])"
diff --git a/admin/src/views/vehicle/components/OperaCategoryWindow.vue b/admin/src/views/vehicle/components/OperaCategoryWindow.vue
index f7220fb..cea3254 100644
--- a/admin/src/views/vehicle/components/OperaCategoryWindow.vue
+++ b/admin/src/views/vehicle/components/OperaCategoryWindow.vue
@@ -2,22 +2,17 @@
<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="璇烽�夋嫨">
@@ -40,21 +35,31 @@
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' }
@@ -63,28 +68,27 @@
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>
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/Category.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/Category.java
index 4690f9e..f3a64a5 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/Category.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/Category.java
@@ -71,7 +71,12 @@
@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 = "鐖剁骇缂栫爜锛堣嚜鍏宠仈锛�")
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java
index 9d6cd82..d3a9c07 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java
@@ -16,9 +16,12 @@
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;
@@ -38,7 +41,8 @@
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){
@@ -58,6 +62,13 @@
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();
}
@@ -85,9 +96,17 @@
}
@Override
+ @Transactional(rollbackFor = {Exception.class, BindException.class})
public void updateById(Category category) {
checkUnique(category);
categoryMapper.updateById(category);
+ if(category.getBizType()!=null){
+ //娓呯┖鍏朵粬璇izType灞炴��,鍙繚鐣欏綋鍓嶈褰曞敮涓�鏈夋晥
+ categoryMapper.update(null,new UpdateWrapper<Category>().lambda()
+ .set(Category::getBizType,null)
+ .ne(Category::getId,category.getId())
+ );
+ }
}
@Override
@@ -193,10 +212,11 @@
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(),"鍒嗙被淇℃伅宸插瓨鍦�");
}
--
Gitblit v1.9.3