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