123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- import * as config from '../config'
- const selectContractNo = {}
- const detailData = {}
- const erpWarehouse = {}
- const rolesList = []
- const now = Date.now || function() {
- return new Date().getTime();
- };
- const isArray = Array.isArray || function(obj) {
- return obj instanceof Array;
- };
- const getListByUserId = function() {
- let baseUrlNew = config.def().baseUrlNew
- var userInfo = uni.getStorageSync("userInfo")
- console.log("------", userInfo)
- if (userInfo) {
- uni.request({
- url: baseUrlNew + '/roleMenu/query/getListByUserId',
- data: {
- userId: userInfo.id ? userInfo.id : userInfo.data.id
- },
- method: 'GET',
- success: (res) => {
- if (res.statusCode === 200) {
- uni.setStorageSync("jurisdiction", res.data.data)
- let list = getUserAllRoles(res.data.data);
- uni.setStorageSync("rolesList", list)
- }
- }
- })
- }
- }
- const getUserAllRoles = (item) => {
- console.log(item)
- for (let i = 0; i < item.length; i++) {
- rolesList.push(item[i].name)
- // console.log('用户权限',rolesList)
- if (item[i].children && item[i].children.length > 0) {
- getUserAllRoles(item[i].children)
- }
- }
- return rolesList;
- }
- const setAudit = (item) => {
- let _list = uni.getStorageSync("copyTaskInfo")
- let _isShowbtn = true
- if (_list.length == 0) {
- _isShowbtn = false
- }
- for (let i = 0; i < _list.length; i++) {
- if (_list[i].businessId == item.id) {
- _list.splice(i, 1)
- uni.setStorageSync("copyTaskInfo", _list)
- }
- }
- if (_list.length > 0) {
- uni.navigateTo({
- url: _list[0].itemUrl + '&isShowbtn=' + _isShowbtn,
- })
- }
- console.log(item)
- }
- //获取当天日期
- const getNowFormatDate = () => {
- var date = new Date();
- var seperator1 = "-";
- var year = date.getFullYear();
- var month = date.getMonth() + 1;
- var strDate = date.getDate();
- if (month >= 1 && month <= 9) {
- month = "0" + month;
- }
- if (strDate >= 0 && strDate <= 9) {
- strDate = "0" + strDate;
- }
- var currentdate = year + seperator1 + month + seperator1 + strDate;
- return currentdate;
- }
- export default {
- detailData,
- selectContractNo,
- now,
- isArray,
- erpWarehouse,
- getListByUserId,
- setAudit,
- getNowFormatDate
- }
|