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

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