From 8b4a88ce202d790ff6e3576b36bcfe11cf796ab8 Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Wed, 21 Jun 2023 09:02:05 +0800 Subject: [PATCH] 2023-6-20 --- src/api/reception/index.js | 13 + src/api/statics/index.js | 17 + src/permission.js | 20 +- src/store/modules/permission.js | 6 +- src/utils/auth.js | 14 +- src/utils/request.js | 4 +- src/views/component/biaoqian.vue | 48 ++ src/views/component/dialog.vue | 13 +- src/views/component/drawer.vue | 55 ++- src/views/component/examine.vue | 175 +++++++ src/views/component/fujian.vue | 21 + src/views/component/table.vue | 61 ++- src/views/component/tableExamine.vue | 657 +++++++++++++++++++++++++++ src/views/reception/index.vue | 3 + src/views/statics/doughnut.vue | 120 +++++ src/views/statics/line.vue | 162 +++++++ 16 files changed, 1358 insertions(+), 31 deletions(-) create mode 100644 src/api/reception/index.js create mode 100644 src/api/statics/index.js create mode 100644 src/views/component/biaoqian.vue create mode 100644 src/views/component/examine.vue create mode 100644 src/views/component/fujian.vue create mode 100644 src/views/component/tableExamine.vue create mode 100644 src/views/statics/doughnut.vue create mode 100644 src/views/statics/line.vue diff --git a/src/api/reception/index.js b/src/api/reception/index.js new file mode 100644 index 0000000..3ff34a9 --- /dev/null +++ b/src/api/reception/index.js @@ -0,0 +1,13 @@ +import request from "@/utils/request"; +import {getToken} from "@/utils/auth"; + +export function login (params) { + return request({ + headers: { + ['Authorization']: 'Bearer' + getToken('ReceptionTokenKey') + }, + url: '/api/user/login', + method: 'get', + params + }) +} diff --git a/src/api/statics/index.js b/src/api/statics/index.js new file mode 100644 index 0000000..bc53d02 --- /dev/null +++ b/src/api/statics/index.js @@ -0,0 +1,17 @@ +import request from "@/utils/request"; + +export function day (params) { + return request({ + method: 'get', + url: '/api/admin/chart/day', + params + }) +} + +export function month (params) { + return request({ + method: 'get', + url: '/api/admin/chart/month', + params + }) +} diff --git a/src/permission.js b/src/permission.js index b10d532..4146f6c 100644 --- a/src/permission.js +++ b/src/permission.js @@ -3,8 +3,9 @@ import store from './store' import { Message } from 'element-ui' import NProgress from 'nprogress' // progress bar import 'nprogress/nprogress.css' // progress bar style -import { getToken } from '@/utils/auth' // get token from cookie +import {getToken, setToken} from '@/utils/auth' // get token from cookie import getPageTitle from '@/utils/get-page-title' +import { login } from "@/api/reception/index" NProgress.configure({ showSpinner: false }) // NProgress Configuration @@ -18,7 +19,22 @@ router.beforeEach(async(to, from, next) => { document.title = getPageTitle(to.meta.title) if (/^\/index\/.*/.test(to.path)) { - next() + if (getToken('RecptionTokenKey')) { + next() + } else { + if (to.query.code) { + login({ + code: to.query.code + }).then(res => { + setToken(res.access_token,'RecoveryTokenKey') + next() + }) + } else { + let redirectUri = encodeURIComponent(window.location.href) + window.location.href = `https://api.weishao.com.cn/oauth/authorize?client_id=d05e4c9d07f705ef&redirect_uri=${redirectUri}&response_type=code&scope=base_api&state=wyd` + } + } + return } // determine whether the user has logged in diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 668e182..6743c9a 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -133,9 +133,9 @@ export function generaMenu(routes, data) { } }, ] } - if (item.children) { - generaMenu(menu.children, item.children) - } + // if (item.children) { + // generaMenu(menu.children, item.children) + // } routes.push(menu) } else { const menu = { diff --git a/src/utils/auth.js b/src/utils/auth.js index d6e79c6..4a765d1 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -1,15 +1,15 @@ import Cookies from 'js-cookie' const TokenKey = 'weiyuan_doc_token' - -export function getToken() { - return Cookies.get(TokenKey) +const RecptionTokenKey = 'weiyuan_doc_reception_token' +export function getToken(key = TokenKey) { + return Cookies.get(key) } -export function setToken(token) { - return Cookies.set(TokenKey, token) +export function setToken(token, key = TokenKey) { + return Cookies.set(key, token) } -export function removeToken() { - return Cookies.remove(TokenKey) +export function removeToken(key = TokenKey) { + return Cookies.remove(key) } diff --git a/src/utils/request.js b/src/utils/request.js index ab840ea..28fb3c9 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -7,7 +7,7 @@ import { import store from '@/store' import { getToken -} from '@/utils/auth' +} from '@/utils/auth'; let loading ; // create an axios instance @@ -30,7 +30,7 @@ service.interceptors.request.use( } // do something before request is sent - if (store.getters.token) { + if (store.getters.token && !config.headers['Authorization']) { // let each request carry token // ['X-Token'] is a custom headers key // please modify it according to the actual situation diff --git a/src/views/component/biaoqian.vue b/src/views/component/biaoqian.vue new file mode 100644 index 0000000..2ba92c3 --- /dev/null +++ b/src/views/component/biaoqian.vue @@ -0,0 +1,48 @@ + + + + + diff --git a/src/views/component/dialog.vue b/src/views/component/dialog.vue index 0fe8a69..d9c4a19 100644 --- a/src/views/component/dialog.vue +++ b/src/views/component/dialog.vue @@ -369,8 +369,6 @@ export default { }, submit() { - console.log(this.form) - return if (this.type === "add") { if (this.form.hasOwnProperty("id")) { delete this.form.id; @@ -399,22 +397,25 @@ export default { this.formInfo.forEach((info) => { if (info._relations?.link_relation === 'newHasMany' || info._relations?.link_relation === 'hasMany') { if (info.edit_input === 'files') { - copyForm[info._relations.link_with_name] = this.file[info.field].map(i => i?.response); + copyForm[info._relations.link_with_name] = this.file[info.field]?.map(i => i?.response); } else { - copyForm[info._relations.link_with_name] = copyForm[info.field] + copyForm[info._relations.link_with_name] = copyForm[info.field]?.map( i => info._params.find(param => param[info._relations?.foreign_key] === i)) } delete copyForm[info.field] } if (info._relations?.link_relation === 'newHasOne' || info._relations?.link_relation === 'hasOne') { if (info.edit_input === 'file') { - //this.form[info._relations.link_with_name] = + copyForm[info._relations.link_with_name] = this.file[info.field]?.map(i => i?.response); } else { - + copyForm[info._relations.link_with_name] = info._params.find(param => param[info._relations?.foreign_key] === copyForm[info.field]) } delete copyForm[info.field] } + if (!copyForm[info._relations?.link_with_name]) { + delete copyForm[info._relations?.link_with_name] + } // if (info._relations?.link_with_name) { // if (info.edit_input === "files" || info.edit_input === "file") { // this.form[info._relations.link_with_name] = this.file[info.field].map(i => i?.response); diff --git a/src/views/component/drawer.vue b/src/views/component/drawer.vue index fb769ce..eb9bcc7 100644 --- a/src/views/component/drawer.vue +++ b/src/views/component/drawer.vue @@ -23,13 +23,16 @@ + + +
+ + diff --git a/src/views/component/fujian.vue b/src/views/component/fujian.vue new file mode 100644 index 0000000..d716e75 --- /dev/null +++ b/src/views/component/fujian.vue @@ -0,0 +1,21 @@ + + + + + diff --git a/src/views/component/table.vue b/src/views/component/table.vue index 30996f9..3d8ec8a 100644 --- a/src/views/component/table.vue +++ b/src/views/component/table.vue @@ -184,7 +184,7 @@ /> + + import { index as fieldIndex } from "@/api/system/customFormField"; import { authMixin } from "@/mixin/authMixin"; -import { index, destroy } from "@/api/system/baseForm"; +import { index, destroy, save } from "@/api/system/baseForm"; import { op } from "@/const/op"; import { download } from "@/utils/downloadRequest"; import { getparameter } from "@/api/system/dictionary"; @@ -306,7 +321,9 @@ import LxHeader from "@/components/LxHeader/index.vue"; import headerContent from "@/components/LxHeader/XyContent.vue"; import drawer from "@/views/component/drawer.vue"; import imports from "./imports.vue"; -import flow from "@/views/flow/flow.vue" +import flow from "@/views/flow/flow.vue"; +import biaoqian from "./biaoqian.vue"; +import fujian from "./fujian.vue"; export default { components: { LxHeader, @@ -315,7 +332,9 @@ export default { drawer, imports, - flow + flow, + biaoqian, + fujian }, mixins: [authMixin], provide: { @@ -405,6 +424,21 @@ export default { target.value = `${temp ? temp : ""},${e}`; }, + + //权限操作 + submit (scope, setType) { + save(Object.assign( deepCopy(scope.row), { 'zhuangtai': setType,'table_name': this.customForm.tableName })).then(res => { + this.$message({ + type: 'success', + message: '操作成功' + }) + + this.$refs['xyTable'].getTableData() + }) + + }, + + async getFormDetail() { if (this.$route.meta.params?.custom_form) { let decode = decodeURIComponent(this.$route.meta.params?.custom_form); @@ -430,6 +464,13 @@ export default { ['admins',[]] ]) let { fields, relation } = res; + let fieldRes = await fieldIndex({ + page: 1, + page_size: 999, + custom_form_id: this.customForm.customFormId, + sort_name: 'sort', + sort_type: 'asc' + },false) if ( !fields || !relation || @@ -438,7 +479,7 @@ export default { ) { throw new Error("fields或relation格式错误"); } - fields.forEach((i, index) => { + fieldRes?.data?.forEach((i, index) => { i._relations = relation.find((j) => j.local_key === i.field); if (i.select_item && typeof i.select_item === 'object') { let keys = Object.keys(i.select_item) @@ -470,7 +511,7 @@ export default { } } }); - this.form = fields; + this.form = fieldRes?.data || []; this.table = this.form ?.filter((i) => i.list_show) .map((i) => { @@ -561,21 +602,21 @@ export default { computed: { columnArrTest() { return function (field) { - return this.form.find((i) => i.field === field) + return this.form?.find((i) => i.field === field) ? this.form.find((i) => i.field === field).search_input === "checkbox" || this.form.find((i) => i.field === field).search_input === "radio" : false; }; }, getColumnField() { return function (field) { - return this.form.find((i) => i.field === field) + return this.form?.find((i) => i.field === field) ? this.form.find((i) => i.field === field) : {}; }; }, getColumnParams() { return function (field) { - return this.form.find((i) => i.field === field) + return this.form?.find((i) => i.field === field) ? this.form.find((i) => i.field === field)._params : []; }; diff --git a/src/views/component/tableExamine.vue b/src/views/component/tableExamine.vue new file mode 100644 index 0000000..b241696 --- /dev/null +++ b/src/views/component/tableExamine.vue @@ -0,0 +1,657 @@ + + + + + diff --git a/src/views/reception/index.vue b/src/views/reception/index.vue index 716b1bf..ae05b30 100644 --- a/src/views/reception/index.vue +++ b/src/views/reception/index.vue @@ -35,6 +35,9 @@ export default { }, methods: {}, computed: {}, + mounted() { + console.log(111,this.$route) + } } diff --git a/src/views/statics/doughnut.vue b/src/views/statics/doughnut.vue new file mode 100644 index 0000000..ab6ad23 --- /dev/null +++ b/src/views/statics/doughnut.vue @@ -0,0 +1,120 @@ + + + + + diff --git a/src/views/statics/line.vue b/src/views/statics/line.vue new file mode 100644 index 0000000..2ff2bac --- /dev/null +++ b/src/views/statics/line.vue @@ -0,0 +1,162 @@ + + + + +