djbeditDialog.vue 2.94 KB
<template>
  <div class="jtfccx-edit">
    <div class="jtfccx-edit-con">
      <el-form ref="form"  :model="form" label-width="160px">
        <el-row>
          <el-col :span="8">
            <el-form-item label="权属状态" label-width="140px">
              <el-select v-model="form.qszt">
                <el-option v-for="item in qsztList" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8" v-for="item in datalist" :key="item.bdcdyh">
            <el-form-item :prop="item.prop" :label="item.label" label-width="140px">
              <el-input v-model="form[item.prop]" ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
            <el-form-item class="btn">
      <el-button type="primary" @click="submitForm">保存</el-button>
      <el-button @click="closeDialog">取消</el-button>
    </el-form-item>
      </el-form>

    </div>

  </div>
</template>
<script>
export default {
  props: {
    formData: {
      type: Object,
      default: () => { },
    },
  },
  data () {
    return {
      form:{},
      datalist:[],
     qsztList: [
        {
          value: "0",
          label: "临时",
        },
        {
          value: "1",
          label: "现势",
        },
        {
          value: "2",
          label: "历史",
        },

        ],
       label:"",
    };
  },
  mounted () {
   if (this.formData.data) {
          this.$nextTick(() => {
            this.form = Object.assign({}, this.formData.data)
            // this.datalist = Object.assign([], this.formData.datalist)
            this.form.qszt=this.form.qszt=='0'?"临时":this.form.qszt=='1'?"现势":"历史"
          })
        }
      // this.datalist = this.formData.datalist
      this.datalist = JSON.parse(JSON.stringify(this.formData.datalist));
         this.datalist.shift()
         this.datalist.shift()

  },

  methods: {
       //新增常用意见
      submitForm () {
        this.$refs.form.validate(valid => {
          if (valid) {
            // addUserCommonOpinion({ commonOpinion: this.form.commonOpinion }).then(res => {
            //   if (res.code == 200) {
            //     this.$message.success("新增成功")
            //     this.closeaddDiglog();
            //     this.getList()
            //   } else {
            //     this.$message.error(res.message)
            //   }
            // })
            this.$popupCacel()
          } else {
            return false;
          }
        });
      },
      closeDialog () {
      this.$popupCacel()
      this.$refs['form'].resetFields();
      // this.resetTableFields();
    }
  },
};
</script>
<style scoped lang="scss">
@import "~@/styles/mixin.scss";
@import "~@/styles/public.scss";


.jtfccx-edit {
  @include flex;
  flex-direction: column;
  overflow-y: hidden;
  max-height: 85vh;
  padding: 0 2px;


 .btn{
   text-align: center;

 }
}
</style>