Browse Source

天合修复bug

master
songguoqiang 7 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> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="Item.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search
:schema="Item.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName" <TableHead
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" :allSchemas="Item.allSchemas" /> :HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="Item.allSchemas"
/>
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{ <Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total total: tableObject.total
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage" }"
v-model:sort="tableObject.sort"> v-model:pageSize="tableObject.pageSize"
<template #code="{row}"> v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{ row }">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> <el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span> <span>{{ row.code }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="ItemRules" :formAllSchemas="Item.allSchemas" <BasicForm
:apiUpdate="ItemApi.updateItem" :apiCreate="ItemApi.createItem" @searchTableSuccess="searchTableSuccess" ref="basicFormRef"
:isBusiness="false" /> @success="formsSuccess"
:rules="ItemRules"
:formAllSchemas="Item.allSchemas"
:apiUpdate="ItemApi.updateItem"
:apiCreate="ItemApi.createItem"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<SearchTable ref="searchTableRef" @searchTableSuccess="submitItem" /> <SearchTable ref="searchTableRef" @searchTableSuccess="submitItem" />
@ -36,101 +60,116 @@
<Detail ref="detailRef" :isBasic="true" :allSchemas="Item.allSchemas" /> <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> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { Item, ItemRules } from './item.data' import { Item, ItemRules } from './item.data'
import * as ItemApi from '@/api/eam/basic/item' import * as ItemApi from '@/api/eam/basic/item'
import { createDeviceItemBatch, getDeviceItemPage, getDeviceItemNoPage } from '@/api/eam/basic/rel' import { createDeviceItemBatch, getDeviceItemPage, getDeviceItemNoPage } from '@/api/eam/basic/rel'
import { DeviceAccounts, DeviceAccountsRules } from '@/views/eam/device/deviceAccounts/deviceAccounts.data' import {
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts' DeviceAccounts,
import * as defaultButtons from '@/utils/disposition/defaultButtons' DeviceAccountsRules
import TableHead from '@/components/TableHead/src/TableHead.vue' } from '@/views/eam/device/deviceAccounts/deviceAccounts.data'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import Detail from '@/components/Detail/src/Detail.vue' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { SearchTable } from '@/components/SearchTable' import TableHead from '@/components/TableHead/src/TableHead.vue'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
defineOptions({ name: 'Item' }) import Detail from '@/components/Detail/src/Detail.vue'
import { SearchTable } from '@/components/SearchTable'
const message = useMessage() //
const { t } = useI18n() // defineOptions({ name: 'Item' })
const route = useRoute() //
const routeName = ref() const message = useMessage() //
routeName.value = route.name const { t } = useI18n() //
const itemNumber = ref(); const route = useRoute() //
const tableColumns = ref(Item.allSchemas.tableColumns) const routeName = ref()
const importFormRef = ref() routeName.value = route.name
const itemNumber = ref()
// const tableColumns = ref(Item.allSchemas.tableColumns)
const searchTableSuccess = (formField, searchField, val, formRef) => { const importFormRef = ref()
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => { nextTick(() => {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
formRef.setValues(setV) formRef.setValues(setV)
}) })
} }
// //
const updataTableColumns = (val) => { const updataTableColumns = (val) => {
tableColumns.value = val tableColumns.value = val
} }
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: ItemApi.getItemPage // getListApi: ItemApi.getItemPage //
}) })
// //
const { getList, setSearchParams } = tableMethods const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({ hasPermi: 'basic:item:create' }), // defaultButtons.defaultAddBtn({ hasPermi: 'basic:item:create' }), //
defaultButtons.defaultImportBtn(null), // defaultButtons.defaultImportBtn(null), //
defaultButtons.defaultExportBtn({ hasPermi: 'basic:item:export' }), // defaultButtons.defaultExportBtn({ hasPermi: 'basic:item:export' }), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null) //
] ]
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'add') {
//
openForm('create') openForm('create')
}else if (val == 'import') { // } else if (val == 'import') {
//
handleImport() handleImport()
} else if (val == 'export') { // } else if (val == 'export') {
//
handleExport() handleExport()
} else if (val == 'refresh') { // } else if (val == 'refresh') {
//
getList() getList()
} else if (val == 'filtrate') { // } else if (val == 'filtrate') {
} else { // //
} else {
//
console.log('其他按钮', item) console.log('其他按钮', item)
} }
} }
// - // -
const butttondata = [ const butttondata = [
defaultButtons.mainListEditBtn({ hasPermi: 'basic:item:update' }), // defaultButtons.mainListEditBtn({ hasPermi: 'basic:item:update' }), //
defaultButtons.mainListDeleteBtn({ hasPermi: 'basic:item:delete' }), // defaultButtons.mainListDeleteBtn({ hasPermi: 'basic:item:delete' }) //
] ]
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') {
//
openForm('update', row) openForm('update', row)
} else if (val == 'chooseDevice') { } else if (val == 'chooseDevice') {
openItem(row.number) openItem(row.number)
} else if (val == 'delete') { // } else if (val == 'delete') {
//
handleDelete(row.id) handleDelete(row.id)
} }
} }
const searchTableRef = ref() const searchTableRef = ref()
/** 绑定备件操作 */ /** 绑定备件操作 */
const openItem = async (number : String) => { const openItem = async (number: String) => {
itemNumber.value = number itemNumber.value = number
await CallBack1() await CallBack1()
searchTableRef.value.open( searchTableRef.value.open(
@ -146,54 +185,55 @@
null, null,
searchTableSelections.value searchTableSelections.value
) )
} }
const searchTableSelections = ref([]) const searchTableSelections = ref([])
const CallBack1 = async () => { const CallBack1 = async () => {
await getDeviceItemNoPage({ itemNumber: itemNumber.value }).then(async (res) => { await getDeviceItemNoPage({ itemNumber: itemNumber.value }).then(async (res) => {
await DeviceAccountsApi.getDeviceAccountsAllNoPage({}).then(response => { await DeviceAccountsApi.getDeviceAccountsAllNoPage({}).then((response) => {
searchTableSelections.value = response.filter(element => { searchTableSelections.value = response.filter((element) => {
let flag = false; let flag = false
res.forEach(item => { res.forEach((item) => {
if (element.number == item.deviceNumber) { if (element.number == item.deviceNumber) {
flag = true; flag = true
} }
}); })
return flag; return flag
}); })
}); })
}); })
}; }
const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => { const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => {
const deviceItemRelList = selections.map(element => ({ const deviceItemRelList = selections.map((element) => ({
itemNumber: itemNumber.value, itemNumber: itemNumber.value,
deviceNumber: element.number, deviceNumber: element.number
})); }))
createDeviceItemBatch(deviceItemRelList).then(res => { createDeviceItemBatch(deviceItemRelList).then((res) => {
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
}) })
}; }
/** 添加/修改操作 */ /** 添加/修改操作 */
const basicFormRef = ref() const basicFormRef = ref()
const openForm = (type : string, row ?: any) => { const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)
} }
// form // form
const formsSuccess = async (formType, data) => { const formsSuccess = async (formType, data) => {
var isHave = Item.allSchemas.formSchema.some(function (item) { 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 (isHave) {
if (data.minInventory && data.maxInventory && data.minInventory >= data.maxInventory) { if (data.minInventory && data.maxInventory && data.minInventory >= data.maxInventory) {
message.error('最高库存要大于最低库存') message.error('最高库存要大于最低库存')
return false; return false
} }
} }
if (data.maxInventory == 0) data.maxInventory = null; if (data.maxInventory == 0) data.maxInventory = null
if (data.minInventory == 0) data.minInventory = null; if (data.minInventory == 0) data.minInventory = null
try {
if (formType === 'create') { if (formType === 'create') {
await ItemApi.createItem(data) await ItemApi.createItem(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
@ -203,16 +243,19 @@
} }
basicFormRef.value.dialogVisible = false basicFormRef.value.dialogVisible = false
getList() getList()
} finally {
basicFormRef.value.formLoading = false
} }
}
/** 详情操作 */ /** 详情操作 */
const detailRef = ref() const detailRef = ref()
const openDetail = (row : any, titleName : any, titleValue : any) => { const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicItem') detailRef.value.openDetail(row, titleName, titleValue, 'basicItem')
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id : number) => { const handleDelete = async (id: number) => {
try { try {
// //
await message.delConfirm() await message.delConfirm()
@ -221,12 +264,12 @@
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() await getList()
} catch { } } catch {}
} }
/** 导出按钮操作 */ /** 导出按钮操作 */
const exportLoading = ref(false) // const exportLoading = ref(false) //
const handleExport = async () => { const handleExport = async () => {
try { try {
// //
await message.exportConfirm() await message.exportConfirm()
@ -238,38 +281,38 @@
} finally { } finally {
exportLoading.value = false exportLoading.value = false
} }
} }
onMounted(async () => { onMounted(async () => {
importTemplateData.templateUrl = await ItemApi.importTemplate() importTemplateData.templateUrl = await ItemApi.importTemplate()
}) })
const handleImport = () => { const handleImport = () => {
importFormRef.value.open() importFormRef.value.open()
} }
// //
const importTemplateData = reactive({ const importTemplateData = reactive({
templateUrl: '', templateUrl: '',
templateTitle: '物料导入模版.xlsx' templateTitle: '物料导入模版.xlsx'
}) })
// //
const importSuccess = () => { const importSuccess = () => {
getList() getList()
} }
// //
const searchFormClick = (searchData) => { const searchFormClick = (searchData) => {
tableObject.params = { tableObject.params = {
isSearch: true, isSearch: true,
filters: searchData.filters filters: searchData.filters
} }
getList() // getList() //
} }
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()
}) })
</script> </script>

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

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

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

@ -1,38 +1,72 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="ItemAccounts.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search
:schema="ItemAccounts.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName" <TableHead
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" :allSchemas="ItemAccounts.allSchemas" /> :HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="ItemAccounts.allSchemas"
/>
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{ <Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total total: tableObject.total
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage" }"
v-model:sort="tableObject.sort"> v-model:pageSize="tableObject.pageSize"
<template #code="{row}"> v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{ row }">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> <el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span> <span>{{ row.code }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase
:Butttondata="butttondata(row)"
@button-base-click="buttonTableClick($event, row)"
/>
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="ItemAccountsRules" <BasicForm
:formAllSchemas="ItemAccounts.allSchemas" :apiUpdate="ItemAccountsApi.updateItemAccounts" ref="basicFormRef"
:apiCreate="ItemAccountsApi.createItemAccounts" @searchTableSuccess="searchTableSuccess" :isBusiness="false" /> @success="formsSuccess"
:rules="ItemAccountsRules"
:formAllSchemas="ItemAccounts.allSchemas"
:apiUpdate="ItemAccountsApi.updateItemAccounts"
:apiCreate="ItemAccountsApi.createItemAccounts"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<BasicForm ref="basicFormRef1" @success="formsSuccess" :rules="ItemInRules" <BasicForm
:formAllSchemas="ItemIn.allSchemas" :apiUpdate="ItemAccountsApi.updateItemAccounts" ref="basicFormRef1"
:apiCreate="ItemAccountsApi.createItemAccounts" @searchTableSuccess="searchTableSuccess" :isBusiness="false" /> @success="formsSuccess"
:rules="ItemInRules"
:formAllSchemas="ItemIn.allSchemas"
:apiUpdate="ItemAccountsApi.updateItemAccounts"
:apiCreate="ItemAccountsApi.createItemAccounts"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<SearchTable ref="searchTableRef" @searchTableSuccess="submitItem" /> <SearchTable ref="searchTableRef" @searchTableSuccess="submitItem" />
@ -40,38 +74,44 @@
<Detail ref="detailRef" :isBasic="true" :allSchemas="ItemAccounts.allSchemas" /> <Detail ref="detailRef" :isBasic="true" :allSchemas="ItemAccounts.allSchemas" />
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/item/item-accounts/import" :importTemplateData="importTemplateData" <ImportForm
@success="importSuccess" /> ref="importFormRef"
url="/eam/item/item-accounts/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { ItemAccounts, ItemAccountsRules } from './itemAccounts.data' import { ItemAccounts, ItemAccountsRules } from './itemAccounts.data'
import { ItemIn, ItemInRules } from './itemIn.data' import { ItemIn, ItemInRules } from './itemIn.data'
import * as ItemAccountsApi from '@/api/eam/item/itemAccounts' import * as ItemAccountsApi from '@/api/eam/item/itemAccounts'
import { Item } from '@/views/eam/basic/item/item.data' import { Item } from '@/views/eam/basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item' import * as ItemApi from '@/api/eam/basic/item'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue' import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'ItemAccounts' }) defineOptions({ name: 'ItemAccounts' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
const locationNumber = ref() const locationNumber = ref()
const wantId1 = ref() const wantId1 = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(ItemAccounts.allSchemas.tableColumns) 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 (formField == 'itemNumber') {
if(aa.locationNumber==null||aa.locationNumber==''){// const aa = await ItemAccountsApi.getByItemNumber(val[0][searchField])
if (aa.locationNumber == null || aa.locationNumber == '') {
//
nextTick(() => { nextTick(() => {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
@ -82,56 +122,58 @@
setV['areaName'] = '' setV['areaName'] = ''
formRef.setValues(setV) formRef.setValues(setV)
}) })
}else{// } else {
//
nextTick(() => { nextTick(() => {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
setV['itemName'] = val[0]['name'] setV['itemName'] = val[0]['name']
setV['locationNumber'] = aa.locationNumber setV['locationNumber'] = aa.locationNumber
setV['areaNumber'] =aa.areaNumber setV['areaNumber'] = aa.areaNumber
setV['locationName'] = aa.locationName setV['locationName'] = aa.locationName
setV['areaName'] =aa.areaName setV['areaName'] = aa.areaName
formRef.setValues(setV) formRef.setValues(setV)
}) })
} }
}if(formField=='locationNumber'){// }
if (formField == 'locationNumber') {
//
nextTick(() => { nextTick(() => {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
setV['areaNumber'] = val[0]['areaNumber'] setV['areaNumber'] = val[0]['areaNumber']
formRef.setValues(setV) formRef.setValues(setV)
}) })
}else{ } else {
nextTick(() => { nextTick(() => {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
formRef.setValues(setV) formRef.setValues(setV)
}) })
} }
}
} //
const updataTableColumns = (val) => {
//
const updataTableColumns = (val) => {
tableColumns.value = val tableColumns.value = val
} }
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: ItemAccountsApi.getItemAccountsPage // getListApi: ItemAccountsApi.getItemAccountsPage //
}) })
// //
const { getList, setSearchParams } = tableMethods const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({ hasPermi: 'item:itemAccounts:create' }), // defaultButtons.defaultAddBtn({ hasPermi: 'item:itemAccounts:create' }), //
//defaultButtons.ItemInBtn({ hasPermi: 'item:itemAccounts:createIn' }), // //defaultButtons.ItemInBtn({ hasPermi: 'item:itemAccounts:createIn' }), //
defaultButtons.defaultImportBtn({ hasPermi: 'item:itemAccounts:import' }), // defaultButtons.defaultImportBtn({ hasPermi: 'item:itemAccounts:import' }), //
defaultButtons.defaultExportBtn({ hasPermi: 'item:itemAccounts:export' }), // defaultButtons.defaultExportBtn({ hasPermi: 'item:itemAccounts:export' }), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
//defaultButtons.defaultFilterBtn(null), // //defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null) //
// { // {
// label: '', // label: '',
// name: 'zdy', // name: 'zdy',
@ -140,50 +182,66 @@
// icon: 'Select', // icon: 'Select',
// color: '' // color: ''
// }, // },
] ]
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'add') {
//
openForm('create') openForm('create')
} else if (val == 'import') { // } else if (val == 'import') {
//
handleImport() handleImport()
} else if (val == 'export') { // } else if (val == 'export') {
//
handleExport() handleExport()
} else if (val == 'refresh') { // } else if (val == 'refresh') {
//
getList() getList()
} else if (val == 'filtrate') { // } else if (val == 'filtrate') {
} else if(val=='itemIn'){ // //
} else if (val == 'itemIn') {
//
openForm('itemIn') openForm('itemIn')
} }
} }
// - // -
const butttondata =(row)=>{ const butttondata = (row) => {
return [ return [
//defaultButtons.mainListEditBtn({ hasPermi: 'item:itemAccounts:update' }), // //defaultButtons.mainListEditBtn({ hasPermi: 'item:itemAccounts:update' }), //
defaultButtons.replaceLocation({ hasPermi: 'item:itemAccounts:replaceLocation',hide:!(row.display)}), // defaultButtons.replaceLocation({
defaultButtons.newTurnIn({ hasPermi: 'item:itemAccounts:newTurnIn',hide:!(row.type=='2'&& row.qty>0)}), // 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' }), // //defaultButtons.mainListDeleteBtn({ hasPermi: 'item:itemAccounts:delete' }), //
] ]
} }
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') {
//
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') {
//
handleDelete(row.id) handleDelete(row.id)
} else if (val == 'replaceLocation') {// } else if (val == 'replaceLocation') {
//
openItem(row.locationNumber, row.id) openItem(row.locationNumber, row.id)
}else if (val == 'newTurnIn') {// } else if (val == 'newTurnIn') {
openForm('newTurnIn', row); //
} openForm('newTurnIn', row)
} }
}
const searchTableRef = ref() const searchTableRef = ref()
/** 绑定备件操作 */ /** 绑定备件操作 */
const openItem = async (number : String, wantId : number) => { const openItem = async (number: String, wantId: number) => {
locationNumber.value = number locationNumber.value = number
wantId1.value = wantId wantId1.value = wantId
searchTableRef.value.open( searchTableRef.value.open(
@ -198,26 +256,25 @@
null, null,
null null
) )
} }
const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => { const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => {
const deviceItemRelList = selections.map((element) => ({ const deviceItemRelList = selections.map((element) => ({
id: wantId1.value, id: wantId1.value,
locationNumber: locationNumber.value, locationNumber: locationNumber.value,
itemNumber: element.number, itemNumber: element.number
})) }))
ItemAccountsApi.replaceLocation(deviceItemRelList).then((res) => { ItemAccountsApi.replaceLocation(deviceItemRelList).then((res) => {
message.success(t('更换成功')) message.success(t('更换成功'))
// //
getList() getList()
}) })
} }
const getItemWithOutBind = async () => { const getItemWithOutBind = async () => {
try { try {
const res = await ItemApi.getItemPage({ const res = await ItemApi.getItemPage({
...Item.allSchemas.searchSchema, ...Item.allSchemas.searchSchema,
available: "TRUE" available: 'TRUE'
}) })
if (res.list?.length > 0) { if (res.list?.length > 0) {
// const response = await getDeviceItemPage(DeviceAccounts.allSchemas.searchSchema); // const response = await getDeviceItemPage(DeviceAccounts.allSchemas.searchSchema);
@ -235,66 +292,68 @@
console.error(error) console.error(error)
throw error // throw error //
} }
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
const basicFormRef = ref() const basicFormRef = ref()
const basicFormRef1 = ref(); const basicFormRef1 = ref()
const openForm = (type : string, row ?: any) => { const openForm = (type: string, row?: any) => {
//debugger //debugger
// if(type=='itemIn'){ // if(type=='itemIn'){
// row?.type = null; // row?.type = null;
// row?.itemName=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) basicFormRef1.value.open(type, row)
}else{ } else {
basicFormRef.value.open(type, row) 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) { 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 (isHave) {
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) { if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间') message.error('失效时间要大于生效时间')
return; return
} }
} }
if (data.activeTime == 0) data.activeTime = null; if (data.activeTime == 0) data.activeTime = null
if (data.expireTime == 0) data.expireTime = null; if (data.expireTime == 0) data.expireTime = null
try{ try {
if (formType === 'create') { if (formType === 'create') {
await ItemAccountsApi.createItemAccounts(data) await ItemAccountsApi.createItemAccounts(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} if (formType === 'newTurnIn') {// }
if (formType === 'newTurnIn') {
//
await ItemAccountsApi.newTurnIn(data) await ItemAccountsApi.newTurnIn(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { } else {
await ItemAccountsApi.updateItemAccounts(data) await ItemAccountsApi.updateItemAccounts(data)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
}
}finally{
basicFormRef.value.dialogVisible = false basicFormRef.value.dialogVisible = false
basicFormRef1.value.dialogVisible = false
}
getList() getList()
} }
} finally {
basicFormRef.value.formLoading = false
}
}
/** 详情操作 */ /** 详情操作 */
const detailRef = ref() const detailRef = ref()
const openDetail = (row : any, titleName : any, titleValue : any) => { const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicItemAccounts') detailRef.value.openDetail(row, titleName, titleValue, 'basicItemAccounts')
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id : number) => { const handleDelete = async (id: number) => {
try { try {
// //
await message.delConfirm() await message.delConfirm()
@ -303,12 +362,12 @@
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() await getList()
} catch { } } catch {}
} }
/** 导出按钮操作 */ /** 导出按钮操作 */
const exportLoading = ref(false) // const exportLoading = ref(false) //
const handleExport = async () => { const handleExport = async () => {
try { try {
// //
await message.exportConfirm() await message.exportConfirm()
@ -320,35 +379,35 @@
} finally { } finally {
exportLoading.value = false exportLoading.value = false
} }
} }
/** 导入 */ /** 导入 */
const importFormRef = ref() const importFormRef = ref()
const handleImport = () => { const handleImport = () => {
importFormRef.value.open() importFormRef.value.open()
} }
// //
const importTemplateData = reactive({ const importTemplateData = reactive({
templateUrl: '', templateUrl: '',
templateTitle: '备件台账导入模版.xlsx' templateTitle: '备件台账导入模版.xlsx'
}) })
// //
const importSuccess = () => { const importSuccess = () => {
getList() getList()
} }
// //
const searchFormClick = (searchData) => { const searchFormClick = (searchData) => {
tableObject.params = { tableObject.params = {
isSearch: true, isSearch: true,
filters: searchData.filters filters: searchData.filters
} }
getList() // getList() //
} }
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()
importTemplateData.templateUrl = await ItemAccountsApi.importTemplate() importTemplateData.templateUrl = await ItemAccountsApi.importTemplate()
}) })
</script> </script>

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

@ -1,77 +1,104 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="ItemInLocation.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search
:schema="ItemInLocation.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName" <TableHead
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" :HeadButttondata="HeadButttondata"
:allSchemas="ItemInLocation.allSchemas" /> @button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="ItemInLocation.allSchemas"
/>
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{ <Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total total: tableObject.total
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage" }"
v-model:sort="tableObject.sort"> v-model:pageSize="tableObject.pageSize"
<template #code="{row}"> v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{ row }">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> <el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span> <span>{{ row.code }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="ItemInLocationRules" <BasicForm
:formAllSchemas="ItemInLocation.allSchemas" :apiUpdate="ItemInLocationApi.updateItemInLocation" ref="basicFormRef"
:apiCreate="ItemInLocationApi.createItemInLocation" @searchTableSuccess="searchTableSuccess" :isBusiness="false" /> @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" /> <Detail ref="detailRef" :isBasic="true" :allSchemas="ItemInLocation.allSchemas" />
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/record/item-in-location/import" :importTemplateData="importTemplateData" <ImportForm
@success="importSuccess" /> ref="importFormRef"
url="/record/item-in-location/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { ItemInLocation, ItemInLocationRules } from './itemInLocation.data' import { ItemInLocation, ItemInLocationRules } from './itemInLocation.data'
import * as ItemInLocationApi from '@/api/eam/item/itemInLocation' import * as ItemInLocationApi from '@/api/eam/item/itemInLocation'
import * as ItemAccountApi from '@/api/eam/item/itemAccounts' import * as ItemAccountApi from '@/api/eam/item/itemAccounts'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue' import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'ItemInLocation' }) defineOptions({ name: 'ItemInLocation' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(ItemInLocation.allSchemas.tableColumns) const tableColumns = ref(ItemInLocation.allSchemas.tableColumns)
// //
const searchTableSuccess = async(formField, searchField, val, formRef) => { 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){ if (ret.itemNumber == null || ret.itemNumber == '' || !ret.itemNumber) {
nextTick(() => { nextTick(() => {
const setV = {} const setV = {}
setV[formField] = ''; setV[formField] = ''
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
formRef.setValues(setV) formRef.setValues(setV)
message.info('该库位下无绑定的备件') message.info('该库位下无绑定的备件')
return; return
}) })
}else{ } else {
nextTick(() => { nextTick(() => {
const setV = {} const setV = {}
setV['itemNumber'] = ret.itemNumber setV['itemNumber'] = ret.itemNumber
@ -80,28 +107,27 @@
formRef.setValues(setV) formRef.setValues(setV)
}) })
} }
}
} //
const updataTableColumns = (val) => {
//
const updataTableColumns = (val) => {
tableColumns.value = val tableColumns.value = val
} }
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: ItemInLocationApi.getItemInLocationPage // getListApi: ItemInLocationApi.getItemInLocationPage //
}) })
// //
const { getList, setSearchParams } = tableMethods const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({ hasPermi: 'item:itemInLocation:create' }), // defaultButtons.defaultAddBtn({ hasPermi: 'item:itemInLocation:create' }), //
defaultButtons.defaultExportBtn({ hasPermi: 'item:itemInLocation:export' }), // defaultButtons.defaultExportBtn({ hasPermi: 'item:itemInLocation:export' }), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null) //
// { // {
// label: '', // label: '',
// name: 'zdy', // name: 'zdy',
@ -110,58 +136,67 @@
// icon: 'Select', // icon: 'Select',
// color: '' // color: ''
// }, // },
] ]
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'add') {
//
openForm('create') openForm('create')
} else if (val == 'import') { // } else if (val == 'import') {
//
handleImport() handleImport()
} else if (val == 'export') { // } else if (val == 'export') {
//
handleExport() handleExport()
} else if (val == 'refresh') { // } else if (val == 'refresh') {
//
getList() getList()
} else if (val == 'filtrate') { // } else if (val == 'filtrate') {
} else { // //
} else {
//
console.log('其他按钮', item) console.log('其他按钮', item)
} }
} }
// - // -
const butttondata = [ const butttondata = [
defaultButtons.mainListEditBtn({ hasPermi: 'item:itemInLocation:update' }), // defaultButtons.mainListEditBtn({ hasPermi: 'item:itemInLocation:update' }), //
defaultButtons.mainListDeleteBtn({ hasPermi: 'item:itemInLocation:delete' }), // defaultButtons.mainListDeleteBtn({ hasPermi: 'item:itemInLocation:delete' }) //
] ]
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') {
//
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') {
//
handleDelete(row.id) handleDelete(row.id)
} }
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
const basicFormRef = ref() const basicFormRef = ref()
const openForm = (type : string, row ?: any) => { const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)
} }
// form // form
const formsSuccess = async (formType, data) => { const formsSuccess = async (formType, data) => {
var isHave = ItemInLocation.allSchemas.formSchema.some(function (item) { 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 (isHave) {
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) { if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间') message.error('失效时间要大于生效时间')
return; return
} }
} }
if (data.activeTime == 0) data.activeTime = null; if (data.activeTime == 0) data.activeTime = null
if (data.expireTime == 0) data.expireTime = null; if (data.expireTime == 0) data.expireTime = null
try {
if (formType === 'create') { if (formType === 'create') {
await ItemInLocationApi.createItemInLocation(data) await ItemInLocationApi.createItemInLocation(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
@ -171,16 +206,19 @@
} }
basicFormRef.value.dialogVisible = false basicFormRef.value.dialogVisible = false
getList() getList()
} finally {
basicFormRef.value.formLoading = false
} }
}
/** 详情操作 */ /** 详情操作 */
const detailRef = ref() const detailRef = ref()
const openDetail = (row : any, titleName : any, titleValue : any) => { const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicItemInLocation') detailRef.value.openDetail(row, titleName, titleValue, 'basicItemInLocation')
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id : number) => { const handleDelete = async (id: number) => {
try { try {
// //
await message.delConfirm() await message.delConfirm()
@ -189,12 +227,12 @@
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() await getList()
} catch { } } catch {}
} }
/** 导出按钮操作 */ /** 导出按钮操作 */
const exportLoading = ref(false) // const exportLoading = ref(false) //
const handleExport = async () => { const handleExport = async () => {
try { try {
// //
await message.exportConfirm() await message.exportConfirm()
@ -206,35 +244,35 @@
} finally { } finally {
exportLoading.value = false exportLoading.value = false
} }
} }
/** 导入 */ /** 导入 */
const importFormRef = ref() const importFormRef = ref()
const handleImport = () => { const handleImport = () => {
importFormRef.value.open() importFormRef.value.open()
} }
// //
const importTemplateData = reactive({ const importTemplateData = reactive({
templateUrl: '', templateUrl: '',
templateTitle: '备件入库记录导入模版.xlsx' templateTitle: '备件入库记录导入模版.xlsx'
}) })
// //
const importSuccess = () => { const importSuccess = () => {
getList() getList()
} }
// //
const searchFormClick = (searchData) => { const searchFormClick = (searchData) => {
tableObject.params = { tableObject.params = {
isSearch: true, isSearch: true,
filters: searchData.filters filters: searchData.filters
} }
getList() // getList() //
} }
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()
importTemplateData.templateUrl = await ItemInLocationApi.importTemplate() importTemplateData.templateUrl = await ItemInLocationApi.importTemplate()
}) })
</script> </script>

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

@ -1,7 +1,11 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="ItemOutLocation.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search
:schema="ItemOutLocation.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
@ -27,13 +31,13 @@
v-model:currentPage="tableObject.currentPage" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort" v-model:sort="tableObject.sort"
> >
<template #code="{row}"> <template #code="{ row }">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> <el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span> <span>{{ row.code }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -54,12 +58,17 @@
<Detail ref="detailRef" :isBasic="true" :allSchemas="ItemOutLocation.allSchemas" /> <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> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' 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 ItemOutLocationApi from '@/api/eam/item/itemOutLocation'
import * as ItemAccountsApi from '@/api/eam/item/itemAccounts' import * as ItemAccountsApi from '@/api/eam/item/itemAccounts'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
@ -78,12 +87,13 @@ routeName.value = route.name
const tableColumns = ref(ItemOutLocation.allSchemas.tableColumns) const tableColumns = ref(ItemOutLocation.allSchemas.tableColumns)
// //
const searchTableSuccess = async(formField, searchField, val, formRef) => { const searchTableSuccess = async (formField, searchField, val, formRef) => {
if(formField=='locationNumber'){// if (formField == 'locationNumber') {
let aa = await ItemAccountsApi.getByLocationNumber(val[0][searchField]); //
if(aa.id==null){ let aa = await ItemAccountsApi.getByLocationNumber(val[0][searchField])
message.info("该库位下无备件信息"); if (aa.id == null) {
return; message.info('该库位下无备件信息')
return
} }
nextTick(() => { nextTick(() => {
const setV = {} const setV = {}
@ -92,11 +102,11 @@ const searchTableSuccess = async(formField, searchField, val, formRef) => {
setV['itemName'] = aa.itemName setV['itemName'] = aa.itemName
setV['itemNumber'] = aa.itemNumber setV['itemNumber'] = aa.itemNumber
setV['qty'] = aa.qty 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) formRef.setValues(setV)
}) })
} }
} }
// //
@ -113,11 +123,11 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'item:itemOutLocation:create'}), // defaultButtons.defaultAddBtn({ hasPermi: 'item:itemOutLocation:create' }), //
defaultButtons.defaultExportBtn({hasPermi:'item:itemOutLocation:export'}), // defaultButtons.defaultExportBtn({ hasPermi: 'item:itemOutLocation:export' }), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null) //
// { // {
// label: '', // label: '',
// name: 'zdy', // name: 'zdy',
@ -130,31 +140,39 @@ const HeadButttondata = [
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'add') {
//
openForm('create') openForm('create')
} else if (val == 'import') { // } else if (val == 'import') {
//
handleImport() handleImport()
} else if (val == 'export') { // } else if (val == 'export') {
//
handleExport() handleExport()
} else if (val == 'refresh') { // } else if (val == 'refresh') {
//
getList() getList()
} else if (val == 'filtrate') { // } else if (val == 'filtrate') {
} else { // //
} else {
//
console.log('其他按钮', item) console.log('其他按钮', item)
} }
} }
// - // -
const butttondata = [ const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'item:itemOutLocation:update'}), // defaultButtons.mainListEditBtn({ hasPermi: 'item:itemOutLocation:update' }), //
defaultButtons.mainListDeleteBtn({hasPermi:'item:itemOutLocation:delete'}), // defaultButtons.mainListDeleteBtn({ hasPermi: 'item:itemOutLocation:delete' }) //
] ]
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') {
//
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') {
//
handleDelete(row.id) handleDelete(row.id)
} }
} }
@ -166,18 +184,19 @@ const openForm = (type: string, row?: any) => {
} }
// form // form
const formsSuccess = async (formType,data) => { const formsSuccess = async (formType, data) => {
var isHave =ItemOutLocation.allSchemas.formSchema.some(function (item) { 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 (isHave) {
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间') message.error('失效时间要大于生效时间')
return; return
} }
} }
if(data.activeTime==0)data.activeTime = null; if (data.activeTime == 0) data.activeTime = null
if(data.expireTime==0)data.expireTime = null; if (data.expireTime == 0) data.expireTime = null
try {
if (formType === 'create') { if (formType === 'create') {
await ItemOutLocationApi.createItemOutLocation(data) await ItemOutLocationApi.createItemOutLocation(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
@ -187,6 +206,9 @@ const formsSuccess = async (formType,data) => {
} }
basicFormRef.value.dialogVisible = false basicFormRef.value.dialogVisible = false
getList() getList()
} finally {
basicFormRef.value.formLoading = false
}
} }
/** 详情操作 */ /** 详情操作 */
@ -253,5 +275,4 @@ onMounted(async () => {
getList() getList()
importTemplateData.templateUrl = await ItemOutLocationApi.importTemplate() importTemplateData.templateUrl = await ItemOutLocationApi.importTemplate()
}) })
</script> </script>

Loading…
Cancel
Save