123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <template>
- <div :loading="loading">
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
- <el-form-item label="故障名称" prop="errorAppearance">
- <el-input v-model="form.errorAppearance" placeholder="请输入故障名称" :readonly="readonly"/>
- </el-form-item>
- <el-form-item label="排故流程" prop="flowEncode">
- <el-input
- :readonly="readonly"
- v-model="form.flowEncode"
- type="textarea"
- placeholder="请输入排故流程"
- />
- </el-form-item>
- </el-form>
- <div>
- <el-button v-show="!readonly" type="primary" @click="submitForm">确 定</el-button>
- <el-button v-show="!readonly" @click="cancel">取 消</el-button>
- </div>
- </div>
- </template>
-
- <script>
- import { updateFlow, addFlow, getFlow } from "@/api/suport/flow";
- export default {
- props: {
- subTask: {
- type: Object,
- },
- readonly: {
- type: Boolean,
- },
- },
- data() {
- return {
- loading: false,
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- // 表单参数
- form: {},
- // 表单校验
- rules: {},
- };
- },
- created() {
- this.getResult()
- },
- methods: {
- getResult(){
- this.loading = true
- getFlow(this.subTask.id).then(response => {
- if(response.data){
- this.form = response.data
- }
- this.loading = false
- });
- },
-
- /** 提交按钮 */
- submitForm() {
- this.$refs["form"].validate((valid) => {
- if (valid) {
- this.form.subTaskId = this.subTask.id
- if (this.form.id != null) {
- updateFlow(this.form).then((response) => {
- this.$modal.msgSuccess("修改成功");
- this.open = false;
- this.$emit("closeInfo");
- });
- } else {
- addFlow(this.form).then((response) => {
- this.$modal.msgSuccess("新增成功");
- this.open = false;
- this.$emit("closeInfo");
- });
- }
- }
- });
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- id: null,
- name: null,
- desc: null,
- createBy: null,
- createTime: null,
- updateBy: null,
- updateTime: null,
- };
- },
- },
- };
- </script>
|