Commit 7d5977ab authored by 沈翠玲's avatar 沈翠玲

标签模版开发

parent 2abb9bce
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="模板" prop="templateId"> <el-form-item label="模板" prop="templateId">
<el-select v-model="form.templateId" placeholder="请选择模板" style="width: 100%"> <el-select v-model="form.templateId" placeholder="请选择模板" style="width: 100%" @change="templateChange">
<el-option <el-option
v-for="item in templateOptions" v-for="item in templateOptions"
:key="item.id" :key="item.id"
...@@ -259,15 +259,12 @@ ...@@ -259,15 +259,12 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="图片预览" prop="filePath"> <el-form-item label="模版图片" prop="filePath">
<ImageUpload <ImagePreview
:limit="1" :src="form.filePath"
:value="form.filePath" width="100px"
fieldName="filePath" height="100px"
:fileSize="5" ></ImagePreview>
@onUploaded="handleImgUploaded"
@onRemoved="handleImgRemoved"
></ImageUpload>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -353,13 +350,11 @@ export default { ...@@ -353,13 +350,11 @@ export default {
this.getList() this.getList()
}, },
methods: { methods: {
//图片上传成功 templateChange(){
handleImgUploaded(imgUrl, obj) { const item = this.templateOptions.find(v => v.id === this.form.templateId)
this.form[obj.$attrs.fieldName] = imgUrl; if (item) {
}, this.form.filePath = item.filePath || ''
//图片移除 }
handleImgRemoved(imgUrl, obj) {
this.form[obj.$attrs.fieldName] = null;
}, },
onItemSelected(obj) { onItemSelected(obj) {
if (obj != undefined && obj != null) { if (obj != undefined && obj != null) {
...@@ -469,6 +464,7 @@ export default { ...@@ -469,6 +464,7 @@ export default {
if(!row || !row.id) row = this.selectedRows[0] if(!row || !row.id) row = this.selectedRows[0]
this.reset() this.reset()
this.form = row this.form = row
this.templateChange()
this.open = true this.open = true
this.title = '修改客户产品标签模板对照表' this.title = '修改客户产品标签模板对照表'
}, },
......
...@@ -145,6 +145,17 @@ ...@@ -145,6 +145,17 @@
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item> </el-form-item>
<el-form-item label="模版图片" prop="filePath">
<ImageUpload
:limit="1"
:value="form.filePath"
fieldName="filePath"
:fileSize="5"
@onUploaded="handleImgUploaded"
@onRemoved="handleImgRemoved"
></ImageUpload>
<img src="" alt="">
</el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
...@@ -219,6 +230,14 @@ export default { ...@@ -219,6 +230,14 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
//图片上传成功
handleImgUploaded(imgUrl, obj) {
this.form[obj.$attrs.fieldName] = imgUrl;
},
//图片移除
handleImgRemoved(imgUrl, obj) {
this.form[obj.$attrs.fieldName] = null;
},
/** 查询模版管理列表 */ /** 查询模版管理列表 */
getList() { getList() {
this.loading = true; this.loading = true;
...@@ -240,6 +259,7 @@ export default { ...@@ -240,6 +259,7 @@ export default {
reset() { reset() {
this.form = { this.form = {
id: null, id: null,
filePath: null,
name: null, name: null,
content: null, content: null,
createTime: null, createTime: null,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment