| | |
| | | view.get("#dialogImg").show();
 |
| | | 
 |
| | | };</ClientEvent> |
| | | <ClientEvent name="onReady">
 |
| | | // start 通过收储公司id来加载库区数据
 |
| | | /**
 |
| | | * 通用工具函数:获取URL中的指定参数值
 |
| | | * @param {String} name 要获取的参数名
 |
| | | * @returns {String/null} 参数值(无则返回null)
 |
| | | */
 |
| | | function getUrlParam(name) {
 |
| | | // 解析URL的查询字符串(?后面的部分)
 |
| | | var search = window.location.search.substring(1);
 |
| | | // 分割成键值对数组
 |
| | | var params = search.split("&");
 |
| | | for (var i = 0; i < params.length; i++) {
 |
| | | var pair = params[i].split("=");
 |
| | | // 解码参数值(处理中文/特殊字符)
 |
| | | if (decodeURIComponent(pair[0]) === name) {
 |
| | | return decodeURIComponent(pair[1] || "");
 |
| | | }
 |
| | | }
 |
| | | return null;
 |
| | | };
 |
| | | 
 |
| | | var parentId = getUrlParam("parentId");
 |
| | | console.log("parentId",parentId);
 |
| | | <ClientEvent name="onReady">var parentId = "${request.getParameter('parentId')}";
 |
| | | view.get("#dsMain").set("parameter",{parentId: parentId}).flushAsync();
 |
| | | //end 
 |
| | | 
 |
| | | /**
 |
| | | * 查看详情
 |
| | | * @param {String/Number} manualId 手动传入的id值(可选)
 |
| | | */
 |
| | | detail = function(manualId){
 |
| | | // 优先使用手动传入的id,没有则走原有选中行逻辑
 |
| | | var id = manualId;
 |
| | | if(!id){
 |
| | | var cur = view.get("#dgMain").get("selection");
 |
| | | if(cur){
 |
| | | id = cur.get("id");
 |
| | | }
 |
| | | }
 |
| | | 
 |
| | | // 有id则打开详情页,否则提示
 |
| | | if(id){
 |
| | | detail = function(){
 |
| | | var cur = view.get("#dgMain").get("selection");
 |
| | | if (cur) {
 |
| | | var id = cur.get("id");
 |
| | | var url = "/com.fzzy.igds.Depot.d?parentId="+ id;
 |
| | | window.$openTab("仓库管理", url);
 |
| | | }else{
 |
| | | $notify("请先选择库区……");
 |
| | | }
 |
| | | window.$openTab("库区管理", url);
 |
| | | }else {
 |
| | | $notify("请先选择数据……");
 |
| | | } 
 |
| | | };
 |
| | | 
 |
| | | 
 |
| | | showDlg=function(){
 |
| | | var select = view.get("#dgMain").get("selection");
 |
| | | if(select){
 |
| | | view.get("#dialogMain").show();;
 |
| | | }else{
 |
| | | $notify("请先选择数据……");
 |
| | | }
 |
| | | };
 |
| | | 
 |
| | | renderId = function(arg){
 |
| | | var txt = arg.data.getText("id");
 |
| | | if(!txt) return true;
 |
| | | // 关键修改:点击时把txt作为参数传给detail方法(注意转义双引号)
 |
| | | var htm = "<a href='javascript:;' onClick='detail(\""+txt+"\")' >"+txt+"</a>";
 |
| | | var htm = "<a href='javascript:;' onClick='showDlg()' >"+txt+"</a>";
 |
| | | arg.dom.innerHTML = htm;
 |
| | | }
 |
| | | </ClientEvent> |
| | | }</ClientEvent> |
| | | <Property name="packages">font-awesome,css-common</Property> |
| | | <DataSet id="dsMain"> |
| | | <Property name="dataProvider">deptPR#getData</Property> |
| | |
| | | <Property name="align">center</Property> |
| | | <Property name="width">160</Property> |
| | | </DataColumn> |
| | | <DataColumn> |
| | | <ClientEvent name="onRenderCell">arg.dom.innerHTML = "<a href='javascript:;' onClick='detail()' class='a-btn1'>查看详情</a>";</ClientEvent> |
| | | <Property name="width">160</Property> |
| | | <Property name="caption">操作</Property> |
| | | <Property name="align">center</Property> |
| | | <Property name="width">120</Property> |
| | | <Editor/> |
| | | </DataColumn> |
| | | </DataGrid> |
| | | </Container> |
| | | <Dialog id="dialogMain"> |