Browse Source

feat:[模板管理][update]

lkf
luojie 2 months ago
parent
commit
3aa9795425
2 changed files with 29 additions and 7 deletions
  1. +18
    -7
      src/components/Template/HandleFormItem.vue
  2. +11
    -0
      src/components/Template/mixins/formPackageMixins.js

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

@ -55,12 +55,14 @@
<el-upload ref="uploadRef" class="upload-demo" :action="uploadFileUrl" :on-preview="handlePreview"
:headers="headers"
:before-remove="beforeRemove"
:before-upload="beforeUpload"
:on-remove="handleRemove" multiple :limit="10"
:on-success="handleSuccess"
:on-change="handleChange"
:on-exceed="handleExceed" :file-list="fileList"
:auto-upload="false">
<el-button :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" size="small" type="primary">点击上传</el-button>
<span v-if="error" class = "atta-tips">请上传附件</span>
<div slot="tip" class="el-upload__tip">支持扩展名.rar .zip .doc .docx .pdf .jpg文件大小不超过2MB</div>
</el-upload>
</template>
@ -255,10 +257,13 @@ export default {
this.selectRegentInfo = data;
console.log(data,"yq")
},
//
beforeRemove(file) {
return this.$confirm(`确定移除 ${file.name}`)
beforeUpload(file){
return false;
},
// //
// beforeRemove(file) {
// return this.$confirm(` ${file.name} `)
// },
//
handleChange(file, fileList) {
// statusready
@ -350,8 +355,10 @@ export default {
this.$message.success(`文件 ${file.name} 已移除`);
},
handlePreview(file) {
if (file.url) {
window.open(process.env.VUE_APP_FILE_DOMAIN + file.url, '_blank');
console.log(file)
const url = file.url || file.response?.data?.url;
if (url) {
window.open(process.env.VUE_APP_FILE_DOMAIN + url, '_blank');
}
},
handleExceed(files, fileList) {
@ -472,7 +479,7 @@ export default {
preFill: "blue-border",//
}
//
if (this.error) {
if (this.error && this.type !== "attachment") {
return "error-border";
}
return typeObj[fillType] || ""
@ -1123,7 +1130,6 @@ export default {
}
}
.error-border {
.el-input-group__prepend,
@ -1267,4 +1273,9 @@ export default {
display: flex;
justify-content: flex-end;
}
.atta-tips {
color: #ff5d5d;
font-size: 12px;
margin-left: 5px;
}
</style>

+ 11
- 0
src/components/Template/mixins/formPackageMixins.js View File

@ -298,6 +298,17 @@ export default {
}
}
if(o.type === "attachment"){
const attValue = formFields[key];
if(!attValue || attValue == "[]"){
errors.push({
field: key,
label: o.label,
error: "请上传附件"
});
this.$set(this.errors, key, true);
}
}
if (this.isValueEmpty(formFields[key])) {
// 其他字段需要判断是否显示再校验
if (o.label === "template.common.other" && !this.isShowOther(formFields[o.parentKey])) {

Loading…
Cancel
Save