diagnosisDialog.vue 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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="class_name">
  10. <el-input v-model="formValue.class_name"></el-input>
  11. </el-form-item>
  12. </el-col>
  13. <el-col :span="8">
  14. <el-form-item label="拼音" prop="pinyin">
  15. <el-input v-model="formValue.pinyin"></el-input>
  16. </el-form-item>
  17. </el-col>
  18. <el-col :span="8">
  19. <el-form-item label="五笔" prop="wubi">
  20. <el-input v-model="formValue.wubi"></el-input>
  21. </el-form-item>
  22. </el-col>
  23. <el-col :span="8">
  24. <el-form-item label="目录代码" prop="content_code">
  25. <el-input v-model="formValue.content_code"></el-input>
  26. </el-form-item>
  27. </el-col>
  28. <el-col :span="8">
  29. <el-form-item label="国家编码" prop="country_code">
  30. <el-input v-model="formValue.country_code"></el-input>
  31. </el-form-item>
  32. </el-col>
  33. <el-col :span="8">
  34. <el-form-item label="国家目录名称" prop="country_content_name">
  35. <el-input v-model="formValue.country_content_name"></el-input>
  36. </el-form-item>
  37. </el-col>
  38. </el-row>
  39. <el-col>
  40. <el-form-item label="备注">
  41. <el-input type="textarea" :row="5" v-model="formValue.remark"
  42. placeholder="请输入内容">
  43. </el-input>
  44. </el-form-item>
  45. </el-col>
  46. </el-form>
  47. <span slot="footer" class="dialog-footer">
  48. <el-button v-if="isCreated == 3" @click="cancle('formValue')">取 消</el-button>
  49. <el-button v-if="isCreated != 3 " @click="cancle('formValue')">取 消</el-button>
  50. <el-button v-if="isCreated != 3" type="primary" @click="comfirm('formValue')">保 存</el-button>
  51. </span>
  52. </el-dialog>
  53. </template>
  54. <script>
  55. export default {
  56. name: 'diagnosisDialog',
  57. data() {
  58. return {
  59. visibility: false,
  60. labelPosition: 'right',
  61. isClose: false,
  62. form: {
  63. class_name: '',
  64. content_code: '',
  65. country_code: '',
  66. country_content_name: '',
  67. remark: '',
  68. pinyin: '',
  69. wubi: ''
  70. },
  71. resetForm: {
  72. class_name: '',
  73. content_code: '',
  74. country_code: '',
  75. country_content_name: '',
  76. remark: '',
  77. pinyin: '',
  78. wubi: ''
  79. },
  80. rules: {
  81. class_name: [
  82. { required: true, message: '请输入大类名称', trigger: 'blur' }
  83. ],
  84. content_code: [
  85. { required: true, message: '请输入目录代码', trigger: 'blur' }
  86. ]
  87. }
  88. }
  89. },
  90. props: {
  91. titles: {
  92. type: String,
  93. default: ''
  94. },
  95. formValue: {
  96. type: Object
  97. },
  98. type: {
  99. type: Number,
  100. default: 1
  101. },
  102. isCreated: {
  103. type: Number,
  104. default: 1
  105. }
  106. },
  107. methods: {
  108. show: function() {
  109. this.visibility = true
  110. }, hide: function() {
  111. this.visibility = false
  112. },
  113. cancle: function(formName) {
  114. this.$emit('dialog-cancle', this.getValue())
  115. this.$refs['formValue'].resetFields()
  116. },
  117. comfirm: function(formName) {
  118. this.$refs['formValue'].validate((valid) => {
  119. if (valid) {
  120. let value = {}
  121. value = this.getValue()
  122. this.$emit('dialog-comfirm', value)
  123. this.form = Object.assign({}, this.resetForm)
  124. }
  125. })
  126. },
  127. getValue: function() {
  128. let form = {}
  129. form = this.formValue
  130. form['title'] = this.titles
  131. form['type'] = this.type
  132. form['isCreated'] = this.isCreated
  133. return form
  134. }
  135. }
  136. }
  137. </script>
  138. <style scoped>
  139. </style>