2023-04-28 12:22:26 +08:00

55 lines
3.0 KiB
JavaScript

define(['modules/templates/addtemplate'], function (AddTemplate) {
var q = function (ipt, inspect) {
this.inspect = inspect;
this.inspectmodule = ipt;
};
q.prototype.description = "Inspect";
q.prototype.version = "1.0.0.0";
q.prototype.createContent = function () {
var holder = $('<div class="question-holder"></div>');
holder.append('<div class="question-cell inspect-templatename" style="width:150px;margin-left:8px;"><span></span></div>');
holder.append('<div class="question-cell inspect-assetname" style="width:200px;"><span></span></div>');
holder.append('<div class="question-cell inspect-vin" style="width:200px;"><span></span></div>');
holder.append('<div class="question-cell inspect-make" style="width:150px;"><span></span></div>');
holder.append('<div class="question-cell inspect-model" style="width:150px;"><span></span></div>');
holder.append('<div class="question-cell inspect-type" style="width:150px;"><span></span></div>');
holder.append('<div class="question-cell inspect-status" style="width:120px;"><span></span></div>');
holder.append('<div class="question-cell inspect-committime" style="width:150px;"><span></span></div>');
holder.append('<div class="question-cell inspect-commituser" style="width:150px;"><span></span></div>');
var funcs = $('<div class="question-cell inspect-func" style="width:92px;text-align:right;padding-right:20px;"></div>');
holder.append(funcs);
var _this = this;
holder.find('.inspect-assetname span').click(function () {
window.open("report.aspx?rid=" + _this.inspect.Id, "_blank");
});
funcs.append($('<em class="spanbtn icondetail"></em>').click(function () {
window.open("report.aspx?rid=" + _this.inspect.Id, "_blank");
}).attr('title', 'Detail'));
this.holder = holder;
if (this.inspect != null) {
this.updateContent(this.inspect);
}
return holder;
};
q.prototype.updateContent = function (inspect) {
if (this.inspect != inspect) {
this.inspect = inspect;
}
this.holder.find('.inspect-assetname span').text(inspect.AssetName);
this.holder.find('.inspect-vin span').text(inspect.VIN);
this.holder.find('.inspect-make span').text(inspect.MakeName);
this.holder.find('.inspect-model span').text(inspect.ModelName);
this.holder.find('.inspect-type span').text(inspect.TypeName);
this.holder.find('.inspect-templatename span').text(inspect.TemplateName);
var statustext = '';
if (inspect.Status == 0)
statustext = 'Draft';
else if (inspect.Status == 1)
statustext = 'Committed';
this.holder.find('.inspect-status span').text(statustext);
this.holder.find('.inspect-committime span').text(inspect.CommitTimeLocalStr);
this.holder.find('.inspect-commituser span').text(inspect.CommitedByUserName);
};
return q;
});