123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478 |
- /// <reference path="E:\ZLSoft\109-中联开发管理系统\ZLPMS\PMS.WebUI\Content/Scripts/zlpms.js" />
- function viewModel() {
- //初始化
- this.init = function () {
- $('#productInfo').datagrid({
- fit: true,
- toolbar: '#tb',
- rownumbers: true,
- pagination: false,
- singleSelect: true,
- border:false,
- columns: [[
- { field: '编码', title: '编码', width: 60, align: 'center' },
- { field: '名称', title: '名称', width: 200, align: 'left', halign: 'center' },
- {
- field: '状态', title: '启用', width: 40, align: 'center', styler: function (value, row, index) {
- }
- },
- { field: '负责人', title: '负责人', width: 80, align: 'center' },
- { field: '说明', title: '说明', width: 250, align: 'left', halign: 'center' }
- ]],
- onSelect: function (rowIndex, rowData) {
- Refresh("1");
- }
- });
- $('#productFunction').treegrid({
- idField: 'ID',
- treeField: '名称',
- method: 'GET',
- fit: true,
- toolbar: '#tb2',
- rownumbers: true,
- border: false,
- columns: [[
- { field: '编码', title: '编码', width: 60, align: 'center' },
- { field: '名称', title: '名称', width: 200 },
- { field: '类型', title: '类型', width: 150, align: 'center', halign: 'center' },
- { field: '开发方式', title: '开发方式', width: 80, align: 'center' },
- { field: '开发状态', title: '开发状态', width: 80, align: 'center' },
- { field: '研发人', title: '负责人', width: 80, align: 'center' },
- { field: '测试人NEW', title: '测试人', width: 80, align: 'center' },
- { field: '说明', title: '说明', width: 250, align: 'left', halign: 'center' }
- ]],
- onSelect: function (rowIndex, rowData) {
- }
- });
-
- //产品线按钮
- //增加
- $('#btn-add').click(function () {
- top.ZLPMS.OpenWindow({
- title: '新建产品线',
- url: '/Product/ProductInfoEdit',
- area: ['650px', '500px'],
- yes: function (index, layero) {
- Forms.Submit(index, layero);
- },
- });
- });
- //修改
- $('#btn-edit').click(function () {
- var Node = $('#productInfo').datagrid("getSelected");
- if (Node != null) {
- //打开编辑窗口
- top.ZLPMS.OpenWindow({
- title: '修改产品线',
- url: '/Product/ProductInfoEdit/' + Node["ID"],
- area: ['650px', '500px'],
- yes: function (index, layero) {
- Forms.Submit(index, layero);
- },
- });
- } else {
- top.ZLPMS.Msg("请选择一行记录后执行操作", 0);
- }
- });
- //删除
- $('#btn-del').click(function () {
- var Node = $('#productInfo').datagrid("getSelected");
- if (Node != null) {
- //确认删除对话框
- top.ZLPMS.Confirm('您确定要删除选择的记录吗?删除后不可还原,如果不使用建议禁用模块', 3, function () {
- //执行删除
- var url = '/Product/PostDelProduct';
- $.post(url, { "id": Node["ID"] }, function (data) {
- if (data.code == 200) {
- //刷新
- top.ZLPMS.Msg(data.msg);
- Refresh("0");
- } else {
- ZLPMS.Msg(data.msg, 2);
- }
- });
- });
- } else {
- top.ZLPMS.Msg("请选择一行记录后执行操作", 0);
- }
- });
- //刷新
- $('#btn-ref').click(function () {
- Refresh("0");
- });
- //产品功能按钮
- //新建
- $('#fbtn-add').click(function () {
- var Node = $('#productInfo').datagrid("getSelected");
- var Node2 = $('#productFunction').datagrid("getSelected");
- var url='/Product/ProductFunEdit?ProID=' + Node["ID"] ;
- if(Node2){
- url+='&ParentId=' + Node2["ID"];
- }
- if (Node != null) {
- top.ZLPMS.OpenWindow({
- title: '新建产品功能',
- url: url,
- area: ['650px', '500px'],
- yes: function (index, layero) {
-
- FunForms.Submit(index, layero);
- },
- });
- } else {
- top.ZLPMS.Msg("请选择一行产品线后执行操作", 0);
- }
- });
- //修改
- $('#fbtn-edit').click(function () {
- var Node = $('#productFunction').treegrid("getSelected");
- var Node2 = $('#productInfo').datagrid("getSelected");
- if (Node != null && Node2!=null) {
- //打开编辑窗口
- top.ZLPMS.OpenWindow({
- title: '修改产品功能',
- url: '/Product/ProductFunEdit/' + Node.ID + '?ProID=' + Node2["ID"],
- area: ['650px', '500px'],
- yes: function (index, layero) {
-
- FunForms.Submit(index, layero);
- },
- });
- } else {
- top.ZLPMS.Msg("请选择一行记录后执行操作", 0);
- }
- });
- //删除
- $('#fbtn-del').click(function () {
- var Node = $('#productFunction').datagrid("getSelected");
- if (Node != null) {
- //确认删除对话框
- top.ZLPMS.Confirm('您确定要删除选择的记录吗?删除后不可还原,如果不使用建议禁用模块', 3, function () {
- //执行删除
- var url = '/Product/PostDelProductFun';
- $.post(url, { "id": Node.ID }, function (data) {
- if (data.code == 200) {
- //刷新
- top.ZLPMS.Msg(data.msg);
- Refresh("1");
- } else {
- ZLPMS.Msg(data.msg, 2);
- }
- });
- });
- } else {
- top.ZLPMS.Msg("请选择一行记录后执行操作", 0);
- }
- });
- //刷新
- $('#fbtn-ref').click(function () {
- Refresh("1");
- });
-
- },
- //绑定数据(产品线)
- this.bindData = function (id) {
- this.id = id;
- //加载修改内容
- $.ajax({
- url: '/Product/GetProductInfo/' + id,
- method: 'GET',
- success: function (data) {
- if (data.code == 200) {
- $('#id').val(id);
- $('#Coding').textbox('setValue', data.obj[0].编码);
- $('#name').textbox('setValue', data.obj[0].名称);
- $('#remark').textbox('setValue', data.obj[0].说明);
- $('#PerInChargeID').combobox('setValue', data.obj[0].负责人ID);
- if (data.obj[0].产品流程状态 != null) {
- var array = data.obj[0].产品流程状态.split(",");
- for (var i = 0; i < array.length; i++) {
- var xz = array[i];
- /* $("'#item"+ xz + "'").prop("checked", true);*/
- $('#item' + xz).prop("checked", true)
- }
- }
- //设置值
- ZLPMS.SetFormVal('ff', { "isactive": data.obj[0].状态 == 1 ? true : false });
-
- } else {
- //弹出错误消息
- ZLPMS.Alert(data.msg, 1);
- }
- }
- })
- },
- this.loadmenus = function () {
- $('#PerInChargeID').combobox({
- url: '/PersonManager/GetPersonByJob?Nature=1&job=10',
- method: 'GET',
- valueField: 'ID',
- textField: '姓名',
- editable: true,
- onSelect: function (record) {
- $('#PerInCharge').val(record.姓名);
- }
- });
- //绑定清空事件
- $('#clear').click(function () {
- $('#PerInCharge').combobox('clear');
- });
- //绑定产品状态
- $.ajax({
- url: '/ProManager/SelectNature/?ID=DD2C3294-4FBB-4616-A046-07D3CAF52414',
- method: 'GET',
- async: false,
- success: function (data) {
- if (data!=null) {
- $("#ProductStatus").html("");//先清空在渲染否则还是之前的
- var select = $("#ProductStatus");
- for (var i = 0; i < data.length; i++) {
- var check;
- if (data[i].是否默认 == 1) {
- check = "checked";
- }
- else {
- check = "";
- }
- select.append("<input type=\"checkbox\" id=item" + data[i].代码 + " value=" + data[i].代码 +" name=\"ProductStatus\" title=\"" + data[i].名称 + "\" " + check +"\> ");
- }
- }
- }
- })
- },
- //绑定数据(产品功能)
- this.FunbindData = function (id) {
- this.id = id;
- //加载修改内容
- $.ajax({
- url: '/Product/GetProductFunInfo/' + id,
- method: 'GET',
- success: function (data) {
- if (data.code == 200) {
- $('#id').val(id);
- $('#parentid').combotree('setValue', data.obj[0].上级ID);
- $('#Coding').textbox('setValue', data.obj[0].编码);
- $('#name').textbox('setValue', data.obj[0].名称);
- $('#DevelopmentModeID').combobox('setValue', data.obj[0].开发方式);
- $('#DevelopmentStatusID').combobox('setValue', data.obj[0].状态);
- $('#remark').textbox('setValue', data.obj[0].说明);
- $('#ProType').combobox('setValue', data.obj[0].类型);
- $('#ResearchPerID').combobox('setValue', data.obj[0].研发人ID);
- if (data.obj[0].测试人IDNEW) {
- $('#TestPerID').combobox('setValues', data.obj[0].测试人IDNEW.split(','));
- }
-
-
- } else {
- //弹出错误消息
- ZLPMS.Alert(data.msg, 1);
- }
- }
- })
- },
- this.Funloadmenus = function (ProID, ParentId) {
- $('#parentid').combotree({
- url: '/Product/GetProdutFunTree?ProID=' + ProID,
- method: 'GET',
- editable: true,
- onLoadSuccess: function () {
- if (ParentId) {
- $('#parentid').combotree('setValue', ParentId);
- }
- }
- });
- $('#ProType').combobox({
- valueField: 'ID',
- textField: '名称',
- editable: false,
- data: [{
- ID: 0,
- 名称: '产品模块'
- }, {
- ID: 1,
- 名称: '产品功能'
- }],
- onLoadSuccess: function () {
- $('#ProType').combobox('setValue', 0);
- }
- });
- $('#DevelopmentModeID').combobox({
- url: '/Product/GetCodeCombobox?ClassificationID=00C5F8B0-8C61-46E5-9A82-67E6AAA912A9',
- valueField: '代码',
- textField: '显示名',
- editable: false,
- });
- $('#DevelopmentStatusID').combobox({
- url: '/Product/GetCodeCombobox?ClassificationID=FD59AB3D-1749-4C0E-A658-647071C04200',
- valueField: '代码',
- textField: '显示名',
- editable: false,
- });
- $('#ResearchPerID').combobox({
- url: '/PersonManager/GetPersonByJob?Nature=1',
- method: 'GET',
- valueField: 'ID',
- textField: '姓名',
- editable: true,
-
- onChange: function (NewValue, OldValue) {
-
-
- }
- });
- var job = '5,6';
- $('#TestPerID').combobox({
- url: '/PersonManager/GetPersonByJob?Nature=1',
- method: 'GET',
- valueField: 'ID',
- textField: '姓名',
- editable: true,
- limitToList:true,
- multiple: true,
- onChange: function (NewValue, OldValue) {
-
- }
- });
- }
- }
- function Refresh(_mode) {
- if (_mode == "0") {
- var search = $("#dtn-search").val();
- var Params = {
- Search: search,
- States: "1,0"
- }
- $('#productInfo').datagrid({
- url: '/Product/ProductInfoDataGrid',
- method: 'GET',
- queryParams: Params,
- onLoadSuccess: function () {
- }
- });
- }
- if (_mode == "1") {
- var search = $("#fdtn-search").val();
- var Node = $('#productInfo').datagrid("getSelected");
- $('#productFunction').treegrid("clearSelections");
- var Params = {
- ProductId: Node["ID"],
- Search: search,
- States: ""
- }
- $('#productFunction').treegrid({
- url: '/Product/productFunctionTree',
- method: 'GET',
- queryParams: Params,
- onLoadSuccess: function (data) {
- if (data == "") {
- var body = $(this).data().datagrid.dc.body2;
- body.find('table tbody').append('<tr><td width="' + body.width() + '" style="height: 35px; text-align: center;"><h1>暂无数据</h1></td></tr>');
- }
- }
- });
- }
- };
- //表单操作(产品线)
- var Forms = {
- //表单提交
- Submit: function (index, layero) {
- var iframeWin = ZLPMS.GetChildFrame(layero);//得到iframe页的窗口对象,执行iframe页的方法:
- var param = iframeWin.Forms.PostData();//调用子页面的方法,得到子页面返回的ids
- if (param != null) {
- var url = '/Product/PostSaveProduct';
- $.post(url, param, function (data) {
- if (data.code == 200) {
- top.ZLPMS.CloseWindow(index);
- top.ZLPMS.Msg(data.msg);
- //刷新
- Refresh("0");
- } else {
- ZLPMS.Msg(data.msg, 2);
- }
- });
- }
- },
- //加载数据
- Load: function (data) {
- $('#ff').form('load', data);
- },
- //读取数据
- PostData: function () {
- //执行提交验证
- var r = $('#ff').form('validate');
- if (r) {//post到后台
- var param = ZLPMS.FormToObject('ff');
-
- return param;
- }
- return null;
- }
- };
- //表单操作(产品功能)
- var FunForms = {
-
- //表单提交
- Submit: function (index, layero) {
- var iframeWin = ZLPMS.GetChildFrame(layero);//得到iframe页的窗口对象,执行iframe页的方法:
- var param = iframeWin.FunForms.PostData();//调用子页面的方法,得到子页面返回的ids
- if (param != null) {
- var url = '/Product/PostSaveProductFun';
- $.post(url, param, function (data) {
- if (data.code == 200) {
- top.ZLPMS.CloseWindow(index);
- top.ZLPMS.Msg(data.msg);
- //刷新
- Refresh("1");
- } else {
- ZLPMS.Msg(data.msg, 2);
- }
- });
- }
- },
- //加载数据
- Load: function (data) {
- $('#ff').form('load', data);
- },
- //读取数据
- PostData: function () {
- //执行提交验证
- var r = $('#ff').form('validate');
- if (r) {//post到后台
- var param = ZLPMS.FormToObject('ff');
- param.TestPerID = $('#TestPerID').combobox('getValues').join(",")
- param.ResearchPerID = $('#ResearchPerID').combobox('getValue');
- param.TestPer = $('#TestPerID').combobox('getText');
- param.ResearchPer = $('#ResearchPerID').combobox('getText');
- return param;
- }
- return null;
- }
- }
- //搜索框
- var doSearch={
- Product :function() {
- Refresh("0");
- },
- Funtion: function () {
- Refresh("1");
- }
- }
|