gunter-kgd 1.0.0 → 1.0.2

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.
@@ -0,0 +1,263 @@
1
+ <!--表格td-->
2
+ <template>
3
+ <div>
4
+ <!--fontWeight:((td_data.level ==1 && th.shrink && !th.weight)||th.value==$t('task.detail.number')) ?'bold':'normal'-->
5
+ <div
6
+ ref="cells"
7
+ class="cell detail_click"
8
+ @click.stop="to_edit($refs.cells,td_data)"
9
+ :style="{
10
+ width:th.width ? th.width+'px' : '80px',
11
+ padding:th.shrink ? '0 18px' : '0 10px',
12
+ paddingLeft:th.shrink ? (td_data.level + 1)*18+'px' : null}">
13
+ <span :style="{color:td_data.color ? td_data.color[key_value] : null}" class="cell-value">
14
+ <span class="trigger" @click.stop="opens()" v-if="th.shrink && td_data.children">
15
+ <span v-show="td_data.children" style="cursor: pointer;"
16
+ >
17
+ <span style="display: inline-block"
18
+ :style="{transform: !td_data.open ? 'rotateZ(-90deg)' : null}"
19
+ class="open-icon"></span>
20
+ </span>
21
+ <!--<span v-show="td_data.showLoading" class="el-icon-loading"></span>-->
22
+ </span>
23
+ <span v-if="td_data.level >= 1 && th.shrink && !td_data.children" class="spot"></span>
24
+ <span v-if="th.format">{{myPublic.dateFormat.format(td_data.params[key_value],th.format)}}</span>
25
+ <span v-else v-html="td_data.params[key_value]"></span>
26
+ </span>
27
+ </div>
28
+ <input class="gante_edit_input_liu" @click="change_calendar($refs.cells,td_data.params[key_value])"
29
+ :readonly="th.chooseTime" ref="gante_input" v-if="edit" @blur="td_blur(td_data.gunter_id)" type="text"
30
+ :value="td_data.params[key_value]">
31
+ </div>
32
+ </template>
33
+ <script>
34
+ import commitEmit from './commit'
35
+ import myPublic from '../../utils/public';
36
+
37
+ export default {
38
+ data() {
39
+ return {
40
+ myPublic,
41
+ edit: false,
42
+ showLoading: false,//控制显示加载图标
43
+ }
44
+ },
45
+ props: {
46
+ td_data: Object,
47
+ th: Object,
48
+ index: Number,
49
+ key_value: String,
50
+ is_load_child: Boolean
51
+ },
52
+ methods: {
53
+ // 获取元素距离浏览器的距离
54
+ getPos(ele) {
55
+ var p = ele.offsetParent;
56
+ var left = ele.offsetLeft;
57
+ var top = ele.offsetTop
58
+ while (p) {
59
+ if (window.navigator.userAgent.indexOf("MSIE 8") > -1) {
60
+ left += p.offsetLeft;
61
+ top += p.offsetTop;
62
+ } else {
63
+ left += p.offsetLeft + p.clientLeft;
64
+ top += p.offsetTop + p.clientTop;
65
+ }
66
+ p = p.offsetParent;
67
+ }
68
+ var obj = {};
69
+ obj.x = left;
70
+ obj.y = top;
71
+ return obj;
72
+ },
73
+ // 编辑任务
74
+ to_edit(e, value) {
75
+ console.log('this.th_data', this.td_data)
76
+ if (this.th.edit || this.th.chooseTime) {
77
+ this.edit = true
78
+ if (this.th.chooseTime) {
79
+ var time = '',
80
+ left = this.getPos(e.parentNode.parentNode).x,
81
+ top = this.getPos(e.parentNode.parentNode).y + 44,
82
+ gante_table_box = document.getElementsByClassName('gante-table-box')[0],
83
+ ganteview = document.getElementsByClassName('ganteview')[0]
84
+ if (value.params[this.key_value] == '' || value.params[this.key_value] == null) {
85
+ time = new Date()
86
+ } else {
87
+ if (!Number(value.params[this.key_value])) {
88
+ time = new Date(value.params[this.key_value].replace(/\-/g, '/'))
89
+ } else {
90
+ time = Number(value.params[this.key_value])
91
+ }
92
+ }
93
+ if (gante_table_box.scrollLeft) {
94
+ left = left - gante_table_box.scrollLeft
95
+ }
96
+ if (ganteview.scrollTop) {
97
+ top = top - ganteview.scrollTop
98
+ }
99
+ commitEmit.$emit('change-calendar', {
100
+ show_calendar: true,
101
+ change_value: {
102
+ id: value.gunter_id,
103
+ argument: [
104
+ {argument: this.key_value},
105
+ {argument: this.th.time_mode == 1 ? 'start_time' : 'end_time', mode: true}
106
+ ]
107
+ },
108
+ changeDate: time,
109
+ calendar_left: left,
110
+ calendar_top: top
111
+ })
112
+ } else {
113
+ commitEmit.$emit('change-calendar', {show_calendar: false})
114
+ }
115
+ this.$nextTick(function () {
116
+ this.$refs.gante_input.focus()
117
+ })
118
+ } else {
119
+ commitEmit.$emit('change-calendar', {show_calendar: false})
120
+ }
121
+
122
+ if (this.th.listen_click) {
123
+ commitEmit.$emit('on-click', {
124
+ argument: this.key_value,
125
+ value: this.td_data.params[this.key_value],
126
+ data: JSON.parse(JSON.stringify(this.td_data))
127
+ })
128
+ }
129
+ },
130
+ // 点击input时事件
131
+ change_calendar(e) {
132
+ if (this.th.chooseTime) {
133
+ commitEmit.$emit('change-calendar', {
134
+ show_calendar: true,
135
+ calendar_left: this.getPos(e.parentNode.parentNode).x,
136
+ calendar_top: this.getPos(e.parentNode.parentNode).y + 44
137
+ })
138
+ }
139
+ },
140
+ td_blur(id) {
141
+ // 判断有没有修改值
142
+ if (this.$refs.gante_input.value != this.td_data.params[this.key_value]) {
143
+ commitEmit.$emit('change', {
144
+ change_value: {
145
+ id: id,
146
+ value: [{argument: this.key_value, value: this.$refs.gante_input.value}]
147
+ }
148
+ })
149
+ }
150
+ this.edit = false
151
+ },
152
+ // 展开收缩任务
153
+ opens() {
154
+ //展开
155
+ this.$set(this.td_data, 'open', !this.td_data.open);
156
+ }
157
+ }
158
+ }
159
+ </script>
160
+ <style>
161
+ .project_op_drop{
162
+ min-width: 105px!important;
163
+ padding: 10px!important;
164
+ box-sizing: border-box!important;
165
+ text-align: center!important;
166
+ }
167
+ .project_op_drop .el-dropdown-menu__item{
168
+ border-radius: 4px!important;
169
+ }
170
+ .project_op_drop .el-dropdown-menu__item:hover{
171
+ background: #eee!important;
172
+ color: #666!important;
173
+ }
174
+ .gj-en .el-dropdown-menu__item{
175
+ letter-spacing: normal!important;
176
+ }
177
+ </style>
178
+ <style lang="less">
179
+ .gante_edit_input_liu {
180
+ position: absolute;
181
+ left: 0;
182
+ top: 0;
183
+ width: 100%;
184
+ height: 100%;
185
+ box-sizing: border-box;
186
+ border: 1px solid #00b0ff;
187
+ padding: 0 5px;
188
+ font-size: 14px;
189
+ z-index: 1000;
190
+ }
191
+
192
+ .cell-value {
193
+ position: relative;
194
+ width: calc(100% - 5px);
195
+ line-height: 40px;
196
+ cursor: default;
197
+ display: inline-block;
198
+ height: 40px;
199
+ box-sizing: border-box;
200
+ .op-one{
201
+ height: 20px;
202
+ }
203
+ }
204
+
205
+ .cell{
206
+ .add-op{
207
+ position: absolute;
208
+ display: none;
209
+ right: 0;
210
+ top: 0;
211
+ background: rgba(246, 246, 246);
212
+ padding-right: 10px;
213
+ cursor: pointer;
214
+ span{
215
+ font-weight: bold;
216
+ }
217
+ &:hover{
218
+ color: #3396fb;
219
+ }
220
+ }
221
+ .trigger {
222
+ position: absolute;
223
+ left: -14px;
224
+ width: 10px;
225
+ line-height: 40px;
226
+ text-indent: 0;
227
+ margin-right: 2px;
228
+ cursor: pointer;
229
+ .open-icon {
230
+ transform: rotate(0);
231
+ transition: transform .1s ease, color .1s ease;
232
+ color: #bfbfbf;
233
+ &:after{
234
+ display: block;
235
+ content: "";
236
+ width: 0;
237
+ height: 0;
238
+ border-top: 5px solid #bfbfbf;
239
+ border-right: 5px solid transparent;
240
+ border-left: 5px solid transparent;
241
+ }
242
+ }
243
+ &:hover .open-icon{
244
+ color: #999;
245
+ }
246
+ }
247
+ .spot{
248
+ width: 4px;
249
+ height: 4px;
250
+ position: absolute;
251
+ left: -10px;
252
+ top: 50%;
253
+ margin-top: -2px;
254
+ border-radius: 50%;
255
+ background: #3396fb;
256
+ }
257
+ }
258
+ .gj_hover_class{
259
+ .add-op{
260
+ display: block;
261
+ }
262
+ }
263
+ </style>
@@ -0,0 +1,159 @@
1
+ <!--表格tr-->
2
+ <template>
3
+ <div class="gante-tr-box">
4
+ <!--为了设置母子显示线 gante-cell_after gante-cell_after_first gante-cell_after_last-->
5
+ <div class="gante-tr-one"
6
+ :key="index"
7
+ v-for="(tr,index) in data">
8
+ <!--普通表格-->
9
+ <div class="gante-tr" :class="{gj_hover_class: tr.is_hover}" @mouseenter="enterTr($event,tr)"
10
+ @mouseleave="leaveTr($event,tr)" >
11
+ <div class="gante-td" v-show="th.show != false" v-for="(th,key) in th_data"
12
+ :style="{textAlign:th.value == '编号'?'center':'null'}">
13
+ <td-cell :td_data="tr" :index="index" :key_value="key"
14
+ :th="th"></td-cell>
15
+ </div>
16
+ </div>
17
+ <gante-tr v-if="tr.children && tr.open" :parent_data="tr"
18
+ :all_data="all_data"
19
+ :data="tr.children" :th_data="th_data"></gante-tr>
20
+ </div>
21
+ </div>
22
+ </template>
23
+ <script>
24
+ import tdCell from './gante-table-td.vue'
25
+
26
+ export default {
27
+ name: 'gante-tr',
28
+ props: {
29
+ all_data: Array,
30
+ data: Array,
31
+ th_data: Object,
32
+ // 父级数据
33
+ parent_data: {
34
+ type: Object,
35
+ default: null
36
+ }
37
+ },
38
+ components: {
39
+ tdCell
40
+ },
41
+ methods: {
42
+ opens(data) {
43
+ this.$set(data, 'open', !data.open)
44
+ },
45
+ // 进入到了tr上
46
+ enterTr(ev, tr) {
47
+ this.$set(tr, 'is_hover', true)
48
+ },
49
+ // 离开了tr
50
+ leaveTr(ev, tr) {
51
+ this.$set(tr, 'is_hover', false)
52
+ },
53
+ }
54
+ }
55
+ </script>
56
+ <style lang="less">
57
+ .gante-tr-box {
58
+ width: max-content;
59
+
60
+ .add_task, .seeMore {
61
+ color: #3396fb;
62
+ cursor: pointer;
63
+ display: flex;
64
+ align-items: center;
65
+ height: 40px;
66
+ line-height: 40px;
67
+ border-bottom: 1px solid #ebeef5;
68
+
69
+ &:hover {
70
+ opacity: 0.8;
71
+ }
72
+ }
73
+ }
74
+
75
+ .gante-tr-one {
76
+ .gante-tr.gj_hover_class {
77
+ background: rgba(246, 246, 246, 0.7);
78
+ }
79
+
80
+ .gante-group-text {
81
+ box-sizing: border-box;
82
+ text-overflow: ellipsis;
83
+ vertical-align: middle;
84
+ white-space: nowrap;
85
+ border-bottom: 1px solid #ebeef5;
86
+ border-right: 1px solid #ebeef5;
87
+ line-height: 40px;
88
+ padding: 0 10px;
89
+ color: #333;
90
+ width: 100%;
91
+ font-weight: bold;
92
+ .trigger{
93
+ position: absolute;
94
+ left: 5px;
95
+ width: 10px;
96
+ cursor: pointer;
97
+ .open-icon {
98
+ font-size: 12px;
99
+ color: #bfbfbf;
100
+ cursor: pointer;
101
+ }
102
+ &:hover .open-icon{
103
+ color: #999;
104
+ }
105
+ }
106
+
107
+ }
108
+
109
+ &.gante-cell_after {
110
+ position: relative;
111
+
112
+ &:after {
113
+ position: absolute;
114
+ content: '';
115
+ top: 25px;
116
+ left: calc(8px + var(--leftAfter));
117
+ border-left: 1px dashed #0fb7a6;
118
+ height: calc(100% - 45px);
119
+ }
120
+
121
+ .gante-tr {
122
+ position: relative;
123
+
124
+ &:after {
125
+ position: absolute;
126
+ content: '';
127
+ top: 20px;
128
+ left: calc(var(--leftAfter) - 10px);
129
+ border-top: 1px dashed #0fb7a6;
130
+ width: 15px;
131
+ height: 1px;
132
+ }
133
+
134
+ &.gante_tr_only:after {
135
+ left: 40px;
136
+ width: calc(var(--leftAfter) - 36px);
137
+ }
138
+ }
139
+ }
140
+
141
+ &.gante-cell_after_last {
142
+ position: relative;
143
+
144
+ &:before {
145
+ position: absolute;
146
+ content: '';
147
+ top: 20px;
148
+ left: calc(-10px + var(--leftAfter));
149
+ border-left: 1px solid #fff;
150
+ height: calc(100% - 40px);
151
+ z-index: 1;
152
+ }
153
+ }
154
+
155
+ &.gante-cell_after_first > .gante-tr:after {
156
+ display: none;
157
+ }
158
+ }
159
+ </style>