74 lines
2.1 KiB
Vue
74 lines
2.1 KiB
Vue
<template>
|
|
<view class="content">
|
|
<view class="card">
|
|
<u-form labelPosition="top" :model="form" :rules="rules" ref="formRef" labelWidth="auto">
|
|
<u-form-item label="其它安全措施" borderBottom required v-for="(item,index) in form.value" :key="item.id">
|
|
<u-button v-if="index === 0" type="primary" size="mini" text="新增"
|
|
:customStyle="{position: 'absolute',top: '-46upx',right: '20upx',width:'100upx',margin:0}"
|
|
@click="fnAddValue"/>
|
|
<u-button v-if="index !== 0" type="error" size="mini" text="删除"
|
|
:customStyle="{position: 'absolute',top: '-46upx',right: '20upx',width:'100upx',margin:0}"
|
|
@click="fnDeleteValue(index)"/>
|
|
<u-textarea v-model="item.value" border="none" autoHeight maxlength="-1"/>
|
|
</u-form-item>
|
|
</u-form>
|
|
<view class="mt-10">
|
|
<u-button type="primary" text="下一步" @click="$u.debounce(fnSubmit, 1000,true)"/>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {setOtherSecurityMeasures} from "@/utils/submitHomeworkProcess";
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
EW_RU_JOB_ID: '',
|
|
taskId: '',
|
|
TYPE: '',
|
|
CORP_ID: '',
|
|
form: {
|
|
value: []
|
|
},
|
|
rules: {},
|
|
}
|
|
},
|
|
onLoad(query) {
|
|
this.EW_RU_JOB_ID = query.EW_RU_JOB_ID
|
|
this.taskId = query.taskId
|
|
this.TYPE = query.TYPE
|
|
this.CORP_ID = query.CORP_ID
|
|
this.fnAddValue()
|
|
},
|
|
methods: {
|
|
fnAddValue() {
|
|
this.form.value.push({value: '', id: uni.$u.guid()})
|
|
},
|
|
fnDeleteValue(index) {
|
|
this.form.value.splice(index, 1)
|
|
},
|
|
async fnSubmit() {
|
|
for (let i = 0; i < this.form.value.length; i++) {
|
|
if (!this.form.value[i].value) {
|
|
uni.$u.toast(`第${i + 1}项中,请输入内容`)
|
|
return
|
|
}
|
|
}
|
|
await setOtherSecurityMeasures({
|
|
value: this.form.value,
|
|
taskId: this.taskId,
|
|
EW_RU_JOB_ID: this.EW_RU_JOB_ID,
|
|
CORP_ID: this.CORP_ID,
|
|
TYPE: this.TYPE
|
|
})
|
|
}
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
|
|
</style>
|