|
|
@@ -58,12 +58,53 @@
|
|
|
{{ item.resLocation }}
|
|
|
</span>
|
|
|
</p>
|
|
|
- <footer class="flex justify-between mt4"></footer>
|
|
|
+ <footer class="flex justify-between mt16">
|
|
|
+ <div v-if="item.assignStatus === EntryAssignStatus.ENTERED && item.userId === userInfos.id" style="text-align: right; width: 100%">
|
|
|
+ <van-button type="primary" style="height: 30px" @click="handleOutRoom(item)">申请出室</van-button>
|
|
|
+ </div>
|
|
|
+ </footer>
|
|
|
</div>
|
|
|
</template>
|
|
|
</van-cell>
|
|
|
</van-list>
|
|
|
</div>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ v-model="showOutDialog"
|
|
|
+ title="申请出室"
|
|
|
+ width="85%"
|
|
|
+ :before-close="
|
|
|
+ () => {
|
|
|
+ showOutDialog = false
|
|
|
+ }
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <el-form ref="outRoomFormRef" :model="outRoomForm" :rules="rules" label-position="top">
|
|
|
+ <el-form-item style="display: block" label="申请出室日期" prop="outRoomDate">
|
|
|
+ <el-date-picker
|
|
|
+ :disabled-date="disabledTime"
|
|
|
+ v-model="outRoomForm.outRoomDate"
|
|
|
+ type="month"
|
|
|
+ style="width: 100%"
|
|
|
+ placeholder="请选择出室月份"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <div style="text-align: right; width: 100%">
|
|
|
+ <el-button
|
|
|
+ @click="
|
|
|
+ () => {
|
|
|
+ showOutDialog = false
|
|
|
+ }
|
|
|
+ "
|
|
|
+ >取消</el-button
|
|
|
+ >
|
|
|
+ <el-button type="primary" @click="handleSubmitOutRoom">申请</el-button>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -71,11 +112,15 @@
|
|
|
import { reactive, onMounted, ref } from 'vue'
|
|
|
import { useRouter } from 'vue-router'
|
|
|
import to from 'await-to-js'
|
|
|
+ import { storeToRefs } from 'pinia'
|
|
|
+ import { ElMessage } from 'element-plus'
|
|
|
+ import dayjs from 'dayjs'
|
|
|
|
|
|
import { usePlatformAppointApi } from '/@/api/platform/appoint'
|
|
|
import { useCellAssignApi } from '/@/api/platform/home/assign'
|
|
|
import { usePlatformApi } from '/@/api/platform/home'
|
|
|
import { formatDate } from '/@/utils/formatTime'
|
|
|
+ import { useUserInfo } from '/@/stores/userInfo'
|
|
|
|
|
|
enum EntryAssignStatus {
|
|
|
TO_BE_ENTERED = '10', // 待入室
|
|
|
@@ -85,11 +130,16 @@
|
|
|
NEXT_MONTH_OUT_ROOM = '40' // 次月出室
|
|
|
}
|
|
|
|
|
|
+ const stores = useUserInfo()
|
|
|
+ const { userInfos } = storeToRefs(stores)
|
|
|
+
|
|
|
const platformAppointApi = usePlatformAppointApi()
|
|
|
const platformApi = usePlatformApi()
|
|
|
const cellAssignApi = useCellAssignApi()
|
|
|
const router = useRouter()
|
|
|
|
|
|
+ const outRoomFormRef = ref()
|
|
|
+ const showOutDialog = ref<boolean>(false)
|
|
|
const startTime = ref('')
|
|
|
const endTime = ref('')
|
|
|
const platformList = ref<any[]>([])
|
|
|
@@ -106,6 +156,28 @@
|
|
|
loading: true,
|
|
|
list: [] as any[]
|
|
|
})
|
|
|
+ const currentSelectEntryItem = ref({
|
|
|
+ id: null,
|
|
|
+ endTime: '',
|
|
|
+ startTime: ''
|
|
|
+ })
|
|
|
+
|
|
|
+ const outRoomForm = reactive({
|
|
|
+ outRoomDate: ''
|
|
|
+ })
|
|
|
+
|
|
|
+ const rules = {
|
|
|
+ outRoomDate: { required: true, message: '不能为空', trigger: 'change' }
|
|
|
+ }
|
|
|
+
|
|
|
+ const disabledTime = (date: Date) => {
|
|
|
+ let startTime = formatDate(new Date(dayjs(currentSelectEntryItem.value.startTime).add(1, 'month').format('YYYY-MM-DD')), 'YYYY-mm-dd')
|
|
|
+ let endTime = formatDate(new Date(dayjs(currentSelectEntryItem.value.endTime).subtract(1, 'month').format('YYYY-MM-DD')), 'YYYY-mm-dd')
|
|
|
+
|
|
|
+ let now = formatDate(new Date(), 'YYYY-mm-dd')
|
|
|
+ let time = formatDate(new Date(date), 'YYYY-mm-dd')
|
|
|
+ return time < now || time > endTime || time < startTime
|
|
|
+ }
|
|
|
|
|
|
const onLoad = async () => {
|
|
|
state.loading = true
|
|
|
@@ -165,6 +237,41 @@
|
|
|
onLoad()
|
|
|
}
|
|
|
|
|
|
+ const handleOutRoom = (item: any) => {
|
|
|
+ showOutDialog.value = true
|
|
|
+ currentSelectEntryItem.value = item
|
|
|
+ }
|
|
|
+
|
|
|
+ const handleSubmitOutRoom = () => {
|
|
|
+ outRoomFormRef.value.validate(async (valid: boolean) => {
|
|
|
+ if (!valid) return
|
|
|
+ const { projectGroup } = userInfos.value
|
|
|
+ const [err, res]: ToResponse = await to(
|
|
|
+ platformAppointApi.createCommonAppoint({
|
|
|
+ tranId: currentSelectEntryItem.value.id,
|
|
|
+ tranType: 1,
|
|
|
+ outApplyTime: dayjs(outRoomForm.outRoomDate).endOf('month').format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ memberId: userInfos.value.id,
|
|
|
+ memberName: userInfos.value.nickName,
|
|
|
+ memberType: userInfos.value.userType,
|
|
|
+ memberPhone: userInfos.value.phone,
|
|
|
+ deptId: userInfos.value.deptId,
|
|
|
+ deptName: userInfos.value.deptName,
|
|
|
+ pgId: projectGroup.id,
|
|
|
+ pgName: projectGroup.pgName,
|
|
|
+ mentorId: projectGroup.pgLeaderId,
|
|
|
+ mentorName: projectGroup.pgLeaderName,
|
|
|
+ mentorDeptName: projectGroup.pgOrgPaths,
|
|
|
+ mentorPhone: projectGroup.pgLeaderContact
|
|
|
+ })
|
|
|
+ )
|
|
|
+ if (err) return
|
|
|
+ showOutDialog.value = false
|
|
|
+ ElMessage.success('操作成功')
|
|
|
+ onLoad()
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
getDicts()
|
|
|
onLoad()
|