From a72c01358af89647efdb72d0e41fa79cd2b1f883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=A3=E4=BA=9B=E8=8A=B1=E5=84=BF?= <1156921458@qq.com> Date: Fri, 5 Sep 2025 15:15:11 +0800 Subject: [PATCH] .. --- .../controller/v4/SysV4AppsController.java | 8 +- .../H5ProposalWriteController.java | 2 +- .../SuggestionBoxWriteController.java | 7 + .../static/assets/platform/css/h5.css | 71 ++ .../assets/platform/js/mixin/styleMixin.js | 21 +- .../plugins/paginationList/index.vue | 13 - .../proposal/transact/write/index.html | 2 +- .../proposal/transact/write/index.html | 161 ++++- .../proposal/transact/write/index_.html | 633 ++++++++++++++++++ .../democratic/suggestionBox/write/index.html | 161 +++++ .../views/platform/zhghh5/sys/home/apps.js | 331 +++++++++ .../views/platform/zhghh5/sys/home/index.html | 10 +- .../views/platform/zhghh5/sys/home/todo.js | 359 ++++++++++ 13 files changed, 1719 insertions(+), 60 deletions(-) delete mode 100644 src/main/resources/static/components/plugins/paginationList/index.vue create mode 100644 src/main/resources/views/platform/zhghh5/democratic/proposal/transact/write/index_.html create mode 100644 src/main/resources/views/platform/zhghh5/democratic/suggestionBox/write/index.html create mode 100644 src/main/resources/views/platform/zhghh5/sys/home/apps.js create mode 100644 src/main/resources/views/platform/zhghh5/sys/home/todo.js diff --git a/src/main/java/com/budwk/app/sys/controller/v4/SysV4AppsController.java b/src/main/java/com/budwk/app/sys/controller/v4/SysV4AppsController.java index e59e6f04..256fde2c 100644 --- a/src/main/java/com/budwk/app/sys/controller/v4/SysV4AppsController.java +++ b/src/main/java/com/budwk/app/sys/controller/v4/SysV4AppsController.java @@ -42,8 +42,8 @@ public class SysV4AppsController { @Ok("json") @SaCheckLogin @ApiOperation("获取应用分类") - public Result categories() { - List list = dao.query(Sys_module.class, Cnd.where(Sys_module::getPlatform, "=", "PC").asc(Sys_module::getSortNum)); + public Result categories(@Param(value = "platform", df = "PC") String platform) { + List list = dao.query(Sys_module.class, Cnd.where(Sys_module::getPlatform, "=", platform).asc(Sys_module::getSortNum)); List> categories = list.stream().map(module -> { Map category = new HashMap<>(); category.put("id", module.getId()); @@ -58,7 +58,7 @@ public class SysV4AppsController { @Ok("json:full") @SaCheckLogin @ApiOperation("获取应用列表") - public Result list(@Param("categoryId") String categoryId, @Param("letter") String letter, @Param("keyword") String keyword, HttpServletRequest req) { + public Result list(@Param("categoryId") String categoryId, @Param("letter") String letter, @Param("keyword") String keyword, @Param(value = "platform", df = "PC") String platform, HttpServletRequest req) { Sql sql = Sqls.create(""" SELECT m.id, @@ -77,7 +77,7 @@ public class SysV4AppsController { $condition """); Cnd cnd = Cnd.NEW(); - cnd.and("m.platform", "=", "PC"); + cnd.and("m.platform", "=", platform); cnd.and("m.disabled", "=", false); cnd.and(Cnd.exps("m.parentId", "is", null).or("m.parentId", "=", "")); cnd.andEX("m.moduleId", "=", categoryId); diff --git a/src/main/java/com/budwk/app/zhgh/democratic/proposal/h5controller/H5ProposalWriteController.java b/src/main/java/com/budwk/app/zhgh/democratic/proposal/h5controller/H5ProposalWriteController.java index ee8c8a9e..0b654d59 100644 --- a/src/main/java/com/budwk/app/zhgh/democratic/proposal/h5controller/H5ProposalWriteController.java +++ b/src/main/java/com/budwk/app/zhgh/democratic/proposal/h5controller/H5ProposalWriteController.java @@ -13,7 +13,7 @@ import org.nutz.mvc.annotation.Ok; public class H5ProposalWriteController { @At("") - @Ok("beetl:/platform/zhghh5/democratic/proposal/transact/write/index.html") + @Ok("beetl:/platform/zhghh5/democratic/proposal/transact/write/index_.html") @SaCheckPermission("h5.proposal.write") public void index() { } diff --git a/src/main/java/com/budwk/app/zhgh/democratic/suggestionBox/controller/SuggestionBoxWriteController.java b/src/main/java/com/budwk/app/zhgh/democratic/suggestionBox/controller/SuggestionBoxWriteController.java index c7a54f68..db545331 100644 --- a/src/main/java/com/budwk/app/zhgh/democratic/suggestionBox/controller/SuggestionBoxWriteController.java +++ b/src/main/java/com/budwk/app/zhgh/democratic/suggestionBox/controller/SuggestionBoxWriteController.java @@ -46,6 +46,13 @@ public class SuggestionBoxWriteController { } + @At("") + @Ok("beetl:/platform/zhghh5/democratic/suggestionBox/write/index.html") + @SaCheckPermission("h5.suggestionBox.write") + public void h5Index(){ + + } + @At @SaCheckPermission("suggestionBox.write") @ApiOperation("保存申请") diff --git a/src/main/resources/static/assets/platform/css/h5.css b/src/main/resources/static/assets/platform/css/h5.css index 7a73287d..23777029 100644 --- a/src/main/resources/static/assets/platform/css/h5.css +++ b/src/main/resources/static/assets/platform/css/h5.css @@ -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; +} + diff --git a/src/main/resources/static/assets/platform/js/mixin/styleMixin.js b/src/main/resources/static/assets/platform/js/mixin/styleMixin.js index acb5890a..55abf8e6 100644 --- a/src/main/resources/static/assets/platform/js/mixin/styleMixin.js +++ b/src/main/resources/static/assets/platform/js/mixin/styleMixin.js @@ -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; + }); }, } diff --git a/src/main/resources/static/components/plugins/paginationList/index.vue b/src/main/resources/static/components/plugins/paginationList/index.vue deleted file mode 100644 index 6478dc94..00000000 --- a/src/main/resources/static/components/plugins/paginationList/index.vue +++ /dev/null @@ -1,13 +0,0 @@ - - - - - diff --git a/src/main/resources/views/platform/zhgh/democratic/proposal/transact/write/index.html b/src/main/resources/views/platform/zhgh/democratic/proposal/transact/write/index.html index c6ac1185..33f592b9 100644 --- a/src/main/resources/views/platform/zhgh/democratic/proposal/transact/write/index.html +++ b/src/main/resources/views/platform/zhgh/democratic/proposal/transact/write/index.html @@ -147,7 +147,7 @@ layout("/layouts/platform.html"){ - 保存 + 保存 提交 提交 diff --git a/src/main/resources/views/platform/zhghh5/democratic/proposal/transact/write/index.html b/src/main/resources/views/platform/zhghh5/democratic/proposal/transact/write/index.html index 9b4676c1..3e8164ef 100644 --- a/src/main/resources/views/platform/zhghh5/democratic/proposal/transact/write/index.html +++ b/src/main/resources/views/platform/zhghh5/democratic/proposal/transact/write/index.html @@ -16,7 +16,7 @@ layout("/layouts/platform_h5.html"){ -
+ @@ -144,8 +144,10 @@ layout("/layouts/platform_h5.html"){ - - 保存到我的提案 + + 保存 + 提交 + 提交
@@ -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) } } }, diff --git a/src/main/resources/views/platform/zhghh5/democratic/proposal/transact/write/index_.html b/src/main/resources/views/platform/zhghh5/democratic/proposal/transact/write/index_.html new file mode 100644 index 00000000..8bbf3679 --- /dev/null +++ b/src/main/resources/views/platform/zhghh5/democratic/proposal/transact/write/index_.html @@ -0,0 +1,633 @@ + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 保存 + 提交 + 提交 +
+
+
+ + + +
+
+
+ + + + diff --git a/src/main/resources/views/platform/zhghh5/democratic/suggestionBox/write/index.html b/src/main/resources/views/platform/zhghh5/democratic/suggestionBox/write/index.html new file mode 100644 index 00000000..4fe100a4 --- /dev/null +++ b/src/main/resources/views/platform/zhghh5/democratic/suggestionBox/write/index.html @@ -0,0 +1,161 @@ + + +
+ +
+ + + + + + + + + +
+ + + 保存 + + + 提交 + 提交 + + +
+
+
+
+ + + + + + diff --git a/src/main/resources/views/platform/zhghh5/sys/home/apps.js b/src/main/resources/views/platform/zhghh5/sys/home/apps.js new file mode 100644 index 00000000..c993a4f2 --- /dev/null +++ b/src/main/resources/views/platform/zhghh5/sys/home/apps.js @@ -0,0 +1,331 @@ +const apps = { + template: /*language=HTML*/ ` +
+ + + + + + + + + + +
+ `, + 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; + } + ` +} diff --git a/src/main/resources/views/platform/zhghh5/sys/home/index.html b/src/main/resources/views/platform/zhghh5/sys/home/index.html index 148cdc10..85a8c611 100644 --- a/src/main/resources/views/platform/zhghh5/sys/home/index.html +++ b/src/main/resources/views/platform/zhghh5/sys/home/index.html @@ -6,14 +6,18 @@ layout("/layouts/platform_h5.html"){
+ +
首页 + 应用 工作台 + 待办 我的
@@ -24,13 +28,17 @@ layout("/layouts/platform_h5.html"){ + + new Vue({ el: "#app", store, components: { home, mine, - work + work, + todo, + apps }, data() { return { diff --git a/src/main/resources/views/platform/zhghh5/sys/home/todo.js b/src/main/resources/views/platform/zhghh5/sys/home/todo.js new file mode 100644 index 00000000..17fcb424 --- /dev/null +++ b/src/main/resources/views/platform/zhghh5/sys/home/todo.js @@ -0,0 +1,359 @@ +const todo = { + template: /*language=HTML*/ ` +
+ + + + + + + + + +
+
+
+ +
+ + + + + + + + + +
+ + + + +
+
+ + + + +
+
+
+
{{task.variable?.instanceName || '无标题流程'}}
+ +
+ 任务节点: + {{task.taskName}} +
+ +
+ 流程分类: + + {{categoryOptions.find(item => item.id === task.category)?.name || '未知分类'}} + +
+ +
+ 申请人: + {{task.variable?.initiatorName || '未知'}} +
+ +
+ 状态: + + {{processStatusMap[task.state]?.text || '未知状态'}} + +
+ + +
+
+
+ +
+ +
+
+
+
+ `, + 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; + } + ` +}