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,6 +210,7 @@ layout("/layouts/platform_h5.html"){
} }
}, },
methods: { methods: {
historyBack,
doSearch() { doSearch() {
this.pageForm.pageNumber = 1 this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0 this.pageForm.totalCount = 0
@@ -218,49 +233,45 @@ layout("/layouts/platform_h5.html"){
}, },
// 查看详情 // 查看详情
viewDetail(item) { onView(item) {
window.location.href = '/platform/suggestionBox/detail?id=' + item.id
}, },
// 审核 // 编辑
reviewItem(item) { onEdit(row) {
window.location.href = '/platform/suggestionBox/review?id=' + item.id
}, },
// 删除 // 撤回
deleteItem(item) { onRevoke(row) {
this.$dialog.confirm({ this.$dialog.confirm({
title: '提示', title: '提示',
message: '确定要删除该条建言献策吗?', message: '确定要撤回吗?',
}).then(() => { }).then(() => {
this.$axios.post('/platform/suggestionBox/delete', {id: item.id}).then(res => { this.$axios.post('/flow/common/revokeTask', {taskId: row.startTaskId}).then(res => {
if (res.code === 0) {
this.$toast.success('撤回成功');
this.doSearch();
}
})
}).catch(() => {
});
},
//
onDelete(id) {
this.$dialog.confirm({
title: '提示',
message: '您确定要删除吗?',
}).then(() => {
this.$axios.post('/platform/suggestionBox/mine/delete', {id}).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.$toast.success('删除成功'); this.$toast.success('删除成功');
this.doSearch(); this.doSearch();
} }
}) })
}).catch(() => { }).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();
} }
}, },
created() { created() {
@@ -3,7 +3,8 @@ 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
fixed></van-nav-bar>
<div class="form-container"> <div class="form-container">
<van-form ref="formRef"> <van-form ref="formRef">
<van-cell-group title="基本信息"> <van-cell-group title="基本信息">
@@ -17,6 +18,7 @@ layout("/layouts/platform_h5.html"){
label="标题" label="标题"
placeholder="请输入标题" placeholder="请输入标题"
:rules="[{ required: true, message: '请填写标题' }]" :rules="[{ required: true, message: '请填写标题' }]"
required
maxlength="100" maxlength="100"
show-word-limit show-word-limit
></van-field> ></van-field>
@@ -63,7 +65,7 @@ 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: '提示',
@@ -77,33 +79,38 @@ layout("/layouts/platform_h5.html"){
}).catch(() => { }).catch(() => {
// 取消操作 // 取消操作
}); });
}catch (e){ } catch (e) {
// 表单验证失败 // 表单验证失败
console.log('表单验证失败', error); console.log('表单验证失败', error);
} }
}, },
// 提交 // 提交
onSubmit() { async onSubmit() {
try {
await this.$refs.formRef.validate();
this.$dialog.confirm({ this.$dialog.confirm({
title: '提示', title: '提示',
message: '您确定提交吗?', message: '您确定提交吗?',
}).then(() => { }).then(() => {
this.$axios.post('/platform/suggestionBox/write/submit', { this.$axios.post('/platform/suggestionBox/write/submit', {data: JSON.stringify(this.formData)}).then(res => {
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() {
try {
await this.$refs.formRef.validate();
this.$dialog.confirm({ this.$dialog.confirm({
title: '提示', title: '提示',
message: '您确定要提交吗?', message: '您确定要提交吗?',
@@ -120,6 +127,10 @@ layout("/layouts/platform_h5.html"){
}).catch(() => { }).catch(() => {
// 取消操作 // 取消操作
}); });
} catch (e) {
// 表单验证失败
console.log('表单验证失败', error);
}
}, },
// 初始化 // 初始化