浏览代码

feat: 待审批 隐藏100%

luoyali 1 年之前
父节点
当前提交
4c7dafb2b1

+ 1 - 2
src/components/packages/formEditor/components/Layout/DragGable.jsx

@@ -69,7 +69,6 @@ export default defineComponent({
 		const isInline = props.type === 'inline'
 		const ns = hooks.useNamespace('DragGableLayout')
 		const { state, isEditModel, isPc, setSelection } = hooks.useTarget()
-		console.log(state, 'state=======')
 		const handleMove = e => {
 			return true
 		}
@@ -129,7 +128,7 @@ export default defineComponent({
 						let TypeComponent = ''
 						if (unref(isEditModel) || _.get(state.fieldsLogicState.get(element), 'visible', undefined) !== 0) {
 							const typeProps = hooks.useProps(state, element, unref(isPc))
-							console.log(typeProps, 'typeProps')
+							// console.log(typeProps, 'typeProps')
 							TypeComponent = load.findComponent('FormTypes', element.type)
 							const params = {
 								data: element,

+ 15 - 34
src/views/approve/components/approvedContent.vue

@@ -476,6 +476,7 @@ const getTaskDetail = () => {
 				const formConfig = data.formConfig || []
 				let newFormStructure = formStructure // 存储一份
 				let newFields = newFormStructure.fields
+				let newFieldsList = newFormStructure.list
 				// pendingApproval, 除了[待审批]这个状态, 其余只能读取
 				if (props.currentTaskType !== 'pendingApproval') {
 					newFields.map(item1 => (item1.options.disabled = true))
@@ -483,52 +484,32 @@ const getTaskDetail = () => {
 					// data.formConfig
 					newFields.forEach(item => {
 						const matchingFormItem = formConfig.find(formItem => formItem.id == item.id)
-						if (matchingFormItem) {
+						// 如果找到匹配的对象,且opera为'2',则删除newFields中的对象
+						if (matchingFormItem && matchingFormItem.opera === '2') {
+							newFields = newFields.filter(t => t.id !== item.id)
+						} else if (matchingFormItem) {
+							// 否则,将opera属性添加到newFields中的对象
 							item.opera = matchingFormItem.opera
 							// '0': 只读 '1': 编辑 '2': 隐藏
 							item.options.disabled = ['0', '1'].indexOf(matchingFormItem.opera) > -1 ? !Number(matchingFormItem.opera) : false
 						}
 					})
 
-					// newFields.forEach(item => {
-					// 	// 在formConfig中查找是否有相同id的对象
-					// 	let configMatch = formConfig.find(config => config.id == item.id)
-					//
-					// 	// 如果找到匹配的对象,且opera为'2',则删除newFields中的对象
-					// 	if (configMatch && configMatch.opera === '2') {
-					// 		newFields = newFields.filter(t => t.id !== item.id)
-					// 	} else if (configMatch) {
-					// 		// 否则,将opera属性添加到newFields中的对象
-					// 		item.opera = configMatch.opera
-					// 		// '0': 只读 '1': 编辑 '2': 隐藏
-					// 		item.options.disabled = ['0', '1'].indexOf(configMatch.opera) > -1 ? !Number(configMatch.opera) : false
-					// 	}
-					// })
+					newFieldsList.forEach(item => {
+						const matchingFormItem = formConfig.find(formItem => formItem.id == item.id)
+						// 如果找到匹配的对象,且opera为'2',则删除newFields中的对象
+						if (matchingFormItem && matchingFormItem.opera === '2') {
+							newFieldsList = newFieldsList.filter(t => t.id !== item.id)
+						}
+					})
 				}
-				// console.log(newFields, '=====')
 				newFormStructure = {
 					...newFormStructure,
-					fields: newFields
+					fields: newFields,
+					list: newFieldsList
 				}
 				EReditorRef.value.setData(newFormStructure, formData)
 				validateForm.value.rule = newFields
-				return
-				// 以下代码作废 todo delete
-				// if (Array.isArray(forms)) {
-				// 	validateForm.value.rule = forms
-				// 	const api = validateForm.value.api
-				// 	api.setValue(
-				// 		forms.reduce((obj, item) => {
-				// 			obj[item.field] = item.local_value
-				// 			return obj
-				// 		}, {})
-				// 	)
-				// 	api.nextTick(() => {
-				// 		// 是否有编辑权限 操作
-				// 		api.disabled(false /*true*/)
-				// 	})
-				// }
-				// 以下代码作废 todo delete
 			} catch (e) {
 				console.error('解析 descItems 数据出现问题', e)
 				// descItemsData.value.list = []