n20-common-lib 1.3.113 → 1.3.115

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "n20-common-lib",
3
- "version": "1.3.113",
3
+ "version": "1.3.115",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
7
7
  "serve": "vue-cli-service serve",
8
8
  "serve:theme": "vue-cli-service serve --testTheme",
9
9
  "test": "vue-cli-service serve --test",
10
- "build": "node versionInfo.js && vue-cli-service build --testTheme",
10
+ "build": "node versionInfo.js && npm run build:css && vue-cli-service build --testTheme",
11
11
  "lint": "vue-cli-service lint",
12
12
  "info": "node versionInfo.js",
13
13
  "build:Jenkins_1": "vue-cli-service build --serverConfig ./server-config-jenkins.jsonc",
@@ -29,6 +29,39 @@
29
29
  border-color: none;
30
30
  }
31
31
  }
32
+ .n20-date-select-busi {
33
+ display: inline-block;
34
+ width: 305px;
35
+ border: 1px solid var(--border-color-base);
36
+ border-radius: var(--border-radius-base);
37
+
38
+ .el-select .el-input__inner {
39
+ border: none;
40
+ border-radius: 4px 0 0 4px;
41
+ }
42
+
43
+ .el-select .el-input__inner:active,
44
+ .el-select .el-input__inner:hover,
45
+ .el-select .el-input__inner:focus {
46
+ box-shadow: none;
47
+ border-color: none;
48
+ }
49
+ .el-date-editor .el-input__inner {
50
+ // border-left: none;
51
+ border-top: none;
52
+ border-right: none;
53
+ border-bottom: none;
54
+ border-radius: 0 4px 4px 0;
55
+ }
56
+ .el-date-editor .el-input__inner:active,
57
+ .el-date-editor .el-input__inner:hover,
58
+ .el-date-editor .el-input__inner:focus {
59
+ box-shadow: none;
60
+ border-color: none;
61
+ }
62
+ }
63
+ .n20-date-select-busi:hover,
64
+ .n20-date-select-busi:focus,
32
65
  .n20-date-select:hover,
33
66
  .n20-date-select:focus {
34
67
  border-color: var(--color-primary);
@@ -0,0 +1,163 @@
1
+ <template>
2
+ <div class="flex-box flex-v">
3
+ <div class="n20-date-select-busi">
4
+ <el-select v-model="type" placeholder="请选择" style="width: 85px">
5
+ <el-option label="期望日" :value="1" />
6
+ <el-option label="提交日" :value="2" />
7
+ <el-option label="发起日" :value="3" />
8
+ </el-select>
9
+ <el-date-picker
10
+ v-model="startDate"
11
+ format="yyyy-MM-dd"
12
+ value-format="yyyy-MM-dd"
13
+ type="date"
14
+ placeholder="选择日"
15
+ @change="changeDate"
16
+ />
17
+ </div>
18
+ <el-radio-group v-model="tl" class="m-l-ss" @change="handleRadio">
19
+ <el-radio :label="1">当前日</el-radio>
20
+ <el-radio :label="2">前溯</el-radio>
21
+ <el-radio :label="3">后延</el-radio>
22
+ </el-radio-group>
23
+ <el-input-number
24
+ v-model="num"
25
+ :disabled="tl === 1"
26
+ class="m-l-ss"
27
+ controls-position="right"
28
+ :min="0"
29
+ @change="handleChange"
30
+ />
31
+ </div>
32
+ </template>
33
+
34
+ <script>
35
+ import dayjs from 'dayjs'
36
+ export default {
37
+ name: 'BusiDatePicker',
38
+ props: {
39
+ mapKey: {
40
+ type: Object,
41
+ default: () => {
42
+ return {
43
+ type: 'type',
44
+ startDate: 'startDate',
45
+ tl: 'tl',
46
+ num: 'num',
47
+ endDate: 'endDate'
48
+ }
49
+ }
50
+ },
51
+ fromList: {
52
+ type: Object,
53
+ default: () => {
54
+ return {
55
+ type: 1,
56
+ startDate: '',
57
+ tl: 1,
58
+ num: 0,
59
+ endDate: ''
60
+ }
61
+ }
62
+ }
63
+ },
64
+ data() {
65
+ return {
66
+ type: 1,
67
+ startDate: '',
68
+ tl: 1,
69
+ num: 0
70
+ }
71
+ },
72
+ mounted() {
73
+ this.type = this.fromList[this.mapKey.type]
74
+ this.startDate = this.fromList[this.mapKey.startDate]
75
+ this.tl = this.fromList[this.mapKey.tl]
76
+ this.num = this.fromList[this.mapKey.num]
77
+ },
78
+ methods: {
79
+ handleRadio(val) {
80
+ if (val === 1 && this.startDate) {
81
+ this.num = 0
82
+ let param = {
83
+ [this.mapKey.type]: this.type,
84
+ [this.mapKey.startDate]: this.startDate,
85
+ [this.mapKey.tl]: this.tl,
86
+ [this.mapKey.num]: 0,
87
+ [this.mapKey.endDate]: this.startDate
88
+ }
89
+ this.startDate && this.$emit('change', param)
90
+ } else if (val === 2 && this.num && this.startDate) {
91
+ let param = {
92
+ [this.mapKey.type]: this.type,
93
+ [this.mapKey.startDate]: dayjs(this.startDate).subtract(this.num, 'day').format('YYYY-MM-DD'),
94
+ [this.mapKey.tl]: this.tl,
95
+ [this.mapKey.num]: this.num,
96
+ [this.mapKey.endDate]: this.startDate
97
+ }
98
+ this.startDate && this.$emit('change', param)
99
+ } else if (val === 3 && this.num && this.startDate) {
100
+ let param = {
101
+ [this.mapKey.type]: this.type,
102
+ [this.mapKey.startDate]: dayjs(this.startDate).add(this.num, 'day').format('YYYY-MM-DD'),
103
+ [this.mapKey.tl]: this.tl,
104
+ [this.mapKey.num]: this.num,
105
+ [this.mapKey.endDate]: this.startDate
106
+ }
107
+ this.$emit('change', param)
108
+ }
109
+ },
110
+ changeDate(val) {
111
+ if (this.tl === 1 && val && this.num ) {
112
+ let param = {
113
+ [this.mapKey.type]: this.type,
114
+ [this.mapKey.startDate]: val,
115
+ [this.mapKey.tl]: this.tl,
116
+ [this.mapKey.num]: this.num,
117
+ [this.mapKey.endDate]: val
118
+ }
119
+ this.$emit('change', param)
120
+ } else if (this.tl === 2 && this.num && val) {
121
+ let param = {
122
+ [this.mapKey.type]: this.type,
123
+ [this.mapKey.startDate]: dayjs(this.startDate).subtract(this.num, 'day').format('YYYY-MM-DD'),
124
+ [this.mapKey.tl]: this.tl,
125
+ [this.mapKey.num]: this.num,
126
+ [this.mapKey.endDate]: this.startDate
127
+ }
128
+ this.$emit('change', param)
129
+ } else if (this.tl === 3 && this.num && val) {
130
+ let param = {
131
+ [this.mapKey.type]: this.type,
132
+ [this.mapKey.startDate]: dayjs(this.startDate).add(this.num, 'day').format('YYYY-MM-DD'),
133
+ [this.mapKey.tl]: this.tl,
134
+ [this.mapKey.num]: this.num,
135
+ [this.mapKey.endDate]: this.startDate
136
+ }
137
+ this.$emit('change', param)
138
+ }
139
+ },
140
+ handleChange(val) {
141
+ if (this.tl === 2 &&val && this.startDate) {
142
+ let param = {
143
+ [this.mapKey.type]: this.type,
144
+ [this.mapKey.startDate]: dayjs(this.startDate).subtract(val, 'day').format('YYYY-MM-DD'),
145
+ [this.mapKey.tl]: this.tl,
146
+ [this.mapKey.num]: this.num,
147
+ [this.mapKey.endDate]: this.startDate
148
+ }
149
+ this.$emit('change', param)
150
+ } else if (this.tl === 3 &&val && this.startDate) {
151
+ let param = {
152
+ [this.mapKey.type]: this.type,
153
+ [this.mapKey.startDate]: this.startDate,
154
+ [this.mapKey.tl]: this.tl,
155
+ [this.mapKey.num]: this.num,
156
+ [this.mapKey.endDate]: dayjs(this.startDate).add(val, 'day').format('YYYY-MM-DD')
157
+ }
158
+ this.$emit('change', param)
159
+ }
160
+ }
161
+ }
162
+ }
163
+ </script>
@@ -83,11 +83,30 @@ export default {
83
83
  set(v) {
84
84
  this.$emit('update:selectType', v)
85
85
  },
86
- get(v) {
86
+ get() {
87
87
  return this.selectType
88
88
  }
89
89
  }
90
90
  },
91
+ mounted() {
92
+ switch (this.selectType) {
93
+ case 1:
94
+ this.day = this.value
95
+ break
96
+ case 2:
97
+ this.week = this.value
98
+ break
99
+ case 3:
100
+ this.month = this.value
101
+ break
102
+ case 4:
103
+ this.quarter = this.value
104
+ break
105
+ case 5:
106
+ this.year = this.value
107
+ break
108
+ }
109
+ },
91
110
  methods: {
92
111
  dateTypeSelectChange(val) {
93
112
  this.$emit('update:selectType', val)
@@ -95,6 +114,7 @@ export default {
95
114
  this.week = ''
96
115
  this.month = ''
97
116
  this.year = ''
117
+ this.quarter = ''
98
118
  this.$emit('selectChange', val)
99
119
  },
100
120
 
@@ -134,7 +154,7 @@ export default {
134
154
  this.$emit('input', val)
135
155
  this.$emit('change', val)
136
156
  },
137
- handleChange(val) {
157
+ handleChange(val, val2) {
138
158
  this.$emit('input', val)
139
159
  this.$emit('change', val)
140
160
  }
@@ -69,12 +69,19 @@
69
69
  </template>
70
70
 
71
71
  <script>
72
+ import quarter from 'dayjs/plugin/quarterOfYear'
73
+ import dayjs from 'dayjs'
74
+ dayjs.extend(quarter)
72
75
  export default {
73
76
  name: 'QuarterDatePicker',
74
77
  props: {
78
+ value: {
79
+ type: String,
80
+ default: ''
81
+ },
75
82
  valueArr: {
76
83
  default: () => {
77
- return ['01-03', '04-06', '07-09', '10-12']
84
+ return ['01-01 - 03-31', '04-01 - 06-30', '07-01 - 09-30', '10-01 - 12-31']
78
85
  },
79
86
  type: Array
80
87
  },
@@ -97,11 +104,12 @@ export default {
97
104
  year: new Date().getFullYear(), // input显示时间,会随着用户操作改变
98
105
  defaultyear: new Date().getFullYear(), // 当前年份,不变
99
106
  month: new Date().getMonth() + 1, // 当前月份,不变
100
- showValue: '',
107
+ // showValue: '',
101
108
  isQuarter: true, // 默认展示季度
102
109
  beforeyear: null // 默认显示上一季度所用时间,可能是去年
103
110
  }
104
111
  },
112
+
105
113
  computed: {
106
114
  getYear() {
107
115
  let nfOptionsArray = []
@@ -109,6 +117,19 @@ export default {
109
117
  nfOptionsArray.push(i)
110
118
  }
111
119
  return nfOptionsArray
120
+ },
121
+ showValue: {
122
+ set(v) {
123
+ this.$emit('input', v)
124
+ },
125
+ get() {
126
+ if (this.value) {
127
+ let list = this.value.split(' - ')
128
+ return `${dayjs(list[0]).year()} 年 ${dayjs(list[0]).quarter()} 季度`
129
+ } else {
130
+ return this.value
131
+ }
132
+ }
112
133
  }
113
134
  },
114
135
  mounted() {
@@ -136,37 +157,12 @@ export default {
136
157
  selectSeason(i) {
137
158
  let that = this
138
159
  that.season = i + 1
139
- let arr = that.valueArr[i].split('-')
160
+ let arr = that.valueArr[i].split(' - ')
140
161
  that.showSeason = false
141
162
  this.showValue = `${this.year} 年 ${this.season} 季度`
142
163
  that.$emit('input', this.year + '-' + arr[0] + ' - ' + this.year + '-' + arr[1])
143
- that.$emit('change', this.year + '-' + arr[0] + ' - ' + this.year + '-' + arr[1], this.year - this.season) // 每次选择时间都将当前选择时间发送到父组件
164
+ that.$emit('change', this.year + '-' + arr[0] + ' - ' + this.year + '-' + arr[1]) // 每次选择时间都将当前选择时间发送到父组件
144
165
  }
145
- // getDefaultTime() {
146
- // // 获取默认的上一个季度
147
- // var year = this.defaultyear
148
- // var month = this.month
149
- // var season = null
150
- // if (month <= 3) {
151
- // this.season = 1
152
- // year -= 1
153
- // season = 4
154
- // this.beforeyear = year
155
- // } else if (month > 3 && month <= 6) {
156
- // this.season = 2
157
- // season = 1
158
- // this.beforeyear = year
159
- // } else if (month > 6 && month <= 9) {
160
- // this.season = 3
161
- // season = 2
162
- // this.beforeyear = year
163
- // } else if (month > 9 && month <= 12) {
164
- // this.season = 4
165
- // season = 3
166
- // this.beforeyear = year
167
- // }
168
- // this.showValue = `${year} 年 ${season} 季度`
169
- // }
170
166
  }
171
167
  }
172
168
  </script>
@@ -41,33 +41,44 @@ export function siteTree2menus(siteTree) {
41
41
  return list2tree(list_2, 'menuid', 'pmid', 'children', 'sortnum')
42
42
  }
43
43
 
44
- export function siteTree2RelaNos(siteTree) {
45
- let relaNos = []
46
- siteTree.forEach((m) => {
47
- let oRelaObj = relaNos.find((item) => item.appNo === m.appNo)
48
- if (oRelaObj) {
49
- m.treeno && oRelaObj.relaNos.push(m.treeno)
50
- if (Array.isArray(m.children)) {
51
- forEachs(m.children, (item) => {
52
- item.treeno && oRelaObj.relaNos.push(item.treeno)
53
- })
54
- }
44
+ function addOno(map, item, appNo) {
45
+ if (map[appNo]) {
46
+ map[appNo].relaNos.push(item.treeno)
47
+ } else {
48
+ map[appNo] = {
49
+ appNo: appNo,
50
+ label: item.label,
51
+ pageurl: item.pageurl,
52
+ relaNos: [item.treeno]
53
+ }
54
+ }
55
+
56
+ if (appNo !== item.appNo) {
57
+ if (map[item.appNo]) {
58
+ map[item.appNo].relaNos.push(item.treeno)
55
59
  } else {
56
- oRelaObj = {
57
- appNo: m.appNo,
58
- label: m.label,
59
- pageurl: m.pageurl,
60
- relaNos: []
60
+ map[item.appNo] = {
61
+ appNo: item.appNo,
62
+ label: item.label,
63
+ pageurl: item.pageurl,
64
+ relaNos: [item.treeno]
61
65
  }
66
+ }
67
+ }
68
+ }
62
69
 
63
- m.treeno && oRelaObj.relaNos.push(m.treeno)
64
- if (Array.isArray(m.children)) {
65
- forEachs(m.children, (item) => {
66
- item.treeno && oRelaObj.relaNos.push(item.treeno)
67
- })
68
- }
69
- relaNos.push(oRelaObj)
70
+ export function siteTree2RelaNos(siteTree) {
71
+ let relaNosMap = {}
72
+ siteTree.forEach((m) => {
73
+ addOno(relaNosMap, m, m.appNo)
74
+ if (Array.isArray(m.children)) {
75
+ forEachs(m.children, (item) => {
76
+ if (item.treeno) {
77
+ addOno(relaNosMap, item, m.appNo)
78
+ }
79
+ })
70
80
  }
71
81
  })
82
+ let relaNos = Object.values(relaNosMap)
72
83
  return relaNos
73
84
  }
package/src/index.js CHANGED
@@ -58,6 +58,7 @@ import Descriptions from './components/Descriptions/index.vue'
58
58
  import EventBubble from './components/EventBubble/index.vue'
59
59
  import SelectDatePicker from './components/DateSelect/index.vue'
60
60
  import QuarterDatePicker from './components/DateSelect/quarterDatePicker.vue'
61
+ import BusiDatePicker from './components/DateSelect/busiDate.vue'
61
62
 
62
63
  // ECharts 不要打包进来
63
64
  import Stamp from './components/Stamp/index.vue'
@@ -161,6 +162,7 @@ const components = [
161
162
  Diff,
162
163
  SelectDatePicker,
163
164
  QuarterDatePicker,
165
+ BusiDatePicker,
164
166
  /* old */
165
167
  TableO,
166
168
  FiltersO,
@@ -282,6 +284,7 @@ export {
282
284
  Diff,
283
285
  SelectDatePicker,
284
286
  QuarterDatePicker,
287
+ BusiDatePicker,
285
288
  /* 中建科 */
286
289
  ApprovalCardZjk,
287
290
  ApproveCardZjk,