能源类型
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<template>
|
||||
<el-form
|
||||
ref="form"
|
||||
label-width="100px"
|
||||
:model="form">
|
||||
<el-form-item
|
||||
label="能源类型"
|
||||
prop="energyType">
|
||||
<el-input v-model="form.energyType"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="能源表名"
|
||||
prop="tableIds">
|
||||
<el-select
|
||||
v-model="form.tableIds"
|
||||
placeholder="请选择"
|
||||
style="width: 100%"
|
||||
:multiple="true"
|
||||
filterable>
|
||||
<el-option
|
||||
v-for="dict in getDictDatas('table_name')"
|
||||
:key="dict.id"
|
||||
:label="dict.label"
|
||||
:value="dict.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
energyTableGet,
|
||||
energyTableUpdate,
|
||||
} from '@/api/base/energyQuantityManual';
|
||||
export default {
|
||||
name: 'TableNameConfigUpdate',
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
energyType: '',
|
||||
energyTypeId: '',
|
||||
tableIds: [],
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
energyTableGet({ energyTypeId: id }).then((res) => {
|
||||
this.form.energyType = res.data.energyType || '';
|
||||
this.form.energyTypeId = res.data.energyTypeId || '';
|
||||
this.form.tableIds = res.data.tableIds || [];
|
||||
});
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
// 编辑
|
||||
energyTableUpdate({ ...this.form }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$modal.msgSuccess('操作成功');
|
||||
this.$emit('successSubmit');
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
formClear() {
|
||||
this.form.energyType = '';
|
||||
this.form.energyTypeId = '';
|
||||
this.form.tableIds = [];
|
||||
this.isEdit = false;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
106
src/views/energy/base/tableNameConfig/index.vue
Normal file
106
src/views/energy/base/tableNameConfig/index.vue
Normal file
@@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 列表 -->
|
||||
<base-table
|
||||
:page="queryParams.pageNo"
|
||||
:limit="queryParams.pageSize"
|
||||
:table-props="tableProps"
|
||||
:table-data="list"
|
||||
:max-height="tableH">
|
||||
<method-btn
|
||||
v-if="tableBtn.length"
|
||||
slot="handleBtn"
|
||||
:width="80"
|
||||
label="操作"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick" />
|
||||
</base-table>
|
||||
<!-- 新增 -->
|
||||
<base-dialog
|
||||
dialogTitle="编辑"
|
||||
:dialogVisible="centervisible"
|
||||
@cancel="handleCancel"
|
||||
@confirm="handleConfirm"
|
||||
:before-close="handleCancel">
|
||||
<table-name-config-update
|
||||
ref="tableNameConfigU"
|
||||
@successSubmit="successSubmit" />
|
||||
</base-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { energyTablePage } from '@/api/base/energyQuantityManual';
|
||||
import { publicFormatter } from '@/utils/dict';
|
||||
import tableNameConfigUpdate from './components/tableNameConfigUpdate.vue';
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'energyType',
|
||||
label: '能源类型',
|
||||
width: 200,
|
||||
filter: publicFormatter('energy_type'),
|
||||
},
|
||||
{
|
||||
prop: 'tableName',
|
||||
label: '能源表名',
|
||||
},
|
||||
];
|
||||
export default {
|
||||
name: 'TableNameConfig',
|
||||
components: { tableNameConfigUpdate },
|
||||
data() {
|
||||
return {
|
||||
tableProps,
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi('base:table-name-config:edit')
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
}
|
||||
: undefined,
|
||||
].filter((v) => v),
|
||||
list: [],
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 100,
|
||||
},
|
||||
tableH: this.tableHeight(165),
|
||||
centervisible: false,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
energyTablePage({ ...this.queryParams }).then((res) => {
|
||||
let temp = res.data.list || [];
|
||||
this.list = temp.map((item) => {
|
||||
return {
|
||||
energyType: item.energyType,
|
||||
energyTypeId: item.energyTypeId,
|
||||
tableName: item.tables.join('、'),
|
||||
};
|
||||
});
|
||||
});
|
||||
},
|
||||
handleClick(val) {
|
||||
console.log('编辑');
|
||||
this.centervisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.tableNameConfigU.init(val.data.energyTypeId);
|
||||
});
|
||||
},
|
||||
handleCancel() {
|
||||
this.$refs.tableNameConfigU.formClear();
|
||||
this.centervisible = false;
|
||||
},
|
||||
handleConfirm() {
|
||||
this.$refs.tableNameConfigU.submitForm();
|
||||
},
|
||||
successSubmit() {
|
||||
this.handleCancel();
|
||||
this.getList();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user