Browse Source

天合修复bug

master
songguoqiang 6 months ago
parent
commit
abb5b0c22c
  1. 303
      src/views/eam/basic/item/index.vue
  2. 2
      src/views/eam/basic/item/item.data.ts
  3. 341
      src/views/eam/item/itemAccounts/index.vue
  4. 258
      src/views/eam/item/itemInLocation/index.vue
  5. 93
      src/views/eam/item/itemOutLocation/index.vue

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

@ -1,34 +1,58 @@
<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">
<template #code="{row}">
}"
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" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, row)" />
</template>
</Table>
</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,101 +60,116 @@
<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">
import download from '@/utils/download'
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 * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
import { SearchTable } from '@/components/SearchTable'
defineOptions({ name: 'Item' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const itemNumber = ref();
const tableColumns = ref(Item.allSchemas.tableColumns)
const importFormRef = ref()
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
import download from '@/utils/download'
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 * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
import { SearchTable } from '@/components/SearchTable'
defineOptions({ name: 'Item' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const itemNumber = ref()
const tableColumns = ref(Item.allSchemas.tableColumns)
const importFormRef = ref()
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
}
//
const updataTableColumns = (val) => {
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
}
const { tableObject, tableMethods } = useTable({
const { tableObject, tableMethods } = useTable({
getListApi: ItemApi.getItemPage //
})
})
//
const { getList, setSearchParams } = tableMethods
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({ hasPermi: 'basic:item:create' }), //
defaultButtons.defaultImportBtn(null), //
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') { //
//
const buttonBaseClick = (val, item) => {
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)
}
}
}
// -
const butttondata = [
// -
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') { //
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'chooseDevice') {
openItem(row.number)
} else if (val == 'delete') { //
} else if (val == 'delete') {
//
handleDelete(row.id)
}
}
}
const searchTableRef = ref()
/** 绑定备件操作 */
const openItem = async (number : String) => {
const searchTableRef = ref()
/** 绑定备件操作 */
const openItem = async (number: String) => {
itemNumber.value = number
await CallBack1()
searchTableRef.value.open(
@ -146,54 +185,55 @@
null,
searchTableSelections.value
)
}
}
const searchTableSelections = ref([])
const CallBack1 = async () => {
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 submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => {
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()
const openForm = (type : string, row ?: any) => {
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
}
// form
const formsSuccess = async (formType, data) => {
// 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,16 +243,19 @@
}
basicFormRef.value.dialogVisible = false
getList()
} finally {
basicFormRef.value.formLoading = false
}
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row : any, titleName : any, titleValue : any) => {
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicItem')
}
}
/** 删除按钮操作 */
const handleDelete = async (id : number) => {
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
@ -221,12 +264,12 @@
message.success(t('common.delSuccess'))
//
await getList()
} catch { }
}
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
@ -238,38 +281,38 @@
} finally {
exportLoading.value = false
}
}
}
onMounted(async () => {
onMounted(async () => {
importTemplateData.templateUrl = await ItemApi.importTemplate()
})
})
const handleImport = () => {
const handleImport = () => {
importFormRef.value.open()
}
}
//
const importTemplateData = reactive({
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '物料导入模版.xlsx'
})
})
//
const importSuccess = () => {
//
const importSuccess = () => {
getList()
}
}
//
const searchFormClick = (searchData) => {
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
}
/** 初始化 **/
onMounted(async () => {
/** 初始化 **/
onMounted(async () => {
getList()
})
})
</script>

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[]>([

341
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">
<template #code="{row}">
}"
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,38 +74,44 @@
<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">
import download from '@/utils/download'
import { ItemAccounts, ItemAccountsRules } from './itemAccounts.data'
import { ItemIn, ItemInRules } from './itemIn.data'
import * as ItemAccountsApi from '@/api/eam/item/itemAccounts'
import { Item } from '@/views/eam/basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
import download from '@/utils/download'
import { ItemAccounts, ItemAccountsRules } from './itemAccounts.data'
import { ItemIn, ItemInRules } from './itemIn.data'
import * as ItemAccountsApi from '@/api/eam/item/itemAccounts'
import { Item } from '@/views/eam/basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'ItemAccounts' })
defineOptions({ name: 'ItemAccounts' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
const locationNumber = ref()
const wantId1 = ref()
routeName.value = route.name
const tableColumns = ref(ItemAccounts.allSchemas.tableColumns)
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
const locationNumber = ref()
const wantId1 = ref()
routeName.value = route.name
const tableColumns = ref(ItemAccounts.allSchemas.tableColumns)
//
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 searchTableSuccess = async (formField, searchField, val, formRef) => {
//
if (formField == 'itemNumber') {
const aa = await ItemAccountsApi.getByItemNumber(val[0][searchField])
if (aa.locationNumber == null || aa.locationNumber == '') {
//
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
@ -82,56 +122,58 @@
setV['areaName'] = ''
formRef.setValues(setV)
})
}else{//
} else {
//
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
setV['itemName'] = val[0]['name']
setV['locationNumber'] = aa.locationNumber
setV['areaNumber'] =aa.areaNumber
setV['areaNumber'] = aa.areaNumber
setV['locationName'] = aa.locationName
setV['areaName'] =aa.areaName
setV['areaName'] = aa.areaName
formRef.setValues(setV)
})
}
}if(formField=='locationNumber'){//
}
if (formField == 'locationNumber') {
//
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
setV['areaNumber'] = val[0]['areaNumber']
formRef.setValues(setV)
})
}else{
} else {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
}
}
//
const updataTableColumns = (val) => {
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
}
const { tableObject, tableMethods } = useTable({
const { tableObject, tableMethods } = useTable({
getListApi: ItemAccountsApi.getItemAccountsPage //
})
})
//
const { getList, setSearchParams } = tableMethods
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({ hasPermi: 'item:itemAccounts:create' }), //
//defaultButtons.ItemInBtn({ hasPermi: 'item:itemAccounts:createIn' }), //
defaultButtons.defaultImportBtn({ hasPermi: 'item:itemAccounts:import' }), //
defaultButtons.defaultExportBtn({ hasPermi: 'item:itemAccounts:export' }), //
defaultButtons.defaultFreshBtn(null), //
//defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
defaultButtons.defaultSetBtn(null) //
// {
// label: '',
// name: 'zdy',
@ -140,50 +182,66 @@
// icon: 'Select',
// color: ''
// },
]
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
//
const buttonBaseClick = (val, item) => {
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')
}
}
}
// -
const butttondata =(row)=>{
// -
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') { //
// -
const buttonTableClick = async (val, row) => {
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)
}
}
const searchTableRef = ref()
/** 绑定备件操作 */
const openItem = async (number : String, wantId : number) => {
const searchTableRef = ref()
/** 绑定备件操作 */
const openItem = async (number: String, wantId: number) => {
locationNumber.value = number
wantId1.value = wantId
searchTableRef.value.open(
@ -198,26 +256,25 @@
null,
null
)
}
const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => {
}
const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => {
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('更换成功'))
//
getList()
})
}
}
const getItemWithOutBind = async () => {
const getItemWithOutBind = async () => {
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);
@ -235,66 +292,68 @@
console.error(error)
throw error //
}
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const basicFormRef1 = ref();
const openForm = (type : string, row ?: any) => {
/** 添加/修改操作 */
const basicFormRef = 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{
} else {
basicFormRef.value.open(type, row)
}
}
}
// form
const formsSuccess = async (formType, data) => {
// 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;
try{
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'))
}
}finally{
basicFormRef.value.dialogVisible = false
basicFormRef1.value.dialogVisible = false
}
getList()
}
} finally {
basicFormRef.value.formLoading = false
}
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row : any, titleName : any, titleValue : any) => {
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicItemAccounts')
}
}
/** 删除按钮操作 */
const handleDelete = async (id : number) => {
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
@ -303,12 +362,12 @@
message.success(t('common.delSuccess'))
//
await getList()
} catch { }
}
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
@ -320,35 +379,35 @@
} finally {
exportLoading.value = false
}
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '备件台账导入模版.xlsx'
})
//
const importSuccess = () => {
})
//
const importSuccess = () => {
getList()
}
}
//
const searchFormClick = (searchData) => {
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
}
/** 初始化 **/
onMounted(async () => {
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await ItemAccountsApi.importTemplate()
})
})
</script>

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

@ -1,77 +1,104 @@
<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">
<template #code="{row}">
}"
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" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, row)" />
</template>
</Table>
</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">
import download from '@/utils/download'
import { ItemInLocation, ItemInLocationRules } from './itemInLocation.data'
import * as ItemInLocationApi from '@/api/eam/item/itemInLocation'
import * as ItemAccountApi from '@/api/eam/item/itemAccounts'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'ItemInLocation' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(ItemInLocation.allSchemas.tableColumns)
//
const searchTableSuccess = async(formField, searchField, val, formRef) => {
const ret = await ItemAccountApi.getByLocationNumber(val[0][searchField]);
if(ret.itemNumber==null || ret.itemNumber=='' || !ret.itemNumber){
import download from '@/utils/download'
import { ItemInLocation, ItemInLocationRules } from './itemInLocation.data'
import * as ItemInLocationApi from '@/api/eam/item/itemInLocation'
import * as ItemAccountApi from '@/api/eam/item/itemAccounts'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'ItemInLocation' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(ItemInLocation.allSchemas.tableColumns)
//
const searchTableSuccess = async (formField, searchField, val, formRef) => {
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{
} else {
nextTick(() => {
const setV = {}
setV['itemNumber'] = ret.itemNumber
@ -80,28 +107,27 @@
formRef.setValues(setV)
})
}
}
}
//
const updataTableColumns = (val) => {
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
}
const { tableObject, tableMethods } = useTable({
const { tableObject, tableMethods } = useTable({
getListApi: ItemInLocationApi.getItemInLocationPage //
})
})
//
const { getList, setSearchParams } = tableMethods
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({ hasPermi: 'item:itemInLocation:create' }), //
defaultButtons.defaultExportBtn({ hasPermi: 'item:itemInLocation:export' }), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
defaultButtons.defaultSetBtn(null) //
// {
// label: '',
// name: 'zdy',
@ -110,58 +136,67 @@
// icon: 'Select',
// color: ''
// },
]
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
//
const buttonBaseClick = (val, item) => {
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)
}
}
}
// -
const butttondata = [
// -
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') { //
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'delete') { //
} else if (val == 'delete') {
//
handleDelete(row.id)
}
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type : string, row ?: any) => {
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
}
// form
const formsSuccess = async (formType, data) => {
// 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,16 +206,19 @@
}
basicFormRef.value.dialogVisible = false
getList()
} finally {
basicFormRef.value.formLoading = false
}
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row : any, titleName : any, titleValue : any) => {
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicItemInLocation')
}
}
/** 删除按钮操作 */
const handleDelete = async (id : number) => {
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
@ -189,12 +227,12 @@
message.success(t('common.delSuccess'))
//
await getList()
} catch { }
}
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
@ -206,35 +244,35 @@
} finally {
exportLoading.value = false
}
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '备件入库记录导入模版.xlsx'
})
//
const importSuccess = () => {
})
//
const importSuccess = () => {
getList()
}
}
//
const searchFormClick = (searchData) => {
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
}
/** 初始化 **/
onMounted(async () => {
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await ItemInLocationApi.importTemplate()
})
})
</script>

93
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>
<!-- 列表头部 -->
@ -27,13 +31,13 @@
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<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" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, row)" />
</template>
</Table>
</ContentWrap>
@ -54,12 +58,17 @@
<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">
import download from '@/utils/download'
import { ItemOutLocation,ItemOutLocationRules } from './itemOutLocation.data'
import { ItemOutLocation, ItemOutLocationRules } from './itemOutLocation.data'
import * as ItemOutLocationApi from '@/api/eam/item/itemOutLocation'
import * as ItemAccountsApi from '@/api/eam/item/itemAccounts'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
@ -78,12 +87,13 @@ routeName.value = route.name
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(aa.id==null){
message.info("该库位下无备件信息");
return;
const searchTableSuccess = async (formField, searchField, val, formRef) => {
if (formField == 'locationNumber') {
//
let aa = await ItemAccountsApi.getByLocationNumber(val[0][searchField])
if (aa.id == null) {
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)
})
}
}
//
@ -113,11 +123,11 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'item:itemOutLocation:create'}), //
defaultButtons.defaultExportBtn({hasPermi:'item:itemOutLocation:export'}), //
defaultButtons.defaultAddBtn({ hasPermi: 'item:itemOutLocation:create' }), //
defaultButtons.defaultExportBtn({ hasPermi: 'item:itemOutLocation:export' }), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
defaultButtons.defaultSetBtn(null) //
// {
// label: '',
// name: 'zdy',
@ -130,31 +140,39 @@ 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)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'item:itemOutLocation:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'item:itemOutLocation:delete'}), //
defaultButtons.mainListEditBtn({ hasPermi: 'item:itemOutLocation:update' }), //
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)
}
}
@ -166,18 +184,19 @@ 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';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
const formsSuccess = async (formType, data) => {
var isHave = ItemOutLocation.allSchemas.formSchema.some(function (item) {
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