taskid:099 remark:"commit"
This commit is contained in:
@@ -83,7 +83,7 @@
|
||||
},
|
||||
{
|
||||
title: '计量单位',
|
||||
dataIndex: 'unit',
|
||||
dataIndex: 'unitName',
|
||||
},
|
||||
{
|
||||
title: '加权平均',
|
||||
|
@@ -214,7 +214,9 @@
|
||||
const wrapperCol = { span: 19 };
|
||||
const switchLabelCol = { span: 10 };
|
||||
const switchWrapperCol = { span: 14 };
|
||||
const formState = ref({})
|
||||
const formState = ref({
|
||||
orgId: orgId.value,
|
||||
})
|
||||
// 定义form表单的必填
|
||||
const rules: Record<string, Rule[]> = {
|
||||
energyType: [{ required: true, message: '请输入能源种类', trigger: 'change' }],
|
||||
@@ -289,8 +291,8 @@
|
||||
},
|
||||
{
|
||||
title: '计量单位',
|
||||
className: 'unit',
|
||||
dataIndex: 'unit',
|
||||
className: 'unitName',
|
||||
dataIndex: 'unitName',
|
||||
},
|
||||
{
|
||||
title: '全年',
|
||||
@@ -361,9 +363,9 @@
|
||||
getDictList()
|
||||
visible.value = true
|
||||
fetch(energyConsumption.findById , {id : record.id }).then((res) => {
|
||||
if(res.data.unit){
|
||||
res.data.unit = res.data.unit.split(',')
|
||||
}
|
||||
// if(res.data.unit){
|
||||
// res.data.unit = res.data.unit.split(',')
|
||||
// }
|
||||
formState.value = res.data
|
||||
});
|
||||
},
|
||||
@@ -423,12 +425,14 @@
|
||||
.then(() => {
|
||||
console.log('values', formState, toRaw(formState));
|
||||
if(formState.value.unit){
|
||||
formState.value.unit = formState.value.unit.join(',')
|
||||
formState.value.unit = formState.value.unit.join(',').split(',')[1]
|
||||
}
|
||||
if(formState.value.id){
|
||||
fetch(energyConsumption.update , formState.value).then((res) => {
|
||||
visible.value = false
|
||||
formState.value = {}
|
||||
formState.value = {
|
||||
orgId: orgId.value,
|
||||
}
|
||||
message.success('操作成功!');
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
});
|
||||
@@ -439,7 +443,9 @@
|
||||
NsMessage.warning(res.data);
|
||||
}else{
|
||||
visible.value = false
|
||||
formState.value = {}
|
||||
formState.value = {
|
||||
orgId: orgId.value,
|
||||
}
|
||||
message.success('操作成功!');
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
}
|
||||
@@ -491,8 +497,8 @@
|
||||
getDictList()
|
||||
visible.value = true
|
||||
fetch(energyConsumption.findById , {id : record.id }).then((res) => {
|
||||
if(res.data.unit){
|
||||
res.data.unit = res.data.unit.split(',')
|
||||
if(res.data.unitName){
|
||||
res.data.unitName = res.data.unitName.split(',')
|
||||
}
|
||||
formState.value = res.data
|
||||
});
|
||||
@@ -519,7 +525,9 @@
|
||||
// 关闭新增抽屉
|
||||
const onClose = () => {
|
||||
visible.value = false;
|
||||
formState.value = {}
|
||||
formState.value = {
|
||||
orgId: orgId.value,
|
||||
}
|
||||
formRef.value.resetFields();
|
||||
};
|
||||
// 点击上传凭证按钮
|
||||
|
@@ -319,11 +319,11 @@
|
||||
label: '编辑',
|
||||
name: 'userEdit',
|
||||
handle: (record: any) => {
|
||||
selectedRowKeys.value = [record.carbonId];
|
||||
selectedRowKeys.value = [record.factorId];
|
||||
formState.value.id = record.id
|
||||
formState.value.emissionFactors = record.emissionFactors
|
||||
formState.value.dateRange = [record.startTime, record.endTime];
|
||||
formState.value.carbonId = record.carbonId
|
||||
formState.value.factorId = record.factorId
|
||||
visible.value = true
|
||||
getNewTable()
|
||||
},
|
||||
@@ -375,7 +375,7 @@
|
||||
const onSelectionChange = (selectedKeys, selectedRows) => {
|
||||
selectedRowKeys.value = selectedKeys;
|
||||
formState.value.emissionFactors = selectedRows[0].emissionFactors
|
||||
formState.value.carbonId = selectedRows[0].id
|
||||
formState.value.factorId = selectedRows[0].id
|
||||
};
|
||||
const queryData = ref({
|
||||
orgId: orgId.value,
|
||||
@@ -390,11 +390,11 @@
|
||||
};
|
||||
// 点击编辑按钮
|
||||
const editData = (record) =>{
|
||||
selectedRowKeys.value = [record.carbonId];
|
||||
selectedRowKeys.value = [record.factorId];
|
||||
formState.value.id = record.id
|
||||
formState.value.emissionFactors = record.emissionFactors
|
||||
formState.value.dateRange = [record.startTime, record.endTime];
|
||||
formState.value.carbonId = record.carbonId
|
||||
formState.value.factorId = record.factorId
|
||||
visible.value = true
|
||||
getNewTable()
|
||||
};
|
||||
|
Reference in New Issue
Block a user