UiInputSelect.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <el-row class="form-group">
  3. <el-col :span="3" style="min-height:50px;padding-top:10px;">
  4. <label style="margin-left:10px;vertical-align: middle;"
  5. class="control-label">{{ label ? label : 'Text' }}</label>
  6. </el-col>
  7. <el-col :span="9">
  8. <el-input
  9. :type="typeV"
  10. v-model="text"
  11. :placeholder="placeholder ? placeholder : ''"
  12. disabled="disabled"
  13. :minlength="minlength ? parseInt(minlength) : 0"
  14. :maxlength="maxlength ? parseInt(maxlength) : 200"
  15. :auto-complete="autoComplete ? 'on' : 'off'"
  16. :readonly="readonly ? true : false"
  17. :show-password="showPassword ? true : false"
  18. :autofocus="autofocus ? true : false"
  19. :size="size ? size : 'large'"
  20. >
  21. </el-input>
  22. <el-input
  23. type="hidden"
  24. v-model="id"
  25. :placeholder="placeholder ? placeholder : ''"
  26. :name="name ? name : 'text'"
  27. :minlength="minlength ? parseInt(minlength) : 0"
  28. :maxlength="maxlength ? parseInt(maxlength) : 200"
  29. :auto-complete="autoComplete ? 'on' : 'off'"
  30. :readonly="readonly ? true : false"
  31. :show-password="showPassword ? true : false"
  32. :autofocus="autofocus ? true : false"
  33. :id="name"
  34. :size="size ? size : 'large'"
  35. @change="selectChange">
  36. </el-input>
  37. </el-col>
  38. <el-col :span="5">
  39. <a class="createForm" data-title="create">
  40. <button type="button" @click="openForm(send_url)" class="btn btn-info">
  41. {{ button_title == '' ? '查看' : button_title }}
  42. </button>
  43. </a>
  44. </el-col>
  45. <el-col :span="6">
  46. <div class="classJs">
  47. <div v-if="tips">
  48. <span class="red">*</span>&ensp;{{ tips }}
  49. </div>
  50. </div>
  51. </el-col>
  52. </el-row>
  53. </template>
  54. <script>
  55. export default {
  56. props: ['label', 'value', 'placeholder', 'disabled', 'name', 'minlength', 'maxlength', 'readonly', 'autofocus', 'autoComplete', 'size', 'tips', 'type','title', 'showPassword', 'send_url', 'button_type', 'button_title','options'],
  57. data() {
  58. return {
  59. 'text': this.title ? this.title : '',
  60. 'id': this.value ? this.value : '',
  61. 'typeV': this.type ? this.type : 'text',
  62. 'time_num': 0,
  63. 'layer_index':null
  64. };
  65. },
  66. mounted() {
  67. },
  68. methods: {
  69. selectChange(value) {
  70. this.$emit('set-keys', value);
  71. },
  72. openForm: function (send_url) {
  73. this.layer_index= layer.open({
  74. type: 2,
  75. title: this.label,
  76. closeBtn: 1,
  77. time: 0,
  78. id: 'openFormSelect' ,
  79. // move: false,
  80. maxmin: true,
  81. area: ['70%', '80%'],
  82. scrollbar: false,
  83. shadeClose: false,
  84. skin: '',
  85. zIndex: 9999999, //> 当前设置层级
  86. content: send_url,
  87. full: function (ele) {
  88. },
  89. cancel: function () {
  90. },
  91. moveEnd: function () {
  92. }
  93. })
  94. console.log( this.layer_index+'-----------layer_index')
  95. }
  96. },
  97. watch: {
  98. '_props.options.value': function () {
  99. console.log('获取到父级数据变化:' + this._props.options.value);
  100. this.id = this._props.options.value;
  101. layer.close(this.layer_index);
  102. },
  103. '_props.options.title': function () {
  104. console.log('获取到父级数据变化:' + this._props.options.title);
  105. this.text = this._props.options.title;
  106. },
  107. },
  108. }
  109. </script>
  110. <style scoped>
  111. .classJs {
  112. margin-left: 10px;
  113. vertical-align: middle;
  114. height: 42px;
  115. line-height: 42px;
  116. }
  117. .red {
  118. color: red;
  119. }
  120. </style>