This commit is contained in:
2024-07-22 10:42:32 +08:00
parent 6b1e74790b
commit a3f0288c92
6 changed files with 191 additions and 127 deletions

View File

@ -54,7 +54,7 @@ export default class InspectionWizard extends OptionBase {
super(opt);
}
async create() {
async create(asset) {
const option = this._option;
const loading = flag => this._var.popup.loading = flag;
const assetSelector = new AssetSelector({
@ -68,6 +68,7 @@ export default class InspectionWizard extends OptionBase {
loading,
requestTemplates: option.requestTemplates
});
this._var.templateSelector = templateSelector;
assetSelector.onSelected = asset => {
this._var.asset = asset;
this._var.template = null;
@ -127,24 +128,43 @@ export default class InspectionWizard extends OptionBase {
});
this._var.popup = popup;
popup.create();
this._changePage(0);
if (asset) {
this._changePage(1);
this._var.asset = asset;
templateSelector.assetId = asset.Id;
const footerButtons = popup.container.querySelectorAll('.ui-popup-footer>.ui-popup-button');
footerButtons[0].style.display = 'none';
}
else
this._changePage(0);
popup.rect = { width: 1220 };
const mask = await popup.show();
assetSelector.init();
return mask;
}
show() {
show(asset) {
if (this._var.popup == null) {
return this.create();
return this.create(asset);
}
if (asset) {
this._var.asset = asset;
this._var.template = null;
this._changePage(1);
this._var.templateSelector._var.el.inputSearch.value = '';
this._var.templateSelector.assetId = asset.Id;
const footerButtons = this._var.popup.container.querySelectorAll('.ui-popup-footer>.ui-popup-button');
footerButtons[0].style.display = 'none';
}
else {
this._changePage(0);
const selector = this._var.assetSelector;
selector._var.el.inputSearch.value = '';
selector._var.el.dropAssetGroup.select('-1');
selector._var.el.dropJobsite.select('-1');
selector._var.el.dropJobsiteCode.select('-1');
selector.refresh();
}
this._changePage(0);
const selector = this._var.assetSelector;
selector._var.el.inputSearch.value = '';
selector._var.el.dropAssetGroup.select('-1');
selector._var.el.dropJobsite.select('-1');
selector._var.el.dropJobsiteCode.select('-1');
selector.refresh();
return this._var.popup.show();
}