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) { fnSingleChoiceClick(event) {
this.picker.type = event this.picker.type = event
if (event === 'WORK_TYPE_NAME') { 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) { if (this.jobTypeNameArr.length > 0) {
this.picker.defaultIndex = this.jobTypeNameArr; this.picker.defaultIndex = this.jobTypeNameArr;
} }

View File

@ -3,84 +3,85 @@
<view class="card"> <view class="card">
<u-form labelPosition="left" :model="form" :rules="rules" ref="formRef" labelWidth="140px"> <u-form labelPosition="left" :model="form" :rules="rules" ref="formRef" labelWidth="140px">
<u-form-item label="申请单位" prop="APPLY_DEPARTMENT_NAME" borderBottom required> <u-form-item label="申请单位" prop="APPLY_DEPARTMENT_NAME" borderBottom required>
<u-input v-model="form.APPLY_DEPARTMENT_NAME" border="none" readonly/> <u-input v-model="form.APPLY_DEPARTMENT_NAME" border="none" readonly />
</u-form-item> </u-form-item>
<u-form-item label="申请人" prop="APPLY_USER_NAME" borderBottom required> <u-form-item label="申请人" prop="APPLY_USER_NAME" borderBottom required>
<u-input v-model="form.APPLY_USER_NAME" border="none" readonly/> <u-input v-model="form.APPLY_USER_NAME" border="none" readonly />
</u-form-item> </u-form-item>
<u-form-item label="作业分公司" prop="CORP_NAME" borderBottom required> <u-form-item label="作业分公司" prop="CORP_NAME" borderBottom required>
<u-input v-model="form.CORP_NAME" border="none" readonly/> <u-input v-model="form.CORP_NAME" border="none" readonly />
</u-form-item> </u-form-item>
<u-form-item label="作业地点" prop="WORK_PLACE" borderBottom required> <u-form-item label="作业地点" prop="WORK_PLACE" borderBottom required>
<u-input v-model="form.WORK_PLACE" border="none"/> <u-input v-model="form.WORK_PLACE" border="none" />
</u-form-item> </u-form-item>
<u-form-item label="作业人" prop="PROJECT_MANAGER" borderBottom required> <u-form-item label="作业人" prop="PROJECT_MANAGER" borderBottom required>
<u-input v-model="form.PROJECT_MANAGER" border="none"/> <u-input v-model="form.PROJECT_MANAGER" border="none" />
</u-form-item> </u-form-item>
<u-form-item label="作业高度(米)" prop="WORK_HIGH" borderBottom required> <u-form-item label="作业高度(米)" prop="WORK_HIGH" borderBottom required>
<u-input v-model="form.WORK_HIGH" border="none" type="number"/> <u-input v-model="form.WORK_HIGH" border="none" type="number" />
</u-form-item> </u-form-item>
<u-form-item label="高处作业级别" prop="WORK_LEVEL_NAME" borderBottom required <u-form-item label="高处作业级别" prop="WORK_LEVEL_NAME" borderBottom required
@click="fnSingleChoiceClick('WORK_LEVEL_NAME')"> @click="fnSingleChoiceClick('WORK_LEVEL_NAME')">
<u-input v-model="form.WORK_LEVEL_NAME" border="none" readonly/> <u-input v-model="form.WORK_LEVEL_NAME" border="none" readonly />
<u-icon name="arrow-right"></u-icon> <u-icon name="arrow-right"></u-icon>
</u-form-item> </u-form-item>
<u-form-item label="作业内容" prop="WORK_CONTENT" borderBottom required labelPosition="top" labelWidth="auto"> <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>
<u-form-item label="作业实施开始时间" prop="WORK_START_DATE" borderBottom required <u-form-item label="作业实施开始时间" prop="WORK_START_DATE" borderBottom required
@click="fnDateTimePickerClick('WORK_START_DATE')"> @click="fnDateTimePickerClick('WORK_START_DATE')">
<u-input v-model="form.WORK_START_DATE" border="none" readonly/> <u-input v-model="form.WORK_START_DATE" border="none" readonly />
<u-icon name="arrow-right"></u-icon> <u-icon name="arrow-right"></u-icon>
</u-form-item> </u-form-item>
<u-form-item label="作业实施结束时间" prop="WORK_END_DATE" borderBottom required <u-form-item label="作业实施结束时间" prop="WORK_END_DATE" borderBottom required
@click="fnDateTimePickerClick('WORK_END_DATE')"> @click="fnDateTimePickerClick('WORK_END_DATE')">
<u-input v-model="form.WORK_END_DATE" border="none" readonly/> <u-input v-model="form.WORK_END_DATE" border="none" readonly />
<u-icon name="arrow-right"></u-icon> <u-icon name="arrow-right"></u-icon>
</u-form-item> </u-form-item>
<u-form-item label="地点坐标" borderBottom required> <u-form-item label="地点坐标" borderBottom required>
<u-button type="primary" size="small" text="定位" :customStyle="{width:'100upx',margin:0}" <u-button type="primary" size="small" text="定位" :customStyle="{ width: '100upx', margin: 0 }"
@click="fnLocation"/> @click="fnLocation" />
</u-form-item> </u-form-item>
<u-form-item label="经度" prop="WORK_LONGITUDE" borderBottom required> <u-form-item label="经度" prop="WORK_LONGITUDE" borderBottom required>
<u-input v-model="form.WORK_LONGITUDE" border="none" readonly/> <u-input v-model="form.WORK_LONGITUDE" border="none" readonly />
</u-form-item> </u-form-item>
<u-form-item label="纬度" prop="WORK_LATITUDE" borderBottom required> <u-form-item label="纬度" prop="WORK_LATITUDE" borderBottom required>
<u-input v-model="form.WORK_LATITUDE" border="none" readonly/> <u-input v-model="form.WORK_LATITUDE" border="none" readonly />
</u-form-item> </u-form-item>
<u-form-item label="关联的其他特殊作业及安全作业票编号" prop="SPECIAL_WORK" borderBottom required <u-form-item label="关联的其他特殊作业及安全作业票编号" prop="SPECIAL_WORK" borderBottom required labelPosition="top"
labelPosition="top" labelWidth="auto"> labelWidth="auto">
<u-button type="primary" size="mini" text="选择其它" <u-button type="primary" size="mini" text="选择其它"
:customStyle="{position: 'absolute',top: '-46upx',right: '20upx',width: '150upx'}" :customStyle="{ position: 'absolute', top: '-46upx', right: '20upx', width: '150upx' }"
@click="otherAssignmentsShow = true"/> @click="otherAssignmentsShow = true" />
<u-textarea v-model="form.SPECIAL_WORK" border="none" autoHeight maxlength="-1"/> <u-textarea v-model="form.SPECIAL_WORK" border="none" autoHeight maxlength="-1" />
</u-form-item> </u-form-item>
<u-form-item label="风险辨识结果" prop="RISK_IDENTIFICATION" borderBottom required labelPosition="top" <u-form-item label="风险辨识结果" prop="RISK_IDENTIFICATION" borderBottom required labelPosition="top"
labelWidth="auto"> labelWidth="auto">
<u-button type="primary" size="mini" text="选择其它" <u-button type="primary" size="mini" text="选择其它"
:customStyle="{position: 'absolute',top: '-46upx',right: '20upx',width: '150upx'}" :customStyle="{ position: 'absolute', top: '-46upx', right: '20upx', width: '150upx' }"
@click="otherIdentificationShow = true"/> @click="otherIdentificationShow = true" />
<u-textarea v-model="form.RISK_IDENTIFICATION" border="none" autoHeight maxlength="-1"/> <u-textarea v-model="form.RISK_IDENTIFICATION" border="none" autoHeight maxlength="-1" />
</u-form-item> </u-form-item>
</u-form> </u-form>
<view class="mt-10"> <view class="mt-10">
<u-button type="primary" text="下一步" @click="$u.debounce(fnSubmit, 1000,true)"/> <u-button type="primary" text="下一步" @click="$u.debounce(fnSubmit, 1000, true)" />
</view> </view>
</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"/> @confirm="fnSingleChoiceConfirm" @cancel="fnSingleChoiceCancel" />
<u-datetime-picker :show="dateTimePicker.show" v-model="dateTimePicker.value" :mode="dateTimePicker.mode" <u-datetime-picker :show="dateTimePicker.show" v-model="dateTimePicker.value" :mode="dateTimePicker.mode"
:minDate="dateTimePicker.min" :key="dateTimePicker.type" @confirm="fnDateTimePickerConfirm" :minDate="dateTimePicker.min" :key="dateTimePicker.type" @confirm="fnDateTimePickerConfirm"
@cancel="fnDateTimePickerCancel"/> @cancel="fnDateTimePickerCancel" />
<other-select :visible.sync="otherAssignmentsShow" v-model="form.SPECIAL_WORK" type="assignments"/> <other-select :visible.sync="otherAssignmentsShow" v-model="form.SPECIAL_WORK" type="assignments" />
<other-select :visible.sync="otherIdentificationShow" v-model="form.RISK_IDENTIFICATION" type="identification"/> <other-select :visible.sync="otherIdentificationShow" v-model="form.RISK_IDENTIFICATION" type="identification" />
</view> </view>
</template> </template>
<script> <script>
import { getTaskInfo } from "@/api";
import OtherSelect from '@/components/other-select/index.vue'; import OtherSelect from '@/components/other-select/index.vue';
import Sign from '@/components/sign/sign.vue' import Sign from '@/components/sign/sign.vue'
import {setSubmitForm} from "@/utils/submitHomeworkProcess"; import { setSubmitForm } from "@/utils/submitHomeworkProcess";
export default { export default {
components: { components: {
@ -91,20 +92,20 @@ export default {
return { return {
type: '', type: '',
formItems: [ formItems: [
{name: '申请单位', key_name: 'APPLY_DEPARTMENT_NAME', key_id: 'APPLY_DEPARTMENT_ID', type: 0}, { name: '申请单位', key_name: 'APPLY_DEPARTMENT_NAME', key_id: 'APPLY_DEPARTMENT_ID', type: 0 },
{name: '申请人', key_name: 'APPLY_USER_NAME', key_id: 'APPLY_USER_ID', type: 0}, { name: '申请人', key_name: 'APPLY_USER_NAME', key_id: 'APPLY_USER_ID', type: 0 },
{name: '作业分公司', key_name: 'CORP_NAME', key_id: 'CORP_ID', type: 0}, { name: '作业分公司', key_name: 'CORP_NAME', key_id: 'CORP_ID', type: 0 },
{name: '作业地点', key_name: 'WORK_PLACE', type: 0}, { name: '作业地点', key_name: 'WORK_PLACE', type: 0 },
{name: '作业人', key_name: 'PROJECT_MANAGER', type: 0}, { name: '作业人', key_name: 'PROJECT_MANAGER', type: 0 },
{name: '作业高度(米)', key_name: 'WORK_HIGH', type: 0}, { name: '作业高度(米)', key_name: 'WORK_HIGH', type: 0 },
{name: '高处作业级别', key_name: 'WORK_LEVEL_NAME', key_id: 'WORK_LEVEL', type: 0}, { name: '高处作业级别', key_name: 'WORK_LEVEL_NAME', key_id: 'WORK_LEVEL', type: 0 },
{name: '作业内容', key_name: 'WORK_CONTENT', type: 0}, { name: '作业内容', key_name: 'WORK_CONTENT', type: 0 },
{name: '作业实施开始时间', key_name: 'WORK_START_DATE', type: 0}, { name: '作业实施开始时间', key_name: 'WORK_START_DATE', type: 0 },
{name: '作业实施结束时间', key_name: 'WORK_END_DATE', type: 0}, { name: '作业实施结束时间', key_name: 'WORK_END_DATE', type: 0 },
{name: '经度', key_name: 'WORK_LONGITUDE', type: 0}, { name: '经度', key_name: 'WORK_LONGITUDE', type: 0 },
{name: '纬度', key_name: 'WORK_LATITUDE', type: 0}, { name: '纬度', key_name: 'WORK_LATITUDE', type: 0 },
{name: '关联的其他特殊作业及安全作业票编号', key_name: 'SPECIAL_WORK', type: 0}, { name: '关联的其他特殊作业及安全作业票编号', key_name: 'SPECIAL_WORK', type: 0 },
{name: '风险辨识结果', key_name: 'RISK_IDENTIFICATION', type: 0}, { name: '风险辨识结果', key_name: 'RISK_IDENTIFICATION', type: 0 },
], ],
form: { form: {
APPLY_DEPARTMENT_ID: this.$store.getters.getUserInfo.DEPARTMENT_ID, APPLY_DEPARTMENT_ID: this.$store.getters.getUserInfo.DEPARTMENT_ID,
@ -127,18 +128,18 @@ export default {
RISK_IDENTIFICATION: '', RISK_IDENTIFICATION: '',
}, },
rules: { rules: {
APPLY_DEPARTMENT_ID: [{type: 'string', required: true, message: '请选择申请单位', trigger: ['blur', 'change']}], APPLY_DEPARTMENT_ID: [{ type: 'string', required: true, message: '请选择申请单位', trigger: ['blur', 'change'] }],
APPLY_USER_NAME: [{type: 'string', required: true, message: '请选择申请人', trigger: ['blur', 'change']}], APPLY_USER_NAME: [{ type: 'string', required: true, message: '请选择申请人', trigger: ['blur', 'change'] }],
CORP_NAME: [{type: 'string', required: true, message: '请选择作业分公司', trigger: ['blur', 'change']}], CORP_NAME: [{ type: 'string', required: true, message: '请选择作业分公司', trigger: ['blur', 'change'] }],
WORK_PLACE: [{type: 'string', required: true, message: '请输入作业地点', trigger: ['blur', 'change']}], WORK_PLACE: [{ type: 'string', required: true, message: '请输入作业地点', trigger: ['blur', 'change'] }],
PROJECT_MANAGER: [{type: 'string', required: true, message: '请输入作业人', trigger: ['blur', 'change']}], PROJECT_MANAGER: [{ type: 'string', required: true, message: '请输入作业人', trigger: ['blur', 'change'] }],
WORK_HIGH: [{type: 'string', required: true, message: '请输入作业高度(米)', trigger: ['blur', 'change']}], WORK_HIGH: [{ type: 'string', required: true, message: '请输入作业高度(米)', trigger: ['blur', 'change'] }],
WORK_LEVEL_NAME: [{type: 'string', required: true, message: '请选择高处作业级别', trigger: ['blur', 'change']}], WORK_LEVEL_NAME: [{ type: 'string', required: true, message: '请选择高处作业级别', trigger: ['blur', 'change'] }],
WORK_CONTENT: [{type: 'string', required: true, message: '请输入作业内容', trigger: ['blur', 'change']}], WORK_CONTENT: [{ type: 'string', required: true, message: '请输入作业内容', trigger: ['blur', 'change'] }],
WORK_START_DATE: [{type: 'string', required: true, message: '请选择作业实施开始时间', trigger: ['blur', 'change']}], WORK_START_DATE: [{ type: 'string', required: true, message: '请选择作业实施开始时间', trigger: ['blur', 'change'] }],
WORK_END_DATE: [{type: 'string', required: true, message: '请选择作业实施结束时间', trigger: ['blur', 'change']}], WORK_END_DATE: [{ type: 'string', required: true, message: '请选择作业实施结束时间', trigger: ['blur', 'change'] }],
WORK_LONGITUDE: [{type: 'string', required: true, message: '请输入经度', trigger: ['blur', 'change']}], WORK_LONGITUDE: [{ type: 'string', required: true, message: '请输入经度', trigger: ['blur', 'change'] }],
WORK_LATITUDE: [{type: 'string', required: true, message: '请输入纬度', trigger: ['blur', 'change']}], WORK_LATITUDE: [{ type: 'string', required: true, message: '请输入纬度', trigger: ['blur', 'change'] }],
SPECIAL_WORK: [{ SPECIAL_WORK: [{
type: 'string', type: 'string',
required: true, required: true,
@ -156,7 +157,8 @@ export default {
show: false, show: false,
columns: [], columns: [],
key: 'NAME', key: 'NAME',
type: 'picker' type: 'picker',
defaultIndex: []
}, },
dateTimePicker: { dateTimePicker: {
show: false, show: false,
@ -167,22 +169,49 @@ export default {
}, },
otherAssignmentsShow: false, otherAssignmentsShow: false,
otherIdentificationShow: false, otherIdentificationShow: false,
/** 存储高处作业类别选中态 */
jobTypeNameArr: [],
} }
}, },
onLoad(options) { onLoad(options) {
this.form.CORP_ID = options.CORPINFO_ID this.form.CORP_ID = options.CORPINFO_ID
this.form.CORP_NAME = options.CORP_NAME this.form.CORP_NAME = options.CORP_NAME
this.type = options.type this.type = options.type
if (options.taskId) {
this.fnGetData(options.taskId)
}
}, },
methods: { 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) { fnSingleChoiceClick(event) {
this.picker.type = event this.picker.type = event
if (event === 'WORK_LEVEL_NAME') this.picker.columns = [[ if (event === 'WORK_LEVEL_NAME') {
{NAME: 'I级高处作业', ID: '1'}, this.picker.columns = [[
{NAME: 'II级高处作业', ID: '2'}, { NAME: 'I级高处作业', ID: '0' },
{NAME: 'III级高处作业', ID: '3'}, { NAME: 'II级高处作业', ID: '1' },
{NAME: 'IV级高处作业', ID: '4'}, { NAME: 'III级高处作业', ID: '2' },
]] { NAME: 'IV级高处作业', ID: '3' },
]];
if (this.jobTypeNameArr.length > 0) {
this.picker.defaultIndex = this.jobTypeNameArr;
}
}
this.picker.show = true this.picker.show = true
}, },
fnSingleChoiceConfirm(event) { fnSingleChoiceConfirm(event) {
@ -221,20 +250,6 @@ export default {
async fnSubmit() { async fnSubmit() {
try { try {
await this.$refs.formRef.validate() 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 { try {
await setSubmitForm({ await setSubmitForm({
form: this.form, form: this.form,
@ -252,5 +267,4 @@ export default {
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss"></style>
</style>