This commit is contained in:
2024-02-01 14:24:12 +08:00
parent 21dc0412e3
commit 1bbd9b1e3a
14 changed files with 277 additions and 34 deletions

View File

@@ -93,7 +93,12 @@
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-col :span="12">
<el-form-item label="是否推送" prop="push">
<el-switch v-model="form.push"></el-switch>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="描述" prop="description">
<el-input v-model="form.description"></el-input>
</el-form-item>
@@ -149,7 +154,8 @@ export default {
code: '',
nuit: '',
pricingMethod: 2,
leaderName: ''
leaderName: '',
push: false
},
isEdit: false, //是否是编辑
rules: {
@@ -178,18 +184,24 @@ export default {
this.form.id = id
getEnergyType( id ).then((res) => {
if (res.code === 0) {
this.form = res.data
this.form.name = res.data.name
this.form.code = res.data.code
this.form.nuit = res.data.nuit
this.form.pricingMethod = res.data.pricingMethod
this.form.leaderName = res.data.leaderName
this.form.push = res.data.push ? true : false
switch(this.form.pricingMethod) {
case 0:
this.tableData1 = this.form.segPriceList
this.tableData1 = this.form.segPriceList || []
break;
case 1:
this.tableData2 = this.form.usedPriceList
this.tableData2 = this.form.usedPriceList || []
break;
default:
}
}
})
console.log(this.form)
} else {
this.isEdit = false
this.form.id = ''
@@ -288,6 +300,7 @@ export default {
return false
}
}
console.log(this.form)
if (this.isEdit) {
// 编辑
updateEnergyType({
@@ -300,7 +313,8 @@ export default {
dim: this.form.pricingMethod === 1 ? this.form.dim: '',
singlePrice: this.form.pricingMethod === 2 ? this.form.singlePrice : '',
segPriceList: this.form.pricingMethod === 0 ? this.tableData1: [],
usedPriceList: this.form.pricingMethod === 1 ? this.tableData2: []
usedPriceList: this.form.pricingMethod === 1 ? this.tableData2: [],
push:this.form.push ? 1 : 0
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
@@ -317,7 +331,8 @@ export default {
dim: this.form.pricingMethod === 1 ? this.form.dim: '',
singlePrice: this.form.pricingMethod === 2 ? this.form.singlePrice : '',
segPriceList: this.form.pricingMethod === 0 ? this.tableData1: [],
usedPriceList: this.form.pricingMethod === 1 ? this.tableData2: []
usedPriceList: this.form.pricingMethod === 1 ? this.tableData2: [],
push:this.form.push ? 1 : 0
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");

View File

@@ -52,7 +52,8 @@ const tableProps = [
{
prop: 'code',
label: '类型编码',
showOverflowtooltip: true
showOverflowtooltip: true,
minWidth: 150
},
{
prop: 'name',
@@ -67,6 +68,11 @@ const tableProps = [
prop: 'pricingMethod',
label: '计价方式'
},
{
prop: 'push',
label: '是否推送',
filter: publicFormatter('push')
},
{
prop: 'price',
label: '价格(元)',