- Finish to fix IOperators

- Fixit Date not change correctly
This commit is contained in:
Paolo Arena
2019-11-01 15:52:58 +01:00
parent 2c62c27e64
commit cdfc32c620
23 changed files with 365 additions and 135 deletions

View File

@@ -21,7 +21,7 @@ import { CMyChipList } from '../CMyChipList'
export default class CGridTableRec extends Vue {
@Prop({ required: false }) public prop_mytable: string
@Prop({ required: true }) public prop_mytitle: string
@Prop({ required: false, default: [] }) public prop_mycolumns: any[]
@Prop({ required: false, default: null }) public prop_mycolumns: any[]
@Prop({ required: false, default: '' }) public prop_colkey: string
@Prop({ required: false, default: '' }) public nodataLabel: string
@Prop({ required: false, default: '' }) public noresultLabel: string
@@ -57,17 +57,13 @@ export default class CGridTableRec extends Vue {
public filter: string = ''
public rowsel: any
public dark: boolean = true
public funcActivated = []
public canEdit: boolean = false
public returnedData
public returnedCount
public colVisib: any[] = []
public colExtra: any[] = []
get canEdit() {
return this.funcActivated.includes(lists.MenuAction.CAN_EDIT_TABLE)
}
get lists() {
return lists
}
@@ -79,7 +75,7 @@ export default class CGridTableRec extends Vue {
}
public selItem(item, col: IColGridTable) {
// console.log('item', item)
console.log('selItem', item)
this.rowsel = item
this.idsel = item._id
this.colsel = col
@@ -317,6 +313,11 @@ export default class CGridTableRec extends Vue {
}
public mounted() {
this.canEdit = tools.getCookie(tools.CAN_EDIT) === 'true'
this.tablesel = tools.getCookie('tablesel')
this.changeTable(false)
}
@@ -382,25 +383,34 @@ export default class CGridTableRec extends Vue {
return '[]'
} else {
let mystr = tools.firstchars(val, tools.MAX_CHARACTERS)
if (val.length > tools.MAX_CHARACTERS)
mystr += '...'
if (val) {
if (val.length > tools.MAX_CHARACTERS)
mystr += '...'
} else {
return val
}
return mystr
}
}
}
public changeCol(newval) {
tools.setCookie(this.mytable, this.colVisib.join('|'))
}
public changeTable(mysel) {
// console.log('changeTable')
if (this.tablesel === undefined || this.tablesel === '')
return
console.log('changeTable mysel=', mysel, 'tablesel', this.tablesel)
let mytab = null
if (this.tablesList) {
if (!this.tablesel) {
this.tablesel = this.tablesList[1].value
}
mytab = this.tablesList.find((rec) => rec.value === this.tablesel)
}
console.log('this.tablesel', this.tablesel)
if (mytab) {
this.mytitle = mytab.label
this.colkey = mytab.colkey
@@ -416,7 +426,17 @@ export default class CGridTableRec extends Vue {
this.mytable = mytab.value
}
tools.setCookie('tablesel', this.tablesel)
this.updatedcol()
if (!!this.mytable) {
const myselcol = tools.getCookie(this.mytable)
if (!!myselcol && myselcol.length > 0) {
this.colVisib = myselcol.split('|')
}
}
this.refresh()
}
@@ -429,8 +449,11 @@ export default class CGridTableRec extends Vue {
}
public doSearch() {
this.refresh()
}
public changefuncAct(newval) {
tools.setCookie(tools.CAN_EDIT, newval)
}
}

View File

@@ -35,13 +35,14 @@
<!--<p style="color:red"> Rows: {{ getrows }}</p>-->
<q-input v-model="search" filled dense type="search" hint="Search" v-on:keyup.enter="doSearch">
<q-input v-model="search" filled dense type="search" debounce="500" hint="Search" v-on:keyup.enter="doSearch">
<template v-slot:after>
<q-btn v-if="mytable" label="" color="primary" @click="refresh" icon="search"></q-btn>
</template>
</q-input>
<q-toggle v-if="mytable" v-model="funcActivated" :val="lists.MenuAction.CAN_EDIT_TABLE" class="q-mx-sm"
:label="$t('grid.editvalues')"></q-toggle>
<q-toggle v-if="mytable" v-model="canEdit" :val="lists.MenuAction.CAN_EDIT_TABLE" class="q-mx-sm"
:label="$t('grid.editvalues')" @input="changefuncAct"
></q-toggle>
<q-btn v-if="mytable" flat dense color="primary" :disable="loading || !canEdit"
:label="$t('grid.addrecord')"
@@ -64,7 +65,8 @@
map-options
:options="mycolumns"
option-value="name"
style="min-width: 150px">
style="min-width: 150px"
@input="changeCol">
</q-select>
@@ -94,7 +96,8 @@
<CDateTime
:label="col.label"
class="cursor-pointer"
:value.sync="props.row[col.name]"
:valueDate="props.row[col.name]"
:readonly="false"
:dense="true"
:canEdit="canEdit"
@savetoclose="SaveValue"
@@ -145,13 +148,33 @@
</q-popup-edit>
</div>
</div>
<div v-else>
<div v-else-if="col.fieldtype === tools.FieldType.string">
<div :class="getclassCol(col)">
{{ visuValByType(col, props.row[col.name]) }}
<q-popup-edit v-if="canEdit" v-model="props.row[col.name]" :disable="col.disable"
:title="col.title" buttons
@save="SaveValue" @show="selItem(props.row, col)">
<q-input v-model="props.row[col.name]"/>
<q-input v-model="props.row[col.name]"
autofocus
>
</q-input>
</q-popup-edit>
</div>
</div>
<div v-else-if="col.fieldtype === tools.FieldType.html">
<div :class="getclassCol(col)">
{{ visuValByType(col, props.row[col.name]) }}
<q-popup-edit v-if="canEdit" v-model="props.row[col.name]" :disable="col.disable"
:title="col.title" buttons
@save="SaveValue" @show="selItem(props.row, col)">
<q-input v-model="props.row[col.name]"
autofocus
@keyup.enter.stop
type="textarea">
</q-input>
</q-popup-edit>
</div>