Sfoglia il codice sorgente

202103240803

master
teddyhuang 5 anni fa
parent
commit
1567558198
4 ha cambiato i file con 216 aggiunte e 194 eliminazioni
  1. +120
    -110
      app/src/components/AssetGroup.vue
  2. +90
    -78
      app/src/components/Inventory.vue
  3. +2
    -2
      src/main/java/com/moze/rms/controller/AssertGroupController.java
  4. +4
    -4
      src/main/java/com/moze/rms/dao/AssertDAO.java

+ 120
- 110
app/src/components/AssetGroup.vue Vedi File

@@ -164,7 +164,10 @@
<v-data-table
:items='allCols[item.value]'
:headers='headers'
hide-default-footer
:height="fullHeight*7/9"
fixed-header
:footer-props="{'items-per-page-options': [30, 40, 50, 60]}"
:items-per-page="30"
>
<template v-slot:item.isselect='{ item }'>
{{item.isselect === 'true' ? '選項':'文字'}}
@@ -179,92 +182,12 @@
{{item.isselect === 'true' ? '是':'否'}}
</template>
<template v-slot:item.actions='{ item }'>
<!--修改資產群駔欄位對話-->
<v-dialog
v-model='dialogModify'
@click:outside='close'
:retain-focus="false"
overlay-opacity="0"
<v-btn
icon
@click='openDialogModifyCol(item)'
>
<template v-slot:activator='{ on, attrs }'>
<v-btn
v-bind='attrs'
v-on='on'
icon
@click='modifyColItem = JSON.parse(JSON.stringify(item))'
>
<v-icon>mdi-pencil</v-icon>
</v-btn>
</template>
<v-card>
<v-card-title>
<span class='headline font-weight-bold'>修改欄位</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col
v-for='(header, index) in headers'
:key='index'
cols='12'
sm='6'
md='4'
class='d-flex'
>
<v-text-field
v-if="header.text !== '' && header.value !== 'isselect' && isBooleanCol.indexOf(header.value) < 0"
:label='header.text'
:value="modifyColItem[header.value]"
hint='必填'
v-on:input='oninput(modifyColItem, header.value, $event)'
/>
<v-select
v-if="header.value === 'isselect' && isBooleanCol.indexOf(header.value) < 0"
:label='header.text' hint='必填'
:value="modifyColItem[header.value]"
v-on:input='oninput(modifyColItem, header.value, $event)'
:items="selectColItem.isselect"
:item-text="selectColItem.isselect.text"
:item-value="selectColItem.isselect.value"
/>
<v-select
v-if="header.value && isBooleanCol.indexOf(header.value) >= 0"
:label='header.text' hint='必填'
:value="modifyColItem[header.value]"
v-on:input='oninput(modifyColItem, header.value, $event)'
:items="selectColItem.boolean"
:item-text="selectColItem.boolean.text"
:item-value="selectColItem.boolean.value"
/>
<v-btn
v-if="header.value === 'isselect' && modifyColItem.isselect === 'true'"
@click='dialogModifySelectItem = true'
>
編輯選項
</v-btn>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color='blue darken-1'
text
@click='close'
>
取消
</v-btn>
<v-btn
color='blue darken-1'
text
@click='modifyCol'
>
修改
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-icon>mdi-pencil</v-icon>
</v-btn>
<v-icon
small
@click='deleteCol(item)'
@@ -358,45 +281,114 @@
</v-card-actions>
</v-card>
</v-dialog>
<!--新增資產群組欄位選項對話-->
<v-dialog
width="40%"
v-model='dialogInsertSelectItem'
@click:outside='closeDialogInsertSelectItem'
:retain-focus="false"
overlay-opacity="0"
>
<v-card>
<v-card-title>
<span class='headline font-weight-bold'>編輯選項</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col cols="11" class="d-flex align-center">
<v-text-field outlined rounded hide-details
v-model="insertSelectItem"/>
<v-btn class="ml-2" @click='pushInsertSelectItem'>新增</v-btn>
</v-col>
</v-row>
<v-card class="mt-2 col-10"
style="border: 1px solid grey;min-height: 500px;border-radius: 10px">
<v-chip
v-for="(insertSelectItem, index) in insertSelectItems"
:key="index"
class="col-12 my-1"
color="secondary"
>
{{insertSelectItem}}
<v-icon small class="ml-4" @click="deleteInsertSelectItem(index)">mdi-close
</v-icon>
</v-chip>
</v-card>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color='blue darken-1'
text
@click='closeDialogInsertSelectItem'
>
關閉
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</template>
</v-data-table>
</v-tab-item>
</v-tabs-items>
<!--新增資產群組欄位選項對話-->
<!--修改資產群駔欄位對話-->
<v-dialog
width="40%"
v-model='dialogInsertSelectItem'
@click:outside='closeDialogInsertSelectItem'
v-model='dialogModify'
@click:outside='close'
:retain-focus="false"
overlay-opacity="0"
>
<v-card>
<v-card-title>
<span class='headline font-weight-bold'>編輯選項</span>
<span class='headline font-weight-bold'>修改欄位</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col cols="11" class="d-flex align-center">
<v-text-field outlined rounded hide-details
v-model="insertSelectItem"/>
<v-btn class="ml-2" @click='pushInsertSelectItem'>新增</v-btn>
<v-col
v-for='(header, index) in headers'
:key='index'
cols='12'
sm='6'
md='4'
class='d-flex'
>
<v-text-field
v-if="header.text !== '' && header.value !== 'isselect' && isBooleanCol.indexOf(header.value) < 0"
:label='header.text'
:value="modifyColItem[header.value]"
hint='必填'
v-on:input='oninput(modifyColItem, header.value, $event)'
/>
<v-select
v-if="header.value === 'isselect' && isBooleanCol.indexOf(header.value) < 0"
:label='header.text' hint='必填'
:value="modifyColItem[header.value]"
v-on:input='oninput(modifyColItem, header.value, $event)'
:items="selectColItem.isselect"
:item-text="selectColItem.isselect.text"
:item-value="selectColItem.isselect.value"
/>
<v-select
v-if="header.value && isBooleanCol.indexOf(header.value) >= 0"
:label='header.text' hint='必填'
:value="modifyColItem[header.value]"
v-on:input='oninput(modifyColItem, header.value, $event)'
:items="selectColItem.boolean"
:item-text="selectColItem.boolean.text"
:item-value="selectColItem.boolean.value"
/>
<v-btn
v-if="header.value === 'isselect' && modifyColItem.isselect === 'true'"
@click='dialogModifySelectItem = true'
>
編輯選項
</v-btn>
</v-col>
</v-row>
<v-card class="mt-2 col-10"
style="border: 1px solid grey;min-height: 500px;border-radius: 10px">
<v-chip
v-for="(insertSelectItem, index) in insertSelectItems"
:key="index"
class="col-12 my-1"
color="secondary"
>
{{insertSelectItem}}
<v-icon small class="ml-4" @click="deleteInsertSelectItem(index)">mdi-close
</v-icon>
</v-chip>
</v-card>
</v-container>
</v-card-text>
<v-card-actions>
@@ -404,9 +396,16 @@
<v-btn
color='blue darken-1'
text
@click='closeDialogInsertSelectItem'
@click='close'
>
關閉
取消
</v-btn>
<v-btn
color='blue darken-1'
text
@click='modifyCol'
>
修改
</v-btn>
</v-card-actions>
</v-card>
@@ -475,6 +474,7 @@
},
data() {
return {
fullHeight: 0,
dialogInsert: false,
dialogModify: false,
dialogNewAssertGroup: false,
@@ -550,6 +550,12 @@
this.getTypes();
this.inventoryItems = [];
this.getCols();
this.fullHeight = window.innerHeight;
console.log(this.fullHeight);
window.onresize = () => {
// this.fullWidth = window.innerWidth;
this.fullHeight = window.innerHeight;
};
},
computed: {},
watch: {
@@ -578,6 +584,10 @@
// console.log(col);
console.log(this.modifySelectItems);
},
openDialogModifyCol(item) {
this.modifyColItem = JSON.parse(JSON.stringify(item));
this.dialogModify = true;
},
closeDialogInsertSelectItem() {
this.dialogInsertSelectItem = false;
},


+ 90
- 78
app/src/components/Inventory.vue Vedi File

@@ -1,6 +1,9 @@
<template>
<div>
<v-data-table class="pa-3 pt-5" :headers="headers" :items="items">
<v-data-table class="pa-3 pt-5" :headers="headers" :items="items" :height="fullHeight*7/9"
fixed-header
:footer-props="{'items-per-page-options': [30, 40, 50, 60]}"
:items-per-page="30">
<template v-slot:top>
<v-toolbar flat>
<v-toolbar-title class="title font-weight-bold">{{title}}</v-toolbar-title>
@@ -17,13 +20,14 @@
@click="exportFile"
icon
>
<v-icon >mdi-file-export-outline</v-icon>
<v-icon>mdi-file-export-outline</v-icon>
</v-btn>
<v-dialog
v-model="dialogSearch"
@click:outside="close"
:retain-focus="false"
>
<template v-slot:activator="{ on, attrs }" >
<template v-slot:activator="{ on, attrs }">
<v-btn
color="white"
class="primary mr-5"
@@ -31,7 +35,7 @@
v-on="on"
icon
>
<v-icon >mdi-magnify</v-icon>
<v-icon>mdi-magnify</v-icon>
</v-btn>

</template>
@@ -178,79 +182,12 @@
</v-toolbar>
</template>
<template v-slot:item.actions="{ item }">
<v-dialog
v-model="dialogModify"
@click:outside="close"
<v-btn
icon
@click="openDialogModify(item)"
>
<template v-slot:activator="{ on, attrs }">
<v-btn
v-bind="attrs"
v-on="on"
icon
@click="modifyItem = JSON.parse(JSON.stringify(item))"
>
<v-icon>mdi-pencil</v-icon>
</v-btn>
</template>
<v-card>
<v-card-title>
<span class="headline font-weight-bold">修改</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col

v-for="(val, key, index) in modifyItem"
:key="index"
cols="12"
sm="6"
md="4"
class="d-flex"
>
<v-text-field
v-if="isTextField(key) && headers[index].text"
:label="headers[index].text"
:disabled="isDisabled(key)"
v-bind:value="val"
:persistent-hint="isRequire(key)"
hint="必填"
v-on:input="oninput(modifyItem, key, $event)"
/>
<v-select
v-if="isSelect(key) && headers[index].text"
:persistent-hint="isRequire(key)"
hint="必選"
:label="headers[index].text"
:value="val"
v-on:input="oninput(modifyItem, key, $event)"
:items="selectItem[key]"
item-text="item"
item-value="item"
/>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="blue darken-1"
text
@click="close"
>
取消
</v-btn>
<v-btn
color="blue darken-1"
text
@click="modifyOne(item)"
>
修改
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-icon>mdi-pencil</v-icon>
</v-btn>
<v-icon
small
@click="deleteOne(item)"
@@ -259,6 +196,70 @@
</v-icon>
</template>
</v-data-table>
<v-dialog
v-model="dialogModify"
@click:outside="close"
:retain-focus="false"
>
<v-card>
<v-card-title>
<span class="headline font-weight-bold">修改</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col

v-for="(val, key, index) in modifyItem"
:key="index"
cols="12"
sm="6"
md="4"
class="d-flex"
>
<v-text-field
v-if="isTextField(key) && headers[index].text"
:label="headers[index].text"
:disabled="isDisabled(key)"
v-bind:value="val"
:persistent-hint="isRequire(key)"
hint="必填"
v-on:input="oninput(modifyItem, key, $event)"
/>
<v-select
v-if="isSelect(key) && headers[index].text"
:persistent-hint="isRequire(key)"
hint="必選"
:label="headers[index].text"
:value="val"
v-on:input="oninput(modifyItem, key, $event)"
:items="selectItem[key]"
item-text="item"
item-value="item"
/>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="blue darken-1"
text
@click="close"
>
取消
</v-btn>
<v-btn
color="blue darken-1"
text
@click="modifyOne(item)"
>
修改
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</template>
<script>
@@ -266,6 +267,7 @@
name: '',
data() {
return {
fullHeight: 0,
dialogInsert: false,
dialogModify: false,
dialogSearch: false,
@@ -287,6 +289,12 @@
this.getInventories();
this.getTitle();
this.getSelectItem();
this.fullHeight = window.innerHeight;
console.log(this.fullHeight);
window.onresize = () => {
// this.fullWidth = window.innerWidth;
this.fullHeight = window.innerHeight;
};
},
computed: {
tablename() {
@@ -312,6 +320,10 @@
log() {
alert('as');
},
openDialogModify(item) {
this.modifyItem = JSON.parse(JSON.stringify(item));
this.dialogModify = true;
},
oninput(item, key, val) {
this.$set(item, key, val);
},
@@ -326,7 +338,7 @@
this.cols = resp.data.data;
resp.data.data.forEach((item) => {
let header = {'text': null, 'value': null};
header.text = item.descript;
header.text = item.descript;
header.value = item.colname;
this.headers.push(header);
if (item.isselect === 'true') {
@@ -348,7 +360,7 @@
insertOne() {
this.insertItem.tablename = this.tablename;
this.$axios.post(`/inventory?`, this.insertItem).then(() => {
delete this.insertItem.tablename;
delete this.insertItem.tablename;
this.getInventories();
this.close();
}


+ 2
- 2
src/main/java/com/moze/rms/controller/AssertGroupController.java Vedi File

@@ -90,8 +90,8 @@ public class AssertGroupController {
System.out.println(mappingCol);
// assertDAO.modifyColToTable(mappingCol);

assertDAO.sortCol1(mappingCol.getOldIndex(), mappingCol.getIndex());
assertDAO.sortCol2(mappingCol.getOldIndex(), mappingCol.getIndex());
assertDAO.sortCol1(mappingCol.getOldIndex(), mappingCol.getIndex(), mappingCol.getTablename());
assertDAO.sortCol2(mappingCol.getOldIndex(), mappingCol.getIndex(), mappingCol.getTablename());

assertDAO.modifyColToMappingCol(mappingCol);
assertDAO.modifySelectItems(mappingCol);


+ 4
- 4
src/main/java/com/moze/rms/dao/AssertDAO.java Vedi File

@@ -222,11 +222,11 @@ public interface AssertDAO extends SqlObject {
handle.createUpdate(sql).execute();
}

@SqlUpdate("update mapping.mapping_col set index = index + 1 where index < ?::numeric and index >= ?::numeric ")
void sortCol1(String oldIndex ,String index);
@SqlUpdate("update mapping.mapping_col set index = index + 1 where index < ?::numeric and index >= ?::numeric where tablename = ?")
void sortCol1(String oldIndex ,String index, String tablename);

@SqlUpdate("update mapping.mapping_col set index = index - 1 where index > ?::numeric and index <= ?::numeric ")
void sortCol2(String oldIndex ,String index);
@SqlUpdate("update mapping.mapping_col set index = index - 1 where index > ?::numeric and index <= ?::numeric where tablename = ?")
void sortCol2(String oldIndex ,String index, String tablename);

@SqlUpdate("select index from mapping.mapping_col where tablename = ? order by index desc limit 1;")
Integer getLastIndex(String tablename);


Caricamento…
Annulla
Salva