2024-11-26 15:04:35 +08:00
|
|
|
<!--
|
|
|
|
|
* @Author: SunTao 328867980@qq.com
|
|
|
|
|
* @Date: 2024-11-20 11:58:33
|
|
|
|
|
* @LastEditors: SunTao 328867980@qq.com
|
|
|
|
|
* @LastEditTime: 2024-11-26 15:49:28
|
|
|
|
|
* @FilePath: \znxjxt-ui\src\views\xj\document\maintenance-notice\components\edit-dialog.vue
|
|
|
|
|
* @Description: 养护通知单编辑弹窗
|
|
|
|
|
-->
|
|
|
|
|
<template>
|
|
|
|
|
<div class="edit-dialog">
|
|
|
|
|
<el-form
|
|
|
|
|
class="editForm"
|
|
|
|
|
ref="editForm"
|
|
|
|
|
:model="editForm"
|
|
|
|
|
:rules="rules"
|
|
|
|
|
label-width="7rem"
|
|
|
|
|
>
|
|
|
|
|
<el-row :gutter="24">
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="道路名称:" prop="segmentId">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="editForm.segmentId"
|
|
|
|
|
placeholder="请选择路段"
|
|
|
|
|
clearable
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in segmentList"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="24">
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="开始桩号:" prop="stakeStart">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="editForm.stakeStart"
|
|
|
|
|
placeholder="请输入开始桩号"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="结束桩号:" prop="stakeEnd">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="editForm.stakeEnd"
|
|
|
|
|
placeholder="请输入结束桩号"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="24">
|
|
|
|
|
<el-col :span="24">
|
2024-11-28 11:12:21 +08:00
|
|
|
<el-form-item label="养护负责人:" prop="receiver">
|
2024-11-26 15:04:35 +08:00
|
|
|
<el-input
|
|
|
|
|
clearable
|
2024-11-28 11:12:21 +08:00
|
|
|
v-model="editForm.receiver"
|
2024-11-26 15:04:35 +08:00
|
|
|
placeholder="请输入负责人名称"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="24">
|
2024-11-28 11:12:21 +08:00
|
|
|
<el-form-item label="养护内容:" prop="taskDescription">
|
2024-11-26 15:04:35 +08:00
|
|
|
<fssm-scroll style="max-height: 10rem">
|
|
|
|
|
<div
|
|
|
|
|
class="content-box"
|
2024-11-28 11:12:21 +08:00
|
|
|
v-for="(item, index) in editForm.taskDescription"
|
2024-11-26 15:04:35 +08:00
|
|
|
:key="`content-box-${index}`"
|
|
|
|
|
>
|
|
|
|
|
<el-col :span="21">
|
|
|
|
|
<el-input
|
|
|
|
|
type="textarea"
|
|
|
|
|
resize="none"
|
|
|
|
|
placeholder="请输入养护内容"
|
2024-11-28 11:12:21 +08:00
|
|
|
v-model="editForm.taskDescription[index]"
|
2024-11-26 15:04:35 +08:00
|
|
|
/>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="2">
|
|
|
|
|
<span
|
|
|
|
|
v-if="index < 1"
|
|
|
|
|
class="el-icon-circle-plus-outline"
|
|
|
|
|
@click="handleAddContent"
|
|
|
|
|
></span>
|
|
|
|
|
<span
|
|
|
|
|
v-else
|
|
|
|
|
class="el-icon-delete"
|
|
|
|
|
@click="handleDeleteContent(index)"
|
|
|
|
|
></span>
|
|
|
|
|
</el-col>
|
|
|
|
|
</div>
|
|
|
|
|
</fssm-scroll>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import FssmScroll from "@/components/scroll/fssm-scroll.vue";
|
2024-11-28 11:12:21 +08:00
|
|
|
import { addMaintenanceNotice } from "@/api/xj/document";
|
2024-11-26 15:04:35 +08:00
|
|
|
export default {
|
|
|
|
|
name: "EditDialog",
|
|
|
|
|
components: { FssmScroll },
|
2024-11-28 11:12:21 +08:00
|
|
|
props: {
|
|
|
|
|
dialogItem: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: () => {},
|
|
|
|
|
},
|
|
|
|
|
segmentList: {
|
|
|
|
|
type: Array,
|
|
|
|
|
default: () => [],
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-11-26 15:04:35 +08:00
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
// 编辑表单
|
|
|
|
|
editForm: {
|
2024-11-28 11:12:21 +08:00
|
|
|
// 病害id
|
|
|
|
|
defectId: "",
|
2024-11-26 15:04:35 +08:00
|
|
|
// 道路名称
|
|
|
|
|
segmentId: "",
|
|
|
|
|
// 开始桩号
|
|
|
|
|
stakeStart: "",
|
|
|
|
|
// 结束桩号
|
|
|
|
|
stakeEnd: "",
|
|
|
|
|
// 养护单位项目负责人
|
2024-11-28 11:12:21 +08:00
|
|
|
receiver: "",
|
2024-11-26 15:04:35 +08:00
|
|
|
// 养护内容
|
2024-11-28 11:12:21 +08:00
|
|
|
taskDescription: [""],
|
2024-11-26 15:04:35 +08:00
|
|
|
},
|
|
|
|
|
// 表单验证规则
|
|
|
|
|
rules: {
|
2024-11-28 11:12:21 +08:00
|
|
|
segmentId: [
|
|
|
|
|
{ required: true, message: "请选择路段", trigger: "change" },
|
|
|
|
|
],
|
|
|
|
|
stakeStart: [
|
|
|
|
|
{ required: true, message: "请输入开始桩号", trigger: "blur" },
|
|
|
|
|
],
|
|
|
|
|
stakeEnd: [
|
|
|
|
|
{ required: true, message: "请输入结束桩号", trigger: "blur" },
|
|
|
|
|
],
|
|
|
|
|
receiver: [
|
2024-11-26 15:04:35 +08:00
|
|
|
{ required: true, message: "请输入负责人名称", trigger: "blur" },
|
|
|
|
|
],
|
2024-11-28 11:12:21 +08:00
|
|
|
taskDescription: [
|
2024-11-26 15:04:35 +08:00
|
|
|
{
|
|
|
|
|
type: "array",
|
|
|
|
|
required: true,
|
|
|
|
|
defaultField: {
|
|
|
|
|
type: "string",
|
|
|
|
|
required: true,
|
|
|
|
|
message: "请完整填写内容",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
},
|
2024-11-28 11:12:21 +08:00
|
|
|
watch: {
|
|
|
|
|
dialogItem: {
|
|
|
|
|
handler(val) {
|
|
|
|
|
this.editForm = {
|
|
|
|
|
...val,
|
|
|
|
|
id: null,
|
|
|
|
|
defectId: val.id,
|
|
|
|
|
createdTime: null,
|
|
|
|
|
taskDescription: [
|
|
|
|
|
`${val.createdTimeLocal} ${val.roadName || ""}-${
|
|
|
|
|
val.segmentName || ""
|
|
|
|
|
} 主线 ${val.stakeStart || ""}-${val.stakeEnd || ""} 有${
|
|
|
|
|
val.defectTypeName
|
|
|
|
|
}`,
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
deep: true,
|
|
|
|
|
immediate: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-11-26 15:04:35 +08:00
|
|
|
methods: {
|
|
|
|
|
/**
|
|
|
|
|
* @description: 添加养护内容
|
|
|
|
|
*/
|
|
|
|
|
handleAddContent() {
|
2024-11-28 11:12:21 +08:00
|
|
|
this.editForm.taskDescription.push("");
|
2024-11-26 15:04:35 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @description: 删除养护内容
|
|
|
|
|
*/
|
|
|
|
|
handleDeleteContent(index) {
|
2024-11-28 11:12:21 +08:00
|
|
|
this.editForm.taskDescription.splice(index, 1);
|
2024-11-26 15:04:35 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @description: 取消
|
|
|
|
|
*/
|
|
|
|
|
cancel() {
|
|
|
|
|
this.$emit("cancel");
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @description: 提交表单
|
|
|
|
|
*/
|
|
|
|
|
submitForm() {
|
|
|
|
|
this.$refs.editForm.validate((valid) => {
|
|
|
|
|
if (valid) {
|
2024-11-28 11:12:21 +08:00
|
|
|
addMaintenanceNotice(this.editForm).then(({ code, data }) => {
|
|
|
|
|
if (code === 200) {
|
|
|
|
|
this.$message.success("生成成功");
|
|
|
|
|
this.$emit("cancel");
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(data);
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-11-26 15:04:35 +08:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.edit-dialog {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.editForm {
|
|
|
|
|
.el-select {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.content-box {
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
|
|
span {
|
|
|
|
|
font-size: 1.5rem;
|
|
|
|
|
line-height: 3rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.el-icon-circle-plus-outline {
|
|
|
|
|
color: #08ce29;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.el-icon-delete {
|
|
|
|
|
color: #f01515;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
> div {
|
|
|
|
|
margin: 0.5rem 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 页脚 */
|
|
|
|
|
.dialog-footer {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
}
|
|
|
|
|
</style>
|