| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- import APP from '@/services';
- import { setAllEnum } from '@/services/bus/allEnum';
- import { getLongTypeLoginID } from '@/services/bus/login';
- import { localStorageUtil } from '@/utils/storage';
- import moment from 'moment';
- import { commonSearch_go } from '../index';
- import * as type from './interface';
- /**
- * 获取服务器时间
- */
- export function getServerTime(): Promise<string> {
- return commonSearch_go('/Common/GetServerTime', {})
- .then((res) => {
- const time = moment(res)
- .utc()
- .format('YYYY-MM-DD HH:mm:ss');
- APP.set('systemDate', time);
- return 'ok';
- })
- .catch((err: Error) => {
- throw new Error('获取服务器时间数据错误:' + err);
- });
- }
- /**
- * 获取所有枚举信息
- * @param autoid autoid传入后则返回这个ID之后的数据;如不传则返回所有
- */
- export function getAllEnums(autoid?: number): Promise<string> {
- const param = autoid ? { autoid } : {};
- return commonSearch_go('/Common/GetAllEnums', param)
- .then((res) => {
- console.log('所有枚举信息', res);
- setAllEnum(res)
- return 'ok';
- })
- .catch((err: Error) => {
- throw new Error('查询获取所有枚举信息:' + err);
- });
- }
- /**
- * 获取数据库错误信息
- * @param rowNumber 如果传入rowNumber,则返回此rowNumber后的数据
- */
- export function queryErrorInfos(rowNumber?: string): Promise<string> {
- const param = rowNumber ? { rowNumber } : {};
- return commonSearch_go('/Common/QueryErrorInfos', param)
- .then((res) => {
- localStorageUtil.setItem('errorCodeInfos', res);
- return 'ok';
- })
- .catch((err: Error) => {
- throw new Error('查询获取所有枚举信息:' + err);
- });
- }
- /**
- * 通知公告设置已读请求
- * @param loginID 登录账号
- * @param noticeID 通知公告ID
- */
- export function queryNoticeReaded(noticeID: number): Promise<string> {
- const param = { noticeID, loginID: Number(getLongTypeLoginID()) };
- return commonSearch_go('/Common/NoticeReaded', param, 'post')
- .then(() => 'ok')
- .catch((err: Error) => {
- throw new Error(`通知公告设置已读请求失败:${err}`);
- });
- }
- /**
- * 通知公告系统消息查询
- */
- export function queryNotice(): Promise<type.QueryNoticeRsp[]> {
- const param = { loginID: Number(getLongTypeLoginID()) };
- return commonSearch_go('/Common/QueryNotice', param).catch((err: Error) => {
- throw new Error(`通知公告系统消息查询失败:${err}`);
- });
- }
- /**
- * 获取PC交易端菜单
- */
- export function GetPCMenus(): Promise<string> {
- const param = {
- loginID: Number(getLongTypeLoginID()),
- clientType: 0, // 终端类型,0:PC 1:Mobile
- };
- return commonSearch_go('/Common/GetClientMenus', param)
- .then((res) => {
- APP.set('menus', res);
- console.log('res', res);
- return 'ok';
- })
- .catch((err: Error) => {
- throw new Error(`获取PC交易端菜单失败:${err}`);
- });
- }
- /**
- * 查询交易端列表头信息
- * @returns
- */
- export function QueryTableDefine(): Promise<type.TableDefineRsp[]> {
- const param = {
- tableType: 2, // 列表类型 - 1:管理端 2:H5终端 3:移动终端
- };
- return commonSearch_go('/Common/QueryTableDefine', param)
- .then((res) => {
- console.log('查询交易端列表头信息', res);
- APP.set('tableHead', res);
- return res;
- })
- .catch((err: Error) => {
- throw new Error(`查询交易端列表头信息:${err}`);
- });
- }
|