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********************************/
.table-list-container {
padding: 0;
margin-top: 10px;
}
.table-list-container .table-list-item {
@@ -199,6 +200,7 @@ body {
.table-list-container .table-list-item:last-child {
border-bottom: none;
margin-bottom: 0;
}
.table-list-container .table-list-item .item-header {
@@ -67,6 +67,9 @@
<script>
Vue.config.devtools = true
// 禁用vant的表单验证行内错误信息显示
vant.Form.props.showErrorMessage.default = false
function toggleShowBar() {
if (["/platform/h5/home", "/platform/home"].includes(window.location.pathname)) {
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
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"
finished-text="" @load="pageData">
@@ -152,11 +164,12 @@ layout("/layouts/platform_h5.html"){
</div>
</div>
<div class="item-actions">
<div class="action-btn" @click="viewDetail(item)">
<div class="action-btn" @click="onView(item)">
<i class="fa fa-eye"></i>
<span>查看</span>
</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>
<span>编辑</span>
</div>
@@ -164,7 +177,8 @@ layout("/layouts/platform_h5.html"){
<i class="fa fa-undo"></i>
<span>撤回</span>
</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>
<span>删除</span>
</div>
@@ -196,73 +210,70 @@ layout("/layouts/platform_h5.html"){
}
},
methods: {
doSearch() {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.tableData = []
this.pageData()
},
pageData() {
$.post('/platform/suggestionBox/mine/pageData', this.pageForm).then((res) => {
historyBack,
doSearch() {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.tableData = []
this.pageData()
},
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) {
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
this.$toast.success('撤回成功');
this.doSearch();
}
})
},
// 查看详情
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();
}
}).catch(() => {
});
},
//
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() {
this.pageData()
}
@@ -3,44 +3,46 @@ 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="form-container">
<van-form ref="formRef">
<van-cell-group title="基本信息">
<van-field v-model="formData.userName" label="姓名" readonly></van-field>
<van-field v-model="formData.loginName" label="工号" readonly></van-field>
<van-field v-model="formData.unitName" label="单位" readonly></van-field>
<van-field v-model="formData.unionName" label="工会" readonly></van-field>
<van-field
v-model="formData.title"
name="title"
label="标题"
placeholder="请输入标题"
:rules="[{ required: true, message: '请填写标题' }]"
maxlength="100"
show-word-limit
></van-field>
<van-field
v-model="formData.content"
name="content"
label="意见建议内容"
type="textarea"
placeholder="请输入内容"
:rules="[{ required: true, message: '请填写内容' }]"
maxlength="500"
show-word-limit
rows="5"
></van-field>
</van-cell-group>
<van-nav-bar title="填写建言献策" left-text="返回" left-arrow @click-left="historyBack" placeholder
fixed></van-nav-bar>
<div class="form-container">
<van-form ref="formRef">
<van-cell-group title="基本信息">
<van-field v-model="formData.userName" label="姓名" readonly></van-field>
<van-field v-model="formData.loginName" label="工号" readonly></van-field>
<van-field v-model="formData.unitName" label="单位" readonly></van-field>
<van-field v-model="formData.unionName" label="工会" readonly></van-field>
<van-field
v-model="formData.title"
name="title"
label="标题"
placeholder="请输入标题"
:rules="[{ required: true, message: '请填写标题' }]"
required
maxlength="100"
show-word-limit
></van-field>
<van-field
v-model="formData.content"
name="content"
label="意见建议内容"
type="textarea"
placeholder="请输入内容"
:rules="[{ required: true, message: '请填写内容' }]"
maxlength="500"
show-word-limit
rows="5"
></van-field>
</van-cell-group>
<!-- 按钮区域 -->
<div class="form-actions">
<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>
<!-- 按钮区域 -->
<div class="form-actions">
<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>
</div>
<script>
@@ -63,63 +65,72 @@ layout("/layouts/platform_h5.html"){
// 保存
async onSave() {
try{
await this.$refs.formRef.validate();
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("保存成功");
}
})
}).catch(() => {
// 取消操作
});
}catch (e){
// 表单验证失败
console.log('表单验证失败', error);
}
try {
await this.$refs.formRef.validate();
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("保存成功");
}
})
}).catch(() => {
// 取消操作
});
} catch (e) {
// 表单验证失败
console.log('表单验证失败', error);
}
},
// 提交
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(() => {
// 取消操作
});
async onSubmit() {
try {
await this.$refs.formRef.validate();
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("保存成功");
}
})
}).catch(() => {
// 取消操作
});
} catch (e) {
// 表单验证失败
console.log('表单验证失败', error);
}
},
// 再次提交
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(() => {
// 取消操作
});
async onFinishTask() {
try {
await this.$refs.formRef.validate();
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(() => {
// 取消操作
});
} catch (e) {
// 表单验证失败
console.log('表单验证失败', error);
}
},
// 初始化