function viewModel(PersonProperty) {
var that = this
var PersonProperty = PersonProperty
this.init = function () {
$('#productVersionInfo').treegrid({
idField: 'ID',
treeField: '版本号',
fit: true,
toolbar: '#tb',
singleSelect: true,
border: false,
rownumbers: true,
columns: [[
{ field: '版本号', title: '版本号', width: 200, align: 'center' },
{ field: '类型', title: '类型', width: 100, align: 'center' },
{ field: '状态', title: '状态', width: 60, align: 'center', halign: 'center' }
//{ field: '申请人', title: '申请人', width: 100, align: 'center' },
//{ field: '申请日期', title: '申请日期', width: 150, align: 'center' },
//{ field: '计划日期', title: '计划日期', width: 150, align: 'center' },
//{ field: '发布日期', title: '发布日期', width: 150, align: 'center' },
// { field: '负责人', title: '负责人', width: 100, align: 'center' },
]],
onSelect: function (row) {
$("#VersionID").html(row.版本号);
$("#InCharge").html(row.负责人);
$("#Versiontype").html(row.类型);
$("#SealingDate").html(row.封版日期);
$("#PlanDate").html(row.计划日期);
$("#ReleaseDate").html(row.发布日期);
$("#Detail").html(row.版本概述);
$("#Attention").html(row.注意事项);
$("#Configuration").html(row.配置信息);
Refresh("1");
//初始化版本问题
that.InitVersionProblem();
},
onLoadSuccess(row, data) {
if (data) {
var rootNode = $('#productVersionInfo').treegrid("getRoot");
if (rootNode) {
$('#productVersionInfo').treegrid("select", rootNode['ID']);
}
}
}
});
//$("#QD").combobox({
// valueField: 'ID',
// textField: '名称',
// data: data.rows,
// onSelect: function (e) {
// $('#XM').combobox('clear');
// $('#XM').combobox('reload', '/ProManager/BingProData?ChannelID=' + e.ID + '&Search='); // reload list data using new URL
// Params.QDID = e.ID;
// },
//});
//项目
$("#XMID").combobox({
url: '/Problem/GetProjectByInfo',
valueField: 'ID',
textField: '名称',
limitToList: true,
});
$("#SLRID").combobox({
url: "/Problem/GetFKR",
valueField: 'ID',
textField: '姓名'
})
$("#Product").combobox({
url: '/Product/ProductInfoCombobox',
valueField: 'ID',
textField: '名称',
editable: false,
onLoadSuccess: function (data) {
$("#Product").combobox('setValue', data[0].ID);
},
onChange: function () {
Refresh("0");
}
});
//状态选择事件
$("input:radio[name='radio']").on('click', function () {
Refresh("0");
});
//增加
$('#btn-add').click(function () {
var productID = $("#Product").combobox('getValue');
top.ZLPMS.OpenWindow({
title: '新建产品版本',
url: '/Product/ProductVerInfoEdit?ProID=' + productID,
area: ['750px', '650px'],
yes: function (index, layero) {
Forms.Submit(index, layero);
},
});
});
//修改
$('#btn-edit').click(function () {
var Node = $('#productVersionInfo').treegrid("getSelected");
var productID = $("#Product").combobox('getValue');
if (Node != null) {
//打开编辑窗口
top.ZLPMS.OpenWindow({
title: '修改产品线',
url: '/Product/ProductVerInfoEdit/' + Node.ID + '?ProID=' + productID,
area: ['650px', '550px'],
yes: function (index, layero) {
Forms.Submit(index, layero);
},
});
} else {
top.ZLPMS.Msg("请选择一行记录后执行操作", 0);
}
});
//删除
$('#btn-del').click(function () {
var Node = $('#productVersionInfo').treegrid("getSelected");
if (Node != null) {
//确认删除对话框
top.ZLPMS.Confirm('您确定要删除选择的版本吗?删除后不可还原!', 3, function () {
//执行删除
var url = '/Product/PostDelProductVer';
$.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");
});
//版本问题检索
$('#btn-problemsearch').click(function () {
top.ZLPMS.OpenNewWindow("版本问题检索", "/Product/ProductProblemWindow", '880px', '600px', function () {
});
})
//增加
$('#fbtn-add').click(function () {
var Node = $('#productVersionInfo').treegrid("getSelected");
if (Node != null) {
//打开编辑窗口
top.ZLPMS.OpenNewWindow(
"产品版本附件上传",
"/Product/ProductVerFlieUpload/" + Node.ID,
'650px', '650px'
);
} else {
top.ZLPMS.Msg("请选择一行产品版本后执行操作", 0);
}
});
$('#fbtn-del').click(function () {
var Node = $('#VerisonFile').datagrid("getSelected");
if (Node != null) {
top.ZLPMS.Confirm('确定删除该附件吗?', 3, function (idx) {
var index = top.ZLPMS.Loading3(2);
$.post("/Product/DeleteProductVersionFile/" + Node.ID, function (res) {
top.ZLPMS.UnLoading(index);
if (res.code == 200) {
top.ZLPMS.Msg("删除成功");
$('#VerisonFile').datagrid("reload");
} else {
top.ZLPMS.Msg("删除失败", 0);
}
})
})
} else {
top.ZLPMS.Msg("请选择一行记录后执行操作", 0);
}
})
$('#fbtn-download').click(function () {
var Node = $('#VerisonFile').datagrid("getSelected");
if (Node != null) {
window.open('/MobileProblem/DownLoadVersionFile/' + Node["附件ID"] + "?flieVersionId=" + Node["ID"], '_blank')
} else {
top.ZLPMS.Msg("请选择一行记录后执行操作", 0);
}
})
},
//绑定数据(产品版本)
this.bindData = function (id) {
this.id = id;
//加载修改内容
$.ajax({
url: '/Product/GetProductVerInfo/' + id,
method: 'GET',
success: function (data) {
if (data.code == 200) {
$('#id').val(id);
$('#parentid').combotree('setValue', data.obj[0].主版本ID);
$('#VersionNumber').textbox('setValue', data.obj[0].版本号);
$('#VersionTypeID').combobox('setValue', data.obj[0].类型);
$('#VersionStatusID').combobox('setValue', data.obj[0].状态);
$('#ChargePersonID').combobox('setValue', data.obj[0].负责人ID);
$('#PlaintTime').datebox('setValue', data.obj[0].计划日期);
$('#ReleaseTime').datebox('setValue', data.obj[0].发布日期);
$('#ShroudingTime').datebox('setValue', data.obj[0].封版日期);
$('#VersionDetail').textbox('setValue', data.obj[0].版本概述);
$('#needingAttention').textbox('setValue', data.obj[0].注意事项);
$('#ConfigurationInformation').textbox('setValue', data.obj[0].配置信息);
} else {
//弹出错误消息
ZLPMS.Alert(data.msg, 1);
}
}
})
},
this.loadmenus = function (ProID) {
$('#parentid').combotree({
url: '/Product/GetProdutVersionTree?ProID=' + ProID,
method: 'GET'
});
$('#VersionTypeID').combobox({
url: '/Product/GetCodeCombobox?ClassificationID=F4A05E7C-634B-46D9-83BE-6A70FFBB1672',
valueField: '代码',
textField: '显示名',
editable: false,
});
$('#VersionStatusID').combobox({
valueField: 'ID',
textField: '名称',
editable: false,
data: [{
ID: '',
名称: '请选择版本状态'
}, {
ID: '1',
名称: '未发布'
}, {
ID: '5',
名称: '已发布'
}]
});
$('#ChargePersonID').combobox({
url: '/PersonManager/GetPersonByJob?Nature=1',
method: 'GET',
valueField: 'ID',
textField: '姓名',
editable: true,
onSelect: function (record) {
$('#ChargePerson').val(record.姓名);
}
});
},
this.InitVersionProblem = function () {
var version = $('#productVersionInfo').treegrid("getSelected").ID;
var product = $("#Product").combobox('getValue');
var search = $('#dtn-search-Problem').searchbox('getValue');
var XMID = $("#XMID").val();
if (XMID == undefined) {
XMID = "";
}
var AcceptedId = $("#SLRID").combobox('getValue');
//初始化版本问题列表
$("#VersionProblem").datagrid({
url: "/Problem/GetVersionProblem",
method: 'Get',
pagination: true,
singleSelect: true,
fit: true,
rownumbers: true,
toolbar: '#btn_promb',
queryParams: { ProductId: product, VersionId: version, SearchText: search, projectId: XMID, AcceptedId: AcceptedId },
columns: [[
{
field: '编号', title: '编号', sortable: true, width: 60, align: 'center', styler: function (val, row, index) {
if (row.是否紧急 == 1) {
return " font-weight: bold ; ";
}
}
},
{
field: '问题性质', title: '性质', width: 60, align: 'center', formatter: function (val, row, index) {
switch (val) {
case 1:
return "Bug";
case 2:
return "";
case 3:
return "需求";
case 4:
return "任务";
default:
break;
}
}
},
{
field: '问题标题', title: '【问题标题】', width: 300, halign: 'center', styler: function (val, row, index) {
if (row.是否紧急 == 1) {
return " font-weight: bold ; ";
}
}
},
{ field: '版本', title: '版本号', width: 150, align: 'center' },
{ field: '产品', title: '产品类型', width: 100, align: 'center' },
{ field: '模块', title: '产品模块', width: 100, align: 'center' },
{ field: '解决版本状态', title: '状态', width: 60, sortable: true, align: 'center' },
{ field: '受理人', title: '当前受理人', sortable: true, width: 60, align: 'center' },
{ field: '紧急补丁时间', title: '紧急补丁时间', sortable: true, width: 90, align: 'center' },
{ field: '说明', title: '说明', width: 300, align: 'center' },
{ field: '登记人', title: '登记人', width: 60, align: 'center' },
{ field: '登记日期', title: '登记日期', sortable: true, width: 140, align: 'center' },
{ field: '渠道', title: '分公司(渠道)', width: 100, align: 'center' },
{ field: '项目', title: '所在项目', width: 100, sortable: true, align: 'center' },
{ field: '机构', title: '医疗机构', width: 100, align: 'center' }
]],
onDblClickRow: function (rowIndex, rowData) {
that.checkproblem();
}
})
},
//查看问题弹窗
this.checkproblem = function () {
var that = this
var WT = $('#VersionProblem').datagrid("getSelected");
if (WT == null) {
top.ZLPMS.Msg("请选择一行数据!");
}
else {
top.ZLPMS.OpenNewWindow("查看问题", "/Problem/CheckProblemWindow/" + WT["ID"], '880px', '600px', function () {
that.DealProblem(1,1, WT["ID"]);
});
}
},
//处理问题
this.DealProblem = function (showAtt, IsSupport, ProblemId) {
var that = this
//是否为技术支持处理
IsSupport = IsSupport || 0;
//受理问题
var receiveProblem = function (title, HJID) {
var index = top.ZLPMS.Loading3(2);
//受理问题
$.ajax({
url: '/Support/ReceiveProblem',
data: { id: ProblemId },
method: 'post',
success: function (data) {
top.ZLPMS.UnLoading(index);
var url = "/Problem/ProductionPdeal?id=" + ProblemId + "&showAtt=" + showAtt + '&workflowid=' + HJID + '&IsSupport=' + IsSupport;
//成功后调用
if (data.code == 200) {
top.ZLPMS.OpenNewWindow("处理问题:" + title, url, '1000px', '640px', function () {
//回调用刷新(只有确定后才刷新)
});
} else {//显示具体原因,并提示是否强制处理
top.ZLPMS.Confirm('该问题已被他人受理,您确定要继续处理吗?', 3, function (idx) {
top.ZLPMS.CloseWindow(idx);
top.ZLPMS.OpenNewWindow("处理问题", url, '1000px', '640px');
})
}
}
});
};
$.post('/Problem/GetProblemById/' + ProblemId, function (data) {
var row = data[0];
if (row) {
/*已关闭的问题,已解决的问题,已受理的问题, 不需要处理*/
if (row.是否终止 == 1) {
top.ZLPMS.Msg('已终止的问题不需要再处理!');
return;
}
if (row.是否解决 == 1) {
top.ZLPMS.Msg('已解决的问题不需要再处理!');
return;
}
if (row.环节ID > 3 && that.PersonProperty != '1') {
top.ZLPMS.Msg('非本部人员不能处理技术支持与研发处理环节问题,仅能查阅!');
return;
}
if (row.环节ID == 3 && (that.PersonProperty == '3' || that.PersonProperty == '4' || that.PersonProperty == '5')) {//客户,机构管理员,卫计委人员无法处理项目问题
top.ZLPMS.Msg('客户,机构管理员,卫计委人员无法处理项目问题,仅能查阅!');
return;
}
//打开处理窗口
receiveProblem(row.编号, row.环节ID);
} else {//提醒用户没有选择问题记录
top.ZLPMS.Msg('没有选择需要处理的问题记录,请选择后再处理!');
}
})
}
}
function Refresh(_mode) {
if (_mode == "0") {
var product = $("#Product").combobox('getValue');
var type = $('input:radio:checked').val();
var Params = {
ProductID: product,
States: type
}
$('#productVersionInfo').treegrid({
url: '/Product/productVersionInfoTreeGrid',
method: 'GET',
queryParams: Params
});
}
if (_mode == "1") {
var Node = $('#productVersionInfo').treegrid("getSelected");
var Params = {
ProductVerID: Node.ID
}
$('#VerisonFile').datagrid({
url: '/Product/ProductVerAnnexDataGrid',
method: 'GET',
queryParams: Params,
fit: true,
toolbar: '#ftb',
rownumbers: true,
pagination: false,
singleSelect: true,
border: false,
columns: [[
{ field: '添加人', title: '添加人', width: 200, align: 'center' },
{ field: '添加时间', title: '添加时间', width: 300, align: 'center', halign: 'center' },
{
field: '类型', title: '类型', width: 200, align: 'center', formatter: function (value, row, index) {
if (value == "1") {
return "脚本";
}
else if (value == "2") {
return "对象";
} else if (value == "3") {
return "其他";
}
}
}
]],
onLoadSuccess: function () {
}
});
}
}
//表单操作(产品版本)
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/PostSaveProductVersion';
$.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;
}
};