|
|
@ -15,7 +15,7 @@ |
|
|
|
<el-form :model="dataForm" :rules="dataRule" label-width="110px" ref="dataForm" size="mini"> |
|
|
|
<el-row :gutter="24"> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="所属类别" v-if="type == 'template' && mode!='toDevice'"> |
|
|
|
<el-form-item label="所属类别" v-if="type == 'template' && mode!='toDevice'" prop="category"> |
|
|
|
<el-select v-model="dataForm.category" placeholder="请选择所属类别" size="mini"> |
|
|
|
<el-option v-for="item in templateCategoryList" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"> |
|
|
|
</el-option> |
|
|
@ -90,7 +90,7 @@ |
|
|
|
</el-card> |
|
|
|
|
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
<el-button @click="onSubmit" v-loading="loading" style="background-color: #10aac2;color:#fff;">确认</el-button> |
|
|
|
<el-button @click="onSubmit('dataForm')" v-loading="loading" style="background-color: #10aac2;color:#fff;">确认</el-button> |
|
|
|
<el-button style="background-color:#b5b5b6;color:#fff" @click="onClose">取消</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
@ -160,6 +160,13 @@ export default { |
|
|
|
message: '请输入详细内容', |
|
|
|
trigger: 'blur' |
|
|
|
} |
|
|
|
], |
|
|
|
category: [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: '请选择类别', |
|
|
|
trigger: 'blur' |
|
|
|
} |
|
|
|
] |
|
|
|
}, |
|
|
|
screenSizeOptions: [], |
|
|
@ -271,6 +278,9 @@ export default { |
|
|
|
if(this.$refs.dataForm){ |
|
|
|
this.$refs.dataForm.clearValidate(); |
|
|
|
} |
|
|
|
// if(newV){ |
|
|
|
// this.initData(); |
|
|
|
// } |
|
|
|
}, |
|
|
|
immediate:true |
|
|
|
}, |
|
|
@ -280,7 +290,8 @@ export default { |
|
|
|
tpl:{ |
|
|
|
handler(newV){ |
|
|
|
// { "id": 3, "category": "0", "content": "保持车距,控制车速", "screenSize": "768*64", "fontColor": "FFFF00", "fontSize": "64", "fontType": "2", "fontSpacing": "0", "rollingSpeed": null, "stopTime": "50", "inScreenMode": "1", "formatStyle": "2", "remark": null, "createTime": "2024-01-06 10:40:19", "updateTime": "2024-01-06 11:04:53" } |
|
|
|
if(newV && Object.keys(newV).length>0){ |
|
|
|
|
|
|
|
if(newV && Object.keys(newV).length>0){ //防止关闭对话框时触发 |
|
|
|
this.initData(); |
|
|
|
} |
|
|
|
}, |
|
|
@ -290,6 +301,11 @@ export default { |
|
|
|
handler(newV) { |
|
|
|
this.initData(); |
|
|
|
} |
|
|
|
}, |
|
|
|
"type": { |
|
|
|
handler(newV) { |
|
|
|
this.initData(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
@ -313,14 +329,17 @@ export default { |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
initData() { |
|
|
|
console.log("调用initData+++++++"); |
|
|
|
if(this.isLocked){ |
|
|
|
return |
|
|
|
} |
|
|
|
this.isLocked = true; |
|
|
|
setTimeout(()=>{this.isLocked = false}, 300); |
|
|
|
setTimeout(()=>{this.isLocked = false}, 100); |
|
|
|
|
|
|
|
// getTemplateList({id:this.tpl.id}).then(res=>{ |
|
|
|
// console.log(res.data , "++++++++==========="); |
|
|
|
// }) |
|
|
|
|
|
|
|
if (this.mode == "add") { |
|
|
|
let tempTpl = null; |
|
|
|
if (this.type == "template") { |
|
|
@ -351,7 +370,22 @@ export default { |
|
|
|
this.dialogVisible = false; |
|
|
|
}, |
|
|
|
// 表单提交 |
|
|
|
async onSubmit() { |
|
|
|
async onSubmit(formName) { |
|
|
|
|
|
|
|
// this.$refs[formName].validate((valid) => { |
|
|
|
// if (valid) { |
|
|
|
|
|
|
|
// } else { |
|
|
|
// console.log('格式不正确!!'); |
|
|
|
// return false; |
|
|
|
// } |
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
|
|
if (this.type=="template" && this.dataForm.category == undefined) { |
|
|
|
return this.$modal.msgError('请选择分类!') |
|
|
|
} |
|
|
|
|
|
|
|
if (!this.dataForm.content.trim()) { |
|
|
|
return this.$modal.msgError('当前输入内容为空') |
|
|
|
} |
|
|
|