Blame view

src/views/workflow/components/dialog/clxxAddDialog.vue 3.03 KB
1
<!--
yuanbo committed
2
 * @Description:
3
 * @Autor: renchao
4
 * @LastEditTime: 2023-09-19 10:15:07
5
-->
吴蕾 committed
6
<template>
7
  <dialogBox title="新建材料信息" width="25%" isMain v-model="myValue" @closeDialog="closeDialog" @submitForm="handleSubmit"
任超 committed
8
    :isFullscreen="false">
9
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px">
吴蕾 committed
10 11
      <el-row>
        <el-col :span="24">
12
          <el-form-item label="材料类型" prop="cllx">
任超 committed
13 14 15 16
            <el-select v-model="ruleForm.cllx" class="width100" placeholder="请选择">
              <el-option v-for="item in dictData['A40']" :key="item.dcode" :label="item.dname" :value="item.dcode">
              </el-option>
            </el-select>
吴蕾 committed
17 18 19 20 21
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="24">
22
          <el-form-item label="材料名称" prop="clmc">
吴蕾 committed
23 24 25 26
            <el-input v-model="ruleForm.clmc"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
27
      <el-row :gutter="20">
28
        <el-col :span="24">
29 30 31 32 33 34 35 36 37
          <el-form-item
            label="是否公共材料">
            <el-radio-group
              v-model="ruleForm.sfggcl">
              <el-radio label="1"></el-radio>
              <el-radio label="0"></el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
38
      </el-row>
吴蕾 committed
39
    </el-form>
吴蕾 committed
40 41 42 43
  </dialogBox>
</template>

<script>
44 45 46 47 48 49 50 51 52 53 54
  import { mapGetters } from "vuex";
  export default {
    props: {
      value: { type: Boolean, default: false },
    },
    data () {
      return {
        myValue: this.value,
        ruleForm: {
          cllx: "",
          clmc: "",
55
          sfggcl: "0"
56
        },
57 58 59 60 61 62
        rules: {
          cllx: [
            { required: true, message: '请选择材料类型', trigger: 'change' }
          ],
          clmc: [
            { required: true, message: '请输入材料名称', trigger: 'blur' }
63 64 65
          ],
          clbm: [
            { required: true, message: '请输入材料编码', trigger: 'blur' }
66 67 68
          ]
        }
      }
69 70 71
    },
    computed: {
      ...mapGetters(["dictData"]),
吴蕾 committed
72
    },
73 74 75 76
    watch: {
      value (val) {
        this.myValue = val;
      },
吴蕾 committed
77
    },
78
    methods: {
yuanbo committed
79 80 81 82
      /**
       * @description: closeDialog
       * @author: renchao
       */
83 84 85 86 87
      closeDialog () {
        this.$emit("input", false);
        this.ruleForm = {
          cllx: "",
          clmc: "",
88
          sfggcl: "0"
89 90
        }
      },
yuanbo committed
91 92 93 94
      /**
       * @description: handleSubmit
       * @author: renchao
       */
95
      handleSubmit () {
96 97 98 99 100 101
        this.$refs['ruleForm'].validate((valid) => {
          if (valid) {
            this.$parent.addSave(this.ruleForm);
            this.ruleForm = {
              cllx: "",
              clmc: "",
102
              sfggcl: "0"
103 104 105 106 107 108 109 110
            }
            this.$emit("input", false);
          } else {
            return false;
          }
        })
      }
    }
111
  };
吴蕾 committed
112 113
</script>
<style scoped lang="scss">
114 115 116 117 118 119
  .submit-button {
    text-align: center;
    height: 52px;
    padding-top: 10px;
    background-color: #fff;
  }
吴蕾 committed
120
</style>