#
zjj
2024-04-07 e6a02c8b09a796e436a501e9b87d19e25c34c9d1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<template>
    <view>
        <view class="status_bar">
            <!-- 这里是状态栏 -->
        </view>
        <uni-nav-bar left-icon="left" title="创建日行程" @clickLeft="back" @clickRight="scan"  :fixed="true"
            :border="false" rightWidth="160rpx" leftWidth="160rpx"
            >
            
         </uni-nav-bar>
         
         <view class="card">
             <view class="box">
                 <view class="box-single-row flex-row">
                     <view style="flex: 1;">星期</view>
                     <view style="flex: 4;">
                        {{list.weeklyDay$}}
                    </view>
                 </view>
                <view class="box-single-row flex-row">
                    <view style="flex: 1;">日期</view>
                    <view style="flex: 4;">
                        {{list.dailyTime$}}
                    </view>
                </view>
                <view class="box-single-row flex-row">
                    <view style="flex: 1;">工作内容</view>
                    <view style="flex: 4;">
                        <input class="inputCss" type="text"  v-model="workContent">
                    </view>
                </view>
                <view class="box-single-row flex-row">
                    <view style="flex: 1;">工作目的</view>
                    <view style="flex: 4;">
                        <input class="inputCss" type="text" v-model="workPurpose">
                    </view>
                </view>
                <view class="box-single-row flex-row">
                    <view style="flex: 1;">需协助事项</view>
                    <view style="flex: 3;">
                        <input class="inputCss" type="text" v-model="weeklyMatter">
                    </view>
                </view>
                <view class="box-single-row flex-row">
                    <view style="flex: 1;">甲方单位</view>
                    <view style="flex: 4;">
                        <uni-combox :border="false" class="inputCss" style="border-radius: 0;"  :candidates="companys"  v-model="company" @input=""></uni-combox>
                    </view>
                </view>
             </view>
         </view>
         
         <!-- <view class="main-box">
             <view class="box">
                 <view class="box-title">流程动态</view>
                 <u-steps :current="current" direction="column">
                     <u-steps-item :title="`${item.title} ${item.time ? item.time : ''}`" :desc="item.msg" v-for="item in steps" />
                 </u-steps>
             </view>
         </view> -->
         <view class="floor">
             <!-- <view class="wran" @click="del()">删除</view> -->
             <view class="default" @click="reset()">重置</view>
             <view class="primary" @click="submit()">提交</view>
         </view>
         <view>
             <!-- 提示信息弹窗 -->
             <uni-popup ref="message" type="message">
                 <uni-popup-message :type="msgType1" :message="messageText" :duration="2000"></uni-popup-message>
             </uni-popup>
         </view>
    </view>    
</template>
 
<script>
    export default {
        data(){
            return{
                list: [],
                listRule: [{
                        label: "星期",
                        attribute: "weeklyDay$",
                    },
                    {
                        label: "日期",
                        attribute: "dailyTime$",
                    },
                    {
                        label: "工作内容",
                        attribute: "workContent",
                    },
                    {
                        label: "工作目的",
                        attribute: "workPurpose",
                    },
                    {
                        label: "评论",
                        attribute: "comment",
                    },
                    {
                        label: "需协助事项",
                        attribute: "province",
                    },
                
                    {
                        label: "甲方单位",
                        attribute: "cstmrId$",
                    },                    
                    {
                        label: "备注",
                        attribute: "memo",
                    },
                    {
                        label: "更新时间",
                        attribute: "updateTime$",
                    },
                ],
                current:0,
                steps:[],
                workContent:'',
                workPurpose:'',
                weeklyMatter:'',
                companys:[],
                company:'',
                messageText:'',
                msgType1: 'success',
            }
        },
        onLoad(option) {
            let _this = this
            _this.list = []
            const eventChannel = this.getOpenerEventChannel();
            eventChannel.on('dayStrokeCreate', function(data) {
                _this.list = data.data
                uni.request({
                    url: `${_this.baseUrl}/cstmr/all/get/kv`,
                    // method: 'POST',
                    header: { 'token': uni.getStorageSync('token') },                    
                    success(res) {
                        console.log(res)
                        res = res.data.data
                        for (var i = 0,keys = Object.keys(res); i< keys.length; i++){
                          console.log(res[keys[i]].name);
                          _this.companys.push(res[keys[i]].name);
                        }
                        //
                        
                        
                    }
                })
            })
            
        },
        methods:{
            submit(){
                let that = this
                let params = []
                let param = {
                    weeklyDay: that.list.weeklyDay,
                    dailyTime: that.list.dailyTime,
                    workContent: that.workContent,
                    workPurpose: that.workPurpose,
                    weeklyMatter: that.weeklyMatter,
                    cstmrName: that.company
                }
                params.push(param)
                uni.request({
                    url: `${that.baseUrl}/weekly/from/add/phone/auth`,
                    method: 'POST',
                    header: { 'token': uni.getStorageSync('token') },
                    data:JSON.stringify({
                        weeklyId: that.list.weeklyId,
                        weeklyType: that.list.weeklyType,
                        weeklyDailyRealityList: params
                    }),
                    success(res) {
                        console.log(res)
                        res = res.data
                        if (res.code === 200 ) {
                            that.reset();
                            that.messageText = "创建成功"
                            that.messageToggle('success')
                            // that.save()
                        } else if (res.code == 403) {
                            uni.showToast({title: res.msg, icon: "none", position: 'top'})
                            setTimeout(() => {
                                uni.reLaunch({
                                    url: '../login/login'
                                });
                            }, 1000);
                        } else {
                            uni.showToast({title: res.msg, icon: "none",position: 'top'})
                        }
                        }
                        //
                        
                        
                    })
                
            },
            messageToggle(type) {
                this.msgType1 = type
                this.$refs.message.open()
            },
            reset(){
                let that = this
                that.workContent = ''
                that.workPurpose = ''
                that.weeklyMatter = ''
                that.company = ''
            },
            back() {
                uni.navigateBack({})
            },
            scan() {
                uni.navigateTo({
                    url: '/pages/authority/authority'
                })
            },
        }
    }
    
</script>
 
<style>
    .status_bar {
        height: var(--status-bar-height);
        width: 100%;
        background-color: #FFF;
        position: sticky;
        top: 0;
    }
    .card{
        border-radius: 20rpx;
    }
    .box {
        margin: 16rpx 8rpx;
        /* height: 200px; */
        box-shadow: 0 0 5px #dddddd;
        background-color: #FFF;
        padding: 16rpx 32rpx;
        position: relative;
        border-radius: 20rpx;
        font-size: 24rpx;
        /* color: #bdbdbd; */
    }
    .box-single-row {
        margin-bottom: 20rpx;
        display: flex;
    }
    .inputCss{
        border-bottom: 1px #a5a5a5 solid;
    }
    .floor {
        height: 100rpx;
        line-height: 100rpx;
        width: 100%;
        background-color: #fff;
        position: fixed;
        bottom: 0;
        left: 0;
        display: flex;
        align-items: center;
        text-align: center;
        letter-spacing: 10rpx;
    }
    .default {
        flex: 2;
    }
    .default:active {
        background-color: #eff0f1;
    }
    .primary {
        flex: 3;
        background-color: #2d8cf0;
        color: #fff;
    }
    .primary:active {
        background-color: #007dea;
    }
</style>