This commit is contained in:
shijing 2025-10-11 15:04:34 +08:00
commit 7f9cd6dbc1
9 changed files with 936 additions and 461 deletions

313
src/views/ofm/archive.vue Normal file
View File

@ -0,0 +1,313 @@
<template>
<el-container>
<el-header>
<div class="left-panel-group">
<el-button
type="primary"
icon="el-icon-plus"
@click="handleAdd"
v-auth="'filerecord.create'"
></el-button>
</div>
<div class="right-panel">
<el-input
v-model="query.name"
placeholder="档案名称"
clearable
@keyup.enter="handleQuery"
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" row-key="id">
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column
label="资料名称"
prop="name"
min-width="100"
></el-table-column>
<el-table-column
label="文件份数"
prop="counts"
min-width="100"
></el-table-column>
<el-table-column
label="档案编号"
prop="number"
min-width="100"
></el-table-column>
<el-table-column
label="存档部门"
prop="belong_dept_name"
min-width="120">
</el-table-column>
<el-table-column
label="存档人姓名"
prop="create_by_name"
min-width="120">
</el-table-column>
<el-table-column
label="存档人电话"
prop="contacts"
min-width="100"
></el-table-column>
<el-table-column
label="存档位置"
prop="location"
min-width="100"
></el-table-column>
<el-table-column
label="存档时间"
prop="create_time"
min-width="100"
></el-table-column>
<el-table-column
label="接收人(综合办公室)"
prop="reciver"
min-width="100"
></el-table-column>
<el-table-column
label="备注"
prop="remark"
min-width="100"
></el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="250">
<template #default="scope">
<el-button
link
size="small"
type="primary"
@click="filerecordEidt(scope.row)"
v-auth="'filerecord.update'"
>编辑
</el-button>
<el-popconfirm
title="确定删除吗?"
@confirm="fileDel(scope.row)"
>
<template #reference>
<el-button
link
size="small"
type="danger"
v-auth="'filerecord.delete'"
>删除</el-button
>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
<el-drawer :title="titleMap[type] " v-model="limitedVisible" size="50%">
<el-form
:model="addForm"
:rules="rules"
ref="addForm"
label-width="100px"
label-position="left"
>
<el-form-item label="资料名称" prop="name">
<el-input v-model="addForm.name" clearable></el-input>
</el-form-item>
<el-form-item label="档案编号" prop="number">
<el-input v-model="addForm.number" clearable></el-input>
</el-form-item>
<el-form-item label="文件份数" prop="counts">
<el-input v-model="addForm.counts" clearable></el-input>
</el-form-item>
<el-form-item label="存放位置" prop="location">
<el-input v-model="addForm.location" clearable></el-input>
</el-form-item>
<el-form-item label="存档人电话" prop="contacts">
<el-input v-model="addForm.contacts" clearable></el-input>
</el-form-item>
<el-form-item label="接收人(综合办)" prop="reciver" label-width="120px">
<el-input v-model="addForm.reciver" clearable></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark" type="textarea">
<el-input v-model="addForm.remark" clearable></el-input>
</el-form-item>
</el-form>
<template #footer>
<el-button
v-auth="'filerecord.create'"
v-if="type !== 'show'"
type="primary"
:loading="isSaving"
@click="submitHandle()"
> </el-button
>
</template>
</el-drawer>
</template>
<script>
export default {
name: "index",
data() {
return {
workflowName:"",
workFlowId:'',
apiObj: this.$API.ofm.filerecord.list,
selection: [],
checkList: [],
transitions:[],
timeRange: [],
query: {},
editId: null,
isSaving: false,
limitedVisible: false,
limitedWatch: false,
type: "add",
titleMap: {
add: "新增",
edit: "编辑",
show: "查看",
},
//
addForm: {
name: null,
number: null,
counts: null,
location: null,
contacts: null,
reciver: "",
remark: ""
},
};
},
methods: {
handleAdd() {
this.type = "add";
this.addForm = this.getDefaultForm();
this.limitedVisible = true;
},
handleAdd_outer() {
this.addForm = this.getDefaultForm();
this.type = "add";
this.limitedVisible = true;
this.lending_type = "outer";
this.addForm.is_lending = true;
},
handleCancel() {
this.limitedVisible = false; //
this.lending_type = ""; // lending_type
this.getDefaultForm()//
},
submitHandle() {
let that = this;
that.isSaving = true;
that.submit();
},
getDefaultForm(){
return {
name: null,
number: null,
counts: null,
location: null,
contacts: null,
reciver: "",
remark: ""
}
},
async submit() {
let that = this;
let res = null;
try {
if (that.type === "add") {
res = await that.$API.ofm.filerecord.create.req(that.addForm);
} else {
res = await that.$API.ofm.filerecord.update.req(
that.editId,
that.addForm
);
}
that.isSaving = false;
that.limitedVisible = false;
that.$refs.table.refresh();
} catch (e) {
that.isSaving = false;
}
},
//
filerecordEidt(row) {
this.type = "edit";
this.editId = row.id;
this.limitedVisible = true;
this.addForm = Object.assign({}, row);
},
async filerecordDel(row) {
var id = row.id;
var res = await this.$API.ofm.filerecord.delete.req(id);
if (res.err_msg) {
this.$message.error(res.err_msg);
} else {
this.$refs.table.refresh();
this.$message.success("删除成功");
}
},
//
handleQuery() {
this.$refs.table.queryData(this.query);
},
},
};
</script>
<style scoped>
.treeMain {
height: 280px;
overflow: auto;
border: 1px solid #dcdfe6;
margin-bottom: 10px;
}
::-webkit-scrollbar {
width: 10px;
}
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.2);
background-color: #fefefe;
border-radius: 5px;
}
::-webkit-scrollbar-thumb {
border-radius: 5px;
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
background-color: #f5f5f5;
}
.node rect {
stroke: #606266;
fill: #fff;
}
.edgePath path {
stroke: #606266;
fill: #333;
stroke-width: 1.5px;
}
g.conditions > rect {
fill: #00ffd0;
stroke: #000;
}
.el-icon-close {
cursor: pointer;
}
.left-panel-group {
display: flex;
align-items: center;
gap: 6px; /* 按钮之间的间隙,可以调小点 */
margin-left: 0; /* 靠左 */
}
</style>

View File

@ -0,0 +1,89 @@
<template>
<el-container>
<el-main>
<el-form
:model="addForm"
:rules="rules"
ref="addForm"
label-width="100px"
label-position="left"
>
<el-form-item label="资料名称" prop="name">
<el-input v-model="addForm.name" clearable :disabled="mode==='view'"></el-input>
</el-form-item>
<el-form-item label="档案编号" prop="number">
<el-input v-model="addForm.number" clearable :disabled="mode==='view'"></el-input>
</el-form-item>
<el-form-item label="文件份数" prop="counts">
<el-input v-model="addForm.counts" clearable :disabled="mode==='view'"></el-input>
</el-form-item>
<el-form-item label="存放位置" prop="location">
<el-input v-model="addForm.location" clearable :disabled="mode==='view'"></el-input>
</el-form-item>
<el-form-item label="存档人电话" prop="contacts">
<el-input v-model="addForm.contacts" clearable :disabled="mode==='view'"></el-input>
</el-form-item>
<el-form-item label="接收人(综合办)" prop="reciver" label-width="120px">
<el-input v-model="addForm.reciver" clearable :disabled="mode==='view'"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark" type="textarea">
<el-input v-model="addForm.remark" clearable :disabled="mode==='view'"></el-input>
</el-form-item>
</el-form>
<el-footer v-show="mode!=='show'">
<ticketd_b_start
:workflow_key="'borrowrecord'"
:title="ticketTitle"
:t_id="addForm.id"
:ticket_="addForm.ticket_"
:submit_b_func="submit_b_func"
:ticket_data="ticket_data"
ref="ticketd_b_start"
@success="$emit('success')"
@colsed="$emit('closed')"
/>
</el-footer>
</el-main>
<el-aside width="20%" v-if="addForm.ticket_">
<ticketd ::ticket_="addForm.ticket_" @success="$emit('success')"></ticketd>
</el-aside>
</el-container>
</template>
<script>
import ticketd_b_start from "@/views/wf/ticketd_b_start.vue";
import ticketd from '@/views/wf/ticketd.vue'
export default {
props: {
mode: { type: String, default: "view" }, // add / edit / view
modelValue: { type: Object, default: () => ({}) },
transitions: { type: Array, default: () => [] },
},
components: {ticketd, ticketd_b_start},
emits: ["update:modelValue", "submit", "cancel"],
data(){
return {
addForm: { ...this.modelValue },
ticketTitle: "档案申请",
rules:{
filename: [{ required: true, message: "请输入文件名称", trigger: "blur" }],
},
}
},
methods:{
async submit_b_func() {
let that = this;
this.ticketTitle = `${this.addForm.name}-档案申请`
if(that.mode == "add") {
let res = await that.$API.ofm.filerecord.create.req(that.addForm);
that.addForm.id = res.id;
} else if (that.mode == "edit") {
await that.$API.ofm.filerecord.update.req(that.addForm.id, that.addForm);
}
},
},
}
</script>

View File

@ -69,9 +69,9 @@
type="primary"
@click="borrowEidt(scope.row)"
v-auth="'fileborrow.update'"
>编辑
>详情
</el-button>
<el-popconfirm
<!-- <el-popconfirm
title="确定删除吗?"
@confirm="borrowDel(scope.row)"
>
@ -84,85 +84,36 @@
>删除</el-button
>
</template>
</el-popconfirm>
</el-popconfirm> -->
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
<el-drawer :title="titleMap[type] " v-model="limitedVisible" size="50%">
<el-form
:model="addForm"
:rules="rules"
ref="addForm"
label-width="100px"
label-position="left"
>
<el-form-item label="档案名称">
<el-select v-model="addForm.borrow_file" multiple placeholder="请选择档案" clearable style="width: 300px;">
<el-option
v-for="item in fileList"
:key="item.id"
:value="item.id"
:label="item.name"></el-option>
</el-select>
</el-form-item>
<el-form-item label="申请人电话" prop="contacts">
<el-input v-model="addForm.contacts" clearable style="width: 300px;"></el-input>
</el-form-item>
<el-form-item label="借阅时间" prop="borrow_date">
<el-date-picker
v-model="addForm.borrow_date"
type="date"
placeholder="选择日期时间"
align="right"
value-format="YYYY-MM-DD"
>
</el-date-picker>
</el-form-item>
<el-form-item label="归还时间" prop="return_date">
<el-date-picker
v-model="addForm.return_date"
type="date"
placeholder="选择日期时间"
align="right"
value-format="YYYY-MM-DD"
>
</el-date-picker>
</el-form-item>
<el-form-item label="用途" prop="remark">
<el-checkbox-group v-model="addForm.remark">
<el-checkbox label="借阅"></el-checkbox>
<el-checkbox label="复印"></el-checkbox>
<el-checkbox label="查阅"></el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-drawer :title="titleMap[type] "
v-model="limitedVisible"
direction="rtl"
size="70%">
</el-form>
<template #footer>
<el-button
v-for="item in transitions"
:key="item.id"
type="primary"
:loading="isSaving"
:disabled="isSaving"
@click="submitTicketCreate(item.id)"
style="margin-right: 4px"
>{{ item.name }}</el-button>
<el-button @click="handleCancel"> </el-button>
<el-button
v-auth="'fileborrow.return'"
v-if="type !== 'show'"
type="primary"
:loading="isSaving"
@click="submitHandle()"
> </el-button
>
</template>
<div style="display: flex; height: calc(100% - 60px);">
<div style="flex: 1; padding-right: 20px; overflow-y: auto;">
<borrowlForm
:mode="type"
v-model="addForm"
:lending_type="lending_type"
@success="()=>{handleQuery(); limitedVisible = false}"
@closed="limitedVisible = false"
/>
</div>
</div>
</el-drawer>
</template>
<script>
import borrowlForm from "./borrowfile_form.vue";
export default {
components: { borrowlForm },
name: "index",
data() {
return {
@ -192,7 +143,7 @@ export default {
counts: null,
location: null,
contacts: null,
ticket: null,
ticket_: null,
reciver: "",
remark: [],
},
@ -201,13 +152,12 @@ export default {
mounted(){
let that = this;
that.getInit();
this.getFileList();
},
methods: {
getInit() {
let that = this;
if(this.addForm.ticket!==null){
this.$API.wf.ticket.ticketTransitions.req(this.addForm.ticket).then((res) => {
if(this.addForm.ticket_!==null){
this.$API.wf.ticket_.ticketTransitions.req(this.addForm.ticket_).then((res) => {
that.transitions = res;
})
}else{
@ -222,21 +172,12 @@ export default {
this.addForm = this.getDefaultForm();
this.limitedVisible = true;
},
getFileList() {
this.$API.ofm.filerecord.list.req(this.query).then((res) => {
this.fileList = res.results;
});
},
handleCancel() {
this.limitedVisible = false; //
this.lending_type = ""; // lending_type
this.getDefaultForm()//
},
submitHandle() {
let that = this;
that.isSaving = true;
that.submit();
},
getDefaultForm(){
return {
borrow_file: [],
@ -244,108 +185,28 @@ export default {
counts: null,
location: null,
contacts: null,
ticket_:null,
reciver: "",
remark: [],
}
},
async submit() {
let that = this;
let res = null;
try {
if (that.type === "add") {
res = await that.$API.ofm.borrow.create.req(that.addForm);
} else {
res = await that.$API.ofm.borrow.update.req(
that.editId,
that.addForm
);
}
that.isSaving = false;
that.limitedVisible = false;
that.$refs.table.refresh();
} catch (e) {
that.isSaving = false;
}
},
submitTicketCreate(id) {
let that = this;
if(that.type == "add") {
that.$API.ofm.borrow.create.req(that.addForm).then((res) => {
let ticket = {};
ticket.title = '档案借阅审批单';
ticket.workflow = that.initForm.workflow;
ticket.ticket_data = {t_id: res.id};
ticket.transition = id;
that.$API.wf.ticket.create.req(ticket).then((res) => {
that.isSaving = false;
that.limitedVisible = false;
that.$emit("success");
that.$refs.table.refresh();
that.$message.success("提交成功");
}).catch((e) => {
that.isSaving = false;
});
}).catch((e) => {
that.isSaving = false;
});
} else if (that.type == "edit") {
that.$API.ofm.borrow.update.req(that.addForm.id, that.addForm).then((res) => {
if (that.addForm.ticket == null) {
let ticket = {};
ticket.title = '档案借阅审批单';
ticket.workflow = that.initForm.workflow;
ticket.ticket_data = {t_id: res.id};
ticket.transition = id;
that.$API.wf.ticket.create.req(ticket).then((res) => {
that.isSaving = false;
that.limitedVisible = false;
that.$emit("success");
that.$message.success("提交成功");
that.$refs.table.refresh();
}).catch((e) => {
that.isSaving = false;
});
} else {
let data = {transition: id, ticket_data: {}}
that.$API.wf.ticket.ticketHandle.req(that.addForm.ticket, data).then(res=>{
that.isSaving = false;
that.limitedVisible = false;
that.$emit("success");
that.$message.success("提交成功");
that.$refs.table.refresh();
}).catch((e) => {
that.isSaving = false;
})
}
}).catch((err) => {
that.isSaving = false;
return err;
});
}
},
//
borrowEidt(row) {
this.type = "edit";
this.type = "view";
this.editId = row.id;
this.limitedVisible = true;
if (!this.fileList || this.fileList.length === 0) {
this.getFileList();
}
this.addForm = Object.assign({}, row);
if(row.file_detail){
this.addForm.borrow_file = row.file_detail.map(item => item.id);
}
},
async borrowDel(row) {
var id = row.id;
var res = await this.$API.ofm.borrow.delete.req(id);
if (res.err_msg) {
this.$message.error(res.err_msg);
} else {
this.$refs.table.refresh();
this.$message.success("删除成功");
}
},
// async borrowDel(row) {
// var id = row.id;
// var res = await this.$API.ofm.borrow.delete.req(id);
// if (res.err_msg) {
// this.$message.error(res.err_msg);
// } else {
// this.$refs.table.refresh();
// this.$message.success("");
// }
// },
//
handleQuery() {
this.$refs.table.queryData(this.query);

View File

@ -0,0 +1,185 @@
<template>
<el-container>
<el-main>
<el-form
:model="addForm"
:rules="rules"
ref="addForm"
label-width="100px"
label-position="left"
>
<el-form-item label="档案名称">
<el-select v-model="addForm.borrow_file" multiple placeholder="请选择档案" clearable style="width: 300px;">
<el-option
v-for="item in fileList"
:key="item.id"
:value="item.id"
:disabled="mode==='view'"
:label="item.name"></el-option>
</el-select>
</el-form-item>
<el-form-item label="申请人电话" prop="contacts">
<el-input v-model="addForm.contacts" clearable style="width: 300px;" :disabled="mode==='view'"></el-input>
</el-form-item>
<el-form-item label="借阅时间" prop="borrow_date">
<el-date-picker
v-model="addForm.borrow_date"
type="date"
placeholder="选择日期时间"
align="right"
value-format="YYYY-MM-DD"
:disabled="mode==='view'"
>
</el-date-picker>
</el-form-item>
<el-form-item label="归还时间" prop="return_date">
<el-date-picker
v-model="addForm.return_date"
type="date"
placeholder="选择日期时间"
align="right"
value-format="YYYY-MM-DD"
:disabled="mode==='view'"
>
</el-date-picker>
</el-form-item>
<el-form-item label="用途" prop="remark" :disabled="mode==='view'">
<el-checkbox-group v-model="addForm.remark">
<el-checkbox label="借阅"></el-checkbox>
<el-checkbox label="复印"></el-checkbox>
<el-checkbox label="查阅"></el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-form>
<el-footer v-show="mode!=='show'">
<ticketd_b_start
:workflow_key="'borrowrecord'"
:title="ticketTitle"
:t_id="addForm.id"
:ticket_="addForm.ticket_"
:submit_b_func="submit"
ref="ticketd_b_start"
@success="$emit('success')"
/>
<el-button @click="$emit('closed')">取消</el-button>
</el-footer>
</el-main>
<el-aside v-if="addForm.ticket">
<ticketd
:ticket_="addForm.ticket_"
@success="$emit('success')"
style="margin-top: 20px;"
/>
</el-aside>
</el-container>
</template>
<script>
import ticketd_b_start from "@/views/wf/ticketd_b_start.vue";
import ticketd from "@/views/wf/ticketd.vue";
export default {
name: "index",
props: {
mode: {
type: String, default: "view"
},
modelValue: { type: Object, default: () => ({}) },
},
components: {
ticketd, ticketd_b_start
},
data() {
return {
ticketTitle: "档案借阅",
addForm: {...this.modelValue},
query: {},
fileList: [],
rules: {
file_name: [
{ required: true, message: "请选择档案", trigger: "blur" },
],
},
};
},
mounted(){
this.getFileList();
},
methods: {
async submit() {
let that = this;
let res = null;
this.ticketTitle = `${this.addForm.file_name}-档案借阅`;
if (that.mode === "add") {
res = await that.$API.ofm.borrow.create.req(that.addForm);
that.addForm.id = res.id;
} else if (that.mode === "edit") {
res = await that.$API.ofm.borrow.update.req(
that.addForm.id,
that.addForm
);
}
},
getFileList() {
this.$API.ofm.filerecord.list.req(this.query).then((res) => {
this.fileList = res.results;
});
},
},
};
</script>
<style scoped>
.treeMain {
height: 280px;
overflow: auto;
border: 1px solid #dcdfe6;
margin-bottom: 10px;
}
::-webkit-scrollbar {
width: 10px;
}
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.2);
background-color: #fefefe;
border-radius: 5px;
}
::-webkit-scrollbar-thumb {
border-radius: 5px;
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
background-color: #f5f5f5;
}
.node rect {
stroke: #606266;
fill: #fff;
}
.edgePath path {
stroke: #606266;
fill: #333;
stroke-width: 1.5px;
}
g.conditions > rect {
fill: #00ffd0;
stroke: #000;
}
.el-icon-close {
cursor: pointer;
}
.left-panel-group {
display: flex;
align-items: center;
gap: 6px; /* 按钮之间的间隙,可以调小点 */
margin-left: 0; /* 靠左 */
}
</style>

View File

@ -167,7 +167,7 @@ export default {
mode: "add",
drawerTitle: {
add: "新增印章使用",
edit: "编辑印章使用",
edit: "审批流",
view: "查看印章使用",
},
currentRow: null,
@ -185,7 +185,7 @@ export default {
return_date: null,
actual_return_date: null,
reason: "",
ticket:null
ticket_:null
},
};
},
@ -198,8 +198,8 @@ export default {
//
getInit() {
let that = this;
if(this.addForm.ticket!==null){
this.$API.wf.ticket.ticketTransitions.req(this.addForm.ticket).then((res) => {
if(this.addForm.ticket_!==null){
this.$API.wf.ticket_.ticketTransitions.req(this.addForm.ticket_).then((res) => {
that.transitions = res;
})
}else{
@ -242,12 +242,12 @@ export default {
return_date: null,
actual_return_date: null,
reason: "",
ticket:null
ticket_:null
}
},
//
sealEidt(row) {
this.mode = "edit";
this.mode = "view";
this.editId = row.id;
this.limitedVisible = true;
this.lending_type = 'outer';

View File

@ -1,104 +1,102 @@
<template>
<el-container>
<el-main>
<el-form :model="localForm" label-width="100px" label-position="left" :rules="rules">
<el-form-item label="文件名称" prop="filename">
<el-input v-model="localForm.filename" clearable></el-input>
</el-form-item>
<el-form-item label="联系电话" prop="contacts">
<el-input v-model="localForm.contacts" clearable></el-input>
</el-form-item>
<el-form :model="localForm" label-width="100px" label-position="left" :rules="rules">
<el-form-item label="文件名称" prop="filename">
<el-input v-model="localForm.filename" clearable :disabled="mode==='view'"></el-input>
</el-form-item>
<el-form-item label="联系电话" prop="contacts">
<el-input v-model="localForm.contacts" clearable :disabled="mode==='view'"></el-input>
</el-form-item>
<el-form-item label="印章类型">
<el-checkbox-group v-model="localForm.seal">
<el-checkbox label="公章"></el-checkbox>
<el-checkbox label="法人章"></el-checkbox>
<el-checkbox label="合同章"></el-checkbox>
<el-checkbox label="财务章"></el-checkbox>
<el-checkbox label="其他"></el-checkbox>
</el-checkbox-group>
<el-input
v-if="localForm.seal.includes('其他')"
v-model="localForm.seal_other"
placeholder = "请输入印章名称"
size = "small"
style="margin-top: 10;"
></el-input>
</el-form-item>
<template v-if="lending_type === 'outer'">
<el-form-item label="借用日期">
<el-date-picker
v-model="timeRange"
type="daterange"
<el-form-item label="印章类型">
<el-checkbox-group v-model="localForm.seal" :disabled="mode==='view'">
<el-checkbox label="公章"></el-checkbox>
<el-checkbox label="法人章"></el-checkbox>
<el-checkbox label="合同章"></el-checkbox>
<el-checkbox label="财务章"></el-checkbox>
<el-checkbox label="其他"></el-checkbox>
</el-checkbox-group>
<el-input
v-if="localForm.seal.includes('其他')"
v-model="localForm.seal_other"
placeholder = "请输入印章名称"
size = "small"
style="margin-top: 10;"
></el-input>
</el-form-item>
<template v-if="lending_type === 'outer'">
<el-form-item label="借用日期">
<el-date-picker
v-model="timeRange"
type="daterange"
align="right"
value-format="YYYY-MM-DD"
unlink-panels
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:disabled="mode==='view'"
@change="handleDateChange">
</el-date-picker>
</el-form-item>
<el-form-item label="实际归还日期" v-auth="'seal.return'">
<el-date-picker
v-model="localForm.actual_return_date"
type="date"
align="right"
value-format="YYYY-MM-DD"
unlink-panels
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="handleDateChange">
</el-date-picker>
placeholder="选择日期"
:disabled="mode==='view'"
>
</el-date-picker>
</el-form-item>
<el-form-item label="借用理由" prop="reason" >
<el-input
type='textarea'
placeholder="请输入借用理由"
v-model="localForm.reason"
rows = '3'
:disabled="mode==='view'">
</el-input>
</el-form-item>
</template>
<el-form-item label="文件内容">
<sc-upload-file
v-model="localForm.file"
:multiple="false"
:limit="1"
:accept="['.xlsx', '.xls','.pdf','.docx', '.doc', '.jpg', '.png', '.jpeg']"
@success = "fileUPSuccess"
:disabled="mode==='view'"
>
<el-button type="primary" icon="el-icon-upload"> </el-button>
</sc-upload-file>
</el-form-item>
<el-form-item label="实际归还日期" v-auth="'seal.return'">
<el-date-picker
v-model="localForm.actual_return_date"
type="date"
align="right"
value-format="YYYY-MM-DD"
unlink-panels
placeholder="选择日期"
>
</el-date-picker>
<el-form-item label="用印份数" prop="file_count">
<el-input v-model="localForm.file_count" clearable :disabled="mode==='view'"></el-input>
</el-form-item>
<el-form-item label="借用理由" prop="reason" >
<el-input
type='textarea'
placeholder="请输入借用理由"
v-model="localForm.reason"
rows = '3'>
</el-input>
</el-form-item>
</template>
<el-form-item label="文件内容">
<sc-upload-file
v-model="localForm.file"
:multiple="false"
:limit="1"
:accept="['.xlsx', '.xls','.pdf','.docx', '.doc', '.jpg', '.png', '.jpeg']"
@success = "fileUPSuccess"
>
<el-button type="primary" icon="el-icon-upload"> </el-button>
</sc-upload-file>
</el-form-item>
<el-form-item label="用印份数" prop="file_count">
<el-input v-model="localForm.file_count" clearable></el-input>
</el-form-item>
<el-form-item v-if="!isView">
<el-button type="primary" @click="onSubmit">保存</el-button>
<el-button @click="$emit('cancel')">取消</el-button>
</el-form-item>
</el-form>
</el-form>
<el-footer v-show="mode!=='show'">
<ticketd_b_start
:workflow_key="'seal'"
:title="ticketTitle"
:t_id="localForm.id"
:ticketId="localForm.ticket"
:ticket_="localForm.ticket_"
:submit_b_func="submit_b_func"
ref="ticketd_b_start"
@success="$emit('success')"
/>
<el-button @click="$emit('closed')">取消</el-button>
</el-footer>
</el-footer>
</el-main>
<el-aside v-if="localForm.ticket">
<ticketd
:ticketId="localForm.ticket"
@success="$emit('success')"
style="margin-top: 20px;"
<ticketd
:ticket_="localForm.ticket_"
@success="$emit('success')"
style="margin-top: 20px;"
/>
</el-aside>
</el-container>
@ -113,7 +111,6 @@ export default {
lending_type: { type: String, default: "outer" }, // inner / outer
modelValue: { type: Object, default: () => ({}) },
},
components: {ticketd, ticketd_b_start },
emits: ["update:modelValue", "submit", "cancel"],
data() {
@ -125,11 +122,6 @@ export default {
filename: [{ required: true, message: "请输入文件名称", trigger: "blur" }],
},
};
},
computed: {
isView() {
return this.mode === "view";
},
},
mounted() {
this.initTimeRange();
@ -149,12 +141,9 @@ export default {
this.$emit("update:modelValue", val);
},
deep: true,
}
},
},
methods: {
onSubmit() {
this.$emit("submit", this.localForm);
},
handleDateChange(val) {
this.localForm.lending_date = val?.[0] || null
this.localForm.return_date = val?.[1] || null

View File

@ -33,6 +33,13 @@
prop="reason"
min-width="120">
</el-table-column>
<el-table-column label="市内用车" prop="is_city" mim-width="100">
<template #default="scope">
<span :style="{color: scope.row.is_city ? '#67C23A' : '#F56C6C'}">
{{ scope.row.is_city ? '是' : '否'}}
</span>
</template>
</el-table-column>
<el-table-column
label="出车时间"
prop="start_time"
@ -81,7 +88,7 @@
type="primary"
@click="vehicleEidt(scope.row)"
v-auth="'vehicle.update'"
>编辑
>详情
</el-button>
<!-- <el-popconfirm
title="确定删除吗?"
@ -102,79 +109,34 @@
</scTable>
</el-main>
</el-container>
<el-drawer :title="titleMap[type] " v-model="limitedVisible" direction="rtl" size="50%">
<el-form
:model="addForm"
:rules="rules"
ref="addForm"
label-width="100px"
label-position="left"
>
<el-form-item label="用车事由" prop="reason">
<el-input v-model="addForm.reason" clearable></el-input>
</el-form-item>
<el-form-item label="出发地点" prop="location">
<el-input v-model="addForm.location" clearable></el-input>
</el-form-item>
<el-form-item label="途经地点" prop="via">
<el-input v-model="addForm.via" clearable></el-input>
</el-form-item>
<el-form-item label="到达地点" prop="destination">
<el-input v-model="addForm.destination" clearable></el-input>
</el-form-item>
<el-form-item label="出发公里数" prop="start_km">
<el-input v-model="addForm.start_km" clearable></el-input>
</el-form-item>
<el-form-item label="归还公里数" prop="end_km">
<el-input v-model="addForm.end_km" clearable></el-input>
</el-form-item>
<el-form-item label="出车时间">
<el-date-picker
v-model="addForm.start_time"
type="date"
align="right"
value-format="YYYY-MM-DD"
unlink-panels
placeholder="选择日期"
>
</el-date-picker>
</el-form-item>
<el-form-item label="还车时间" v-auth="'vehicle.return'">
<el-date-picker
v-model="addForm.end_time"
type="date"
align="right"
value-format="YYYY-MM-DD"
unlink-panels
placeholder="选择日期"
>
</el-date-picker>
</el-form-item>
</el-form>
<template #footer>
<el-button
v-for="item in transitions"
:key="item.id"
type="primary"
:loading="isSaving"
:disabled="isSaving"
@click="submitTicketCreate(item.id)"
style="margin-right: 4px"
>{{ item.name }}</el-button>
<el-button @click="handleCancel"> </el-button>
<el-button
v-auth="'vehicle.return'"
v-if="type !== 'show'"
type="primary"
:loading="isSaving"
@click="submitHandle()"
> </el-button
>
</template>
<el-drawer
:title="drawerTitle[type]"
v-model="limitedVisible"
:destroy-on-close="true"
direction="rtl"
size="70%">
<div style="display: flex; height: calc(100% - 60px);">
<div style="flex: 1; padding-right: 20px; overflow-y: auto;">
<VehicleForm
:mode="type"
v-model="addForm"
:lending_type="lending_type"
:transitions="transitions"
@success="()=>{handleQuery(); limitedVisible = false}"
@closed="limitedVisible = false"
@submit="saveVehicle"
/>
</div>
</div>
</el-drawer>
</template>
<script>
import VehicleForm from "./vehicleForm.vue";
export default {
components: {
VehicleForm
},
name: "index",
data() {
return {
@ -183,8 +145,12 @@ export default {
apiObj: this.$API.ofm.vehicle.list,
selection: [],
checkList: [],
fileList: [],
transitions:[],
drawerTitle: {
add: "新增车辆使用",
edit: "编辑车辆使用",
view: "查看车辆使用",
},
timeRange: [],
lending_type: "",
choiceOption: [],
@ -194,11 +160,6 @@ export default {
limitedVisible: false,
limitedWatch: false,
type: "add",
titleMap: {
add: "新增",
edit: "编辑",
show: "查看",
},
//
addForm: {
start_time: null,
@ -206,11 +167,11 @@ export default {
location: null,
via: null,
destination: null,
start_km: "",
end_km: "",
start_km: null,
end_km: null,
is_city: true,
reason: null,
ticket:null
ticket_:null
},
};
},
@ -219,99 +180,29 @@ export default {
that.getInit();
},
methods: {
//
//
getInit() {
let that = this;
if(this.addForm.ticket!==null){
this.$API.wf.ticket.ticketTransitions.req(this.addForm.ticket).then((res) => {
that.transitions = res;
})
}else{
that.$API.wf.workflow.initkey.req("vehicle").then((res) => {
that.initForm = res;
that.transitions = res.transitions;
});
}
},
let that = this;
if(this.addForm.ticket_!==null){
this.$API.wf.ticket_.ticketTransitions.req(this.addForm.ticket_).then((res) => {
that.transitions = res;
})
}else{
that.$API.wf.workflow.initkey.req("vehicle").then((res) => {
that.initForm = res;
that.transitions = res.transitions;
});
}
},
handleAdd() {
this.type = "add";
this.addForm = this.getDefaultForm();
this.limitedVisible = true;
},
handleAdd_outer() {
this.addForm = this.getDefaultForm();
this.type = "add";
this.limitedVisible = true;
this.lending_type = "outer";
this.addForm.is_lending = true;
},
handleCancel() {
this.limitedVisible = false; //
this.lending_type = ""; // lending_type
this.getDefaultForm()//
},
submitTicketCreate(id) {
let that = this;
if(that.type == "add") {
that.$API.ofm.vehicle.create.req(that.addForm).then((res) => {
let ticket = {};
ticket.title = '车辆使用审批单';
ticket.workflow = that.initForm.workflow;
ticket.ticket_data = {t_id: res.id};
ticket.transition = id;
that.$API.wf.ticket.create.req(ticket).then((res) => {
that.isSaving = false;
that.limitedVisible = false;
that.$emit("success");
that.$refs.table.refresh();
that.$message.success("提交成功");
}).catch((e) => {
that.isSaving = false;
});
}).catch((e) => {
that.isSaving = false;
});
} else if (that.type == "edit") {
that.$API.ofm.vehicle.update.req(that.addForm.id, that.addForm).then((res) => {
if (that.addForm.ticket == null) {
let ticket = {};
ticket.title = '车辆使用审批单';
ticket.workflow = that.initForm.workflow;
ticket.ticket_data = {t_id: res.id};
ticket.transition = id;
that.$API.wf.ticket.create.req(ticket).then((res) => {
that.isSaving = false;
that.limitedVisible = false;
that.$emit("success");
that.$message.success("提交成功");
that.$refs.table.refresh();
}).catch((e) => {
that.isSaving = false;
});
} else {
let data = {transition: id, ticket_data: {}}
that.$API.wf.ticket.ticketHandle.req(that.addForm.ticket, data).then(res=>{
that.isSaving = false;
that.limitedVisible = false;
that.$emit("success");
that.$message.success("提交成功");
that.$refs.table.refresh();
}).catch((e) => {
that.isSaving = false;
})
}
}).catch((err) => {
that.isSaving = false;
return err;
});
}
},
submitHandle() {
let that = this;
that.isSaving = true;
that.submit();
},
getDefaultForm(){
return {
start_time: null,
@ -319,39 +210,35 @@ export default {
location: null,
via: null,
destination: null,
start_km: "",
end_km: "",
start_km: null,
end_km: null,
is_city: true,
reason: null,
ticket:null
}
},
async submit() {
let that = this;
let res = null;
try {
if (that.type === "add") {
res = await that.$API.ofm.vehicle.create.req(that.addForm);
} else {
res = await that.$API.ofm.vehicle.update.req(
that.editId,
that.addForm
);
}
that.isSaving = false;
that.limitedVisible = false;
that.$refs.table.refresh();
} catch (e) {
that.isSaving = false;
ticket_:null
}
},
//
vehicleEidt(row) {
this.type = "edit";
this.type = "view";
this.editId = row.id;
this.limitedVisible = true;
this.addForm = Object.assign({}, row);
},
//
saveVehicle() {
this.isSaving = true;
this.$API.ofm.vehicle.update.req(this.addForm.id, this.addForm).then((res) => {
this.isSaving = false;
if (res.err_code) {
this.$message.error(res.err_msg);
} else {
this.$message.success("更新成功");
this.limitedVisible = false;
this.$refs.table.refresh();
}
});
}
},
async vehicleDel(row) {
var id = row.id;
var res = await this.$API.ofm.vehicle.delete.req(id);
@ -366,7 +253,6 @@ export default {
handleQuery() {
this.$refs.table.queryData(this.query);
},
},
};
</script>

View File

@ -0,0 +1,152 @@
<template>
<el-container>
<el-main>
<el-form
:model="addForm"
:rules="rules"
ref="addForm"
label-width="100px"
label-position="left"
>
<el-form-item label="用车事由" prop="reason">
<el-input v-model="addForm.reason" clearable :disabled="mode==='view'"></el-input>
</el-form-item>
<el-form-item label="用车范围" prop="is_city">
<el-select v-model="addForm.is_city" placeholder="请选择" :disabled="mode==='view'">
<el-option
v-for="item in vehicle_scope"
:key="item.is_city"
:label="item.name"
:value="item.is_city"
/>
</el-select>
</el-form-item>
<el-form-item label="出发地点" prop="location">
<el-input v-model="addForm.location" clearable :disabled="mode==='view'"></el-input>
</el-form-item>
<el-form-item label="途经地点" prop="via">
<el-input v-model="addForm.via" clearable :disabled="mode==='view'"></el-input>
</el-form-item>
<el-form-item label="到达地点" prop="destination">
<el-input v-model="addForm.destination" clearable :disabled="mode==='view'"></el-input>
</el-form-item>
<el-form-item label="出发公里数" prop="start_km">
<el-input-number v-model="addForm.start_km" clearable :disabled="mode==='view'"></el-input-number>
</el-form-item>
<el-form-item label="归还公里数" prop="end_km">
<el-input-number v-model="addForm.end_km" clearable></el-input-number>
</el-form-item>
<el-form-item label="出车时间">
<el-date-picker
v-model="addForm.start_time"
type="date"
align="right"
value-format="YYYY-MM-DD"
unlink-panels
placeholder="选择日期"
:disabled="mode==='view'"
>
</el-date-picker>
</el-form-item>
<el-form-item label="还车时间" v-auth="'vehicle.return'">
<el-date-picker
v-model="addForm.end_time"
type="date"
align="right"
value-format="YYYY-MM-DD"
unlink-panels
placeholder="选择日期"
:disabled="mode==='view'"
>
</el-date-picker>
</el-form-item>
</el-form>
<el-footer v-show="mode!=='show'">
<ticketd_b_start
:workflow_key="'vehicle'"
:title="ticketTitle"
:t_id="addForm.id"
:ticket_="addForm.ticket_"
:submit_b_func="submit_b_func"
:ticket_data="ticket_data"
ref="ticketd_b_start"
@success="$emit('success')"
@colsed="$emit('closed')"
/>
<el-button type='primary' @click="$emit('submit')">保存</el-button>
</el-footer>
</el-main>
<el-aside v-if="addForm.ticket_">
<ticketd
:ticket_="addForm.ticket_"
:ticket_data="ticket_data"
@success="$emit('success')"
style="margin-top: 20px;"
/>
</el-aside>
</el-container>
</template>
<script>
import ticketd_b_start from "@/views/wf/ticketd_b_start.vue";
import ticketd from '@/views/wf/ticketd.vue'
export default {
props: {
mode: { type: String, default: "view" }, // add / edit / view
lending_type: { type: String, default: "outer" }, // inner / outer
modelValue: { type: Object, default: () => ({}) },
transitions: { type: Array, default: () => [] },
},
components: {ticketd, ticketd_b_start},
emits: ["update:modelValue", "submit", "cancel"],
data() {
return {
addForm: { ...this.modelValue },
ticketTitle: "用车申请",
ticket_data: {},
rules:{
filename: [{ required: true, message: "请输入文件名称", trigger: "blur" }],
},
workflow_key: "vehicle_in",
vehicle_scope:[{name: '市内', is_city: true},{name: '市外', is_city: false}],
}
},
// mounted() {
// console.log(this.transitions)
// },
watch: {
// ->
modelValue: {
handler(val) {
this.addForm = { ...val };
},
deep: true,
},
// ->
addForm: {
handler(val) {
this.$emit("update:modelValue", val);
},
deep: true,
}
},
methods: {
async submit_b_func() {
let that = this;
if (this.addForm.is_city === true){
that.workflow_key = "vehicle"
}else{
that.workflow_key = "vehicle_out"
}
this.ticketTitle = `${this.addForm.reason}-用车申请`
if(that.mode == "add") {
let res = await that.$API.ofm.vehicle.create.req(that.addForm);
that.addForm.id = res.id;
} else if (that.mode == "edit") {
console.log(that.transitions)
await that.$API.ofm.vehicle.update.req(that.addForm.id, that.addForm);
}
},
},
};
</script>

View File

@ -391,9 +391,9 @@ export default {
}else{
that.mode = "show";
}
that.$nextTick(()=>{
that.$refs.ticketd_b_start.init();
})
// that.$nextTick(()=>{
// that.$refs.ticketd_b_start.init();
// })
})
}