14
0
Эх сурвалжийг харах

Merge branch 'feature/H516088' of wanglj/labsop_h5 into master

徐凯 7 сар өмнө
parent
commit
c58e1cc9c7

+ 4 - 0
src/api/platform/appoint/index.ts

@@ -76,6 +76,10 @@ export function usePlatformAppointApi() {
     },
     },
     getMolecularEntityById(params?: Object) {
     getMolecularEntityById(params?: Object) {
       return request.postRequest(basePath, 'PlatPlatformAppoint', 'GetMolecularEntityById', params)
       return request.postRequest(basePath, 'PlatPlatformAppoint', 'GetMolecularEntityById', params)
+    },
+    // 申请出室
+    createCommonAppoint(params?: Object) {
+      return request.postRequest(basePath, 'PlatPlatformAppoint', 'CreateCommonAppoint', params)
     }
     }
   }
   }
 }
 }

+ 6 - 3
src/main.ts

@@ -12,12 +12,13 @@ import 'vant/es/toast/style'
 import 'vant/es/dialog/style'
 import 'vant/es/dialog/style'
 import ElementPlus from 'element-plus'
 import ElementPlus from 'element-plus'
 import * as ElementPlusIconsVue from '@element-plus/icons-vue'
 import * as ElementPlusIconsVue from '@element-plus/icons-vue'
+import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
 import 'element-plus/dist/index.css'
 import 'element-plus/dist/index.css'
 import router from './router'
 import router from './router'
 import './theme/index.scss'
 import './theme/index.scss'
 import './theme/vant.scss'
 import './theme/vant.scss'
-import pinia from '/@/stores/index';
-import { directive } from '/@/directive/index';
+import pinia from '/@/stores/index'
+import { directive } from '/@/directive/index'
 const app = createApp(App)
 const app = createApp(App)
 for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
 for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
   app.component(key, component)
   app.component(key, component)
@@ -25,5 +26,7 @@ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
 directive(app)
 directive(app)
 app.use(pinia)
 app.use(pinia)
 app.use(router)
 app.use(router)
-app.use(ElementPlus)
+app.use(ElementPlus, {
+  locale: zhCn
+})
 app.mount('#app')
 app.mount('#app')

+ 108 - 1
src/view/entry/mine.vue

@@ -58,12 +58,53 @@
                   {{ item.resLocation }}
                   {{ item.resLocation }}
                 </span>
                 </span>
               </p>
               </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>
             </div>
           </template>
           </template>
         </van-cell>
         </van-cell>
       </van-list>
       </van-list>
     </div>
     </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>
   </div>
 </template>
 </template>
 
 
@@ -71,11 +112,15 @@
   import { reactive, onMounted, ref } from 'vue'
   import { reactive, onMounted, ref } from 'vue'
   import { useRouter } from 'vue-router'
   import { useRouter } from 'vue-router'
   import to from 'await-to-js'
   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 { usePlatformAppointApi } from '/@/api/platform/appoint'
   import { useCellAssignApi } from '/@/api/platform/home/assign'
   import { useCellAssignApi } from '/@/api/platform/home/assign'
   import { usePlatformApi } from '/@/api/platform/home'
   import { usePlatformApi } from '/@/api/platform/home'
   import { formatDate } from '/@/utils/formatTime'
   import { formatDate } from '/@/utils/formatTime'
+  import { useUserInfo } from '/@/stores/userInfo'
 
 
   enum EntryAssignStatus {
   enum EntryAssignStatus {
     TO_BE_ENTERED = '10', // 待入室
     TO_BE_ENTERED = '10', // 待入室
@@ -85,11 +130,16 @@
     NEXT_MONTH_OUT_ROOM = '40' // 次月出室
     NEXT_MONTH_OUT_ROOM = '40' // 次月出室
   }
   }
 
 
+  const stores = useUserInfo()
+  const { userInfos } = storeToRefs(stores)
+
   const platformAppointApi = usePlatformAppointApi()
   const platformAppointApi = usePlatformAppointApi()
   const platformApi = usePlatformApi()
   const platformApi = usePlatformApi()
   const cellAssignApi = useCellAssignApi()
   const cellAssignApi = useCellAssignApi()
   const router = useRouter()
   const router = useRouter()
 
 
+  const outRoomFormRef = ref()
+  const showOutDialog = ref<boolean>(false)
   const startTime = ref('')
   const startTime = ref('')
   const endTime = ref('')
   const endTime = ref('')
   const platformList = ref<any[]>([])
   const platformList = ref<any[]>([])
@@ -106,6 +156,28 @@
     loading: true,
     loading: true,
     list: [] as any[]
     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 () => {
   const onLoad = async () => {
     state.loading = true
     state.loading = true
@@ -165,6 +237,41 @@
     onLoad()
     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(() => {
   onMounted(() => {
     getDicts()
     getDicts()
     onLoad()
     onLoad()