新需求增加
This commit is contained in:
parent
99b1ca8247
commit
ef068aeed8
|
|
@ -21,7 +21,8 @@ const isError = ref(false)
|
|||
const taskDescribe = ref('')
|
||||
|
||||
const origin = window.location.href
|
||||
const taskId = ref('')
|
||||
const taskId = ref('28')
|
||||
const taskType = ref(2)
|
||||
|
||||
if (origin.indexOf('=') > -1) {
|
||||
taskId.value = origin.split('=')[1]
|
||||
|
|
@ -32,6 +33,10 @@ const getTaskDetailsData = async () => {
|
|||
const { data: res } = await getTaskDetailsApi({
|
||||
id: taskId.value,
|
||||
})
|
||||
|
||||
taskType.value = res.type
|
||||
|
||||
console.log(res, '数据源')
|
||||
if (res.code == 200) {
|
||||
isError.value = false
|
||||
taskDescribe.value = res.data.taskDescribe
|
||||
|
|
@ -45,7 +50,9 @@ getTaskDetailsData()
|
|||
|
||||
// 填写意见按钮
|
||||
const onSubmitOptions = () => {
|
||||
uni.redirectTo({ url: `/pages/opinion/index?taskId=${taskId.value}` })
|
||||
uni.redirectTo({
|
||||
url: `/pages/opinion/index?taskId=${taskId.value}&taskType=${taskType.value}`,
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
labelWidth="auto"
|
||||
class="opinion-form"
|
||||
>
|
||||
<up-form-item label="姓名" prop="userName">
|
||||
<up-form-item label="姓名" prop="userName" :required="isRequired">
|
||||
<up-input
|
||||
v-model="opinionModel.userName"
|
||||
class="input-content"
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
clearable
|
||||
/>
|
||||
</up-form-item>
|
||||
<up-form-item label="电话" prop="userPhone">
|
||||
<up-form-item label="电话" prop="userPhone" :required="isRequired">
|
||||
<up-input
|
||||
v-model="opinionModel.userPhone"
|
||||
class="input-content"
|
||||
|
|
@ -109,39 +109,9 @@ const opinionModel = ref({
|
|||
userOpinion: '',
|
||||
})
|
||||
|
||||
onLoad((option) => {
|
||||
if (option.taskId) {
|
||||
opinionModel.value.taskId = option.taskId
|
||||
}
|
||||
})
|
||||
|
||||
const fileList = ref([])
|
||||
|
||||
const opinionRules = ref({
|
||||
// userName: [
|
||||
// {
|
||||
// type: 'string',
|
||||
// required: true,
|
||||
// message: '请填写姓名',
|
||||
// trigger: ['blur', 'change'],
|
||||
// },
|
||||
// {
|
||||
// pattern: /^[\u4e00-\u9fa5]{2,6}$/,
|
||||
// // 正则检验前先将值转为字符串
|
||||
// transform(value) {
|
||||
// return String(value)
|
||||
// },
|
||||
// message: '请填写正确的姓名',
|
||||
// },
|
||||
// ],
|
||||
userName: [],
|
||||
userPhone: [
|
||||
// {
|
||||
// type: 'string',
|
||||
// required: true,
|
||||
// message: '请填写电话',
|
||||
// trigger: ['blur', 'change'],
|
||||
// },
|
||||
|
||||
{
|
||||
pattern: /^1[3-9]\d{9}$/,
|
||||
// 正则检验前先将值转为字符串
|
||||
|
|
@ -165,6 +135,45 @@ const opinionRules = ref({
|
|||
],
|
||||
})
|
||||
|
||||
const isRequired = ref(false)
|
||||
|
||||
onLoad((option) => {
|
||||
if (option.taskId) {
|
||||
opinionModel.value.taskId = option.taskId
|
||||
}
|
||||
if (option.taskType && option.taskType == 1) {
|
||||
isRequired.value = true
|
||||
|
||||
opinionRules.value.userName = [
|
||||
{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请填写姓名',
|
||||
trigger: ['blur', 'change'],
|
||||
},
|
||||
{
|
||||
pattern: /^[\u4e00-\u9fa5]{2,6}$/,
|
||||
// 正则检验前先将值转为字符串
|
||||
transform(value) {
|
||||
return String(value)
|
||||
},
|
||||
message: '请填写正确的姓名',
|
||||
},
|
||||
]
|
||||
opinionRules.value.userPhone.push({
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请填写电话',
|
||||
trigger: ['blur', 'change'],
|
||||
})
|
||||
}
|
||||
if (option.taskType && option.taskType == 2) {
|
||||
isRequired.value = false
|
||||
}
|
||||
})
|
||||
|
||||
const fileList = ref([])
|
||||
|
||||
// 表单实例
|
||||
const opinionModelRef = ref(null)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue