Merge branch 'master' of http://47.115.223.229:8888/yangjun/hldy_yunwei_vue
# Conflicts: # src/views/iot/hs/electricity/components/DrawerModal.vue # src/views/iot/hs/electricity/index.vue
This commit is contained in:
commit
0a3937808e
|
|
@ -5,15 +5,15 @@
|
||||||
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
|
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
|
||||||
<a-button type="primary" @click="handleOk" v-if="!disableSubmit">确认</a-button>
|
<a-button type="primary" @click="handleOk" v-if="!disableSubmit">确认</a-button>
|
||||||
</template>
|
</template>
|
||||||
<ElectricityInfoDrawer v-if="visible" ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit"
|
<ElectricityInfoForm v-if="visible" ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit"
|
||||||
:formBpm="false">
|
:formBpm="false">
|
||||||
</ElectricityInfoDrawer>
|
</ElectricityInfoForm>
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, nextTick, defineExpose } from 'vue';
|
import { ref, nextTick, defineExpose } from 'vue';
|
||||||
import ElectricityInfoDrawer from './ElectricityInfoForm.vue'
|
import ElectricityInfoForm from './ElectricityInfoForm.vue'
|
||||||
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||||
|
|
||||||
const title = ref<string>('');
|
const title = ref<string>('');
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
import { getValueType } from '/@/utils';
|
import { getValueType } from '/@/utils';
|
||||||
import { save } from '../electricity.api';
|
import { save } from '../electricity.api';
|
||||||
import { Form } from 'ant-design-vue';
|
import { Form } from 'ant-design-vue';
|
||||||
|
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
formDisabled: { type: Boolean, default: false },
|
formDisabled: { type: Boolean, default: false },
|
||||||
|
|
@ -121,13 +122,8 @@ async function submitForm() {
|
||||||
}
|
}
|
||||||
await save(model)
|
await save(model)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.success) {
|
|
||||||
createMessage.success(res.message);
|
|
||||||
emit('ok');
|
emit('ok');
|
||||||
} else {
|
}).catch(() =>{})
|
||||||
createMessage.warning(res.message);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
confirmLoading.value = false;
|
confirmLoading.value = false;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ enum Api {
|
||||||
save = '/iot/hs/dsElectricityMeter/add',
|
save = '/iot/hs/dsElectricityMeter/add',
|
||||||
delete = '/iot/hs/dsElectricityMeter/delete',
|
delete = '/iot/hs/dsElectricityMeter/delete',
|
||||||
eleReset = '/iot/hs/dsElectricityMeter/eleReset',
|
eleReset = '/iot/hs/dsElectricityMeter/eleReset',
|
||||||
eleCutOff = '/iot/hs/dsElectricityMeter/eleControl',
|
eleCutOff = '/iot/hs/dsElectricityMeter/eleCutOff',
|
||||||
eleConnected = '/iot/hs/dsElectricityMeter/eleControl',
|
eleConnected = '/iot/hs/dsElectricityMeter/eleConnected',
|
||||||
eleRead = '/iot/hs/dsElectricityMeter/eleRead',
|
eleRead = '/iot/hs/dsElectricityMeter/eleRead',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -20,13 +20,13 @@ export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||||
* 添加
|
* 添加
|
||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
export const save = (params) => defHttp.post({ url: Api.save, params });
|
export const save = (params) => defHttp.post({ url: Api.save, params }, { joinParamsToUrl: true });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
export const deleteMeter = (id) => defHttp.delete({ url: Api.delete, params:{ id } }, { joinParamsToUrl: true });
|
export const deleteMeter = (id) => defHttp.post({ url: Api.delete, params:{ id } });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电表清零
|
* 电表清零
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,13 @@ export const columns: BasicColumn[] = [
|
||||||
align: "center",
|
align: "center",
|
||||||
dataIndex: 'relayState',
|
dataIndex: 'relayState',
|
||||||
customRender:({record})=>{
|
customRender:({record})=>{
|
||||||
return record.relayState?(record.relayState=='1'?'合闸':'拉闸'):'';
|
if(record.relayState=='1'){
|
||||||
|
return "合闸";
|
||||||
|
}else if(record.relayState=='0'){
|
||||||
|
return "拉闸";
|
||||||
|
}else{
|
||||||
|
return "未知";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,16 @@
|
||||||
</template>
|
</template>
|
||||||
<template #bodyCell="{ column, record, index, text }">
|
<template #bodyCell="{ column, record, index, text }">
|
||||||
<template v-if="column.dataIndex === 'relayState'">
|
<template v-if="column.dataIndex === 'relayState'">
|
||||||
<span v-if="record.relayState ==='1'" style="color:green">
|
<span v-if="record.relayState ==null||record.relayState ===''" style="color:red">
|
||||||
合闸
|
未知
|
||||||
</span>
|
</span>
|
||||||
<span v-else style="color:red">
|
<span v-else>
|
||||||
拉闸
|
<span v-if="record.relayState ==='1'" style="color:green">
|
||||||
|
合闸
|
||||||
|
</span>
|
||||||
|
<span v-if="record.relayState ==='0'" style="color:red">
|
||||||
|
合闸
|
||||||
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -43,11 +48,10 @@
|
||||||
import { useListPage } from '/@/hooks/system/useListPage';
|
import { useListPage } from '/@/hooks/system/useListPage';
|
||||||
import { useUserStore } from '/@/store/modules/user';
|
import { useUserStore } from '/@/store/modules/user';
|
||||||
import {Modal} from "ant-design-vue";
|
import {Modal} from "ant-design-vue";
|
||||||
import {list, deleteMeter, eleReset, eleCutOff, eleConnected, eleRead} from './electricity.api';
|
import {list, save, deleteMeter, eleReset, eleCutOff, eleConnected, eleRead} from './electricity.api';
|
||||||
import { columns, searchFormSchema } from './electricity.data';
|
import { columns, searchFormSchema } from './electricity.data';
|
||||||
import {useModal} from "@/components/Modal";
|
import {useModal} from "@/components/Modal";
|
||||||
import ApiLogModal from "/@/views/iot/tq/electricity/apilog/ApiLogModal.vue";
|
import ApiLogModal from "./apilog/ApiLogModal.vue";
|
||||||
|
|
||||||
import DrawerModal from "./components/DrawerModal.vue";
|
import DrawerModal from "./components/DrawerModal.vue";
|
||||||
import { defHttp } from '/@/utils/http/axios';
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
|
||||||
|
|
@ -66,7 +70,7 @@
|
||||||
api: list,
|
api: list,
|
||||||
columns,
|
columns,
|
||||||
canResize:false,
|
canResize:false,
|
||||||
showIndexColumn: true,
|
// showIndexColumn: true,
|
||||||
formConfig: {
|
formConfig: {
|
||||||
//labelWidth: 120,
|
//labelWidth: 120,
|
||||||
schemas: searchFormSchema,
|
schemas: searchFormSchema,
|
||||||
|
|
@ -114,7 +118,11 @@
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: '删除',
|
label: '删除',
|
||||||
onClick: handleRead.bind(null, record),
|
popConfirm: {
|
||||||
|
title: '是否确认删除数据',
|
||||||
|
confirm: handleDelete.bind(null, record),
|
||||||
|
placement: 'topLeft',
|
||||||
|
},
|
||||||
ifShow: record.izAllocate != 'Y',
|
ifShow: record.izAllocate != 'Y',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -154,11 +162,16 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
async function handleDelete(record: Recordable) {
|
||||||
|
await deleteMeter(record.id);
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
// 抄电表
|
// 抄电表
|
||||||
async function handleRead(record: Recordable) {
|
async function handleRead(record: Recordable) {
|
||||||
const params = {
|
const params = {
|
||||||
'cid' : record.cid,
|
'sn' : record.sn,
|
||||||
'address' : record.address,
|
|
||||||
};
|
};
|
||||||
await eleRead(params);
|
await eleRead(params);
|
||||||
reload();
|
reload();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue