feat: 高出作业的回显修补

八项作业
mengfanliang 2024-08-30 12:54:34 +08:00
parent 0dcfee9404
commit e6bf76cade
2 changed files with 98 additions and 84 deletions

View File

@ -290,7 +290,7 @@ export default {
fnSingleChoiceClick(event) {
this.picker.type = event
if (event === 'WORK_TYPE_NAME') {
this.picker.columns = [[{ NAME: "堵盲板", ID: '1' }, { NAME: "抽盲板", ID: '2' }]]
this.picker.columns = [[{ NAME: "堵盲板", ID: '0' }, { NAME: "抽盲板", ID: '1' }]]
if (this.jobTypeNameArr.length > 0) {
this.picker.defaultIndex = this.jobTypeNameArr;
}

View File

@ -26,7 +26,7 @@
<u-icon name="arrow-right"></u-icon>
</u-form-item>
<u-form-item label="作业内容" prop="WORK_CONTENT" borderBottom required labelPosition="top" labelWidth="auto">
<u-textarea v-model="form.WORK_USER" border="none" autoHeight maxlength="-1"/>
<u-textarea v-model="form.WORK_CONTENT" border="none" autoHeight maxlength="-1" />
</u-form-item>
<u-form-item label="作业实施开始时间" prop="WORK_START_DATE" borderBottom required
@click="fnDateTimePickerClick('WORK_START_DATE')">
@ -48,8 +48,8 @@
<u-form-item label="纬度" prop="WORK_LATITUDE" borderBottom required>
<u-input v-model="form.WORK_LATITUDE" border="none" readonly />
</u-form-item>
<u-form-item label="关联的其他特殊作业及安全作业票编号" prop="SPECIAL_WORK" borderBottom required
labelPosition="top" labelWidth="auto">
<u-form-item label="关联的其他特殊作业及安全作业票编号" prop="SPECIAL_WORK" borderBottom required labelPosition="top"
labelWidth="auto">
<u-button type="primary" size="mini" text="选择其它"
:customStyle="{ position: 'absolute', top: '-46upx', right: '20upx', width: '150upx' }"
@click="otherAssignmentsShow = true" />
@ -67,7 +67,7 @@
<u-button type="primary" text="下一步" @click="$u.debounce(fnSubmit, 1000, true)" />
</view>
</view>
<u-picker :show="picker.show" :columns="picker.columns" :keyName="picker.key" :key="picker.type"
<u-picker :show="picker.show" :columns="picker.columns" :keyName="picker.key" :key="picker.type" :defaultIndex="picker.defaultIndex"
@confirm="fnSingleChoiceConfirm" @cancel="fnSingleChoiceCancel" />
<u-datetime-picker :show="dateTimePicker.show" v-model="dateTimePicker.value" :mode="dateTimePicker.mode"
:minDate="dateTimePicker.min" :key="dateTimePicker.type" @confirm="fnDateTimePickerConfirm"
@ -78,6 +78,7 @@
</template>
<script>
import { getTaskInfo } from "@/api";
import OtherSelect from '@/components/other-select/index.vue';
import Sign from '@/components/sign/sign.vue'
import { setSubmitForm } from "@/utils/submitHomeworkProcess";
@ -156,7 +157,8 @@ export default {
show: false,
columns: [],
key: 'NAME',
type: 'picker'
type: 'picker',
defaultIndex: []
},
dateTimePicker: {
show: false,
@ -167,22 +169,49 @@ export default {
},
otherAssignmentsShow: false,
otherIdentificationShow: false,
/** 存储高处作业类别选中态 */
jobTypeNameArr: [],
}
},
onLoad(options) {
this.form.CORP_ID = options.CORPINFO_ID
this.form.CORP_NAME = options.CORP_NAME
this.type = options.type
if (options.taskId) {
this.fnGetData(options.taskId)
}
},
methods: {
async fnGetData(taskId) {
let resData = await getTaskInfo({ EW_RU_TASK_ID: taskId })
if (resData.list.form && resData.list.form.length > 0) {
let newFormData = { ...this.form };
resData.list.form.forEach((sos, index) => {
newFormData[sos.ITEM_NAME] = sos.ITEM_VALUE;
if (sos.FK_NAME) {
newFormData[sos.FK_NAME] = sos.FK_VALUE;
if (sos.FK_NAME === "WORK_LEVEL") {
this.jobTypeNameArr = [Number(sos.FK_VALUE)];
}
}
});
this.form = newFormData;
}
},
fnSingleChoiceClick(event) {
this.picker.type = event
if (event === 'WORK_LEVEL_NAME') this.picker.columns = [[
{NAME: 'I级高处作业', ID: '1'},
{NAME: 'II级高处作业', ID: '2'},
{NAME: 'III级高处作业', ID: '3'},
{NAME: 'IV级高处作业', ID: '4'},
]]
if (event === 'WORK_LEVEL_NAME') {
this.picker.columns = [[
{ NAME: 'I级高处作业', ID: '0' },
{ NAME: 'II级高处作业', ID: '1' },
{ NAME: 'III级高处作业', ID: '2' },
{ NAME: 'IV级高处作业', ID: '3' },
]];
if (this.jobTypeNameArr.length > 0) {
this.picker.defaultIndex = this.jobTypeNameArr;
}
}
this.picker.show = true
},
fnSingleChoiceConfirm(event) {
@ -221,20 +250,6 @@ export default {
async fnSubmit() {
try {
await this.$refs.formRef.validate()
for (let i = 0; i < this.form.boardList.length; i++) {
if (!this.form.boardList[i].BOARD_MATERIAL) {
uni.$u.toast(`盲板抽堵参数第${i + 1}项中,请输入管道材质`)
return
}
if (!this.form.boardList[i].BOARD_SPECIFICATION) {
uni.$u.toast(`盲板抽堵参数第${i + 1}项中,请输入管道规格`)
return
}
if (!this.form.boardList[i].BOARD_NO) {
uni.$u.toast(`盲板抽堵参数第${i + 1}项中,请输入管道编号`)
return
}
}
try {
await setSubmitForm({
form: this.form,
@ -252,5 +267,4 @@ export default {
}
</script>
<style scoped lang="scss">
</style>
<style scoped lang="scss"></style>