代码调整

This commit is contained in:
joylink_fanyuhong 2024-04-07 17:54:31 +08:00
parent 5f7c04ee99
commit fde31acc72
15 changed files with 222 additions and 21 deletions

@ -1 +1 @@
Subproject commit 208bcaedccf71e7bfd2535e2889ca4cf7c4bdbb6
Subproject commit e4728f0f732904f543a86aabb2c3da2653dd139f

View File

@ -21,7 +21,147 @@
<q-separator inset />
<q-card-section>
<q-list dense>
<q-item v-for="(item, index) in list" :key="index">
<q-item v-for="(item, index) in list1" :key="index">
<q-item-section>
<q-item-label>{{ item.label }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>{{
item.formatFn
? item.formatFn(carWashingState[item.key])
: carWashingState[item.key]
}}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-card-section>
<q-separator inset />
<q-card-section>
<q-list dense>
<q-item v-for="(item, index) in list2" :key="index">
<q-item-section>
<q-item-label>{{ item.label }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>{{
item.formatFn
? item.formatFn(carWashingState[item.key])
: carWashingState[item.key]
}}</q-item-label>
</q-item-section>
</q-item>
<q-item v-for="(item, index) in list3" :key="index + list2.length">
<q-item-section>
<q-item-label>{{ item.label }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption
><span>[</span>
<span
v-if="carWashingState.twjList.length >= 1"
:style="{
color: carWashingState.twjList[0] ? 'green' : 'red',
}"
>{{
`1:${carWashingState.twjList[0] ? '结束' : '未结束'}`
}}</span
>
<span
v-if="carWashingState.twjList.length >= 2"
:style="{
color: carWashingState.twjList[1] ? 'green' : 'red',
}"
>{{
`2:${carWashingState.twjList[1] ? '结束' : '未结束'}`
}}</span
>
<span
v-if="carWashingState.twjList.length >= 3"
:style="{
color: carWashingState.twjList[2] ? 'green' : 'red',
}"
>{{
`3:${carWashingState.twjList[2] ? '结束' : '未结束'}`
}}</span
>
<span>]</span></q-item-label
>
</q-item-section>
</q-item>
<q-item
v-for="(item, index) in list4"
:key="index + list2.length + list3.length"
>
<q-item-section>
<q-item-label>{{ item.label }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>{{
item.formatFn
? item.formatFn(carWashingState[item.key])
: carWashingState[item.key]
}}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-card-section>
<q-separator inset />
<q-card-section>
<q-list dense>
<q-item v-for="(item, index) in list5" :key="index">
<q-item-section>
<q-item-label>{{ item.label }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>{{
item.formatFn
? item.formatFn(carWashingState[item.key])
: carWashingState[item.key]
}}</q-item-label>
</q-item-section>
</q-item>
<q-item v-for="(item, index) in list6" :key="index + list5.length">
<q-item-section>
<q-item-label>{{ item.label }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>
<span>[</span>
<span
v-if="carWashingState.cfjList.length >= 1"
:style="{
color: carWashingState.cfjList[0] ? 'green' : 'red',
}"
>{{
`1:${carWashingState.cfjList[0] ? '结束' : '未结束'}`
}}</span
>
<span
v-if="carWashingState.cfjList.length >= 2"
:style="{
color: carWashingState.cfjList[1] ? 'green' : 'red',
}"
>{{
`2:${carWashingState.cfjList[1] ? '结束' : '未结束'}`
}}</span
>
<span
v-if="carWashingState.cfjList.length >= 3"
:style="{
color: carWashingState.cfjList[2] ? 'green' : 'red',
}"
>{{
`3:${carWashingState.cfjList[2] ? '结束' : '未结束'}`
}}</span
>
<span>]</span>
</q-item-label>
</q-item-section>
</q-item>
<q-item
v-for="(item, index) in list7"
:key="index + list5.length + list6.length"
>
<q-item-section>
<q-item-label>{{ item.label }}</q-item-label>
</q-item-section>
@ -64,15 +204,27 @@ interface KeyType {
formatFn?(v: CarWashingState[keyof CarWashingState]): string;
}
const list: KeyType[] = [
const list1: KeyType[] = [
{ label: '洗车机索引', key: 'id' },
{ label: '洗车机名称', key: 'code', formatFn: getNameFormat },
];
const list2: KeyType[] = [
{ label: '洗车请求', key: 'xqj', formatFn: getBoolFormat },
{ label: '是否停稳', key: 'twjList', formatFn: getTwFormat },
];
const list3: KeyType[] = [
{ label: '端洗停稳 ', key: 'twjList', formatFn: getTwFormat },
];
const list4: KeyType[] = [
{ label: '通过请求', key: 'tgqj', formatFn: getBoolFormat },
];
const list5: KeyType[] = [
{ label: '洗车就绪', key: 'xcjxj', formatFn: getBoolFormat },
{ label: '洗车允许', key: 'xcyxj', formatFn: getBoolFormat },
{ label: '移动允许', key: 'cfjList', formatFn: getYXFormat },
];
const list6: KeyType[] = [
{ label: '端洗结束', key: 'cfjList', formatFn: getYXFormat },
];
const list7: KeyType[] = [
{ label: '紧急停车', key: 'jtj', formatFn: getBoolFormat },
{ label: '通过允许', key: 'tgyxj', formatFn: getBoolFormat },
];
@ -107,11 +259,11 @@ function getBoolFormat(v: boolean) {
}
function getTwFormat(v: boolean[]) {
if (v.length === 2) {
return `头部${v[0] ? '停稳' : '未停稳'};尾部${v[1] ? '停稳' : '未停稳'};`;
return `[1:${v[0] ? '停稳' : '未停稳'};2:${v[1] ? '停稳' : '未停稳'};]`;
} else if (v.length === 3) {
return `头部${v[0] ? '停稳' : '未停稳'};中部${
v[1] ? '停稳' : '未停稳'
};尾部${v[2] ? '停稳' : '未停稳'};`;
return `[1:${v[0] ? '停稳' : '未停稳'};2:${v[1] ? '停稳' : '未停稳'};3:${
v[2] ? '停稳' : '未停稳'
};]`;
} else {
return '状态显示错误';
}
@ -132,7 +284,6 @@ function getYXFormat(v: boolean[]) {
function initCarWashingState(carWashing: CarWashing) {
copySelectGraphic = toRaw(carWashing);
code.value = carWashing.datas.code;
console.log(code.value, carWashing);
updateState(carWashing);
subscribeState(carWashing);

View File

@ -84,6 +84,7 @@ const list: KeyType[] = [
{ label: '防淹门名称', key: 'code', formatFn: getNameFormat },
{ label: '防淹门关闭', key: 'mgj', formatFn: getName },
{ label: '控制端', key: 'local', formatFn: getLocal },
{ label: '门旁路', key: 'mplj', formatFn: getName },
{ label: '防淹门强制', key: 'param', formatFn: getForceName },
{ label: '设置故障', key: 'param', formatFn: getFaultName },
];

View File

@ -84,6 +84,7 @@ const list: KeyType[] = [
{ label: '车库门名称', key: 'code', formatFn: getNameFormat },
{ label: '车库门关闭', key: 'mgj', formatFn: getName },
{ label: '控制端', key: 'local', formatFn: getLocal },
{ label: '门旁路', key: 'mplj', formatFn: getName },
// { label: '', key: 'stateLoss', formatFn: getName },
{ label: '车库门强制', key: 'param', formatFn: getForceName },
{ label: '设置故障', key: 'param', formatFn: getFaultName },

View File

@ -9,7 +9,7 @@ function getHost(): string {
// return '192.168.3.7:9091';
// return '192.168.3.47:9091';
// return '192.168.3.37:9091';
// return '192.168.33.207:9091'; // 张骞
return '192.168.33.207:9091'; // 张骞
// return '192.168.33.93:9091';
// return '192.168.3.37:9091'; //卫志宏
// return 'test.joylink.club/bjrtsts-service'; // 测试

View File

@ -114,6 +114,12 @@ export class FloodGateState
set local(v: boolean) {
this.states.local = v;
}
get mplj() {
return this.states.mplj;
}
set mplj(v: boolean) {
this.states.mplj = v;
}
get states(): state.CkmState {
return this.getState<state.CkmState>();
}

View File

@ -114,6 +114,12 @@ export class GarageDoorState
set local(v: boolean) {
this.states.local = v;
}
get mplj() {
return this.states.mplj;
}
set mplj(v: boolean) {
this.states.mplj = v;
}
get states(): state.CkmState {
return this.getState<state.CkmState>();
}

View File

@ -81,6 +81,12 @@ export class PslButtonState
set down(v: boolean) {
this.states.down = v;
}
get active(): boolean {
return this.states.active;
}
set active(v: boolean) {
this.states.active = v;
}
get states(): state.ButtonState {
return this.getState<state.ButtonState>();
}

View File

@ -260,7 +260,6 @@ export function loadGatedRelateDeviceList() {
export function creatGatedRelateDevice(row: graphicData.DeviceCombinationtype) {
refDevicesList.push(row);
console.log(refDevicesList, '====');
drawApp?.emit('postdataloaded');
}

View File

@ -69,15 +69,17 @@ function handleSubscribe(pslScene: IGraphicScene) {
const states: GraphicState[] = [];
const storage = state.PushedDevicesStatus.deserialize(message);
if (storage.all) {
// storage.allStatus.buttonState.forEach((item) => {
// if (item.id) {
// states.push(new PslButtonState(item));
// }
// });
storage.allStatus.buttonState.forEach((item) => {
if (item.id) {
states.push(new PslButtonState(item));
}
});
}
// console.log(states, 'states');
return states;
},
graphicQueryer: (state, store) => {
return store.queryById(+state.code);
},
});
}

View File

@ -128,10 +128,10 @@ export class CarWashing extends JlGraphic {
} else if (this.states.tgyxj) {
stateText = '通过';
} else if (this.states.cfjList.length === 2) {
if (this.states.cfjList[0]) {
stateText = '头部';
} else if (this.states.cfjList[1]) {
if (this.states.cfjList[1]) {
stateText = '尾部';
} else if (this.states.cfjList[0]) {
stateText = '头部';
}
} else if (this.states.cfjList.length === 3) {
if (this.states.cfjList[1]) {

View File

@ -33,6 +33,8 @@ export interface IFloodGateState extends GraphicState {
set param(v: request.CkmParam);
get local(): boolean;
set local(v: boolean);
get mplj(): boolean;
set mplj(v: boolean);
}
const garageConsts = {

View File

@ -33,6 +33,8 @@ export interface IGarageDoorState extends GraphicState {
set param(v: request.CkmParam);
get local(): boolean;
set local(v: boolean);
get mplj(): boolean;
set mplj(v: boolean);
}
const garageConsts = {

View File

@ -31,6 +31,8 @@ export interface IPslButtonState extends GraphicState {
set code(v: string);
get down(): boolean;
set down(v: boolean);
get active(): boolean;
set active(v: boolean);
}
export class PslButton extends JlGraphic {

View File

@ -8030,6 +8030,7 @@ export namespace state {
mgj?: boolean;
param?: dependency_3.request.CkmParam;
local?: boolean;
mplj?: boolean;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -8046,6 +8047,9 @@ export namespace state {
if ("local" in data && data.local != undefined) {
this.local = data.local;
}
if ("mplj" in data && data.mplj != undefined) {
this.mplj = data.mplj;
}
}
}
get id() {
@ -8075,11 +8079,18 @@ export namespace state {
set local(value: boolean) {
pb_1.Message.setField(this, 4, value);
}
get mplj() {
return pb_1.Message.getFieldWithDefault(this, 5, false) as boolean;
}
set mplj(value: boolean) {
pb_1.Message.setField(this, 5, value);
}
static fromObject(data: {
id?: number;
mgj?: boolean;
param?: ReturnType<typeof dependency_3.request.CkmParam.prototype.toObject>;
local?: boolean;
mplj?: boolean;
}): CkmState {
const message = new CkmState({});
if (data.id != null) {
@ -8094,6 +8105,9 @@ export namespace state {
if (data.local != null) {
message.local = data.local;
}
if (data.mplj != null) {
message.mplj = data.mplj;
}
return message;
}
toObject() {
@ -8102,6 +8116,7 @@ export namespace state {
mgj?: boolean;
param?: ReturnType<typeof dependency_3.request.CkmParam.prototype.toObject>;
local?: boolean;
mplj?: boolean;
} = {};
if (this.id != null) {
data.id = this.id;
@ -8115,6 +8130,9 @@ export namespace state {
if (this.local != null) {
data.local = this.local;
}
if (this.mplj != null) {
data.mplj = this.mplj;
}
return data;
}
serialize(): Uint8Array;
@ -8129,6 +8147,8 @@ export namespace state {
writer.writeMessage(3, this.param, () => this.param.serialize(writer));
if (this.local != false)
writer.writeBool(4, this.local);
if (this.mplj != false)
writer.writeBool(5, this.mplj);
if (!w)
return writer.getResultBuffer();
}
@ -8150,6 +8170,9 @@ export namespace state {
case 4:
message.local = reader.readBool();
break;
case 5:
message.mplj = reader.readBool();
break;
default: reader.skipField();
}
}