|
|
@@ -4,38 +4,23 @@ |
|
|
|
<el-col :span='12'> |
|
|
|
<el-form-item label="能源类型" prop="energyTypeId"> |
|
|
|
<el-select v-model="form.energyTypeId" placeholder="请选择" style="width: 100%;" filterable> |
|
|
|
<el-option |
|
|
|
v-for="item in this.energyTypeList" |
|
|
|
:key="item.id" |
|
|
|
:label="item.name" |
|
|
|
:value="item.id"> |
|
|
|
<el-option v-for="item in this.energyTypeList" :key="item.id" :label="item.name" :value="item.id"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span='12'> |
|
|
|
<el-form-item label="抄表日期" prop="recordTime"> |
|
|
|
<el-date-picker |
|
|
|
v-model="form.recordTime" |
|
|
|
type="date" |
|
|
|
format="yyyy-MM-dd" |
|
|
|
value-format="timestamp" |
|
|
|
placeholder="选择日期" |
|
|
|
style="width: 100%;"> |
|
|
|
<el-date-picker v-model="form.recordTime" type="date" format="yyyy-MM-dd" value-format="timestamp" |
|
|
|
placeholder="选择日期" style="width: 100%;"> |
|
|
|
</el-date-picker> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span='24'> |
|
|
|
<base-table |
|
|
|
border |
|
|
|
:table-props="tableProps" |
|
|
|
:table-data="tableData" |
|
|
|
:add-button-show="addButtonShow" |
|
|
|
@emitFun="inputChange" |
|
|
|
@emitButtonClick="emitButtonClick" |
|
|
|
/> |
|
|
|
<base-table border :table-props="tableProps" :table-data="tableData" :add-button-show="addButtonShow" |
|
|
|
@emitFun="inputChange" @emitButtonClick="emitButtonClick" /> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
@@ -48,15 +33,15 @@ import SelectArea from './SelectArea' |
|
|
|
const tableProps = [ |
|
|
|
{ |
|
|
|
prop: 'tableName', |
|
|
|
label: '表名', |
|
|
|
label: '表名*', |
|
|
|
subcomponent: SelectArea |
|
|
|
}, |
|
|
|
{ |
|
|
|
prop: 'readingQuantity', |
|
|
|
label: '抄表数', |
|
|
|
label: '抄表数*', |
|
|
|
subcomponent: InputArea |
|
|
|
} |
|
|
|
] |
|
|
|
] |
|
|
|
export default { |
|
|
|
name: 'EnergyQuantityManualAdd', |
|
|
|
props: { |
|
|
@@ -72,7 +57,7 @@ export default { |
|
|
|
return { |
|
|
|
tableProps, |
|
|
|
tableData: [], |
|
|
|
addButtonShow:'新增', |
|
|
|
addButtonShow: '新增', |
|
|
|
form: { |
|
|
|
id: '', |
|
|
|
energyTypeId: '', |
|
|
@@ -98,16 +83,16 @@ export default { |
|
|
|
obj.tableName = params.tableName + '' |
|
|
|
obj.readingQuantity = 0 |
|
|
|
this.tableData.push(obj) |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
this.isEdit = true |
|
|
|
this.form.id = params.id |
|
|
|
this.addButtonShow = '' |
|
|
|
energyQuantityManualGet({id: this.form.id}).then(res => { |
|
|
|
energyQuantityManualGet({ id: this.form.id }).then(res => { |
|
|
|
if (res.code === 0) { |
|
|
|
this.form.energyTypeId = res.data.energyTypeId |
|
|
|
this.form.recordTime = res.data.recordTime ? res.data.recordTime : null |
|
|
|
let obj = {} |
|
|
|
obj.tableName = res.data.tableName ? res.data.tableName+'' : '' |
|
|
|
obj.tableName = res.data.tableName ? res.data.tableName + '' : '' |
|
|
|
obj.readingQuantity = res.data.readingQuantity |
|
|
|
this.tableData.push(obj) |
|
|
|
} |
|
|
@@ -130,10 +115,10 @@ export default { |
|
|
|
if (this.tableData.length === 0) { |
|
|
|
this.$modal.msgError("抄表数据不能为空"); |
|
|
|
return false |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
for (let item of this.tableData) { |
|
|
|
console.log(item) |
|
|
|
if (!item.tableName || (!item.readingQuantity && item.readingQuantity!==0)) { |
|
|
|
if (!item.tableName || (!item.readingQuantity && item.readingQuantity !== 0)) { |
|
|
|
this.$modal.msgError("抄表数据有空值,请检查"); |
|
|
|
return false |
|
|
|
} |
|
|
@@ -142,11 +127,11 @@ export default { |
|
|
|
if (this.isEdit) { |
|
|
|
// 编辑 |
|
|
|
energyQuantityManualUpdate({ |
|
|
|
id:this.form.id, |
|
|
|
energyTypeId:this.form.energyTypeId, |
|
|
|
recordTime:this.form.recordTime, |
|
|
|
tableName:this.tableData[0].tableName, |
|
|
|
readingQuantity:this.tableData[0].readingQuantity |
|
|
|
id: this.form.id, |
|
|
|
energyTypeId: this.form.energyTypeId, |
|
|
|
recordTime: this.form.recordTime, |
|
|
|
tableName: this.tableData[0].tableName, |
|
|
|
readingQuantity: this.tableData[0].readingQuantity |
|
|
|
}).then((res) => { |
|
|
|
if (res.code === 0) { |
|
|
|
this.$modal.msgSuccess("操作成功"); |
|
|
@@ -155,9 +140,9 @@ export default { |
|
|
|
}) |
|
|
|
} else { |
|
|
|
energyQuantityManualCreate({ |
|
|
|
energyTypeId:this.form.energyTypeId, |
|
|
|
recordTime:this.form.recordTime, |
|
|
|
data:this.tableData |
|
|
|
energyTypeId: this.form.energyTypeId, |
|
|
|
recordTime: this.form.recordTime, |
|
|
|
data: this.tableData |
|
|
|
}).then((res) => { |
|
|
|
if (res.code === 0) { |
|
|
|
this.$modal.msgSuccess("操作成功"); |
|
|
|