feat: ofm-veicle 修改车辆审批
This commit is contained in:
parent
be9db47732
commit
a40dd9079a
|
|
@ -154,7 +154,6 @@ export default {
|
||||||
},
|
},
|
||||||
async submit_b_func() {
|
async submit_b_func() {
|
||||||
let that = this;
|
let that = this;
|
||||||
this.ticketTitle = `${this.localForm.filename}-用印申请`
|
|
||||||
if(that.localMode == "add") {
|
if(that.localMode == "add") {
|
||||||
let res = await that.$API.ofm.lendingseal.create.req(that.localForm);
|
let res = await that.$API.ofm.lendingseal.create.req(that.localForm);
|
||||||
that.localForm.id = res.id;
|
that.localForm.id = res.id;
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@
|
||||||
link
|
link
|
||||||
size="small"
|
size="small"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="vehicleEidt(scope.row)"
|
@click="handleShow(scope.row)"
|
||||||
v-auth="'vehicle.update'"
|
v-auth="'vehicle.update'"
|
||||||
>详情
|
>详情
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
@ -128,7 +128,6 @@
|
||||||
<div style="flex: 1; padding-right: 20px; overflow-y: auto;">
|
<div style="flex: 1; padding-right: 20px; overflow-y: auto;">
|
||||||
<VehicleForm
|
<VehicleForm
|
||||||
:mode="type"
|
:mode="type"
|
||||||
:formData="currentRow"
|
|
||||||
:t_id="t_id"
|
:t_id="t_id"
|
||||||
@success="()=>{handleQuery(); limitedVisible = false}"
|
@success="()=>{handleQuery(); limitedVisible = false}"
|
||||||
@closed="limitedVisible = false"
|
@closed="limitedVisible = false"
|
||||||
|
|
@ -151,52 +150,23 @@ export default {
|
||||||
actStateEnum, interveneTypeEnum,
|
actStateEnum, interveneTypeEnum,
|
||||||
apiObj: this.$API.ofm.vehicle.list,
|
apiObj: this.$API.ofm.vehicle.list,
|
||||||
query: {},
|
query: {},
|
||||||
editId: null,
|
|
||||||
isSaving: false,
|
|
||||||
limitedVisible: false,
|
limitedVisible: false,
|
||||||
type: "add",
|
type: "show",
|
||||||
t_id: null,
|
t_id: null,
|
||||||
//表单数据
|
|
||||||
addForm: {
|
|
||||||
start_time: null,
|
|
||||||
end_time: null,
|
|
||||||
location: null,
|
|
||||||
via: null,
|
|
||||||
destination: null,
|
|
||||||
start_km: null,
|
|
||||||
end_km: null,
|
|
||||||
is_city: true,
|
|
||||||
reason: null,
|
|
||||||
ticket_:null
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.type = "add";
|
this.type = "add";
|
||||||
|
this.t_id = null;
|
||||||
this.limitedVisible = true;
|
this.limitedVisible = true;
|
||||||
},
|
},
|
||||||
// 审批流结束之后才可以编辑
|
// 审批流结束之后才可以编辑
|
||||||
vehicleEidt(row) {
|
handleShow(row) {
|
||||||
this.type = "show";
|
this.type = "show";
|
||||||
this.currentRow = row;
|
|
||||||
this.t_id = row.id;
|
this.t_id = row.id;
|
||||||
this.limitedVisible = true;
|
this.limitedVisible = true;
|
||||||
},
|
},
|
||||||
// 更新审批流
|
|
||||||
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) {
|
async vehicleDel(row) {
|
||||||
var id = row.id;
|
var id = row.id;
|
||||||
var res = await this.$API.ofm.vehicle.delete.req(id);
|
var res = await this.$API.ofm.vehicle.delete.req(id);
|
||||||
|
|
|
||||||
|
|
@ -9,29 +9,25 @@
|
||||||
label-position="left"
|
label-position="left"
|
||||||
>
|
>
|
||||||
<el-form-item label="用车事由" prop="reason">
|
<el-form-item label="用车事由" prop="reason">
|
||||||
<el-input v-model="addForm.reason" clearable :disabled="localMode ==='view'"></el-input>
|
<el-input v-model="addForm.reason" clearable :disabled="localMode ==='show'"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="用车范围" prop="is_city">
|
<el-form-item label="用车范围" prop="is_city">
|
||||||
<el-select v-model="addForm.is_city" placeholder="请选择" :disabled="localMode ==='view'">
|
<el-radio-group v-model="addForm.is_city" :disabled="localMode ==='show'">
|
||||||
<el-option
|
<el-radio :label="true">市内</el-radio>
|
||||||
v-for="item in vehicle_scope"
|
<el-radio :label="false">市外</el-radio>
|
||||||
:key="item.is_city"
|
</el-radio-group>
|
||||||
:label="item.name"
|
|
||||||
:value="item.is_city"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="出发地点" prop="location">
|
<el-form-item label="出发地点" prop="location">
|
||||||
<el-input v-model="addForm.location" clearable :disabled="localMode ==='view'"></el-input>
|
<el-input v-model="addForm.location" clearable :disabled="localMode ==='show'"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="途经地点" prop="via">
|
<el-form-item label="途经地点" prop="via">
|
||||||
<el-input v-model="addForm.via" clearable :disabled="localMode ==='view'"></el-input>
|
<el-input v-model="addForm.via" clearable :disabled="localMode ==='show'"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="到达地点" prop="destination">
|
<el-form-item label="到达地点" prop="destination">
|
||||||
<el-input v-model="addForm.destination" clearable :disabled="localMode ==='view'"></el-input>
|
<el-input v-model="addForm.destination" clearable :disabled="localMode ==='show'"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="出发公里数" prop="start_km">
|
<el-form-item label="出发公里数" prop="start_km">
|
||||||
<el-input-number v-model="addForm.start_km" clearable :disabled="localMode ==='view'"></el-input-number>
|
<el-input-number v-model="addForm.start_km" clearable :disabled="localMode ==='show'"></el-input-number>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="归还公里数" prop="end_km" v-if="addForm.ticket_?.state_?.name=='用车中'">
|
<el-form-item label="归还公里数" prop="end_km" v-if="addForm.ticket_?.state_?.name=='用车中'">
|
||||||
<el-input-number v-model="addForm.end_km" clearable>
|
<el-input-number v-model="addForm.end_km" clearable>
|
||||||
|
|
@ -41,21 +37,21 @@
|
||||||
<el-form-item label="出车时间">
|
<el-form-item label="出车时间">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="addForm.start_time"
|
v-model="addForm.start_time"
|
||||||
type="date"
|
type="datetime"
|
||||||
align="right"
|
align="right"
|
||||||
value-format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
unlink-panels
|
unlink-panels
|
||||||
placeholder="选择日期"
|
placeholder="选择日期"
|
||||||
:disabled="mode==='view'"
|
:disabled="mode==='show'"
|
||||||
>
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="还车时间" v-if="addForm.ticket_?.state_?.name=='用车中'">
|
<el-form-item label="还车时间" v-if="addForm.ticket_?.state_?.name=='用车中'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="addForm.end_time"
|
v-model="addForm.end_time"
|
||||||
type="date"
|
type="datetime"
|
||||||
align="right"
|
align="right"
|
||||||
value-format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
unlink-panels
|
unlink-panels
|
||||||
placeholder="选择日期"
|
placeholder="选择日期"
|
||||||
>
|
>
|
||||||
|
|
@ -64,22 +60,19 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-footer>
|
<el-footer>
|
||||||
<ticketd_b
|
<ticketd_b
|
||||||
v-if="ticketed_show"
|
|
||||||
:workflow_key="'vehicle'"
|
:workflow_key="'vehicle'"
|
||||||
:title="用车审批"
|
:title="ticketTitle"
|
||||||
:t_id="addForm.id"
|
:t_id="addForm.id"
|
||||||
:ticket_="addForm.ticket_"
|
|
||||||
:submit_b_func="submit_b_func"
|
:submit_b_func="submit_b_func"
|
||||||
|
:ticket_="addForm.ticket_"
|
||||||
:ticket_data="ticket_data"
|
:ticket_data="ticket_data"
|
||||||
ref="ticketd_b"
|
ref="ticketd_b"
|
||||||
@success="$emit('success')"
|
@success="$emit('success')"
|
||||||
@colsed="$emit('closed')"
|
|
||||||
/>
|
/>
|
||||||
</el-footer>
|
</el-footer>
|
||||||
</el-main>
|
</el-main>
|
||||||
<el-aside v-if="addForm.ticket_">
|
<el-aside v-if="addForm.ticket_">
|
||||||
<ticketd
|
<ticketd
|
||||||
v-if="ticketed_show"
|
|
||||||
:ticket_="addForm.ticket_"
|
:ticket_="addForm.ticket_"
|
||||||
:ticket_data="ticket_data"
|
:ticket_data="ticket_data"
|
||||||
@success="$emit('success')"
|
@success="$emit('success')"
|
||||||
|
|
@ -95,65 +88,32 @@ import ticketd from '@/views/wf/ticketd.vue'
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
mode: {
|
mode: {
|
||||||
type: String, default: "view"
|
type: String, default: "show"
|
||||||
}, // add / edit / view
|
}, // add / edit / show
|
||||||
formData: {
|
|
||||||
type: Object, default: () => ({})
|
|
||||||
},
|
|
||||||
t_id: {
|
t_id: {
|
||||||
type: String,
|
type: String,
|
||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {ticketd, ticketd_b},
|
components: {ticketd, ticketd_b},
|
||||||
emits: ["update:modelValue", "submit", "cancel"],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
addForm: {
|
addForm: {},
|
||||||
ticket_: {
|
|
||||||
state_: { type: '' }
|
|
||||||
},
|
|
||||||
...this.modelValue
|
|
||||||
},
|
|
||||||
ticketed_show: false,
|
|
||||||
ticketTitle: "用车申请",
|
ticketTitle: "用车申请",
|
||||||
ticket_data: {},
|
ticket_data: {},
|
||||||
localMode : this.mode,
|
localMode : this.mode,
|
||||||
rules:{
|
rules:{
|
||||||
filename: [{ required: true, message: "请输入文件名称", trigger: "blur" }],
|
filename: [{ required: true, message: "请输入文件名称", trigger: "blur" }],
|
||||||
},
|
},
|
||||||
workflow_key: "vehicle_in",
|
|
||||||
vehicle_scope:[{name: '市内', is_city: true},{name: '市外', is_city: false}],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.addForm = that.formData;
|
if (that.t_id) {
|
||||||
// if (that.addForm.ticket_?.state_.type===1){
|
that.getTid();
|
||||||
// that.localMode = 'edit'
|
}
|
||||||
// };
|
|
||||||
that.ticket_data = {
|
|
||||||
...that.ticket_data,
|
|
||||||
is_city: that.addForm.is_city,
|
|
||||||
};
|
|
||||||
that.getTid();
|
|
||||||
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// 父组件数据变动 -> 同步到本地
|
|
||||||
modelValue: {
|
|
||||||
handler(val) {
|
|
||||||
this.addForm = { ...val };
|
|
||||||
},
|
|
||||||
deep: true,
|
|
||||||
},
|
|
||||||
// 本地数据变动 -> 同步回父组件
|
|
||||||
addForm: {
|
|
||||||
handler(val) {
|
|
||||||
this.$emit("update:modelValue", val);
|
|
||||||
},
|
|
||||||
deep: true,
|
|
||||||
},
|
|
||||||
addForm: {
|
addForm: {
|
||||||
handler(val) {
|
handler(val) {
|
||||||
Object.assign(this.ticket_data, {
|
Object.assign(this.ticket_data, {
|
||||||
|
|
@ -167,20 +127,14 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async submit_b_func() {
|
async submit_b_func() {
|
||||||
let that = this;
|
let that = this;
|
||||||
if (this.addForm.is_city === true){
|
if(that.localMode == "add") {
|
||||||
that.workflow_key = "vehicle"
|
let res = await that.$API.ofm.vehicle.create.req(that.addForm);
|
||||||
}else{
|
that.addForm.id = res.id;
|
||||||
that.workflow_key = "vehicle_out"
|
} else if (that.localMode == "edit") {
|
||||||
}
|
await that.$API.ofm.vehicle.update.req(that.addForm.id, that.addForm);
|
||||||
this.ticketTitle = `${this.addForm.reason}-用车申请`
|
}
|
||||||
if(that.localMode == "add") {
|
},
|
||||||
let res = await that.$API.ofm.vehicle.create.req(that.addForm);
|
|
||||||
that.addForm.id = res.id;
|
|
||||||
} else if (that.localMode == "edit") {
|
|
||||||
await that.$API.ofm.vehicle.update.req(that.addForm.id, that.addForm);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getTid (){
|
getTid (){
|
||||||
var that = this;
|
var that = this;
|
||||||
if (that.t_id) {
|
if (that.t_id) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue