Browse Source

天合修复bug

master
songguoqiang 6 months ago
parent
commit
abb5b0c22c
  1. 131
      src/views/eam/basic/item/index.vue
  2. 2
      src/views/eam/basic/item/item.data.ts
  3. 161
      src/views/eam/item/itemAccounts/index.vue
  4. 100
      src/views/eam/item/itemInLocation/index.vue
  5. 69
      src/views/eam/item/itemOutLocation/index.vue

131
src/views/eam/basic/item/index.vue

@ -1,19 +1,36 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="Item.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search
:schema="Item.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" :allSchemas="Item.allSchemas" />
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="Item.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort">
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{ row }">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
@ -26,9 +43,16 @@
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="ItemRules" :formAllSchemas="Item.allSchemas"
:apiUpdate="ItemApi.updateItem" :apiCreate="ItemApi.createItem" @searchTableSuccess="searchTableSuccess"
:isBusiness="false" />
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="ItemRules"
:formAllSchemas="Item.allSchemas"
:apiUpdate="ItemApi.updateItem"
:apiCreate="ItemApi.createItem"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<SearchTable ref="searchTableRef" @searchTableSuccess="submitItem" />
@ -36,8 +60,12 @@
<Detail ref="detailRef" :isBasic="true" :allSchemas="Item.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/item/import" :importTemplateData="importTemplateData" @success="importSuccess" />
<ImportForm
ref="importFormRef"
url="/eam/item/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template>
<script setup lang="ts">
@ -45,7 +73,10 @@
import { Item, ItemRules } from './item.data'
import * as ItemApi from '@/api/eam/basic/item'
import { createDeviceItemBatch, getDeviceItemPage, getDeviceItemNoPage } from '@/api/eam/basic/rel'
import { DeviceAccounts, DeviceAccountsRules } from '@/views/eam/device/deviceAccounts/deviceAccounts.data'
import {
DeviceAccounts,
DeviceAccountsRules
} from '@/views/eam/device/deviceAccounts/deviceAccounts.data'
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
@ -60,7 +91,7 @@
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const itemNumber = ref();
const itemNumber = ref()
const tableColumns = ref(Item.allSchemas.tableColumns)
const importFormRef = ref()
@ -92,21 +123,27 @@
defaultButtons.defaultExportBtn({ hasPermi: 'basic:item:export' }), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
defaultButtons.defaultSetBtn(null) //
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
if (val == 'add') {
//
openForm('create')
}else if (val == 'import') { //
} else if (val == 'import') {
//
handleImport()
} else if (val == 'export') { //
} else if (val == 'export') {
//
handleExport()
} else if (val == 'refresh') { //
} else if (val == 'refresh') {
//
getList()
} else if (val == 'filtrate') { //
} else { //
} else if (val == 'filtrate') {
//
} else {
//
console.log('其他按钮', item)
}
}
@ -114,16 +151,18 @@
// -
const butttondata = [
defaultButtons.mainListEditBtn({ hasPermi: 'basic:item:update' }), //
defaultButtons.mainListDeleteBtn({ hasPermi: 'basic:item:delete' }), //
defaultButtons.mainListDeleteBtn({ hasPermi: 'basic:item:delete' }) //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'chooseDevice') {
openItem(row.number)
} else if (val == 'delete') { //
} else if (val == 'delete') {
//
handleDelete(row.id)
}
}
@ -151,29 +190,29 @@
const searchTableSelections = ref([])
const CallBack1 = async () => {
await getDeviceItemNoPage({ itemNumber: itemNumber.value }).then(async (res) => {
await DeviceAccountsApi.getDeviceAccountsAllNoPage({}).then(response => {
searchTableSelections.value = response.filter(element => {
let flag = false;
res.forEach(item => {
await DeviceAccountsApi.getDeviceAccountsAllNoPage({}).then((response) => {
searchTableSelections.value = response.filter((element) => {
let flag = false
res.forEach((item) => {
if (element.number == item.deviceNumber) {
flag = true;
flag = true
}
})
return flag
})
})
})
}
});
return flag;
});
});
});
};
const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => {
const deviceItemRelList = selections.map(element => ({
const deviceItemRelList = selections.map((element) => ({
itemNumber: itemNumber.value,
deviceNumber: element.number,
}));
createDeviceItemBatch(deviceItemRelList).then(res => {
deviceNumber: element.number
}))
createDeviceItemBatch(deviceItemRelList).then((res) => {
message.success(t('common.createSuccess'))
})
};
}
/** 添加/修改操作 */
const basicFormRef = ref()
@ -184,16 +223,17 @@
// form
const formsSuccess = async (formType, data) => {
var isHave = Item.allSchemas.formSchema.some(function (item) {
return item.field === 'maxInventory' || item.field === 'minInventory';
});
return item.field === 'maxInventory' || item.field === 'minInventory'
})
if (isHave) {
if (data.minInventory && data.maxInventory && data.minInventory >= data.maxInventory) {
message.error('最高库存要大于最低库存')
return false;
return false
}
}
if (data.maxInventory == 0) data.maxInventory = null;
if (data.minInventory == 0) data.minInventory = null;
if (data.maxInventory == 0) data.maxInventory = null
if (data.minInventory == 0) data.minInventory = null
try {
if (formType === 'create') {
await ItemApi.createItem(data)
message.success(t('common.createSuccess'))
@ -203,6 +243,9 @@
}
basicFormRef.value.dialogVisible = false
getList()
} finally {
basicFormRef.value.formLoading = false
}
}
/** 详情操作 */

2
src/views/eam/basic/item/item.data.ts

@ -10,6 +10,8 @@ export const ItemRules = reactive({
uom: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
classification: [ { required: true, message: '请输入备件编号', trigger: 'blur' }
],
})
export const ItemSearchTable = useCrudSchemas(reactive<CrudSchema[]>([

161
src/views/eam/item/itemAccounts/index.vue

@ -1,38 +1,72 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="ItemAccounts.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search
:schema="ItemAccounts.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" :allSchemas="ItemAccounts.allSchemas" />
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="ItemAccounts.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort">
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{ row }">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase
:Butttondata="butttondata(row)"
@button-base-click="buttonTableClick($event, row)"
/>
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="ItemAccountsRules"
:formAllSchemas="ItemAccounts.allSchemas" :apiUpdate="ItemAccountsApi.updateItemAccounts"
:apiCreate="ItemAccountsApi.createItemAccounts" @searchTableSuccess="searchTableSuccess" :isBusiness="false" />
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="ItemAccountsRules"
:formAllSchemas="ItemAccounts.allSchemas"
:apiUpdate="ItemAccountsApi.updateItemAccounts"
:apiCreate="ItemAccountsApi.createItemAccounts"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<BasicForm ref="basicFormRef1" @success="formsSuccess" :rules="ItemInRules"
:formAllSchemas="ItemIn.allSchemas" :apiUpdate="ItemAccountsApi.updateItemAccounts"
:apiCreate="ItemAccountsApi.createItemAccounts" @searchTableSuccess="searchTableSuccess" :isBusiness="false" />
<BasicForm
ref="basicFormRef1"
@success="formsSuccess"
:rules="ItemInRules"
:formAllSchemas="ItemIn.allSchemas"
:apiUpdate="ItemAccountsApi.updateItemAccounts"
:apiCreate="ItemAccountsApi.createItemAccounts"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<SearchTable ref="searchTableRef" @searchTableSuccess="submitItem" />
@ -40,8 +74,12 @@
<Detail ref="detailRef" :isBasic="true" :allSchemas="ItemAccounts.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/item/item-accounts/import" :importTemplateData="importTemplateData"
@success="importSuccess" />
<ImportForm
ref="importFormRef"
url="/eam/item/item-accounts/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template>
<script setup lang="ts">
@ -68,10 +106,12 @@
const tableColumns = ref(ItemAccounts.allSchemas.tableColumns)
//
const searchTableSuccess = async(formField, searchField, val, formRef) => {//
const searchTableSuccess = async (formField, searchField, val, formRef) => {
//
if (formField == 'itemNumber') {
const aa = await ItemAccountsApi.getByItemNumber(val[0][searchField]);
if(aa.locationNumber==null||aa.locationNumber==''){//
const aa = await ItemAccountsApi.getByItemNumber(val[0][searchField])
if (aa.locationNumber == null || aa.locationNumber == '') {
//
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
@ -82,7 +122,8 @@
setV['areaName'] = ''
formRef.setValues(setV)
})
}else{//
} else {
//
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
@ -94,7 +135,9 @@
formRef.setValues(setV)
})
}
}if(formField=='locationNumber'){//
}
if (formField == 'locationNumber') {
//
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
@ -108,7 +151,6 @@
formRef.setValues(setV)
})
}
}
//
@ -131,7 +173,7 @@
defaultButtons.defaultExportBtn({ hasPermi: 'item:itemAccounts:export' }), //
defaultButtons.defaultFreshBtn(null), //
//defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
defaultButtons.defaultSetBtn(null) //
// {
// label: '',
// name: 'zdy',
@ -144,16 +186,22 @@
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
if (val == 'add') {
//
openForm('create')
} else if (val == 'import') { //
} else if (val == 'import') {
//
handleImport()
} else if (val == 'export') { //
} else if (val == 'export') {
//
handleExport()
} else if (val == 'refresh') { //
} else if (val == 'refresh') {
//
getList()
} else if (val == 'filtrate') { //
} else if(val=='itemIn'){ //
} else if (val == 'filtrate') {
//
} else if (val == 'itemIn') {
//
openForm('itemIn')
}
}
@ -162,22 +210,32 @@
const butttondata = (row) => {
return [
//defaultButtons.mainListEditBtn({ hasPermi: 'item:itemAccounts:update' }), //
defaultButtons.replaceLocation({ hasPermi: 'item:itemAccounts:replaceLocation',hide:!(row.display)}), //
defaultButtons.newTurnIn({ hasPermi: 'item:itemAccounts:newTurnIn',hide:!(row.type=='2'&& row.qty>0)}), //
defaultButtons.replaceLocation({
hasPermi: 'item:itemAccounts:replaceLocation',
hide: !row.display
}), //
defaultButtons.newTurnIn({
hasPermi: 'item:itemAccounts:newTurnIn',
hide: !(row.type == '2' && row.qty > 0)
}) //
//defaultButtons.mainListDeleteBtn({ hasPermi: 'item:itemAccounts:delete' }), //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'delete') { //
} else if (val == 'delete') {
//
handleDelete(row.id)
} else if (val == 'replaceLocation') {//
} else if (val == 'replaceLocation') {
//
openItem(row.locationNumber, row.id)
}else if (val == 'newTurnIn') {//
openForm('newTurnIn', row);
} else if (val == 'newTurnIn') {
//
openForm('newTurnIn', row)
}
}
@ -203,7 +261,7 @@
const deviceItemRelList = selections.map((element) => ({
id: wantId1.value,
locationNumber: locationNumber.value,
itemNumber: element.number,
itemNumber: element.number
}))
ItemAccountsApi.replaceLocation(deviceItemRelList).then((res) => {
message.success(t('更换成功'))
@ -216,8 +274,7 @@
try {
const res = await ItemApi.getItemPage({
...Item.allSchemas.searchSchema,
available: "TRUE"
available: 'TRUE'
})
if (res.list?.length > 0) {
// const response = await getDeviceItemPage(DeviceAccounts.allSchemas.searchSchema);
@ -239,52 +296,54 @@
/** 添加/修改操作 */
const basicFormRef = ref()
const basicFormRef1 = ref();
const basicFormRef1 = ref()
const openForm = (type: string, row?: any) => {
//debugger
// if(type=='itemIn'){
// row?.type = null;
// row?.itemName=null;
// }
if(type=='newTurnIn'){//
if (type == 'newTurnIn') {
//
//
ItemIn.allSchemas.formSchema.find(item => item.field == 'qty').componentProps.max = row.qty//
ItemIn.allSchemas.formSchema.find((item) => item.field == 'qty').componentProps.max = row.qty //
basicFormRef1.value.open(type, row)
} else {
basicFormRef.value.open(type, row)
}
}
// form
const formsSuccess = async (formType, data) => {
var isHave = ItemAccounts.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
return item.field === 'activeTime' || item.field === 'expireTime'
})
if (isHave) {
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间')
return;
return
}
}
if (data.activeTime == 0) data.activeTime = null;
if (data.expireTime == 0) data.expireTime = null;
if (data.activeTime == 0) data.activeTime = null
if (data.expireTime == 0) data.expireTime = null
try {
if (formType === 'create') {
await ItemAccountsApi.createItemAccounts(data)
message.success(t('common.createSuccess'))
} if (formType === 'newTurnIn') {//
}
if (formType === 'newTurnIn') {
//
await ItemAccountsApi.newTurnIn(data)
message.success(t('common.createSuccess'))
} else {
await ItemAccountsApi.updateItemAccounts(data)
message.success(t('common.updateSuccess'))
basicFormRef.value.dialogVisible = false
getList()
}
} finally {
basicFormRef.value.dialogVisible = false
basicFormRef1.value.dialogVisible = false
basicFormRef.value.formLoading = false
}
getList()
}
/** 详情操作 */

100
src/views/eam/item/itemInLocation/index.vue

@ -1,20 +1,36 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="ItemInLocation.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search
:schema="ItemInLocation.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick"
:allSchemas="ItemInLocation.allSchemas" />
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="ItemInLocation.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort">
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{ row }">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
@ -27,16 +43,27 @@
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="ItemInLocationRules"
:formAllSchemas="ItemInLocation.allSchemas" :apiUpdate="ItemInLocationApi.updateItemInLocation"
:apiCreate="ItemInLocationApi.createItemInLocation" @searchTableSuccess="searchTableSuccess" :isBusiness="false" />
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="ItemInLocationRules"
:formAllSchemas="ItemInLocation.allSchemas"
:apiUpdate="ItemInLocationApi.updateItemInLocation"
:apiCreate="ItemInLocationApi.createItemInLocation"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="ItemInLocation.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/record/item-in-location/import" :importTemplateData="importTemplateData"
@success="importSuccess" />
<ImportForm
ref="importFormRef"
url="/record/item-in-location/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template>
<script setup lang="ts">
@ -61,15 +88,15 @@
//
const searchTableSuccess = async (formField, searchField, val, formRef) => {
const ret = await ItemAccountApi.getByLocationNumber(val[0][searchField]);
const ret = await ItemAccountApi.getByLocationNumber(val[0][searchField])
if (ret.itemNumber == null || ret.itemNumber == '' || !ret.itemNumber) {
nextTick(() => {
const setV = {}
setV[formField] = '';
setV[formField] = ''
setV[formField] = val[0][searchField]
formRef.setValues(setV)
message.info('该库位下无绑定的备件')
return;
return
})
} else {
nextTick(() => {
@ -80,7 +107,6 @@
formRef.setValues(setV)
})
}
}
//
@ -101,7 +127,7 @@
defaultButtons.defaultExportBtn({ hasPermi: 'item:itemInLocation:export' }), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
defaultButtons.defaultSetBtn(null) //
// {
// label: '',
// name: 'zdy',
@ -114,16 +140,22 @@
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
if (val == 'add') {
//
openForm('create')
} else if (val == 'import') { //
} else if (val == 'import') {
//
handleImport()
} else if (val == 'export') { //
} else if (val == 'export') {
//
handleExport()
} else if (val == 'refresh') { //
} else if (val == 'refresh') {
//
getList()
} else if (val == 'filtrate') { //
} else { //
} else if (val == 'filtrate') {
//
} else {
//
console.log('其他按钮', item)
}
}
@ -131,14 +163,16 @@
// -
const butttondata = [
defaultButtons.mainListEditBtn({ hasPermi: 'item:itemInLocation:update' }), //
defaultButtons.mainListDeleteBtn({ hasPermi: 'item:itemInLocation:delete' }), //
defaultButtons.mainListDeleteBtn({ hasPermi: 'item:itemInLocation:delete' }) //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'delete') { //
} else if (val == 'delete') {
//
handleDelete(row.id)
}
}
@ -152,16 +186,17 @@
// form
const formsSuccess = async (formType, data) => {
var isHave = ItemInLocation.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
return item.field === 'activeTime' || item.field === 'expireTime'
})
if (isHave) {
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间')
return;
return
}
}
if (data.activeTime == 0) data.activeTime = null;
if (data.expireTime == 0) data.expireTime = null;
if (data.activeTime == 0) data.activeTime = null
if (data.expireTime == 0) data.expireTime = null
try {
if (formType === 'create') {
await ItemInLocationApi.createItemInLocation(data)
message.success(t('common.createSuccess'))
@ -171,6 +206,9 @@
}
basicFormRef.value.dialogVisible = false
getList()
} finally {
basicFormRef.value.formLoading = false
}
}
/** 详情操作 */

69
src/views/eam/item/itemOutLocation/index.vue

@ -1,7 +1,11 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="ItemOutLocation.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search
:schema="ItemOutLocation.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 -->
@ -54,7 +58,12 @@
<Detail ref="detailRef" :isBasic="true" :allSchemas="ItemOutLocation.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/record/item-out-location/import" :importTemplateData="importTemplateData" @success="importSuccess" />
<ImportForm
ref="importFormRef"
url="/record/item-out-location/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template>
<script setup lang="ts">
@ -79,11 +88,12 @@ const tableColumns = ref(ItemOutLocation.allSchemas.tableColumns)
//
const searchTableSuccess = async (formField, searchField, val, formRef) => {
if(formField=='locationNumber'){//
let aa = await ItemAccountsApi.getByLocationNumber(val[0][searchField]);
if (formField == 'locationNumber') {
//
let aa = await ItemAccountsApi.getByLocationNumber(val[0][searchField])
if (aa.id == null) {
message.info("该库位下无备件信息");
return;
message.info('该库位下无备件信息')
return
}
nextTick(() => {
const setV = {}
@ -92,11 +102,11 @@ const searchTableSuccess = async(formField, searchField, val, formRef) => {
setV['itemName'] = aa.itemName
setV['itemNumber'] = aa.itemNumber
setV['qty'] = aa.qty
ItemOutLocation.allSchemas.formSchema.find(item => item.field == 'qty').componentProps.max = aa.qty//
ItemOutLocation.allSchemas.formSchema.find((item) => item.field == 'qty').componentProps.max =
aa.qty //
formRef.setValues(setV)
})
}
}
//
@ -117,7 +127,7 @@ const HeadButttondata = [
defaultButtons.defaultExportBtn({ hasPermi: 'item:itemOutLocation:export' }), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
defaultButtons.defaultSetBtn(null) //
// {
// label: '',
// name: 'zdy',
@ -130,16 +140,22 @@ const HeadButttondata = [
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
if (val == 'add') {
//
openForm('create')
} else if (val == 'import') { //
} else if (val == 'import') {
//
handleImport()
} else if (val == 'export') { //
} else if (val == 'export') {
//
handleExport()
} else if (val == 'refresh') { //
} else if (val == 'refresh') {
//
getList()
} else if (val == 'filtrate') { //
} else { //
} else if (val == 'filtrate') {
//
} else {
//
console.log('其他按钮', item)
}
}
@ -147,14 +163,16 @@ const buttonBaseClick = (val, item) => {
// -
const butttondata = [
defaultButtons.mainListEditBtn({ hasPermi: 'item:itemOutLocation:update' }), //
defaultButtons.mainListDeleteBtn({hasPermi:'item:itemOutLocation:delete'}), //
defaultButtons.mainListDeleteBtn({ hasPermi: 'item:itemOutLocation:delete' }) //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'delete') { //
} else if (val == 'delete') {
//
handleDelete(row.id)
}
}
@ -168,16 +186,17 @@ const openForm = (type: string, row?: any) => {
// form
const formsSuccess = async (formType, data) => {
var isHave = ItemOutLocation.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
return item.field === 'activeTime' || item.field === 'expireTime'
})
if (isHave) {
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间')
return;
return
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (data.activeTime == 0) data.activeTime = null
if (data.expireTime == 0) data.expireTime = null
try {
if (formType === 'create') {
await ItemOutLocationApi.createItemOutLocation(data)
message.success(t('common.createSuccess'))
@ -187,6 +206,9 @@ const formsSuccess = async (formType,data) => {
}
basicFormRef.value.dialogVisible = false
getList()
} finally {
basicFormRef.value.formLoading = false
}
}
/** 详情操作 */
@ -253,5 +275,4 @@ onMounted(async () => {
getList()
importTemplateData.templateUrl = await ItemOutLocationApi.importTemplate()
})
</script>

Loading…
Cancel
Save