LiFan
2024-07-16 f087a50629e95666db2e0b0ba4373834e2b9593b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
use "dev:code[SKUTemplate.vx]"
 
unit vbusiness.vpage
[
    SKUTemplateImport is extend SKUTemplate;
    about SKUTemplateImport
    [
        field:
            xdwgrid__    dw_list;
            xdwtable__  dw_other;
            xdwtable__  dw_prop;                     
        method:
        [
 
            string jxParam(string p, string n)
            {
                if(p != "")
                {
 
                    int i = 1;
                    while (p.find("=",0)>0)
                    {
                        string name = p.mid(0, p.find("=",0));
                        string value = p.mid(p.find("=",0) + 1, p.find("=",0) - 1);
                        return ""+value;
                        i += 1;
                    }
                }        
                return "";
            }        
            int OnSelectAll()
            {
                if(this.dw_list.GetRowCount() > 0 )
                    this.dw_list.SelectRow(1,true);
 
                this.dw_list.SelectRow(0,true);
                this.dw_list.Redraw();
                return 1;
            }
            
            int OnSelectNo()
            {
                this.dw_list.SelectRow(0,false);
                this.dw_list.Redraw();
                return 1;
            }
            
            int OnOk()
            {    
                dw_other.openUrl("/sale/view/CustomerGoods/template/CustomerGoods/itemother");        
                dw_other.SetColHeaderHeight(0);
                dw_other.SetRowSelectorWidth(0);
                int row = SKUTemplate::dw_list.GetNextSelectRow(1);
                if (row<1)
                {
                    alert("ÇëÑ¡ÔñÄ£°å!");
                    return 1;
                }                    
                    
                msxml::IXMLDOMElement e =SKUTemplate::dw_list.GetRowElement(row);            
                string TemplateContent = e.selectSingleNode("TemplateContent").text+"";
                string TemplateID = e.selectSingleNode("TemplateID").text+"";                
                //trace(ItemName);
                xml__ x = new xml__;
                x.setNativePointer(x.CreateInstance());
                x.LoadXml(TemplateContent);                    
                dw_other.Retrieve(x);
                dw_prop.SetItemString(1,"TemplateID",TemplateID);                
                CloseWindow();
                return 1;
            }
            
            int OnCancel()
            {
                CloseWindow();    
                return 1;
            }
            int OnDoubleClicked(ref TNotifyEvent evt,int p)
            {    
                OnOk();    
                return 1;
            }            
                
            int OnCmdDispatch(string comdid)
            {
                if (comdid=="SelectAll") OnSelectAll();
                else if (comdid=="SelectNo") OnSelectNo();
                else if (comdid=="cb_import") OnOk();
                else if (comdid=="cb_close") OnCancel();
                //else if (comdid=="query") GridSearch();                        
                return 0;
            }
            
            int OnXCommand(ref TXCommandEvent evt,int p)
            {
                return OnCmdDispatch(evt.pStrID);
            }
            
            int onload()
            {
                if (GetParam())
                {
                    int iArgs = GetParam();
                    xaserverarg__ arg1 = new xaserverarg__;
                    arg1.setNativePointer(iArgs);
                    dw_other = new xdwtable__;
                    dw_other.setNativePointer(arg1.GetArgString("dw_other").toInt());
                    dw_prop = new xdwtable__;
                    dw_prop.setNativePointer(arg1.GetArgString("dw_prop").toInt());                
                }
                //trace(dw_other.__nativept);
                SKUTemplate::onload();
                SKUTemplate::dw_list.SetSelectionMode(1); //3
                SKUTemplate::dw_list.SetReadOnly(true);            
                AttachEvent("WM_XCOMMAND",OnXCommand);
                AttachEvent("dw_list","DWV_DOUBLECLICKED",OnDoubleClicked);//ÐÐË«»÷                
            }
        ]
    ]
]