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.

propertyUserField.vue 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <div class="row">
  3. <div class="col-md-4" v-for="(currentField, i) in fields" :key="i">
  4. <div v-if="!setFields[i] && currentField.type !== 'yesno'">
  5. <label class="uniSelectLabel" style="margin-top:10px;">{{ currentField.name }}</label>
  6. </div>
  7. <float-label
  8. v-if="currentField.type === 'number'"
  9. :label="currentField.name"
  10. style="width:100%;top:-1em !important;"
  11. >
  12. <input
  13. v-if="currentField.type === 'number'"
  14. class="form-control uniInput"
  15. type="number"
  16. style="margin-top:20px;"
  17. :name="currentField.name"
  18. :id="currentField.id"
  19. v-model="setFields[i]"
  20. @change="UpdateSetFields(currentField, i)"
  21. />
  22. </float-label>
  23. <float-label
  24. v-if="currentField.type === 'text'"
  25. :label="currentField.name"
  26. style="width:100%;top:-1em !important;"
  27. >
  28. <input
  29. v-if="currentField.type === 'text'"
  30. class="form-control uniInput"
  31. type="text"
  32. style="margin-top:20px;"
  33. :name="currentField.name"
  34. :id="currentField.id"
  35. v-model="setFields[i]"
  36. @change="UpdateSetFields(currentField, i)"
  37. />
  38. </float-label>
  39. <div class="input-group" v-if="currentField.type === 'yesno'">
  40. <label class="uniSelectLabel" :for="currentField.name">{{ currentField.name }}</label>
  41. <input
  42. type="checkbox"
  43. :id="currentField.id"
  44. :name="currentField.name"
  45. style="margin-left:-5px; margin-top:10px"
  46. v-model="setFields[i]"
  47. @change="UpdateSetFields(currentField, i)"
  48. />
  49. </div>
  50. </div>
  51. </div>
  52. </template>
  53. <script>
  54. export default {
  55. name: "UserDefinedField",
  56. props: {
  57. fields: { type: Array, default: () => [] }
  58. },
  59. data() {
  60. return {
  61. setFields: []
  62. };
  63. },
  64. methods: {
  65. UpdateSetFields(field, index) {
  66. const item = {
  67. userDefinedFieldId: field.id,
  68. value: this.setFields[index],
  69. type: field.type
  70. };
  71. if (item) {
  72. this.$emit("UpdateUserDefinedFields", item);
  73. }
  74. },
  75. GetFirstLetter(value) {
  76. if (value) {
  77. return value.slice(0, 1);
  78. }
  79. return "";
  80. }
  81. }
  82. };
  83. </script>