lion 2 years ago
commit 9d2ddb0fb6

@ -4,5 +4,7 @@ NODE_ENV = production
ENV = 'staging' ENV = 'staging'
# base api # base api
VUE_APP_BASE_API = '/stage-api' VUE_APP_BASE_API=http://jiwei.ali251.langye.net
VUE_APP_UPLOAD_API=http://jiwei.ali251.langye.net/api/admin/upload-file

@ -17,3 +17,57 @@ export function recordStore (data,isLoading=true) {
isLoading isLoading
}) })
} }
export function getYears (params,isLoading=false) {
return request({
method: "get",
url: "/api/person/get-years",
params,
isLoading
})
}
export function getYearStatistics (params,isLoading=false) {
return request({
method: "get",
url: "/api/person/get-year-statistics",
params,
isLoading
})
}
export function getByCategory (params,isLoading=true) {
return request({
method: "get",
url: "/api/person/record/get-by-category",
params,
isLoading
})
}
export function destroy (data,isLoading=true) {
return request({
method: "post",
url: "/api/person/record/delete",
data,
isLoading
})
}
export function show (params,isLoading=true) {
return request({
method: "get",
url: "/api/person/record/show",
params,
isLoading
})
}
export function save (data,isLoading=true) {
return request({
method: "post",
url: "/api/person/record/save",
data,
isLoading
})
}

@ -1,6 +1,6 @@
import request from "@/utils/request"; import request from "@/utils/request";
export function login (data,isLoading=true) { export function login (data,isLoading=false) {
return request({ return request({
method: "post", method: "post",
url: "/api/person/auth/login", url: "/api/person/auth/login",
@ -25,3 +25,11 @@ export function logout () {
isLoading: false isLoading: false
}) })
} }
export function getBaseInfo (isLoading=false) {
return request({
method: "get",
url: "/api/person/get-base-info",
isLoading
})
}

@ -77,6 +77,8 @@ export const constantRoutes = [{
{ {
path: "/h5", path: "/h5",
name: "h5",
redirect: "/h5/index",
component: () => import("@/views/h5/index.vue"), component: () => import("@/views/h5/index.vue"),
hidden: true, hidden: true,
children: [ children: [
@ -98,16 +100,13 @@ export const constantRoutes = [{
}, },
{ {
path: '/h5/login', path: '/h5/login',
name: "h5login",
component:() => import("@/views/h5/login/login.vue"), component:() => import("@/views/h5/login/login.vue"),
meta: { meta: {
title: "登录", title: "登录",
}, },
hidden: true hidden: true
}, },
{
path: '/h5',
redirect: '/h5/index'
},
] ]

@ -66,8 +66,8 @@ const actions = {
username: username.trim(), username: username.trim(),
password: password password: password
}).then(res => { }).then(res => {
commit('SET_TOKEN_H5', res.access_token)
setToken(res.access_token) setToken(res.access_token)
commit('SET_TOKEN_H5', res.access_token)
resolve(res) resolve(res)
}).catch(error => { }).catch(error => {
reject(error) reject(error)

@ -5,6 +5,7 @@ import {
Loading Loading
} from 'element-ui' } from 'element-ui'
import store from '@/store' import store from '@/store'
import route from "@/router"
import { import {
getToken getToken
} from '@/utils/auth' } from '@/utils/auth'
@ -30,13 +31,13 @@ service.interceptors.request.use(
} }
// do something before request is sent // do something before request is sent
if (store.getters.token) { if (getToken(/\/h5/g.test(route.currentRoute.path))) {
// let each request carry token // let each request carry token
// ['X-Token'] is a custom headers key // ['X-Token'] is a custom headers key
// please modify it according to the actual situation // please modify it according to the actual situation
//config.headers['X-Token'] = getToken(); //config.headers['X-Token'] = getToken();
config.headers['Authorization'] = "Bearer " + getToken() config.headers['Authorization'] = "Bearer " + getToken(/\/h5/g.test(route.currentRoute.path))
} }
return config return config
}, },

@ -1,25 +1,58 @@
<template> <template>
<div class="card"> <div class="card">
<xy-table ref="xyTable" <div style="padding: 15px">
height="100%" <el-radio-group v-model="select.year">
:isHandlerKey="false" <el-radio v-for="item in years" :label="item" border>{{ item }}</el-radio>
:is-page="false" </el-radio-group>
:list="categories" </div>
res-prop="" <div class="info">
:indent="20" <p class="info__title">
:row-key="row => row._index" {{ title }}
:table-item="table" </p>
:auths="[]">
<div class="info__status">
正常填报 <div class="cir1"></div> {{ static.count_normal }}迟报 <div class="cir2"></div> {{ static.count_delayed }}逾期未报 <div class="cir3"></div> {{ static.count_missed }}
</div>
</div>
<xy-table
ref="xyTable"
height=""
:isHandlerKey="false"
:is-page="false"
:list="categories"
res-prop=""
:indent="20"
:row-key="(row) => row._index"
:table-item="table"
:auths="[]"
>
</xy-table> </xy-table>
<el-drawer title="填报清单" :visible.sync="isShowDrawer" position="rtl" size="560px"> <el-drawer
<div style="padding: 20px 40px;"> title="填报清单"
<el-form class="form" ref="elForm" :model="form" :rules="rules" label-width="80px" size="small"> :visible.sync="isShowDrawer"
position="rtl"
size="750px"
:wrapper-closable="false"
>
<div style="padding: 20px 40px">
<el-form
class="form"
ref="elForm"
:model="form"
:rules="rules"
label-width="80px"
size="small"
>
<el-form-item label="标题" prop="title"> <el-form-item label="标题" prop="title">
<el-input v-model="form.title"></el-input> <el-input v-model="form.title" placeholder="请填写标题"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="内容" required prop="content"> <el-form-item label="内容" required prop="content">
<el-input type="textarea" :autosize="{ minRows:2 }" v-model="form.content"></el-input> <el-input
type="textarea"
:autosize="{ minRows: 30 }"
v-model="form.content"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="附件" prop="files"> <el-form-item label="附件" prop="files">
<el-upload <el-upload
@ -27,118 +60,203 @@
:action="action" :action="action"
multiple multiple
:limit="10" :limit="10"
:headers="{
'Authorization': 'Bearer ' + getToken(true)
}"
:before-upload="beforeUpload" :before-upload="beforeUpload"
:file-list="fileList"> :on-success="uploadSuccess"
:file-list="fileList"
>
<el-button size="small" type="primary">点击上传</el-button> <el-button size="small" type="primary">点击上传</el-button>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="所属月份" required prop="belongs_year_month"> <el-form-item label="所属周期" prop="_week">
<el-date-picker placeholder="请选择所属月份" type="month" value-format="yyyy-MM" v-model="form.belongs_year_month"></el-date-picker> <el-input
placeholder="请选择所属周期"
readonly
v-model="form._week"
></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="onSubmit"></el-button> <el-button type="primary" @click="onSubmit">{{ type === 'add' ? '' : '' }}</el-button>
<el-button @click="isShowDrawer = false">取消</el-button> <el-button @click="isShowDrawer = false">取消</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
</el-drawer> </el-drawer>
<detail ref="show" @edit="editShow"></detail>
</div> </div>
</template> </template>
<script> <script>
import { category, recordStore } from "@/api/h5/form"; import detail from "@/views/h5/form/show.vue";
import { category, recordStore, getYears, show, save } from "@/api/h5/form";
import { getToken } from "@/utils/auth";
export default { export default {
components: {
detail
},
inject: ['myInfo', 'statics'],
data() { data() {
return { return {
isShowDrawer: false, isShowDrawer: false,
formInfo: [],
customForm: {
customFormId: 11,
tableName: "asd",
},
fileList: [], fileList: [],
action: process.env.VUE_APP_UPLOAD_API, action: process.env.VUE_APP_UPLOAD_API,
select: { select: {
year: "" year: this.$moment().format("YYYY"),
}, },
years: [],
categories: [], categories: [],
table: [ table: [
{ {
type: "", type: "",
label: "", label: "",
prop: "index", prop: "index",
customFn:row => { customFn: row => {
return row._type === 'type' ? row._text : row._index; return row._type === 'type' ? row._text : row._index;
} }
}, },
{ {
prop: "title", prop: "title",
label: "清单类型名称", label: "清单类型名称",
minWidth: 300,
renderHeader: col => {
return (
<div>{ this.title ? this.title.substring(0, this.title.length - 2) + '清单' : '清单类型名称' }</div>
)
},
align: "left", align: "left",
customFn:row => { customFn: (row) => {
return row._type === 'type' ? (<span><i style="padding: 0 8px;color: rgb(239, 216, 117);" class="el-icon-folder-opened"></i><span>{row.title}</span></span>) : ( return row._type === "type" ? (
<span><i style="padding: 0 8px;" class="el-icon-document"></i><span>{row.title}</span></span>) <span>
} <i
style="padding: 0 8px;color: rgb(239, 216, 117);"
class="el-icon-folder-opened"
></i>
<span>{row.title}</span>
</span>
) : (
<span>
<i style="padding: 0 8px;" class="el-icon-document"></i>
<span>{row.title}</span>
</span>
);
},
}, },
{ {
fixed: "right",
prop: "records_count", prop: "records_count",
label: "填报数量", label: "填报要求",
customFn:row => { width: 240,
if (!row.children?.length) { customFn: row => {
return (<span>{row.records_count}</span>) return(<div>
} {
row.rules.map(item => (<div>{item.start_at} ~ {item.end_at}不少于{item.quantity}</div>))
}
</div>)
} }
}, },
{ {
prop: "btns",
label: "填报",
fixed: "right", fixed: "right",
width: 80, prop: "records_count",
customFn: row => { label: "填报情况",
if (!row.children?.length) { showOverflowTooltip: false,
return ( width: 150,
<Button customFn: (row) => {
size="small" return row._is_end ? (
type="primary" <div>
icon="ios-create" <Button type="primary" size="small" ghost on={{
on={ ['click']:_ => {
this.pickRule = row.rules
this.$refs['show'].setId(row.id)
this.$refs['show'].show()
}
}}>
查看
<Icon type="ios-search"></Icon>
</Button>
<el-dropdown size="small" disabled={!(row.rules instanceof Array && row.rules.length > 0)} style="margin-left: 10px" on={{
['command']: e => {
this.type = "add"
this.isShowDrawer = true;
this.form.category_rule_id = e;
this.form.category_id = row.id;
let rule = row.rules.find(item => (item.id === e))
this.form._week = `${rule.start_at} ~ ${rule.end_at}`
}
}}>
<Button type="primary" size="small">
填报
<Icon type="ios-arrow-down"></Icon>
</Button>
<el-dropdown-menu slot="dropdown">
{ {
['click']:_ => { row.rules.map(item => (<el-dropdown-item command={item.id}>{item.start_at} ~ {item.end_at}</el-dropdown-item>))
this.isShowDrawer = true;
this.form.category_id = row.id;
}
} }
}> </el-dropdown-menu>
填报 </el-dropdown>
</Button> </div>
) ) : '';
} },
},
{
fixed: "right",
label: "系统预警",
width: 116,
customFn: row => {
let color = ['#377e22', '#f2a93c', '#ea3423']
let nums = [
row.rules.reduce((pre, cur) => (pre + (cur.record_count?.count_normal ?? 0)),0),
row.rules.reduce((pre, cur) => (pre + (cur.record_count?.count_delayed ?? 0)),0),
row.rules.reduce((pre, cur) => (pre + (cur.record_count?.count_missed ?? 0)),0)
]
return row._is_end ? (
<div style="display: flex;">
{
Array.from({ length: 3 },_ => undefined).map((i, index) => (
<div style="display: flex;align-items: center;">
<div style={{
'color': '#fff',
'background': color[index],
'padding': '10px',
'border-radius': '100%'
}}></div>
<span style="padding: 4px;">{ nums[index] }</span>
</div>
))
}
</div>
) : ''
} }
} },
], ],
type: "add",
pickRule: [],
form: { form: {
category_rule_id: "",
category_id: "", category_id: "",
title: "", title: "",
content: "", content: "",
files: "", files: "",
belongs_year_month: "", myindex: "",
myindex: "" _week: ""
}, },
rules: { rules: {
content: [ content: [{ required: true, message: "请填写内容" }]
{ required: true, message: "请填写内容" } },
], };
belongs_year_month: [
{ required: true, message: "请选择所属月份" }
]
}
}
}, },
methods: { methods: {
async getList () { getToken,
let res = await category(this.select); beforeUpload(file) {
this.formatList(res); if (file.size / 1000 > 20 * 1024) {
this.list = res;
},
beforeUpload (file) {
if ((file.size / 1000) > (20 * 1024)) {
this.$message({ this.$message({
type: "warning", type: "warning",
message: "上传大小超过20Mb", message: "上传大小超过20Mb",
@ -146,9 +264,40 @@ export default {
return false; return false;
} }
}, },
uploadSuccess (response, file, fileList) {
this.form.files = fileList.map(i => i.response?.id).toString()
},
async getDetail (id) {
const res = await show({
id
})
this.$integrateData(this.form, res)
this.form.id = id
},
async editShow (id) {
this.type = 'edit'
await this.getDetail(id)
let rule = this.pickRule.find(i => i.id === this.form.category_rule_id)
this.form._week = `${rule.start_at} ~ ${rule.end_at}`
this.isShowDrawer = true
},
toChineseNum(number) { toChineseNum(number) {
const chineseNum = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"]; const chineseNum = [
"零",
"一",
"二",
"三",
"四",
"五",
"六",
"七",
"八",
"九",
];
const chineseUnit = ["", "十", "百", "千", "万", "亿"]; const chineseUnit = ["", "十", "百", "千", "万", "亿"];
let numStr = number.toString(); let numStr = number.toString();
let len = numStr.length; let len = numStr.length;
@ -163,53 +312,115 @@ export default {
if (str[str.length - 1] === "零") { if (str[str.length - 1] === "零") {
str = str.slice(0, -1); str = str.slice(0, -1);
} }
return str return str;
}, },
formatList (data=[],pid) { formatList(data = [], pid) {
data.forEach((item,index) => { data.forEach((item, index) => {
if (item.hasOwnProperty('categories_tree')) { if (item.hasOwnProperty('categories_tree')) {
item._id = item.id item._id = item.id
delete item.id; delete item.id;
item._disabled = true item._disabled = true
item._type = 'type' item._type = 'type'
item.children = item.categories_tree item.children = item.categories_tree
item._text = this.toChineseNum(index+1) item._text = this.toChineseNum(index + 1)
} else { } else {
item._type = 'doc' item._type = 'doc'
item._index = pid ? `${pid}-${index+1}` : (index+1) item._index = pid ? `${pid}-${index+1}` : (index + 1)
// item._index = pid ? (index+1) : (index + 1)
} }
if (item.children instanceof Array && item.children.length > 0) { if (item.children instanceof Array && item.children.length > 0) {
this.formatList(item.children,item._index ? item._index : false) this.formatList(item.children, item._index ? item._index : false)
} else {
item._is_end = 1
} }
}) })
}, },
async getCategories () { async getCategories() {
const res = await category(this.select,false) const res = await category(this.select, false);
this.formatList(res) this.formatList(res);
this.categories = res this.categories = res;
},
async getYears () {
const res = await getYears();
this.select.year = res.selected_year;
this.years = res.years;
}, },
onSubmit () {
this.$refs['elForm'].validate(res => { onSubmit() {
this.$refs["elForm"].validate((res) => {
if (res) { if (res) {
this.form.files = this.fileList.map(i => i.response.id).toString() this.form.files = this.fileList.map((i) => i.response.id).toString();
recordStore(this.form).then(res => { if (this.type === 'add') {
this.$message({ recordStore(this.form).then((res) => {
type: "success", this.$message({
message: "填报成功" type: "success",
}) message: "填报成功",
}) });
this.isShowDrawer = false;
this.getCategories()
});
} else {
save(this.form).then((res) => {
this.$message({
type: "success",
message: "修改成功",
});
this.isShowDrawer = false;
this.getCategories()
this.$refs['show'].getData()
});
}
} }
}) });
},
},
computed: {
title () {
return `${this.me?.department?.name ?? ''}-${this.me?.name ?? ''}-${this.me?.category_type?.title ?? ''}-${this.select.year}年填报总览`
},
me () {
return this.myInfo()
},
static () {
return this.statics()
}
},
watch: {
type (newVal) {
if (newVal === 'add') {
delete this.form.id
}
},
isShowDrawer (newVal) {
if (newVal) {
} else {
this.fileList = [];
this.form = {
category_rule_id: "",
category_id: "",
title: "",
content: "",
files: "",
myindex: "",
_week: ""
}
this.$refs['elForm'].clearValidate()
}
} }
}, },
computed: {},
created() { created() {
this.getCategories() this.getYears();
} this.getCategories();
}
},
};
</script> </script>
<style lang="scss"> <style lang="scss">
@ -220,10 +431,75 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.card { .card {
height: 100%; height: 100%;
background-color: #fff;
margin: 40px;
}
.info {
border-top: 1px solid #EBEEF5;
background: #faf0e9;
padding: 40px; padding: 10px 15px;
&__title {
font-size: 22px;
font-weight: 600;
padding-bottom: 8px;
}
&__status {
$color: #377e22,#f2a93c,#ea3423;
display: flex;
align-items: center;
font-size: 12px;
@mixin cir {
padding: 8px;
border-radius: 100%;
margin: 0 6px;
}
@for $i from 1 through length($color) {
.cir#{$i} {
@include cir;
background: nth($color, $i);
}
}
}
} }
::v-deep .table-tree { ::v-deep .table-tree {
height: 100%; height: 100%;
background: #f0f2f8;
}
::v-deep .el-radio__input.is-checked + .el-radio__label {
color: #c4312b;
}
::v-deep .el-radio__input.is-checked .el-radio__inner {
background-color: #c4312b;
border-color: #c4312b;
}
::v-deep .el-radio__inner {
width: 18px;
height: 18px;
}
::v-deep .el-radio__input.is-checked .el-radio__inner:after {
content: "";
width: 12px;
height: 6px;
margin-top: -1px;
border: 2px solid white;
border-top: transparent;
border-right: transparent;
text-align: center;
display: block;
position: absolute;
top: 50%;
left: 50%;
vertical-align: middle;
transform: translate(-50%, -50%) rotate(-45deg);
border-radius: 0px;
background: none;
}
::v-deep .el-tabs__nav-wrap::after {
background-color: #ebeef5;
} }
</style> </style>

@ -0,0 +1,125 @@
<template>
<div>
<el-dialog title="填报" width="860px" :visible.sync="visible">
<xy-table style="width: 820px"
stripe
ref="xyTable"
:req-opt="select"
:is-first-req="false"
:height="500"
:action="getByCategory"
:table-item="table"
:destroy-action="destroy">
</xy-table>
</el-dialog>
</div>
</template>
<script>
import { getByCategory, destroy } from "@/api/h5/form";
export default {
data() {
return {
auth: ['delete'],
visible: false,
select: {
category_id: ""
},
table: [
{
prop: "title",
label: "标题",
fixed: "left",
width: 180
},
{
prop: "created_at",
label: "填报日期",
width: 160
},
{
prop: "content",
label: "内容",
align: "left",
minWidth: 200
},
{
prop: "operate",
label: "操作",
align: "left",
width: 140,
customFn: row => {
const _this = this
return (
<div>
<Button type="primary"
size="small"
on={{
['click']:_ => {
this.$emit('edit', row.id)
}
}}>编辑</Button>
<Button type="error"
size="small"
on={{
['click']:_ => {
this.$confirm('此操作将永久删除该填报, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
destroy({
id: row.id
}).then(_ => {
this.$message({
type: 'success',
message: '删除成功!'
});
_this.$refs['xyTable'].getTableData()
})
})
}
}}>删除</Button>
</div>
)
}
}
]
}
},
methods: {
getByCategory,destroy,
show () {
this.visible = true;
},
hide () {
this.visible = false;
},
setId (id) {
this.select.category_id = id;
},
getData () {
this.$refs['xyTable'].getTableData()
}
},
computed: {},
watch: {
visible (newVal) {
if (newVal) {
this.$nextTick(_ => {
this.$refs['xyTable'].getTableData(true)
})
} else {
}
}
},
created() {
}
}
</script>
<style scoped lang="scss">
</style>

@ -1,287 +1,78 @@
<template> <template>
<div class="card"> <div class="card">
<div style="padding:15px"> <h2 class="title">欢迎进入一把手和领导班子监督平台</h2>
<el-radio-group v-model="select.year"> <Card style="padding: 20px;">
<el-radio v-for="item in years" :label="item">{{item}}</el-radio> <el-descriptions title="用户信息" :column="1">
</el-radio-group> <el-descriptions-item v-for="(value, key) in descriptions" :label="value">
</div> {{ descriptionLabel(key) }}
<xy-table ref="xyTable" </el-descriptions-item>
height="100%" <el-descriptions-item label="本年统计">
:isHandlerKey="false" 正常填报{{ static.count_normal }}迟报{{ static.count_delayed }}超期未报{{ static.count_missed }}
:is-page="false" </el-descriptions-item>
:list="categories" </el-descriptions>
res-prop="" <Button type="primary" long @click="$router.push('/h5/form')"></Button>
:indent="20" </Card>
:row-key="row => row._index" </div>
:table-item="table"
:auths="[]">
</xy-table>
<el-drawer title="填报清单" :visible.sync="isShowDrawer" position="rtl" size="560px">
<div style="padding: 20px 40px;">
<el-form class="form" ref="elForm" :model="form" :rules="rules" label-width="80px" size="small">
<el-form-item label="标题" prop="title">
<el-input v-model="form.title"></el-input>
</el-form-item>
<el-form-item label="内容" required prop="content">
<el-input type="textarea" :autosize="{ minRows:2 }" v-model="form.content"></el-input>
</el-form-item>
<el-form-item label="附件" prop="files">
<el-upload
class="upload-demo"
:action="action"
multiple
:limit="10"
:before-upload="beforeUpload"
:file-list="fileList">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
<el-form-item label="所属月份" required prop="belongs_year_month">
<el-date-picker placeholder="请选择所属月份" type="month" value-format="yyyy-MM" v-model="form.belongs_year_month"></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit"></el-button>
<el-button @click="isShowDrawer = false">取消</el-button>
</el-form-item>
</el-form>
</div>
</el-drawer>
</div>
</template> </template>
<script> <script>
import { category, recordStore } from "@/api/h5/form";
export default { export default {
components:{ inject: ['myInfo', 'statics'],
},
data() { data() {
return { return {
isShowDrawer: false, descriptions: {
formInfo:[], "department.name": "市委",
customForm:{ "name": "姓名",
customFormId:11, "position": "职位",
tableName:'asd' "start_at": "开始填报",
}, "end_at": "结束填报"
fileList: [],
action: process.env.VUE_APP_UPLOAD_API,
select: {
year: this.$moment().format('YYYY')
},
years: [],
categories: [],
table: [
{
type: "",
label: "",
prop: "index",
customFn:row => {
return row._type === 'type' ? row._text : row._index;
}
},
{
prop: "title",
label: "清单类型名称",
align: "left",
customFn:row => {
return row._type === 'type' ? (<span><i style="padding: 0 8px;color: rgb(239, 216, 117);" class="el-icon-folder-opened"></i><span>{row.title}</span></span>) : (
<span><i style="padding: 0 8px;" class="el-icon-document"></i><span>{row.title}</span></span>)
}
},
{
label: "年份",
prop: "year",
width:120,
customFn:row => {
return row._type === 'type' ? '--' : row.year;
}
},
{
prop: "records_count",
label: "填报数量",
customFn:row => {
if (!row.children?.length) {
return (<span>{row.records_count}</span>)
}
}
},
{
prop: "btns",
label: "填报",
fixed: "right",
width: 80,
customFn: row => {
if (!row.children?.length) {
return (
<Button
size="small"
type="primary"
icon="ios-create"
on={
{
['click']:_ => {
// this.isShowDrawer = true;
// this.form.category_id = row.id;
this.openDialog(row.id)
}
}
}>
填报
</Button>
)
}
}
}
],
form: {
category_id: "",
title: "",
content: "",
files: "",
belongs_year_month: "",
myindex: ""
},
rules: {
content: [
{ required: true, message: "请填写内容" }
],
belongs_year_month: [
{ required: true, message: "请选择所属月份" }
]
} }
} }
}, },
methods: { methods: {
beforeUpload (file) {
if ((file.size / 1000) > (20 * 1024)) {
this.$message({
type: "warning",
message: "上传大小超过20Mb",
});
return false;
}
},
getSelectYear() {
const currentYear = this.$moment().format('YYYY');
const years = [];
for (let i = currentYear; i >= 2017; i--) {
years.push(i);
}
this.years = years
},
toChineseNum(number) {
const chineseNum = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
const chineseUnit = ["", "十", "百", "千", "万", "亿"];
let numStr = number.toString();
let len = numStr.length;
let str = "";
for (let i = 0; i < len; i++) {
str += chineseNum[parseInt(numStr[i])] + chineseUnit[len - 1 - i];
}
str = str.replace(/零[十百千]/g, "零");
str = str.replace(/零+/g, "零");
str = str.replace(/^零+/, "");
str = str.replace(/零+$/, "");
if (str[str.length - 1] === "零") {
str = str.slice(0, -1);
}
return str
},
formatList (data=[],pid) { },
data.forEach((item,index) => { computed: {
if (item.hasOwnProperty('categories_tree')) { static () {
item._id = item.id return this.statics()
delete item.id;
item._disabled = true
item._type = 'type'
item.children = item.categories_tree
item._text = this.toChineseNum(index+1)
} else {
item._type = 'doc'
item._index = pid ? `${pid}-${index+1}` : (index+1)
}
if (item.children instanceof Array && item.children.length > 0) {
this.formatList(item.children,item._index ? item._index : false)
}
})
}, },
async getCategories () { me () {
const res = await category(this.select,false) return this.myInfo()
this.formatList(res)
this.categories = res
}, },
descriptionLabel () {
onSubmit () { return function (key) {
this.$refs['elForm'].validate(res => { if (!this.me) return ""
if (res) { let splitKey = key.split(".")
this.form.files = this.fileList.map(i => i.response.id).toString() if (splitKey.length > 0) {
recordStore(this.form).then(res => { let res = {}
this.$message({ splitKey.forEach((k, index) => {
type: "success", res = index === 0 ? this.me[k] : res[k]
message: "填报成功"
})
this.isShowDrawer = false;
}) })
return res
} else {
return this.me[key] || ""
} }
}) }
}, }
},
computed: {},
created() {
this.getSelectYear()
this.getCategories()
} }
} }
</script> </script>
<style lang="scss">
.el-cascader-node__label {
max-width: 300px;
}
</style>
<style scoped lang="scss"> <style scoped lang="scss">
.card { .card {
height: 100%; $width: 46vw;
background-color: #fff; $height: 56vh;
margin: 40px; width: $width;
} height: $height;
::v-deep .table-tree {
height: 100%;
}
::v-deep .el-radio__input.is-checked+.el-radio__label {
color: #c4312b;
}
::v-deep .el-radio__input.is-checked .el-radio__inner { position: absolute;
background-color: #c4312b; left: calc(50% - #{$width} / 2);
border-color: #c4312b; top: calc(50% - #{$height} / 2);
}
::v-deep .el-radio__inner{ .title {
width:18px;
height:18px;
}
::v-deep .el-radio__input.is-checked .el-radio__inner:after {
content: '';
width: 12px;
height: 6px;
margin-top:-1px;
border: 2px solid white;
border-top: transparent;
border-right: transparent;
text-align: center; text-align: center;
display: block; padding: 20px 0;
position: absolute;
top: 50%;
left: 50%;
vertical-align: middle;
transform: translate(-50%, -50%) rotate(-45deg);
border-radius: 0px;
background: none;
}
::v-deep .el-tabs__nav-wrap::after{
background-color: #EBEEF5;
} }
}
</style> </style>

@ -1,6 +1,6 @@
<template> <template>
<div style="width: 100%;height: 100%;"> <div style="width: 100%;height: 100%;" id="h5-page">
<Menu class="menu" mode="horizontal" theme="primary" active-name="1"> <Menu class="menu" mode="horizontal" theme="primary" :active-name="name" @on-select="e => name = e">
<MenuItem name="1" to="/h5/index"> <MenuItem name="1" to="/h5/index">
<Icon type="ios-home" /> <Icon type="ios-home" />
首页 首页
@ -22,25 +22,6 @@
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</div> </div>
<!-- <Submenu name="3">-->
<!-- <template slot="title">-->
<!-- <Icon type="ios-stats" />-->
<!-- 统计分析-->
<!-- </template>-->
<!-- <MenuGroup title="使用">-->
<!-- <MenuItem name="3-1">新增和启动</MenuItem>-->
<!-- <MenuItem name="3-2">活跃分析</MenuItem>-->
<!-- <MenuItem name="3-3">时段分析</MenuItem>-->
<!-- </MenuGroup>-->
<!-- <MenuGroup title="留存">-->
<!-- <MenuItem name="3-4">用户留存</MenuItem>-->
<!-- <MenuItem name="3-5">流失用户</MenuItem>-->
<!-- </MenuGroup>-->
<!-- </Submenu>-->
<!-- <MenuItem name="4">-->
<!-- <Icon type="ios-construct" />-->
<!-- 综合设置-->
<!-- </MenuItem>-->
</Menu> </Menu>
<section class="app-main__h5"> <section class="app-main__h5">
@ -52,12 +33,32 @@
</template> </template>
<script> <script>
import { getBaseInfo } from "@/api/h5/login";
import {getYearStatistics} from "@/api/h5/form";
export default { export default {
provide() {
return {
myInfo: () => this.myInfo,
statics: () => this.statics,
}
},
data() { data() {
return { return {
name: "1",
myInfo: null,
statics: {
count_normal: 0,
count_delayed: 0,
count_missed: 0
}
} }
}, },
methods: { methods: {
async getStatics () {
this.statics = await getYearStatistics(this.select);
},
async logout() { async logout() {
await this.$store.dispatch('user/logout') await this.$store.dispatch('user/logout')
this.$router.push(`/h5/login?redirect=${this.$route.fullPath}`) this.$router.push(`/h5/login?redirect=${this.$route.fullPath}`)
@ -68,6 +69,10 @@ export default {
return this.$route.path return this.$route.path
} }
}, },
created() {
this.getStatics();
getBaseInfo().then(res => (this.myInfo = res))
}
} }
</script> </script>
@ -144,3 +149,12 @@ export default {
height: calc(100% - 60px); height: calc(100% - 60px);
} }
</style> </style>
<style>
#app:has(#h5-page) {
height: auto;
min-height: 100%;
background: url("../../assets/bkg.png") no-repeat;
background-size: cover;
padding-bottom: 50px;
}
</style>

@ -172,11 +172,12 @@ export default {
this.$store this.$store
.dispatch("user/login", this.loginForm) .dispatch("user/login", this.loginForm)
.then(() => { .then(() => {
console.log(this.redirect); setTimeout(() => {
this.$router.push({ this.$router.push({
path: this.redirect || "/h5/index", path: this.redirect || "/h5/index",
}); });
this.loading = false; this.loading = false;
}, 500)
}) })
.catch(() => { .catch(() => {
this.loading = false; this.loading = false;

@ -24,7 +24,7 @@ module.exports = {
* In most cases please use '/' !!! * In most cases please use '/' !!!
* Detail: https://cli.vuejs.org/config/#publicpath * Detail: https://cli.vuejs.org/config/#publicpath
*/ */
publicPath: '/admin/', publicPath: process.env.ENV === 'staging' ? '/admin_test' : '/admin',
outputDir: './dist', outputDir: './dist',
assetsDir: 'static', assetsDir: 'static',
css: { css: {
@ -35,10 +35,6 @@ module.exports = {
sass:{ sass:{
prependData: '@import "@/styles/index.scss";' prependData: '@import "@/styles/index.scss";'
} }
},
extract: { // 打包后css文件名称添加时间戳
filename: `static/css/[name].${timeStamp}.css`,
chunkFilename: `static/css/chunk.[id].${timeStamp}.css`
} }
}, },
lintOnSave: process.env.NODE_ENV === 'development', lintOnSave: process.env.NODE_ENV === 'development',
@ -69,10 +65,6 @@ module.exports = {
alias: { alias: {
'@': resolve('src') '@': resolve('src')
} }
},
output: {
filename: `js/[name]-${timeStamp}.js`,
chunkFilename: `js/[name]-${timeStamp}.js`
} }
}, },
chainWebpack(config) { chainWebpack(config) {

Loading…
Cancel
Save