From 9c31ab66612240fd1846f9cf0c04bfb64a72809b Mon Sep 17 00:00:00 2001 From: yubao Date: Thu, 15 Mar 2018 23:38:14 +0800 Subject: [PATCH] routine updata --- OpenAuth.Mvc/Views/FlowSchemes/Index.cshtml | 9 +- .../css/modules/laydate/default/laydate.css | 2 - OpenAuth.Mvc/userJs/flowSchemes.js | 98 ++++++++++++++++--- OpenAuth.Mvc/userJs/forms.js | 2 +- OpenAuth.Repository/Domain/Form.cs | 2 +- 5 files changed, 93 insertions(+), 20 deletions(-) delete mode 100644 OpenAuth.Mvc/obj/Release/Package/PackageTmp/layui/css/modules/laydate/default/laydate.css diff --git a/OpenAuth.Mvc/Views/FlowSchemes/Index.cshtml b/OpenAuth.Mvc/Views/FlowSchemes/Index.cshtml index 40ed31e6..581afdd0 100644 --- a/OpenAuth.Mvc/Views/FlowSchemes/Index.cshtml +++ b/OpenAuth.Mvc/Views/FlowSchemes/Index.cshtml @@ -44,11 +44,12 @@
- +
@@ -94,6 +95,12 @@
+ +
+
    +
    +
    +
    diff --git a/OpenAuth.Mvc/obj/Release/Package/PackageTmp/layui/css/modules/laydate/default/laydate.css b/OpenAuth.Mvc/obj/Release/Package/PackageTmp/layui/css/modules/laydate/default/laydate.css deleted file mode 100644 index fef46e3a..00000000 --- a/OpenAuth.Mvc/obj/Release/Package/PackageTmp/layui/css/modules/laydate/default/laydate.css +++ /dev/null @@ -1,2 +0,0 @@ -/** layui-v2.1.5 MIT License By http://www.layui.com */ - .laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file diff --git a/OpenAuth.Mvc/userJs/flowSchemes.js b/OpenAuth.Mvc/userJs/flowSchemes.js index a39267aa..59c30048 100644 --- a/OpenAuth.Mvc/userJs/flowSchemes.js +++ b/OpenAuth.Mvc/userJs/flowSchemes.js @@ -14,9 +14,9 @@ }); layui.droptree("/UserSession/GetOrgs", "#Organizations", "#OrganizationIds"); - + //主列表加载,可反复调用进行刷新 - var config= {}; //table的参数,如搜索key,点击tree的id + var config = {}; //table的参数,如搜索key,点击tree的id var mainList = function (options) { if (options != undefined) { $.extend(config, options); @@ -66,6 +66,72 @@ } }(); + var vm = new Vue({ + el: "#formEdit" + }); + + //表单选择 + var frmTree = function () { + var zTreeObj; + var setting = { + view: { selectedMulti: true }, + check: { + enable: true, + chkStyle: "checkbox", + chkboxType: { "Y": "", "N": "" } //去掉勾选时级联 + }, + data: { + key: { + name: 'Name', + title: 'Name' + }, + simpleData: { + enable: true, + idKey: 'Id', + pIdKey: 'ParentId', + rootPId: 'null' + } + }, + callback: { + onClick: function (event, treeId, treeNode) { + var id = treeNode.Id; + $.get("/forms/previewdata?id=" + id, function (data) { + $("#frmPreview").html(data); + }); + }, + onCheck: function (event, treeId, treeNode) { + $("#FrmId").val(treeNode.Id); + } + } + }; + + var load = function () { + var url = '/forms/load'; + $.getJSON(url, function (json) { + zTreeObj = $.fn.zTree.init($("#frmTree"), setting); + zTreeObj.addNodes(null, json.data); + + $("#menutree").html("点击预览表单效果"); + zTreeObj.expandAll(true); + }); + }; + + var setCheck = function (id) { //设置已经选中的表单 + if (id == null | id == '') return; + var node = zTreeObj.getNodeByParam("Id", id, null); + zTreeObj.checkNode(node, true, false); + + $.get("/forms/previewdata?id=" + id, function (data) { + $("#frmPreview").html(data); + }); + } + + return { + load: load, + setCheck: setCheck + } + }(); + /*=========流程设计(begin)======================*/ var flowDesignPanel = $('#flowPanel').flowdesign({ height: 500, @@ -104,29 +170,31 @@ /*=========流程设计(end)=====================*/ //添加(编辑)对话框 - var editDlg = function() { - var vm = new Vue({ - el: "#formEdit" - }); + var editDlg = function () { + var update = false; //是否为更新 var show = function (data) { var title = update ? "编辑信息" : "添加"; + + frmTree.load(); + layer.open({ title: title, area: ["800px", "600px"], type: 1, content: $('#divEdit'), - success: function() { + success: function () { vm.$set('$data', data); if (update) { flowDesignPanel.loadData(JSON.parse(data.SchemeContent)); + frmTree.setCheck(data.FrmId); } }, end: mainList }); var url = "/FlowSchemes/Add"; if (update) { - url = "/FlowSchemes/Update"; + url = "/FlowSchemes/Update"; } //提交数据 form.on('submit(formSubmit)', @@ -136,10 +204,10 @@ SchemeContent: JSON.stringify(content) } - $.extend(data.field,schemecontent); + $.extend(data.field, schemecontent); $.post(url, data.field, - function(data) { + function (data) { layer.msg(data.Message); }, "json"); @@ -147,25 +215,25 @@ }); } return { - add: function() { //弹出添加 + add: function () { //弹出添加 update = false; show({ Id: '' }); }, - update: function(data) { //弹出编辑框 + update: function (data) { //弹出编辑框 update = true; show(data); } }; }(); - + //监听表格内部按钮 table.on('tool(list)', function (obj) { var data = obj.data; if (obj.event === 'detail') { //查看 layer.msg('ID:' + data.Id + ' 的查看操作'); - } + } }); //监听页面主按钮操作 @@ -193,7 +261,7 @@ , search: function () { //搜索 mainList({ key: $('#key').val() }); } - , btnRefresh: function() { + , btnRefresh: function () { mainList(); } }; diff --git a/OpenAuth.Mvc/userJs/forms.js b/OpenAuth.Mvc/userJs/forms.js index 7d188709..926c5eb8 100644 --- a/OpenAuth.Mvc/userJs/forms.js +++ b/OpenAuth.Mvc/userJs/forms.js @@ -219,7 +219,7 @@ return false; } else { - alert('表单内容不能为空!') + layer.msg('表单内容不能为空!'); $('#submitbtn').button('reset'); return false; } diff --git a/OpenAuth.Repository/Domain/Form.cs b/OpenAuth.Repository/Domain/Form.cs index 0311354f..e551f540 100644 --- a/OpenAuth.Repository/Domain/Form.cs +++ b/OpenAuth.Repository/Domain/Form.cs @@ -55,7 +55,7 @@ namespace OpenAuth.Repository.Domain /// public string ContentParse { get; set; } /// - /// 表单原html模板未经处理的 + /// 表单原html模板未经处理的,仅仅用作编辑修改 /// public string Content { get; set; } ///