|
@@ -26,9 +26,10 @@
|
|
|
<div class="area-divider"></div>
|
|
|
|
|
|
<!-- 表单 -->
|
|
|
- <el-descriptions v-loading="descItemsData.loading" :column="1" size="default">
|
|
|
- <el-descriptions-item v-for="(v, i) of descItemsData.list" :key="i" :label="v.showLabel">{{ v.showValue }}</el-descriptions-item>
|
|
|
- </el-descriptions>
|
|
|
+ <div v-loading="validateForm.loading" class="form-wrap">
|
|
|
+ <FormCreate v-show="validateForm.rule.length" v-model:api="validateForm.api" :option="validateForm.option" :rule="validateForm.rule" />
|
|
|
+ <LeNoData v-if="!validateForm.rule.length" message="表单无数据" />
|
|
|
+ </div>
|
|
|
|
|
|
<div class="area-divider"></div>
|
|
|
|
|
@@ -127,6 +128,7 @@ import ConsentOrRefuseDialog from '../components/consentOrRefuseDialog'
|
|
|
import DeliverToReviewDialog from '../components/deliverToReviewDialog'
|
|
|
import LoseSignDialog from '../components/loseSignDialog'
|
|
|
import RollbackDialog from '../components/rollbackDialog'
|
|
|
+import viewForm from '@/utils/form'
|
|
|
|
|
|
const props = defineProps({
|
|
|
modelValue: {
|
|
@@ -163,11 +165,16 @@ const visibleDialog = computed({
|
|
|
const taskId = computed(() => {
|
|
|
return props.taskObj.taskId || ''
|
|
|
})
|
|
|
-const descItemsData = ref({
|
|
|
- origin: undefined,
|
|
|
- list: [],
|
|
|
+const FormCreate = viewForm.$form()
|
|
|
+const validateForm = ref({
|
|
|
+ api: {},
|
|
|
+ option: {
|
|
|
+ submitBtn: false
|
|
|
+ },
|
|
|
+ rule: [],
|
|
|
loading: false
|
|
|
})
|
|
|
+
|
|
|
// 关闭按钮
|
|
|
const closeDrawer = () => {
|
|
|
emit('successFn')
|
|
@@ -188,6 +195,22 @@ const openComment = (type, item) => {
|
|
|
addSignVisible.value = !addSignVisible.value
|
|
|
break
|
|
|
case 'consentOrRefuseVisible':
|
|
|
+ // 点击同意
|
|
|
+ if (item === 'agree') {
|
|
|
+ debugger
|
|
|
+ // 验证表单 todo...
|
|
|
+ const api = validateForm.value.api
|
|
|
+ api.validate((valid, fail) => {
|
|
|
+ if (valid) {
|
|
|
+ const values = api.formData()
|
|
|
+ console.warn(values, 'values')
|
|
|
+ //todo 表单验证通过
|
|
|
+ } else {
|
|
|
+ //todo 表单验证未通过
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // return
|
|
|
+ }
|
|
|
currentDialog.value = item
|
|
|
consentOrRefuseVisible.value = !consentOrRefuseVisible.value
|
|
|
break
|
|
@@ -210,13 +233,13 @@ nextTick(() => {
|
|
|
activeData.value = data
|
|
|
})
|
|
|
// 提交的表单 数据展示
|
|
|
- descItemsData.value.loading = true
|
|
|
+ validateForm.value.loading = true
|
|
|
processTaskApprovalInfo(cur.taskId)
|
|
|
.then(data => {
|
|
|
- // console.log(data, 'data.......')
|
|
|
- descItemsData.value.origin = data
|
|
|
+ console.log(data, 'data.......')
|
|
|
+ // validateForm.value.origin = data
|
|
|
try {
|
|
|
- descItemsData.value.list = JSON.parse(data.formContent).map(item => {
|
|
|
+ /*descItemsData.value.list = JSON.parse(data.formContent).map(item => {
|
|
|
const showLabel = item.title
|
|
|
let showValue = item.local_value
|
|
|
const options = item.options
|
|
@@ -235,14 +258,30 @@ nextTick(() => {
|
|
|
showLabel,
|
|
|
showValue
|
|
|
}
|
|
|
- })
|
|
|
+ })*/
|
|
|
+ const forms = JSON.parse(data.formContent)
|
|
|
+ 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*/)
|
|
|
+ })
|
|
|
+ }
|
|
|
} catch (e) {
|
|
|
console.error('解析 descItems 数据出现问题', e)
|
|
|
- descItemsData.value.list = []
|
|
|
+ // descItemsData.value.list = []
|
|
|
+ validateForm.value.rule = []
|
|
|
}
|
|
|
})
|
|
|
.finally(() => {
|
|
|
- descItemsData.value.loading = false
|
|
|
+ validateForm.value.loading = false
|
|
|
})
|
|
|
})
|
|
|
</script>
|