123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513 |
- import $http from '@/common/request.js'
- import config from '@/config'
- import store from '@/store/index.js'
- import { user } from '@/store/user.js'
- function storeUser() {
- let userInfo = store.state.user.userInfo
- return {
- userId: userInfo.userId,
- phone: userInfo.phone,
- userName: userInfo.name
- }
- }
- function getProjectId() {
- let userInfo = store.state.user.userInfo
- return userInfo.projectId
- }
- function commonParams() {
- return `openid=${storeUser().userId}&pubname=${
- config.brsgServer.pubname
- }&projectId=${getProjectId()}&userName=${storeUser().userName}&userPhone=${
- storeUser().phone
- }&userId=${storeUser().userId}`
- }
- // 获取地暖
- function querySapceFloorHeating(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- isNotShowErrorToast: true,
- url: `/duoduo-service/duoduoenv-service/ctrl/querySapceFloorHeating?${commonParams()}&spaceId=${params.spaceId}`,
- errorSave: true,
- method: 'get'
- })
- }
- // 设置设备
- function setEquipeHttp(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/object/eqp/infocode/set?${commonParams()}`,
- method: 'POST',
- isNotShowErrorToast: true,
- errorSave: true,
- data: JSON.stringify(params)
- })
- }
- // 获取设备
- function getObjectDataEqpGroupHttp(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/object/objectDataEqpGroup/query?${commonParams()}`,
- method: 'POST',
- isNotShowErrorToast: true,
- errorSave: true,
- data: JSON.stringify({ ...params })
- })
- }
- // 改变场景
- function switchoverSceneHttp(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/meeting/room/scene/switchover?${commonParams()}`,
- method: 'POST',
- isNotShowErrorToast: true,
- errorSave: true,
- data: JSON.stringify({ ...params, projectId: getProjectId() })
- })
- }
- // 获得空间当前会议室场景
- function getMeetingSceneHttp(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/meeting/room/scene/getMeetingScene/V2?${commonParams()}&spaceId=${
- params.spaceId
- }`,
- isNotShowErrorToast: true,
- errorSave: true,
- method: 'get'
- })
- }
- // 获得空间场景
- function querySpaceSceneConfigHttp(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/duoduo-service/setup-service/scene/querySpaceSceneConfig?${commonParams()}&spaceId=${
- params.spaceId
- }`,
- isNotShowErrorToast: true,
- errorSave: true,
- method: 'get'
- })
- }
- // 设备
- function getEquipmentListHttp(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/object/equipment/findForServe?${commonParams()}&spaceId=${
- params.spaceId
- }`,
- isNotShowErrorToast: true,
- errorSave: true,
- method: 'POST'
- })
- }
- // set 设备
- function setEquipmentHttp(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/object/equipment/setRunStatus?${commonParams()}`,
- isNotShowErrorToast: true,
- errorSave: true,
- method: 'POST',
- data: JSON.stringify({ ...params, projectId: getProjectId() })
- })
- }
- // 详情页 面积图
- function getChartListHTTP(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- isNotShowErrorToast: true,
- errorSave: true,
- url: `/server/spaceAdjust/queryPropertyData?${commonParams()}&spaceId=${
- params.spaceId
- }&funcid=${params.funcid}`,
- method: 'get'
- })
- }
- // 办公空间
- function getSpaceAdjustList(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- // serverSp: 'http://192.168.0.47:52009',
- url: `/server/space/property?${commonParams()}`,
- method: 'POST',
- isNotShowErrorToast: true,
- errorSave: true,
- data: JSON.stringify({
- ...params,
- criteria: { ...params.criteria, projectId: getProjectId() }
- })
- })
- }
- // 温度上下限
- function getTempRangeHttp() {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/space/getTempRange?${commonParams()}`,
- isNotShowErrorToast: true,
- errorSave: true,
- method: 'get'
- })
- }
- // 天气预报
- function getWeather() {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- isNotShowErrorToast: true,
- url: `/duoduo-service/object-service/weather/getCurrentWeather?${commonParams()}`,
- errorSave: true,
- method: 'get'
- })
- }
- // 空调 - 调节文案/空调信息
- function getFeedbackDocumentsHttp(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/custom/feedback/documents?${commonParams()}`,
- isNotShowErrorToast: true,
- errorSave: true,
- method: 'POST',
- data: JSON.stringify(params)
- })
- }
- // 空调 调节
- function changeTempHttp(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/custom/feedbackCreate/v2?${commonParams()}`,
- method: 'POST',
- isNotShowErrorToast: true,
- errorSave: true,
- data: JSON.stringify({ ...params, projectId: getProjectId() })
- })
- }
- // 手动控制 下发指令
- function changeManualTempHttp(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/ctrl/set?${commonParams()}`,
- method: 'POST',
- isNotShowErrorToast: true,
- errorSave: true,
- data: JSON.stringify(params)
- })
- }
- // 查询空间空调信息
- function querySpaceConditioners(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- // serverSp: 'http://192.168.0.47:52009',
- url: `/server/ctrl/querySpaceConditioners?projectId=${params.projectId}&spaceId=${
- params.spaceId
- }`,
- isNotShowErrorToast: true,
- errorSave: true,
- method: 'GET'
- })
- }
- // // 空调 调节
- // function changeTempHttp(params) {
- // return $http({
- // serverSp: config.brsgServer.duoduoUrl,
- // url: `/server/custom/feedbackCreate?pubname=${config.brsgServer.pubname}&openid=${config.brsgServer.openid}&userName=${storeUser().userName}&userPhone=${storeUser().phone}`,
- // method: 'POST',
- // data: JSON.stringify(params)
- // });
- // }
- /* 灯的接口 */
- // 查询定制时间
- function getSetTimeHttp(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/customScene/queryCustom?${commonParams()}&spaceId=${
- params.spaceId
- }`,
- isNotShowErrorToast: true,
- errorSave: true,
- method: 'GET'
- })
- }
- // 更改 定制时间
- function changeSetTimeHttp(params) {
- params = { ...params, projectId: getProjectId() }
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/customScene/create?${commonParams()}`,
- method: 'POST',
- isNotShowErrorToast: true,
- errorSave: true,
- data: JSON.stringify(params)
- })
- }
- // 灯的状态
- function getLampHttp(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/light/status/query?${commonParams()}&spaceId=${
- params.spaceId
- }`,
- isNotShowErrorToast: true,
- errorSave: true,
- method: 'GET'
- })
- }
- // 批量 开关灯
- function setallLampHttp(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/light/onoff/set?${commonParams()}`,
- method: 'POST',
- isNotShowErrorToast: true,
- errorSave: true,
- data: JSON.stringify(params)
- })
- }
- // 全部关闭 关灯 走廊的灯 晚关
- function specialLightSetHttp(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/light/onoff/specialSet?${commonParams()}`,
- method: 'POST',
- isNotShowErrorToast: true,
- errorSave: true,
- data: JSON.stringify(params)
- })
- }
- // 开关失败时 定时查询灯状态
- function getStatusHttp(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/light/onoff/setSatus?${commonParams()}`,
- method: 'POST',
- isNotShowErrorToast: true,
- errorSave: true,
- data: JSON.stringify(params)
- })
- }
- // 插座-列表
- function getSocketHttp(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/duoduo-service/duoduoenv-service/ctrl/queryEquipmentStatusInfo?${commonParams()}&spaceId=${
- params.spaceId
- }&equipType=socket`,
- isNotShowErrorToast: true,
- errorSave: true,
- method: 'GET'
- })
- }
- // 插座-控制
- function setSocketHttp(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/duoduo-service/duoduoenv-service/ctrl/set?${commonParams()}`,
- method: 'POST',
- isNotShowErrorToast: true,
- errorSave: true,
- data: JSON.stringify(params)
- })
- }
- // 查询是否是过渡季
- function getSeasonType(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/duoduo-service/custom-service/custom/getSeasonType?projectId=${params.projectId}&date=${params.date}`,
- isNotShowErrorToast: true,
- errorSave: true,
- method: 'GET'
- })
- }
- // 查询所有空间设备
- function queryEquipStatistics(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/duoduo-service/object-service/object/equipment/queryEquipStatistics?projectId=${params.projectId}&floorId=${params.floorId}`,
- isNotShowErrorToast: true,
- errorSave: true,
- method: 'GET'
- })
- }
- // 批量空调 调节
- function changeAllAirHttp(params) {
- /// duoduoenv.sagacloud.cn/server/custom/feedbackCreate/v2Batch
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/custom/feedbackCreate/v2Batch?${commonParams()}`,
- method: 'POST',
- isNotShowErrorToast: true,
- errorSave: true,
- data: JSON.stringify(params)
- })
- }
- // 批量取消和申请加班
- function saveBatchCustomScene(params) {
- let paramsArr = JSON.parse(JSON.stringify(params.historyBookList))
- paramsArr.find((item) => {
- item.customSceneEqType = 'ALL'
- if (!item.sceneEquipList) item.sceneEquipList = []
- })
- if (params.type !== 'workOff' && params.type !== 'delete') {
- if (
- params.newBooklist &&
- params.newBooklist.startTime &&
- params.newBooklist.startTime !== ''
- ) {
- params.newBooklist.projectId = getProjectId()
- params.newBooklist.sourceType = config.brsgServer.pubname
- params.newBooklist.userId = storeUser().userId
- params.newBooklist.userPhone = storeUser().phone
- params.newBooklist.userName = storeUser().userName
- }
- if (paramsArr.length > 0) {
- paramsArr.find((item) => {
- item.startDate = item.startDate.replace(/-/g, '')
- item.endDate = item.startDate
- })
- }
- params.newBooklist && paramsArr.push(params.newBooklist)
- }
- if (params.type === 'delete') {
- paramsArr.find((item) => {
- item.startDate = item.startDate.replace(/-/g, '')
- item.endDate = item.startDate
- item.customSceneEqType = 'ALL'
- item.projectId = getProjectId()
- item.sourceType = config.brsgServer.pubname
- item.userId = storeUser().userId
- item.userPhone = storeUser().phone
- item.userName = storeUser().userName
- })
- }
- console.log(paramsArr, 'paramsArrparamsArr')
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/customScene/saveBatchCustomScene?${commonParams()}`,
- method: 'POST',
- isNotShowErrorToast: true,
- errorSave: true,
- data: JSON.stringify(paramsArr)
- })
- }
- // 查询加班记录
- function queryCustomAndScence(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/server/customScene/queryCustomAndScence?${commonParams()}&spaceId=${
- params.spaceId
- }`,
- method: 'GET',
- isNotShowErrorToast: true,
- errorSave: true
- })
- }
- // 设置常驻工区
- function changeDefaultSpace(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/duoduo-service/setup-service/controlSpaceUser/savePermanentSpace?spaceId=${params}&userId=${storeUser().userId}`,
- method: 'GET',
- isNotShowErrorToast: true,
- errorSave: true
- })
- }
- // 设备运行配置
- function queryEquipmentRunConfig(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/duoduo-service/custom-service/equipmentRun/queryEquipmentRunConfig?projectId=${getProjectId()}&spaceId=${params}`,
- method: 'GET',
- isNotShowErrorToast: true,
- errorSave: true
- })
- }
- // ---权限控制---
- // 项目控制权限
- function queryProjectConfig() {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/duoduo-service/duoduoenv-service/user/permissions/queryProjectConfig?projectId=${getProjectId()}`,
- method: 'GET',
- isNotShowErrorToast: true,
- errorSave: true
- })
- }
- // 空间控制权限
- function queryUserControlInfo() {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/duoduo-service/duoduoenv-service/user/permissions/queryUserControlInfo?${commonParams()}`,
- method: 'GET',
- isNotShowErrorToast: true,
- errorSave: true
- })
- }
- // 会议室控制权限
- function querySpaceMeetingInfo(params) {
- return $http({
- serverSp: config.brsgServer.duoduoUrl,
- url: `/duoduo-service/duoduoenv-service/meeting/querySpaceMeetingInfo?${commonParams()}`,
- method: 'POST',
- isNotShowErrorToast: true,
- errorSave: true,
- data: JSON.stringify(params)
- })
- }
- export {
- querySapceFloorHeating,
- querySpaceMeetingInfo,
- queryUserControlInfo,
- queryProjectConfig,
- queryEquipmentRunConfig,
- setSocketHttp,
- getSocketHttp,
- queryCustomAndScence,
- saveBatchCustomScene,
- setEquipeHttp,
- getObjectDataEqpGroupHttp,
- getFeedbackDocumentsHttp,
- getTempRangeHttp,
- getStatusHttp,
- setallLampHttp,
- specialLightSetHttp,
- getLampHttp,
- changeSetTimeHttp,
- getSetTimeHttp,
- getSpaceAdjustList,
- getWeather,
- changeTempHttp,
- getChartListHTTP,
- getEquipmentListHttp,
- setEquipmentHttp,
- getMeetingSceneHttp,
- querySpaceSceneConfigHttp,
- switchoverSceneHttp,
- getSeasonType,
- queryEquipStatistics,
- changeAllAirHttp,
- querySpaceConditioners,
- changeManualTempHttp,
- changeDefaultSpace
- }
|