songjun
2024-09-04 cc908053e0b5075fbfd27350b6da4b39bca9e550
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
@model sbcLabSystem.Models.Backstage.ShowPageViewModel
@{
    ViewBag.Title = "答案列表";
    Layout = "~/Views/Shared/Master.cshtml";
}
<script type="text/javascript">
    var viewModel;
    $(function () {
        viewModel = new myViewModel_AnswerPageInfo(@Html.Raw(Json.Encode(Model)));
        ko.applyBindings(viewModel, $(".container")[0]);
        viewModel.isInit(false)
    });
 
    function myViewModel_AnswerPageInfo(data) {
        var self = this;
        self.isInit = ko.observable(true);
        self.rootUrl = ko.pureComputed(function () {
            return "@Url.Action("AnswerManage", "Backstage")";
        }, self);
        self.switchPage = function (pageIndex) {
            if (pageIndex == self.PageNavInfo.PageIndex()) {
                return;
            }
            if (self.isInit() != true) {
                console.log("切换页" + pageIndex);
                location.href = "@Url.Action("AnswerList", "Backstage")" + "?qcDistributionId=" + self.QCDistInfo.Id() + "&pageIndex=" + pageIndex;
            }
        }
        this.searchOptions = ko.observableArray([
            { Value: 'LabCode', Text: '实验室代码' },
            { Value: 'LabName', Text: '实验室名称' }
        ]);
        this.selectList = ko.observable(data.selectList);
        this.searchField = ko.observable("");
        this.searchValue = ko.observable("");
        this.searchClick = function () {
            $.bootstrapLoading.start();
            DoAjaxPost("@Url.Action("AnswerListSearch", "Backstage")",
                JSON.stringify({
                    qcDistributionId: self.QCDistInfo.Id(),
                    pageIndex: 1,
                    searchField: self.searchField(),
                    searchValue: self.searchValue(),
                }), function (json) {
                    $.bootstrapLoading.end();
                    ko.mapping.fromJS(json, myViewModel_AnswerPageInfo.mapping, self);
                    $.messager.popup("搜索完成!");
                });
        }
        this.allSubmit = function () {
            $.messager.confirm("提示", "确认要将所有未提交状态的答卷强制提交吗?", function () {
                $.bootstrapLoading.start();
                DoAjaxPost("@Url.Action("DoSubmitAll", "Backstage")",
                    JSON.stringify({
                        qcDistributionId: self.QCDistInfo.Id()
                    }), function (json) {
                        $.bootstrapLoading.end();
                        $.messager.popup("全部强制提交完成!");
                        ko.mapping.fromJS(json, myViewModel_AnswerPageInfo.mapping, self);
                    });
            });
        }
        this.Statistics = function () {
            $.messager.confirm("提示", "确定完成本次答案报表数据统计?", function () {
                $.bootstrapLoading.start();
                DoAjaxPost("@Url.Action("DoStatistics", "Backstage")",
                    JSON.stringify({
                        qcDistributionId: self.QCDistInfo.Id()
                    }), function (json) {
 
                        $.bootstrapLoading.end();
                        $.messager.popup("报表数据统计完成!");
 
                    });
            });
        }
        this.DownloadsShow = function () {
           
            var selectLists=JSON.stringify(this.selectList());
           
            window.location.href = "@Url.Action("Quality_Excel", "Backstage")" + "?selectModel=" + selectLists;
          
        };
        ko.mapping.fromJS(data, myViewModel_AnswerPageInfo.mapping, self);
    }
    myViewModel_AnswerPageInfo.mapping = {
        'RegList': {
            create: function (options) {
                return new AnswerInfo(options.data);
            }
        }
    };
 
    function AnswerInfo(data) {
        var self = this;
        self.ExPort = function (data) {
 
            var info = ko.mapping.toJS(self);
            var form = $("<form>");   //定义一个form表单
            form.attr('style', 'display:none');   //在form表单中添加查询参数
            form.attr('target', '');
            form.attr('method', 'post');
            // form.attr('data', JSON.stringify(data));
            form.attr('action', "@Url.Action("ToExcel", "Backstage")");
 
            var input1 = $('<input>');
            input1.attr('type', 'hidden');
            input1.attr('name', 'model');
            input1.attr('value', info.Id);
            $('body').append(form);  //将表单放置在web中
            form.append(input1);   //将查询参数控件提交到表单上
            form.submit();
        }
        self.AnswerInfoUrl = ko.pureComputed(function () {
            return "@Url.Action("UserAnswerInfo","Backstage")" + "?qcDistributionId={0}&LabId={1}"
                .format(self.QCDistributionId(), self.LabId());
        }, self)
        self.ProjectIdString = ko.pureComputed(function () {
            return "{0}类项目".format(self.ProjectDescribeString());
        }, self);
        self.FontColorComputed = ko.pureComputed(function () {
            if (self.SubmitUserNo() != null) {
                return "text-danger";
            }
            else {
                return "text-info";
            }
        }, self);
        self.IsEndingString = ko.pureComputed(function () {
            if (self.IsEnding() == true) {
                return "是"
            }
            else {
                return "否"
            }
        }, self);
        self.LastPageModifyTimeString = ko.pureComputed(function () {
            if (self.LastPageModifyTime() == null) {
                return "";
            }
            else {
                return moment(self.LastPageModifyTime()).format("YYYY-MM-DD HH:mm:ss");
            }
        }, self);
        self.SubmitTimeString = ko.pureComputed(function () {
            if (self.SubmitTime() == null) {
                return "";
            }
            else {
                return moment(self.SubmitTime()).format("YYYY-MM-DD HH:mm:ss");
            }
        }, self);
        self.modifySubmitStatus = function (dataInfo) {
            if (self.IsSubmit() == false) {
                self.IsSubmit(true);
                self.SubmitUserNo("管理员");
            }
            else {
                self.IsSubmit(false);
                self.SubmitUserNo("");
            }
            DoAjaxPost("@Url.Action("SwitchSubmitState", "Backstage")",
                JSON.stringify(ko.mapping.toJS(self)),
                function (json) {
                    $.messager.popup("提交成功!");
                }, function () {
                    self.IsSubmit(false);
                });
        }
        console.debug(data.Scores);
        self.ScoreHtml = ko.pureComputed(function () {
            if (self.IsSubmit() == false || self.Scores() == null) {
                return "";
            }
            var score_ABO = 0;
            var score_Rhd = 0;
            var score_Filter = 0;
            var score_Identity = 0;
            var score_blood = 0;
            for (var i = 0; i < self.Scores().length; i++) {
                var scoreInfo = self.Scores()[i];
                if (scoreInfo.Name().substr(0, 3) == "ABO") {
                    score_ABO += scoreInfo.RealScore();
                }
                else if (scoreInfo.Name().substr(0, 2) == "RH") {
                    score_Rhd += scoreInfo.RealScore();
                }
                else if (scoreInfo.Name().substr(0, 6) == "Filter") {
                    score_Filter += scoreInfo.RealScore();
                }
                else if (scoreInfo.Name().substr(0, 8) == "Identity") {
                    score_Identity += scoreInfo.RealScore();
                }
                else if (scoreInfo.Name().substr(0, 7) == "Patient") {
                    score_blood += scoreInfo.RealScore();
                }
            }
            var html = '<p><span class="text-info">ABO分数:{0}</span></p>'.format(score_ABO);
            html += '<p><span class="text-info">RhD分数:{0}</span></p>'.format(score_Rhd);
            html += '<p><span class="text-info">抗体筛选分数:{0}</span></p>'.format(score_Filter);
            html += '<p><span class="text-info">抗体鉴定分数:{0}</span></p>'.format(score_Identity);
            html += '<p><span class="text-info">交叉配型分数:{0}</span></p>'.format(score_blood);
            return html;
        }, self);
        ko.mapping.fromJS(data, {}, self);
    }
 
</script>
<div class="container">
    <div class="row">
        <div class="col-xs-12">
            <ol class="breadcrumb">
                <li><a data-bind="attr:{href:rootUrl}">答案管理</a></li>
                <li class="active">质评答案列表</li>
            </ol>
        </div>
    </div>
 
    <div class="row" style="margin-top:10px;margin-bottom:10px;">
        <div class="col-lg-7 col-md-8 col-sm-8 col-xs-12">
            <div class="form-group" style="background:#0094ff">
                <div class="col-lg-2 col-md-2 col-sm-12 col-xs-12">
                    <label class="control-label">搜索条件:</label>
                </div>
                <div class="col-lg-4 col-md-5 col-sm-12 col-xs-12">
                    <select class="form-control"
                            data-bind="options:searchOptions,optionsValue:'Value',optionsText:'Text',value:searchField"></select>
                </div>
                <div class="col-lg-6 col-md-5 col-sm-12 col-xs-12">
                    <div class="col-lg-10 col-md-10 col-sm-12 col-xs-12">
                        <input class="form-control" data-bind="textInput:searchValue" />
                    </div>
                    <div class="col-lg-2 col-md-2 col-sm-12 col-xs-12">
                        <button class="btn btn-primary" data-bind="click:searchClick">搜索</button>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-12 pull-left">
            <!--ko if:QCDistInfo.IsSubmitAll()==false-->
            <button class="btn btn-danger pull-right" data-bind="click:allSubmit">全部强制提交</button>
            <!--/ko-->
            <!--ko if:QCDistInfo.IsSubmitAll()==true-->
            <span class="text-info">已全部强制提交!</span>
            <!--/ko-->
        </div>
        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-12 pull-right">
            <!--ko if:QCDistInfo.IsSubmitAll()==true-->
            <button class="btn btn-danger pull-right" data-bind="click:Statistics">报表数据计算反馈</button>
            <!--/ko--> 
            <!--ko if:QCDistInfo.IsSubmitAll()==false-->
            <span class="text-info"></span>
            <!--/ko-->
        </div>
        <div class="col-lg-1 col-md-1 col-sm-1 col-xs-12 ">
            <button class="btn btn-warning pull-right" data-toggle="modal" data-target="#myModal" >下载</button>
        </div>
    </div>
 
    <table class="table table-responsive table-bordered table-hover">
        <thead>
            <tr>
                <th>操作</th>
                <th>质评项目类别</th>
                <th>是否批阅</th>
                <th>实验室代码</th>
                <th>实验室名称</th>
                <th>最后保存时间</th>
                <th>提交时间</th>
                <th>管理员</th>
                <th>计分</th>
                <th>计分情况</th>
            </tr>
        </thead>
        <tbody data-bind="foreach:RegList">
            <tr>
                <td>
                    <a data-bind="attr:{href:AnswerInfoUrl},visible:IsSubmit()==true" href=""
                       class="btn btn-warning">查看</a>
                    <span data-bind="visible:IsSubmit()==false">未提交...</span>
                    <a data-bind="click:modifySubmitStatus" href="javascript:void(0);"
                       class="btn btn-info">修改提交状态</a>
                </td>
                <td>
                    <span data-bind="text:ProjectIdString,
                            css:{'text-success':SubmitUserNo()==null&&IsSubmit()==true,
                                'text-danger':SubmitUserNo()!=null&&IsSubmit()==true}"></span>
                </td>
                <td>
                    <span data-bind="text:IsEndingString,
                            css:{'text-success':SubmitUserNo()==null&&IsSubmit()==true,
                                'text-danger':SubmitUserNo()!=null&&IsSubmit()==true}"></span>
                </td>
                <td>
                    <span data-bind="text:LabCode,
                            css:{'text-success':SubmitUserNo()==null&&IsSubmit()==true,
                                'text-danger':SubmitUserNo()!=null&&IsSubmit()==true}"></span>
                </td>
                <td>
                    <span data-bind="text:CompanyName,
                            css:{'text-success':SubmitUserNo()==null&&IsSubmit()==true,
                                'text-danger':SubmitUserNo()!=null&&IsSubmit()==true}"></span>
                </td>
                <td>
                    <span data-bind="text:LastPageModifyTimeString,
                            css:{'text-success':SubmitUserNo()==null&&IsSubmit()==true,
                                'text-danger':SubmitUserNo()!=null&&IsSubmit()==true}"></span>
                </td>
                <td>
                    <span data-bind="text:SubmitTimeString,
                            css:{'text-success':SubmitUserNo()==null&&IsSubmit()==true,
                                'text-danger':SubmitUserNo()!=null&&IsSubmit()==true}"></span>
                </td>
                <td>
                    <span data-bind="text:SubmitUserNo,
                            css:{'text-success':SubmitUserNo()==null&&IsSubmit()==true,
                                'text-danger':SubmitUserNo()!=null&&IsSubmit()==true}"></span>
                </td>
                <td data-bind="html:ScoreHtml"></td>
                <td>
                    <!--ko if:IsCount()==true-->
                    <button class="btn btn-default" data-bind="click:ExPort">导出</button>
                    <!--/ko-->
                </td>
            </tr>
        </tbody>
    </table>
    <nav aria-label="Page navigation" data-bind="with:PageNavInfo">
        <ul class="pagination" data-bind="foreach:Pages">
            <li data-bind="if:$data==1">
                <a href="javascript:void(0);" aria-label="Previous" data-bind="click:function(data,event){$root.switchPage(1)}">
                    <span aria-hidden="true">&laquo;</span>
 
                </a>
            </li>
            <li data-bind="css:{active:$data==$parent.PageIndex()}"><a href="javascript:void(0);" data-bind="click:function(data,event){$root.switchPage($data)},text:$data"></a></li>
            <li data-bind="if:$data==$parent.LastPageIndex()">
                <a href="javascript:void(0);" aria-label="Next" data-bind="click:function(data,event){$root.switchPage($parent.LastPageIndex())}">
                    <span aria-hidden="true">&raquo;</span>'
                </a>
            </li>
        </ul>
        @*<div class="row" style="margin-top:20px;">
                <div class="col-xs-12">
                    <button class="btn btn-primary center-block" data-bind="click:$root.saveQCDistRegInfo">保存</button>
                </div>
            </div>*@
    </nav>
    <div id="myModal" class="modal fade" tabindex="-1" role="dialog">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">下载列表选择</h4>
                </div>
                <div class="modal-body" data-bind="with:selectList">
                    <label class="checkbox-inline">
                        <input type="checkbox" id="inlineCheckbox1" data-bind="checked:option1" > 1
                    </label>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="inlineCheckbox2" data-bind="checked:option2"> 2
                    </label>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="inlineCheckbox3" data-bind="checked:option3"> 3
                    </label>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="inlineCheckbox1" data-bind="checked:option4"> 4
                    </label>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="inlineCheckbox2" data-bind="checked:option5"> 5
                    </label>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="inlineCheckbox3" data-bind="checked:option6"> 6
                    </label>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="inlineCheckbox1" data-bind="checked:option7"> 7
                    </label>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="inlineCheckbox2" data-bind="checked:option8"> 8
                    </label>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="inlineCheckbox3" data-bind="checked:option9"> 9
                    </label>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="inlineCheckbox1" data-bind="checked:option10"> 10
                    </label>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="inlineCheckbox2" data-bind="checked:option11"> 11
                    </label>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="inlineCheckbox3" data-bind="checked:option12"> 12
                    </label>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" data-bind="click:DownloadsShow">确定下载</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
</div>