能源
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
<template>
|
||||
<div class="tableInner">
|
||||
<!-- <el-input v-model="list[itemProp]" @blur="changeInput" /> -->
|
||||
<el-input-number v-model="list[itemProp]" @change="changeInput" :min="0" :max="999999999" style='width: 100%;' :controls='false' :precision='2'></el-input-number>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'InputArea',
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
itemProp: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: this.injectData
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeInput() {
|
||||
console.log(this.list)
|
||||
this.$emit('emitData', this.list)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.tableInner .el-input__inner {
|
||||
border: none;
|
||||
padding: 0;
|
||||
height: 33px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,44 +0,0 @@
|
||||
<template>
|
||||
<div class="tableInner">
|
||||
<el-select v-model="list[itemProp]" placeholder="请选择" style="width: 100%;" @change="changeSelect">
|
||||
<el-option
|
||||
v-for="item in getDictDatas(DICT_TYPE.TABLE_NAME)"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'SelectArea',
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
itemProp: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: this.injectData
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeSelect() {
|
||||
console.log(this.list)
|
||||
this.$emit('emitData', this.list)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.tableInner .el-input__inner {
|
||||
border: none;
|
||||
padding: 0;
|
||||
height: 33px;
|
||||
}
|
||||
</style>
|
||||
@@ -40,18 +40,10 @@
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<add-table
|
||||
:table-props="tableProps"
|
||||
:table-data="tableData"
|
||||
:table-name-list="tableNameList"
|
||||
@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>
|
||||
@@ -64,21 +56,7 @@ import {
|
||||
} from '@/api/base/energyQuantityManual';
|
||||
import moment from 'moment';
|
||||
import AddTable from './AddTable';
|
||||
import InputArea from './InputArea';
|
||||
import SelectArea from './SelectArea';
|
||||
import { energyTableGet } from '@/api/base/energyQuantityManual';
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'tableName',
|
||||
label: '表名*',
|
||||
subcomponent: SelectArea,
|
||||
},
|
||||
{
|
||||
prop: 'readingQuantity',
|
||||
label: '抄表数*',
|
||||
subcomponent: InputArea,
|
||||
},
|
||||
];
|
||||
export default {
|
||||
name: 'EnergyQuantityManualAdd',
|
||||
props: {
|
||||
@@ -92,7 +70,6 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableProps,
|
||||
tableData: [],
|
||||
tableNameList: [], //表名list
|
||||
addButtonShow: '新增',
|
||||
@@ -122,6 +99,7 @@ export default {
|
||||
} else if (params.type === 'meterReading') {
|
||||
this.isEdit = false;
|
||||
this.form.energyTypeId = params.energyTypeId;
|
||||
this.selEnergyType(this.form.energyTypeId);
|
||||
let obj = {};
|
||||
obj.tableName = params.tableName + '';
|
||||
obj.readingQuantity = 0;
|
||||
@@ -133,6 +111,7 @@ export default {
|
||||
energyQuantityManualGet({ id: this.form.id }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.form.energyTypeId = res.data.energyTypeId;
|
||||
this.selEnergyType(this.form.energyTypeId);
|
||||
this.form.recordTime = res.data.recordTime
|
||||
? res.data.recordTime
|
||||
: null;
|
||||
@@ -164,6 +143,11 @@ export default {
|
||||
this.tableNameList = [];
|
||||
energyTableGet({ energyTypeId: id }).then((res) => {
|
||||
this.tableNameList = res.data.tableObjs || [];
|
||||
if (this.tableNameList.length === 0) {
|
||||
this.$modal.msgWarning(
|
||||
'当前能源类型暂无配置表名,请先到《表名配置》页面配置'
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
submitForm() {
|
||||
|
||||
@@ -52,12 +52,12 @@ import { publicFormatter } from '@/utils/dict';
|
||||
import { parseTimeTable } from '@/utils/ruoyi';
|
||||
import EnergyQuantityManualAdd from './components/energyQuantityManualAdd';
|
||||
import moment from 'moment';
|
||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'energyType',
|
||||
prop: 'energyTypeLabel',
|
||||
label: '能源类型',
|
||||
minWidth: 110,
|
||||
filter: publicFormatter('energy_type'),
|
||||
showOverflowtooltip: true,
|
||||
},
|
||||
{
|
||||
@@ -142,7 +142,6 @@ export default {
|
||||
},
|
||||
],
|
||||
tableProps,
|
||||
tableH: this.tableHeight(260),
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 班次基础信息列表
|
||||
@@ -181,10 +180,8 @@ export default {
|
||||
};
|
||||
},
|
||||
components: { EnergyQuantityManualAdd },
|
||||
mixins: [tableHeightMixin],
|
||||
created() {
|
||||
window.addEventListener('resize', () => {
|
||||
this.tableH = this.tableHeight(260);
|
||||
});
|
||||
let end = moment(moment().format('YYYY-MM-DD 23:59:59')).valueOf();
|
||||
let start = moment(
|
||||
moment().subtract(7, 'days').format('YYYY-MM-DD 00:00:00')
|
||||
@@ -244,6 +241,11 @@ export default {
|
||||
? item.amount.toFixed(2)
|
||||
: ''
|
||||
: '';
|
||||
this.getDictDatas('energy_type').map((subItem) => {
|
||||
if (item.energyType === subItem.value) {
|
||||
item.energyTypeLabel = subItem.label;
|
||||
}
|
||||
});
|
||||
});
|
||||
this.list = arr;
|
||||
this.total = response.data.total;
|
||||
@@ -305,7 +307,7 @@ export default {
|
||||
handleDelete(row) {
|
||||
console.log(row.id);
|
||||
this.$modal
|
||||
.confirm('是否确认删除能源类型为"' + row.energyType + '"的数据项?')
|
||||
.confirm('是否确认删除能源类型为"' + row.energyTypeLabel + '"的数据项?')
|
||||
.then(function () {
|
||||
return energyQuantityManualDelete({ id: row.id });
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user