Explorar el Código

新增文章审核流程页签

在文章详情的属性与权限之间新增流程页签,展示文章历次发布、变动、停用和启用审核状态。

复用现有业务流程时间线,根据流程状态选择当前待审或历史审核记录,并支持多次流程切换及无流程空状态。

验证:Java 服务编译通过;本地完整后台启动成功;首页返回 HTTP 200;运行副本 class 与编译产物一致;本地流程数据查询通过。
非繁 hace 4 meses
padre
commit
acc39044b1

+ 96 - 0
WebRoot/web/subassembly/app/pc/10021/10106/1002110106_run.jsp

@@ -70,6 +70,57 @@
 			overflow-y: auto;
 		}
 
+		.article-flow-panel {
+			box-sizing: border-box;
+			display: flex;
+			flex-direction: column;
+			height: 100%;
+			min-height: 0;
+			background: #f6f7f8;
+		}
+
+		.article-flow-toolbar {
+			box-sizing: border-box;
+			display: flex;
+			align-items: center;
+			gap: 12px;
+			min-height: 56px;
+			padding: 10px 20px;
+			background: #fff;
+			border-bottom: 1px solid #e4e7ed;
+		}
+
+		.article-flow-select {
+			width: 390px;
+			max-width: 55%;
+		}
+
+		.article-flow-time {
+			color: #909399;
+			font-size: 13px;
+		}
+
+		.article-flow-frame {
+			display: block;
+			flex: 1 1 auto;
+			width: 100%;
+			min-height: 0;
+			border: 0;
+		}
+
+		.article-flow-empty {
+			display: flex;
+			flex: 1 1 auto;
+			align-items: center;
+			justify-content: center;
+			color: #909399;
+		}
+
+		.article-flow-empty i {
+			margin-right: 8px;
+			font-size: 20px;
+		}
+
 		.article-info-pc-preview-stage {
 			box-sizing: border-box;
 			display: flex;
@@ -423,6 +474,30 @@
 					</div>
 
 				</el-tab-pane>
+				<el-tab-pane label="流程" name="flow">
+					<div class="article-flow-panel">
+						<template v-if="articleFlowList.length">
+							<div class="article-flow-toolbar">
+								<el-select v-model="activeFlowApplyid" class="article-flow-select" size="small">
+									<el-option v-for="item in articleFlowList" :key="item.applyid"
+										:label="item.flowName + ' · ' + item.statusName + ' · ' + item.createTime"
+										:value="String(item.applyid)">
+									</el-option>
+								</el-select>
+								<el-tag v-if="activeFlow" :type="activeFlow.statusType" effect="plain" size="small">
+									{{activeFlow.statusName}}
+								</el-tag>
+								<span v-if="activeFlow" class="article-flow-time">
+									发起:{{activeFlow.createTime}}<span v-if="activeFlow.endTime"> 结束:{{activeFlow.endTime}}</span>
+								</span>
+							</div>
+							<iframe v-if="activeFlowUrl" class="article-flow-frame" :src="activeFlowUrl" frameborder="0"></iframe>
+						</template>
+						<div v-else class="article-flow-empty">
+							<i class="el-icon-time"></i><span>该文章尚未发起审核流程</span>
+						</div>
+					</div>
+				</el-tab-pane>
 				<el-tab-pane label="权限" name="permission">
 					<div class="article-permission-panel">
 						<el-form :model="guestAccess" label-width="120px">
@@ -451,6 +526,7 @@
 	</div>
 </body>
 <script type="text/javascript">
+	var articleFlowList = JSON.parse('${articleFlowList}');
 	space.vue = new Vue({
 		el: space.appContent,
 		data() {
@@ -459,10 +535,30 @@
 				disable: space.utils.parseBoolean("${article.dcode == '61' }"),
 				copyNavigation: JSON.parse('${copyNav}'),
 				popFmt: false,
+				articleFlowList: articleFlowList,
+				activeFlowApplyid: articleFlowList.length ? String(articleFlowList[0].applyid) : '',
 				guestAccess: { guestAccessFlag: '0', guestAccountIds: [] },
 				guestAccounts: []
 			};
 		},
+		computed: {
+			activeFlow: function() {
+				var applyid = this.activeFlowApplyid;
+				return this.articleFlowList.find(function(item) {
+					return String(item.applyid) === applyid;
+				});
+			},
+			activeFlowUrl: function() {
+				if (!this.activeFlow) {
+					return '';
+				}
+				var url = '/app/flow/time/?applyid=' + encodeURIComponent(this.activeFlow.applyid);
+				if (Number(this.activeFlow.auditid) > 0) {
+					url += '&auditid=' + encodeURIComponent(this.activeFlow.auditid);
+				}
+				return url;
+			}
+		},
 		methods: {
 			loadGuestAccess: function() {
 				var _this = this;

+ 36 - 0
src/space/apps/moudules/website/services/ArticleService.java

@@ -957,6 +957,41 @@ public class ArticleService extends BaseTransaction {
         }
     }
 
+    private List<Map<String, Object>> getArticleFlowList(GeneralDBAccess gdba, Long articleid) throws Exception {
+        String sql = " select ap.applyid, ap.ascode, "
+                + " coalesce(asc1.name, '未知状态') as statusName, "
+                + " case "
+                + "   when lower(ap.flow_key) like '%articlechange%' then '变动审核' "
+                + "   when lower(ap.flow_key) like '%articledisable%' then '停用审核' "
+                + "   when lower(ap.flow_key) like '%articleenable%' then '启用审核' "
+                + "   when lower(ap.flow_key) like '%articlerelease%' then '发布审核' "
+                + "   else '文章审核' "
+                + " end as flowName, "
+                + " case "
+                + "   when ap.ascode = 11 then 'warning' "
+                + "   when ap.ascode in (41, 51) then 'success' "
+                + "   when ap.ascode in (21, 31, 61) then 'danger' "
+                + "   else 'info' "
+                + " end as statusType, "
+                + " date_format(ap.create_time, '%Y-%m-%d %H:%i:%s') as createTime, "
+                + " ifnull(date_format(ap.end_time, '%Y-%m-%d %H:%i:%s'), '') as endTime, "
+                + " ifnull((select au.auditid from audit au "
+                + "   where au.applyid = ap.applyid and au.dcode <> 72 "
+                + "   order by case "
+                + "     when ap.ascode = 11 and au.audit_time is null and au.acode in (51, 101) then 0 "
+                + "     when au.audit_time is not null then 1 "
+                + "     else 2 end, "
+                + "   ifnull(au.steps, 0) desc, au.auditid desc limit 1), 0) as auditid "
+                + " from apply ap "
+                + " left join apply_status_code asc1 on asc1.apply_status_code = ap.ascode "
+                + " where ap.dcode <> 72 and ap.table_name = 'article' and ap.table_key = 'articleid' "
+                + " and ap.table_key_value = :articleid "
+                + " order by case when ap.ascode = 11 then 0 else 1 end, ap.create_time desc, ap.applyid desc ";
+        SqlCommandImpl sqlCmd = new SqlCommandImpl(sql);
+        sqlCmd.setString("articleid", articleid);
+        return gdba.selectAsMapList(sqlCmd);
+    }
+
     /**
      * 文章信息
      *
@@ -1022,6 +1057,7 @@ public class ArticleService extends BaseTransaction {
         setRequestAttribute("navAllName", navAllName);
 
         setRequestAttribute("copyNav", GsonUtil.toJson(articleCopyList));
+        setRequestAttribute("articleFlowList", GsonUtil.toJson(getArticleFlowList(gdba, article.getArticleid())));
         WebsiteNavigation navigation = getWebsiteNavigationById(gdba, article.getNavigationid());
         String articleContentForPreview;
         try {