123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
-
- //智能表单
- var Params = {
- pageNumber: 1,
- pageSize: 999,
- FLID: 0,
- FLMC:""
- };
- var viewModel = function () {
-
- //初始化表格
- this.init = function () {
- $("#tree").tree({
- lines: true,
- animate: true,
- method: "get",
- idField: 'id',
- treeField: 'text',
- /* url: '/ViewModels/tree_data.json',*/
- url: '/SmartForm/GetCategory',
- onSelect: eventData.TreeNodeClick,
- onDblClick: function (node) {
- //双击收起或展开
- $(this).tree("collapse", node.target);
- },
- onClick: function (node) {
- Params.FLID = node.id;
- Params.FLMC = node.text;
-
- $('#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.FLID = data[0].id;
- Params.FLMC = data[0].text;
- 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);
- }
- }
- });
- //增加
- $('#btn-add').click(function () {
- top.ZLPMS.OpenNewWindow("新增分类", "/SmartForm/AddClass?id=&type=1", "600px", "300px", function (callback) {
- $('#tree').tree('reload');
- })
- });
- //编辑
- $('#btn-edit').click(function () {
- if (Params.FLMC != null) {
- top.ZLPMS.OpenNewWindow("修改分类", encodeURI("/SmartForm/AddClass?id=" + Params.FLID + "&type=2&name=" + Params.FLMC), "600px", "300px", function (callback) {
- $('#tree').tree('reload');
- })
- } else {
- top.ZLPMS.Msg("请选择一行记录后执行操作", 0);
- }
- });
- //刷新
- $('#btn-ref').click(function () {
- $('#tree').tree('reload');
- });
- /*表单增加*/
- //增加
- $('#fbtn-add').click(function () {
- top.ZLPMS.OpenNewWindow("新增表单", "/SmartForm/AddSmartForm?id=&type=1", "80%", "765px", function () {
- console.log("回调")
- })
- //top.ZLPMS.OpenWindow({
- // url: '/SmartForm/AddSmartForm',
- // title: '表单编辑',
- // btn: ['确定', '取消'],
- // area: ['80%', '765px'],
- // yes: function (index, layero) {
- // Forms.Submit(index, layero);
- // },
- //});
- });
- /*表单修改*/
- $('#fbtn-edit').click(function () {
- var row = $('#grid').datagrid('getSelected');
- if (!row) {
- top.ZLPMS.Msg("请选择列");
- return;
- }
- top.ZLPMS.OpenNewWindow("编辑表单", "/SmartForm/AddSmartForm?id=" + row.ID + "&type=2", "80%", "765px", function () {
- console.log("回调")
- })
- });
- //刷新表单
- $('#fbtn-ref').click(function () {
- $('#grid').datagrid('reload');
- });
- //复制表单
- $('#fbtn-copy').click(function () {
- var row = $('#grid').datagrid('getSelected');
- if (!row) {
- top.ZLPMS.Msg("请选择列");
- return;
- }
- $.ajax({
- url: '/SmartForm/CopySmartForm/' + row.ID,
- method: 'post',
- success: function (data) {
- if (data.code == 200) {
- top.ZLPMS.Msg(data.msg);
- $('#grid').datagrid('reload');
- } else {
- ZLPMS.Msg(data.msg, 2);
- }
- }
- })
-
- });
- //分享
- $('#fbtn-share').click(function () {
- var row = $('#grid').datagrid('getSelected');
- if (!row) {
- top.ZLPMS.Msg("请选择列");
- return;
- }
-
-
- let copy_text ="登录后请打开此地址填写信息《"+row.MC +"》https://zlpms.zlsoft.com:8078/MobileProblem/SelectProblemItem?id="+ row.ID;//拿到想要复制的值
- let input_dom = document.createElement('input');//创建input元素
- input_dom.value = copy_text;//添加需要复制的内容到value属性
- document.body.appendChild(input_dom);//向页面底部追加输入框
- input_dom.select();//选择input元素
- document.execCommand("Copy");//执行复制命令
- top.ZLPMS.Msg("地址已复制成功,使用CTRL+V进行粘贴");
-
- //复制之后再删除元素,否则无法成功赋值
- input_dom.remove();//删除动态创建的节点
-
- });
-
-
- }
-
- }
- //列表操作
- 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: '/SmartForm/BdxxSelectList',
- 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: 'MC', title: '表单名称', align: 'left', fixed: true, width: 150 },
- /* { field: 'TXTS', title: '填写提示', align: 'left', fixed: true, width: 200 },*/
- {
- field: 'TXXZ', title: '填写限制', align: 'left', fixed: true, width: 80,
- formatter: function (value, rowData, index) {
- return rowData.TXXZ == 0 ? '无限制' : '可填写' + rowData.TXXZ + '次';
- }
- },
- {
- field: 'CLMS', title: '处理模式', align: 'center', fixed: true, width: 80,
- formatter: function (value, rowData, index) {
- return rowData.CLMS == 0 ? '无需处理' : '需要处理';
- }
- },
- { field: 'TXHM', title: '提醒号码', align: 'left', fixed: true, width: 120 },
- { field: 'YJTS', title: '邮件推送', align: 'left', fixed: true, width: 120 },
- {
- field: 'JLSJ', title: '建立时间', width: 135, align: 'center', fixed: true,
- },
- { field: 'BZ', title: '备注', align: 'left', fixed: true, width: 300 },
- {
- field: 'ZT', title: '状态', align: 'left', fixed: true, width: 80,
- formatter: function (value, rowData, index) {
- return rowData.ZT == 0 ? '停用' : '启用';
- }
- },
- ]],
- rowStyler: function (index, row) {
- },
- onDblClickRow: function (rowIndex, rowData) {
- }
- });
-
-
- },
- //删除指定的模块菜单
- Del: function (id) {
- }
- }
- //树形操作
- var eventData = {
- //树节点单击事件
- TreeNodeClick: function (node) {
- //console.log(node);
-
- }
- }
|