master
xy 2 years ago
parent 5b7028bdc3
commit 0fb19c8f13

@ -4,8 +4,8 @@ NODE_ENV = production
ENV = 'staging'
# base api
VUE_APP_DOMIAN = http://contract-sqhj.ali251.langye.net
VUE_APP_UPLOAD_API = http://contract-sqhj.ali251.langye.net/api/admin/upload-file
VUE_APP_DOMIAN = http://contract-sqhj-test.ali251.langye.net
VUE_APP_UPLOAD_API = http://contract-sqhj-test.ali251.langye.net/api/admin/upload-file
VUE_APP_BASE_API =
VUE_APP_OUT_Book = http://book-sqhj.ali251.langye.net
VUE_APP_OUT_GDZC = http://hjjc-szemcgdzc.ali251.langye.net

@ -230,6 +230,7 @@ export default {
height: $topbarHeight;
filter: drop-shadow(0 1px 1px #49a0f3);
display: grid;
-webkit-app-region: drag;
grid-template-columns: auto 0.5fr 6fr 0.2fr 1fr;
grid-template-rows: $topbarHeight;
grid-template-areas: "logo . menu . user";
@ -241,6 +242,7 @@ export default {
right: 0;
&__logo {
-webkit-app-region: no-drag;
height: $topbarHeight;
grid-area: logo;
display: flex;
@ -255,6 +257,7 @@ export default {
}
&__user {
-webkit-app-region: no-drag;
grid-area: user;
}
@ -266,6 +269,7 @@ export default {
align-items: flex-end;
li {
-webkit-app-region: no-drag;
color: #fff;
height: 40px;
line-height: 40px;

@ -109,13 +109,6 @@ export default {
this.$nextTick(() => this.$refs.form.clearValidate())
},
async getDetail () {
const res = await show({ id: this.id },false);
for (let key in this.form) {
this.form[key] = res[key]
}
},
submit () {
this.loading = true
this.$refs.form.validate((valid) => {
@ -141,12 +134,6 @@ export default {
computed: {},
created() {
this.init();
},
beforeRouteEnter(to, from, next) {
next(vm => {
vm.id = to.query.id;
vm.getDetail(vm.id);
})
}
}
</script>

@ -0,0 +1,276 @@
<template>
<div>
<xy-dialog
ref="dialog"
:is-show.sync="isShow"
type="form"
:title="type === 'add' ? '新增出差' : '编辑出差'"
:form="form"
:rules="rules"
@submit="submit"
>
<template v-slot:title>
<div class="xy-table-item">
<div class="xy-table-item-label">标题 </div>
<div class="xy-table-item-content">
<el-input
v-model="form.title"
clearable
placeholder="请输入标题"
style="width: 300px"
></el-input>
</div>
</div>
</template>
<template v-slot:use_car>
<div class="xy-table-item">
<div class="xy-table-item-label">是否用车 </div>
<div class="xy-table-item-content">
<el-radio-group style="width: 300px" v-model="form.use_car">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</div>
</div>
</template>
<template v-slot:is_subsidize>
<div class="xy-table-item">
<div class="xy-table-item-label">是否室内补助 </div>
<div class="xy-table-item-content">
<el-radio-group style="width: 300px" v-model="form.is_subsidize">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</div>
</div>
</template>
<template v-slot:start_date>
<div class="xy-table-item">
<div class="xy-table-item-label">开始时间 </div>
<div class="xy-table-item-content">
<el-date-picker
v-model="form.start_date"
placeholder="请选择开始时间"
style="width: 300px"
value-format="yyyy-MM-dd"
></el-date-picker>
</div>
</div>
</template>
<template v-slot:end_date>
<div class="xy-table-item">
<div class="xy-table-item-label">开始时间 </div>
<div class="xy-table-item-content">
<el-date-picker
v-model="form.end_date"
placeholder="请选择开始时间"
style="width: 300px"
value-format="yyyy-MM-dd"
></el-date-picker>
</div>
</div>
</template>
<template v-slot:use_car_status v-if="$store.state.user.min_allow_level === 0">
<div class="xy-table-item">
<div class="xy-table-item-label">用车审核 </div>
<div class="xy-table-item-content">
<el-radio-group style="width: 300px" v-model="form.use_car_status">
<el-radio :label="1">待申请</el-radio>
<el-radio :label="2">流转中</el-radio>
<el-radio :label="3">已结办</el-radio>
</el-radio-group>
</div>
</div>
</template>
<template v-slot:subsidize_status v-if="$store.state.user.min_allow_level === 0">
<div class="xy-table-item">
<div class="xy-table-item-label">市内补助审核 </div>
<div class="xy-table-item-content">
<el-radio-group style="width: 300px" v-model="form.subsidize_status">
<el-radio :label="1">待申请</el-radio>
<el-radio :label="2">流转中</el-radio>
<el-radio :label="3">已结办</el-radio>
</el-radio-group>
</div>
</div>
</template>
<template v-slot:away_status v-if="$store.state.user.min_allow_level === 0">
<div class="xy-table-item">
<div class="xy-table-item-label">出差审核 </div>
<div class="xy-table-item-content">
<el-radio-group style="width: 300px" v-model="form.away_status">
<el-radio :label="1">待申请</el-radio>
<el-radio :label="2">流转中</el-radio>
<el-radio :label="3">已结办</el-radio>
</el-radio-group>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import { show, save } from "@/api/away";
export default {
props: {},
data() {
return {
isShow: false,
id: "",
type: "",
form: {
title: "",
use_car: "",
is_subsidize: "",
start_date: "",
end_date: "",
use_car_status: "",
subsidize_status: "",
away_status: "",
financial_status: ""
},
rules: {
title: [
{ required: true, message: '请输入标题', trigger: 'blur' },
],
start_date: [
{ required: true, message: '请选择开始时间', trigger: 'blur' },
{
validator: (rule, value, callback) => {
if (this.form.end_date && this.form.start_date) {
if (this.$moment(this.form.end_date).isAfter(this.form.start_date)) {
callback()
} else {
callback(new Error('结束时间不能小于开始时间'))
}
} else {
callback()
}
}
}
],
end_date: [
{ required: true, message: '请选择结束时间', trigger: 'blur' },
{
validator: (rule, value, callback) => {
if (this.form.end_date && this.form.start_date) {
if (this.$moment(this.form.end_date).isAfter(this.form.start_date)) {
callback()
} else {
callback(new Error('结束时间不能小于开始时间'))
}
} else {
callback()
}
}
}
],
},
};
},
methods: {
show() {
this.isShow = true;
},
hidden() {
this.isShow = false;
},
init() {
for (let key in this.form) {
if (this.form[key] instanceof Array) {
this.form[key] = [];
} else {
this.form[key] = "";
}
}
this.$refs["dialog"].clearValidate();
},
setId(id) {
if (typeof id == "number") {
this.id = id;
} else {
console.error("error typeof id: " + typeof id);
}
},
getId() {
return this.id;
},
setType(type = "add") {
let types = ["add", "editor"];
if (types.includes(type)) {
this.type = type;
} else {
console.warn("Unknown type: " + type);
}
},
setForm(key = [], value = []) {
if (key instanceof Array) {
key.forEach((key, index) => {
this.form[key] = value[index] ?? "";
});
}
if (typeof key === "string") {
this.form[key] = value;
}
if (!key) {
this.init();
}
},
async getDetail() {
const res = await show({ id: this.id });
this.$integrateData(this.form, res);
},
submit() {
if (this.type === "add") {
if (this.form.hasOwnProperty("id")) {
delete this.form.id;
}
}
if (this.type === "editor") {
Object.defineProperty(this.form, "id", {
value: this.id,
enumerable: true,
configurable: true,
writable: true,
});
}
save(this.form).then((res) => {
this.$message({
type: "success",
message: this.type === "add" ? "新增出差" : "编辑出差" + "成功",
});
this.isShow = false;
this.$emit("refresh");
});
},
},
watch: {
isShow(val) {
if (val) {
if (this.type === "editor") {
this.getDetail();
}
} else {
this.id = "";
this.type = "";
this.init();
this.$refs["dialog"].clearValidate();
delete this.form.id;
}
},
},
};
</script>
<style scoped lang="scss">
::v-deep .el-input__inner {
text-align: left;
}
.xy-table-item-label {
width: 160px;
}
</style>

@ -73,8 +73,9 @@
label="操作"
width="220"
>
<template #default="{ row }">
<template #default="{ row }" v-if="!/Finance/g.test($route.path)">
<Poptip
v-if="isAuthEdit(row)"
:transfer="true"
confirm
placement="bottom"
@ -82,7 +83,7 @@
@on-ok="() => deleteAway(row.id)"
>
<Button
style="margin-left: 4px;"
style="margin: 2px;"
ghost
size="small"
type="error"
@ -90,41 +91,62 @@
</Button>
</Poptip>
<Button
style="margin-left: 4px;"
style="margin: 2px;"
size="small"
type="primary"
@click="$router.push('/contract/away/addAway?id=' + row.id)"
@click="$refs['addAway'].setType('editor'),$refs['addAway'].setId(row.id),$refs['addAway'].show()"
>编辑
</Button>
<template v-if="row.FLOWSTATUS.useCar.isEnabled()">
<Button
style="margin-left: 4px;"
style="margin: 2px;"
size="small"
type="primary"
@click=""
@click="goUseCar(row)"
>用车审核
</Button>
</template>
<template v-if="row.FLOWSTATUS.subsidize.isEnabled()">
<Button
style="margin-left: 4px;"
style="margin: 2px;"
size="small"
type="primary"
@click=""
@click="goSubsidize(row)"
>市内补助审核
</Button>
</template>
<template v-if="row.FLOWSTATUS.away.isEnabled()">
<Button
style="margin-left: 4px;"
style="margin: 2px;"
size="small"
type="primary"
@click=""
@click="goAway(row)"
>出差审核
</Button>
</template>
</template>
<template v-else #default="{ row }">
<template v-if="row.FLOWSTATUS.financial.getExecutable()">
<Button
v-if="row.FLOWSTATUS.financial.getStatus() === 2"
style="margin: 2px;"
size="small"
type="primary"
@click="examineAway(row,1)"
ghost
>财务审核取消
</Button>
<Button
v-else
style="margin: 2px;"
size="small"
type="primary"
@click="examineAway(row,2)"
>财务审核确认
</Button>
</template>
</template>
</el-table-column>
</template>
</xy-table>
@ -146,15 +168,26 @@
/>
</div>
</div>
<addAway ref="addAway" @refresh="getList"></addAway>
</div>
</template>
<script>
import { index, destroy } from "@/api/away";
import addAway from "@/views/away/component/addAway.vue"
import { index, destroy, save } from "@/api/away";
export default {
components: {
addAway
},
data() {
return {
window: {
width: 0,
height: 0,
top: 0,
left: 0,
},
select: {
keyword: '',
start_year: "",
@ -164,6 +197,18 @@ export default {
},
total: 0,
list: [],
flowStatus: new Map([
[0, "-"],
[1, "待申请"],
[2, "流转中"],
[3, "已办结"]
]),
flowStatusColor: new Map([
[0, "rgb(140, 140, 140)"],
[1, "rgb(96, 109, 241)"],
[2, "rgb(219, 122, 122)"],
[3, "rgb(147, 201, 134)"]
]),
table: [
{
label: "标题",
@ -197,6 +242,68 @@ export default {
},
width: 140
},
{
label: "流程状态",
multiHd: [
{
label: "用车",
customFn:row => {
if (!row.FLOWSTATUS.useCar.getExecutable()) {
return (
<span style="color: rgb(140, 140, 140);">-</span>
)
}
return (
<div>
<span style={{ 'color': this.flowStatusColor.get(row.FLOWSTATUS.useCar.getStatus()) }}>{ this.flowStatus.get(row.FLOWSTATUS.useCar.getStatus()) || '待申请' }</span>
<br/>
{
(row.FLOWSTATUS.useCar.getStatus() > 1) ? <a style="color: #333" on={{['click']:()=>{
}}}>查看</a> : ''
}
</div>
)
}
},
{
label: "市内补助",
customFn:row => {
if (!row.FLOWSTATUS.subsidize.getExecutable()) {
return (
<span style="color: rgb(140, 140, 140);">-</span>
)
}
return (
<div>
<span style={{ 'color': this.flowStatusColor.get(row.FLOWSTATUS.subsidize.getStatus()) }}>{ this.flowStatus.get(row.FLOWSTATUS.subsidize.getStatus()) || '待申请' }</span>
<br/>
{
(row.FLOWSTATUS.subsidize.getStatus() > 1) ? <a style="color: #333" on={{['click']:()=>{
}}}>查看</a> : ''
}
</div>
)
}
},
{
label: "出差审批",
customFn:row => {
return (
<div>
<span style={{ 'color': this.flowStatusColor.get(row.FLOWSTATUS.away.getStatus()) }}>{ this.flowStatus.get(row.FLOWSTATUS.away.getStatus()) || '待申请' }</span>
<br/>
{
(row.FLOWSTATUS.away.getStatus() > 1) ? <a style="color: #333" on={{['click']:()=>{
}}}>查看</a> : ''
}
</div>
)
}
}
]
},
{
label: "创建日期",
width: 160,
@ -219,7 +326,49 @@ export default {
}
},
methods: {
async getList () {
goUseCar (row) {
const baseInfo = {
"flow_title": row.title
};
let url = `${process.env.VUE_APP_OUT_OLD}/flow/create/3?auth_token=${this.$store.getters.oa_token}&out_away_id=${
row.id
}&default_json=${JSON.stringify(baseInfo)}`;
window.open(
url,
"buyProcess",
`top=${this.window.top},left=${this.window.left},width=${this.window.width},height=${this.window.height},location=0`
);
},
goSubsidize (row) {
const baseInfo = {
"flow_title": row.title
};
let url = `${process.env.VUE_APP_OUT_OLD}/flow/create/24?auth_token=${this.$store.getters.oa_token}&out_away_id=${
row.id
}&default_json=${JSON.stringify(baseInfo)}`;
window.open(
url,
"buyProcess",
`top=${this.window.top},left=${this.window.left},width=${this.window.width},height=${this.window.height},location=0`
);
},
goAway (row) {
const baseInfo = {
"flow_title": row.title,
"6583dbd6332fd": row.start_date,
"6583dbec5d888": row.end_date,
};
let url = `${process.env.VUE_APP_OUT_OLD}/flow/create/21?auth_token=${this.$store.getters.oa_token}&out_away_id=${
row.id
}&default_json=${JSON.stringify(baseInfo)}`;
window.open(
url,
"buyProcess",
`top=${this.window.top},left=${this.window.left},width=${this.window.width},height=${this.window.height},location=0`
);
},
async getList (isFirst) {
class Flow {
status = 0
executable = false
@ -238,11 +387,14 @@ export default {
getStatus () {
return this.status
}
getExecutable () {
return this.executable
}
isEnabled () {
return this.executable && this.status === 1
return this.executable && (this.status === 1 || this.status === null)
}
}
const res = await index(this.select);
const res = await index(this.select,!isFirst);
this.total = res.total;
this.list = res.data;
this.list.forEach(item => {
@ -254,37 +406,68 @@ export default {
}
if (item.use_car) {
flowStatus.useCar.setStatus(item.use_car_status)
if (item.use_car_status === 1) {
if (item.use_car_status === 1 || item.use_car_status === null) {
flowStatus.useCar.setExecutable(true)
}
}
if (item.is_subsidize) {
flowStatus.subsidize.setStatus(item.subsidize_status)
if (item.subsidize_status === 1) {
if (item.subsidize_status === 1 || item.subsidize_status === null) {
flowStatus.subsidize.setExecutable(true)
}
}
flowStatus.away.setStatus(item.away_status)
if (item.away_status === 1) {
if (item.away_status === 1 || item.away_status === null) {
flowStatus.away.setExecutable(true)
}
flowStatus.financial.setStatus(item.financial_status)
if (item.away_status === 3) {
if ((!item.is_subsidize || item.subsidize_status === 3) && (!item.use_car || item.use_car_status === 3) && item.away_status === 3) {
flowStatus.financial.setExecutable(true)
}
item.FLOWSTATUS = flowStatus;
});
console.log(this.list)
},
async deleteAway (id) {
await destroy({ id });
await this.getList();
},
examineAway (row, status) {
this.$confirm("是否确认审批?", "提示", {}).then(_ => {
save({
...row,
financial_status: status
}).then(_ => {
this.$message.success("操作成功");
this.getList()
})
})
}
},
computed: {
isAuthEdit () {
return function (row) {
return !(row.FLOWSTATUS.useCar.getStatus() > 1 || row.FLOWSTATUS.subsidize.getStatus() > 1 || row.FLOWSTATUS.away.getStatus() > 1 || row.FLOWSTATUS.financial.getStatus() > 1)
}
}
},
computed: {},
created() {
this.getList()
this.window.width = screen.availWidth * 0.95;
this.window.height = screen.availHeight * 0.95;
this.window.top = (window.screen.height - 30 - this.window.height) / 2;
this.window.left = (window.screen.width - 10 - this.window.width) / 2;
this.getList(true)
window.onfocus = () => {
this.getList()
}
},
destroyed() {
window.onfocus = null;
}
}
</script>

Loading…
Cancel
Save