| | |
| | | <!-- 工地专属信息编辑 --> |
| | | <template> |
| | | <el-form |
| | | v-if="showStyle == 'form'" |
| | | v-show="showStyle == 'form'" |
| | | :inline="false" |
| | | :model="formObj" |
| | | ref="formRef" |
| | |
| | | </el-form> |
| | | |
| | | <el-descriptions |
| | | v-else-if="showStyle == 'descriptions'" |
| | | v-show="showStyle == 'descriptions'" |
| | | :column="2" |
| | | :size="fontSize" |
| | | direction="horizontal" |
| | |
| | | </template> |
| | | <template #extra> |
| | | <el-button |
| | | :disabled="!edit && !ignoreEdit" |
| | | :size="fontSize" |
| | | :disabled="!edit" |
| | | type="primary" |
| | | @click="onSubmit" |
| | | :loading="loading" |
| | | >提交</el-button |
| | | > |
| | | <el-button :size="fontSize" :disabled="!edit" @click="onReset" |
| | | <el-button |
| | | :size="fontSize" |
| | | :disabled="!edit && !ignoreEdit" |
| | | @click="onReset" |
| | | >重置</el-button |
| | | > |
| | | </template> |
| | |
| | | <el-descriptions-item label="施工地址" span="2" |
| | | ><el-input |
| | | clearable |
| | | v-model="formObj.location" |
| | | v-model="sceneObj.location" |
| | | placeholder="施工地址" |
| | | :size="fontSize" |
| | | /></el-descriptions-item> |
| | |
| | | <template #append>㎡</template> |
| | | </el-input></el-descriptions-item |
| | | > |
| | | <el-descriptions-item label="项目负责人" |
| | | ><el-input |
| | | :size="fontSize" |
| | | clearable |
| | | v-model="sceneObj.contacts" |
| | | placeholder="项目负责人" |
| | | /></el-descriptions-item> |
| | | <el-descriptions-item label="项目负责人电话" |
| | | ><el-input |
| | | :size="fontSize" |
| | | clearable |
| | | type="tel" |
| | | v-model="sceneObj.contactst" |
| | | placeholder="项目负责人电话" |
| | | > |
| | | <template #prepend> |
| | | <el-icon><Iphone /></el-icon> |
| | | </template> </el-input |
| | | ></el-descriptions-item> |
| | | <el-descriptions-item label="安全员" |
| | | ><el-input |
| | | :size="fontSize" |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { defineProps, defineEmits, reactive, ref, watch } from 'vue'; |
| | | import { reactive, ref, watch, computed } from 'vue'; |
| | | import { useDateFormat } from '@vueuse/core'; |
| | | import { enumStatusNA, enumStageNA } from '@/enum/construction'; |
| | | import sceneApi from '@/api/fysp/sceneApi'; |
| | |
| | | title: String |
| | | }); |
| | | const fontSize = ref('small'); |
| | | const emit = defineEmits(['onSubmit', 'onCancel']); |
| | | const emit = defineEmits([ |
| | | 'onSubmit', |
| | | 'onCancel', |
| | | 'update:scene', |
| | | 'update:formInfo' |
| | | ]); |
| | | |
| | | const sceneObj = ref({}); |
| | | const { formObj, formRef, edit, onSubmit, onReset } = useFormConfirm({ |
| | | submit: { |
| | | do: submit |
| | |
| | | do: cancel |
| | | } |
| | | }); |
| | | const ignoreEdit = computed(() => props.showStyle == 'descriptions'); |
| | | |
| | | const loading = ref(false); |
| | | const status = reactive(enumStatusNA()); |
| | | const stage = reactive(enumStageNA()); |
| | |
| | | }); |
| | | |
| | | // 创建或更新场景详情 |
| | | function createOrupdateScene() { |
| | | function createOrupdateSubScene() { |
| | | loading.value = true; |
| | | |
| | | if (formObj.value._timeRange && formObj.value._timeRange.length == 2) { |
| | |
| | | return sceneApi |
| | | .updateSubScene(props.sceneType, formObj.value) |
| | | .then((res) => { |
| | | emit('onSubmit', formObj); |
| | | emit('update:formInfo', formObj); |
| | | return res.data; |
| | | }) |
| | | .finally(() => { |
| | |
| | | }); |
| | | } |
| | | |
| | | function submit() { |
| | | emit('onSubmit', formObj); |
| | | // 更新场景 |
| | | function updateScene() { |
| | | return sceneApi.updateScene(sceneObj.value).then(() => { |
| | | emit('update:scene', sceneObj); |
| | | }); |
| | | } |
| | | |
| | | return createOrupdateScene(); |
| | | function submit() { |
| | | updateScene(); |
| | | return createOrupdateSubScene(); |
| | | } |
| | | |
| | | function cancel() { |
| | |
| | | }, |
| | | { deep: false, immediate: true } |
| | | ); |
| | | |
| | | watch( |
| | | () => props.scene, |
| | | (nValue) => { |
| | | if (nValue) { |
| | | sceneObj.value = nValue; |
| | | } |
| | | }, |
| | | { deep: false, immediate: true } |
| | | ); |
| | | </script> |
| | | |
| | | <style> |