- Add New Record directly by the QSelect
This commit is contained in:
@@ -802,6 +802,7 @@ export default defineComponent({
|
||||
|
||||
}
|
||||
|
||||
|
||||
async function createNewRecord() {
|
||||
|
||||
await createNewRecordDialog()
|
||||
@@ -947,12 +948,9 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function visCol(col: IColGridTable) {
|
||||
if (col.visuonlyEditVal) {
|
||||
if (canEdit.value) {
|
||||
return col.visuonlyEditVal
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
if ((!tools.isBitActive(col.showWhen, costanti.showWhen.NewRec)) && !tools.isBitActive(col.showWhen, costanti.showWhen.InView)
|
||||
&& !tools.isBitActive(col.showWhen, costanti.showWhen.InView_OnlyifExist) && tools.isBitActive(col.showWhen, costanti.showWhen.InEdit)) {
|
||||
return (canEdit.value)
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
@@ -1129,9 +1127,8 @@ export default defineComponent({
|
||||
|
||||
mycolumns.value.forEach((col: IColGridTable) => {
|
||||
if (col.required) {
|
||||
console.log('newRecord.value', newRecord.value, newRecord.value[col.name])
|
||||
// console.log('newRecord.value', newRecord.value, newRecord.value[col.name])
|
||||
if (!newRecord.value[col.name]) {
|
||||
|
||||
ok = false
|
||||
}
|
||||
}
|
||||
@@ -1202,8 +1199,8 @@ export default defineComponent({
|
||||
|
||||
const data = await globalStore.saveTable(mydata)
|
||||
.then((ris) => {
|
||||
// console.log('ris', ris)
|
||||
if (ris) {
|
||||
// console.log('ris', ris)
|
||||
editRecordBool.value = false
|
||||
const indrec = serverData.value.findIndex((rec: IMySkill) => rec._id === ris._id)
|
||||
console.log('indrec', indrec, serverData.value[indrec])
|
||||
@@ -1234,11 +1231,12 @@ export default defineComponent({
|
||||
return ((rec._id > 0 && typeof rec._id === 'number') || rec._id !== 'number') && rec !== -100
|
||||
}
|
||||
|
||||
function showColCheck(col: IColGridTable, newrec: boolean){
|
||||
return (colVisib.value.includes(col.field! + col.subfield) || colVisib.value.includes(col.field + '.' + col.subfield)) &&
|
||||
(!col.showOnlyNewRec || (col.showOnlyNewRec && newrec)) &&
|
||||
(col.visible) &&
|
||||
(!props.visuinpage || (col.visuinpage && props.visuinpage))
|
||||
function showColCheck(col: IColGridTable, tipovis: number, visulabel:boolean, value: any = ''){
|
||||
const check = tools.checkIfShowField(col, tipovis, visulabel, value)
|
||||
|
||||
const valuePresent = (colVisib.value.includes(col.field! + col.subfield) || colVisib.value.includes(col.field + '.' + col.subfield))
|
||||
|
||||
return check && valuePresent
|
||||
}
|
||||
|
||||
function getValueExtra(col: IColGridTable, record: any) {
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
:props="props"
|
||||
class="text-italic text-weight-bold"
|
||||
>
|
||||
<span v-if="col && showColCheck(col, false)">
|
||||
<span v-if="col && showColCheck(col, tools.TIPOVIS_SHOW_RECORD, true)">
|
||||
{{ col.label }}
|
||||
</span>
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
<template v-slot:top-left>
|
||||
|
||||
<div v-if="searchList"
|
||||
:class="$q.screen.lt.sm ? `` : `row` + ` text-blue`">
|
||||
:class="$q.screen.lt.sm ? `` : `row` + ` text-blue `">
|
||||
<span v-for="(item, index) in searchList" :key="index">
|
||||
<CMySelect
|
||||
v-if="(item.type === costanti.FieldType.select) || (item.type === costanti.FieldType.select_by_server)"
|
||||
@@ -252,7 +252,7 @@
|
||||
<q-td
|
||||
v-for="col in mycolumns" :key="col.name" :props="props">
|
||||
<div
|
||||
v-if="showColCheck(col, false)" class="tdclass">
|
||||
v-if="showColCheck(col, tools.TIPOVIS_SHOW_RECORD, true, 1)" class="tdclass">
|
||||
<div :class="getclrow(props.row)">
|
||||
<CMyPopupEdit
|
||||
:table="mytable"
|
||||
@@ -306,7 +306,7 @@
|
||||
class="q-pa-xs col-xs-12 col-sm-6 col-md-4 col-lg-3 grid-style-transition"
|
||||
:style="props.selected ? 'transform: scale(0.95);' : ''"
|
||||
>
|
||||
<q-card :class="props.selected ? 'bg-grey-2' : ''" style="min-width: 200px;">
|
||||
<q-card :class="props.selected ? 'bg-grey-2 my-card' : 'my-card'">
|
||||
<q-bar v-if="!visuinpage" dense class="bg-primary text-white full-height">
|
||||
<span class=""> {{ props.row[col_title] }} </span>
|
||||
<q-space/>
|
||||
@@ -328,9 +328,7 @@
|
||||
<q-list dense>
|
||||
<div v-for="col in mycolumns" :key="col.name">
|
||||
|
||||
<q-item v-if="showColCheck(col, false) &&
|
||||
(!col.noshowifnone || (col.noshowifnone && tools.getValue(props.row,col.field, col.subfield))
|
||||
)"
|
||||
<q-item v-if="showColCheck(col, tools.TIPOVIS_SHOW_RECORD, false, tools.getValue(props.row,col.field, col.subfield))"
|
||||
:class="clByCol(col)" class="riduci_pad">
|
||||
|
||||
<q-item-section avatar v-if="col.icon">
|
||||
@@ -378,7 +376,7 @@
|
||||
<div
|
||||
class="q-ma-xs q-pa-xs text-center rounded-borders q-list--bordered"
|
||||
v-for="mycol in mycolumns" :key="mycol.name">
|
||||
<div v-if="showColCheck(mycol, false)">
|
||||
<div v-if="showColCheck(mycol, tools.TIPOVIS_SHOW_RECORD, false)">
|
||||
<div class="row items-center justify-center q-gutter-md q-ma-xs">
|
||||
<div class="q-ma-xs">
|
||||
<q-field rounded outlined bg-color="orange-3" dense>
|
||||
@@ -426,7 +424,7 @@
|
||||
<div
|
||||
v-for="col in mycolumns" :key="col.name" class="newrec_fields">
|
||||
<div
|
||||
v-if="showColCheck(col, true) && col.foredit">
|
||||
v-if="showColCheck(col, tools.TIPOVIS_NEW_RECORD, true) && col.foredit">
|
||||
<div class="">
|
||||
<CMyPopupEdit
|
||||
:table="mytable"
|
||||
@@ -469,7 +467,7 @@
|
||||
<div
|
||||
v-for="col in mycolumns" :key="col.name">
|
||||
<div
|
||||
v-if="showColCheck(col, false) && col.foredit">
|
||||
v-if="showColCheck(col, tools.TIPOVIS_EDIT_RECORD, false) && col.foredit">
|
||||
<div>
|
||||
<CMyPopupEdit
|
||||
:table="mytable"
|
||||
|
||||
Reference in New Issue
Block a user