123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026 |
- var resouceindex = 0;
- function ProcessProblem(id, uprop, workid) {
- //问题id
- this.id = id;
- //渠道
- this.companyid = null;
- //是否显示附加信息0:不显示,1:显示
- this.isShowAttInfo = null;
- //人员性质
- this.userProp = uprop;
- //环节id
- this.workflowid = workid;
- //初始化
- this.inits = function (showAtt, IsSupport, Deatil) {
- resouceindex = top.ZLPMS.Loading("请稍等,正在加载数据....",0);
- var that = this;
- this.isShowAttInfo = showAtt; //是否显示附加信息0:不显示,1:显示
- this.IsSupport = IsSupport; //1-技术支持 2-项目处理 0-研发处理
- this.Deatil = Deatil || {};
- if ((that.IsSupport == '1' && $('#rdSubmit').radiobutton('options').checked) || (that.IsSupport == '1' && $('#rdSolve').radiobutton('options').checked)) {
- $('#ProblemType').combotreegrid({
- required: true
- });
- }
- GetProblemType();
- //关闭窗口
- $('#btnClose').bind('click', function () {
- ZLPMS.CloseTopWindow();
- });
- //取消受理
- $('#btnCancel').bind('click', function () {
- ZLPMS.Confirm('您确定要取消受理该问题吗?', 3, function () {
- $.ajax({ //取消当前受理
- url: '/Problem/CancelReceiveProblem',
- data: {
- id: that.id
- },
- method: 'post',
- success: function (data) {
- if (data.code == 200) { //成功取消关闭当前窗口
- ZLPMS.CloseTopWindow(true);
- } else { //失败显示原因
- ZLPMS.Msg(data.msg);
- }
- }
- });
- });
- });
- $('#cbUser').combobox({
- disabled: true
- });
- //选择指派人员
- $('#rdPerson').radiobutton({
- onChange: function (checked) {
- if (checked) {
- $('#cbUser').combobox({
- disabled: false,
- required: true
- });
- $('#test').combobox({
- required: false
- });
- $('#BB').combobox({
- required: false
- });
- $('#BBZT').combobox({
- required: false
- });
- } else {
- $('#cbUser').combobox({
- disabled: true
- });
-
- }
- }
- });
- //回退问题
- $('#rdBack').radiobutton({
- onChange: function (checked) {
- $('#test').combobox({
- required: false
- });
- $('#BB').combobox({
- required: false
- });
- $('#BBZT').combobox({
- required: false
- });
- }
- });
- //红黑榜
- $('#rdNo').radiobutton({
- onChange: function (checked) {
- $('#tbContent').textbox('setValue', "");
- $('#tbContent').textbox('textbox').attr('readonly', true);
- }
- });
- //红黑榜
- $('#rdRed').radiobutton({
- onChange: function (checked) {
- $('#tbContent').textbox('textbox').attr('readonly', false);
- }
- });
- //红黑榜
- $('#rdBlack').radiobutton({
- onChange: function (checked) {
- $('#tbContent').textbox('textbox').attr('readonly', false);
- }
- });
- //加载以前的处理描述
- $('#rdDeal').radiobutton({
- onChange: function (checked) {
- var t = $('#rdSolve').radiobutton('options').checked;
- var content = UM.getEditor('tbRemark').getContent();
- if (!content) {
- if (checked) {
- UM.getEditor('tbRemark').setContent(that.Deatil.DealDetail, false);
- } else if (!checked && !t) {
- UM.getEditor('tbRemark').setContent('');
- }
- }
- $('#test').combobox({
- required: false
- });
- $('#BB').combobox({
- required: false
- });
- $('#BBZT').combobox({
- required: false
- });
- }
- });
- //加载指派人员
- $('#cbUser').combobox({
- url: '/MobileProblem/GetDistribuPerson',
- queryParams: {
- search: "",
- problemId: this.id
- },
- valueField: 'ID',
- textField: '姓名',
- groupField: '公司名称',
- limitToList: true,
- formatter: function (row) {
- return row.姓名 + '【' + (row.职务 == null ? '无' : row.职务) + '】';
- },
- filter: function (q, row) {
- var opts = $(this).combobox('options');
- return row[opts.textField].indexOf(q) > -1 || row.简码.indexOf(q.toUpperCase()) > -1;
- }
- });
- //选择向上提交的人员
- if (this.IsSupport == '1') {
- $("#isSupport").css('display', 'inline-block');
- $('#rdSubmit').radiobutton({
- onChange: function (checked) {
- if (checked) {
- $('#cbSubUser').combobox({
- disabled: false,
- required: true
- });
- $('#test').combobox({
- required: false
- });
- $('#BB').combobox({
- required: false
- });
- $('#BBZT').combobox({
- required: false
- });
- } else {
- $('#cbSubUser').combobox({
- disabled: true
- });
- }
- }
- });
- //加载提交人员
- $('#cbSubUser').combobox({
- url: "/PersonManager/GetPersonByJob?Nature=1&job=10,11",
- valueField: 'ID',
- textField: '姓名',
- limitToList: true,
- formatter: function (row) {
- return row.姓名 + '【' + (row.职务 == null ? '无' : row.职务) + '】';
- }
- });
- }
- //确定按钮事件
- $('#btnFinish').bind('click', function () {
- index = ZLPMS.Loading3(1);
- debugger
- var r = $("#form1").form('validate');
- if (!r) {
- top.ZLPMS.Msg("请注意必填选项!", 2)
- //验证不通过
- ZLPMS.UnLoading(index);
- } else {
- //验证通过
- var obj = that.GetPara();
- ZLPMS.UnLoading(index);
- var index = null;
- var obj = that.GetPara();
- $.post('/Problem/ExecuteProcessData', obj, function (data) {
- if (data.code == 200) { //关闭当前页面
- top.ZLPMS.Msg('完成处理');
- document.getElementById("btn_upload").click();
- var obj = that.GetPara();
- //若选择了多处理版本
- if (obj.NewVersion != undefined && obj.NewVersion.length > 0 && obj.NewVersion[0].length > 0) {
- for (var i = 0; i < obj.NewVersion.length;) {
- $.ajax({ //取消当前受理
- url: '/Problem/SaveVersion',
- data: { pid: obj.ProblemID, version: obj.NewVersion[i] },
- method: 'post',
- async: false,
- success: function (data) {
- if (data == 1) {
- i++
- top.ZLPMS.Msg("保存成功!", 1)
- } else {
- top.ZLPMS.Msg("生成多版本处理失败!", 2)
- }
- }
- });
- }
- }
- } else {
- top.ZLPMS.Msg(data.msg);
- }
- ZLPMS.CloseTopWindow(true);
- })
- }
- });
- //绑定一键回退按钮
-
- $('#rdBackStart').radiobutton({
- onChange: function (checked) {
- if (checked) {
- $('#cbBackHj').combobox({
- disabled: false
- });
- $('#cbBackUser').combobox({
- disabled: false
- });
- $('#test').combobox({
- required: false
- });
- $('#BB').combobox({
- required: false
- });
- $('#BBZT').combobox({
- required: false
- });
- }
- else {
- $('#cbBackHj').combobox({
- disabled: true
- });
- $('#cbBackUser').combobox({
- disabled: true
- });
- }
- }
- });
- //一键回退加载项目流程
- $('#cbBackHj').combobox({
- data: [{
- "ID": "3",
- "名称": "项目处理"
- }, {
- "ID": "4",
- "名称": "技术支持处理"
- }],
- valueField: 'ID',
- textField: '名称',
- onChange: function (cur, old) {
- var Nature = 2;//性质1本部、2渠道人员,
- var job = "3,4";//3项目经理、4实施人员,12技术支持
- if (cur == 4) {
- Nature = 1;
- job = "12";
- }
- $.ajax({
- url: '/PersonManager/GetPersonByJob?Nature=' + Nature + '&job=' + job,
- data: {
- id: that.id
- },
- method: 'post',
- success: function (data) {
- $("#cbBackUser").combobox('clear')
- $("#cbBackUser").combobox('loadData', data)
- }
- });
- }
- });
- if (that.workflowid == 5) { //如果是研发环节则不再向上提交
- $('#rdSubmit').radiobutton('disable');
- $("#isSupport").css('display', 'none');
- }
- if (that.workflowid > 3 && that.userProp != 1) { //如果环节ID>3表示,技术支持或研发,而人员性质不为1则表示非中联本部人员,则不允许再次提交
- $('#btnSubmit').remove();
- $('#lbsubmit').remove(); //隐藏相关文本
- }
- if (showAtt == '0') { //隐藏附加信息的面板
- $('#tabMyprocess').tabs('close', 2);
- }
- //版本
- $("#BB").combobox({
- url: '/Problem/GetVersionById?id=' + id + "&type=1",
- valueField: 'ID',
- textField: '版本号',
- required: true,
- onChange: function (cur, old) {
- if (cur.length == 0) {
- $("#BBZT").combobox("setValue", '')
- }
- var list = $("#BB").combobox('getData')
- list = list.filter(x => x.ID != cur)
- //多版本处理
- $("#Version").combobox('loadData', list)
- //$('#BBZT').combobox({
- // required: true
- //});
- }
- });
- $("#BBZT").combobox({
- url: "/Problem/GetBaseCode?type=35DB8B88-36B5-49FE-A879-D49DB88BC03B",
- valueField: '代码',
- textField: '显示名',
- required: true,
- onChange: function (cur, old) {
-
- }
- });
- //加载测试处理人
- $('#test').combobox({
- url: '/MobileProblem/GetDistribuPerson',
- queryParams: {
- search: "",
- problemId: this.id
- },
- valueField: 'ID',
- textField: '姓名',
- groupField: '公司名称',
- limitToList: true,
- required: true,
- formatter: function (row) {
- return row.姓名 + '【' + (row.职务 == null ? '无' : row.职务) + '】';
- },
- filter: function (q, row) {
- var opts = $(this).combobox('options');
- return row[opts.textField].indexOf(q) > -1 || row.简码.indexOf(q.toUpperCase()) > -1;
- }
- });
- ///产品问题
- $('#rdProc').radiobutton({
- onChange: function (checked) {
- if (checked) {
- //解决版本
- $('#BB').combobox({
- required: true,
- readonly: false,
- });
-
- $('#test').combobox({
- required: true,
- readonly: false,
- });
- $('#BBZT').combobox({
- required: true,
- readonly: false,
- });
-
- }
- }
- });
-
- ///项目问题
- $('#rdItem').radiobutton({
- onChange: function (checked) {
- if (checked) {
- //解决版本
- $('#BB').combobox({
- required: false,
- readonly: true,
- setValue: ""
- });
- $('#test').combobox({
- required: false,
- readonly: true,
- setValue: ""
- });
- $('#BBZT').combobox({
- required: false,
- readonly: true,
- setValue: ""
- });
-
- }
- }
- });
- //加载问题信息
- $.ajax({
- url: '/Problem/CheckProblem',
- data: {
- id: this.id
- },
- method: 'post',
- success: function (data) {
- sessionStorage.setItem("WTID", data[0].ID);
- //首次加载时问题归类是否显示
- if (that.IsSupport == '1' || that.IsSupport == '2') {
- GetProblemType();
- }
- //附件记录(附件id|文件类型,1:图像,2:其它)
- var attach_ids = data[0].附件
- if (attach_ids != null) { //包括了附件
- var ids = attach_ids.split(',');
- var imghtml = '';
- for (var i = 0; i < ids.length; i++) {
- var imgid = ids[i].split('|');
- var id = imgid[0];
- var ft = imgid[1];
- if (ft == '1') { //图像类型,显示缩略图 o原图,s缩略图,m大图
- imghtml += '<a href="#" onclick="OpenImage(' + id + ')"><img src="/Problem/ViewProblemImage?id=' + id + '&type=s" class="img"/></a> ';
- } else { //非图像类型,显示下载附件
- imghtml += '<a href="#" onclick="downloadfile(' + id + ')">下载附件' + (i + 1) + '</a>';
- }
- }
- //添加附件html
- $('#attach').html(imghtml);
- }
- //放大图片
- var img = $('#content').find("img");
- if (img) {
- img.bind("click", function () {
- var src = $(this).attr("src")
- top.ZLPMS.OpenNewWindow("查看图片", "/Problem/ViewImg?src=" + src, "850px", "620px")
- })
- }
- //绑定解决问题按钮
- $('#rdSolve').radiobutton({
- onChange: function (checked) {
- var t = $('#rdDeal').radiobutton('options').checked;
- var content = UM.getEditor('tbRemark').getContent();
- if (!content) {
- if (checked) {
- UM.getEditor('tbRemark').setContent(that.Deatil.SolveDetail, false);
- } else if (!checked && !t) {
- UM.getEditor('tbRemark').setContent('');
- }
- }
- if (that.IsSupport == '1' || that.IsSupport == '2') {
- //绑定是否选择问题归类
- if (checked) {
- $("#PROBLEMTYEP").show();//技术支持和项目默认显示问题归类
- if (that.IsSupport == '1') {
- $('#ProblemType').combotreegrid({
- required: true
- });
- }
- GetProblemType();
- } else {
- $("#PROBLEMTYEP").hide();
- $('#ProblemType').combotreegrid({
- required: false,
- });
- }
- }
- $('#test').combobox({
- required: true
- });
- $('#BB').combobox({
- required: true
- });
- $('#BBZT').combobox({
- required: true
- });
- }
- });
- //绑定终止按钮
- $('#rdStop').radiobutton({
- onChange: function (checked) {
- //绑定是否选择问题归类
- if (checked) {
- $("#PROBLEMTYEP").show();//技术支持和项目默认显示问题归类
- if (that.IsSupport == '1') {
- $('#ProblemType').combotreegrid({
- required: true
- });
- }
- GetProblemType();
- } else {
- $("#PROBLEMTYEP").hide();
- $('#ProblemType').combotreegrid({
- required: false,
- });
- }
- $('#test').combobox({
- required: false
- });
- $('#BB').combobox({
- required: false
- });
- $('#BBZT').combobox({
- required: false
- });
- }
- });
- //向上提交
- $('#rdSubmit').radiobutton({
- onChange: function (checked) {
- if (that.IsSupport == '1' || that.IsSupport == '2') {
- //绑定是否选择问题归类
- if (checked) {
- if (that.IsSupport == '1') {
- $('#cbSubUser').combobox({
- disabled: false,
- required: true
- });
- $("#PROBLEMTYEP").show();//技术支持和项目默认显示问题归类
- $('#ProblemType').combotreegrid({
- required: true,
- });
- GetProblemType();
- }
- } else {
- $("#PROBLEMTYEP").hide();
- $('#ProblemType').combotreegrid({
- required: false,
- });
- if (that.IsSupport == '1') {
- $('#cbSubUser').combobox({
- disabled: true
- });
- }
- }
- }
- $('#test').combobox({
- required: false
- });
- $('#BB').combobox({
- required: false
- });
- }
- });
- //加载资源信息
- $('#resource').datagrid({
- toolbar: '#btn_func',
- singleSelect: true,
- url: '/Problem/ResourceData?proid=' + data[0].ID,
- fit: true,
- columns: [
- [{
- field: 'DECODE类型',
- title: '类型',
- width: 100
- },
- {
- field: '内容',
- width: 516,
- title: '内容',
- minWdith: 516
- },
- {
- field: '资源ID',
- title: '资源ID',
- width: 220,
- minWdith: 220
- },
- {
- field: '添加时间',
- title: '添加时间',
- width: 142,
- }
- ]
- ],
- onClickRow: function (index, data) {
- sessionStorage.setItem("WTID", data.问题ID);
- sessionStorage.setItem("ID", data.ID);
- sessionStorage.setItem("资源ID", data.资源ID);
- sessionStorage.setItem("类型", data.类型);
- sessionStorage.setItem("内容", data.内容);
- sessionStorage.setItem("序号", data.序号);
- sessionStorage.setItem("实例类型", data.实例类型);
- }
- })
- $('#code').text(data[0].编号);
- $('#property').text(data[0].问题性质);
- $('#company').text(data[0].渠道);
- $('#project').text(data[0].项目);
- $('#org').text(data[0].机构);
- $('#productAndVersion').text(data[0].产品 + '/' + data[0].版本号);
- $('#module').text(data[0].模块);
- $('#prior').text(data[0].紧急代码);
- var priordate = data[0].要求时间 == null ? '无' : data[0].要求时间;
- $('#priordate').text(priordate);
- var priordesc = data[0].紧急描述 == null ? '无' : data[0].紧急描述;
- $('#priorDesc').text(priordesc);
- var feedback = data[0].反馈人 == null ? '无' : data[0].反馈人;
- $('#feedbackAndRegisterPerson').text(feedback + '/' + data[0].登记人);
- $('#registertime').text(data[0].登记日期);
- $('#title').text(data[0].问题标题);
- $('#content').html(data[0].问题描述);
- data[0].问题类型 == 2 ? $('#rdProc').radiobutton({ checked: true }) : 1
- //其他信息
- if (data[0].红黑榜 == 1) {
- $('#rdRed').radiobutton({ checked: true })
- $('#tbContent').textbox('textbox').attr('readonly', false);
- }
- else if (data[0].红黑榜 == 2) {
- $('#rdBlack').radiobutton({ checked: true })
- $('#tbContent').textbox('textbox').attr('readonly', false);
- }
- $('#tbContent').textbox('setValue', data[0].红黑榜理由)
- $('#BB').combobox('setValue', data[0].解决版本ID)
- $('#BBZT').combobox('setValue', data[0].解决版本状态)
- data[0].是否发布 == 1 ? $('#ckIsRelease').checkbox({ checked: true }) : 1
- data[0].需要培训 == 1 ? $('#ckIsTrain').checkbox({ checked: true }) : 1
- data[0].常见问题 == 1 ? $('#ckIsOften').checkbox({ checked: true }) : 1
- data[0].项目个性化 == 1 ? $('#identify').checkbox({ checked: true }) : 1
- $('#tbBHNumber').textbox('setValue', data[0].bh编号)
- data[0].修改说明 == null ? null : UM.getEditor('tbAlterRemark').setContent(data[0].修改说明);
- $('#tbUpgrateRemark').textbox('setValue', data[0].升级说明)
- $('#tbBHNumber').textbox('setValue', data[0].BH编号)
- $('#tbBHVersion').textbox('setValue', data[0].BH版本)
- }
- });
- //获取用户录入内容(正常处理)
- this.GetPara = function () {
- var para = {};
- //问题ID
- para.ProblemID = this.id;
- //是否指派人员
- var IsAssign = $('#rdPerson').radiobutton('options').checked;
- //指派人员名称
- var AssignName = $('#cbUser').combobox('getText');
- var AssignID = $('#cbUser').combobox('getValue');
- //处理问题
- var IsDeal = $('#rdDeal').radiobutton('options').checked;
- //是否解决
- var IsSolve = $('#rdSolve').radiobutton('options').checked;
- //是否终止问题
- var IsStop = $('#rdStop').radiobutton('options').checked;
- //是否回退
- var IsBack = $('#rdBack').radiobutton('options').checked;
- //一键回退
- var IsBackStart = $('#rdBackStart').radiobutton('options').checked;
- //如果一键回退流程选择的是技术支持处理,直接走回退问题流程。如果走项目处理。就多级回退
- var BackHj = $('#cbBackHj').combobox('getValue');
- if (BackHj == 4) {
- IsBackStart = false;
- IsBack = true;
- }
- //向上提交
- var IsCommit = $('#rdSubmit').radiobutton('options').checked;
- //提交人员名称
- var SubName = $('#cbSubUser').combobox('getText');
- var SubID = $('#cbSubUser').combobox('getValue');
-
- //处理说明
- var ProcessRemark = escape(UM.getEditor('tbRemark').getContent());
- //红黑榜
- para.RedBlack = 0;
- para.RedBlackContent = $('#tbContent').combobox('getText');
- var rdRed = $('#rdRed').radiobutton('options').checked;
- if (rdRed) {
- para.RedBlack = 1;
- }
- var rdBlack = $('#rdBlack').radiobutton('options').checked;
- if (rdBlack) {
- para.RedBlack = 2;
- }
- //添加到对象中
- para.IsAssign = IsAssign;
- para.AssignName = AssignName;
- para.AssignID = AssignID;
- para.SubName = SubName;
- para.SubID = SubID;
- para.IsDeal = IsDeal;
- para.IsSolve = IsSolve;
- para.ProblemTypeID = $('#ProblemType').combotreegrid('getValue');
- para.IsStop = IsStop;
- para.IsBack = IsBack;
- para.IsBackStart = IsBackStart;
- para.IsCommit = IsCommit;
- para.ProcessRemark = ProcessRemark; //处理说明
- para.IsAttInfo = (this.isShowAttInfo != '0') ? true : false;
-
-
- // 1:产品 2:项目
- if (this.isShowAttInfo != '0') {
- //显示了附加信息(技术支持或研发处理)
- var IsItem = $('#rdItem').radiobutton('options').checked;
- var SolveVersion = $('#BB').combobox('getText'); //解决版本
- var VersionID = $('#BB').combobox('getValue'); //解决版本id
- var SolveVersionstate = $('#BBZT').combobox('getValue'); //解决版本状态
- var NewVersion = $('#Version').combobox('getValues'); //多解决版本
- var IsRelease = $('#ckIsRelease').checkbox('options').checked; //是否发布
- var BHNumber = $('#tbBHNumber').textbox('getValue'); //BH版本号
- var IsOften = $('#ckIsOften').checkbox('options').checked; //是否常见问题
- var Identify = $('#identify').checkbox('options').checked; //项目个性化
- var BHVersion = $('#tbBHVersion').textbox('getValue'); //BH版本号
- var IsTrain = $('#ckIsTrain').checkbox('options').checked; //是否需要培训
- var AlterRemark = escape(UM.getEditor('tbAlterRemark').getContent());//修改说明
- var UpgrateRemark = $('#tbUpgrateRemark').textbox('getValue'); //升级说明
- //测试人员id
- var TestPeronId = $('#test').combobox('getValue');
- //添加扩展的json
- para.IsItem = IsItem;
- para.SolveVersion = SolveVersion;
- para.SolveVersionstate = SolveVersionstate;
- para.NewVersion = NewVersion;
- para.IsRelease = IsRelease;
- para.BHNumber = BHNumber;
- para.IsOften = IsOften;
- para.BHVersion = BHVersion;
- para.IsTrain = IsTrain;
- para.AlterRemark = AlterRemark;
- para.UpgrateRemark = UpgrateRemark;
- para.Identify = Identify
- para.TestPeronId = TestPeronId;
- para.VersionID = VersionID;
- }
- return para;
- }
- }
- }
- //查看附件大图
- function OpenImage(id) {
- top.ZLPMS.OpenNewWindow(null, '/SysCom/ImageView?id=' + id + '&type=m', '70%', '80%');
- }
- //下载附件文件
- function downloadfile(id) {
- window.open('/Problem/ViewProblemImage?id=' + id);
- }
- function addfiles() {
- var guid = new GUID();
- var id = guid.newGUID();
- var fileIn = '<input type="file" id="f_' + id + '" name="f_' + id + '" />';
- var html = '<div id=' + id + '>' + fileIn + ' <a href="#" onclick="fileRemove(\'' + id + '\')" style="color:red">移除</a></br></div>';
- $('#files').append(html);
- //$('#f_' + id).trigger('click');
- }
- //移除选择的附加文件
- function fileRemove(val) {
- $('#' + val).remove();
- }
- function GUID() {
- this.date = new Date(); /* 判断是否初始化过,如果初始化过以下代码,则以下代码将不再执行,实际中只执行一次 */
- if (typeof this.newGUID != 'function') {
- /* 生成GUID码 */
- GUID.prototype.newGUID = function () {
- this.date = new Date();
- var guidStr = '';
- sexadecimalDate = this.hexadecimal(this.getGUIDDate(), 16);
- sexadecimalTime = this.hexadecimal(this.getGUIDTime(), 16);
- for (var i = 0; i < 9; i++) {
- guidStr += Math.floor(Math.random() * 16).toString(16);
- }
- guidStr += sexadecimalDate;
- guidStr += sexadecimalTime;
- while (guidStr.length < 32) {
- guidStr += Math.floor(Math.random() * 16).toString(16);
- }
- return this.formatGUID(guidStr);
- }
- /* * 功能:获取当前日期的GUID格式,即8位数的日期:19700101 * 返回值:返回GUID日期格式的字条串 */
- GUID.prototype.getGUIDDate = function () {
- return this.date.getFullYear() + this.addZero(this.date.getMonth() + 1) + this.addZero(this.date.getDay());
- }
- /* * 功能:获取当前时间的GUID格式,即8位数的时间,包括毫秒,毫秒为2位数:12300933 * 返回值:返回GUID日期格式的字条串 */
- GUID.prototype.getGUIDTime = function () {
- return this.addZero(this.date.getHours()) + this.addZero(this.date.getMinutes()) + this.addZero(this.date.getSeconds()) + this.addZero(parseInt(this.date.getMilliseconds() / 10));
- }
- /* * 功能: 为一位数的正整数前面添加0,如果是可以转成非NaN数字的字符串也可以实现 * 参数: 参数表示准备再前面添加0的数字或可以转换成数字的字符串 * 返回值: 如果符合条件,返回添加0后的字条串类型,否则返回自身的字符串 */
- GUID.prototype.addZero = function (num) {
- if (Number(num).toString() != 'NaN' && num >= 0 && num < 10) {
- return '0' + Math.floor(num);
- } else {
- return num.toString();
- }
- }
- /* * 功能:将y进制的数值,转换为x进制的数值 * 参数:第1个参数表示欲转换的数值;第2个参数表示欲转换的进制;第3个参数可选,表示当前的进制数,如不写则为10 * 返回值:返回转换后的字符串 */
- GUID.prototype.hexadecimal = function (num, x, y) {
- if (y != undefined) {
- return parseInt(num.toString(), y).toString(x);
- } else {
- return parseInt(num.toString()).toString(x);
- }
- }
- /* * 功能:格式化32位的字符串为GUID模式的字符串 * 参数:第1个参数表示32位的字符串 * 返回值:标准GUID格式的字符串 */
- GUID.prototype.formatGUID = function (guidStr) {
- var str1 = guidStr.slice(0, 8) + '-',
- str2 = guidStr.slice(8, 12) + '-',
- str3 = guidStr.slice(12, 16) + '-',
- str4 = guidStr.slice(16, 20) + '-',
- str5 = guidStr.slice(20);
- return str1 + str2 + str3 + str4 + str5;
- }
- }
- }
- //加载问题分类
- function GetProblemType() {
- $('#ProblemType').combotreegrid({
- width: '200px',
- panelWidth: 680,
- panelHeight: 200,
- prompt: '选择问题分类',
- url: '/ClassifyManage/GetTreeGrid',
- method: 'GET',
- idField: 'ID',
- treeField: '名称',
- editable: true,
- columns: [
- [{
- field: '编码',
- title: '编码',
- width: 55,
- align: 'center'
- },
- {
- field: '名称',
- title: '名称',
- width: 170,
- align: 'center'
- },
- {
- field: '说明',
- title: '说明',
- width: 380,
- align: 'center',
- halign: 'center',
- formatter: function (value, row, index) {
- var content = '';
- var abValue = value + '';
- if (value != undefined) {
- if (value.length >= 22) {
- abValue = value.substring(0, 19) + "...";
- content = '<a href="javascript:;" title="' + value + '" class="easyui-tooltip">' + abValue + '</a>';
- } else {
- content = '<a href="javascript:;" title="' + abValue + '" class="easyui-tooltip">' + abValue + '</a>';
- }
- }
- return content;
- }
- },
- //{
- // field: '分值',
- // title: '分值',
- // width: 70,
- // align: 'center',
- // halign: 'center',
- // formatter: function (val, row, index) {
- // return (val || 0) + "分";
- // }
- //}
- ]
- ],
- onLoadSuccess: function (row, data) {
- top.ZLPMS.UnLoading(resouceindex);
- $("#PROBLEMTYEP").show();
- }
- });
- }
- function remarkFormater(value, row, index) {
- alert("value=" + value + " index=" + index);
- var content = '';
- var abValue = value + '';
- if (value != undefined) {
- if (value.length >= 22) {
- abValue = value.substring(0, 19) + "...";
- content = '<a href="javascript:;" title="' + value + '" class="easyui-tooltip">' + abValue + '</a>';
- } else {
- content = '<a href="javascript:;" title="' + abValue + '" class="easyui-tooltip">' + abValue + '</a>';
- }
- }
- return content;
- }
- //新增资源
- function Add_Resource() {
- top.ZLPMS.OpenWindow({
- title: '资源编辑',
- url: "/Problem/ResourceWindow?type=0" + "&version=1",
- area: ['600px', '650px'],
- yes: function (index, layero) {
- var iframeWin = top.window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法:
- iframeWin.Forms.PostData(index, layero, $("#resource")); //调用子页面的方法,得到子页面返回的ids
- },
- });
- }
- //删除资源
- function Delete_Resource() {
- var data = $("#resource").datagrid("getSelected");
- if (data == null) {
- top.ZLPMS.Msg("请选择一条记录", 3);
- return false
- }
- top.ZLPMS.Confirm('您确定要删除选中的记录吗', 5, function () {
- //执行删除
- $.post("/Problem/DelResource?id=" + data.ID, function (data) {
- if (data == 1) {
- $('#resource').datagrid('reload');
- top.ZLPMS.Msg("删除成功");
- } else {
- top.ZLPMS.Msg("删除失败");
- }
- })
- });
- }
- //修改资源
- function Update_Resource() {
- var data = $("#resource").datagrid("getSelected");
- if (data == null) {
- top.ZLPMS.Msg("请选择一条记录", 3);
- return false
- }
- top.ZLPMS.OpenWindow({
- title: '资源编辑',
- url: "/Problem/ResourceWindow?type=1" + "&version=1",
- area: ['600px', '650px'],
- yes: function (index, layero) {
- var iframeWin = top.window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法:
- iframeWin.Forms.PostData(index, layero, $("#resource")); //调用子页面的方法,得到子页面返回的ids
- }
- });
- }
- //提交请求
- var Forms = {
- PostData: function (index, layero, obj) {
- //执行提交验证
- var r = $('#edit_resource').form('validate');
- if (r) { //post到后台
- var param = ZLPMS.FormToObject('edit_resource');
- if (param.LX == null) { top.ZLPMS.Msg("请选择资源类型", 4); return false }
- if (param.SL == null) { top.ZLPMS.Msg("请选择实例类型", 4); return false }
- $.post('/Problem/SaveResource', param, function (data) {
- if (data == 1) {
- obj.datagrid("reload");
- top.ZLPMS.Msg("保存成功", 1);
- } else {
- top.ZLPMS.Msg("保存失败,请联系管理员", 2);
- }
- if (param.continue != "on") {
- top.ZLPMS.CloseWindow(index);
- } else {
- //不关闭 值刷新当前页面
- window.location.reload()
- }
- });
- }
- }
- };
|