xq feat:"完成了数据接入"
This commit is contained in:
		| @ -61,3 +61,10 @@ export const delNbq = (nbqId: string | number | Array<string | number>) => { | |||||||
|     method: 'delete' |     method: 'delete' | ||||||
|   }); |   }); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | export const getAll = () => { | ||||||
|  |   return request({ | ||||||
|  |     url: '/business/nbq/listNotPage', | ||||||
|  |     method: 'get' | ||||||
|  |   }); | ||||||
|  | }; | ||||||
|  | |||||||
| @ -6,7 +6,9 @@ | |||||||
|  |  | ||||||
|     <div class="right-menu flex align-center"> |     <div class="right-menu flex align-center"> | ||||||
|       <template v-if="appStore.device !== 'mobile'"> |       <template v-if="appStore.device !== 'mobile'"> | ||||||
|         <el-select class="program-list" :placeholder="programName"> </el-select> |         <el-select class="program-list" :placeholder="programName" @change="updateProgram"> | ||||||
|  |           <el-option v-for="(p, index) in programList" :key="index" :value="p.nbqId" :label="p.projectBrief"></el-option> | ||||||
|  |         </el-select> | ||||||
|         <el-select |         <el-select | ||||||
|           v-if="userId === 1 && tenantEnabled" |           v-if="userId === 1 && tenantEnabled" | ||||||
|           v-model="companyName" |           v-model="companyName" | ||||||
| @ -100,13 +102,15 @@ import { TenantVO } from '@/api/types'; | |||||||
| import notice from './notice/index.vue'; | import notice from './notice/index.vue'; | ||||||
| import router from '@/router'; | import router from '@/router'; | ||||||
| import { ElMessageBoxOptions } from 'element-plus/es/components/message-box/src/message-box.type'; | import { ElMessageBoxOptions } from 'element-plus/es/components/message-box/src/message-box.type'; | ||||||
|  | import { getAll } from '@/api/business/nbq'; | ||||||
|  | import { useProgram } from '@/store/modules/program'; | ||||||
|  |  | ||||||
| const appStore = useAppStore(); | const appStore = useAppStore(); | ||||||
| const userStore = useUserStore(); | const userStore = useUserStore(); | ||||||
| const settingsStore = useSettingsStore(); | const settingsStore = useSettingsStore(); | ||||||
| const noticeStore = storeToRefs(useNoticeStore()); | const noticeStore = storeToRefs(useNoticeStore()); | ||||||
| const newNotice = ref(<number>0); | const newNotice = ref(<number>0); | ||||||
|  | const programState = useProgram(); | ||||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||||
|  |  | ||||||
| const userId = ref(userStore.userId); | const userId = ref(userStore.userId); | ||||||
| @ -144,7 +148,7 @@ const dynamicClearEvent = async () => { | |||||||
|  |  | ||||||
| const programList = ref([{}]); | const programList = ref([{}]); | ||||||
|  |  | ||||||
| const programName = ref('田中光伏'); | const programName = ref(); | ||||||
|  |  | ||||||
| const programId = ref(); | const programId = ref(); | ||||||
|  |  | ||||||
| @ -205,6 +209,43 @@ watch( | |||||||
|   }, |   }, | ||||||
|   { deep: true } |   { deep: true } | ||||||
| ); | ); | ||||||
|  |  | ||||||
|  | function getAllList() { | ||||||
|  |   getAll().then((res) => { | ||||||
|  |     const data = res.data; | ||||||
|  |     programList.value = data.map((item) => { | ||||||
|  |       return { | ||||||
|  |         nbqId: item.nbqId, | ||||||
|  |         projectBrief: item.projectBrief | ||||||
|  |       }; | ||||||
|  |     }); | ||||||
|  |     programName.value = programList.value[0].projectBrief; | ||||||
|  |     programId.value = programList.value[0].nbqId; | ||||||
|  |   }); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function updateProgram(a) { | ||||||
|  |   programList.value.forEach((item) => { | ||||||
|  |     if (item.nbqId === a) { | ||||||
|  |       programName.value = item.projectBrief; | ||||||
|  |       programId.value = item.nbqId; | ||||||
|  |     } | ||||||
|  |   }); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | watch( | ||||||
|  |   programId, | ||||||
|  |   (nv, ov) => { | ||||||
|  |     if (nv !== ov) { | ||||||
|  |       programState.updateId(nv); | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |   { deep: true } | ||||||
|  | ); | ||||||
|  |  | ||||||
|  | onMounted(() => { | ||||||
|  |   getAllList(); | ||||||
|  | }); | ||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <style lang="scss" scoped> | <style lang="scss" scoped> | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user