Procházet zdrojové kódy

feat: 审批流程条件换成中文

luoyali před 1 rokem
rodič
revize
aa453a4b60

+ 17 - 11
src/components/scWorkflow/nodes/branch.vue

@@ -114,14 +114,7 @@
 												<el-option v-for="{ id, label, key } in expressionFormList" :key="id" :label="label" :value="key" />
 											</el-select>
 											<el-select v-model="condition.operator" placeholder="请选择表达式">
-												<el-option label="等于" value="=="></el-option>
-												<el-option label="不等于" value="!="></el-option>
-												<el-option label="大于" value=">"></el-option>
-												<el-option label="大于等于" value=">="></el-option>
-												<el-option label="小于" value="<"></el-option>
-												<el-option label="小于等于" value="<="></el-option>
-												<el-option label="包含" value="include"></el-option>
-												<el-option label="不包含" value="notinclude"></el-option>
+												<el-option v-for="{ value, label } in operatorType" :key="label" :label="label" :value="value"></el-option>
 											</el-select>
 											<el-input v-model="condition.value" placeholder="值" />
 										</div>
@@ -156,6 +149,7 @@
 
 <script>
 import addNode from './addNode.vue'
+import { operatorType } from './config'
 import useFlowStore from '@/store/modules/flow'
 import { Delete, Plus, ArrowLeft, Close, ArrowRight, Edit } from '@element-plus/icons-vue'
 import { mapState } from 'pinia'
@@ -174,6 +168,7 @@ export default {
 	},
 	data() {
 		return {
+			operatorType,
 			nodeConfig: {},
 			drawer: false,
 			isEditTitle: false,
@@ -286,7 +281,18 @@ export default {
 		toText(nodeConfig, index) {
 			var { conditionList } = nodeConfig.conditionNodes[index]
 			if (conditionList && conditionList.length == 1) {
-				const text = conditionList.map(conditionGroup => conditionGroup.map(item => `${item.label}${item.operator}${item.value}`).join(' 和 '))
+				const text = conditionList.map(conditionGroup =>
+					conditionGroup
+						.map(item => {
+							const showOperator = this.operatorType.find(i => i.value === item.operator).label
+							if (item.type === 'form') {
+								return `${item.showLabel}${showOperator}${item.value}`
+							} else {
+								return `${item.label}${showOperator}${item.value}`
+							}
+						})
+						.join(' 和 ')
+				)
 				return text
 			} else if (conditionList && conditionList.length > 1) {
 				return conditionList.length + '个条件,或满足'
@@ -301,8 +307,8 @@ export default {
 		getCurrentItemLabel(conditionIdx, idx) {
 			const currentCondition = this.form.conditionList[conditionIdx]
 			const field = currentCondition[idx].field
-			// const labelObj = this.expressionFormList.find(i => i.key === field)
-			// currentCondition[idx].label = labelObj.label
+			const labelObj = this.expressionFormList.find(i => i.key === field)
+			currentCondition[idx].showLabel = labelObj.label
 			currentCondition[idx].label = field
 		},
 		getCurrentItemField(conditionIdx, idx) {

+ 35 - 0
src/components/scWorkflow/nodes/config.ts

@@ -156,3 +156,38 @@ export const subProcessType = [
 // 	res[value] = label
 // 	return res
 // }, {})
+// 操作符
+export const operatorType = [
+	{
+		label: '等于',
+		value: '=='
+	},
+	{
+		label: '不等于',
+		value: '!='
+	},
+	{
+		label: '大于',
+		value: '>'
+	},
+	{
+		label: '大于等于',
+		value: '>='
+	},
+	{
+		label: '小于',
+		value: '<'
+	},
+	{
+		label: '小于等于',
+		value: '<='
+	},
+	{
+		label: '包含',
+		value: 'include'
+	},
+	{
+		label: '不包含',
+		value: 'notinclude'
+	}
+]