additionDialog.vue 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <el-dialog width="854px" :title="titles" :visible.sync="visibility" :close-on-click-modal="isClose"
  3. :close-on-press-escape="isClose">
  4. <el-form :model="formValue" :rules="rules" ref="formValue" class="demo-form-inline"
  5. :label-position="labelPosition"
  6. label-width="100px">
  7. <el-row>
  8. <el-col :span="8">
  9. <el-form-item label="费用名称" prop="name">
  10. <el-input v-model="formValue.name"></el-input>
  11. </el-form-item>
  12. </el-col>
  13. <el-col :span="8">
  14. <el-form-item label="国家编码" prop="code">
  15. <el-input v-model="formValue.code"></el-input>
  16. </el-form-item>
  17. </el-col>
  18. <el-col :span="8">
  19. <el-form-item label="费用" >
  20. <el-input type="number" v-model="formValue.price"></el-input>
  21. </el-form-item>
  22. </el-col>
  23. </el-row>
  24. </el-form>
  25. <span slot="footer" class="dialog-footer">
  26. <el-button v-if="isCreated == 3" @click="cancle('formValue')">取 消</el-button>
  27. <el-button v-if="isCreated != 3 " @click="cancle('formValue')">取 消</el-button>
  28. <el-button v-if="isCreated != 3" type="primary" @click="comfirm('formValue')">保 存</el-button>
  29. </span>
  30. </el-dialog>
  31. </template>
  32. <script>
  33. export default {
  34. name: 'diagnosisDialog',
  35. data() {
  36. return {
  37. visibility: false,
  38. labelPosition: 'right',
  39. isClose: false,
  40. form: {
  41. name: '',
  42. code: '',
  43. price: '',
  44. },
  45. resetForm: {
  46. name: '',
  47. code: '',
  48. price: '',
  49. wubi: ''
  50. },
  51. rules: {
  52. name: [
  53. { required: true, message: '请输入费用名称', trigger: 'blur' }
  54. ],
  55. code: [
  56. { required: true, message: '请输入国家编码', trigger: 'blur' }
  57. ]
  58. }
  59. }
  60. },
  61. props: {
  62. titles: {
  63. type: String,
  64. default: ''
  65. },
  66. formValue: {
  67. type: Object
  68. },
  69. type: {
  70. type: Number,
  71. default: 1
  72. },
  73. isCreated: {
  74. type: Number,
  75. default: 1
  76. }
  77. },
  78. methods: {
  79. show: function() {
  80. this.visibility = true
  81. }, hide: function() {
  82. this.visibility = false
  83. },
  84. cancle: function(formName) {
  85. this.$emit('dialog-cancle', this.getValue())
  86. this.$refs['formValue'].resetFields()
  87. },
  88. comfirm: function(formName) {
  89. this.$refs['formValue'].validate((valid) => {
  90. if (valid) {
  91. let value = {}
  92. value = this.getValue()
  93. this.$emit('dialog-comfirm', value)
  94. this.form = Object.assign({}, this.resetForm)
  95. }
  96. })
  97. },
  98. getValue: function() {
  99. let form = {}
  100. form = this.formValue
  101. form['title'] = this.titles
  102. form['type'] = this.type
  103. form['isCreated'] = this.isCreated
  104. return form
  105. }
  106. }
  107. }
  108. </script>
  109. <style scoped>
  110. </style>