华西海圻ELN前端工程
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.6 KiB

  1. <!-- 选择模板 -->
  2. <template>
  3. <div>
  4. <el-input v-model="selected.name" :placeholder="$t('form.placeholderSelect')" :disabled="disabled" @click.native="showSelectTemplate" />
  5. <SelectTemplateDialog ref="selectTemplateDialog" @callback="handleChange" />
  6. </div>
  7. </template>
  8. <script>
  9. import SelectTemplateDialog from './SelectTemplateDialog.vue'
  10. export default {
  11. name: "SelectTemplate",
  12. components: {SelectTemplateDialog},
  13. props: {
  14. value: {
  15. type: [Number, String , Array],
  16. default: ''
  17. },
  18. name: {
  19. type: String,
  20. default: ''
  21. },
  22. disabled: {
  23. type: Boolean,
  24. default: false
  25. },
  26. needPre: {
  27. type: Number,
  28. default: 0
  29. },
  30. studyType: {
  31. type: Number,
  32. default: null
  33. },
  34. studyFormType: {
  35. type: Number,
  36. default: null
  37. },
  38. },
  39. watch: {
  40. value: {
  41. immediate: true,
  42. handler(v) {
  43. this.selected.id = v ?((v+'').indexOf('u_')>-1? v:('u_'+v)):''
  44. }
  45. },
  46. name: {
  47. immediate: true,
  48. handler(v) {
  49. this.selected.name=v || ''
  50. }
  51. },
  52. },
  53. data() {
  54. return {
  55. selected:{
  56. id:'',
  57. name:''
  58. },
  59. };
  60. },
  61. mounted() {
  62. },
  63. methods: {
  64. showSelectTemplate(){
  65. if(!this.disabled){
  66. this.$refs.selectTemplateDialog.show({needPre:this.needPre,studyType:this.studyType,studyFormType:this.studyFormType})
  67. }
  68. },
  69. handleChange(obj) {
  70. this.selected.name=obj.name
  71. this.selected.id=obj.id
  72. this.$emit('change', obj)
  73. this.$emit('input', obj.id)
  74. },
  75. }
  76. };
  77. </script>