diff --git a/dp2weixin.service/SearchBiblioResult.cs b/dp2weixin.service/SearchBiblioResult.cs index dfe7e450..85cf444b 100644 --- a/dp2weixin.service/SearchBiblioResult.cs +++ b/dp2weixin.service/SearchBiblioResult.cs @@ -44,6 +44,9 @@ public class BiblioDetailResult : ApiResult { public string biblioPath { get; set; } + // 书目记录时间戳 + public string Timestamp { get; set; } + public List itemList { get; set; } //public string biblioName { get; set; } diff --git a/dp2weixin.service/dp2WeiXinService.cs b/dp2weixin.service/dp2WeiXinService.cs index f8e0b214..3366baef 100644 --- a/dp2weixin.service/dp2WeiXinService.cs +++ b/dp2weixin.service/dp2WeiXinService.cs @@ -7700,6 +7700,7 @@ public BiblioDetailResult GetBiblioDetail(LoginInfo loginInfo, string strBiblioInfo = ""; string imgHtml = "";// 封面图像 string biblioInfo = ""; + string timestamp = ""; if (format == "summary") { nRet = this.GetSummaryAndImgHtml(lib, @@ -7732,6 +7733,7 @@ public BiblioDetailResult GetBiblioDetail(LoginInfo loginInfo, showCover, out strBiblioInfo, out imgHtml, + out timestamp, out strError); if (nRet == -1 || nRet == 0) { @@ -7777,13 +7779,11 @@ public BiblioDetailResult GetBiblioDetail(LoginInfo loginInfo, result.errorInfo = strError; return result; } + // 有好书推荐的权限 if (nHasRights == 1) { workerUserName = activeUser.userName; - } - if (workerUserName != "") - { string returnUrl = "/Biblio/Index"; if (from == "detail") returnUrl = "/Biblio/Detail?biblioPath=" + HttpUtility.UrlEncode(biblioPath); @@ -7795,22 +7795,23 @@ public BiblioDetailResult GetBiblioDetail(LoginInfo loginInfo, // + "&returnUrl=" + HttpUtility.UrlEncode(returnUrl); recommendBtn = ""; + } - // - - // todo 修改书目跳转的url + // 工作人员都出现编辑书目和删除书目的按钮 + { + // 修改书目跳转的url string biblioEditUrl = "/Biblio/BiblioEdit?biblioPath=" + HttpUtility.UrlEncode(biblioPath); recommendBtn += "  "; - + + " onclick=\"gotoUrl('" + biblioEditUrl + "')\">修改书目"; - // todo 删除书目 + // 删除书目 + string deletefun = "deleteBiblio('" + biblioPath + "','" + timestamp + "')"; recommendBtn += "  "; - + + " onclick=\"" + deletefun + "\">删除书目"; + } + if (string.IsNullOrEmpty(recommendBtn) ==false) recommendBtn = "
" + recommendBtn + "
"; - } } // 书目信息上方为 table+好书推荐按钮 @@ -7878,11 +7879,13 @@ private int GetTableAndImgHtml(LibEntity lib, bool showCover, out string table, out string coverImgHtml, + out string timestamp, //2022/10/17增加时间戳 out string strError) { strError = ""; table = ""; coverImgHtml = ""; + timestamp = ""; List dataList = null; int nRet = this.GetBiblioInfo(lib, @@ -7895,6 +7898,7 @@ private int GetTableAndImgHtml(LibEntity lib, return nRet; string xml = dataList[0]; + timestamp = dataList[1];//2022/10/17取出时间戳 XmlDocument dom = new XmlDocument(); try { @@ -8640,6 +8644,7 @@ public int SetBiblio(string loginUserName, int nRet = 0; outputBiblioPath = ""; outputTimestamp = ""; + string style = ""; //删除记录时,传whenChildEmpty // 调dp2接口时,使用的dp2帐户 LoginInfo loginInfo = GetLoginInfo(loginUserName, loginUserType);// new LoginInfo(loginUserName, false); @@ -8705,7 +8710,8 @@ 1010 ǂachi } else if (biblio.Action == C_Action_delete) { - // todo + // 书目没有下级记录时,才可以删除。 + style = "whenChildEmpty"; } else { @@ -8741,6 +8747,7 @@ public class Record // 本接口目前仅支持处理一条记录 Entity entity = new Entity(); entity.Action = biblio.Action; + entity.Style = style; //新记录 Record newRecord = new Record(); @@ -8773,10 +8780,11 @@ public class Record entities); try { + string connName = C_ConnPrefix_Myself + libId; //":"; // 连接 MessageConnection connection = this._channels.GetConnectionTaskAsync( this._dp2MServerUrl, - "").Result; + connName).Result; //注意这里connName传的标记表示使用本图书馆的weixin_xxx帐户,这样在配置权限时,把setbiblio权限配置在weixin_xxx。 //发起请求 SetInfoResult result = connection.SetInfoTaskAsync( lib.capoUserName, @@ -8785,7 +8793,7 @@ public class Record cancel_token).Result; if (result.Value == -1) { - strError = "图书馆 " + lib.libName + " 的保存书目出错:" + result.ErrorInfo; + strError = "为图书馆'" + lib.libName + "'设置书目出错:" + result.ErrorInfo; return -1; } diff --git a/dp2weixinP2P/Scripts/weixin.js b/dp2weixinP2P/Scripts/weixin.js index ea8be41c..06fdb2fd 100644 --- a/dp2weixinP2P/Scripts/weixin.js +++ b/dp2weixinP2P/Scripts/weixin.js @@ -371,7 +371,7 @@ function getDetail(libId, recPath, obj, from,biblioName) { itemTables += "" + "" //+ "" - + "" + + "" +" " + ""; } @@ -414,6 +414,80 @@ function getDetail(libId, recPath, obj, from,biblioName) { //return ""; } +//删除书目 +function deleteBiblio(biblioPath, biblioTimestamp) { + + var gnl = confirm("您确认要删除书目[" + biblioPath + "]吗?"); + if (gnl == false) { + return false; + } + + //alert("1"); + // 图书馆 + var libId = getLibId();//$("#selLib").val(); + if (libId == "" || libId == null) { + alert("您尚未选择图书馆。"); + return; + } + + var weixinId = $("#weixinId").text(); + if (weixinId == null || weixinId == "") { + alert("weixinId参数为空"); + return; + } + + // 时间戳不能为空 + if (biblioTimestamp == null || biblioTimestamp == "") { + alert("删除书目时timestamp参数不能为空"); + return; + } + + // biblio path不能为空 + if (biblioPath == null || biblioPath == "") { + alert("书目路径不能为空"); + return; + } + + // 登录帐户和类型 + var loginUserName = getLoginUserName(); + var loginUserType = getLoginUserType(); + + // web api + var url = "/api2/BiblioApi/SetBiblio?loginUserName=" + encodeURIComponent(loginUserName) + + "&loginUserType=" + loginUserType + + "&weixinId=" + weixinId + + "&libId=" + libId + + //alert(url); + sendAjaxRequest(url, "POST", + function (result) { + // 关闭等待层 + hideMaskLayer(); + + + if (result.errorCode == -1) { + alert(result.errorInfo); + return; + } + + alert("删除书目成功。"); + + }, + function (xhq, textStatus, errorThrown) { + // 关闭等待层 + hideMaskLayer(); + alert(errorThrown); + }, + { + BiblioPath: biblioPath, + Action: "delete", + Fields: "", + Timestamp: biblioTimestamp + } + ); + +} + //预约 function reservation(obj, barcode, style) { //alert("走到reservation()"); diff --git a/dp2weixinP2P/Views/Biblio/Detail.cshtml b/dp2weixinP2P/Views/Biblio/Detail.cshtml index 723a98a8..d5846314 100644 --- a/dp2weixinP2P/Views/Biblio/Detail.cshtml +++ b/dp2weixinP2P/Views/Biblio/Detail.cshtml @@ -146,7 +146,7 @@ function loadJs(sid, jsurl, callback) { var biblioName = $("#_biblioName").text(); if (biblioName != null && biblioName != "") { - expand("d1", 1); + expand("d1", 0); //2022/10/17 修改:当新增册的情况也让书目展开,与从册编辑界面查看详情进入保持一致的状态。 } } }); @@ -450,7 +450,7 @@ else
- +
} diff --git a/dp2weixinP2P/Views/Biblio/Index.cshtml b/dp2weixinP2P/Views/Biblio/Index.cshtml index acad0a2f..5199ff13 100644 --- a/dp2weixinP2P/Views/Biblio/Index.cshtml +++ b/dp2weixinP2P/Views/Biblio/Index.cshtml @@ -739,8 +739,14 @@ function loadJs(sid, jsurl, callback) {
- (简单检索默认以"前方一致"匹配) 高级检索 -  新增书目 + (简单检索默认以"前方一致"匹配) 高级检索 + + + @if (ViewBag.Worker != null && ViewBag.Worker != "") + { + @Html.Raw(" 新增书目"); + } +
diff --git a/dp2weixinP2P/Views/Shared/_Layout.cshtml b/dp2weixinP2P/Views/Shared/_Layout.cshtml index a8634b0a..c1645d29 100644 --- a/dp2weixinP2P/Views/Shared/_Layout.cshtml +++ b/dp2weixinP2P/Views/Shared/_Layout.cshtml @@ -13,7 +13,7 @@ - + diff --git a/dp2weixinP2P/Views/Shared/_LayoutEmpty.cshtml b/dp2weixinP2P/Views/Shared/_LayoutEmpty.cshtml index 163b9de7..7ec8d729 100644 --- a/dp2weixinP2P/Views/Shared/_LayoutEmpty.cshtml +++ b/dp2weixinP2P/Views/Shared/_LayoutEmpty.cshtml @@ -13,7 +13,7 @@ - + diff --git a/dp2weixinP2P/Views/Shared/_LayoutManager.cshtml b/dp2weixinP2P/Views/Shared/_LayoutManager.cshtml index 96400e84..53b46be6 100644 --- a/dp2weixinP2P/Views/Shared/_LayoutManager.cshtml +++ b/dp2weixinP2P/Views/Shared/_LayoutManager.cshtml @@ -12,7 +12,7 @@ - + @RenderSection("style", required: false)