This commit is contained in:
shijing 2022-08-04 11:23:35 +08:00
parent 7294adcf94
commit 8281eff236
3 changed files with 68 additions and 189 deletions

View File

@ -101,6 +101,7 @@ const install = (Vue, vm) => {
oplCateItem, oplCateItem,
operationItem, operationItem,
operationCreat, operationCreat,
operationUpdate,
operationList, operationList,
oplLists, oplLists,
oplItem, oplItem,

View File

@ -27,9 +27,7 @@
<text class="form-left-text">开始时间</text> <text class="form-left-text">开始时间</text>
</view> </view>
<view class="form-right form-date"> <view class="form-right form-date">
<picker mode="date" :value="formData.start_time" @change="bindStartDateChange"> <uni-datetime-picker v-model="formData.start_time" :border="false" />
<view class="uni-input">{{formData.start_time}}</view>
</picker>
</view> </view>
</view> </view>
<view class="form-item border-bottom"> <view class="form-item border-bottom">
@ -38,9 +36,7 @@
<text class="form-left-text">结束时间</text> <text class="form-left-text">结束时间</text>
</view> </view>
<view class="form-right form-date"> <view class="form-right form-date">
<picker mode="date" :value="formData.end_time" @change="bindEndDateChange"> <uni-datetime-picker v-model="formData.end_time" :border="false" />
<view class="uni-input">{{formData.end_time}}</view>
</picker>
</view> </view>
</view> </view>
<view class="form-item border-bottom"> <view class="form-item border-bottom">
@ -109,21 +105,18 @@
<script> <script>
var that; var that;
var promise; import nonNullCheck from '../../../utils/nonNullCheck.js';
export default { export default {
name: "operation", name: "operation",
data() { data() {
const currentDate = this.getDate({
format: true
})
return { return {
date: currentDate,
formData: { formData: {
name: '', // name: '', //
// state: '', // // state: '', //
place: '', // place: '', //
start_time: currentDate, // start_time: '', //
end_time: currentDate, // end_time: '', //
state_work: '', // state_work: '', //
belong_dept: '', // belong_dept: '', //
area: '', // area: '', //
@ -131,30 +124,20 @@
dept_bus: '', // dept_bus: '', //
coordinator: '', // coordinator: '', //
}, },
publishRangeCon: '',
showBtns: false,
//
releaseWeb: [],
createTimeFromShow: false,
createTimeFromList: [],
createTimeFromCon: '',
userRange: [], userRange: [],
// //
range: [], range: [],
// //
stateRange: [{ stateRange: [{
value: 0, value: '0',
text: "运行" text: "运行"
}, },
{ {
value: 1, value: '1',
text: "停机" text: "停机"
}, },
{ {
value: 2, value: '2',
text: "检修" text: "检修"
}, },
], ],
@ -162,14 +145,6 @@
depRange: [], depRange: [],
} }
}, },
computed: {
startDate() {
return this.getDate('start');
},
endDate() {
return this.getDate('end');
}
},
onLoad(params) { onLoad(params) {
if(params.operationId){ if(params.operationId){
this.operationId = params.operationId; this.operationId = params.operationId;
@ -193,24 +168,47 @@
methods: { methods: {
//operation //operation
getOperation() { getOperation() {
let that = this; let that = this;
that.$u.api.operationItem(that.operationId).then((res) => { that.$u.api.operationItem(that.operationId).then((res) => {
that.formData.id = res.id; //
that.formData.name = res.name; //
that.formData.place = res.place; //
that.formData.state_work = res.state_work; //
that.formData.area = res.area; //
that.formData.dept_bus = res.dept_bus; //
that.formData.coordinator = res.coordinator; //
that.formData.dept_ter = res.dept_ter; //
that.formData.start_time = res.start_time; // that.formData.start_time = res.start_time; //
that.formData.end_time = res.end_time; // that.formData.end_time = res.end_time; //
that.operationName = res.name; // that.operationName = res.name; //
console.log(res); console.log(res);
debugger;
}); });
}, },
saveSubmit() { saveSubmit() {
let that = this;
if (!that.paramsCheck()) {
return;
} else {
console.log(this.formData) console.log(this.formData)
this.formData.start_time = new Date(this.formData.start_time).toISOString(); if(this.formData.id){
this.formData.end_time = new Date(this.formData.end_time).toISOString(); this.$u.api.operationUpdate(this.formData.id,this.formData).then(res => {
let params = `?operationId=${res.id}`;
uni.navigateTo({
url: '/pages/workSpace/operation/oplCate'+params
})
})
}else{
this.$u.api.operationCreat(this.formData).then(res => { this.$u.api.operationCreat(this.formData).then(res => {
let params = `?operationId=${res.id}`; let params = `?operationId=${res.id}`;
uni.navigateTo({ uni.navigateTo({
url: '/pages/workSpace/list/oplCate'+params url: '/pages/workSpace/operation/oplCate'+params
}) })
}) })
}
}
}, },
//dept //dept
getdept() { getdept() {
@ -249,53 +247,7 @@
this.userRange = user this.userRange = user
}) })
}, },
getDate(type) {
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (type === 'start') {
year = year - 60;
} else if (type === 'end') {
year = year + 2;
}
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
return `${year}-${month}-${day}`;
},
bindStartDateChange: function(e) {
this.formData.start_time = e.detail.value
},
bindEndDateChange: function(e) {
this.formData.end_time = e.detail.value
},
happenTimeFun(num) { //
let date = new Date(num);
//10*1000131000
let y = date.getFullYear();
let MM = date.getMonth() + 1;
MM = MM < 10 ? ('0' + MM) : MM; //0
let d = date.getDate();
d = d < 10 ? ('0' + d) : d; //0
let h = date.getHours();
h = h < 10 ? ('0' + h) : h; //0
let m = date.getMinutes();
m = m < 10 ? ('0' + m) : m; //0
let s = date.getSeconds();
s = s < 10 ? ('0' + s) : s; //0
//         return y + '-' + MM + '-' + d + ' ' + h + ':' + m+ ':' + s;
return y + '-' + MM + '-' + d;
},
createTimeToFn(e) {
that.formData.createTimeTo = e.year + '-' + e.month + '-' + e.day;
},
createTimeFromYesFn(e) {
console.log(e)
var index = e[0]
that.formData.createTimeFrom = that.createTimeFromList[index].id
that.createTimeFromCon = that.createTimeFromList[index].label
},
redata(postList) { redata(postList) {
let posts = []; let posts = [];
@ -326,147 +278,79 @@
/* 参数验证 */ /* 参数验证 */
paramsCheck() { paramsCheck() {
var typeArr = []; if (!nonNullCheck(this.formData.name)) {
for (let i = 0; i < that.releaseWeb.length; i++) {
if (that.releaseWeb[i].checked == true) {
typeArr.push(that.releaseWeb[i].id)
}
}
that.formData.typeList = typeArr;
if (!nonNullCheck(this.formData.itemInfo.itemName)) {
uni.showToast({ uni.showToast({
title: '请输入标题', title: '请填写作业简介',
icon: "none" icon: "none"
}) })
return false; return false;
} }
if (!nonNullCheck(this.formData.itemInfo.applicationDept)) { if (!nonNullCheck(this.formData.start_time)) {
uni.showToast({ uni.showToast({
title: '请选择申请部门', title: '请选择开始时间',
icon: "none" icon: "none"
}) })
return false; return false;
} }
if (!nonNullCheck(this.formData.createTimeTo)) { if (!nonNullCheck(this.formData.end_time)) {
uni.showToast({ uni.showToast({
title: '请选择申请日期', title: '请选择结束时间',
icon: "none" icon: "none"
}) })
return false; return false;
} }
if (!nonNullCheck(this.formData.writer)) { if (!nonNullCheck(this.formData.state_work)) {
uni.showToast({ uni.showToast({
title: '请填写撰稿人', title: '请选择生产状态',
icon: "none" icon: "none"
}) })
return false; return false;
} }
if (!nonNullCheck(this.formData.mailbox)) { if (!nonNullCheck(this.formData.area)) {
uni.showToast({ uni.showToast({
title: '请填写联系邮箱', title: '请选择作业区域',
icon: "none" icon: "none"
}) })
return false; return false;
} }
if (emailRegular.test(this.formData.mailbox) === false) { if (!nonNullCheck(this.formData.dept_bus)) {
uni.showToast({ uni.showToast({
title: '联系邮箱格式不对,请重新填写', title: '请选择业务部门',
icon: "none" icon: "none"
}) })
return false; return false;
} }
if (!nonNullCheck(this.formData.contactNumber)) { if (!nonNullCheck(this.formData.coordinator)) {
uni.showToast({ uni.showToast({
title: '请填写联系电话', title: '请选择部门协调员',
icon: "none" icon: "none"
}) })
return false; return false;
} }
if (phoneRegular.test(this.formData.contactNumber) === false) { if (!nonNullCheck(this.formData.dept_ter)) {
uni.showToast({
title: '请选择属地部门',
icon: "none"
})
return false;
}
/* if (phoneRegular.test(this.formData.contactNumber) === false) {
uni.showToast({ uni.showToast({
title: '联系电话格式不对,请重新填写', title: '联系电话格式不对,请重新填写',
icon: "none" icon: "none"
}) })
return false; return false;
} } */
if (that.formData.typeList.length == 0) {
uni.showToast({
title: '请选择发布网站',
icon: "none"
})
return false;
}
if (!nonNullCheck(this.formData.createTimeFrom)) {
uni.showToast({
title: '请选择信息有效期',
icon: "none"
})
return false;
}
if (!nonNullCheck(this.formData.releaseColumn)) {
uni.showToast({
title: '请填写发布栏目',
icon: "none"
})
return false;
}
if (!nonNullCheck(this.formData.newsInformation)) {
uni.showToast({
title: '请填写新闻信息',
icon: "none"
})
return false;
}
if (!nonNullCheck(this.formData.reason)) {
uni.showToast({
title: '请填写申请理由',
icon: "none"
})
return false;
}
return true; return true;
}, },
publishChange(e) {
var i = e.detail.value;
that.publishRangeCon = that.publishRange[i].name;
that.formData.scopeOfPublication = that.publishRange[i].id;
},
goBack() { goBack() {
uni.navigateTo({ uni.navigateBack({
url: '/pages/workSpace/visit/visitList' delta: 1
}) })
}, },
onPopupclosed() {
if (this.lsId) {
this.formData.itemInfo.applicationDept = this.lsId;
}
},
depChange(e) {
const idx = e.detail.value;
this.selectedDep = this.depRange[idx].name;
},
tiaoxiuChange(e) {
const idx = e.detail.value;
this.selectedtiaoxiu = this.tiaoxiuRange[idx].name;
this.selectedtiaoxiuId = this.tiaoxiuRange[idx].id;
that.formData.compensatoryLeave = this.tiaoxiuRange[idx].id;
},
typeChange(e) {
const idx = e.detail.value;
this.selectedtype = this.typeRange[idx].label;
this.selectedtypeId = this.typeRange[idx].id;
that.formData.leaveType = this.typeRange[idx].id;
},
onnodeclick(e) { onnodeclick(e) {
console.log(e); console.log(e);
}, },

View File

@ -153,8 +153,6 @@
} }
}, },
onLoad(params) { onLoad(params) {
debugger;
console.log(params)
if (params.visit) { if (params.visit) {
this.visitId = params.visit; this.visitId = params.visit;
this.type = params.type; this.type = params.type;
@ -224,8 +222,6 @@
} else { } else {
debugger; debugger;
if (that.formData.id) { if (that.formData.id) {
that.formData.visit_time = new Date(that.formData.visit_time).toISOString();
that.formData.leave_time = new Date(that.formData.leave_time).toISOString();
that.$u.api.visitUpdate(that.formData.id, that.formData).then(res => { that.$u.api.visitUpdate(that.formData.id, that.formData).then(res => {
if (res.err_msg) { if (res.err_msg) {
@ -237,8 +233,6 @@
} }
}) })
} else { } else {
that.formData.visit_time = new Date(that.formData.visit_time).toISOString();
that.formData.leave_time = new Date(that.formData.leave_time).toISOString();
that.$u.api.visitCreate(that.formData).then(res => { that.$u.api.visitCreate(that.formData).then(res => {
if (res.err_msg) { if (res.err_msg) {