3 changed files with 205 additions and 9 deletions
@ -0,0 +1,170 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<div class="tab-header webtop"> |
|||
<div>设置标签</div> |
|||
<div> |
|||
<el-button type="primary" size="small" @click="handleCreate()">保存</el-button> |
|||
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> |
|||
</div> |
|||
</div> |
|||
<div class="listconadd"> |
|||
<el-form ref="temp_form" :model="temp" label-position="right" class="formadd" :rules="rules"> |
|||
<el-row style="border-top: 1px solid #E0E3EB"> |
|||
<el-col :span="3" class="tleftb"> |
|||
<span>车型</span> |
|||
</el-col> |
|||
<el-col :span="21"> |
|||
<el-form-item> |
|||
<span>{{ temp.vehicleAlias }}</span> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="3" class="tleftb"> |
|||
<span>常用配置</span> |
|||
</el-col> |
|||
<el-col :span="21" class="tleftb_chang"> |
|||
<el-form-item> |
|||
<span>{{ temp.configName }}</span> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="3" class="tleftb"> |
|||
<span>更多配置</span> |
|||
</el-col> |
|||
<el-col :span="21" class="break_word"> |
|||
<el-form-item> |
|||
<span>{{ temp.otherConfig }}</span> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<div class="title"> |
|||
<div>标签列表</div> |
|||
<el-button type="primary" size="mini" class="btntopblueline" @click="handleAdd()">添加</el-button> |
|||
</div> |
|||
<el-table :key="tableKey" :data="temp.labelSid" :index="index" border style="width: 100%"> |
|||
<el-table-column fixed width="60px" label="序号" type="index" :index="index + 1" align="center"/> |
|||
<el-table-column fixed label="操作" width="190px" align="center" header-align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-button size="mini" type="danger" @click="dataDelete(scope.$index)">删除</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="标签名称" align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-select v-model="scope.row.labelSid" placeholder="请选择" filterable @change="changeActualPay($event, scope.row)"> |
|||
<el-option v-for="item in label_list" :key="item.sid" :label="item.labelName" :value="item.sid"></el-option> |
|||
</el-select> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
</el-form> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import {fetchBySid, fetchDetailsByOrgSid, fetchDetailsByVehModelSid, saveBiaoQian} from '@/api/cheliang/basemodelconfig' |
|||
|
|||
export default { |
|||
name: 'chexingpeizhibiaoqian', |
|||
data() { |
|||
return { |
|||
tableKey: 0, |
|||
index: 0, |
|||
label_list: [], |
|||
temp: { |
|||
sid: '', // 一条数据的sid |
|||
vehicleAlias: '', |
|||
configName: '', |
|||
otherConfig: '', |
|||
vehmodelConfigSid: '', |
|||
labelSid: [] |
|||
}, |
|||
rules: {} |
|||
} |
|||
}, |
|||
methods: { |
|||
showEdit(sid, useOrgSid) { |
|||
this.$nextTick(() => { |
|||
this.$refs['temp_form'].clearValidate() |
|||
}) |
|||
fetchBySid(sid).then(resp => { |
|||
if (resp.success) { |
|||
this.temp.vehicleAlias = resp.data.vehicleAlias |
|||
this.temp.configName = resp.data.configName |
|||
this.temp.otherConfig = resp.data.otherConfig |
|||
this.temp.sid = sid |
|||
this.temp.vehmodelConfigSid = sid |
|||
} |
|||
}) |
|||
fetchDetailsByOrgSid(useOrgSid).then((res) => { |
|||
if (res.success) { |
|||
this.label_list = res.data |
|||
} |
|||
}) |
|||
fetchDetailsByVehModelSid(sid).then((resp) => { |
|||
if (resp.success) { |
|||
this.temp.labelSid = resp.data.labelSid |
|||
} |
|||
}) |
|||
}, |
|||
handleAdd() { |
|||
this.temp.labelSid.push({ |
|||
labelName: '', |
|||
labelSid: '' |
|||
}) |
|||
}, |
|||
dataDelete(index) { |
|||
this.temp.labelSid.splice(index, 1) |
|||
}, |
|||
changeActualPay(value, row) { |
|||
const choose = this.label_list.filter((item) => item.sid === value) |
|||
row.labelName = choose[0].labelName |
|||
}, |
|||
// 返回 |
|||
handleReturn(isreload) { |
|||
if (isreload === 'true') this.$emit('reloadlist') |
|||
this.temp = { |
|||
sid: '', // 一条数据的sid |
|||
vehicleAlias: '', |
|||
configName: '', |
|||
otherConfig: '', |
|||
vehmodelConfigSid: '', |
|||
labelSid: [] |
|||
} |
|||
this.$emit('doback') |
|||
}, |
|||
// 保存修改数据 |
|||
handleCreate() { |
|||
this.$refs['temp_form'].validate(valid => { |
|||
if (valid) { |
|||
saveBiaoQian(this.temp).then(resp => { |
|||
if (resp.success) { |
|||
this.$message({ showClose: true, type: 'success', message: '保存成功' }) |
|||
this.handleReturn('true') |
|||
} |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.title { |
|||
padding: 7px; |
|||
display: flex; |
|||
flex-direction: row; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
} |
|||
.break_word { |
|||
word-wrap: break-word; |
|||
} |
|||
|
|||
.tleftb_chang .el-form-item /deep/ .el-form-item__content { |
|||
line-height: 20px; |
|||
} |
|||
</style> |
Loading…
Reference in new issue