Commit 6515b7eb authored by Gavin Peng's avatar Gavin Peng

feat: 送货计划协同详情补充,工具类细分

parent a4b4f6e7
interface StatusStyle {
bgColor: string,
fontColor: string
}
interface StatusStyleItem {
[key: string]: StatusStyle
}
/**
* 状态描述
* - default: 默认
* - toSbumit: 待提交
* - toBeConfirmed: 待确认
* - toBeModified: 待修改
* - confirmed: 已确认
* - generated: 已确认
* - voided: 已确认
*/
enum StatusEnum {
Default = 1,
ToSbumit = 2,
ToBeConfirmed = 3,
ToBeModified = 4,
Confirmed = 5,
Generated = 6,
Voided = 7,
}
class TagStatus {
/**
* 默认的Sytle集合 具体情况,看StatusEnum
*/
#tagStatusColor: StatusStyleItem = {
[StatusEnum.Default]: this.defaultStatusStyle(),
[StatusEnum.ToSbumit]: this.toSbumitStatusStyle(),
[StatusEnum.ToBeConfirmed]: this.toBeConfirmedStyle(),
[StatusEnum.ToBeModified]: this.toBeConfirmedStyle(),
[StatusEnum.Confirmed]: this.confirmedStyle(),
[StatusEnum.Generated]: this.generatedStyle(),
[StatusEnum.Voided]: this.voidedStyle(),
}
defaultStatusStyle() {
return { bgColor: '#f2f4f5', fontColor: '#000' }
}
toSbumitStatusStyle() {
return { bgColor: '#f4f5f7', fontColor: '#5c626a' };
}
toBeConfirmedStyle() {
return { bgColor: '#ecf2fe', fontColor: '#4787f0' };
}
toBeModifiedStyle() {
return { bgColor: '#eae6ff', fontColor: '#9963d8' }
}
confirmedStyle() {
return { bgColor: '#ebf9f6', fontColor: '#00a98f' }
}
generatedStyle() {
return { bgColor: '#f0f5ff', fontColor: '#f0f5ff' }
}
voidedStyle() {
return { bgColor: '#fff2f0', fontColor: '#ff4d4f' }
}
/**
* 设置Style的属性,相同的key会覆盖
* @param status
* @param value
*/
setStyleToCollection(status: string | number, value: StatusStyle) {
this.#tagStatusColor = {
...this.#tagStatusColor,
[status]: value
}
}
/**
* 获取Tag Style属性
* @param status 后台的状态值
* @param value
*/
getTagStyle(status: string | number) {
return this.#tagStatusColor[status] ? this.#tagStatusColor[status] : this.defaultStatusStyle();
}
}
class TagStatusFactory {
static getInstance(){
return new TagStatus();
}
}
export {
TagStatus,
TagStatusFactory
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment