diff --git a/.env.development b/.env.development index 4fad5c2..649935a 100644 --- a/.env.development +++ b/.env.development @@ -2,5 +2,5 @@ ENV='development' # base api -VUE_APP_BASE_API=http://starter.ali251.langye.net -VUE_APP_UPLOAD_API=http://starter.ali251.langye.net/api/admin/upload-file +VUE_APP_BASE_API=http://knzg.ali251.langye.net +VUE_APP_UPLOAD_API=http://knzg.ali251.langye.net/api/admin/upload-file diff --git a/.env.production b/.env.production index f837c50..ecacbb2 100644 --- a/.env.production +++ b/.env.production @@ -2,5 +2,5 @@ ENV = 'production' # base api -VUE_APP_BASE_API = http://starter.ali251.langye.net -VUE_APP_UPLOAD_API =http://starter.ali251.langye.net/api/admin/upload-file \ No newline at end of file +VUE_APP_BASE_API=http://knzg.ali251.langye.net +VUE_APP_UPLOAD_API=http://knzg.ali251.langye.net/api/admin/upload-file diff --git a/src/api/h5/index.js b/src/api/h5/index.js new file mode 100644 index 0000000..120cd3b --- /dev/null +++ b/src/api/h5/index.js @@ -0,0 +1,8 @@ +import request from "@/utils/request"; + +export function login () { + return request({ + url: '/api/mobile/user/login', + + }) +} diff --git a/src/components/XyDialog/index.vue b/src/components/XyDialog/index.vue index 32bda2d..0dd3d73 100644 --- a/src/components/XyDialog/index.vue +++ b/src/components/XyDialog/index.vue @@ -291,12 +291,15 @@ export default { .el-form-item__error{ white-space: nowrap; word-break: keep-all !important; - top: 100% !important; - left: calc(100% - 80px) !important; - transform: translateX(-100%); } .ivu-message{ z-index: 5000 !important; } - + diff --git a/src/components/XyTable/index.vue b/src/components/XyTable/index.vue index 99ed9de..2992eb2 100644 --- a/src/components/XyTable/index.vue +++ b/src/components/XyTable/index.vue @@ -21,6 +21,11 @@ export default { default: "data", }, //请求后需要获取表格数据键名 + isHandlerKey: { + type: Boolean, + default: true + },//是否每次有数据跟新时会刷新表格key从而刷新视图(取消sort优化,标题不会频闪) + //操作权限 auths: { type: Array, @@ -739,7 +744,7 @@ export default { { (() => { let dom = []; _this.auths.forEach((item, index) => { - if (this.btnToMore && _this.moreAuths.find(j => j === item)) return + if ((_this.btnToMore || _this.auths.length > 5) && _this.moreAuths.find(j => j === item)) return if (_this.$scopedSlots[item]) { flag = index; dom.push(_this.$scopedSlots[item](scope, item, index)); @@ -751,7 +756,9 @@ export default { } }) - this.btnToMore? dom.push(btns.get('more')) : '' + if (_this.auths.length > 5 || _this.btnToMore) { + dom.push(btns.get('more')) + } return dom; })() } @@ -870,7 +877,7 @@ export default { { // start progress bar @@ -21,9 +21,10 @@ router.beforeEach(async(to, from, next) => { const hasToken = getToken() if (hasToken) { - if (to.path === '/login') { + if (to.path === '/login' || to.path === '/h5/login') { // if is logged in, redirect to the home page - next({ path: '/' }) + let isH5 = to.path !== '/login' + next({ path: isH5 ? '/h5' : '/' }) NProgress.done() } else { // determine whether the user has obtained his permission roles through getInfo @@ -51,7 +52,7 @@ router.beforeEach(async(to, from, next) => { // remove token and go to login page to re-login await store.dispatch('user/resetToken') Message.error(error || 'Has Error') - next(`/login?redirect=${to.path}`) + next(`${/^\/h5.*/.test(to.path) ? '/h5/login' : '/login'}?redirect=${to.path}`) NProgress.done() } } @@ -64,7 +65,7 @@ router.beforeEach(async(to, from, next) => { next() } else { // other pages that do not have permission to access are redirected to the login page. - next(`/login?redirect=${to.path}`) + next(`${/^\/h5.*/.test(to.path) ? '/h5/login' : '/login'}?redirect=${to.path}`) NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index a5069f3..4c9602d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -33,7 +33,7 @@ import Layout from "@/layout"; export const constantRoutes = [ { path: "/login", - component: () => import("@/views/login/index"), + component: () => import("@/views/login/index.vue"), hidden: true, }, @@ -88,8 +88,8 @@ export const constantRoutes = [ hidden: true }, { - path: '/h5login', - component:() => import("@/views/h5/login.vue"), + path: '/h5/login', + component:() => import("@/views/h5/login/login.vue"), meta: { title: "登录", }, diff --git a/src/utils/auth.js b/src/utils/auth.js index 82a703b..5bf5a01 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -1,15 +1,18 @@ import Cookies from 'js-cookie' - +import router from '@/router' const TokenKey = 'difficult_employee_query_token' - +const TokenKsy_h5 = 'difficult_employee_query_token_h5' export function getToken() { - return Cookies.get(TokenKey) + let flag = /^\/h5.*/.test(router.currentRoute.path) + return Cookies.get(flag ? TokenKsy_h5 : TokenKey) } export function setToken(token) { - return Cookies.set(TokenKey, token) + let flag = /^\/h5.*/.test(router.currentRoute.path) + return Cookies.set(flag ? TokenKsy_h5 : TokenKey, token) } export function removeToken() { - return Cookies.remove(TokenKey) + let flag = /^\/h5.*/.test(router.currentRoute.path) + return Cookies.remove(flag ? TokenKsy_h5 : TokenKey) } diff --git a/src/views/component/detail.vue b/src/views/component/detail.vue index 7e48717..d423696 100644 --- a/src/views/component/detail.vue +++ b/src/views/component/detail.vue @@ -37,7 +37,7 @@ - + {{ contentFormat(item) }} { if (item.edit_input !== 'files') { - let dataTable = this.allTables.find(t => t.table_name === res[1].relation[0].link_table_name); + let dataTable = this.allTables.find(t => t.table_name === res[1]?.relation[0]?.link_table_name); if (dataTable) { formShow({ id: dataTable?.id }).then(res1 => { this.linkTableList.push({ @@ -224,7 +224,7 @@ export default { ['admins',[]] ]) let { fields, relation } = info; - let fieldRes = fields.sort((a,b) => a.sort - b.sort) + let fieldRes = fields.sort((a,b) => a.sort - b.sort).filter(i => i.list_show) if ( !fields || !relation || @@ -467,8 +467,7 @@ export default { computed: { showFields () { - console.log(this.fields) - return this.fields.filter(field => (!field._relations || field._relations.link_relation === 'hasOne' || field._relations.link_relation === 'newHasOne')) + return this.fields.filter(field => (!field._relations || field._relations.link_relation === 'hasOne' || field._relations.link_relation === 'newHasOne')).filter(i => i.list_show) }, contentFormat() { return function (i) { diff --git a/src/views/component/dialog.vue b/src/views/component/dialog.vue index ea2c37c..77f99ac 100644 --- a/src/views/component/dialog.vue +++ b/src/views/component/dialog.vue @@ -34,187 +34,208 @@ export default { }, [ h( - "el-form", + "el-scrollbar", { - ref: "elForm", - props: { - model: this.form, - labelWidth: "80px", - rules: this.rules, - labelPosition: "right", - size: "small", + style: { + height: "58vh", }, }, - (() => { - let dom = []; - this.formInfo - .filter((i) => i.form_show) - .forEach((i, index) => { - dom.push( - h( - "el-form-item", - { - ref: `elFormItem${i.field}`, - style: { - width: "100%", - }, - props: { - label: i.name, - prop: i.field, - required: - i.validation instanceof Array - ? !!i.validation.find((i) => i === "required") - : false, - }, - }, - this.$scopedSlots[i.field] - ? this.$scopedSlots[i.field]({ - fieldInfo: i, - form: this.form, - file: this.file, - }) - : i._relations && - i.edit_input !== "file" && - i.edit_input !== "files" - ? [ - h( - "el-input", - { - props: { - readonly: true, - value: - i._relations.link_relation === - "newHasOne" || - i._relations.link_relation === "hasOne" - ? this.originalForm[ - i._relations.link_with_name - ]?.name || - this.originalForm[ - i._relations.link_with_name - ]?.mingcheng || - this.originalForm[ - i._relations.link_with_name - ]?.no || - this.originalForm[ - i._relations.link_with_name - ]?.id || this.form[i.field] - : this.originalForm[ - i._relations.link_with_name - ] - ?.map( - (j) => - j[ - i._relations - .custom_form_field - ] - ) - ?.toString(), - }, - on: { - ['focus']:e => { - this.pickedLinkField.field = i.field; - this.pickedLinkField.linkType = - i._relations.link_relation; - this.pickedLinkField.linkTableName = - i._relations.link_table_name; - this.pickedLinkField.originalRows = - this.originalForm[ - i._relations.link_with_name - ]; - this.$refs["linkPickModal"].show(); + + [ + h( + "el-form", + { + ref: "elForm", + class: "form-body", + props: { + model: this.form, + labelWidth: "80px", + rules: this.rules, + labelPosition: "right", + size: "small", + }, + }, + (() => { + let dom = []; + this.formInfo + .filter((i) => i.form_show) + .forEach((i, index) => { + dom.push( + h( + "el-form-item", + { + ref: `elFormItem${i.field}`, + style: { + width: "100%", + }, + props: { + label: i.name, + prop: i.field, + required: + i.validation instanceof Array + ? !!i.validation.find((i) => i === "required") + : false, + }, + }, + this.$scopedSlots[i.field] + ? this.$scopedSlots[i.field]({ + fieldInfo: i, + form: this.form, + file: this.file, + }) + : i._relations && + i.edit_input !== "file" && + i.edit_input !== "files" + ? [ + h( + "el-input", + { + props: { + readonly: true, + value: + i._relations.link_relation === + "newHasOne" || + i._relations.link_relation === "hasOne" + ? this.originalForm[ + i._relations.link_with_name + ]?.name || + this.originalForm[ + i._relations.link_with_name + ]?.mingcheng || + this.originalForm[ + i._relations.link_with_name + ]?.no || + this.originalForm[ + i._relations.link_with_name + ]?.id || this.form[i.field] + : this.originalForm[ + i._relations.link_with_name + ] + ?.map( + (j) => + j[ + i._relations + .custom_form_field + ] + ) + ?.toString(), + }, + on: { + ['focus']:e => { + this.pickedLinkField.field = i.field; + this.pickedLinkField.linkType = + i._relations.link_relation; + this.pickedLinkField.linkTableName = + i._relations.link_table_name; + this.pickedLinkField.originalRows = + this.originalForm[ + i._relations.link_with_name + ]; + this.$refs["linkPickModal"].show(); + } + }, } - }, - } - ) - ] - : [ - h( - domMap.get(i.edit_input), - { - ref: `elEdit_${i.field}`, - style: { - width: "100%", - }, - props: { - ...addPropsMap.get(i.edit_input), - ...this.extraProps(i), - placeholder: i.help, - value: this.form[i.field], - }, - attrs: { - placeholder: i.help || `请填写${i.name}`, - }, - on: { - [this.getEventType(i.edit_input)]: (e) => { - if (i.field) { - this.form[i.field] = e; - this.form = Object.assign({}, this.form); - } - }, - }, - scopedSlots: - i.edit_input === "file" || - i.edit_input === "files" - ? { - file: (scope) => { - let { file } = scope; - return [ - h("div", {}, [ - h("i", { - class: { - "el-icon-circle-check": - file.status === "success", - "el-icon-loading": - file.status === "uploading", - }, - style: { - color: - file.status === "success" - ? "green" - : "", - }, - }), - h( - "a", - { - attrs: { - href: file.url, - download: file.name, - }, - class: { - "uploaded-a": - file.status === "success", - }, - style: { - padding: "0 4px", - }, - }, - file.name - ), - ]), - h("i", { - class: "el-icon-close", - on: { - ["click"]: () => - this.fileRemoveHandler( - file, - i.field - ), - }, - }), - ]; + ), + ] + : [ + h( + domMap.get(i.edit_input), + { + ref: `elEdit_${i.field}`, + style: { + width: "100%", + }, + props: { + ...addPropsMap.get(i.edit_input), + ...this.extraProps(i), + placeholder: i.help, + value: this.form[i.field], + }, + attrs: { + placeholder: i.help || `请填写${i.name}`, + }, + on: { + [this.getEventType(i.edit_input)]: ( + e + ) => { + if (i.field) { + this.form[i.field] = e; + this.form = Object.assign( + {}, + this.form + ); + } }, - } - : "", - }, - this.optionsRender(h, i) - ), - ] - ) - ); - }); - return dom; - })() + }, + scopedSlots: + i.edit_input === "file" || + i.edit_input === "files" + ? { + file: (scope) => { + let { file } = scope; + return [ + h("div", {}, [ + h("i", { + class: { + "el-icon-circle-check": + file.status === + "success", + "el-icon-loading": + file.status === + "uploading", + }, + style: { + color: + file.status === + "success" + ? "green" + : "", + }, + }), + h( + "a", + { + attrs: { + href: file.url, + download: file.name, + }, + class: { + "uploaded-a": + file.status === + "success", + }, + style: { + padding: "0 4px", + }, + }, + file.name + ), + ]), + h("i", { + class: "el-icon-close", + on: { + ["click"]: () => + this.fileRemoveHandler( + file, + i.field + ), + }, + }), + ]; + }, + } + : "", + }, + this.optionsRender(h, i) + ), + ] + ) + ); + }); + return dom; + })() + ), + ] ), h("template", { slot: "footer" }, [ h( @@ -656,4 +677,9 @@ export default { color: red; text-decoration: underline; } +.form-body { + display: grid; + grid-gap: 10px; + grid-template-columns: repeat(var(--column-num), 1fr); +} diff --git a/src/views/h5/login.vue b/src/views/h5/login.vue deleted file mode 100644 index 7ba120c..0000000 --- a/src/views/h5/login.vue +++ /dev/null @@ -1,60 +0,0 @@ - - - - 苏州市总工会 - 在档困难职工查询系统 - - 请输入留档信息登录 - - - - - - - - - 确 认 - - - - - 2023 苏州市总工会 - - - - - - diff --git a/src/views/h5/login/component/loginPanel.vue b/src/views/h5/login/component/loginPanel.vue new file mode 100644 index 0000000..c923366 --- /dev/null +++ b/src/views/h5/login/component/loginPanel.vue @@ -0,0 +1,224 @@ + + + + + 苏州总工会 + + + + 苏州市总工会 + 在档困难职工查询系统 + + 请输入留档信息登录 + + + + + + + + + {{ time ? time+'秒重新获取' : '发送验证码'}} + + + + + + 确 认 + + + + + + + + + + + diff --git a/src/views/h5/login/login.vue b/src/views/h5/login/login.vue new file mode 100644 index 0000000..abc2e97 --- /dev/null +++ b/src/views/h5/login/login.vue @@ -0,0 +1,102 @@ + + + + + + + 欢迎使用本平台 + + + 本平台为在档困难职工提供证明查询和打印 + + + -苏州市总工会- + + + + + + + + diff --git a/src/views/login/index.vue b/src/views/login/index.vue index a5e5125..889c51a 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -44,7 +44,7 @@ validUsername } from '@/utils/validate' - const defaultSettings = require('../../../src/settings.js') + const defaultSettings = require('../../settings.js') export default { name: 'Login', data() { diff --git a/src/views/record/component/add.vue b/src/views/record/component/add.vue new file mode 100644 index 0000000..d89a564 --- /dev/null +++ b/src/views/record/component/add.vue @@ -0,0 +1,417 @@ + + + + diff --git a/src/views/record/index.vue b/src/views/record/index.vue new file mode 100644 index 0000000..4415f6f --- /dev/null +++ b/src/views/record/index.vue @@ -0,0 +1,632 @@ + + + + + + + + + + + + + {{ item.name }} + + + {{ item.label }} + + + + + + + {{ + item.key || item.value || item.name || item.no || item.mingcheng || item.id + }} + + + + inputStartHandler(e, select.filter[0])" + /> + 至 + inputEndHandler(e, select.filter[0])" + /> + + 查询 + + + + + + 条件{{ index + 1 }} + + {{ item.name }} + + + {{ item.label }} + + + + + + + {{ + item.key || item.value || item.name || item.no || item.mingcheng || item.id + }} + + + + inputStartHandler(e, item)" + /> + 至 + inputEndHandler(e, item)" + /> + + + + + + + 新增一条 + + + + + + + 新增 + + + 导入 + + + 导出 + + + + + + + { + $router.push({ + path: $route.path + '/detail/' + row.id + }) + } + " + @editor=" + (row) => { + $refs['dialog'].setId(row.id); + $refs['dialog'].setType('editor'); + $refs['dialog'].show(); + } + " + > + + 打印 + + + + + + + + + + + + +
条件{{ index + 1 }}