0804
This commit is contained in:
parent
7294adcf94
commit
8281eff236
|
|
@ -101,6 +101,7 @@ const install = (Vue, vm) => {
|
||||||
oplCateItem,
|
oplCateItem,
|
||||||
operationItem,
|
operationItem,
|
||||||
operationCreat,
|
operationCreat,
|
||||||
|
operationUpdate,
|
||||||
operationList,
|
operationList,
|
||||||
oplLists,
|
oplLists,
|
||||||
oplItem,
|
oplItem,
|
||||||
|
|
|
||||||
|
|
@ -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() {
|
||||||
console.log(this.formData)
|
let that = this;
|
||||||
this.formData.start_time = new Date(this.formData.start_time).toISOString();
|
if (!that.paramsCheck()) {
|
||||||
this.formData.end_time = new Date(this.formData.end_time).toISOString();
|
return;
|
||||||
this.$u.api.operationCreat(this.formData).then(res => {
|
} else {
|
||||||
let params = `?operationId=${res.id}`;
|
console.log(this.formData)
|
||||||
uni.navigateTo({
|
if(this.formData.id){
|
||||||
url: '/pages/workSpace/list/oplCate'+params
|
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
|
//获取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位需*1000,时间戳为13位的话不需乘1000
|
|
||||||
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);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue