This commit is contained in:
jr719 2021-04-13 00:40:20 +08:00
parent 5c65f0e0fc
commit 3be98d89b3
3 changed files with 252 additions and 254 deletions

View File

@ -73,22 +73,22 @@ const actions = {
// user logout
logout({ commit, state, dispatch }) {
// return new Promise((resolve, reject) => {
// logout(state.token)
// .then(() => {
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
removeToken()
resetRouter()
// logout(state.token)
// .then(() => {
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
removeToken()
resetRouter()
// reset visited views and cached views
// to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
dispatch('tagsView/delAllViews', null, { root: true })
// reset visited views and cached views
// to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
dispatch('tagsView/delAllViews', null, { root: true })
// resolve()
// })
// .catch(error => {
// reject(error)
// })
// resolve()
// })
// .catch(error => {
// reject(error)
// })
// })
},

View File

@ -5,8 +5,7 @@
type="primary"
style="position:absolute;right:50px;top:120px"
@click="$router.push('/convenience/add')"
><i class="el-icon-plus" /> 直接建立工单</el-button
>
><i class="el-icon-plus" /> 直接建立工单</el-button>
<div class="title">工单列表</div>
<div style="margin-bottom:15px;margin-top:15px" />
<el-radio-group v-model="listQuery.phase">
@ -16,20 +15,20 @@
<el-radio-button label="PROCESSING">办理中</el-radio-button>
<el-radio-button label="FINISH">已办结</el-radio-button>
</el-radio-group>
<br />
<br />
<br>
<br>
<el-radio-group v-model="listQuery.status">
<el-radio-button :label="undefined">全部状态</el-radio-button>
<el-radio-button label="MINE">我处理</el-radio-button>
<el-radio-button label="FORWARDED">已转交</el-radio-button>
<el-radio-button label="FORWARDED_APPLY"
>转交超限审批中</el-radio-button
>
<el-radio-button
label="FORWARDED_APPLY"
>转交超限审批中</el-radio-button>
<el-radio-button label="SUBMIT_APPLY">已提交审批</el-radio-button>
<el-radio-button label="WAIT_APPLY">待我审批</el-radio-button>
</el-radio-group>
<br />
<br />
<br>
<br>
</div>
<div class="convenienceList">
@ -57,13 +56,13 @@
<p>流水号{{ item.serialNumber }}</p>
<p>
阶段{{ item.phase | phaseFilter }}
<i class="icon_timeout" v-if="timers&&timers[index].status !== null"></i>
<i v-if="timers&&timers[index].status !== null" class="icon_timeout" />
<span style="color:#ff3000">{{
timers && timers[index].status === null
? ""
: timers&&timers[index].status
? "已超时"
: "即将超时"
? "已超时"
: "即将超时"
}}</span>
</p>
</div>
@ -92,8 +91,7 @@
type="primary"
size="mini"
@click="handleUpdate(item, 5)"
>接单</el-button
>
>接单</el-button>
</p>
</div>
</div>
@ -187,10 +185,10 @@
<script>
// import Pagination from "@/components/Pagination";
import { list, typeList, update } from "@/api/convenience";
import { parseTime } from "@/utils";
import { staffList } from "@/api/staff";
import AliOss from "@/components/AliOSS/index.vue";
import { list, typeList, update } from '@/api/convenience'
import { parseTime } from '@/utils'
import { staffList } from '@/api/staff'
import AliOss from '@/components/AliOSS/index.vue'
export default {
components: {
@ -200,48 +198,48 @@ export default {
filters: {
sponsorFilter(status) {
const statusMap = {
SELF: "居民",
STAFF: "工作人员"
};
return statusMap[status];
SELF: '居民',
STAFF: '工作人员'
}
return statusMap[status]
},
phaseFilter(status) {
const statusMap = {
PENDING_ORDER: "待接单",
PREREQUISITES: "要件准备中",
PROCESSING: "办理中",
FINISH: "办结"
};
return statusMap[status];
PENDING_ORDER: '待接单',
PREREQUISITES: '要件准备中',
PROCESSING: '办理中',
FINISH: '办结'
}
return statusMap[status]
},
statusFilter(status) {
const statusMap = {
MINE: "待我处理",
FORWARDED: "已转交",
FORWARDED_APPLY: "转交超限审批中",
SUBMIT_APPLY: "提交申请",
WAIT_APPLY: "待审核"
};
return statusMap[status];
MINE: '待我处理',
FORWARDED: '已转交',
FORWARDED_APPLY: '转交超限审批中',
SUBMIT_APPLY: '提交申请',
WAIT_APPLY: '待审核'
}
return statusMap[status]
},
typeFilter(status) {
const statusMap = {
1: "建立工单",
2: "撤销工单",
3: "沟通",
4: "调整工单类别",
5: "接单",
6: "要件齐备",
7: "办结",
8: "转交超限审批提交",
9: "转交超限审批撤销",
10: "转交超限审批",
11: "发起审批",
12: "撤销审批",
13: "审批操作",
14: "转交"
};
return statusMap[status];
1: '建立工单',
2: '撤销工单',
3: '沟通',
4: '调整工单类别',
5: '接单',
6: '要件齐备',
7: '办结',
8: '转交超限审批提交',
9: '转交超限审批撤销',
10: '转交超限审批',
11: '发起审批',
12: '撤销审批',
13: '审批操作',
14: '转交'
}
return statusMap[status]
}
},
data() {
@ -272,140 +270,140 @@ export default {
},
msec: 0,
rules: {
ids: [{ required: true, message: "请选择操作对象", trigger: "change" }]
ids: [{ required: true, message: '请选择操作对象', trigger: 'change' }]
},
timers: undefined,
timersInterval: undefined
};
}
},
watch: {
"listQuery.phase": {
'listQuery.phase': {
//
handler(val) {
this.listQuery.phase = val;
this.getList();
this.listQuery.phase = val
this.getList()
},
deep: true // true
},
"listQuery.status": {
'listQuery.status': {
//
handler(val) {
this.listQuery.status = val;
this.getList();
this.listQuery.status = val
this.getList()
},
deep: true // true
}
},
created() {
this.getList();
this.getStaffList();
this.getList()
this.getStaffList()
},
methods: {
getList() {
this.listLoading = true;
this.listLoading = true
list(this.listQuery).then(res => {
this.list = res.d.records;
this.listLoading = false;
clearInterval(this.timersInterval);
const tempData = res.d.records;
const now = Date.parse(new Date()).toString() / 1000;
const arr = [];
this.list = res.d.records
this.listLoading = false
clearInterval(this.timersInterval)
const tempData = res.d.records
const now = Date.parse(new Date()).toString() / 1000
const arr = []
tempData.map((item, index) => {
let msec = [];
let obj = {};
let msec = []
let obj = {}
switch (item.phase) {
case "PENDING_ORDER":
case 'PENDING_ORDER':
//
msec = now - item.createDate;
msec = now - item.createDate
obj = {
time: msec,
phase: item.phase,
status: null
};
arr.push(obj);
break;
case "PREREQUISITES":
}
arr.push(obj)
break
case 'PREREQUISITES':
//
msec = now - item.createDate - item.acceptanceTime;
msec = now - item.createDate - item.acceptanceTime
obj = {
time: msec,
phase: item.phase,
status: null
};
arr.push(obj);
break;
case "PROCESSING":
}
arr.push(obj)
break
case 'PROCESSING':
//
msec =
now -
item.createDate -
item.acceptanceTime -
item.prerequisitesTime;
item.prerequisitesTime
obj = {
time: msec,
phase: item.phase,
status: null
};
arr.push(obj);
break;
case "FINISH":
}
arr.push(obj)
break
case 'FINISH':
msec =
item.acceptanceTime + item.prerequisitesTime + item.finishTime;
item.acceptanceTime + item.prerequisitesTime + item.finishTime
obj = {
time: msec,
phase: item.phase,
status: null
};
arr.push(obj);
}
arr.push(obj)
//
break;
break
default:
break;
break
}
});
})
this.timersInterval = setInterval(() => {
if (arr.length > 0) {
arr.map((item, index) => {
if (item.phase !== "FINISH") {
item.time++;
if (this.list[index].phase === "PENDING_ORDER") {
if (item.phase !== 'FINISH') {
item.time++
if (this.list[index].phase === 'PENDING_ORDER') {
if (item.status == null) {
if (item.time > 57600) {
item.status = false;
item.status = false
if (item.time >= 86400) {
item.status = true;
item.status = true
}
}
}
}
if (this.list[index].phase === "PROCESSING") {
if (this.list[index].phase === 'PROCESSING') {
if (item.status == null) {
// &&item.time<this.list[index].eventType.commitmentTimeLimit
if (
item.time >
this.list[index].eventType.timeoutReminder * 3600
) {
item.status = false;
item.status = false
if (
item.time >=
this.list[index].eventType.commitmentTimeLimit * 3600
) {
item.status = true;
item.status = true
}
}
}
}
}
});
})
}
this.timers = arr;
}, 1000);
});
this.timers = arr
}, 1000)
})
},
getTypeList() {
typeList().then(res => {
// console.log(res);
});
})
},
getStaffList() {
staffList().then(res => {
@ -413,10 +411,10 @@ export default {
const obj = {
label: item.name,
value: item.id
};
this.staffOptions.push(obj);
});
});
}
this.staffOptions.push(obj)
})
})
},
handleTypeChange() {},
resetPayload() {
@ -428,79 +426,79 @@ export default {
attachmentList: undefined,
approve: undefined,
evaluation: undefined
};
}
},
handleUpdate(row, type) {
this.resetPayload();
this.resetPayload()
this.$nextTick(() => {
this.$refs.applyForm.clearValidate();
});
this.updateType = type;
this.payload.id = row.id;
this.payload.version = row.version;
this.payload.type = type;
this.$refs.applyForm.clearValidate()
})
this.updateType = type
this.payload.id = row.id
this.payload.version = row.version
this.payload.type = type
switch (type) {
case 5:
this.applyDialog = true;
break;
this.applyDialog = true
break
case 6:
this.applyDialog = true;
break;
this.applyDialog = true
break
case 11:
this.applyDialog = true;
break;
this.applyDialog = true
break
case 13:
this.applyDialog = true;
break;
this.applyDialog = true
break
case 14:
this.applyDialog = true;
break;
this.applyDialog = true
break
default:
this.updateData();
break;
this.updateData()
break
}
},
updateData() {
update(this.payload).then(res => {
if (res.c === 200) {
this.$notify.success("操作成功");
this.getList();
this.$notify.success('操作成功')
this.getList()
}
});
})
},
apply() {
this.$nextTick(() => {
this.$refs.applyForm.validate(valid => {
if (valid) {
this.updateData();
this.applyDialog = false;
this.updateData()
this.applyDialog = false
}
});
}, 100);
})
}, 100)
},
handleFilterPhase(phase, event) {
// console.log(event.target.tagName==='SPAN');
if (event.target.tagName === "SPAN") {
if (event.target.tagName === 'SPAN') {
event.target.parentElement.setAttribute(
"class",
"el-button el-button--" +
(phase === undefined ? "primary" : "default") +
" el-button--medium is-round"
);
'class',
'el-button el-button--' +
(phase === undefined ? 'primary' : 'default') +
' el-button--medium is-round'
)
} else {
event.target.setAttribute(
"class",
"el-button el-button--" +
(phase === undefined ? "primary" : "default") +
" el-button--medium is-round"
);
'class',
'el-button el-button--' +
(phase === undefined ? 'primary' : 'default') +
' el-button--medium is-round'
)
}
this.listQuery.phase = phase;
this.getList();
this.listQuery.phase = phase
this.getList()
},
handleFilterStatus(status) {
this.listQuery.status = status;
this.getList();
this.listQuery.status = status
this.getList()
},
handlePreview() {},
handleRemove() {},
@ -509,18 +507,18 @@ export default {
timeFormat(timeStamp) {
const timeStr = `${
Math.floor(timeStamp / 3600) < 9
? "0" + Math.floor(timeStamp / 3600)
? '0' + Math.floor(timeStamp / 3600)
: Math.floor(timeStamp / 3600)
}:${
Math.floor(((timeStamp % 86400) % 3600) / 60) < 9
? "0" + Math.floor(((timeStamp % 86400) % 3600) / 60)
? '0' + Math.floor(((timeStamp % 86400) % 3600) / 60)
: Math.floor(((timeStamp % 86400) % 3600) / 60)
}:${
Math.floor(((timeStamp % 86400) % 3600) % 60) < 9
? "0" + Math.floor(((timeStamp % 86400) % 3600) % 60)
? '0' + Math.floor(((timeStamp % 86400) % 3600) % 60)
: Math.floor(((timeStamp % 86400) % 3600) % 60)
}`;
return timeStr;
}`
return timeStr
},
countdown(index, status) {
//
@ -538,7 +536,7 @@ export default {
// return statusEl;
// }
}
};
}
</script>
<style scope>

View File

@ -11,12 +11,13 @@
margin: 0 auto;"
>
<el-row>
<el-col :span="12"
><img
src="./img/loginImg.png"
style="padding: 70px 0px 70px 72px;width:100%"
alt=""
/></el-col>
<el-col
:span="12"
><img
src="./img/loginImg.png"
style="padding: 70px 0px 70px 72px;width:100%"
alt=""
></el-col>
<el-col :span="12">
<el-form
@ -75,8 +76,7 @@
type="primary"
style="width:100%;margin-bottom:30px;border-radius:10px;height:54px"
@click.native.prevent="handleLogin"
>登录</el-button
>
>登录</el-button>
</el-form>
</el-col>
</el-row>
@ -85,12 +85,12 @@
</template>
<script>
import { validUsername } from "@/utils/validate";
import { getGuestToken, getSms } from "@/api/user";
import Axios from "axios";
import { validUsername } from '@/utils/validate'
import { getGuestToken, getSms } from '@/api/user'
import Axios from 'axios'
export default {
name: "Login",
name: 'Login',
// components: { SocialSign },
data() {
const validateUsername = (rule, value, callback) => {
@ -100,57 +100,57 @@ export default {
// callback()
// }
if (value.length < 4) {
callback(new Error("账号格式错误不能为空或小于11位"));
callback(new Error('账号格式错误不能为空或小于11位'))
} else {
callback();
callback()
}
};
}
const validateCaptcha = (rule, value, callback) => {
if (value.length < 6) {
callback(new Error("验证码格式错误不能为空或小于6位"));
callback(new Error('验证码格式错误不能为空或小于6位'))
} else {
callback();
callback()
}
};
}
return {
// loginForm: {
// username: 'admin',
// password: '111111'
// },
loginForm: {
username: "18882564006",
captcha: "111111",
appVersion: "1.0.0",
system: "IOS",
username: '18882564006',
captcha: '111111',
appVersion: '1.0.0',
system: 'IOS',
device: navigator.userAgent,
extra: ""
extra: ''
},
loginRules: {
username: [
{ required: true, trigger: "blur", validator: validateUsername }
{ required: true, trigger: 'blur', validator: validateUsername }
],
captcha: [
{ required: true, trigger: "blur", validator: validateCaptcha }
{ required: true, trigger: 'blur', validator: validateCaptcha }
]
},
passwordType: "password",
passwordType: 'password',
capsTooltip: false,
loading: false,
showDialog: false,
redirect: undefined,
otherQuery: {},
codeText: "获取验证码",
codeText: '获取验证码',
time: 5,
getCodeDisabled: false
};
}
},
watch: {
$route: {
handler: function(route) {
const query = route.query;
const query = route.query
if (query) {
this.redirect = query.redirect;
this.otherQuery = this.getOtherQuery(query);
this.redirect = query.redirect
this.otherQuery = this.getOtherQuery(query)
}
},
immediate: true
@ -158,30 +158,30 @@ export default {
},
created() {
// window.addEventListener('storage', this.afterQRScan)
const { appVersion, system, device, extra } = this.loginForm;
const { appVersion, system, device, extra } = this.loginForm
const payload = {
appVersion,
system,
device,
extra
};
}
Axios({
method: "POST",
method: 'POST',
url: `${process.env.VUE_APP_BASE_API}api/auth/guest`,
data: payload,
headers: {
Authorization: "basic YW5kcm9pZC1jbGllbnQ6YW5kcm9pZC1zZWNyZXQtMjAyMA=="
Authorization: 'basic YW5kcm9pZC1jbGllbnQ6YW5kcm9pZC1zZWNyZXQtMjAyMA=='
}
}).then(res => {
// console.log(res);
sessionStorage.setItem("token", res.data.d.access_token);
});
sessionStorage.setItem('token', res.data.d.access_token)
})
},
mounted() {
if (this.loginForm.username === "") {
this.$refs.username.focus();
} else if (this.loginForm.captcha === "") {
this.$refs.password.focus();
if (this.loginForm.username === '') {
this.$refs.username.focus()
} else if (this.loginForm.captcha === '') {
this.$refs.password.focus()
}
},
destroyed() {
@ -189,8 +189,8 @@ export default {
},
methods: {
checkCapslock(e) {
const { key } = e;
this.capsTooltip = key && key.length === 1 && key >= "A" && key <= "Z";
const { key } = e
this.capsTooltip = key && key.length === 1 && key >= 'A' && key <= 'Z'
},
// showPwd() {
// if (this.passwordType === 'password') {
@ -206,37 +206,37 @@ export default {
this.$refs.loginForm.validate(valid => {
if (valid) {
Axios({
method: "POST",
method: 'POST',
url: `${process.env.VUE_APP_BASE_API}api/auth/sms`,
data: this.loginForm,
headers: {
Authorization:
"basic YW5kcm9pZC1jbGllbnQ6YW5kcm9pZC1zZWNyZXQtMjAyMA=="
'basic YW5kcm9pZC1jbGllbnQ6YW5kcm9pZC1zZWNyZXQtMjAyMA=='
}
}).then(res => {
console.log(res);
console.log(res)
if (res.data.c === 200) {
this.$store.dispatch("user/setToken", res.data.d.access_token);
this.$store.dispatch('user/setToken', res.data.d.access_token)
this.$router.push({
path: this.redirect || "/",
path: this.redirect || '/',
query: this.otherQuery
});
})
this.$notify({
title: "成功",
message: "登录成功",
type: "success",
title: '成功',
message: '登录成功',
type: 'success',
duration: 2000
});
})
} else {
this.$notify.error(res.data.m);
this.$notify.error(res.data.m)
}
});
})
} else {
console.log("error submit!!");
console.log('error submit!!')
return false;
return false
}
});
})
// this.$refs.loginForm.validate(valid => {
// if (valid) {
// this.loading = true
@ -256,53 +256,53 @@ export default {
},
getOtherQuery(query) {
return Object.keys(query).reduce((acc, cur) => {
if (cur !== "redirect") {
acc[cur] = query[cur];
if (cur !== 'redirect') {
acc[cur] = query[cur]
}
return acc;
}, {});
return acc
}, {})
},
handleSms() {
this.getCodeDisabled = false;
this.getCodeDisabled = false
const payload = {
phone: this.loginForm.username,
category: "SIGNIN"
};
category: 'SIGNIN'
}
Axios({
method: "GET",
method: 'GET',
url: `${process.env.VUE_APP_BASE_API}api/common/sms/send`,
params: payload,
headers: {
Authorization: "Bearer " + sessionStorage.getItem("token")
Authorization: 'Bearer ' + sessionStorage.getItem('token')
}
}).then(res => {
if (res.data.c === 200) {
this.getCodeDisabled = true;
this.timer();
this.getCodeDisabled = true
this.timer()
this.$notify({
title: "成功",
message: "获取验证码成功",
type: "success",
title: '成功',
message: '获取验证码成功',
type: 'success',
duration: 2000
});
})
}
});
})
},
timer() {
this.codeText = `${this.time}s 后重新获取`;
this.codeText = `${this.time}s 后重新获取`
var interval = setInterval(() => {
this.time--;
this.codeText = `${this.time}s 后重新获取`;
this.time--
this.codeText = `${this.time}s 后重新获取`
if (this.time === 0) {
this.time = 5;
this.codeText = "获取验证码";
this.getCodeDisabled = false;
clearInterval(interval);
this.time = 5
this.codeText = '获取验证码'
this.getCodeDisabled = false
clearInterval(interval)
}
}, 1000);
}, 1000)
}
}
};
}
</script>
<style lang="scss">