田源
2024-04-07 2ac55ce0edf4870a29691b56bfad59f4830a11a2
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
/**
 * 按钮处理 页面展示为tab选项卡
 * @author wangting
 * @date 2021-3-16
 */
layui.define(['layer','element','BaseAction'],function(exports){
    var webUtil = $webUtil;
    var Class = function() {
        this.MODELNAME = "BaseTabViewAction";
        this.moduleKey = "BaseTabViewAction";
 
        this.getContent = function (id) {
            var that = this;
            that.id = id;
            var html = [
                '<div class="addOrEdit" id="View_', id, ' lay-filter="View_', id, '" style="display:block; text-align: center"></div>'
            ].join("");
            return html;
        };
 
        this.doAction = function (options) {
            var that = this;
            webUtil.copyConfig(that, that.moduleKey);
            that.id = options.id;
            var paramVOS={
                getDataUrl:'uiDataController/dataFormQuery',
                getDataBackPath: configData.compatibility ? path : configData.objectServicePath,
                getDataMethod:'post',
                url:'uiDataController/editSave',
                backPath:configData.compatibility ? path : configData.objectServicePath,
                method:'put',
                uploadFileUrl:'vciFileUploadController/uploadFile',
                uploadFileBackPath: configData.compatibility ? path : configData.fileServicePath
            }
            $.extend(paramVOS,options.paramVOS);
            options.paramVOS=paramVOS;
 
            var baseAction = layui['BaseAction'];
            baseAction.callPreEvent(options, that, function (options) {
                that.doView(options, function () {
                    baseAction.callPostEvent(options, that, options.callback);
                });
            });
        };
 
        this.doView=function (options) {
            var that = this;
            var paramVOS = $webUtil.paramLow(options.paramVOS);
            var id = options.dataStore[0] ? options.dataStore[0].oid : options.id;
            var text =paramVOS.title;
            var url = "USEJS:platform/objectService/VciUIContentViewer";
            if ($webUtil.isNotNull(paramVOS.customurl)) {
                //自定义js
                url = paramVOS.customurl;
            }
            /*var selectData = options.dataStore;
            if(selectData.length<1){
                $webUtil.showErrorMsg("请选择一条需要浏览的数据");
                return false;
            }
            if(!paramVOS.multi && selectData.length > 1){
                $webUtil.showErrorMsg("仅能选择一条数据来浏览");
                return false;
            }*/
            var menuObject = { //弹出选项卡
                id: 'TabView_' + id,
                url: url,
                text: text,
                multiCompent: true,
                initSourceData: {
                    btmType: paramVOS.type,
                    content: paramVOS.context || paramVOS.content,
                    actionData: {
                        selectData: options.sourceData,
                        paramVOS: paramVOS
                    }
                }
            };
            if (options.dataStore[0]) {
                menuObject.initSourceData = {
                    btmType: paramVOS.type,
                    content: paramVOS.context || paramVOS.content,
                    dataOid: options.dataStore[0].oid,
                    readOnly: true,
                    actionData: {
                        selectData: options.sourceData,
                        dataStore:options.dataStore,
                        paramVOS: paramVOS
                    }
                }
            }
            portal.showTabByMenu('TabView_' + id, menuObject);
        }
 
        this.refresh = function () {
            var that = this;
 
        };
 
        this.destory = function () {
            var that = this;
            var filter = "View_" + that.id;
            $('#' + filter).remove()
        };
    };
    var cs = new Class();
    exports(cs.MODELNAME,cs);
});