SelectLibRateDialog.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <Dialog ref="dialog" v-model="dialogVisible">
  3. <template #header>
  4. <div class="row items-center">
  5. <div style="font-size: 110%">
  6. Выбрать оценки
  7. </div>
  8. </div>
  9. </template>
  10. <div ref="box" class="column q-mt-xs overflow-auto no-wrap" style="width: 200px; padding: 0px 10px 10px 10px;">
  11. <q-option-group
  12. v-model="ticked"
  13. :options="options"
  14. type="checkbox"
  15. >
  16. </q-option-group>
  17. </div>
  18. <template #footer>
  19. <q-btn class="q-px-md q-ml-sm" color="primary" dense no-caps @click="okClick">
  20. OK
  21. </q-btn>
  22. </template>
  23. </Dialog>
  24. </template>
  25. <script>
  26. //-----------------------------------------------------------------------------
  27. import vueComponent from '../../vueComponent.js';
  28. import Dialog from '../../share/Dialog.vue';
  29. const componentOptions = {
  30. components: {
  31. Dialog
  32. },
  33. watch: {
  34. modelValue(newValue) {
  35. this.dialogVisible = newValue;
  36. },
  37. dialogVisible(newValue) {
  38. this.$emit('update:modelValue', newValue);
  39. },
  40. librate() {
  41. this.updateTicked();
  42. },
  43. ticked() {
  44. this.updateLibrate();
  45. },
  46. }
  47. };
  48. class SelectLibRateDialog {
  49. _options = componentOptions;
  50. _props = {
  51. modelValue: Boolean,
  52. librate: String,
  53. };
  54. dialogVisible = false;
  55. ticked = [];
  56. tickAll = false;
  57. created() {
  58. this.commit = this.$store.commit;
  59. }
  60. mounted() {
  61. this.updateTicked();
  62. }
  63. get options() {
  64. return [
  65. {label: 'Без оценки', value: '0'},
  66. {label: '1', value: '1'},
  67. {label: '2', value: '2'},
  68. {label: '3', value: '3'},
  69. {label: '4', value: '4'},
  70. {label: '5', value: '5'},
  71. ];
  72. }
  73. updateTicked() {
  74. this.ticked = this.librate.split(',').filter(s => s);
  75. }
  76. updateLibrate() {
  77. this.ticked.sort((a, b) => a.localeCompare(b))
  78. this.$emit('update:librate', this.ticked.join(','));
  79. }
  80. okClick() {
  81. this.dialogVisible = false;
  82. }
  83. }
  84. export default vueComponent(SelectLibRateDialog);
  85. //-----------------------------------------------------------------------------
  86. </script>
  87. <style scoped>
  88. </style>