..
This commit is contained in:
@@ -170,3 +170,74 @@ body {
|
||||
margin-top: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
|
||||
/*****************************申请表单CSS********************************/
|
||||
.form-container {
|
||||
padding-bottom: 80px;
|
||||
}
|
||||
|
||||
.form-container .form-group {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.form-container .form-actions {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
padding: 12px 16px;
|
||||
background-color: #ffffff;
|
||||
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.form-container .form-actions .van-button {
|
||||
flex: 1;
|
||||
margin: 0 8px;
|
||||
border-radius: 4px;
|
||||
height: 40px;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.form-container .van-cell-group {
|
||||
margin-bottom: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.form-container .van-cell-group__title {
|
||||
padding: 12px 16px 8px;
|
||||
font-size: 15px;
|
||||
color: #323233;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.form-container .van-field__label {
|
||||
width: 90px;
|
||||
color: #323233;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.form-container .van-field__value {
|
||||
color: #323233;
|
||||
}
|
||||
|
||||
.form-container .van-cell {
|
||||
padding: 12px 16px;
|
||||
}
|
||||
|
||||
.form-container .van-cell:not(:last-child)::after {
|
||||
left: 16px;
|
||||
right: 16px;
|
||||
}
|
||||
|
||||
.form-container .direction-column-field .van-field__body {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.form-container .direction-column-field .van-field__control {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,27 +65,32 @@ const styleUtil = {
|
||||
|
||||
// 为CSS规则添加作用域属性
|
||||
scopeCss(css, scopedId) {
|
||||
// 处理CSS规则,为每个选择器添加[scopedId]
|
||||
const processedCss = css.replace(/([^{]+){/g, (match, selectors) => {
|
||||
return selectors.split(',')
|
||||
// 使用正则表达式匹配CSS选择器和规则块
|
||||
// 这种方法可以确保我们只处理选择器部分,而不会影响CSS属性值
|
||||
return css.replace(/([^{]+)({[^}]*})/g, (match, selectors, rules) => {
|
||||
// 处理选择器部分
|
||||
const processedSelectors = selectors.split(',')
|
||||
.map(selector => {
|
||||
selector = selector.trim();
|
||||
|
||||
// 处理深度选择器
|
||||
if (selector.includes('::v-deep')) {
|
||||
return selector.replace('::v-deep', `[${scopedId}]`);
|
||||
}
|
||||
|
||||
// 处理媒体查询等特殊情况
|
||||
if (selector.includes('@') || selector.trim().startsWith('@')) {
|
||||
if (selector.includes('@') || selector.startsWith('@')) {
|
||||
return selector;
|
||||
}
|
||||
|
||||
// 普通选择器
|
||||
return `${selector.trim()}[${scopedId}]`
|
||||
return `${selector}[${scopedId}]`;
|
||||
})
|
||||
.join(',') + '{'
|
||||
})
|
||||
.join(', ');
|
||||
|
||||
return processedCss
|
||||
// 返回处理后的选择器和原始规则块
|
||||
return processedSelectors + rules;
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
<script>
|
||||
module.exports = {
|
||||
name: "index"
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
+1
-1
@@ -147,7 +147,7 @@ layout("/layouts/platform.html"){
|
||||
<!-- </el-form-item>-->
|
||||
</el-form>
|
||||
<el-row justify="end" type="flex" v-if="isWriteTime">
|
||||
<el-button @click="onSave" type="primary">保存</el-button>
|
||||
<el-button type="primary" @click="onSave">保存</el-button>
|
||||
<el-button type="primary" @click="onSubmit" v-if="!taskId">提交</el-button>
|
||||
<el-button type="primary" @click="onSubmitAgain" v-else>提交</el-button>
|
||||
</el-row>
|
||||
|
||||
+129
-32
@@ -16,7 +16,7 @@ layout("/layouts/platform_h5.html"){
|
||||
</van-text-dialog>
|
||||
|
||||
<van-cell-group>
|
||||
<form @submit.prevent="doSave">
|
||||
<form ref="formRef">
|
||||
<van-field v-model="formData.createUserName" label="代表姓名" readonly></van-field>
|
||||
<van-field v-model="formData.createTime" label="提案时间" readonly></van-field>
|
||||
|
||||
@@ -144,8 +144,10 @@ layout("/layouts/platform_h5.html"){
|
||||
<h5-signature v-model="formData.signature" slot="input"></h5-signature>
|
||||
</van-field>
|
||||
|
||||
<van-cell cell-class="form-button-cell" v-if="showButton">
|
||||
<van-button type="primary" size="large" block native-type="submit">保存到我的提案</van-button>
|
||||
<van-cell cell-class="form-button-cell" v-if="isWriteTime">
|
||||
<van-button type="primary" @click="onSave">保存</van-button>
|
||||
<van-button type="info" @click="onSubmit" v-if="!taskId">提交</van-button>
|
||||
<van-button type="info" @click="onSubmitAgain" v-else>提交</van-button>
|
||||
</van-cell>
|
||||
</form>
|
||||
</van-cell-group>
|
||||
@@ -157,6 +159,9 @@ layout("/layouts/platform_h5.html"){
|
||||
dicts: ["PROPOSAL_TYPE"],
|
||||
data() {
|
||||
return {
|
||||
bizId: GetQueryString("bizId"),
|
||||
taskId: GetQueryString("taskId"),
|
||||
|
||||
formData: {},
|
||||
showSourcePicker: false,
|
||||
showSessionPicker: false,
|
||||
@@ -189,18 +194,91 @@ layout("/layouts/platform_h5.html"){
|
||||
},
|
||||
methods: {
|
||||
historyBack,
|
||||
doSave() {
|
||||
formRules(this.rules, this.formData, (valid) => {
|
||||
if (valid) {
|
||||
this.$axios.post("/platform/proposal/write/save", { info: JSON.stringify(this.formData) }).then((res) => {
|
||||
|
||||
async onSave() {
|
||||
this.$refs['formRef'].validate().then(async valid => {
|
||||
console.log( valid)
|
||||
})
|
||||
|
||||
|
||||
|
||||
// const valid = await this.$refs["addForm"].validate()
|
||||
// if (valid) {
|
||||
// if (!this.formData.name || this.formData.name.trim().length < 1) {
|
||||
// this.$message.warning("请填写提案名称")
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// this.$axios.post("/platform/proposal/write/save", {info: JSON.stringify(this.formData)}).then((res) => {
|
||||
// if (res.code === 0) {
|
||||
// this.$message.success(res.msg)
|
||||
// this.formData = res.data
|
||||
// window.location.href = '/platform/proposal/mine'
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
},
|
||||
|
||||
|
||||
// 提交
|
||||
async onSubmit() {
|
||||
const valid = await this.$refs["addForm"].validate()
|
||||
if (valid) {
|
||||
if (!this.formData.name || this.formData.name.trim().length < 1) {
|
||||
this.$message.warning("请填写提案名称")
|
||||
return
|
||||
}
|
||||
if (this.formData.brief.length < this.proposalConfig.briefMinLength) {
|
||||
this.$message.warning("提案内容和依据最少为" + this.proposalConfig.briefMinLength + "字")
|
||||
return
|
||||
}
|
||||
|
||||
this.$confirm("您确定要提交吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post('/platform/proposal/write/submit', {info: JSON.stringify(this.formData)}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$toast.success(res.msg)
|
||||
this.$pjaxReplace("/platform/h5/proposal/mine")
|
||||
this.$message.success("提交成功")
|
||||
window.location.href = '/platform/proposal/mine'
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
// 重新提交
|
||||
async onSubmitAgain() {
|
||||
const valid = await this.$refs["addForm"].validate()
|
||||
if (valid) {
|
||||
if (!this.formData.name || this.formData.name.trim().length < 1) {
|
||||
this.$message.warning("请填写提案名称")
|
||||
return
|
||||
}
|
||||
if (this.formData.brief.length < this.proposalConfig.briefMinLength) {
|
||||
this.$message.warning("提案内容和依据最少为" + this.proposalConfig.briefMinLength + "字")
|
||||
return
|
||||
}
|
||||
|
||||
this.$confirm("您确定要提交吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post('/platform/proposal/write/submitAgain', {
|
||||
info: JSON.stringify(this.formData),
|
||||
taskId: GetQueryString("taskId")
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success("提交成功")
|
||||
window.location.href = '/platform/proposal/mine'
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
sourceConfirm(val) {
|
||||
this.showSourcePicker = false
|
||||
this.formData.source = val.code
|
||||
@@ -227,6 +305,7 @@ layout("/layouts/platform_h5.html"){
|
||||
this.formData.typeName = val.name
|
||||
},
|
||||
|
||||
// 获取提案类别
|
||||
listProposalType() {
|
||||
this.$axios.post("/platform/proposal/common/listProposalType").then((res) => {
|
||||
if (res.code === 0) {
|
||||
@@ -235,6 +314,7 @@ layout("/layouts/platform_h5.html"){
|
||||
})
|
||||
},
|
||||
|
||||
// 获取配置
|
||||
getProposalConfig() {
|
||||
return this.$axios.post("/platform/proposal/common/config").then((res) => {
|
||||
if (res.code === 0) {
|
||||
@@ -243,26 +323,36 @@ layout("/layouts/platform_h5.html"){
|
||||
})
|
||||
},
|
||||
|
||||
//教代会change
|
||||
async meetingChange(val) {
|
||||
this.formData.delegationId = null
|
||||
this.formData.committeeId = null
|
||||
this.listDelegation()
|
||||
this.searchMineDelegation()
|
||||
// this.delegationOptions = await proposal.getDelegation(val)
|
||||
// this.committeeOptions = await this.getInstitutions(val)
|
||||
},
|
||||
|
||||
// 获取代表团
|
||||
listDelegation() {
|
||||
return this.$axios.post("/platform/proposal/common/listDelegation", { sessionId: this.formData.sessionId }).then((res) => {
|
||||
return this.$axios.post("/platform/proposal/common/listDelegation", {sessionId: this.formData.sessionId}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.delegationOptions = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 查询开启的教代会
|
||||
listOpenSession(isModify = false) {
|
||||
return this.$axios.post("/platform/proposal/common/listOpenSession").then(async (res) => {
|
||||
this.$axios.post("/platform/proposal/common/listOpenSession").then(async (res) => {
|
||||
if (res.code === 0) {
|
||||
this.sessionOptions = res.data
|
||||
if (!isModify && this.sessionOptions) {
|
||||
this.$set(this.formData, "sessionId", this.sessionOptions[0].id)
|
||||
this.$set(this.formData, "sessionName", this.sessionOptions[0].fullName)
|
||||
// 获取代表团
|
||||
await this.searchMineDelegation()
|
||||
// 检查是否在撰写时间内
|
||||
this.checkWriteTime()
|
||||
}
|
||||
await this.listDelegation()
|
||||
await this.listSource()
|
||||
@@ -288,31 +378,38 @@ layout("/layouts/platform_h5.html"){
|
||||
})
|
||||
},
|
||||
|
||||
// 检查是否在撰写时间内
|
||||
checkWriteTime() {
|
||||
this.$axios.post("/platform/proposal/write/checkWriteTime", {sessionId: this.formData.sessionId}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
if (!res.data) {
|
||||
this.$message.warning("当前时间不在撰写时间段内")
|
||||
this.isWriteTime = false
|
||||
} else {
|
||||
this.isWriteTime = true
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
init() {
|
||||
const id = GetQueryString("id")
|
||||
if (id) {
|
||||
this.$axios.post("/platform/proposal/write/detail", { id }).then(async (res) => {
|
||||
if (this.bizId) {
|
||||
this.$axios.post("/platform/proposal/write/detail", {id: this.bizId}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.formData = res.data
|
||||
await this.listOpenSession(true)
|
||||
this.$set(this.formData, "sourceName", this.sourceOptions.find((v) => v.code === this.formData.source)?.name)
|
||||
this.$set(this.formData, "sessionName", this.sessionOptions.find((v) => v.id === this.formData.sessionId)?.fullName)
|
||||
this.$set(this.formData, "delegationName", this.delegationOptions.find((v) => v.id === this.formData.delegationId)?.name)
|
||||
this.$set(this.formData, "typeName", this.typeOptions.find((v) => v.id === this.formData.typeId)?.name)
|
||||
this.listOpenSession(true)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
vant.Dialog.alert({
|
||||
title: "提示",
|
||||
message: "本届提案征集已结束!"
|
||||
})
|
||||
this.showButton = false
|
||||
// this.noticeDialogVisible = true
|
||||
// this.listOpenSession(false)
|
||||
// this.$set(this.formData, "createUserId", this.$store.state.user.id)
|
||||
// this.$set(this.formData, "createUserName", this.$store.state.user.username)
|
||||
// this.$set(this.formData, "createUserLoginName", this.$store.state.user.loginname)
|
||||
// this.$set(this.formData, "createTime", this.$moment().format("YYYY-MM-DD"))
|
||||
this.listOpenSession(false)
|
||||
|
||||
this.$set(this.formData, "createUserId", this.$store.state.user.id)
|
||||
this.$set(this.formData, "createUserName", this.$store.state.user.username)
|
||||
this.$set(this.formData, "createUserLoginName", this.$store.state.user.loginname)
|
||||
this.$set(this.formData, "createTime", this.$moment().format("YYYY-MM-DD"))
|
||||
this.$set(this.formData, "mobile", this.$store.state.user.mobile)
|
||||
this.$set(this.formData, "unitName", this.$store.state.user.unit?.name)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
+633
@@ -0,0 +1,633 @@
|
||||
<!--#
|
||||
layout("/layouts/platform_h5.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
/*.page-container {*/
|
||||
/* background-color: #ffffff;*/
|
||||
/* min-height: 100vh;*/
|
||||
/* padding-bottom: 80px;*/
|
||||
/*}*/
|
||||
|
||||
/*.form-group {*/
|
||||
/* margin-bottom: 12px;*/
|
||||
/*}*/
|
||||
|
||||
/*.form-actions {*/
|
||||
/* position: fixed;*/
|
||||
/* bottom: 0;*/
|
||||
/* left: 0;*/
|
||||
/* right: 0;*/
|
||||
/* display: flex;*/
|
||||
/* justify-content: space-around;*/
|
||||
/* padding: 12px 16px;*/
|
||||
/* background-color: #ffffff;*/
|
||||
/* box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);*/
|
||||
/* z-index: 100;*/
|
||||
/*}*/
|
||||
|
||||
/*.form-actions .van-button {*/
|
||||
/* flex: 1;*/
|
||||
/* margin: 0 8px;*/
|
||||
/* border-radius: 4px;*/
|
||||
/* height: 40px;*/
|
||||
/* font-size: 15px;*/
|
||||
/*}*/
|
||||
|
||||
/*.notice-dialog-content {*/
|
||||
/* max-height: 60vh;*/
|
||||
/* overflow-y: auto;*/
|
||||
/*}*/
|
||||
|
||||
/*.van-cell-group {*/
|
||||
/* margin-bottom: 12px;*/
|
||||
/* overflow: hidden;*/
|
||||
/*}*/
|
||||
|
||||
/*.van-cell-group__title {*/
|
||||
/* padding: 12px 16px 8px;*/
|
||||
/* font-size: 15px;*/
|
||||
/* color: #323233;*/
|
||||
/* font-weight: bold;*/
|
||||
/*}*/
|
||||
|
||||
/*.van-field__label {*/
|
||||
/* width: 90px;*/
|
||||
/* color: #323233;*/
|
||||
/* font-size: 14px;*/
|
||||
/*}*/
|
||||
|
||||
/*.van-field__value {*/
|
||||
/* color: #323233;*/
|
||||
/*}*/
|
||||
|
||||
/*.van-cell {*/
|
||||
/* padding: 12px 16px;*/
|
||||
/*}*/
|
||||
|
||||
/*.van-cell:not(:last-child)::after {*/
|
||||
/* left: 16px;*/
|
||||
/* right: 16px;*/
|
||||
/*}*/
|
||||
|
||||
/*.direction-column-field .van-field__body {*/
|
||||
/* display: block;*/
|
||||
/*}*/
|
||||
|
||||
/*.direction-column-field .van-field__control {*/
|
||||
/* margin-top: 8px;*/
|
||||
/*}*/
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<van-nav-bar title="撰写提案" left-text="返回" left-arrow @click-left="onClickLeft" placeholder fixed z-index="999"
|
||||
class="custom-nav"></van-nav-bar>
|
||||
|
||||
<div class="form-container">
|
||||
<van-form ref="addForm" @submit="onSubmit">
|
||||
<!-- 基本信息 -->
|
||||
<van-cell-group title="基本信息">
|
||||
<van-field
|
||||
v-model="formData.createUserName"
|
||||
label="代表姓名"
|
||||
readonly
|
||||
:rules="[{ required: true, message: '请填写提案人' }]"
|
||||
></van-field>
|
||||
|
||||
<van-field
|
||||
v-model="formData.createTime"
|
||||
label="提案时间"
|
||||
readonly
|
||||
:rules="[{ required: true, message: '请填写提案时间' }]"
|
||||
></van-field>
|
||||
|
||||
<van-field
|
||||
v-model="formData.sessionName"
|
||||
is-link
|
||||
readonly
|
||||
name="教代会"
|
||||
label="所属教代会"
|
||||
placeholder="请选择所属教代会"
|
||||
@click="showSessionPicker = true"
|
||||
:rules="[{ required: true, message: '请选择所属教代会' }]"
|
||||
></van-field>
|
||||
<van-popup v-model="showSessionPicker" position="bottom">
|
||||
<van-picker
|
||||
show-toolbar
|
||||
:columns="sessionOptions.map(item => ({text: item.fullName, value: item.id}))"
|
||||
@confirm="onSessionConfirm"
|
||||
@cancel="showSessionPicker = false"
|
||||
></van-picker>
|
||||
</van-popup>
|
||||
|
||||
<van-field
|
||||
v-model="formData.delegationName"
|
||||
label="所属代表团"
|
||||
readonly
|
||||
:rules="[{ required: true, message: '请选择所属代表团' }]"
|
||||
></van-field>
|
||||
|
||||
<van-field
|
||||
v-if="formData.mannerCode=='W03'"
|
||||
v-model="formData.committeeName"
|
||||
is-link
|
||||
readonly
|
||||
name="委员会"
|
||||
label="所属委员会"
|
||||
placeholder="请选择所属委员会"
|
||||
@click="showCommitteePicker = true"
|
||||
:rules="[{ required: true, message: '请选择所属委员会' }]"
|
||||
></van-field>
|
||||
<van-popup v-model="showCommitteePicker" position="bottom">
|
||||
<van-picker
|
||||
show-toolbar
|
||||
:columns="committeeOptions.map(item => ({text: item.name, value: item.id}))"
|
||||
@confirm="onCommitteeConfirm"
|
||||
@cancel="showCommitteePicker = false"
|
||||
></van-picker>
|
||||
</van-popup>
|
||||
|
||||
<van-field
|
||||
v-model="formData.unitName"
|
||||
label="单位"
|
||||
readonly
|
||||
:rules="[{ required: true, message: '请填写单位' }]"
|
||||
></van-field>
|
||||
|
||||
<van-field
|
||||
v-model="formData.mobile"
|
||||
label="联系电话"
|
||||
type="tel"
|
||||
placeholder="请输入联系电话"
|
||||
:rules="[{ required: true, message: '请填写联系电话' }]"
|
||||
></van-field>
|
||||
|
||||
</van-cell-group>
|
||||
|
||||
<van-cell-group title="提案信息" class="form-group">
|
||||
<van-field
|
||||
v-model="formData.name"
|
||||
label="提案名称"
|
||||
placeholder="请输入提案名称"
|
||||
:rules="[{ required: true, message: '请填写提案名称' }]"
|
||||
maxlength="100"
|
||||
show-word-limit
|
||||
></van-field>
|
||||
|
||||
<van-field
|
||||
v-model="formData.sourceName"
|
||||
is-link
|
||||
readonly
|
||||
name="提案方式"
|
||||
label="提案方式"
|
||||
placeholder="请选择提案方式"
|
||||
@click="showSourcePicker = true"
|
||||
:rules="[{ required: true, message: '请选择提案方式' }]"
|
||||
></van-field>
|
||||
<van-popup v-model="showSourcePicker" position="bottom">
|
||||
<van-picker
|
||||
show-toolbar
|
||||
:columns="sourceOptions.map(item => ({text: item.name, value: item.code}))"
|
||||
@confirm="onSourceConfirm"
|
||||
@cancel="showSourcePicker = false"
|
||||
></van-picker>
|
||||
</van-popup>
|
||||
|
||||
<van-field
|
||||
v-model="formData.typeName"
|
||||
is-link
|
||||
readonly
|
||||
name="提案类别"
|
||||
label="提案类别"
|
||||
placeholder="请选择提案类别"
|
||||
@click="showTypePicker = true"
|
||||
:rules="[{ required: true, message: '请选择提案类别' }]"
|
||||
></van-field>
|
||||
<van-popup v-model="showTypePicker" position="bottom">
|
||||
<van-picker
|
||||
show-toolbar
|
||||
:columns="typeOptions.map(item => ({text: item.name, value: item.id}))"
|
||||
@confirm="onTypeConfirm"
|
||||
@cancel="showTypePicker = false"
|
||||
></van-picker>
|
||||
</van-popup>
|
||||
|
||||
</van-cell-group>
|
||||
|
||||
<van-cell-group title="提案内容" class="form-group">
|
||||
<van-field
|
||||
v-model="formData.researchFindings"
|
||||
label="调研情况"
|
||||
type="textarea"
|
||||
rows="4"
|
||||
autosize
|
||||
placeholder="请输入调研情况"
|
||||
:rules="[{ required: true, message: '请填写调研情况' }]"
|
||||
></van-field>
|
||||
|
||||
<van-field
|
||||
v-model="formData.brief"
|
||||
label="案由"
|
||||
type="textarea"
|
||||
rows="6"
|
||||
autosize
|
||||
placeholder="请输入案由"
|
||||
:rules="[{ required: true, message: '请填写案由' }]"
|
||||
></van-field>
|
||||
|
||||
<van-field
|
||||
v-model="formData.measures"
|
||||
label="建议措施"
|
||||
type="textarea"
|
||||
rows="6"
|
||||
autosize
|
||||
placeholder="请输入建议措施"
|
||||
:rules="[{ required: true, message: '请填写建议措施' }]"
|
||||
></van-field>
|
||||
|
||||
</van-cell-group>
|
||||
|
||||
<!-- 附件上传 -->
|
||||
<van-cell-group title="附件上传" class="form-group">
|
||||
<van-field label="附件" name="files" required class="direction-column-field">
|
||||
<h5-file-upload
|
||||
slot="input"
|
||||
:value.sync="formData.files"
|
||||
:upload_number="10"
|
||||
upload_mode="file"
|
||||
upload_result_category="array"
|
||||
upload_result_type="url"
|
||||
complete_result
|
||||
></h5-file-upload>
|
||||
</van-field>
|
||||
</van-cell-group>
|
||||
|
||||
<!-- 按钮区域 -->
|
||||
<div class="form-actions" v-if="isWriteTime">
|
||||
<van-button plain type="info" @click="onSave">保存</van-button>
|
||||
<van-button type="primary" @click="onSubmit" v-if="!taskId">提交</van-button>
|
||||
<van-button type="primary" @click="onSubmitAgain" v-else>提交</van-button>
|
||||
</div>
|
||||
</van-form>
|
||||
</div>
|
||||
|
||||
<!-- 提案撰写须知弹窗 -->
|
||||
<van-dialog
|
||||
v-model="noticeDialogVisible"
|
||||
title="提案撰写须知"
|
||||
show-cancel-button
|
||||
confirm-button-text="我已知晓"
|
||||
@confirm="noticeDialogVisible = false"
|
||||
>
|
||||
<div class="notice-dialog-content" v-html="proposalConfig.writeRemind"></div>
|
||||
</van-dialog>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
new Vue({
|
||||
el: '#app',
|
||||
store,
|
||||
data() {
|
||||
return {
|
||||
bizId: GetQueryString("bizId"),
|
||||
taskId: GetQueryString("taskId"),
|
||||
|
||||
formData: {},
|
||||
sessionOptions: [],
|
||||
sourceOptions: [],
|
||||
delegationOptions: [],
|
||||
committeeOptions: [],
|
||||
typeOptions: [],
|
||||
|
||||
showSessionPicker: false,
|
||||
showSourcePicker: false,
|
||||
showTypePicker: false,
|
||||
showCommitteePicker: false,
|
||||
|
||||
// 移除不必要的变量声明,这些值现在直接存储在formData对象中
|
||||
|
||||
fileList: [],
|
||||
|
||||
proposalConfig: {},
|
||||
noticeDialogVisible: false,
|
||||
|
||||
isWriteTime: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClickLeft() {
|
||||
history.back();
|
||||
},
|
||||
|
||||
// 选择器确认事件
|
||||
onSessionConfirm(value) {
|
||||
this.formData.sessionId = value.value;
|
||||
const selectedOption = this.sessionOptions.find(item => item.id === value.value);
|
||||
if (selectedOption) {
|
||||
this.$set(this.formData, 'sessionName', selectedOption.fullName);
|
||||
}
|
||||
this.showSessionPicker = false;
|
||||
this.meetingChange(value.value);
|
||||
},
|
||||
|
||||
onSourceConfirm(value) {
|
||||
this.formData.source = value.value;
|
||||
this.$set(this.formData, 'sourceName', value.text);
|
||||
this.showSourcePicker = false;
|
||||
},
|
||||
|
||||
onTypeConfirm(value) {
|
||||
this.formData.typeId = value.value;
|
||||
this.$set(this.formData, 'typeName', value.text);
|
||||
this.showTypePicker = false;
|
||||
},
|
||||
|
||||
onCommitteeConfirm(value) {
|
||||
this.formData.committeeId = value.value;
|
||||
this.$set(this.formData, 'committeeName', value.text);
|
||||
this.showCommitteePicker = false;
|
||||
},
|
||||
|
||||
async onSave() {
|
||||
// 表单验证
|
||||
try {
|
||||
await this.$refs.addForm.validate();
|
||||
|
||||
if (!this.formData.name || this.formData.name.trim().length < 1) {
|
||||
this.$toast("请填写提案名称");
|
||||
return;
|
||||
}
|
||||
|
||||
this.$toast.loading({
|
||||
message: '保存中...',
|
||||
forbidClick: true,
|
||||
});
|
||||
|
||||
this.$axios.post("/platform/proposal/write/save", {info: JSON.stringify(this.formData)})
|
||||
.then((res) => {
|
||||
this.$toast.clear();
|
||||
if (res.code === 0) {
|
||||
this.$toast.success(res.msg);
|
||||
this.formData = res.data;
|
||||
setTimeout(() => {
|
||||
pjaxReplace('/platform/h5/proposal/mine')
|
||||
}, 1500);
|
||||
} else {
|
||||
this.$toast.fail(res.msg || '保存失败');
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.$toast.clear();
|
||||
this.$toast.fail('网络错误,请稍后重试');
|
||||
});
|
||||
} catch (error) {
|
||||
// 表单验证失败
|
||||
console.log('表单验证失败', error);
|
||||
}
|
||||
},
|
||||
|
||||
// 提交
|
||||
async onSubmit() {
|
||||
try {
|
||||
await this.$refs.addForm.validate();
|
||||
|
||||
if (!this.formData.name || this.formData.name.trim().length < 1) {
|
||||
this.$toast("请填写提案名称");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.formData.brief.length < this.proposalConfig.briefMinLength) {
|
||||
this.$toast("提案内容和依据最少为" + this.proposalConfig.briefMinLength + "字");
|
||||
return;
|
||||
}
|
||||
|
||||
this.$dialog.confirm({
|
||||
title: '提示',
|
||||
message: '您确定要提交吗?',
|
||||
}).then(() => {
|
||||
this.$toast.loading({
|
||||
message: '提交中...',
|
||||
forbidClick: true,
|
||||
});
|
||||
|
||||
this.$axios.post('/platform/proposal/write/submit', {info: JSON.stringify(this.formData)})
|
||||
.then(res => {
|
||||
this.$toast.clear();
|
||||
if (res.code === 0) {
|
||||
this.$toast.success("提交成功");
|
||||
setTimeout(() => {
|
||||
pjaxReplace('/platform/h5/proposal/mine')
|
||||
}, 1500);
|
||||
} else {
|
||||
this.$toast.fail(res.msg || '提交失败');
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.$toast.clear();
|
||||
this.$toast.fail('网络错误,请稍后重试');
|
||||
});
|
||||
}).catch(() => {
|
||||
// 取消提交
|
||||
});
|
||||
} catch (error) {
|
||||
// 表单验证失败
|
||||
console.log('表单验证失败', error);
|
||||
}
|
||||
},
|
||||
|
||||
// 重新提交
|
||||
async onSubmitAgain() {
|
||||
try {
|
||||
await this.$refs.addForm.validate();
|
||||
|
||||
if (!this.formData.name || this.formData.name.trim().length < 1) {
|
||||
this.$toast("请填写提案名称");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.formData.brief.length < this.proposalConfig.briefMinLength) {
|
||||
this.$toast("提案内容和依据最少为" + this.proposalConfig.briefMinLength + "字");
|
||||
return;
|
||||
}
|
||||
|
||||
this.$dialog.confirm({
|
||||
title: '提示',
|
||||
message: '您确定要提交吗?',
|
||||
}).then(() => {
|
||||
this.$toast.loading({
|
||||
message: '提交中...',
|
||||
forbidClick: true,
|
||||
});
|
||||
|
||||
this.$axios.post('/platform/proposal/write/submitAgain', {
|
||||
info: JSON.stringify(this.formData),
|
||||
taskId: this.$utils.getQueryString("taskId")
|
||||
}).then(res => {
|
||||
this.$toast.clear();
|
||||
if (res.code === 0) {
|
||||
this.$toast.success("提交成功");
|
||||
setTimeout(() => {
|
||||
pjaxReplace('/platform/h5/proposal/mine')
|
||||
}, 1500);
|
||||
} else {
|
||||
this.$toast.fail(res.msg || '提交失败');
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$toast.clear();
|
||||
this.$toast.fail('网络错误,请稍后重试');
|
||||
});
|
||||
}).catch(() => {
|
||||
// 取消提交
|
||||
});
|
||||
} catch (error) {
|
||||
// 表单验证失败
|
||||
console.log('表单验证失败', error);
|
||||
}
|
||||
},
|
||||
|
||||
// 获取提案类别
|
||||
listProposalType() {
|
||||
this.$axios.post("/platform/proposal/common/listProposalType").then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.typeOptions = res.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 获取配置
|
||||
getProposalConfig() {
|
||||
return this.$axios.post("/platform/proposal/common/config").then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.proposalConfig = res.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//教代会change
|
||||
async meetingChange(val) {
|
||||
this.formData.delegationId = null;
|
||||
this.formData.committeeId = null;
|
||||
this.formData.delegationName = '';
|
||||
this.formData.committeeName = '';
|
||||
await this.listDelegation();
|
||||
await this.searchMineDelegation();
|
||||
await this.listSource();
|
||||
// 检查是否在撰写时间内
|
||||
this.checkWriteTime();
|
||||
},
|
||||
|
||||
// 获取代表团
|
||||
listDelegation() {
|
||||
return this.$axios.post("/platform/proposal/common/listDelegation", {sessionId: this.formData.sessionId}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.delegationOptions = res.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 查询开启的教代会
|
||||
listOpenSession(isModify = false) {
|
||||
this.$axios.post("/platform/proposal/common/listOpenSession").then(async (res) => {
|
||||
if (res.code === 0) {
|
||||
this.sessionOptions = res.data;
|
||||
if (!isModify && this.sessionOptions && this.sessionOptions.length > 0) {
|
||||
this.$set(this.formData, "sessionId", this.sessionOptions[0].id);
|
||||
this.$set(this.formData, "sessionName", this.sessionOptions[0].fullName);
|
||||
await this.listDelegation();
|
||||
await this.listSource();
|
||||
// 获取代表团
|
||||
await this.searchMineDelegation();
|
||||
// 检查是否在撰写时间内
|
||||
this.checkWriteTime();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//查询自己有权限的撰写方式
|
||||
listSource() {
|
||||
return this.$axios.post("/platform/proposal/write/listSource", {sessionId: this.formData.sessionId}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.sourceOptions = res.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//查询自己有权限的代表团
|
||||
searchMineDelegation() {
|
||||
return this.$axios.post("/platform/proposal/write/searchMineDelegation", {sessionId: this.formData.sessionId}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$set(this.formData, "delegationId", res.data);
|
||||
// 设置代表团名称
|
||||
const delegation = this.delegationOptions.find(item => item.id === res.data);
|
||||
if (delegation) {
|
||||
this.formData.delegationName = delegation.name;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 检查是否在撰写时间内
|
||||
checkWriteTime() {
|
||||
this.$axios.post("/platform/proposal/write/checkWriteTime", {sessionId: this.formData.sessionId}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
if (!res.data) {
|
||||
this.$toast("当前时间不在撰写时间段内");
|
||||
this.isWriteTime = false;
|
||||
} else {
|
||||
this.isWriteTime = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
init() {
|
||||
if (this.bizId) {
|
||||
this.$axios.post("/platform/proposal/write/detail", {id: this.bizId}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.formData = res.data;
|
||||
|
||||
// // 设置选择器显示值
|
||||
// const delegation = this.delegationOptions.find(item => item.id === this.formData.delegationId);
|
||||
// if (delegation) {
|
||||
// this.formData.delegationName = delegation.name;
|
||||
// }
|
||||
//
|
||||
// const source = this.sourceOptions.find(item => item.code === this.formData.source);
|
||||
// if (source) {
|
||||
// this.sourceName = source.name;
|
||||
// }
|
||||
//
|
||||
// const type = this.typeOptions.find(item => item.id === this.formData.typeId);
|
||||
// if (type) {
|
||||
// this.typeName = type.name;
|
||||
// }
|
||||
|
||||
this.listOpenSession(true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// this.noticeDialogVisible = true;
|
||||
this.listOpenSession(false);
|
||||
|
||||
// 设置用户信息
|
||||
this.$set(this.formData, "createUserId", this.$store.state.user.id);
|
||||
this.$set(this.formData, "createUserName", this.$store.state.user.username);
|
||||
this.$set(this.formData, "createUserLoginName", this.$store.state.user.loginname);
|
||||
this.$set(this.formData, "createTime", this.$moment().format("YYYY-MM-DD"));
|
||||
this.$set(this.formData, "mobile", this.$store.state.user.mobile);
|
||||
this.$set(this.formData, "unitName", this.$store.state.user.unit?.name);
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.init();
|
||||
this.listProposalType();
|
||||
this.getProposalConfig();
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,161 @@
|
||||
<!--#
|
||||
layout("/layouts/platform_h5.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<van-nav-bar title="填写建言献策" left-text="返回" left-arrow @click-left="historyBack" placeholder fixed></van-nav-bar>
|
||||
<div class="container">
|
||||
<van-form @submit="onSubmit">
|
||||
<van-cell-group inset>
|
||||
<van-field v-model="formData.userName" label="姓名" readonly />
|
||||
<van-field v-model="formData.loginName" label="工号" readonly />
|
||||
<van-field v-model="formData.unitName" label="单位" readonly />
|
||||
<van-field v-model="formData.unionName" label="工会" readonly />
|
||||
<van-field
|
||||
v-model="formData.title"
|
||||
name="title"
|
||||
label="标题"
|
||||
placeholder="请输入标题"
|
||||
:rules="[{ required: true, message: '请填写标题' }]"
|
||||
maxlength="100"
|
||||
show-word-limit
|
||||
/>
|
||||
<van-field
|
||||
v-model="formData.content"
|
||||
name="content"
|
||||
label="意见建议内容"
|
||||
type="textarea"
|
||||
placeholder="请输入内容"
|
||||
:rules="[{ required: true, message: '请填写内容' }]"
|
||||
maxlength="500"
|
||||
show-word-limit
|
||||
rows="5"
|
||||
/>
|
||||
</van-cell-group>
|
||||
<div style="margin: 16px;">
|
||||
<van-row gutter="20">
|
||||
<van-col span="12">
|
||||
<van-button round block type="info" plain @click="onSave">保存</van-button>
|
||||
</van-col>
|
||||
<van-col span="12">
|
||||
<van-button v-if="!taskId" round block type="info" native-type="submit">提交</van-button>
|
||||
<van-button v-else round block type="info" @click="onFinishTask">提交</van-button>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</div>
|
||||
</van-form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
new Vue({
|
||||
el: '#app',
|
||||
store,
|
||||
data() {
|
||||
return {
|
||||
bizId: GetQueryString("bizId"),
|
||||
taskId: GetQueryString("taskId"),
|
||||
formData: {},
|
||||
formRules: {
|
||||
title: [{required: true, message: "必填", trigger: ["change", "blur"]}],
|
||||
content: [{required: true, message: "必填", trigger: ["change", "blur"]}]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
historyBack,
|
||||
|
||||
// 保存
|
||||
onSave() {
|
||||
this.$dialog.confirm({
|
||||
title: '提示',
|
||||
message: '您确定保存吗?',
|
||||
}).then(() => {
|
||||
this.$axios.post('/platform/suggestionBox/write/save', {data: JSON.stringify(this.formData)}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$toast.success("保存成功");
|
||||
window.location.href = '/platform/suggestionBox/mine';
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
// 取消操作
|
||||
});
|
||||
},
|
||||
|
||||
// 提交
|
||||
onSubmit() {
|
||||
this.$dialog.confirm({
|
||||
title: '提示',
|
||||
message: '您确定要提交吗?',
|
||||
}).then(() => {
|
||||
this.$axios.post('/platform/suggestionBox/write/submit', {
|
||||
data: JSON.stringify(this.formData)
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$toast.success("提交成功");
|
||||
window.location.href = '/platform/suggestionBox/mine';
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
// 取消操作
|
||||
});
|
||||
},
|
||||
|
||||
// 再次提交
|
||||
onFinishTask() {
|
||||
this.$dialog.confirm({
|
||||
title: '提示',
|
||||
message: '您确定要提交吗?',
|
||||
}).then(() => {
|
||||
this.$axios.post('/platform/suggestionBox/write/submitAgain', {
|
||||
data: JSON.stringify(this.formData),
|
||||
taskId: GetQueryString("taskId")
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$toast.success("提交成功");
|
||||
window.location.href = '/platform/suggestionBox/mine';
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
// 取消操作
|
||||
});
|
||||
},
|
||||
|
||||
// 初始化
|
||||
init() {
|
||||
if (this.bizId) {
|
||||
this.$axios.post("/platform/suggestionBox/write/info", {id: this.bizId}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.formData = res.data;
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const {username, loginname, id, unit, union, mobile} = this.$store.state.user;
|
||||
this.formData = {
|
||||
userName: username,
|
||||
loginName: loginname,
|
||||
submitterId: id,
|
||||
unitId: unit?.id,
|
||||
unitName: unit?.name,
|
||||
unionId: union?.id,
|
||||
unionName: union?.name,
|
||||
concat: mobile
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.init();
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.container {
|
||||
padding: 56px 0 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,331 @@
|
||||
const apps = {
|
||||
template: /*language=HTML*/ `
|
||||
<div class="apps-container">
|
||||
<van-nav-bar title="代表阅览" placeholder fixed></van-nav-bar>
|
||||
<!-- 搜索栏 -->
|
||||
<van-sticky offset-top="46px">
|
||||
<van-search
|
||||
v-model="searchKeyword"
|
||||
placeholder="搜索应用"
|
||||
show-action
|
||||
@search="onSearch"
|
||||
@cancel="onCancel"
|
||||
></van-search>
|
||||
</van-sticky>
|
||||
|
||||
<!-- 使用TreeSelect组件 -->
|
||||
<van-tree-select
|
||||
:items="treeSelectItems"
|
||||
:main-active-index.sync="activeTab"
|
||||
@click-nav="onClickNav"
|
||||
>
|
||||
<template #content>
|
||||
|
||||
<!-- 应用列表 -->
|
||||
<div class="app-list" v-if="applications.length > 0">
|
||||
<div
|
||||
v-for="app in applications"
|
||||
:key="app.id"
|
||||
class="app-item"
|
||||
@click="openApp(app)"
|
||||
>
|
||||
<div class="app-icon">
|
||||
<van-image
|
||||
v-if="app.picIcon"
|
||||
:src="app.picIcon"
|
||||
fit="cover"
|
||||
width="40"
|
||||
height="40"
|
||||
radius="4"
|
||||
></van-image>
|
||||
<van-icon v-else-if="app.icon" :name="app.icon" size="24"></van-icon>
|
||||
<van-icon v-else name="apps-o" size="24"></van-icon>
|
||||
</div>
|
||||
<div class="app-info">
|
||||
<div class="app-title">{{ app.name }}</div>
|
||||
<div class="app-desc" v-if="app.department">{{ app.department }}</div>
|
||||
</div>
|
||||
<div class="app-action">
|
||||
<van-icon
|
||||
:name="app.isFavorite ? 'star' : 'star-o'"
|
||||
:class="['favorite-icon', app.isFavorite ? 'active' : '']"
|
||||
@click.stop="toggleFavorite(app.id)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<van-empty v-else description="暂无应用"></van-empty>
|
||||
</template>
|
||||
</van-tree-select>
|
||||
</div>
|
||||
`,
|
||||
data() {
|
||||
return {
|
||||
// 应用列表
|
||||
applications: [],
|
||||
// 固定分类列表
|
||||
categories: [
|
||||
{id: "all", name: "全部应用", icon: "apps-o"},
|
||||
{id: "favorites", name: "我的收藏", icon: "star-o"},
|
||||
{id: "recommended", name: "推荐应用", icon: "like-o"}
|
||||
],
|
||||
// 动态加载的分类
|
||||
dynamicCategories: [],
|
||||
// 当前选中的分类索引
|
||||
activeTab: 0,
|
||||
// 搜索关键词
|
||||
searchKeyword: "",
|
||||
// 列表相关
|
||||
loading: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 所有分类(固定分类 + 动态分类)
|
||||
allCategories() {
|
||||
return [...this.categories, ...this.dynamicCategories]
|
||||
},
|
||||
// 当前选中的分类ID
|
||||
currentCategoryId() {
|
||||
return this.allCategories[this.activeTab]?.id || "all"
|
||||
},
|
||||
// TreeSelect组件所需的数据格式
|
||||
treeSelectItems() {
|
||||
return this.allCategories.map(category => ({
|
||||
text: category.name,
|
||||
className: 'category-item'
|
||||
}))
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 页面加载时获取分类和应用数据
|
||||
this.loadCategories()
|
||||
this.loadApps()
|
||||
},
|
||||
methods: {
|
||||
// 加载分类数据
|
||||
loadCategories() {
|
||||
$.get("/platform/v4/apps/categories", {platform: "H5"})
|
||||
.then((result) => {
|
||||
if (result.code === 0) {
|
||||
this.dynamicCategories = result.data || []
|
||||
} else {
|
||||
console.error("获取应用分类失败:", result.msg)
|
||||
}
|
||||
})
|
||||
.fail((error) => {
|
||||
console.error("获取应用分类异常:", error)
|
||||
})
|
||||
},
|
||||
|
||||
// 加载应用数据
|
||||
loadApps() {
|
||||
this.loading = true
|
||||
|
||||
// 构建请求参数
|
||||
const params = {
|
||||
categoryId:
|
||||
this.currentCategoryId === "all"
|
||||
? ""
|
||||
: this.currentCategoryId,
|
||||
keyword: this.searchKeyword,
|
||||
platform: "H5"
|
||||
}
|
||||
|
||||
// 将参数转换为URL查询参数
|
||||
const queryString = Object.keys(params)
|
||||
.filter((key) => params[key] !== null && params[key] !== undefined && params[key] !== "")
|
||||
.map((key) => encodeURIComponent(key) + "=" + encodeURIComponent(params[key]))
|
||||
.join("&")
|
||||
|
||||
// 如果是"我的收藏"分类
|
||||
if (this.currentCategoryId === "favorites") {
|
||||
this.loadFavorites()
|
||||
return
|
||||
}
|
||||
|
||||
// 如果是"推荐应用"分类
|
||||
if (this.currentCategoryId === "recommended") {
|
||||
$.get("/platform/v4/apps/recommended")
|
||||
.then((result) => {
|
||||
if (result.code === 0) {
|
||||
this.applications = result.data.list || []
|
||||
} else {
|
||||
console.error("获取推荐应用失败:", result.msg)
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
.fail((error) => {
|
||||
console.error("获取推荐应用异常:", error)
|
||||
this.loading = false
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 发送请求获取普通应用列表
|
||||
$.get("/platform/v4/apps/list?" + queryString)
|
||||
.then((result) => {
|
||||
if (result.code === 0) {
|
||||
this.applications = result.data || []
|
||||
} else {
|
||||
console.error("获取应用列表失败:", result.msg)
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
.fail((error) => {
|
||||
console.error("获取应用列表异常:", error)
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
// 加载收藏的应用
|
||||
loadFavorites() {
|
||||
$.get("/platform/v4/apps/favorite")
|
||||
.then((result) => {
|
||||
if (result.code === 0) {
|
||||
this.applications = result.data || []
|
||||
} else {
|
||||
console.error("获取收藏应用失败:", result.msg)
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
.fail((error) => {
|
||||
console.error("获取收藏应用异常:", error)
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
// 切换应用收藏状态
|
||||
toggleFavorite(appId) {
|
||||
const app = this.applications.find((a) => a.id === appId)
|
||||
if (!app) return
|
||||
|
||||
const url = app.isFavorite ? "/platform/v4/apps/removeFavorite" : "/platform/v4/apps/addFavorite"
|
||||
const params = {appId: appId}
|
||||
|
||||
$.post(url, params)
|
||||
.then((result) => {
|
||||
if (result.code === 0) {
|
||||
app.isFavorite = !app.isFavorite
|
||||
this.$toast(app.isFavorite ? "收藏成功" : "取消收藏成功")
|
||||
} else {
|
||||
console.error(app.isFavorite ? "取消收藏失败:" : "收藏失败:", result.msg)
|
||||
}
|
||||
})
|
||||
.fail((error) => {
|
||||
console.error(app.isFavorite ? "取消收藏异常:" : "收藏异常:", error)
|
||||
})
|
||||
},
|
||||
|
||||
// 搜索
|
||||
onSearch() {
|
||||
this.applications = []
|
||||
this.loadApps()
|
||||
},
|
||||
|
||||
// 取消搜索
|
||||
onCancel() {
|
||||
this.searchKeyword = ""
|
||||
this.onSearch()
|
||||
},
|
||||
|
||||
// 切换标签页 - TreeSelect导航点击事件
|
||||
onClickNav(index) {
|
||||
this.activeTab = index
|
||||
this.applications = []
|
||||
this.loadApps()
|
||||
},
|
||||
|
||||
// 打开应用
|
||||
openApp(app) {
|
||||
// 储存到缓存
|
||||
window.sessionStorage.setItem("zhgh_sub_app", JSON.stringify(app))
|
||||
// 新标签页打开
|
||||
window.open("/platform/v4/subApp?appId=" + app.id, "_blank")
|
||||
}
|
||||
},
|
||||
style: /*language=CSS*/ `
|
||||
.apps-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.van-tree-select {
|
||||
height: calc(100vh - 150px) !important;
|
||||
}
|
||||
|
||||
.van-tree-select__nav {
|
||||
flex: 0 0 90px;
|
||||
}
|
||||
|
||||
.van-tree-select__content {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.category-item {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.app-list {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.app-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12px 16px;
|
||||
background-color: #fff;
|
||||
margin-bottom: 1px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.app-icon {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 4px;
|
||||
background-color: #f2f3f5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.app-info {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.app-title {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
margin-bottom: 4px;
|
||||
color: #323233;
|
||||
}
|
||||
|
||||
.app-desc {
|
||||
font-size: 12px;
|
||||
color: #969799;
|
||||
}
|
||||
|
||||
.app-action {
|
||||
padding: 0 8px;
|
||||
}
|
||||
|
||||
.favorite-icon {
|
||||
font-size: 20px;
|
||||
color: #c8c9cc;
|
||||
}
|
||||
|
||||
.favorite-icon.active {
|
||||
color: #ff9800;
|
||||
}
|
||||
|
||||
.loading-container {
|
||||
padding: 20px 0;
|
||||
text-align: center;
|
||||
}
|
||||
`
|
||||
}
|
||||
@@ -6,14 +6,18 @@ layout("/layouts/platform_h5.html"){
|
||||
<div>
|
||||
<div>
|
||||
<home v-if="homeTabbarActive === 'home'" @module-click="moduleClick"></home>
|
||||
<todo v-if="homeTabbarActive === 'todo'"></todo>
|
||||
<work v-if="homeTabbarActive === 'work'"></work>
|
||||
<mine v-if="homeTabbarActive === 'mine'"></mine>
|
||||
<apps v-if="homeTabbarActive === 'apps'"></apps>
|
||||
</div>
|
||||
|
||||
<div id="page-tarbar" class="page-tarbar">
|
||||
<van-tabbar v-model="homeTabbarActive" @change="homeTabbarChange">
|
||||
<van-tabbar-item name="home" icon="wap-home-o">首页</van-tabbar-item>
|
||||
<van-tabbar-item name="apps" icon="gem">应用</van-tabbar-item>
|
||||
<van-tabbar-item name="work" icon="gem">工作台</van-tabbar-item>
|
||||
<van-tabbar-item name="todo" icon="gem">待办</van-tabbar-item>
|
||||
<van-tabbar-item name="mine" icon="user-o">我的</van-tabbar-item>
|
||||
</van-tabbar>
|
||||
</div>
|
||||
@@ -24,13 +28,17 @@ layout("/layouts/platform_h5.html"){
|
||||
<!--#include("home.js"){}#-->
|
||||
<!--#include("work.js"){}#-->
|
||||
<!--#include("mine.js"){}#-->
|
||||
<!--#include("todo.js"){}#-->
|
||||
<!--#include("apps.js"){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
store,
|
||||
components: {
|
||||
home,
|
||||
mine,
|
||||
work
|
||||
work,
|
||||
todo,
|
||||
apps
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -0,0 +1,359 @@
|
||||
const todo = {
|
||||
template: /*language=HTML*/ `
|
||||
<div class="task-center">
|
||||
<van-nav-bar title="待办中心" placeholder fixed></van-nav-bar>
|
||||
<!-- 标签页 -->
|
||||
<van-sticky offset-top="46px">
|
||||
<van-tabs v-model="activeTab" @change="handleTabChange" animated swipeable>
|
||||
<van-tab title="待办" name="todo"></van-tab>
|
||||
<van-tab title="已办" name="done"></van-tab>
|
||||
<van-tab title="我发起的" name="started"></van-tab>
|
||||
</van-tabs>
|
||||
<!-- 搜索筛选区域 -->
|
||||
<div class="filter-section">
|
||||
<div>
|
||||
<div class="search-form">
|
||||
<van-search v-model="pageForm.searchKeyword" placeholder="请输入搜索关键词"></van-search>
|
||||
</div>
|
||||
|
||||
<!-- <van-field-->
|
||||
<!-- readonly-->
|
||||
<!-- clickable-->
|
||||
<!-- :value="categoryLabel"-->
|
||||
<!-- placeholder="选择流程分类"-->
|
||||
<!-- class="category-select"-->
|
||||
<!-- @click="showCategoryPicker = true"-->
|
||||
<!-- ></van-field>-->
|
||||
</div>
|
||||
|
||||
<van-popup v-model="showCategoryPicker" round position="bottom">
|
||||
<van-picker
|
||||
show-toolbar
|
||||
:columns="categoryOptions"
|
||||
value-key="name"
|
||||
@confirm="onCategoryConfirm"
|
||||
@cancel="showCategoryPicker = false"
|
||||
></van-picker>
|
||||
</van-popup>
|
||||
</div>
|
||||
</van-sticky>
|
||||
|
||||
<!-- 任务列表区域 -->
|
||||
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
|
||||
<van-list
|
||||
v-model="loading"
|
||||
:finished="finished"
|
||||
finished-text="没有更多了"
|
||||
@load="getTasks"
|
||||
>
|
||||
<div v-if="tasks.length > 0" class="task-list">
|
||||
<div
|
||||
v-for="task in tasks"
|
||||
:key="task.taskId"
|
||||
class="task-item"
|
||||
>
|
||||
<div class="task-content">
|
||||
<div class="task-title">{{task.variable?.instanceName || '无标题流程'}}</div>
|
||||
|
||||
<div class="task-info">
|
||||
<span class="task-info-label">任务节点:</span>
|
||||
<span class="task-info-value">{{task.taskName}}</span>
|
||||
</div>
|
||||
|
||||
<div class="task-info">
|
||||
<span class="task-info-label">流程分类:</span>
|
||||
<span class="task-info-value">
|
||||
{{categoryOptions.find(item => item.id === task.category)?.name || '未知分类'}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="task-info">
|
||||
<span class="task-info-label">申请人:</span>
|
||||
<span class="task-info-value">{{task.variable?.initiatorName || '未知'}}</span>
|
||||
</div>
|
||||
|
||||
<div class="task-info" v-if="activeTab === 'started'">
|
||||
<span class="task-info-label">状态:</span>
|
||||
<span class="task-info-value">
|
||||
{{processStatusMap[task.state]?.text || '未知状态'}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="task-footer">
|
||||
<van-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="openView(task)"
|
||||
>查看
|
||||
</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else class="empty-section">
|
||||
<van-empty :description="getEmptyText()"/>
|
||||
</div>
|
||||
</van-list>
|
||||
</van-pull-refresh>
|
||||
</div>
|
||||
`,
|
||||
data() {
|
||||
return {
|
||||
// 统计数据
|
||||
todoCount: 0,
|
||||
doneCount: 0,
|
||||
startedCount: 0,
|
||||
|
||||
// 查询表单
|
||||
pageForm: {
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
totalCount: 0,
|
||||
searchKeyword: "",
|
||||
category: ""
|
||||
},
|
||||
|
||||
// 流程类型选项
|
||||
categoryOptions: [],
|
||||
showCategoryPicker: false,
|
||||
categoryLabel: "",
|
||||
|
||||
// 任务列表
|
||||
tasks: [],
|
||||
loading: false,
|
||||
finished: false,
|
||||
refreshing: false,
|
||||
|
||||
// 标签页
|
||||
activeTab: "todo",
|
||||
|
||||
processStatusMap: {
|
||||
10: {text: "进行中", class: "doing"},
|
||||
20: {text: "已完成", class: "finished"},
|
||||
30: {text: "已撤回", class: "withdraw"},
|
||||
40: {text: "强行终止", class: "interrupt"},
|
||||
45: {text: "已拒绝", class: "reject"},
|
||||
50: {text: "挂起", class: "pending"},
|
||||
99: {text: "已废弃", class: "abandon"}
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.initData();
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化数据
|
||||
async initData() {
|
||||
await Promise.all([this.getStatistics(), this.listCategory()]);
|
||||
// 初始加载任务
|
||||
// this.getTasks();
|
||||
},
|
||||
|
||||
// 获取统计数据
|
||||
async getStatistics() {
|
||||
try {
|
||||
const {code, data, msg} = await this.$axios.post("/flow/todoCenter/statistics");
|
||||
if (code === 0) {
|
||||
const {todoCount, doneCount, startedCount} = data
|
||||
this.todoCount = todoCount;
|
||||
this.doneCount = doneCount;
|
||||
this.startedCount = startedCount;
|
||||
}
|
||||
} catch (error) {
|
||||
this.$toast("获取统计数据失败");
|
||||
console.error("获取统计数据失败:", error);
|
||||
}
|
||||
},
|
||||
|
||||
// 获取流程类型
|
||||
async listCategory() {
|
||||
try {
|
||||
// 这里使用模拟数据,实际项目中替换为API调用
|
||||
const res = await axios.post("/flow/category/list");
|
||||
if (res.data.code === 0) {
|
||||
this.categoryOptions = res.data.data;
|
||||
}
|
||||
} catch (error) {
|
||||
this.$toast("获取流程分类失败");
|
||||
console.error("获取流程分类失败:", error);
|
||||
}
|
||||
},
|
||||
|
||||
// 获取任务列表
|
||||
async getTasks() {
|
||||
if (this.refreshing) {
|
||||
this.tasks = [];
|
||||
this.refreshing = false;
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
|
||||
try {
|
||||
const {code,data,msg} = await this.$axios.post("/flow/todoCenter/" + this.activeTab, this.pageForm);
|
||||
if (code === 0) {
|
||||
this.tasks = this.tasks.concat(data.list || []);
|
||||
this.pageForm.totalCount = data.totalCount;
|
||||
this.loading = false;
|
||||
|
||||
// 数据全部加载完成
|
||||
if (this.tasks.length >= this.pageForm.totalCount) {
|
||||
this.finished = true;
|
||||
} else {
|
||||
this.pageForm.pageNumber++;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
this.$toast("获取任务列表失败");
|
||||
console.error("获取任务列表失败:", error);
|
||||
this.loading = false;
|
||||
this.refreshing = false;
|
||||
}
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onRefresh() {
|
||||
this.pageForm.pageNumber = 1;
|
||||
this.finished = false;
|
||||
this.getTasks();
|
||||
},
|
||||
|
||||
// 处理标签页变化
|
||||
handleTabChange(name) {
|
||||
this.activeTab = name;
|
||||
this.pageForm.pageNumber = 1;
|
||||
this.tasks = [];
|
||||
this.finished = false;
|
||||
this.getTasks();
|
||||
this.getStatistics();
|
||||
},
|
||||
|
||||
// 搜索
|
||||
search() {
|
||||
this.pageForm.pageNumber = 1;
|
||||
this.tasks = [];
|
||||
this.finished = false;
|
||||
this.getTasks();
|
||||
this.getStatistics();
|
||||
},
|
||||
|
||||
// 重置搜索
|
||||
reset() {
|
||||
this.pageForm.searchKeyword = "";
|
||||
this.pageForm.category = "";
|
||||
this.categoryLabel = "";
|
||||
this.search();
|
||||
},
|
||||
|
||||
// 分类选择确认
|
||||
onCategoryConfirm(value) {
|
||||
this.pageForm.category = value.id;
|
||||
this.categoryLabel = value.name;
|
||||
this.showCategoryPicker = false;
|
||||
},
|
||||
|
||||
// 处理任务
|
||||
openView(task) {
|
||||
const {taskId, taskKey, instanceId, businessNo, formKey} = task;
|
||||
|
||||
if (!formKey) {
|
||||
this.$toast("当前流程没有配置地址");
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
// 获取空状态文本
|
||||
getEmptyText() {
|
||||
switch (this.activeTab) {
|
||||
case "todo":
|
||||
return "您当前没有需要办理的任务,辛苦了";
|
||||
case "done":
|
||||
return "您当前没有已办理的任务记录";
|
||||
case "started":
|
||||
return "您当前没有发起的流程";
|
||||
default:
|
||||
return "暂无数据";
|
||||
}
|
||||
}
|
||||
},
|
||||
style: /*language=CSS*/ `
|
||||
.task-center {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
::v-deep .filter-section {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.search-form {
|
||||
display: flex;
|
||||
background: #fff;
|
||||
padding: 12px 16px;
|
||||
border-radius: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.search-form .van-search{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
flex: 1;
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
.task-list {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
::v-deep .task-item {
|
||||
margin-bottom: 12px;
|
||||
overflow: hidden;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
::v-deep .task-content {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
::v-deep .task-title {
|
||||
font-weight: 500;
|
||||
font-size: 16px;
|
||||
margin-bottom: 8px;
|
||||
color: #323233;
|
||||
}
|
||||
|
||||
::v-deep .task-info {
|
||||
display: flex;
|
||||
font-size: 14px;
|
||||
color: #969799;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
::v-deep .task-info-label {
|
||||
width: 70px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
::v-deep .task-info-value {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
::v-deep .task-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
::v-deep .empty-section {
|
||||
padding: 40px 0;
|
||||
text-align: center;
|
||||
color: #969799;
|
||||
}
|
||||
|
||||
.category-select {
|
||||
margin: 0 12px 12px 0;
|
||||
}
|
||||
`
|
||||
}
|
||||
Reference in New Issue
Block a user