This commit is contained in:
fan 2023-08-11 14:42:58 +08:00
commit 6e6907e299
9 changed files with 70 additions and 5 deletions

View File

@ -5,6 +5,7 @@ const UriBase = '/api/v1/category';
export interface createParams {
name: string;
code: string;
id?: number;
config?: string;
}

View File

@ -37,7 +37,7 @@ export async function pageQuery(
* @param params
* @returns
*/
export function createDraft(draftData: { name: string; category: number }) {
export function createDraft(draftData: { name: string; category: string }) {
return api.post(`${DraftUriBase}`, draftData);
}

View File

@ -13,7 +13,7 @@
/>
<q-input
outlined
label="曲度半径"
label="曲度半径(mm)"
type="number"
@blur="onUpdate"
v-model.number="curvatureModel.curvatureNumber"

View File

@ -176,6 +176,24 @@ export class TrainState extends GraphicStateBase implements ITrainState {
set show(v: boolean) {
this.states.show = v;
}
get headDeviceId(): string {
return this.states.headDeviceId;
}
set headDeviceId(v: string) {
this.states.headDeviceId = v;
}
get headOffset(): number {
return this.states.headOffset;
}
set headOffset(v: number) {
this.states.headOffset = v;
}
get devicePort(): string {
return this.states.devicePort;
}
set devicePort(v: string) {
this.states.devicePort = v;
}
clone(): TrainState {
return new TrainState(this.states.cloneMessage());
}

View File

@ -72,7 +72,7 @@ export class Curvature extends JlGraphic {
}
});
//曲度值
const text = Math.abs(this.datas.curvatureNumber);
const text = Math.abs(this.datas.curvatureNumber / 1000);
this.curvatureNumber.text = text ? `R-${text}` : '';
const centerPos = calculateLineMidpoint(
this.datas.points[0],

View File

@ -68,6 +68,12 @@ export interface ITrainState extends GraphicState {
set trainLength(v: number);
get show(): boolean;
set show(v: boolean);
get headDeviceId(): string;
set headDeviceId(v: string);
get headOffset(): number;
set headOffset(v: number);
get devicePort(): string;
set devicePort(v: string);
}
interface bodyWH {

View File

@ -69,6 +69,13 @@
lazy-rules
:rules="[(val) => val.length > 0 || '请输入名称!']"
/>
<q-input
outlined
label="编码"
v-model="editInfo.code"
lazy-rules
:rules="[(val) => val.length > 0 || '请输入编码!']"
/>
<q-input outlined label="配置" v-model="editInfo.config" />
<q-card-actions align="right">
@ -125,6 +132,12 @@ const columnDefs: QTableColumn[] = [
required: true,
align: 'center',
},
{
name: 'code',
label: '编码',
field: 'code',
align: 'center',
},
{
name: 'created_at',
label: '创建时间',
@ -193,6 +206,7 @@ function onCreate() {
try {
const params: createParams = {
name: editInfo.categoryName,
code: editInfo.code,
config: JSON.stringify(editInfo.config),
};
if (editInfo.id) {
@ -219,6 +233,7 @@ function onCreate() {
function onReset() {
editInfo.id = '';
editInfo.categoryName = '';
editInfo.code = '';
editInfo.config = '';
myForm.value?.resetValidation();
}
@ -250,6 +265,7 @@ async function deleteData(row: CategoryItem) {
const editInfo = reactive({
id: '',
categoryName: '',
code: '',
config: '',
});
function editData(row: CategoryItem) {
@ -257,6 +273,7 @@ function editData(row: CategoryItem) {
.then((res: CategoryItem) => {
editInfo.id = res.id + '';
editInfo.categoryName = res.name;
editInfo.code = res.code;
editInfo.config = res.config ? JSON.parse(res.config) : '';
createFormShow.value = true;
})

View File

@ -251,7 +251,7 @@ function onCreate() {
try {
await createDraft({
name: draftName.value,
category: +categoryId.value,
category: categoryId.value,
});
createFormShow.value = false;
tableRef.value.requestServerInteraction(); //
@ -348,7 +348,7 @@ function getCategoryListFn() {
getCategoryList()
.then((res: CategoryItem[]) => {
res.forEach((item) => {
categoryOptions.push({ label: item.name, value: item.id + '' });
categoryOptions.push({ label: item.name, value: item.code });
});
})
.catch((err) => {

View File

@ -5166,6 +5166,7 @@ export namespace graphicData {
bRelatedRef?: RelatedRef;
devicePositions?: CalculateLink.DevicePosition[];
index?: number;
ab?: boolean;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 6], this.#one_of_decls);
@ -5191,6 +5192,9 @@ export namespace graphicData {
if ("index" in data && data.index != undefined) {
this.index = data.index;
}
if ("ab" in data && data.ab != undefined) {
this.ab = data.ab;
}
}
}
get common() {
@ -5244,6 +5248,12 @@ export namespace graphicData {
set index(value: number) {
pb_1.Message.setField(this, 7, value);
}
get ab() {
return pb_1.Message.getFieldWithDefault(this, 8, false) as boolean;
}
set ab(value: boolean) {
pb_1.Message.setField(this, 8, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
points?: ReturnType<typeof Point.prototype.toObject>[];
@ -5252,6 +5262,7 @@ export namespace graphicData {
bRelatedRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
devicePositions?: ReturnType<typeof CalculateLink.DevicePosition.prototype.toObject>[];
index?: number;
ab?: boolean;
}): CalculateLink {
const message = new CalculateLink({});
if (data.common != null) {
@ -5275,6 +5286,9 @@ export namespace graphicData {
if (data.index != null) {
message.index = data.index;
}
if (data.ab != null) {
message.ab = data.ab;
}
return message;
}
toObject() {
@ -5286,6 +5300,7 @@ export namespace graphicData {
bRelatedRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
devicePositions?: ReturnType<typeof CalculateLink.DevicePosition.prototype.toObject>[];
index?: number;
ab?: boolean;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -5308,6 +5323,9 @@ export namespace graphicData {
if (this.index != null) {
data.index = this.index;
}
if (this.ab != null) {
data.ab = this.ab;
}
return data;
}
serialize(): Uint8Array;
@ -5328,6 +5346,8 @@ export namespace graphicData {
writer.writeRepeatedMessage(6, this.devicePositions, (item: CalculateLink.DevicePosition) => item.serialize(writer));
if (this.index != 0)
writer.writeInt32(7, this.index);
if (this.ab != false)
writer.writeBool(8, this.ab);
if (!w)
return writer.getResultBuffer();
}
@ -5358,6 +5378,9 @@ export namespace graphicData {
case 7:
message.index = reader.readInt32();
break;
case 8:
message.ab = reader.readBool();
break;
default: reader.skipField();
}
}