This commit is contained in:
那些花儿
2025-09-05 18:08:23 +08:00
parent 9acf6679e7
commit fc15ba1d39
4 changed files with 182 additions and 155 deletions
@@ -187,6 +187,7 @@ body {
/*****************************列表list css********************************/ /*****************************列表list css********************************/
.table-list-container { .table-list-container {
padding: 0; padding: 0;
margin-top: 10px;
} }
.table-list-container .table-list-item { .table-list-container .table-list-item {
@@ -199,6 +200,7 @@ body {
.table-list-container .table-list-item:last-child { .table-list-container .table-list-item:last-child {
border-bottom: none; border-bottom: none;
margin-bottom: 0;
} }
.table-list-container .table-list-item .item-header { .table-list-container .table-list-item .item-header {
@@ -67,6 +67,9 @@
<script> <script>
Vue.config.devtools = true Vue.config.devtools = true
// 禁用vant的表单验证行内错误信息显示
vant.Form.props.showErrorMessage.default = false
function toggleShowBar() { function toggleShowBar() {
if (["/platform/h5/home", "/platform/home"].includes(window.location.pathname)) { if (["/platform/h5/home", "/platform/home"].includes(window.location.pathname)) {
document.querySelector("body>.main-page").classList.add("page-showtabbar") document.querySelector("body>.main-page").classList.add("page-showtabbar")
@@ -116,7 +116,19 @@ layout("/layouts/platform_h5.html"){
<van-nav-bar @click-left="historyBack" left-arrow left-text="返回" title="我的建言献策" placeholder <van-nav-bar @click-left="historyBack" left-arrow left-text="返回" title="我的建言献策" placeholder
fixed></van-nav-bar> fixed></van-nav-bar>
<van-pull-refresh v-model="tableRefreshing" @refresh="doSearch" style="min-height: calc(100vh - 90px)"> <van-sticky offset-top="46px">
<van-search
v-model="pageForm.searchKeyword"
:show-action="false"
:reverse-color="false"
input-align="left"
placeholder="请输入关键字搜索"
@search="doSearch"
></van-search>
</van-sticky>
<!-- style="min-height: calc(100vh - 106px)"-->
<van-pull-refresh v-model="tableRefreshing" @refresh="doSearch">
<van-list v-if="tableData && tableData.length>0" v-model="tableLoading" :finished="tableFinished" <van-list v-if="tableData && tableData.length>0" v-model="tableLoading" :finished="tableFinished"
finished-text="" @load="pageData"> finished-text="" @load="pageData">
@@ -152,11 +164,12 @@ layout("/layouts/platform_h5.html"){
</div> </div>
</div> </div>
<div class="item-actions"> <div class="item-actions">
<div class="action-btn" @click="viewDetail(item)"> <div class="action-btn" @click="onView(item)">
<i class="fa fa-eye"></i> <i class="fa fa-eye"></i>
<span>查看</span> <span>查看</span>
</div> </div>
<div class="action-btn" v-if="item.taskKey === 'startTask' || !item.instanceId" @click="onEdit(item)"> <div class="action-btn" v-if="item.taskKey === 'startTask' || !item.instanceId"
@click="onEdit(item)">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
<span>编辑</span> <span>编辑</span>
</div> </div>
@@ -164,7 +177,8 @@ layout("/layouts/platform_h5.html"){
<i class="fa fa-undo"></i> <i class="fa fa-undo"></i>
<span>撤回</span> <span>撤回</span>
</div> </div>
<div class="action-btn delete" v-if="item.taskKey === 'startTask' || !item.instanceId" @click="onDelete(item)"> <div class="action-btn delete" v-if="item.taskKey === 'startTask' || !item.instanceId"
@click="onDelete(item)">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
<span>删除</span> <span>删除</span>
</div> </div>
@@ -196,73 +210,70 @@ layout("/layouts/platform_h5.html"){
} }
}, },
methods: { methods: {
doSearch() { historyBack,
this.pageForm.pageNumber = 1 doSearch() {
this.pageForm.totalCount = 0 this.pageForm.pageNumber = 1
this.tableData = [] this.pageForm.totalCount = 0
this.pageData() this.tableData = []
}, this.pageData()
pageData() { },
$.post('/platform/suggestionBox/mine/pageData', this.pageForm).then((res) => { pageData() {
$.post('/platform/suggestionBox/mine/pageData', this.pageForm).then((res) => {
if (res.code === 0) {
this.tableData = this.tableData.concat(res.data.list)
this.pageForm.totalCount = res.data.totalCount
if (this.tableData.length >= this.pageForm.totalCount) {
this.tableFinished = true
} else {
this.pageForm.pageNumber++
}
this.tableLoading = false
}
})
},
// 查看详情
onView(item) {
},
// 编辑
onEdit(row) {
},
// 撤回
onRevoke(row) {
this.$dialog.confirm({
title: '提示',
message: '您确定要撤回吗?',
}).then(() => {
this.$axios.post('/flow/common/revokeTask', {taskId: row.startTaskId}).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.tableData = this.tableData.concat(res.data.list) this.$toast.success('撤回成功');
this.pageForm.totalCount = res.data.totalCount this.doSearch();
if (this.tableData.length >= this.pageForm.totalCount) {
this.tableFinished = true
} else {
this.pageForm.pageNumber++
}
this.tableLoading = false
} }
}) })
}, }).catch(() => {
});
// 查看详情
viewDetail(item) {
window.location.href = '/platform/suggestionBox/detail?id=' + item.id
},
// 审核
reviewItem(item) {
window.location.href = '/platform/suggestionBox/review?id=' + item.id
},
// 删除
deleteItem(item) {
this.$dialog.confirm({
title: '提示',
message: '确定要删除该条建言献策吗?',
}).then(() => {
this.$axios.post('/platform/suggestionBox/delete', {id: item.id}).then(res => {
if (res.code === 0) {
this.$toast.success('删除成功');
this.doSearch();
}
})
}).catch(() => {
// 取消操作
});
},
// 判断是否可以审核
canReview(item) {
// 根据实际业务逻辑判断是否显示审核按钮
// 例如:只有特定状态或当前用户有权限时才显示
return item.instanceState === 'RUNNING' && this.$store.state.user.permissions.includes('suggestion:review');
},
// 判断是否可以删除
canDelete(item) {
// 根据实际业务逻辑判断是否显示删除按钮
// 例如:只有草稿状态或当前用户是创建者时才可删除
return item.instanceState === 'DRAFT' ||
(item.submitterId === this.$store.state.user.id && item.instanceState !== 'COMPLETED');
},
historyBack() {
window.history.back();
}
}, },
//
onDelete(id) {
this.$dialog.confirm({
title: '提示',
message: '您确定要删除吗?',
}).then(() => {
this.$axios.post('/platform/suggestionBox/mine/delete', {id}).then(res => {
if (res.code === 0) {
this.$toast.success('删除成功');
this.doSearch();
}
})
}).catch(() => {
});
}
},
created() { created() {
this.pageData() this.pageData()
} }
@@ -3,44 +3,46 @@ layout("/layouts/platform_h5.html"){
#--> #-->
<div id="app" v-cloak> <div id="app" v-cloak>
<van-nav-bar title="填写建言献策" left-text="返回" left-arrow @click-left="historyBack" placeholder fixed></van-nav-bar> <van-nav-bar title="填写建言献策" left-text="返回" left-arrow @click-left="historyBack" placeholder
<div class="form-container"> fixed></van-nav-bar>
<van-form ref="formRef"> <div class="form-container">
<van-cell-group title="基本信息"> <van-form ref="formRef">
<van-field v-model="formData.userName" label="姓名" readonly></van-field> <van-cell-group title="基本信息">
<van-field v-model="formData.loginName" label="工号" readonly></van-field> <van-field v-model="formData.userName" label="姓名" readonly></van-field>
<van-field v-model="formData.unitName" label="单位" readonly></van-field> <van-field v-model="formData.loginName" label="工号" readonly></van-field>
<van-field v-model="formData.unionName" label="工会" readonly></van-field> <van-field v-model="formData.unitName" label="单位" readonly></van-field>
<van-field <van-field v-model="formData.unionName" label="工会" readonly></van-field>
v-model="formData.title" <van-field
name="title" v-model="formData.title"
label="标题" name="title"
placeholder="请输入标题" label="标题"
:rules="[{ required: true, message: '请填写标题' }]" placeholder="请输入标题"
maxlength="100" :rules="[{ required: true, message: '请填写标题' }]"
show-word-limit required
></van-field> maxlength="100"
<van-field show-word-limit
v-model="formData.content" ></van-field>
name="content" <van-field
label="意见建议内容" v-model="formData.content"
type="textarea" name="content"
placeholder="请输入内容" label="意见建议内容"
:rules="[{ required: true, message: '请填写内容' }]" type="textarea"
maxlength="500" placeholder="请输入内容"
show-word-limit :rules="[{ required: true, message: '请填写内容' }]"
rows="5" maxlength="500"
></van-field> show-word-limit
</van-cell-group> rows="5"
></van-field>
</van-cell-group>
<!-- 按钮区域 --> <!-- 按钮区域 -->
<div class="form-actions"> <div class="form-actions">
<van-button plain type="info" @click="onSave">保存</van-button> <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="onSubmit" v-if="!taskId">提交</van-button>
<van-button type="primary" @click="onSubmitAgain" v-else>提交</van-button> <van-button type="primary" @click="onSubmitAgain" v-else>提交</van-button>
</div> </div>
</van-form> </van-form>
</div> </div>
</div> </div>
<script> <script>
@@ -63,63 +65,72 @@ layout("/layouts/platform_h5.html"){
// 保存 // 保存
async onSave() { async onSave() {
try{ try {
await this.$refs.formRef.validate(); await this.$refs.formRef.validate();
this.$dialog.confirm({ this.$dialog.confirm({
title: '提示', title: '提示',
message: '您确定保存吗?', message: '您确定保存吗?',
}).then(() => { }).then(() => {
this.$axios.post('/platform/suggestionBox/write/save', {data: JSON.stringify(this.formData)}).then(res => { this.$axios.post('/platform/suggestionBox/write/save', {data: JSON.stringify(this.formData)}).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.$toast.success("保存成功"); this.$toast.success("保存成功");
} }
}) })
}).catch(() => { }).catch(() => {
// 取消操作 // 取消操作
}); });
}catch (e){ } catch (e) {
// 表单验证失败 // 表单验证失败
console.log('表单验证失败', error); console.log('表单验证失败', error);
} }
}, },
// 提交 // 提交
onSubmit() { async onSubmit() {
this.$dialog.confirm({ try {
title: '提示', await this.$refs.formRef.validate();
message: '您确定要提交吗?', this.$dialog.confirm({
}).then(() => { title: '提示',
this.$axios.post('/platform/suggestionBox/write/submit', { message: '您确定提交吗?',
data: JSON.stringify(this.formData) }).then(() => {
}).then(res => { this.$axios.post('/platform/suggestionBox/write/submit', {data: JSON.stringify(this.formData)}).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.$toast.success("提交成功"); this.$toast.success("保存成功");
window.location.href = '/platform/suggestionBox/mine'; }
} })
}) }).catch(() => {
}).catch(() => { // 取消操作
// 取消操作 });
}); } catch (e) {
// 表单验证失败
console.log('表单验证失败', error);
}
}, },
// 再次提交 // 再次提交
onFinishTask() { async onFinishTask() {
this.$dialog.confirm({ try {
title: '提示', await this.$refs.formRef.validate();
message: '您确定要提交吗?', this.$dialog.confirm({
}).then(() => { title: '提示',
this.$axios.post('/platform/suggestionBox/write/submitAgain', { message: '您确定要提交吗?',
data: JSON.stringify(this.formData), }).then(() => {
taskId: GetQueryString("taskId") this.$axios.post('/platform/suggestionBox/write/submitAgain', {
}).then(res => { data: JSON.stringify(this.formData),
if (res.code === 0) { taskId: GetQueryString("taskId")
this.$toast.success("提交成功"); }).then(res => {
window.location.href = '/platform/suggestionBox/mine'; if (res.code === 0) {
} this.$toast.success("提交成功");
}) window.location.href = '/platform/suggestionBox/mine';
}).catch(() => { }
// 取消操作 })
}); }).catch(() => {
// 取消操作
});
} catch (e) {
// 表单验证失败
console.log('表单验证失败', error);
}
}, },
// 初始化 // 初始化