This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
<gz-report-selector ref="reportSelector"></gz-report-selector>
|
<gz-report-selector ref="reportSelector"></gz-report-selector>
|
||||||
<div v-if="formState.ready">
|
<div v-if="formState.ready">
|
||||||
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
|
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
|
||||||
|
{{ obj }}
|
||||||
<v-form ref="form">
|
<v-form ref="form">
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col cols="12">
|
<v-col cols="12">
|
||||||
@@ -16,8 +17,45 @@
|
|||||||
data-cy="selectedPartId"
|
data-cy="selectedPartId"
|
||||||
></gz-pick-list>
|
></gz-pick-list>
|
||||||
</v-col>
|
</v-col>
|
||||||
PartSerialNumbersAvailable list here
|
<v-col cols="12" sm="6" v-if="!formState.readOnly">
|
||||||
{{ obj }}
|
<v-textarea
|
||||||
|
v-model="newSerial"
|
||||||
|
:label="$ay.t('PartSerialNumbersAvailable')"
|
||||||
|
clearable
|
||||||
|
no-resize
|
||||||
|
rows="4"
|
||||||
|
ref="newSerial"
|
||||||
|
data-cy="newSerial"
|
||||||
|
append-outer-icon="$ayiPlus"
|
||||||
|
@click:append-outer="addItem()"
|
||||||
|
></v-textarea>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="12">
|
||||||
|
<v-simple-table>
|
||||||
|
<template v-slot:default>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th />
|
||||||
|
<!-- <th class="text-left">
|
||||||
|
{{ $ay.t("PartSerialNumbersAvailable") }}
|
||||||
|
</th> -->
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="(item, index) in sortedList()" :key="index">
|
||||||
|
<td>
|
||||||
|
{{ item }}
|
||||||
|
|
||||||
|
<v-icon class="ml-6" @click="removeItem(index)">
|
||||||
|
$ayiTrashAlt
|
||||||
|
</v-icon>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</template>
|
||||||
|
</v-simple-table>
|
||||||
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-form>
|
</v-form>
|
||||||
</div>
|
</div>
|
||||||
@@ -106,7 +144,8 @@ export default {
|
|||||||
},
|
},
|
||||||
rights: window.$gz.role.defaultRightsObject(),
|
rights: window.$gz.role.defaultRightsObject(),
|
||||||
ayaType: window.$gz.type.Part,
|
ayaType: window.$gz.type.Part,
|
||||||
selectedPartId: Number(this.$route.params.recordid)
|
selectedPartId: Number(this.$route.params.recordid),
|
||||||
|
newSerial: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -128,16 +167,38 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
sortedList: function() {
|
||||||
|
if (this.obj == null || this.obj.length == 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.obj.slice().sort();
|
||||||
|
},
|
||||||
|
removeItem: function(index) {
|
||||||
|
vm.obj.splice(index, 1);
|
||||||
|
vm.formState.dirty = true;
|
||||||
|
},
|
||||||
canSave: function() {
|
canSave: function() {
|
||||||
return this.formState.valid && this.formState.dirty;
|
return this.formState.valid && this.formState.dirty;
|
||||||
},
|
},
|
||||||
|
addItem: function() {
|
||||||
|
if (this.newSerial == null || this.newSerial == "") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//add to list, may be in various formats so handle that
|
||||||
|
let splitted = this.newSerial.split(/[\s,]+/).filter(Boolean);
|
||||||
|
splitted = [...splitted, ...this.obj];
|
||||||
|
let uniqueItems = [...new Set(splitted)];
|
||||||
|
uniqueItems.sort();
|
||||||
|
console.log(uniqueItems);
|
||||||
|
//1,2,3,1,014369160,5,3,9,qw
|
||||||
|
},
|
||||||
ayaTypes: function() {
|
ayaTypes: function() {
|
||||||
return window.$gz.type;
|
return window.$gz.type;
|
||||||
},
|
},
|
||||||
// form() {
|
form() {
|
||||||
// return window.$gz.form;
|
return window.$gz.form;
|
||||||
// },
|
},
|
||||||
// fieldValueChanged(ref) {
|
// fieldValueChanged(ref) {
|
||||||
// if (
|
// if (
|
||||||
// this.formState.ready &&
|
// this.formState.ready &&
|
||||||
@@ -281,14 +342,14 @@ function generateMenu(vm) {
|
|||||||
let menuOptions = {
|
let menuOptions = {
|
||||||
isMain: false,
|
isMain: false,
|
||||||
readOnly: vm.formState.readOnly,
|
readOnly: vm.formState.readOnly,
|
||||||
icon: "$ayiProjectDiagram",
|
icon: null,
|
||||||
title: "Project",
|
title: "PartSerialNumbersAvailable",
|
||||||
helpUrl: "form-svc-projects",
|
helpUrl: "form-inv-part-serials",
|
||||||
formData: {
|
formData: {
|
||||||
ayaType: window.$gz.type.Project,
|
// ayaType: window.$gz.type.Par,
|
||||||
recordId: vm.$route.params.recordid,
|
// recordId: vm.$route.params.recordid,
|
||||||
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
|
// formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
|
||||||
recordName: vm.obj.name
|
// recordName: vm.obj.name
|
||||||
},
|
},
|
||||||
menuItems: []
|
menuItems: []
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user