Commit 46a55538 authored by 陈浩玮's avatar 陈浩玮

Merge branch 'feature/shuiluo' into 'master'

feat: 放开路由权限、解决pnpm不能使用的问题

See merge request product/kim3-web-vue/starter-web-vue!33
parents 799f3e81 ad7d455a
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -24,6 +24,8 @@ export default { ...@@ -24,6 +24,8 @@ export default {
request: Function, request: Function,
formatData: { type: Object, default: undefined }, formatData: { type: Object, default: undefined },
getName: Function, getName: Function,
labelFiled: String, // 和 formatData 一样 传一种就行了
valueFiled: String,
}, },
data() { data() {
return { return {
...@@ -34,6 +36,9 @@ export default { ...@@ -34,6 +36,9 @@ export default {
if (this.request) { if (this.request) {
const newArr = await this.request(); const newArr = await this.request();
this.data = this.formatData ? await formatObj(newArr, this.formatData) : newArr; this.data = this.formatData ? await formatObj(newArr, this.formatData) : newArr;
this.data = this.labelFiled
? formatObj(newArr, { label: this.labelFiled, value: this.valueFiled, key: this.valueFiled })
: this.data;
} }
}, },
methods: { methods: {
......
...@@ -21,8 +21,9 @@ export default { ...@@ -21,8 +21,9 @@ export default {
props: { props: {
url: String, url: String,
searchField: String, searchField: String,
formatData: Object,
mode: String, mode: String,
labelFiled: String,
valueFiled: String,
}, },
model: { model: {
prop: 'value', prop: 'value',
...@@ -38,10 +39,11 @@ export default { ...@@ -38,10 +39,11 @@ export default {
}, },
methods: { methods: {
async getData(searchString) { async getData(searchString) {
this.options = formatObj( this.options = formatObj(await getReq(this.url, { [this.searchField]: searchString }), {
await getReq(this.url, { [this.searchField]: searchString }), label: this.labelFiled,
this.formatData, value: this.valueFiled,
); key: this.valueFiled,
});
}, },
handleSearch(value) { handleSearch(value) {
if (this.timeOut) clearTimeout(this.timeOut); if (this.timeOut) clearTimeout(this.timeOut);
......
...@@ -3,7 +3,7 @@ import { formatFullPath } from '@/utils/i18nUtil'; ...@@ -3,7 +3,7 @@ import { formatFullPath } from '@/utils/i18nUtil';
import { filterMenu } from '@/utils/authorityUtil'; import { filterMenu } from '@/utils/authorityUtil';
import { getLocalSetting } from '@/utils/themeUtil'; import { getLocalSetting } from '@/utils/themeUtil';
import { langUtil } from '@/utils'; import { langUtil } from '@/utils';
import deepClone from 'lodash.clonedeep'; import deepClone from 'lodash/cloneDeep';
const localSetting = getLocalSetting(true); const localSetting = getLocalSetting(true);
const customTitlesStr = sessionStorage.getItem(process.env.VUE_APP_TBAS_TITLES_KEY); const customTitlesStr = sessionStorage.getItem(process.env.VUE_APP_TBAS_TITLES_KEY);
......
<template> <template>
<exception-page home-route="/dashboard/workplace" :style="`min-height: ${minHeight}`" type="403" /> <exception-page home-route="/" :style="`min-height: ${minHeight}`" type="403" />
</template> </template>
<script> <script>
...@@ -16,6 +16,3 @@ export default { ...@@ -16,6 +16,3 @@ export default {
}, },
}; };
</script> </script>
<style scoped lang="less">
</style>
<template> <template>
<exception-page home-route="/dashboard/workplace" :style="`min-height: ${minHeight}`" type="500" /> <exception-page home-route="/" :style="`min-height: ${minHeight}`" type="500" />
</template> </template>
<script> <script>
...@@ -16,6 +16,3 @@ export default { ...@@ -16,6 +16,3 @@ export default {
}, },
}; };
</script> </script>
<style scoped lang="less">
</style>
export const areaFormatData = {
label: 'regionName',
value: 'regionId',
key: 'regionId',
};
export const statusFormtData = {
label: 'paramName',
value: 'paramValue',
key: 'paramValue',
};
export const banZuFormatData = {
label: 'paramName',
value: 'paramValue',
key: 'paramValue',
};
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
<a-form-model-item label="地区" prop="regionId"> <a-form-model-item label="地区" prop="regionId">
<RequestSelect <RequestSelect
:request="getAreaListDataApi" :request="getAreaListDataApi"
:formatData="areaFormatData"
v-model="form.regionId" v-model="form.regionId"
labelFiled="regionName"
valueFiled="regionId"
/> />
</a-form-model-item> </a-form-model-item>
...@@ -21,8 +22,9 @@ ...@@ -21,8 +22,9 @@
<a-form-model-item label="班组" prop="shiftType"> <a-form-model-item label="班组" prop="shiftType">
<RequestSelect <RequestSelect
:request="getBanZuListApi" :request="getBanZuListApi"
:formatData="banZuFormatData"
v-model="form.shiftType" v-model="form.shiftType"
labelFiled="paramName"
valueFiled="paramValue"
/> />
</a-form-model-item> </a-form-model-item>
...@@ -39,7 +41,8 @@ ...@@ -39,7 +41,8 @@
<SearchSelect <SearchSelect
url="/api/v1/users/searching" url="/api/v1/users/searching"
searchField="userName" searchField="userName"
:formatData="formatXunJianRenData" labelFiled="userName"
valueFiled="userId"
v-model="form.inspectionIdList" v-model="form.inspectionIdList"
mode="multiple" mode="multiple"
/> />
...@@ -54,7 +57,6 @@ import RequestSelect from '@/components/MySelect/RequestSelect.vue'; ...@@ -54,7 +57,6 @@ import RequestSelect from '@/components/MySelect/RequestSelect.vue';
import SearchSelect from '@/components/MySelect/search_select.vue'; import SearchSelect from '@/components/MySelect/search_select.vue';
import UrlSelect from '@/components/MySelect/url_select.vue'; import UrlSelect from '@/components/MySelect/url_select.vue';
import { getAreaListDataApi, getBanZuListApi, addXunJianTaskApi } from '@/api'; import { getAreaListDataApi, getBanZuListApi, addXunJianTaskApi } from '@/api';
import { areaFormatData, banZuFormatData } from './common';
export default { export default {
props: { props: {
...@@ -65,7 +67,6 @@ export default { ...@@ -65,7 +67,6 @@ export default {
data() { data() {
return { return {
getAreaListDataApi, getAreaListDataApi,
banZuFormatData,
getBanZuListApi, getBanZuListApi,
form: {}, form: {},
rules: { rules: {
...@@ -75,12 +76,6 @@ export default { ...@@ -75,12 +76,6 @@ export default {
routeId: [{ required: true }], routeId: [{ required: true }],
regionId: [{ required: true }], regionId: [{ required: true }],
}, },
areaFormatData,
formatXunJianRenData: {
value: 'userId',
label: 'userName',
key: 'userId',
},
}; };
}, },
computed: { computed: {
......
...@@ -19,57 +19,73 @@ ...@@ -19,57 +19,73 @@
<a-date-picker <a-date-picker
class="tw-w-full" class="tw-w-full"
show-time show-time
v-model="query.startTime" v-model="query.endTime"
valueFormat="YYYY-MM-DD HH:mm:ss" valueFormat="YYYY-MM-DD HH:mm:ss"
/> />
</my-form-item> </my-form-item>
<my-form-item label="地区"> <my-form-item label="地区">
<RequestSelect <RequestSelect
:request="getAreaListDataApi" :request="getAreaListDataApi"
:formatData="areaFormatData"
v-model="query.regionId" v-model="query.regionId"
labelFiled="regionName"
valueFiled="regionId"
/> />
</my-form-item> </my-form-item>
<my-form-item label="专业"> <my-form-item label="专业">
<RequestSelect <UrlSelect
:request="getAreaListDataApi" :url="
:formatData="areaFormatData" query.regionId
v-model="query.regionId" ? `/ranger/inspection/api/v1/specialities/valid/regions/${query.regionId}/list`
: ''
"
v-model="query.specialityId"
labelFiled="specialityName"
valueFiled="specialityId"
/> />
</my-form-item> </my-form-item>
<my-form-item label="线路"> <my-form-item label="线路">
<RequestSelect <UrlSelect
:request="getAreaListDataApi" :url="
:formatData="areaFormatData" query.regionId
v-model="query.regionId" ? `/ranger/inspection/api/v1/routes/regions/${query.regionId}/list`
: ''
"
labelFiled="routeName"
valueFiled="routeId"
v-model="query.routeId"
/> />
</my-form-item> </my-form-item>
<my-form-item label="班组"> <my-form-item label="班组">
<RequestSelect <RequestSelect
:request="getBanZuListApi" :request="getBanZuListApi"
:formatData="banZuFormatData"
v-model="query.shiftType" v-model="query.shiftType"
labelFiled="paramName"
valueFiled="paramValue"
/> />
</my-form-item> </my-form-item>
<my-form-item label="巡检状态"> <my-form-item label="巡检状态">
<RequestSelect <RequestSelect
:request="getBusinessListApi" :request="getBusinessListApi"
:formatData="statusFormtData"
v-model="query.inspectionState" v-model="query.inspectionState"
labelFiled="paramName"
valueFiled="paramValue"
/> />
</my-form-item> </my-form-item>
<my-form-item label="任务类型"> <my-form-item label="任务类型">
<RequestSelect <RequestSelect
:request="getTaskTypeApi" :request="getTaskTypeApi"
:formatData="taskTypeFormatData"
v-model="query.jobType" v-model="query.jobType"
labelFiled="paramName"
valueFiled="paramValue"
/> />
</my-form-item> </my-form-item>
<my-form-item label="巡检人"> <my-form-item label="巡检人">
<RequestSelect <SearchSelect
:request="getBusinessListApi" url="/api/v1/users/searching"
:formatData="statusFormtData" searchField="userName"
v-model="query.lastInspectionStaffId" v-model="query.lastInspectionStaffId"
labelFiled="userName"
valueFiled="userId"
/> />
</my-form-item> </my-form-item>
</template> </template>
...@@ -98,20 +114,20 @@ ...@@ -98,20 +114,20 @@
<script> <script>
import Table from '@/components/table/table.vue'; import Table from '@/components/table/table.vue';
import Form from './form.vue'; import Form from './form.vue';
import UrlSelect from '@/components/MySelect/url_select.vue';
import { getXunJianDownloadUrlApi } from '@/api'; import { getXunJianDownloadUrlApi } from '@/api';
import { downloadFileByUrl } from '@/utils'; import { downloadFileByUrl } from '@/utils';
import RequestSelect from '@/components/MySelect/RequestSelect.vue'; import RequestSelect from '@/components/MySelect/RequestSelect.vue';
import SearchSelect from '@/components/MySelect/search_select.vue';
import { getAreaListDataApi, getBusinessListApi, getBanZuListApi, getTaskTypeApi } from '@/api'; import { getAreaListDataApi, getBusinessListApi, getBanZuListApi, getTaskTypeApi } from '@/api';
import { areaFormatData, statusFormtData, banZuFormatData } from './common';
export default { export default {
components: { Table, Form, RequestSelect }, components: { Table, Form, RequestSelect, UrlSelect, SearchSelect },
data() { data() {
return { return {
getAreaListDataApi, getAreaListDataApi,
getBusinessListApi, getBusinessListApi,
getBanZuListApi, getBanZuListApi,
banZuFormatData,
getTaskTypeApi, getTaskTypeApi,
addBtn: { addBtn: {
title: '新建临时任务', title: '新建临时任务',
...@@ -124,13 +140,6 @@ export default { ...@@ -124,13 +140,6 @@ export default {
{ type: 'confirm' }, { type: 'confirm' },
], ],
selected: [], selected: [],
areaFormatData,
statusFormtData,
taskTypeFormatData: {
label: 'paramName',
value: 'paramValue',
key: 'paramValue',
},
}; };
}, },
methods: { methods: {
......
...@@ -8,10 +8,9 @@ NProgress.configure({ showSpinner: false }); ...@@ -8,10 +8,9 @@ NProgress.configure({ showSpinner: false });
function hasAuthority(to) { function hasAuthority(to) {
const { path } = to; const { path } = to;
if (globalRoutes.find(m => m.path === path)) return true; if (globalRoutes.find((m) => m.path === path)) return true;
const { menuList = [] } = getUserInfo(); const { menuList = [] } = getUserInfo();
// return !!menuList.find(i => i.menuUrl === path); return !!menuList.find((i) => i.menuUrl === path);
return true;
} }
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment