api+页面调整
This commit is contained in:
parent
a7f6fc945d
commit
a476abc7a4
@ -9,6 +9,18 @@ export enum DraftDataType {
|
|||||||
ISCS = 'ISCS',
|
ISCS = 'ISCS',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum IscsStyle {
|
||||||
|
UNKNOWN,
|
||||||
|
DA_SHI_ZHI_NENG = 'DA_SHI_ZHI_NENG',
|
||||||
|
}
|
||||||
|
|
||||||
|
export const iscsStyleOption = [
|
||||||
|
{
|
||||||
|
label: '达实智能',
|
||||||
|
value: IscsStyle.DA_SHI_ZHI_NENG,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
export interface DraftItem {
|
export interface DraftItem {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
@ -90,15 +102,10 @@ export async function sharedDraftPageQuery(
|
|||||||
* @param params
|
* @param params
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export enum IscsStyle {
|
|
||||||
UNKNOWN,
|
|
||||||
DA_SHI_ZHI_NENG = 'DA_SHI_ZHI_NENG',
|
|
||||||
}
|
|
||||||
interface CreateDraftIscsDto {
|
interface CreateDraftIscsDto {
|
||||||
input: {
|
input: {
|
||||||
name: string;
|
name: string;
|
||||||
options: IscsDataOptions;
|
options: IscsDataOptions;
|
||||||
userId: number;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
export function createDraft(params: CreateDraftIscsDto) {
|
export function createDraft(params: CreateDraftIscsDto) {
|
||||||
@ -204,11 +211,10 @@ export function saveDraft(variables: { id: number; data: string }) {
|
|||||||
export async function saveAsDraft(variables: {
|
export async function saveAsDraft(variables: {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
userId: number;
|
}) {
|
||||||
}): Promise<DraftItem> {
|
|
||||||
const mutation = `
|
const mutation = `
|
||||||
mutation saveAsNewDraftData($id: Int,$name: String,$userId: Int) {
|
mutation saveAsNewDraftData($id: Int,$name: String) {
|
||||||
saveAsNewDraftData(id: $id,name: $name,userId: $userId){
|
saveAsNewDraftData(id: $id,name: $name){
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,10 +127,10 @@ export async function publishPageQuery(
|
|||||||
* 另存到草稿
|
* 另存到草稿
|
||||||
* @param id 发布id
|
* @param id 发布id
|
||||||
*/
|
*/
|
||||||
export function saveToDraft(variables: { versionId: number; userId: number }) {
|
export function saveToDraft(variables: { versionId: number }) {
|
||||||
const mutation = `
|
const mutation = `
|
||||||
mutation createDraftDataFromReleaseDataVersion($versionId: Int,$userId: Int) {
|
mutation createDraftDataFromReleaseDataVersion($versionId: Int) {
|
||||||
createDraftDataFromReleaseDataVersion(versionId: $versionId,userId: $userId){name}
|
createDraftDataFromReleaseDataVersion(versionId: $versionId){name}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
return api.post('', {
|
return api.post('', {
|
||||||
|
@ -68,15 +68,17 @@ export class ApiError {
|
|||||||
const api = axios.create({ baseURL: getHttpBase() });
|
const api = axios.create({ baseURL: getHttpBase() });
|
||||||
let isOpenDialog = false; // 认证弹窗是否打开
|
let isOpenDialog = false; // 认证弹窗是否打开
|
||||||
|
|
||||||
//const CancelToken = axios.CancelToken;
|
const CancelToken = axios.CancelToken;
|
||||||
//const source = CancelToken.source();
|
const source = CancelToken.source();
|
||||||
export default boot(({ app, router }) => {
|
export default boot(({ app, router }) => {
|
||||||
// for use inside Vue files (Options API) through this.$axios and this.$api
|
// for use inside Vue files (Options API) through this.$axios and this.$api
|
||||||
|
|
||||||
// 拦截请求,添加
|
// 拦截请求,添加
|
||||||
/* api.interceptors.request.use(
|
api.interceptors.request.use(
|
||||||
(config) => {
|
(config) => {
|
||||||
config.headers.Authorization = getJwtToken();
|
//config.headers.Authorization = getJwtToken();
|
||||||
|
config.headers.Authorization = 'Bearer 1e2d0d5d96034f4a0805af6512051ddc';
|
||||||
|
config.headers['Token'] = '1e2d0d5d96034f4a0805af6512051ddc';
|
||||||
config.cancelToken = source.token;
|
config.cancelToken = source.token;
|
||||||
if (isOpenDialog) {
|
if (isOpenDialog) {
|
||||||
source.cancel();
|
source.cancel();
|
||||||
@ -86,7 +88,7 @@ export default boot(({ app, router }) => {
|
|||||||
(err: AxiosError) => {
|
(err: AxiosError) => {
|
||||||
return Promise.reject(ApiError.from(err));
|
return Promise.reject(ApiError.from(err));
|
||||||
}
|
}
|
||||||
); */
|
);
|
||||||
|
|
||||||
api.interceptors.response.use(
|
api.interceptors.response.use(
|
||||||
(response) => {
|
(response) => {
|
||||||
|
@ -143,18 +143,17 @@ import { Rect } from 'src/graphics/rect/Rect';
|
|||||||
import { getIscsStyleConfig } from 'src/configs/iscsStyleConfig';
|
import { getIscsStyleConfig } from 'src/configs/iscsStyleConfig';
|
||||||
import { IscsStyle, saveAsDraft } from 'src/api/DraftApi';
|
import { IscsStyle, saveAsDraft } from 'src/api/DraftApi';
|
||||||
import DraggableDialog from 'src/components/common/DraggableDialog.vue';
|
import DraggableDialog from 'src/components/common/DraggableDialog.vue';
|
||||||
import { ApiError } from 'src/boot/axios';
|
|
||||||
import { useAuthStore } from 'src/stores/auth-store';
|
|
||||||
import { successNotify } from 'src/utils/CommonNotify';
|
import { successNotify } from 'src/utils/CommonNotify';
|
||||||
|
import { saveDrawDatas } from 'src/drawApp/iscsApp';
|
||||||
|
import { saveDrawToServer } from 'src/drawApp/commonApp';
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const searchId = ref(0);
|
const searchId = ref(0);
|
||||||
|
|
||||||
const drawStore = useDrawStore();
|
const drawStore = useDrawStore();
|
||||||
const authStore = useAuthStore();
|
|
||||||
const showDrawTool = ref(true);
|
const showDrawTool = ref(true);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => drawStore.drawMode,
|
() => drawStore.drawMode,
|
||||||
(drawMode) => {
|
(drawMode) => {
|
||||||
@ -281,37 +280,40 @@ function onResize() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveAllDrawDatas() {
|
|
||||||
// const drawApp = drawStore.getDrawApp();
|
|
||||||
}
|
|
||||||
|
|
||||||
function backConfirm() {
|
function backConfirm() {
|
||||||
router.go(-1);
|
router.go(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function saveAllDrawDatas() {
|
||||||
|
const drawApp = drawStore.getDrawApp();
|
||||||
|
saveDrawToServer(saveDrawDatas(drawApp));
|
||||||
|
}
|
||||||
|
|
||||||
const saveAsDialog = ref(false);
|
const saveAsDialog = ref(false);
|
||||||
const saveAsName = ref('');
|
const saveAsName = ref('');
|
||||||
|
|
||||||
async function saveAs(name: string) {
|
async function saveAs(name: string) {
|
||||||
try {
|
const res = await saveAsDraft({
|
||||||
await saveAsDraft({
|
id: +route.params.id as number,
|
||||||
id: +route.params.id as number,
|
name,
|
||||||
name,
|
});
|
||||||
userId: authStore.userId,
|
if (res.data?.errors && res.data?.errors.length) {
|
||||||
});
|
|
||||||
successNotify('另存为草稿成功');
|
|
||||||
saveAsDialog.value = false;
|
|
||||||
} catch (err) {
|
|
||||||
const error = err as ApiError;
|
|
||||||
$q.notify({
|
$q.notify({
|
||||||
type: 'negative',
|
type: 'negative',
|
||||||
message: error.title,
|
message: res.data.errors[0].message,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
successNotify('另存为草稿成功');
|
||||||
|
saveAsDialog.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTopMenuClick() {
|
function onTopMenuClick(name: string) {
|
||||||
|
console.log(name);
|
||||||
|
drawStore.clickSubmenuName = name;
|
||||||
const drawApp = drawStore.getDrawApp();
|
const drawApp = drawStore.getDrawApp();
|
||||||
|
const graphics = drawApp.queryStore.getAllGraphics();
|
||||||
|
graphics.forEach((graphic) => (graphic.visible = false));
|
||||||
drawApp.forceReload();
|
drawApp.forceReload();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -248,6 +248,7 @@ import {
|
|||||||
setDraftRename,
|
setDraftRename,
|
||||||
sharedDraftPageQuery,
|
sharedDraftPageQuery,
|
||||||
PagingQueryParams,
|
PagingQueryParams,
|
||||||
|
iscsStyleOption,
|
||||||
} from '../api/DraftApi';
|
} from '../api/DraftApi';
|
||||||
import { ApiError } from 'src/boot/axios';
|
import { ApiError } from 'src/boot/axios';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
@ -260,6 +261,7 @@ import {
|
|||||||
} from 'src/api/PublishApi';
|
} from 'src/api/PublishApi';
|
||||||
import { useAuthStore } from 'src/stores/auth-store';
|
import { useAuthStore } from 'src/stores/auth-store';
|
||||||
import { PageDto } from 'src/api/ApiCommon';
|
import { PageDto } from 'src/api/ApiCommon';
|
||||||
|
import { useDrawStore } from 'src/stores/draw-store';
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@ -270,6 +272,7 @@ const props = withDefaults(
|
|||||||
{ sizeHeight: 500 }
|
{ sizeHeight: 500 }
|
||||||
);
|
);
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
|
const drawStore = useDrawStore();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const tableHeight = computed(() => {
|
const tableHeight = computed(() => {
|
||||||
@ -288,6 +291,14 @@ const columnDefs: QTableColumn[] = [
|
|||||||
required: true,
|
required: true,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'type',
|
||||||
|
label: '类型',
|
||||||
|
field: (row) => {
|
||||||
|
return getTypeName(row);
|
||||||
|
},
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'userId',
|
name: 'userId',
|
||||||
label: '创建人',
|
label: '创建人',
|
||||||
@ -383,18 +394,22 @@ async function onRequest(props: any) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTypeName(row: DraftItem) {
|
||||||
|
const iscsStyle = allRequestData.find((item) => item.draftData.id == row.id)
|
||||||
|
.options.style;
|
||||||
|
const iscsStyleName = iscsStyleOption.find(
|
||||||
|
(item) => item.value == iscsStyle
|
||||||
|
).label;
|
||||||
|
return iscsStyleName || '';
|
||||||
|
}
|
||||||
|
|
||||||
//新建相关
|
//新建相关
|
||||||
const createFormShow = ref(false);
|
const createFormShow = ref(false);
|
||||||
const createForm = reactive({
|
const createForm = reactive({
|
||||||
draftName: '',
|
draftName: '',
|
||||||
style: IscsStyle.DA_SHI_ZHI_NENG,
|
style: IscsStyle.DA_SHI_ZHI_NENG,
|
||||||
});
|
});
|
||||||
const iscsStyleOption = [
|
|
||||||
{
|
|
||||||
label: '达实智能',
|
|
||||||
value: IscsStyle.DA_SHI_ZHI_NENG,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
const myForm = ref<QForm | null>(null);
|
const myForm = ref<QForm | null>(null);
|
||||||
function onCreate() {
|
function onCreate() {
|
||||||
myForm.value?.validate().then(async (res) => {
|
myForm.value?.validate().then(async (res) => {
|
||||||
@ -404,7 +419,6 @@ function onCreate() {
|
|||||||
input: {
|
input: {
|
||||||
name: createForm.draftName,
|
name: createForm.draftName,
|
||||||
options: { style: createForm.style },
|
options: { style: createForm.style },
|
||||||
userId: authStore.userId,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const res = await createDraft(variables);
|
const res = await createDraft(variables);
|
||||||
@ -426,6 +440,7 @@ function onCreate() {
|
|||||||
|
|
||||||
//编辑
|
//编辑
|
||||||
function goToPath(row: DraftItem) {
|
function goToPath(row: DraftItem) {
|
||||||
|
drawStore.clickSubmenuName = '车站控制';
|
||||||
let path = `/iscsPainting/${row.id}`;
|
let path = `/iscsPainting/${row.id}`;
|
||||||
const iscsStyle = allRequestData.find((item) => item.draftData.id == row.id)
|
const iscsStyle = allRequestData.find((item) => item.draftData.id == row.id)
|
||||||
.options.style;
|
.options.style;
|
||||||
|
@ -136,12 +136,13 @@ import {
|
|||||||
setPublishRelease,
|
setPublishRelease,
|
||||||
PublishHistoryItem,
|
PublishHistoryItem,
|
||||||
fallbackVersion,
|
fallbackVersion,
|
||||||
|
PublishIscsDataDto,
|
||||||
} from '../api/PublishApi';
|
} from '../api/PublishApi';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { ApiError } from 'src/boot/axios';
|
import { ApiError } from 'src/boot/axios';
|
||||||
import { nextTick } from 'process';
|
import { nextTick } from 'process';
|
||||||
import { DraftDataType } from 'src/api/DraftApi';
|
import { DraftDataType, iscsStyleOption } from 'src/api/DraftApi';
|
||||||
import { useAuthStore } from 'src/stores/auth-store';
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
||||||
@ -152,7 +153,6 @@ const props = withDefaults(
|
|||||||
}>(),
|
}>(),
|
||||||
{ sizeHeight: 500, selects: () => [] }
|
{ sizeHeight: 500, selects: () => [] }
|
||||||
);
|
);
|
||||||
const authStore = useAuthStore();
|
|
||||||
const tableHeight = computed(() => {
|
const tableHeight = computed(() => {
|
||||||
return props.sizeHeight - 32;
|
return props.sizeHeight - 32;
|
||||||
});
|
});
|
||||||
@ -170,6 +170,14 @@ const columnDefs: QTableColumn[] = [
|
|||||||
required: true,
|
required: true,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'type',
|
||||||
|
label: '类型',
|
||||||
|
field: (row) => {
|
||||||
|
return getTypeName(row);
|
||||||
|
},
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'description',
|
name: 'description',
|
||||||
label: '描述',
|
label: '描述',
|
||||||
@ -213,6 +221,7 @@ const pagination = ref({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
|
let allRequestData: PublishIscsDataDto[] = [];
|
||||||
async function onRequest(props: any) {
|
async function onRequest(props: any) {
|
||||||
const { page, rowsPerPage } = props.pagination;
|
const { page, rowsPerPage } = props.pagination;
|
||||||
const filter = props.filter;
|
const filter = props.filter;
|
||||||
@ -224,7 +233,6 @@ async function onRequest(props: any) {
|
|||||||
itemsPerPage: rowsPerPage,
|
itemsPerPage: rowsPerPage,
|
||||||
},
|
},
|
||||||
query: {
|
query: {
|
||||||
userId: authStore.userId,
|
|
||||||
dataType: DraftDataType.ISCS,
|
dataType: DraftDataType.ISCS,
|
||||||
name: filter.name,
|
name: filter.name,
|
||||||
},
|
},
|
||||||
@ -239,6 +247,7 @@ async function onRequest(props: any) {
|
|||||||
rows.length,
|
rows.length,
|
||||||
...(response.items.map((item) => item.releaseData) as [])
|
...(response.items.map((item) => item.releaseData) as [])
|
||||||
);
|
);
|
||||||
|
allRequestData = response.items;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const error = err as ApiError;
|
const error = err as ApiError;
|
||||||
$q.notify({
|
$q.notify({
|
||||||
@ -250,6 +259,15 @@ async function onRequest(props: any) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTypeName(row: PublishItem) {
|
||||||
|
const iscsStyle = allRequestData.find((item) => item.releaseData.id == row.id)
|
||||||
|
.options.style;
|
||||||
|
const iscsStyleName = iscsStyleOption.find(
|
||||||
|
(item) => item.value == iscsStyle
|
||||||
|
).label;
|
||||||
|
return iscsStyleName || '';
|
||||||
|
}
|
||||||
|
|
||||||
//上下架
|
//上下架
|
||||||
function dataReleaseFn(row: PublishItem) {
|
function dataReleaseFn(row: PublishItem) {
|
||||||
if (row.isPublished) {
|
if (row.isPublished) {
|
||||||
@ -291,7 +309,6 @@ function dataReleaseFn(row: PublishItem) {
|
|||||||
function saveToDraftFn(row: PublishItem) {
|
function saveToDraftFn(row: PublishItem) {
|
||||||
saveToDraft({
|
saveToDraft({
|
||||||
versionId: row.usedVersionId,
|
versionId: row.usedVersionId,
|
||||||
userId: row.userId,
|
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.data?.errors && res.data?.errors.length) {
|
if (res.data?.errors && res.data?.errors.length) {
|
||||||
$q.notify({
|
$q.notify({
|
||||||
|
@ -2,7 +2,7 @@ import { defineStore } from 'pinia';
|
|||||||
|
|
||||||
export const useAuthStore = defineStore('auth', {
|
export const useAuthStore = defineStore('auth', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
userId: 1 as number | null,
|
userId: 8160 as number | null,
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
setUserId(id: number | null) {
|
setUserId(id: number | null) {
|
||||||
|
@ -20,6 +20,7 @@ export const useDrawStore = defineStore('draw', {
|
|||||||
selectedGraphics: null as JlGraphic[] | null,
|
selectedGraphics: null as JlGraphic[] | null,
|
||||||
draftId: null as number | null,
|
draftId: null as number | null,
|
||||||
drawPictureType: null as PictureType | null,
|
drawPictureType: null as PictureType | null,
|
||||||
|
clickSubmenuName: '车站控制',
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
drawMode: (state) => state.drawAssistant != null,
|
drawMode: (state) => state.drawAssistant != null,
|
||||||
|
Loading…
Reference in New Issue
Block a user