| | |
| | | res.resetContrl = card.wrap.resetContrl || 'init' |
| | | |
| | | if (res.colorField && res.signs) { |
| | | res.signs = res.signs.map(item => { |
| | | res.signs = res.signs.map((item, i) => { |
| | | try { |
| | | let colors = item.color.match(/\d+/g) |
| | | let colors = item.background.match(/\d+/g) |
| | | if ((colors[0] * 0.299 + colors[1] * 0.578 + colors[2] * 0.114) * colors[3] < 192) { |
| | | item.fontColor = '#ffffff' |
| | | } else { |
| | |
| | | item.fontColor = '' |
| | | } |
| | | |
| | | item.style = {background: item.background} |
| | | if (item.fontColor) { |
| | | item.style.color = item.fontColor |
| | | } |
| | | |
| | | item.$index = i + 1 |
| | | |
| | | return item |
| | | }) |
| | | } |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (!is(fromJS(this.props.config.wrap), fromJS(nextProps.config.wrap))) { |
| | | const { datelist } = this.state |
| | | if (!is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | this.setState({ |
| | | levels: nextProps.config.wrap.levels, |
| | | level: nextProps.config.wrap.levels[0] |
| | | datelist: this.mountdata(datelist, nextProps.data) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | mountdata = (datelist, data) => { |
| | | return fromJS(datelist).toJS().map(month => { |
| | | month.subData = [] |
| | | data.forEach(item => { |
| | | if (item.$startM <= month.time && item.$endM >= month.time) { |
| | | month.subData.push(item) |
| | | } |
| | | }) |
| | | |
| | | month.children = month.children.map(week => { |
| | | week.children = week.children.map(day => { |
| | | if (day.$disable) return day |
| | | |
| | | day.subData = [] |
| | | day.style = null |
| | | day.$level = 100 |
| | | data.forEach(item => { |
| | | if (item.$start <= day.time && item.$end >= day.time) { |
| | | day.subData.push(item) |
| | | |
| | | if (!day.style) { |
| | | day.style = item.$style |
| | | day.$level = item.$level |
| | | } else if (item.$level < day.$level) { |
| | | day.style = item.$style |
| | | day.$level = item.$level |
| | | } |
| | | } |
| | | }) |
| | | return day |
| | | }) |
| | | return week |
| | | }) |
| | | return month |
| | | }) |
| | | } |
| | | |
| | | getNongLi = (nyear, nmonth, nday, week) => { |
| | |
| | | |
| | | let item = { |
| | | day: _day, |
| | | time: times[0] + times[1] + _day, |
| | | time: +(times[0] + times[1] + _day), |
| | | label: _day, |
| | | subData: [], |
| | | $disable: true, |
| | |
| | | |
| | | let item = { |
| | | day: _day, |
| | | time: selectYear + month + _day, |
| | | time: +(selectYear + month + _day), |
| | | label: i, |
| | | subData: [], |
| | | ...nl |
| | |
| | | |
| | | let item = { |
| | | day: _day, |
| | | time: times[0] + times[1] + _day, |
| | | time: +(times[0] + times[1] + _day), |
| | | label: i, |
| | | subData: [], |
| | | $disable: true, |
| | |
| | | |
| | | datelist.push({ |
| | | month: month, |
| | | time: selectYear + month, |
| | | time: +(selectYear + month), |
| | | label: monthName[month], |
| | | children: _weeklist, |
| | | subData: [] |
| | |
| | | } |
| | | |
| | | yearChange = (value) => { |
| | | const { data } = this.props |
| | | const { selectMonth } = this.state |
| | | let datelist = this.getDateList(value) |
| | | |
| | | if (data.length > 0) { |
| | | datelist = this.mountdata(datelist, data) |
| | | } |
| | | |
| | | let monthlist = datelist.filter(item => item.month === selectMonth)[0].children.filter(cell => !cell.children[0].$disable || !cell.children[6].$disable) |
| | | |
| | | this.setState({ selectYear: value, datelist, monthlist }) |
| | |
| | | <tr key={m}> |
| | | {cell.children.map((d, i) => ( |
| | | <td key={i}> |
| | | <div className={'day-wrap' + (d.$disable ? ' disabled' : '')}> |
| | | <div style={d.style} className={'day-wrap' + (d.$disable ? ' disabled' : '')}> |
| | | {d.label} |
| | | </div> |
| | | </td> |
| | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import CalendarBoard from './board' |
| | | import './index.scss' |
| | | |
| | | const NormalHeader = asyncComponent(() => import('@/tabviews/custom/components/share/normalheader')) |
| | | const MainSearch = asyncComponent(() => import('@/tabviews/zshare/topSearch')) |
| | | const PopupButton = asyncComponent(() => import('@/tabviews/zshare/actionList/popupbutton')) |
| | | const CalendarBoard = asyncComponent(() => import('./board')) |
| | | |
| | | class NormalCalendar extends Component { |
| | | static propTpyes = { |
| | |
| | | BID: '', // 上级ID |
| | | config: null, // 图表配置信息 |
| | | loading: false, // 数据加载状态 |
| | | data: null, // 数据 |
| | | data: [], // 数据 |
| | | search: '', |
| | | year: new Date().getFullYear(), |
| | | BData: '' |
| | |
| | | _config.setting.$re_year = true |
| | | } |
| | | |
| | | if (_config.wrap.colorField && (!_config.wrap.signs || _config.wrap.signs.length === 0)) { |
| | | _config.wrap.colorField = '' |
| | | } |
| | | |
| | | this.setState({ |
| | | BID: BData ? (BData.$BID || '') : '', |
| | | BData: BData, |
| | |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: res.map((item, index) => { |
| | | let data = [] |
| | | res.forEach((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | |
| | | return item |
| | | })}) |
| | | |
| | | let pass = this.resetLine(item) |
| | | |
| | | if (pass) { |
| | | data.push(item) |
| | | } |
| | | }) |
| | | |
| | | this.setState({data: data}) |
| | | }) |
| | | } |
| | | } |
| | |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | let data = result.data.map((item, index) => { |
| | | let data = [] |
| | | result.data.forEach((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | |
| | | return item |
| | | let pass = this.resetLine(item) |
| | | |
| | | if (pass) { |
| | | data.push(item) |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | loading: false |
| | | }) |
| | | |
| | | |
| | | if (result.message) { |
| | | if (result.ErrCode === 'Y') { |
| | | Modal.success({ |
| | |
| | | } |
| | | } |
| | | |
| | | resetLine = (item) => { |
| | | const { config: { wrap } } = this.state |
| | | |
| | | let startTime = item[wrap.timeField] || '' |
| | | let endTime = item[wrap.endField || wrap.timeField] || '' |
| | | |
| | | item.$message = item[wrap.remarkField] |
| | | |
| | | if (!/^(1|2)\d{3}(-|\/)\d{2}(-|\/)\d{2}/.test(startTime)) return false |
| | | if (!/^(1|2)\d{3}(-|\/)\d{2}(-|\/)\d{2}/.test(endTime)) return false |
| | | if (!item.$message) return false |
| | | |
| | | if (wrap.colorField) { |
| | | let sign = item[wrap.colorField] || '' |
| | | |
| | | wrap.signs.forEach(cell => { |
| | | if (cell.sign !== sign) return |
| | | |
| | | item.$style = cell.style |
| | | item.$color = cell.background |
| | | item.$level = cell.$index |
| | | }) |
| | | } |
| | | |
| | | let equal = endTime.substr(0, 4) === startTime.substr(0, 4) |
| | | |
| | | item.$startM = +(startTime.substr(0, 4) + startTime.substr(5, 2)) |
| | | item.$endM = +(endTime.substr(0, 4) + endTime.substr(5, 2)) |
| | | item.$start = +(startTime.substr(0, 4) + startTime.substr(5, 2) + startTime.substr(8, 2)) |
| | | item.$end = +(endTime.substr(0, 4) + endTime.substr(5, 2) + endTime.substr(8, 2)) |
| | | item.$startTime = equal ? `${startTime.substr(5, 2)}-${startTime.substr(8, 2)}` : `${startTime.substr(0, 4)}-${startTime.substr(5, 2)}-${startTime.substr(8, 2)}` |
| | | item.$endTime = equal ? `${endTime.substr(5, 2)}-${endTime.substr(8, 2)}` : `${endTime.substr(0, 4)}-${endTime.substr(5, 2)}-${endTime.substr(8, 2)}` |
| | | |
| | | return true |
| | | } |
| | | |
| | | refreshbysearch = (searches) => { |
| | | this.setState({ |
| | | search: searches |
| | |
| | | <div className="normal-calendar-box" id={'anchor' + config.uuid} style={{...config.style}}> |
| | | {loading ? |
| | | <div className="loading-mask"> |
| | | {data ? <div className="ant-spin-blur"></div> : null} |
| | | <div className="ant-spin-blur"></div> |
| | | <Spin /> |
| | | </div> : null |
| | | } |
| | |
| | | {config.action[0] ? |
| | | <PopupButton disabled={false} BID={BID} btn={config.action[0]} BData={BData} setting={config.setting} selectedData={[]}/> : null |
| | | } |
| | | <CalendarBoard config={config} /> |
| | | <CalendarBoard config={config} data={data}/> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | document.getElementsByTagName('head')[0].removeChild(JSONP) |
| | | },500) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | // handleItem = (list) => { |
| | | // let param = list.shift() |
| | | // Object.keys(param).forEach(key => { |
| | | // if (param[key] === null) { |
| | | // param[key] = '' |
| | | // } |
| | | // }) |
| | | // Api.directRequest({ |
| | | // url: 'http://bms.kresstools.cn/oc/webapi/dostar/zsn_app_bddmsdealersm_add_upt', |
| | | // method: 'post', |
| | | // data: JSON.stringify({ |
| | | // func: 'zsn_app_bddmsdealersm_add_upt', |
| | | // userid: '', |
| | | // ...param |
| | | // }) |
| | | // }).then(res => { |
| | | // if (res.status && list.length > 0) { |
| | | // this.handleItem(list) |
| | | // } else { |
| | | // console.log(list) |
| | | // } |
| | | // }) |
| | | // } |
| | | |
| | | componentDidMount () { |
| | | // md5("/ws/location/v1/ip?callback=callbackFunction&key=key&output=jsonp secret key") |
| | | // md5("/ws/location/v1/ip?callback=callbackFunction&key=BA7BZ-4QB65-LFCIA-QPDA6-4G6O7-MJB4Q&output=jsonpuThL4ZM3XOj642ksEQh76tyHFjh4") |
| | | |
| | | // Api.directRequest({ |
| | | // url: 'http://bms.kresstools.cn/saas-mp-open-api/shop/shopStore/getAllStoreList', |
| | | // method: 'get' |
| | | // }).then(res => { |
| | | // if (res && res.code === 0 && res.data && res.data.length > 0) { |
| | | // this.handleItem(res.data) |
| | | // } |
| | | // }) |
| | | setTimeout(() => { |
| | | Api.delCacheConfig() |
| | | }, 50) |