123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372 |
-
- //原型记录
- var Params = {
- pageNumber: 1,
- pageSize: 999,
- 类型: 1,
- 状态: -1,
- 名称:"",
- 分类ID: "",
- 是否所有分类: "",
- 分类名称: ""
- };
- var viewModel = function () {
- //初始化表格
- this.init = function () {
- $("#tree").tree({
- lines: true,
- animate: true,
- method: "post",
- idField: 'id',
- treeField: 'text',
- queryParams: { "类型":Params.类型 },
- url: '/MedicalRecordManager/GetCategory',
- onSelect: eventData.TreeNodeClick,
- onDblClick: function (node) {
- //双击收起或展开
- $(this).tree("collapse", node.target);
- },
- onClick: function (node) {
- Params.分类ID = node.id;
- Params.分类名称 = node.text;
- Params.是否所有分类 = Params.分类ID;//记录选中分类
- $('#grid').datagrid('reload', Params);
- },
- onLoadSuccess: function (node, data) {
- if (node) {
- //加载某个节点
- if (curOrg && curOrg.id) {
- $("#tree").tree("select", $("#tree").tree("find", curOrg.id).target);
- }
- } else {
- //初始化加载
- //展开第一个根节点
- var roots = $(this).tree("getRoots");
- if (roots.length > 0) {
- $(this).tree("expand", roots[0].target);
- //找到第一个元素
- var n = $('#tree').tree('find', data[0].id);
- //调用选中事件
- $('#tree').tree('select', n.target);
- Params.分类ID = data[0].id;
- Params.分类名称 = data[0].text;
- List.loadGrid();
- }
- else {
- Params.分类ID = "";
- Params.分类名称 = "";
- List.loadGrid();
- }
- }
- },
- onBeforeLoad: function (node, param) {
- if (node)
- return false;
- },
- loadFilter: function (data, parent) {
- //无数据则显示为叶子节点
- if (parent && data.length == 0) {
- var node = $(this).tree("getSelected");
- if (node) {
- $(this).tree("update", {
- target: node.target,
- state: "open",
- iconCls: "tree-file"
- });
- }
- }
- if (data) {
- return eval(data);
- }
- }
- });
- //类型
- $("#LX").combobox({
- data: [{ ID: "1", MC: "个人" }, { ID: "2", MC: "渠道" }, { ID: "3", MC: "总部" }],
- valueField: "ID",
- textField: "MC",
- onSelect: function (data) {
- Params.类型 = data.ID;
- $('#tree').tree("options").queryParams = { "类型": Params.类型 };
- $('#tree').tree('reload');
-
- if (Params.类型 == 3) {//
-
- $("#btnSH").attr("style", "");//审核显示
- $("#btnQX").attr("style", "");
- $("#btnQY").attr("style", "display:none;");
- $("#btnTY").attr("style", "display:none;");//启用隐藏
-
- }
- else {
- $("#btnQY").attr("style", "");//启用显示
- $("#btnTY").attr("style", "");
- $("#btnSH").attr("style", "display:none;");//审核隐藏
- $("#btnQX").attr("style", "display:none;");
- }
-
-
- },
- onLoadSuccess: function () {
- var data = $(this).combobox('getData')[0];
- if (data) {
- var vf = $(this).combobox('options').valueField;
- $('#LX').combobox('setValue', data.MC);
- }
- if (Params.类型 == 3) {//
- $("#btnSH").attr("style", "");//审核显示
- $("#btnQX").attr("style", "");
- $("#btnQY").attr("style", "display:none;");
- $("#btnTY").attr("style", "display:none;");//启用隐藏
- }
- else {
- $("#btnQY").attr("style", "");//启用显示
- $("#btnTY").attr("style", "");
- $("#btnSH").attr("style", "display:none;");//审核隐藏
- $("#btnQX").attr("style", "display:none;");
- }
- }
- });
- //性质
- $("#XZ").combobox({
- url: '/MedicalRecordManager/SelectNature?ID=ACA9B395-0B88-412A-89F0-91FEF1D7D27C',
- valueField: "ID",
- textField: "名称",
- onSelect: function (data) {
- Params.性质 = data.ID;
- $('#grid').datagrid('reload', Params);
- }
- });
- //状态
- $("#ZT").combobox({
- data: [{ ID: "-1", MC: "全部" },{ ID: "0", MC: "停用" }, { ID: "1", MC: "启用" }],
- valueField: "ID",
- textField: "MC",
- onSelect: function (data) {
- Params.状态 = data.ID;
- $('#grid').datagrid('reload', Params);
- },
- onLoadSuccess: function () {
- var data = $(this).combobox('getData')[0];
- if (data) {
- var vf = $(this).combobox('options').valueField;
- $('#ZT').combobox('setValue', data.MC);
- }
-
- }
- });
- //分类增加
- $('#btn-add').click(function () {
- top.ZLPMS.OpenNewWindow("新增分类", "/MedicalRecordManager/AddClass?id=&type=1&lx=" + Params.类型, "600px", "300px", function (callback) {
- $('#tree').tree('reload');
- }, function (endcallback) {
-
- })
- });
- //添加评论
- $('#AddComment').click(function () {
- var row = $('#grid').datagrid('getSelected');
- if (!row) {
- top.ZLPMS.Msg("请选择列");
- return;
- }
- top.ZLPMS.OpenNewWindow("新增评论", "/MedicalRecordManager/AddComment?id=" + row.ID, "600px", "300px", function (callback) {
- DealProcess(row.ID);
- }, function (endcallback) {
- })
- });
-
- //分类编辑
- $('#btn-edit').click(function () {
- if (Params.分类名称 != null) {
- top.ZLPMS.OpenNewWindow("修改分类", encodeURI("/MedicalRecordManager/AddClass?id=" + Params.分类ID + "&type=2&name=" + Params.分类名称 + "&lx=" + Params.类型), "600px", "300px", function (callback) {
- $('#tree').tree('reload');
- })
- } else {
- top.ZLPMS.Msg("请选择一行记录后执行操作", 0);
- }
- });
- //分类刷新
- $('#btn-ref').click(function () {
- $('#tree').tree('reload');
- });
- //分类删除
- $('#btn-del').click(function () {
- $.post("/MedicalRecordManager/DelCategory", { ID: Params.分类ID}, function (data) {
- top.ZLPMS.Msg(data.msg);
- $('#tree').tree('reload');
- })
- });
- /*原型记录*/
- //查询
- $('#btnSelect').click(function () {
-
- Params.名称 = $('#KsCx').textbox('getValue');
-
- Params.分类ID = $("#terminissues").checkbox('options').checked == true ? '' : Params.是否所有分类
- $('#grid').datagrid('reload');
- });
-
- }
- }
- //更新状态
- function UpdateState(type, state) {
- var row = $('#grid').datagrid('getSelected');
- if (!row) {
- top.ZLPMS.Msg("请选择列");
- return;
- }
- $.ajax({
- url: '/MedicalRecordManager/UpdateSate?type=' + type + "&id=" + row.ID + "&state=" + state,
- method: 'post',
- success: function (data) {
- if (data.code == 200) {
- top.ZLPMS.Msg(data.msg);
- $('#grid').datagrid('reload');
- } else {
- ZLPMS.Msg(data.msg, 2);
- }
- }
- })
- };
- ///获取评价过程
- function DealProcess(ID) {
- /* ID ='eecac372-cc3e-482b-b71f-8d49ce15136c'*/
- var url = "/MedicalRecordManager/GetProcessRecords?ID=" + ID;
- $.post(url, {}, function (data) {
- $("#timeLine").empty();
- $.each(data, function (idx, json) {
- if (json != undefined) {
- var attfile = "";
- if (json.附件 != undefined) {
- attfile = "<i class='fa fa-paperclip' style='color:blue' title='包含过程附件'></i>";
- }
- json.评论内容 = json.评论内容 != undefined ? json.评论内容 : "无";
- if (json.评论内容 != "无") {
- var arrEntities = {
- 'lt': '<',
- 'gt': '>',
- 'nbsp': ' ',
- 'amp': '&',
- 'quot': '"'
- };
- json.评论内容 = json.评论内容.replace(/<[^>]+>/g, "").replace(/&(lt|gt|nbsp|amp|quot);/ig, function (all, t) {
- return arrEntities[t]
- });
- if (json.评论内容.length == 0) {
- json.评论内容 = "内有图片,点击该过程即可查看";
- }
- }
- if (json.评论内容.length > 25) {
- json.评论内容 = json.评论内容.substring(0, 25) + "...";
- }
- var html = "<li onclick='viewProcess(\"" + json.ID + "\")' class='layui-timeline-item timelineDetail'><i class='layui-icon layui-timeline-axis'></i><div class='layui-timeline-content layui-text'><h3 class='layui-timeline-title'><a href='#' ></a> " + attfile + "</h3><p>" + json.评论日期 + "<br> <strong>" + json.评论人 + "</strong><br>" + "评论:" + (json.评论内容) + "</p></div></li>";
- $("#timeLine").append(html);
- }
- });
- });
- };
- function viewData(ID) {
- top.ZLPMS.OpenNewWindow("原型预览", "/MedicalRecordManager/Preview?id=" + ID, "80%", "90%", function (callback) {
- }, function (endcallback) {
- })
- }
- //列表操作
- var List = {
- //重新加载
- loadGrid: function () {
- $("#grid").datagrid({
- fit: true,
- width: '100%',
- toolbar: '#toolbar',
- pageSize: 20,
- pageList: [10, 20, 30, 40, 50, 1000],
- rownumbers: true,
- pagination: true,
- border: true,
- remoteSort: true,
- singleSelect: true, //单行选择
- queryParams: Params,
- loadMsg: "正在查询数据,请稍候...",
- url: '/MedicalRecordManager/PrototypeRecordSelect',
- method: "post",
- columns: [[
- { field: 'ID', title: 'ID', width: 20, align: 'center', fixed: true, hidden: true },
- { field: 'FLID', title: '分类id', width: 20, align: 'center', fixed: true, hidden: true },
- { field: '原型预览地址', title: '原型预览地址', width: 20, align: 'center', fixed: true, hidden: true },
- { field: '序号', title: '序号', align: 'left', fixed: true, width: 40 },
- { field: '性质', title: '性质', align: 'left', fixed: true, width: 150 },
- {
- field: '名称', title: '名称', align: 'left', fixed: true, width: 200, formatter: function (value, rowData, index) {
- return '<a onclick=viewData("' + rowData.ID + '") href="#"> <span style=color:green; >' + rowData.名称 + '</span></a>';
- } },
- {
- field: '登记日期', title: '上传时间', width: 135, align: 'center', fixed: true,
- },
- { field: '登记人', title: '上传人', align: 'left', fixed: true, width: 120 },
- {
- field: '审核日期', title: '审核日期', width: 135, align: 'center', fixed: true,
- },
- { field: '审核人', title: '审核人', align: 'left', fixed: true, width: 120 },
-
- { field: '下载次数', title: '下载次数', align: 'left', fixed: true, width: 60 },
- {
- field: '最后下载日期', title: '最后下载日期', width: 135, align: 'center', fixed: true,
- },
- {
- field: '是否审核', title: '是否审核', align: 'left', fixed: true, width: 80,
- formatter: function (value, rowData, index) {
- return rowData.是否审核 == 1 ? '审核' : '未审核';
- }
- },
- {
- field: '状态', title: '状态', align: 'left', fixed: true, width: 80,
- formatter: function (value, rowData, index) {
- return rowData.状态 == 1 ? '正常' : '停用';
- }
- },
- ]],
- rowStyler: function (index, row) {
- },
- onDblClickRow: function (rowIndex, rowData) {
- },
- onSelect: function (rowIndex, rowData) {
- DealProcess(rowData["ID"]);
- }
- });
- },
- }
- //树形操作
- var eventData = {
- //树节点单击事件
- TreeNodeClick: function (node) {
- //console.log(node);
- }
- }
|