代码同步 02.19

master
张博文 3 months ago
parent 4a9016f36f
commit ba00da66be

@ -63,7 +63,7 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="模板名称" prop="templateName"> <el-form-item label="模板名称" prop="templateName">
<el-input class="w100" v-model="form.templateName" :disabled="isDisable" placeholder="请输入检测报告模板名称" /> <el-input class="w100" v-model="form.templateName" :disabled="isDisable" placeholder="请输入检测报告模板名称" maxlength="64" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -71,33 +71,34 @@
<div class="flex-jend"> <div class="flex-jend">
<el-select v-model="tempId" placeholder="请先选择商户" class="w160 mr-10"> <el-select v-model="tempId" placeholder="请先选择商户" class="w160 mr-10">
<el-option <el-option
v-for="(item,index) in tempList" v-for="(item,index) in tempList"
:key="index" :key="index"
:label="item.templateName" :label="item.templateName"
:value="index"></el-option> :value="item.id"
/>
</el-select> </el-select>
<el-button :disabled="tempId!==undefined?false:true" @click="form.inspectionItems = tempList[tempId].inspectionItems">导入模板</el-button> <el-button :disabled="tempId!==undefined?false:true" @click="importTemplate"></el-button>
</div> </div>
<el-table class="mt20" :data="form.inspectionItems" style="width: 100%"> <el-table class="mt20" :data="form.inspectionItems" style="width: 100%">
<el-table-column <el-table-column
prop="inspectionItem" prop="inspectionItem"
label="检测项目"> label="检测项目">
<template v-slot="{ row }"> <template v-slot="{ row }">
<el-input class="w100" placeholder="请输入" v-model="row.inspectionItem"></el-input> <el-input class="w100" placeholder="请输入" v-model="row.inspectionItem" maxlength="64" ></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="inspectionUnit" prop="inspectionUnit"
label="单位"> label="单位">
<template v-slot="{ row }"> <template v-slot="{ row }">
<el-input class="w100" placeholder="请输入" v-model="row.inspectionUnit"></el-input> <el-input class="w100" placeholder="请输入" v-model="row.inspectionUnit" maxlength="64" ></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="inspectionRequire" prop="inspectionRequire"
label="技术要求"> label="技术要求">
<template v-slot="{ row }"> <template v-slot="{ row }">
<el-input class="w100" placeholder="请输入" v-model="row.inspectionRequire"></el-input> <el-input class="w100" placeholder="请输入" v-model="row.inspectionRequire" maxlength="255" ></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -228,6 +229,8 @@ export default {
}, },
/** 表单重置 */ /** 表单重置 */
reset() { reset() {
this.tempId = undefined;
this.tempList = [];
this.form = { this.form = {
id: undefined, id: undefined,
templateName: undefined, templateName: undefined,
@ -264,6 +267,7 @@ export default {
this.open = true; this.open = true;
this.title = "修改检测报告模板"; this.title = "修改检测报告模板";
this.isDisable = true; this.isDisable = true;
this.getTemplateList(this.form.belongBusinessId);
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
@ -312,28 +316,33 @@ export default {
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {});
}, },
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有检测报告模板数据项?').then(() => {
this.exportLoading = true;
return exportInspectionTemplateExcel(params);
}).then(response => {
this.$download.excel(response, '检测报告模板.xls');
this.exportLoading = false;
}).catch(() => {});
},
changeBusiness(e){ changeBusiness(e){
this.$nextTick(async () => { this.$nextTick(async () => {
let label = this.$refs.businessName.selected.label; let label = this.$refs.businessName.selected.label;
this.form.belongBusinessName = label; this.form.belongBusinessName = label;
let res = await getByBusinessId({businessId:e}); this.getTemplateList(e);
if(res.data) this.tempList = res.data; });
},
getTemplateList(businessId) {
getByBusinessId({ businessId }).then(({ data }) => {
this.tempList = data;
}); });
}, },
importTemplate() {
if (this.tempId === undefined) {
this.$message.error("请先选择模板");
return;
}
const template = this.tempList.find(item => item.id == this.tempId);
if (template) {
this.form.inspectionItems = template.inspectionItems.map(item => {
return {
...item,
id: undefined,
}
});
}
},
} }
}; };
</script> </script>

Loading…
Cancel
Save