Browse Source

修复下拉框选中显示错误,增加品类词去重

master
С·æ 4 years ago
parent
commit
2351ad7351
  1. 15
      src/Coldairarrow.Business/HuiYan/catsBusiness.cs
  2. 8
      src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs
  3. 3
      src/Coldairarrow.Web/.env
  4. 56
      src/Coldairarrow.Web/src/views/HuiYan/cats/EditForm.vue
  5. 41
      客户端/齐越慧眼/齐越慧眼/UserControls/BrowerControl.xaml.cs
  6. 3
      客户端/齐越慧眼/齐越慧眼/UserControls/CatControl.xaml.cs
  7. 4
      客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/cats/Index.vue
  8. 2
      客户端/齐越慧眼/齐越慧眼/vuepage/dist/js/app.js
  9. 2
      客户端/齐越慧眼/齐越慧眼/vuepage/dist/js/app.js.map
  10. 2
      客户端/齐越慧眼/齐越慧眼/齐越慧眼.csproj

15
src/Coldairarrow.Business/HuiYan/catsBusiness.cs

@ -153,17 +153,22 @@ namespace Coldairarrow.Business.HuiYan
var list = new List<cats>(); var list = new List<cats>();
model.KeyWords.ForEach(key => { var hasKeys= Db.GetIQueryable<cats>().Where(c =>c.Type==0 &&c.ParentId == lastCat.Id && model.KeyWords.Contains(c.Name)).Select(c=>c.Name).ToList();
list.Add(new cats() {
model.KeyWords.Where(c => !hasKeys.Contains(c)).ForEach(key =>
{
list.Add(new cats()
{
Id = IdHelper.GetId(), Id = IdHelper.GetId(),
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
CreatorId = "admin", CreatorId = "admin",
Deleted = false, Deleted = false,
Name = key, Name = key,
ParentId = lastCat.Id, ParentId = lastCat.Id,
LastShowJDTime=DateTime.MinValue, LastShowJDTime = DateTime.MinValue,
LastShowPddTime=DateTime.MinValue, LastShowPddTime = DateTime.MinValue,
LastShowTBTime=DateTime.MinValue LastShowTBTime = DateTime.MinValue,
Type = 0
}); });
}); });

8
src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs

@ -223,10 +223,10 @@ namespace Coldairarrow.Business.HuiYan
item.IsAdded = false; item.IsAdded = false;
}); });
if (row <= 0) //if (row <= 0)
{ //{
throw new Exception($"删除失败!"); // throw new Exception($"删除失败!");
} //}
}); });

3
src/Coldairarrow.Web/.env

@ -7,7 +7,8 @@ VUE_APP_DesktopPath=/Home/Introduce
#发布后接口根地址 #发布后接口根地址
VUE_APP_PublishRootUrl=http://hyapi.qiyue666.com VUE_APP_PublishRootUrl=http://hyapi.qiyue666.com
#本地调试接口根地址 #本地调试接口根地址
VUE_APP_LocalRootUrl=http://localhost:5000 #VUE_APP_LocalRootUrl=http://localhost:5000
VUE_APP_LocalRootUrl=http://hyapi.qiyue666.com
#接口超时时间ms #接口超时时间ms
VUE_APP_ApiTimeout=10000 VUE_APP_ApiTimeout=10000
#本地开发启动端口 #本地开发启动端口

56
src/Coldairarrow.Web/src/views/HuiYan/cats/EditForm.vue

@ -4,10 +4,10 @@
<a-spin :spinning="loading"> <a-spin :spinning="loading">
<a-form-model ref="form" :model="entity" :rules="rules" v-bind="layout"> <a-form-model ref="form" :model="entity" :rules="rules" v-bind="layout">
<a-form-model-item label="一级类目" prop="OneCat"> <a-form-model-item label="一级类目" prop="OneCat">
<a-select v-model="entity.OneCat" showSearch :filter-option="filterOption" style="width: 100%" <a-select v-model="entity.OneCat" label-in-value showSearch :filter-option="filterOption" style="width: 100%"
placeholder="请选择或输入一级类目"> placeholder="请选择或输入一级类目">
<a-select-option v-for="(cat,index) in catList" :key="index" :value="cat"> <a-select-option v-for="(cat,index) in catList" :key="index" :value="cat.Id">
{{cat.Text}} {{cat.Text}}
</a-select-option> </a-select-option>
@ -21,15 +21,15 @@
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="二级类目" prop="TwoCat"> <a-form-model-item label="二级类目" prop="TwoCat">
<a-select v-if="entity.OneCat" v-model="entity.TwoCat" showSearch :filter-option="filterOption" <a-select label-in-value v-if="entity.OneCat&&catList.find(c=>c.Id==entity.OneCat.key)" v-model="entity.TwoCat" showSearch :filter-option="filterOption"
style="width: 100%" placeholder="请选择或输入一级类目"> style="width: 100%" placeholder="请选择或输入一级类目">
<a-select-option v-for="(cat,index) in entity.OneCat.Children" :key="index" :value="cat"> <a-select-option v-for="(cat,index) in catList.find(c=>c.Id==entity.OneCat.key).Children" :key="index" :value="cat.Id">
{{cat.Text}} {{cat.Text}}
</a-select-option> </a-select-option>
<div slot="dropdownRender" slot-scope="menu"> <div slot="dropdownRender" slot-scope="menu">
<v-nodes :vnodes="menu" /> <v-nodes :vnodes="menu" />
<a-divider style="margin: 4px 0;" /> <a-divider style="margin: 4px 0;" />
<div style="padding: 4px 8px; cursor: pointer;" @mousedown="e => e.preventDefault()" @click="()=>addItem(2,entity.OneCat.Children)"> <div style="padding: 4px 8px; cursor: pointer;" @mousedown="e => e.preventDefault()" @click="()=>addItem(2,catList.find(c=>c.Id==entity.OneCat.key).Children)">
<a-icon type="plus" /> 添加新类目 <a-icon type="plus" /> 添加新类目
</div> </div>
</div> </div>
@ -37,15 +37,15 @@
<span v-else>请选择一级类目</span> <span v-else>请选择一级类目</span>
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="三级类目" prop="LastCat"> <a-form-model-item label="三级类目" prop="LastCat">
<a-select v-if="entity.TwoCat" v-model="entity.LastCat" showSearch :filter-option="filterOption" <a-select label-in-value v-if="entity.TwoCat&&entity.OneCat&&catList.find(c=>c.Id==entity.OneCat.key).Children.find(c=>c.Id==entity.TwoCat.key)" v-model="entity.LastCat" showSearch :filter-option="filterOption"
style="width: 100%" placeholder="请选择或输入一级类目"> style="width: 100%" placeholder="请选择或输入一级类目">
<a-select-option v-for="(cat,index) in entity.TwoCat.Children" :key="index" :value="cat"> <a-select-option v-for="(cat,index) in catList.find(c=>c.Id==entity.OneCat.key).Children.find(c=>c.Id==entity.TwoCat.key).Children" :key="index" :value="cat.Id">
{{cat.Text}} {{cat.Text}}
</a-select-option> </a-select-option>
<div slot="dropdownRender" slot-scope="menu"> <div slot="dropdownRender" slot-scope="menu">
<v-nodes :vnodes="menu" /> <v-nodes :vnodes="menu" />
<a-divider style="margin: 4px 0;" /> <a-divider style="margin: 4px 0;" />
<div style="padding: 4px 8px; cursor: pointer;" @mousedown="e => e.preventDefault()" @click="()=>addItem(3,entity.TwoCat.Children)"> <div style="padding: 4px 8px; cursor: pointer;" @mousedown="e => e.preventDefault()" @click="()=>addItem(3,catList.find(c=>c.Id==entity.OneCat.key).Children.find(c=>c.Id==entity.TwoCat.key).Children)">
<a-icon type="plus" /> 添加新类目 <a-icon type="plus" /> 添加新类目
</div> </div>
</div> </div>
@ -98,7 +98,7 @@
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['form'].clearValidate() this.$refs['form'].clearValidate()
}) })
this.catList = this.parentObj.data.slice(0) this.catList = this.parentObj.data.slice(0)
}, },
openForm(id, title) { openForm(id, title) {
this.init() this.init()
@ -121,16 +121,33 @@
var push={} var push={}
push.KeyWords=this.entity.KeyWords.split(/[(\r\n)\r\n]+/) push.KeyWords=this.entity.KeyWords.split(/[(\r\n)\r\n]+/)
push.OneCat={ push.OneCat={
Text:this.entity.OneCat.Text, Text:this.entity.OneCat.label.trim(),
Id:this.entity.OneCat.Id Id:this.entity.OneCat.key
} }
if(push.OneCat.Id.indexOf("test")>=0)
{
push.OneCat.Id=undefined
}
push.TwoCat={ push.TwoCat={
Text:this.entity.TwoCat.Text, Text:this.entity.TwoCat.label.trim(),
Id:this.entity.TwoCat.Id Id:this.entity.TwoCat.key
}
if(push.TwoCat.Id.indexOf("test")>=0)
{
push.TwoCat.Id=undefined
} }
push.LastCat={ push.LastCat={
Text:this.entity.LastCat.Text, Text:this.entity.LastCat.label.trim(),
Id:this.entity.LastCat.Id Id:this.entity.LastCat.key
}
if(push.LastCat.Id.indexOf("test")>=0)
{
push.LastCat.Id=undefined
} }
this.$http.post('/HuiYan/cats/AddKeyWord', push).then(resJson => { this.$http.post('/HuiYan/cats/AddKeyWord', push).then(resJson => {
@ -162,18 +179,19 @@
onOk(e) { onOk(e) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
var text= document.getElementById('newcattext').value var text= document.getElementById('newcattext').value
var opt={Text:text,Children:[]} var key="test"+Math.ceil(Math.random()*10000)
var opt={Text:text,Children:[],Id:key}
data.push(opt) data.push(opt)
switch(type) switch(type)
{ {
case 1: case 1:
that.entity.OneCat=opt that.entity.OneCat={key:key,label:text}
break break
case 2: case 2:
that.entity.TwoCat=opt that.entity.TwoCat={key:key,label:text}
break break
case 3: case 3:
that.entity.LastCat=opt that.entity.LastCat={key:key,label:text}
break break
} }
e() e()

41
客户端/齐越慧眼/齐越慧眼/UserControls/BrowerControl.xaml.cs

@ -216,10 +216,11 @@ namespace 齐越慧眼.UserControls
"); ");
DoJavaScript(@"$('div#mainsrp-itemlist .items .item').find('.myitemState').remove();$('div#mainsrp-itemlist .items .item .pic').before('<div class=""myitemState""><div class=""stateGraydiv""></div></div><div class=""myopdiv""> DoJavaScript(@"$('div#mainsrp-itemlist .items .item').find('.myitemState').remove();$('div#mainsrp-itemlist .items .item .pic').before('<div class=""myitemState""><div class=""stateGraydiv""></div></div><div class=""myopdiv"">
<div class=""bgGreen"" onclick=""optClick(this,0)""></div>
<div class=""bgPig"" onclick=""optClick(this,1)""></div> <div class=""bgYellow"" style=""display:flex"" onclick=""optClick(this,3)""></div>
<div class=""bgZs"" onclick=""optClick(this,2)""></div> <div class=""bgZs"" style=""display:flex"" onclick=""optClick(this,2)""></div>
<div class=""bgYellow"" style=""display:flex"" onclick=""optClick(this,3)""></div> <div class=""bgPig"" style=""display:flex"" onclick=""optClick(this,1)""></div>
<div class=""bgGreen"" style=""display:flex"" onclick=""optClick(this,0)""></div>
</div>')"); </div>')");
@ -303,14 +304,44 @@ namespace 齐越慧眼.UserControls
.bgGreen .bgGreen
{ {
background: rgba(99, 161, 3, 0.8); background: rgba(99, 161, 3, 0.8);
font-size:20px;
color:red;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
float: right;
font-family: ""global-iconfont"";
font-weight: 999;
margin-right:5px;
} }
.bgPig .bgPig
{ {
background: rgba(236, 128, 141, 0.8); background: rgba(236, 128, 141, 0.8);
font-size:20px;
color:red;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
float: right;
font-family: ""global-iconfont"";
font-weight: 999;
margin-right:5px;
} }
.bgZs .bgZs
{ {
background: rgba(194, 128, 255, 0.8); background: rgba(194, 128, 255, 0.8);
font-size:20px;
color:red;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
float: right;
font-family: ""global-iconfont"";
font-weight: 999;
margin-right:5px;
} }
.bgYellow .bgYellow
{ {
@ -370,7 +401,7 @@ namespace 齐越慧眼.UserControls
public string getTest() public string getTest()
{ {
return "我草"; return "";
} }
public bool setItemData(dynamic data) public bool setItemData(dynamic data)
{ {

3
客户端/齐越慧眼/齐越慧眼/UserControls/CatControl.xaml.cs

@ -36,7 +36,6 @@ namespace 齐越慧眼.UserControls
}, },
}; };
grid.Children.Add(web); grid.Children.Add(web);
@ -45,8 +44,6 @@ namespace 齐越慧眼.UserControls
web.JavascriptObjectRepository.Register("hyCoreModel", new CatsAsyncJS(), BindingOptions.DefaultBinder); web.JavascriptObjectRepository.Register("hyCoreModel", new CatsAsyncJS(), BindingOptions.DefaultBinder);
web.ExecuteScriptAsyncWhenPageLoaded(@$"localStorage.setItem('user', '{{""token"":""{ApiHelper.JwtToken}""}}');window.getDatas();"); web.ExecuteScriptAsyncWhenPageLoaded(@$"localStorage.setItem('user', '{{""token"":""{ApiHelper.JwtToken}""}}');window.getDatas();");
} }
private void Button_Click(object sender, RoutedEventArgs e) private void Button_Click(object sender, RoutedEventArgs e)

4
客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/cats/Index.vue

@ -109,8 +109,8 @@
}, },
openKey(obj,key,id) openKey(obj,key,id)
{ {
obj.IsShowTBTime=false //obj.IsShowTBTime=false
hyCoreModel.openTabByKey(key,id,0) hyCoreModel.openTabByKey(key,id,this.currentTab)
}, },
getDatas() { getDatas() {
this.http.get('/HuiYan/cats/GetCatDatas').then(res => { this.http.get('/HuiYan/cats/GetCatDatas').then(res => {

2
客户端/齐越慧眼/齐越慧眼/vuepage/dist/js/app.js

File diff suppressed because one or more lines are too long

2
客户端/齐越慧眼/齐越慧眼/vuepage/dist/js/app.js.map

File diff suppressed because one or more lines are too long

2
客户端/齐越慧眼/齐越慧眼/齐越慧眼.csproj

@ -46,6 +46,7 @@
<None Remove="vuepage\dist\css\chunk-vendors.09af4a6b.css" /> <None Remove="vuepage\dist\css\chunk-vendors.09af4a6b.css" />
<None Remove="vuepage\dist\css\chunk-vendors.css" /> <None Remove="vuepage\dist\css\chunk-vendors.css" />
<None Remove="vuepage\dist\img\close.png" /> <None Remove="vuepage\dist\img\close.png" />
<None Remove="vuepage\dist\img\pop.png" />
<None Remove="vuepage\dist\img\true.png" /> <None Remove="vuepage\dist\img\true.png" />
<None Remove="vuepage\client\index.html" /> <None Remove="vuepage\client\index.html" />
<None Remove="vuepage\client\package.json" /> <None Remove="vuepage\client\package.json" />
@ -72,6 +73,7 @@
<EmbeddedResource Include="vuepage\dist\css\chunk-vendors.09af4a6b.css" /> <EmbeddedResource Include="vuepage\dist\css\chunk-vendors.09af4a6b.css" />
<EmbeddedResource Include="vuepage\dist\css\chunk-vendors.css" /> <EmbeddedResource Include="vuepage\dist\css\chunk-vendors.css" />
<EmbeddedResource Include="vuepage\dist\img\close.png" /> <EmbeddedResource Include="vuepage\dist\img\close.png" />
<EmbeddedResource Include="vuepage\dist\img\pop.png" />
<EmbeddedResource Include="vuepage\dist\img\true.png" /> <EmbeddedResource Include="vuepage\dist\img\true.png" />
</ItemGroup> </ItemGroup>

Loading…
Cancel
Save