<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>
|