Ohm-Management - Projektarbeit B-ME
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.

files.js 3.3KB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. const FileRouter = {
  2. template: `
  3. <div class="content">
  4. <div class="column is-four-fifths-desktop pull-right-sm">
  5. <h4>Erweiterte Suche</h4>
  6. <b-field label="Suche nach">
  7. <b-select
  8. placeholder="Wähle eine Suchform"
  9. v-model="selectedOptions">
  10. <option value="freeSearch">Freie Suche</option>
  11. <option value="subject">Betreff</option>
  12. <option value="tags">Tags</option>
  13. <option value="text">Nachrichtentext</option>
  14. <option value="user">User</option>
  15. </b-select>
  16. </b-field>
  17. <b-field v-if="selectedOptions=='freeSearch'||selectedOptions=='subject'|| selectedOptions=='text' || selectedOptions=='user'">
  18. <b-input id="freeSe"></b-input>
  19. </b-field>
  20. <b-field v-if="selectedOptions=='tags'">
  21. <b-autocomplete v-model="searchtext"
  22. :data="filteredDataArray"
  23. placeholder="#" icon="label"
  24. @select="option => selected = option">
  25. </b-autocomplete>
  26. </b-field>
  27. <b-button type="is-primary" @click="search">SUCHE</b-button>
  28. <div id="om-msg-cards" v-if="isExtendedSearch==true">
  29. <MsgCard
  30. v-for="id in messagelist.slice().reverse()"
  31. :key="id"
  32. :msg="messages[id] || {}"
  33. ></MsgCard>
  34. </div>
  35. </div>
  36. </div>
  37. `,
  38. data: function () {
  39. return {
  40. searchtext: "",
  41. selectedOptions: [],
  42. selected: [],
  43. taglist: data,
  44. messagelist: _messagelist,
  45. messages: _messages,
  46. isExtendedSearch: false,
  47. }
  48. },
  49. computed: {
  50. filteredDataArray() {
  51. return this.taglist.filter((option) => {
  52. return option
  53. .toString()
  54. .toLowerCase()
  55. .indexOf(this.searchtext.toLowerCase()) >= 0
  56. })
  57. }
  58. },
  59. methods: {
  60. list_messages: function () {
  61. messages();
  62. },
  63. getFilteredTags(text) {
  64. this.taglist = data.filter((option) => {
  65. return option
  66. .toString()
  67. .toLowerCase()
  68. .indexOf(text.toLowerCase()) >= 0
  69. })
  70. },
  71. list_tags: function () {
  72. $.ajax({
  73. url: "api/tag/ids",
  74. method: "GET"
  75. })
  76. .done(jd => {
  77. // NICHT SO wg. Vue: _messagelist = jd;
  78. if(data == ""){
  79. _taglist.splice(0, _taglist.length);
  80. _taglist.push.apply(_taglist, jd);
  81. console.log("tag: jd: " + jd);
  82. for (var e in jd) {
  83. if (!_tags[jd[e]]) {
  84. get_insert_tag(jd[e]);
  85. }
  86. }
  87. }
  88. }).fail(function (e, f, g) {
  89. console.log("err: " + e + f + g);
  90. });
  91. },
  92. saveTagsToArray: function () {
  93. tagArray = this.selected;
  94. console.info(tagArray);
  95. },
  96. search: function () {
  97. searching(this.searchtext);
  98. this.isExtendedSearch=true;
  99. },
  100. list_messages: function () {
  101. messages();
  102. },
  103. },
  104. mounted: function () {
  105. //this.search();
  106. //this.list_tags();
  107. //this.list_messages();
  108. },
  109. };