Browse Source

feat:[模板管理][update]

lkf
luojie 2 months ago
parent
commit
a800745891
4 changed files with 26 additions and 30 deletions
  1. +1
    -1
      src/components/Template/BaseInfoFormPackage.vue
  2. +22
    -18
      src/components/Template/HandleFormItem.vue
  3. +0
    -8
      src/utils/conConverter.js
  4. +3
    -3
      src/views/business/comps/template/comps/sp/SP00456.vue

+ 1
- 1
src/components/Template/BaseInfoFormPackage.vue View File

@ -70,7 +70,7 @@
</div> </div>
</template> </template>
<template v-else-if="item.type === 'cellItem'"> <template v-else-if="item.type === 'cellItem'">
<div class="form-item ">
<div class="form-item " :class="sItem.span == 1 ? 'full-row' : ''">
<div class="form-title fs-16" v-if="item.label">{{ $t( item.label) }}</div> <div class="form-title fs-16" v-if="item.label">{{ $t( item.label) }}</div>
<div class="grid-container gap2"> <div class="grid-container gap2">
<div v-for="(sItem, key) in item.config" class="c-Item" :class="getSpanClass(sItem)" :key="key"> <div v-for="(sItem, key) in item.config" class="c-Item" :class="getSpanClass(sItem)" :key="key">

+ 22
- 18
src/components/Template/HandleFormItem.vue View File

@ -54,10 +54,11 @@
<template v-else-if="type === 'attachment'"> <template v-else-if="type === 'attachment'">
<el-upload class="upload-demo" :action="uploadFileUrl" :on-preview="handlePreview" <el-upload class="upload-demo" :action="uploadFileUrl" :on-preview="handlePreview"
:headers="headers" :headers="headers"
:on-remove="handleRemove" :before-remove="beforeRemove" multiple :limit="10"
:on-remove="handleRemove" multiple :limit="10"
:on-success="handleSuccess" :on-success="handleSuccess"
:before-upload="beforeUpload"
:on-exceed="handleExceed" :file-list="fileList"> :on-exceed="handleExceed" :file-list="fileList">
<el-button size="small" type="primary">点击上传</el-button>
<el-button :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">支持扩展名.rar .zip .doc .docx .pdf .jpg</div> <div slot="tip" class="el-upload__tip">支持扩展名.rar .zip .doc .docx .pdf .jpg</div>
</el-upload> </el-upload>
</template> </template>
@ -296,28 +297,31 @@ export default {
handlePreview(file) { handlePreview(file) {
// //
if (file.url) { if (file.url) {
const fileType = file.type || file.name.split('.').pop().toLowerCase();
const imageTypes = ['jpg', 'jpeg', 'png', 'gif', 'bmp'];
if (imageTypes.includes(fileType)) {
//
window.open(process.env.VUE_APP_FILE_DOMAIN + file.url, '_blank');
} else {
//
const link = document.createElement('a');
link.href = file.url;
link.download = file.name;
link.target = '_blank';
link.click();
}
window.open(process.env.VUE_APP_FILE_DOMAIN + file.url, '_blank');
} }
}, },
//
beforeUpload(file) {
console.log(file,"fff")
const isAllowedType = ['image/jpeg', 'image/png', 'image/gif', 'application/pdf'].includes(file.type)
const isLt2M = file.size / 1024 / 1024 < 2
if (!isAllowedType) {
this.$message.error('只能上传 JPG/PNG/GIF/PDF 格式的文件!')
return false
}
if (!isLt2M) {
this.$message.error('文件大小不能超过 2MB!')
return false
}
return true
},
handleExceed(files, fileList) { handleExceed(files, fileList) {
this.$message.warning(`当前限制选择 10 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`); this.$message.warning(`当前限制选择 10 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
}, },
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
// //
onMixReagentSubmit(data) { onMixReagentSubmit(data) {
if (data.uuid !== this.uuid) return; if (data.uuid !== this.uuid) return;

+ 0
- 8
src/utils/conConverter.js View File

@ -172,12 +172,4 @@ class ConcentrationConverter {
} }
} }
} }
// 将静态方法绑定到实例上,以便可以直接通过实例调用
export const convertConcentration = new ConcentrationConverter(); export const convertConcentration = new ConcentrationConverter();
// // 将静态方法复制到实例上
// converterInstance.convert = ConcentrationConverter.convert.bind(ConcentrationConverter);
// converterInstance.convertAll = ConcentrationConverter.convertAll.bind(ConcentrationConverter);
// converterInstance.isSupportedUnit = ConcentrationConverter.isSupportedUnit.bind(ConcentrationConverter);
// export const convertConcentration = converterInstance;

+ 3
- 3
src/views/business/comps/template/comps/sp/SP00456.vue View File

@ -376,12 +376,12 @@ export default {
if (type === 'ladder') { if (type === 'ladder') {
const tableRef = this.$refs[`ladderStepTableRef_${configIndex}`]; const tableRef = this.$refs[`ladderStepTableRef_${configIndex}`];
if (tableRef) { if (tableRef) {
tableRef.deleteRow(rowIndex);
tableRef[0].deleteRow(rowIndex);
} }
} else if (type === 'paralle') { } else if (type === 'paralle') {
const tableRef = this.$refs[`paralleStepTableRef_${configIndex}`]; const tableRef = this.$refs[`paralleStepTableRef_${configIndex}`];
if (tableRef) { if (tableRef) {
tableRef.deleteRow(rowIndex);
tableRef[0].deleteRow(rowIndex);
} }
} }
}, },
@ -425,7 +425,7 @@ export default {
this.$refs[`paralleStepTableRef_${configIndex}`][0]?.updateDataSourceByRowIndex(rowIndex, { this.$refs[`paralleStepTableRef_${configIndex}`][0]?.updateDataSourceByRowIndex(rowIndex, {
actSolutionVolume: volResult.actVol, actSolutionVolume: volResult.actVol,
actSolutionConcentration: volResult.actNd, actSolutionConcentration: volResult.actNd,
}, "blur");
});
} }
} }

Loading…
Cancel
Save