281 lines
6.1 KiB
Vue
281 lines
6.1 KiB
Vue
<template>
|
|
<el-container>
|
|
<el-header>
|
|
<div class="left-panel">
|
|
<el-button type="primary" icon="el-icon-plus" @click="add"></el-button>
|
|
</div>
|
|
<div class="right-panel">
|
|
<div class="right-panel-search">
|
|
<el-input
|
|
v-model="search.keyword"
|
|
placeholder="名称"
|
|
clearable
|
|
></el-input>
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-search"
|
|
></el-button>
|
|
</div>
|
|
</div>
|
|
</el-header>
|
|
<el-main class="nopadding">
|
|
<scTable
|
|
ref="table"
|
|
:apiObj="apiObj"
|
|
row-key="id"
|
|
@selection-change="selectionChange"
|
|
stripe
|
|
@resetQuery="resetQuery"
|
|
>
|
|
<el-table-column
|
|
label="#"
|
|
fixed="left"
|
|
type="index"
|
|
width="50"
|
|
></el-table-column>
|
|
|
|
<el-table-column label="来访事由" prop="state" width="180" fixed="left">
|
|
<template #default="scope">{{purpose_[scope.row.purpose] }}</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="访问级别"
|
|
prop="level"
|
|
width="200"
|
|
fixed="left"
|
|
>
|
|
<template #default="scope">
|
|
<el-space v-if="scope.row.level==10">一般</el-space>
|
|
<el-space v-else>重要</el-space>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="来访单位"
|
|
prop="company"
|
|
width="180"
|
|
fixed="left"
|
|
></el-table-column>
|
|
<el-table-column
|
|
label="项目状态"
|
|
prop="state"
|
|
width="180"
|
|
>
|
|
<template #default="scope">{{state_[scope.row.state] }}</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="审批状态"
|
|
prop="state"
|
|
width="180"
|
|
>
|
|
<template #default="scope">
|
|
<span v-if="scope.row.ticket_&&scope.row.ticket_.state_" style="margin-right: 5px;">{{scope.row.ticket_.state_.name }}</span>
|
|
<el-tag
|
|
v-if="scope.row.ticket_&&scope.row.ticket_.act_state"
|
|
class="mx-1"
|
|
size="small"
|
|
:type="scope.row.ticket_.act_state===0?'':scope.row.ticket_.act_state===1?'':scope.row.ticket_.act_state===2?'danger':scope.row.ticket_.act_state===3?'danger':scope.row.ticket_.act_state===5?'danger':scope.row.ticket_.act_state===4?'success':''"
|
|
>{{act_states[scope.row.ticket_.act_state]}}</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="来访概述"
|
|
prop="name"
|
|
width="180"
|
|
></el-table-column>
|
|
<el-table-column
|
|
label="来访详述"
|
|
prop="description"
|
|
width="180"
|
|
></el-table-column>
|
|
<el-table-column
|
|
label="来访时间"
|
|
prop="visit_time"
|
|
width="180"
|
|
></el-table-column>
|
|
<el-table-column
|
|
label="离开时间"
|
|
prop="leave_time"
|
|
width="180"
|
|
></el-table-column>
|
|
<el-table-column
|
|
label="来访人数"
|
|
prop="count_people"
|
|
width="180"
|
|
></el-table-column>
|
|
<el-table-column
|
|
label="属地部门"
|
|
prop="belong_dept"
|
|
width="180"
|
|
></el-table-column>
|
|
<el-table-column
|
|
label="接待人"
|
|
prop="receptionist_name"
|
|
width="180"
|
|
>
|
|
<template #default="scope">
|
|
<span v-if="scope.row.receptionist_">{{scope.row.receptionist_.name}}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="创建时间"
|
|
prop="create_time"
|
|
width="180"
|
|
></el-table-column>
|
|
<el-table-column label="操作" fixed="right" align="left" width="170">
|
|
<template #default="scope">
|
|
<el-button-group>
|
|
<el-button
|
|
text
|
|
v-if="scope.row.state==10"
|
|
type="primary"
|
|
size="small"
|
|
@click="addpepple(scope.row, scope.$index)"
|
|
>继续编辑
|
|
</el-button>
|
|
<el-button
|
|
text
|
|
type="primary"
|
|
size="small"
|
|
@click="table_show(scope.row, scope.$index)"
|
|
>查看
|
|
</el-button>
|
|
<el-button
|
|
text
|
|
type="primary"
|
|
size="small"
|
|
@click="table_del(scope.row)"
|
|
>删除
|
|
</el-button>
|
|
</el-button-group>
|
|
</template>
|
|
</el-table-column>
|
|
</scTable>
|
|
</el-main>
|
|
<save-dialog
|
|
v-if="dialog.save"
|
|
ref="saveDialog"
|
|
@success="handleSaveSuccess"
|
|
@closed="dialog.save = false"
|
|
></save-dialog>
|
|
<detial-dialog
|
|
v-if="dialog.save"
|
|
ref="detialDialog"
|
|
></detial-dialog>
|
|
</el-container>
|
|
</template>
|
|
<script>
|
|
import saveDialog from "./visit_form.vue";
|
|
import detialDialog from "./visit_detial.vue";
|
|
|
|
export default {
|
|
name: "visit",
|
|
components: {
|
|
saveDialog,
|
|
detialDialog
|
|
},
|
|
data() {
|
|
return {
|
|
dialog: {
|
|
save: false,
|
|
permission: false,
|
|
},
|
|
apiObj: this.$API.vm.visit.list,
|
|
query: {},
|
|
selection: [],
|
|
search: {
|
|
keyword: null,
|
|
},
|
|
|
|
purpose_: {
|
|
10: "参观",
|
|
20: "拜访",
|
|
30: "面试",
|
|
40: "开会"
|
|
},
|
|
state_: {
|
|
10: "创建中",
|
|
20: "审批中",
|
|
30: "待入厂",
|
|
40: "进行中",
|
|
50: "已完成",
|
|
},
|
|
act_states: {
|
|
0: "草稿中",//p
|
|
1: "进行中",//p
|
|
|
|
2: "被退回",//d
|
|
3: "被撤回",//d
|
|
|
|
4: "已完成",//s
|
|
5: "已关闭",//d
|
|
},
|
|
};
|
|
},
|
|
methods: {
|
|
//添加
|
|
add() {
|
|
this.dialog.save = true;
|
|
this.$nextTick(() => {
|
|
this.$refs.saveDialog.open("add");
|
|
});
|
|
},
|
|
addpepple(row) {
|
|
this.$router.push({
|
|
name: "vistoradd",
|
|
query: {
|
|
visitid: row.id, //访问项目id
|
|
},
|
|
});
|
|
},
|
|
|
|
|
|
//查看
|
|
table_show(row) {
|
|
this.dialog.save = true;
|
|
this.$nextTick(() => {
|
|
this.$refs.detialDialog.open("show").setData(row);
|
|
});
|
|
},
|
|
|
|
//权限设置
|
|
permission() {
|
|
this.dialog.permission = true;
|
|
this.$nextTick(() => {
|
|
this.$refs.permissionDialog.open();
|
|
});
|
|
},
|
|
//删除
|
|
table_del(row) {
|
|
this.$API.vm.visit.delete
|
|
.req(row.id)
|
|
.then((res) => {
|
|
this.$message.success("删除成功");
|
|
|
|
return res;
|
|
})
|
|
.catch((err) => {
|
|
return err;
|
|
});
|
|
|
|
},
|
|
|
|
//表格选择后回调事件
|
|
selectionChange(selection) {
|
|
this.selection = selection;
|
|
},
|
|
|
|
|
|
//本地更新数据
|
|
handleSaveSuccess(data, mode) {
|
|
if (mode == "add") {
|
|
this.$refs.table.refresh();
|
|
} else if (mode == "edit") {
|
|
this.$refs.table.refresh();
|
|
}
|
|
},
|
|
resetQuery() {
|
|
this.query = {};
|
|
},
|
|
},
|
|
};
|
|
</script>
|