Commit 9d40991c by jianshuqin

新增功能:平台交易流水增加"存货破损"

parent d0bd4327
...@@ -34,7 +34,7 @@ namespace Bailun.DC.Services ...@@ -34,7 +34,7 @@ namespace Bailun.DC.Services
obj = cn.Query<dc_menu>(sql, null, null, true, 2 * 60).Distinct().ToList(); obj = cn.Query<dc_menu>(sql, null, null, true, 2 * 60).Distinct().ToList();
} }
foreach (var item in obj.Where(a=>a.parentid==0)) foreach (var item in obj.Where(a => a.parentid == 0))
{ {
GetChildrens(item, obj); GetChildrens(item, obj);
list.Add(item); list.Add(item);
...@@ -68,10 +68,10 @@ namespace Bailun.DC.Services ...@@ -68,10 +68,10 @@ namespace Bailun.DC.Services
} }
var sql = $@"select DISTINCT * from (select t1.id,t1.parentid,t1.icon,t1.`name`,t1.path,t1.sort from dc_menu t1 var sql = $@"select DISTINCT * from (select t1.id,t1.parentid,t1.icon,t1.`name`,t1.path,t1.sort from dc_menu t1
join dc_menu_permission t2 on t1.id=t2.menuid and t2.delstatus=0 and t2.role_id in ({string.Join(",",objRoles.Select(a=>a.role_id))}) join dc_menu_permission t2 on t1.id=t2.menuid and t2.delstatus=0 and t2.role_id in ({string.Join(",", objRoles.Select(a => a.role_id))})
where t1.delstatus=0 where t1.delstatus=0 AND t1.is_develop = 0
union all union all
select t1.id,t1.parentid,t1.icon,t1.`name`,t1.path,t1.sort from dc_menu t1 where t1.delstatus=0 and 1 = (select isall from dc_menu_permission where role_id in ({string.Join(",", objRoles.Select(a => a.role_id))}) and isall=1 and delstatus=0 order by isall desc limit 1)) tb order by parentid,sort"; select t1.id,t1.parentid,t1.icon,t1.`name`,t1.path,t1.sort from dc_menu t1 where t1.delstatus=0 {(objRoles.Select(a => a.role_id).Contains(37) ? string.Empty : "AND t1.is_develop = 0")} and 1 = (select isall from dc_menu_permission where role_id in ({string.Join(",", objRoles.Select(a => a.role_id))}) and isall=1 and delstatus=0 order by isall desc limit 1)) tb order by parentid,sort";
obj = cn.Query<dc_menu>(sql, null, null, true, 2 * 60).ToList(); obj = cn.Query<dc_menu>(sql, null, null, true, 2 * 60).ToList();
...@@ -149,7 +149,7 @@ namespace Bailun.DC.Services ...@@ -149,7 +149,7 @@ namespace Bailun.DC.Services
cn.Open(); cn.Open();
} }
var obj = cn.Query<dc_menu_permission>("select * from dc_menu_permission where delstatus=0 and role_id="+roleid); var obj = cn.Query<dc_menu_permission>("select * from dc_menu_permission where delstatus=0 and role_id=" + roleid);
return obj.ToList(); return obj.ToList();
} }
...@@ -173,7 +173,7 @@ namespace Bailun.DC.Services ...@@ -173,7 +173,7 @@ namespace Bailun.DC.Services
return objRoles.ToList(); return objRoles.ToList();
} }
} }
#region Private #region Private
...@@ -184,7 +184,7 @@ namespace Bailun.DC.Services ...@@ -184,7 +184,7 @@ namespace Bailun.DC.Services
var childrens = list.Where(a => a.parentid == m.id); var childrens = list.Where(a => a.parentid == m.id);
if (childrens.Count() > 0) if (childrens.Count() > 0)
{ {
foreach(var item in childrens) foreach (var item in childrens)
{ {
GetChildrens(item, list); GetChildrens(item, list);
m.childrens.Add(item); m.childrens.Add(item);
...@@ -202,7 +202,7 @@ namespace Bailun.DC.Services ...@@ -202,7 +202,7 @@ namespace Bailun.DC.Services
/// <param name="parameter">分页信息</param> /// <param name="parameter">分页信息</param>
/// <param name="total">符合条件的记录数</param> /// <param name="total">符合条件的记录数</param>
/// <returns></returns> /// <returns></returns>
public List<Models.Menu.dc_user_role> ListUserRole(BtTableParameter parameter,string name,ref int total) public List<Models.Menu.dc_user_role> ListUserRole(BtTableParameter parameter, string name, ref int total)
{ {
var sqlparam = new DynamicParameters(); var sqlparam = new DynamicParameters();
var sql = "select * from dc_user_role where delstatus=0 "; var sql = "select * from dc_user_role where delstatus=0 ";
...@@ -210,12 +210,12 @@ namespace Bailun.DC.Services ...@@ -210,12 +210,12 @@ namespace Bailun.DC.Services
if (!string.IsNullOrEmpty(name)) if (!string.IsNullOrEmpty(name))
{ {
sql += " and name like @name"; sql += " and name like @name";
sqlparam.Add("name", "%"+name+"%"); sqlparam.Add("name", "%" + name + "%");
} }
if (!string.IsNullOrWhiteSpace(parameter.sort)) if (!string.IsNullOrWhiteSpace(parameter.sort))
{ {
sql += " order by "+parameter.sort+" "+parameter.order; sql += " order by " + parameter.sort + " " + parameter.order;
} }
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
...@@ -225,7 +225,7 @@ namespace Bailun.DC.Services ...@@ -225,7 +225,7 @@ namespace Bailun.DC.Services
cn.Open(); cn.Open();
} }
var obj = cn.Page<dc_user_role>(parameter.pageIndex, parameter.limit, sql, ref total,sqlparam); var obj = cn.Page<dc_user_role>(parameter.pageIndex, parameter.limit, sql, ref total, sqlparam);
return obj.ToList(); return obj.ToList();
...@@ -256,7 +256,7 @@ namespace Bailun.DC.Services ...@@ -256,7 +256,7 @@ namespace Bailun.DC.Services
public Models.Menu.dc_user_role GetUserRole(int id) public Models.Menu.dc_user_role GetUserRole(int id)
{ {
var sql = "select * from dc_user_role where delstatus=0 and id="+id; var sql = "select * from dc_user_role where delstatus=0 and id=" + id;
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{ {
...@@ -277,7 +277,7 @@ namespace Bailun.DC.Services ...@@ -277,7 +277,7 @@ namespace Bailun.DC.Services
/// <param name="uid">当前用户id</param> /// <param name="uid">当前用户id</param>
/// <param name="username">当前用户名称</param> /// <param name="username">当前用户名称</param>
/// <returns></returns> /// <returns></returns>
public string SaveRole(Models.Menu.dc_user_role m,int uid,string username) public string SaveRole(Models.Menu.dc_user_role m, int uid, string username)
{ {
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{ {
...@@ -286,7 +286,8 @@ namespace Bailun.DC.Services ...@@ -286,7 +286,8 @@ namespace Bailun.DC.Services
cn.Open(); cn.Open();
} }
var o = new dc_user_role() { var o = new dc_user_role()
{
createtime = DateTime.Now, createtime = DateTime.Now,
createuserid = uid, createuserid = uid,
createusername = username, createusername = username,
...@@ -310,7 +311,7 @@ namespace Bailun.DC.Services ...@@ -310,7 +311,7 @@ namespace Bailun.DC.Services
}; };
} }
} }
o.name = m.name; o.name = m.name;
o.note = m.note; o.note = m.note;
...@@ -341,7 +342,7 @@ namespace Bailun.DC.Services ...@@ -341,7 +342,7 @@ namespace Bailun.DC.Services
/// <param name="uid"></param> /// <param name="uid"></param>
/// <param name="username"></param> /// <param name="username"></param>
/// <returns></returns> /// <returns></returns>
public string DelRole(int id,int uid,string username) public string DelRole(int id, int uid, string username)
{ {
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{ {
...@@ -377,11 +378,11 @@ namespace Bailun.DC.Services ...@@ -377,11 +378,11 @@ namespace Bailun.DC.Services
/// <param name="uid">当前用户id</param> /// <param name="uid">当前用户id</param>
/// <param name="username">当前用户名称</param> /// <param name="username">当前用户名称</param>
/// <returns></returns> /// <returns></returns>
public string SaveRoleUser(int roleid, int userid,string username, int current_uid, string current_username,ref int id) public string SaveRoleUser(int roleid, int userid, string username, int current_uid, string current_username, ref int id)
{ {
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{ {
if(cn.State== System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
cn.Open(); cn.Open();
} }
...@@ -421,9 +422,9 @@ namespace Bailun.DC.Services ...@@ -421,9 +422,9 @@ namespace Bailun.DC.Services
else else
{ {
var result = cn.Insert<dc_user_role_relation>(m); var result = cn.Insert<dc_user_role_relation>(m);
id = result??0; id = result ?? 0;
return (result??0) > 0 ? "" : "保存失败,请重试!"; return (result ?? 0) > 0 ? "" : "保存失败,请重试!";
} }
} }
} }
...@@ -435,16 +436,16 @@ namespace Bailun.DC.Services ...@@ -435,16 +436,16 @@ namespace Bailun.DC.Services
/// <param name="uid">当前用户id</param> /// <param name="uid">当前用户id</param>
/// <param name="username">当前用户名称</param> /// <param name="username">当前用户名称</param>
/// <returns></returns> /// <returns></returns>
public string DelRoleUser(int id,int uid,string username) public string DelRoleUser(int id, int uid, string username)
{ {
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{ {
if(cn.State== System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
cn.Open(); cn.Open();
} }
var m = cn.QueryFirstOrDefault<dc_user_role_relation>("select * from dc_user_role_relation where delstatus=0 and id="+id); var m = cn.QueryFirstOrDefault<dc_user_role_relation>("select * from dc_user_role_relation where delstatus=0 and id=" + id);
if (m == null) if (m == null)
{ {
return "没有该数据,请重试!"; return "没有该数据,请重试!";
...@@ -455,7 +456,7 @@ namespace Bailun.DC.Services ...@@ -455,7 +456,7 @@ namespace Bailun.DC.Services
m.lastupdateusername = username; m.lastupdateusername = username;
m.delstatus = 1; m.delstatus = 1;
return cn.Update<dc_user_role_relation>(m)>0?"":"更新失败,请重试!"; return cn.Update<dc_user_role_relation>(m) > 0 ? "" : "更新失败,请重试!";
} }
} }
...@@ -488,7 +489,7 @@ namespace Bailun.DC.Services ...@@ -488,7 +489,7 @@ namespace Bailun.DC.Services
/// <param name="uid">当前用户id</param> /// <param name="uid">当前用户id</param>
/// <param name="username">当前用户名称</param> /// <param name="username">当前用户名称</param>
/// <returns></returns> /// <returns></returns>
public string SaveRoleMenus(int roleid, string s, int uid, string username,int isall=0) public string SaveRoleMenus(int roleid, string s, int uid, string username, int isall = 0)
{ {
try try
{ {
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
<option value="Fyndiq">Fyndiq</option> <option value="Fyndiq">Fyndiq</option>
<option value="Paypal">Paypal</option> <option value="Paypal">Paypal</option>
<option value="速卖通支付宝">支付宝</option> <option value="速卖通支付宝">支付宝</option>
<option value="存货报损">存货报损</option>
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
......
...@@ -20,12 +20,15 @@ ...@@ -20,12 +20,15 @@
value: { value: {
handler(val) { handler(val) {
if (this.item.type == 'number' && val == null) { if (this.item.type == 'number' && val == null) {
val = undefined val = undefined;
} }
if (this.item.type == 'select' && val && val.constructor == Number) { if (this.item.type == 'select' && val && val.constructor == Number) {
val = val.toString() val = val.toString();
} }
this.$set(this, "item_value", val) if (this.item.type == 'daterange' && val.constructor == Array && val.length > 1 && val[0].constructor == String && val[1].constructor == String) {
val = [new Date(val[0]), new Date(val[1])];
}
this.$set(this, "item_value", val);
}, },
deep: true, deep: true,
immediate: true immediate: true
......
...@@ -89,27 +89,25 @@ ...@@ -89,27 +89,25 @@
if (that.setting && that.setting.listFilterControl) { if (that.setting && that.setting.listFilterControl) {
that.setting.listFilterControl.forEach(function (l) { that.setting.listFilterControl.forEach(function (l) {
//是否默认值 //是否默认值
if (defaultValue) { if (defaultValue && l.defaultValue) {
//日期 //日期
if (l.type == "daterange" || l.type == "date" || l.type == "month") { if (l.type == "daterange" || l.type == "date" || l.type == "month") {
var date = new Date(); var date = new Date();
switch (l.defaultValue) { switch (l.defaultValue) {
case "new Date()": case "new Date()":
date = l.type == "daterange" ? [new Date().format("yyyy-MM-dd"), new Date().format("yyyy-MM-dd")] : date; date = l.type == "daterange" ? [new Date(), new Date()] : date;
break; break;
case "curr day()": case "curr day()":
date = [new Date(date.setDate(date.getDate() - date.getDay() + 1)).format("yyyy-MM-dd"), new Date(date.setDate(date.getDate() - date.getDay() + 7)).format("yyyy-MM-dd")]; date = [new Date(date.setDate(date.getDate() - date.getDay() + 1)), new Date(date.setDate(date.getDate() - date.getDay() + 7))];
break; break;
case "curr month()": case "curr month()":
date = [new Date(date.setDate(1)).format("yyyy-MM-dd"), new Date(date.setMonth(date.getMonth() + 1) - (24 * 60 * 60 * 1000)).format("yyyy-MM-dd")]; date = l.type == "daterange" ? [new Date(date.setDate(1)), new Date(date.setMonth(date.getMonth() + 1) - (24 * 60 * 60 * 1000))] : new Date(date.setDate(1));
break; break;
case "prev day()": case "prev day()":
date = [new Date(date.setDate(date.getDate() - date.getDay() + 1 - 7).format("yyyy-MM-dd")), new Date(date.setDate(date.getDate() - date.getDay() + 7)).format("yyyy-MM-dd")]; date = [new Date(date.setDate(date.getDate() - date.getDay() + 1 - 7)), new Date(date.setDate(date.getDate() - date.getDay() + 7))];
break; break;
case "prev month()": case "prev month()":
date = [new Date(new Date(date.setMonth(date.getMonth() - 1)).setDate(1)).format("yyyy-MM-dd"), new Date(new Date(date.setMonth(date.getMonth() + 1)).setDate(1) - (24 * 60 * 60 * 1000)).format("yyyy-MM-dd")] date = l.type == "daterange" ? [new Date(new Date(date.setMonth(date.getMonth() - 1)).setDate(1)), new Date(new Date(date.setMonth(date.getMonth() + 1)).setDate(1) - (24 * 60 * 60 * 1000))] : new Date(date.setMonth(date.getMonth() - 1));
break;
default:
break; break;
} }
Vue.set(l, "value", date); Vue.set(l, "value", date);
...@@ -120,9 +118,13 @@ ...@@ -120,9 +118,13 @@
if (l.value) { if (l.value) {
var filter = { field: l.prop }; var filter = { field: l.prop };
//日期区间 //日期区间
if (l.type == "daterange") { if (l.type == "daterange" && l.value.constructor == Array && l.value.length > 1) {
filter.operator = "between"; filter.operator = "between";
filter.value = l.value.join(","); if (l.value[0].constructor == Date && l.value[1].constructor == Date) {
filter.value = [l.value[0].format("yyyy-MM-dd"), l.value[1].format("yyyy-MM-dd")];
} else {
filter.value = l.value.join(",");
}
} }
//月 //月
else if (l.type == "month") { else if (l.type == "month") {
...@@ -143,7 +145,6 @@ ...@@ -143,7 +145,6 @@
else { else {
filter.operator = "="; filter.operator = "=";
filter.value = l.value; filter.value = l.value;
} }
that.filterParams.listFilter.push(filter); that.filterParams.listFilter.push(filter);
} }
...@@ -267,12 +268,6 @@ ...@@ -267,12 +268,6 @@
Vue.set(l, 'value', null); Vue.set(l, 'value', null);
}); });
} }
//还原过虑控件值
if (that.setting.listFilterControl && that.setting.listFilterControl.length) {
that.setting.listFilterControl.forEach(function (l) {
Vue.set(l, 'value', (l.defaultValue == 'new Date()' ? new Date() : l.defaultValue) || null);
});
}
} }
//清空排序 //清空排序
that.$refs.table.clearSort(); that.$refs.table.clearSort();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment