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,
operationItem,
operationCreat,
operationUpdate,
operationList,
oplLists,
oplItem,

View File

@ -27,9 +27,7 @@
<text class="form-left-text">开始时间</text>
</view>
<view class="form-right form-date">
<picker mode="date" :value="formData.start_time" @change="bindStartDateChange">
<view class="uni-input">{{formData.start_time}}</view>
</picker>
<uni-datetime-picker v-model="formData.start_time" :border="false" />
</view>
</view>
<view class="form-item border-bottom">
@ -38,9 +36,7 @@
<text class="form-left-text">结束时间</text>
</view>
<view class="form-right form-date">
<picker mode="date" :value="formData.end_time" @change="bindEndDateChange">
<view class="uni-input">{{formData.end_time}}</view>
</picker>
<uni-datetime-picker v-model="formData.end_time" :border="false" />
</view>
</view>
<view class="form-item border-bottom">
@ -109,21 +105,18 @@
<script>
var that;
var promise;
import nonNullCheck from '../../../utils/nonNullCheck.js';
export default {
name: "operation",
data() {
const currentDate = this.getDate({
format: true
})
return {
date: currentDate,
formData: {
name: '', //
// state: '', //
place: '', //
start_time: currentDate, //
end_time: currentDate, //
start_time: '', //
end_time: '', //
state_work: '', //
belong_dept: '', //
area: '', //
@ -131,30 +124,20 @@
dept_bus: '', //
coordinator: '', //
},
publishRangeCon: '',
showBtns: false,
//
releaseWeb: [],
createTimeFromShow: false,
createTimeFromList: [],
createTimeFromCon: '',
userRange: [],
//
range: [],
//
stateRange: [{
value: 0,
value: '0',
text: "运行"
},
{
value: 1,
value: '1',
text: "停机"
},
{
value: 2,
value: '2',
text: "检修"
},
],
@ -162,14 +145,6 @@
depRange: [],
}
},
computed: {
startDate() {
return this.getDate('start');
},
endDate() {
return this.getDate('end');
}
},
onLoad(params) {
if(params.operationId){
this.operationId = params.operationId;
@ -193,24 +168,47 @@
methods: {
//operation
getOperation() {
let that = this;
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.end_time = res.end_time; //
that.operationName = res.name; //
console.log(res);
debugger;
});
},
saveSubmit() {
console.log(this.formData)
this.formData.start_time = new Date(this.formData.start_time).toISOString();
this.formData.end_time = new Date(this.formData.end_time).toISOString();
this.$u.api.operationCreat(this.formData).then(res => {
let params = `?operationId=${res.id}`;
uni.navigateTo({
url: '/pages/workSpace/list/oplCate'+params
})
})
let that = this;
if (!that.paramsCheck()) {
return;
} else {
console.log(this.formData)
if(this.formData.id){
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 => {
let params = `?operationId=${res.id}`;
uni.navigateTo({
url: '/pages/workSpace/operation/oplCate'+params
})
})
}
}
},
//dept
getdept() {
@ -249,53 +247,7 @@
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) {
let posts = [];
@ -326,147 +278,79 @@
/* 参数验证 */
paramsCheck() {
var typeArr = [];
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)) {
if (!nonNullCheck(this.formData.name)) {
uni.showToast({
title: '请输入标题',
title: '请填写作业简介',
icon: "none"
})
return false;
}
if (!nonNullCheck(this.formData.itemInfo.applicationDept)) {
if (!nonNullCheck(this.formData.start_time)) {
uni.showToast({
title: '请选择申请部门',
title: '请选择开始时间',
icon: "none"
})
return false;
}
if (!nonNullCheck(this.formData.createTimeTo)) {
if (!nonNullCheck(this.formData.end_time)) {
uni.showToast({
title: '请选择申请日期',
title: '请选择结束时间',
icon: "none"
})
return false;
}
if (!nonNullCheck(this.formData.writer)) {
if (!nonNullCheck(this.formData.state_work)) {
uni.showToast({
title: '请填写撰稿人',
title: '请选择生产状态',
icon: "none"
})
return false;
}
if (!nonNullCheck(this.formData.mailbox)) {
if (!nonNullCheck(this.formData.area)) {
uni.showToast({
title: '请填写联系邮箱',
title: '请选择作业区域',
icon: "none"
})
return false;
}
if (emailRegular.test(this.formData.mailbox) === false) {
if (!nonNullCheck(this.formData.dept_bus)) {
uni.showToast({
title: '联系邮箱格式不对,请重新填写',
title: '请选择业务部门',
icon: "none"
})
return false;
}
if (!nonNullCheck(this.formData.contactNumber)) {
if (!nonNullCheck(this.formData.coordinator)) {
uni.showToast({
title: '请填写联系电话',
title: '请选择部门协调员',
icon: "none"
})
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({
title: '联系电话格式不对,请重新填写',
icon: "none"
})
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;
},
publishChange(e) {
var i = e.detail.value;
that.publishRangeCon = that.publishRange[i].name;
that.formData.scopeOfPublication = that.publishRange[i].id;
},
goBack() {
uni.navigateTo({
url: '/pages/workSpace/visit/visitList'
uni.navigateBack({
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) {
console.log(e);
},

View File

@ -153,8 +153,6 @@
}
},
onLoad(params) {
debugger;
console.log(params)
if (params.visit) {
this.visitId = params.visit;
this.type = params.type;
@ -224,8 +222,6 @@
} else {
debugger;
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 => {
if (res.err_msg) {
@ -237,8 +233,6 @@
}
})
} 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 => {
if (res.err_msg) {