ljlong_2630 9 months ago
parent
commit
c4146fbed5
  1. 46
      src/api/eam/item/adjustRecordDetail/index.ts
  2. 1
      src/api/eam/item/countRecordMain/index.ts
  3. 3
      src/utils/dict.ts
  4. 143
      src/views/eam/item/adjustRecord/adjustRecord.data.ts
  5. 320
      src/views/eam/item/adjustRecord/index.vue
  6. 32
      src/views/eam/item/adjustRecordMain/adjustRecordMain.data.ts
  7. 204
      src/views/eam/item/adjustRecordMain/index.vue
  8. 44
      src/views/eam/item/countRecord/countRecord.data.ts
  9. 4
      src/views/eam/item/countRecord/index.vue
  10. 3
      src/views/eam/item/itemAccounts/itemAccounts.data.ts

46
src/api/eam/item/adjustRecordDetail/index.ts

@ -0,0 +1,46 @@
import request from '@/config/axios'
export interface AdjustRecordDetailVO {
number: string
planNumber: string
requestNumber: string
requestTime: Date
jobNumber: string
recordNumber: string
}
// 查询备件盘点调整记录主列表
export const getAdjustRecordDetailPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/adjustRecordDetail/senior', data })
} else {
return await request.get({ url: `/eam/adjustRecordDetail/page`, params })
}
}
// 查询备件盘点调整记录主详情
export const getAdjustRecordDetail = async (id: number) => {
return await request.get({ url: `/eam/adjustRecordDetail/get?id=` + id })
}
// 新增备件盘点调整记录主
export const createAdjustRecordDetail = async (data: AdjustRecordDetailVO) => {
return await request.post({ url: `/eam/adjustRecordDetail/create`, data })
}
// 修改备件盘点调整记录主
export const updateAdjustRecordDetail = async (data: AdjustRecordDetailVO) => {
return await request.put({ url: `/eam/adjustRecordDetail/update`, data })
}
// 删除备件盘点调整记录主
export const deleteAdjustRecordDetail = async (id: number) => {
return await request.delete({ url: `/eam/adjustRecordDetail/delete?id=` + id })
}
// 导出备件盘点调整记录主 Excel
export const exportAdjustRecordDetail = async (params) => {
return await request.download({ url: `/eam/adjustRecordDetail/export-excel`, params })
}

1
src/api/eam/item/countRecordMain/index.ts

@ -11,6 +11,7 @@ export interface CountRecordMainVO {
// 查询备件盘点计划列表
export const getCountRecordMainPage = async (params) => {
params.status="CANGENERATE"
if (params.isSearch) {
delete params.isSearch
const data = { ...params }

3
src/utils/dict.ts

@ -296,6 +296,9 @@ export enum DICT_TYPE {
DEPT_BUSI_TYPE = 'dept_busi_type', //部门类型
DEPT_GROUP = 'dept_group', //部门分组
POWER_RANGE = 'power_range', //功率范围
ADJUST_STATUS = 'adjust_status', //盘点调整状态
}

143
src/views/eam/item/adjustRecord/adjustRecord.data.ts

@ -0,0 +1,143 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const Rules = reactive({
number: [required],
planNumber: [required],
})
export const AdjustRecordMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '调整编号',
field: 'number',
sort: 'custom',
isSearch: true,
},
{
label: '计划编号',
field: 'planNumber',
sort: 'custom',
isSearch: true,
},
{
label: '任务编号',
field: 'jobNumber',
sort: 'custom',
isSearch: true,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
//表单校验
export const AdjustRecordMainRules = reactive({
name: [
{ required: true, message: '请填写描述', trigger: 'change' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
})
/**
* @returns {Array}
*/
export const AdjustRecordDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '任务编号',
field: 'number',
sort: 'custom',
isForm: false,
isSearch: true,
table: {
width: 180,
fixed: 'left'
},
},
{
label: '备件编号',
field: 'itemNumber',
sort: 'custom',
isForm: false,
isSearch: true,
table: {
width: 180,
},
},
{
label: '库位编号',
field: 'locationNumber',
sort: 'custom',
isForm: false,
isSearch: true,
table: {
width: 180,
},
},
{
label: '库区编号',
field: 'areaNumber',
sort: 'custom',
isForm: false,
isSearch: true,
table: {
width: 180,
},
},
{
label: '库存数量',
field: 'qty',
sort: 'custom',
isForm: false,
isSearch: true,
table: {
width: 180,
},
},
{
label: '盘点数量',
field: 'countQty',
sort: 'custom',
isForm: false,
isSearch: true,
table: {
width: 180,
},
},
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 150,
fixed: 'right'
},
isTableForm: false,
}
]))
//表单校验
export const AdjustRecordDetailRules = reactive({
lineNumber: [
{ required: true, message: '请输入行号', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
stdPackQty: [
{ required: true, message: '请输入标包数量', trigger: 'blur' }
],
})

320
src/views/eam/item/adjustRecord/index.vue

@ -0,0 +1,320 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="AdjustRecordMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick"
:allSchemas="AdjustRecordMain.allSchemas" />
<!-- 列表 -->
<ContentWrap>
<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 #number="{row}">
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm ref="formRef" @success="getList" :rules="AdjustRecordMainRules" :formAllSchemas="AdjustRecordMain.allSchemas"
:tableAllSchemas="AdjustRecordDetail.allSchemas" :tableFormRules="AdjustRecordDetailRules" :tableData="tableData"
:apiUpdate="AdjustRecordMainApi.updateAdjustRecordMain" :apiCreate="AdjustRecordMainApi.createAdjustRecordMain"
:isBusiness="true" @handleAddTable="handleAddTable" @handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess" @submitForm="submitForm" />
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="false" :allSchemas="AdjustRecordMain.allSchemas"
:detailAllSchemas="AdjustRecordDetail.allSchemas" :detailAllSchemasRules="AdjustRecordDetailRules"
:apiCreate="AdjustRecordDetailApi.createAdjustRecordDetail" :apiUpdate="AdjustRecordDetailApi.updateAdjustRecordDetail"
:apiPage="AdjustRecordDetailApi.getAdjustRecordDetailPage" :apiDelete="AdjustRecordDetailApi.deleteAdjustRecordDetail"
@searchTableSuccessDetail="searchTableSuccessDetail" />
<!-- 导入 -->
<ImportForm
ref="importFormRef"
url="/eam/adjustRecordDetail/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { AdjustRecordMain, AdjustRecordMainRules, AdjustRecordDetail, AdjustRecordDetailRules } from './adjustRecord.data'
import * as AdjustRecordMainApi from '@/api/eam/item/adjustRecordMain'
import * as AdjustRecordDetailApi from '@/api/eam/item/adjustRecordDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
//
defineOptions({ name: 'AdjustRecord' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(AdjustRecordMain.allSchemas.tableColumns)
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(async () => {
if (type == 'tableForm') {
//
row[formField] = val[0][searchField]
row['itemNumber'] = val[0]['number']
row['isRadeIn'] = val[0]['isRadeIn']
row['available'] = val[0]['available']
} else {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
}
})
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(async () => {
const setV = {}
// if(formField == 'itemCode'){
// await ItembasicApi.getItembasicPage({
// code: setV['itemCode']
// }).then(res => {
// setV['uom'] = res.list[0].uom
// setV[formField] = val[0][searchField]
// })
// }
formRef.setValues(setV)
})
}
//
const Echo = []
const { tableObject, tableMethods } = useTable({
getListApi: AdjustRecordMainApi.getAdjustRecordMainPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultImportBtn(null), //
defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
//
const isShowMainButton = (row, val) => {
if (val.indexOf(row.available) > -1) {
return false
} else {
return true
}
}
// -
const butttondata = (row) => {
return [
// defaultButtons.mainAdjust(null),//
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
}
else if (val == 'mainOrderClo') { //
handleClose(row.id)
}
else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = async (type : string, row ?: number) => {
tableData.value = [] //
formRef.value.open(type, row)
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row : any, titleName : any, titleValue : any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicAdjustRecordMain')
}
/** 删除按钮操作 */
const handleDelete = async (id : number) => {
try {
//
await message.delConfirm()
//
await AdjustRecordMainApi.deleteAdjustRecordMain(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch { }
}
/** 列表导出按钮操作 */
const exportLoading = ref(false) //
const handleMainExport = async (id : number) => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await AdjustRecordMainApi.handleMainExport(id)
download.excel(data, '盘点工单.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 关闭按钮操作 */
const handleClose = async (id : number) => {
try {
//
await message.confirm('是否关闭所选中数据?')
//
await AdjustRecordMainApi.closeAdjustRecordMain(id)
message.success(t('关闭成功!'))
//
await getList()
} catch { }
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await AdjustRecordMainApi.exportAdjustRecordMain(tableObject.params)
download.excel(data, '备件申领记录主.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/**
* tableForm方法
*/
const tableFormKeys = {}
AdjustRecordDetail.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
//
const handleAddTable = () => {
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
}
//
const handleDeleteTable = (item, index) => {
tableData.value.splice(index, 1)
}
//
const submitForm = async (formType, data) => {
data.subList = tableData.value //
try {
if (formType === 'create') {
await AdjustRecordMainApi.createAdjustRecordMain(data)
message.success(t('common.createSuccess'))
} else {
await AdjustRecordMainApi.updateAdjustRecordMain(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '采购订单主导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await AdjustRecordMainApi.importTemplate()
})
</script>

32
src/views/eam/item/adjustRecordMain/adjustRecordMain.data.ts

@ -1,32 +0,0 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const Rules = reactive({
number: [required],
planNumber: [required],
})
export const AdjustRecordMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '备件调整编号',
field: 'number',
sort: 'custom',
isSearch: true,
},
{
label: '盘点计划编号',
field: 'planNumber',
sort: 'custom',
isSearch: true,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

204
src/views/eam/item/adjustRecordMain/index.vue

@ -1,204 +0,0 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="AdjustRecordMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" :allSchemas="AdjustRecordMain.allSchemas" />
<!-- 列表 -->
<ContentWrap>
<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}">
<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)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="Rules" :formAllSchemas="AdjustRecordMain.allSchemas"
:apiUpdate="AdjustRecordMainApi.updateAdjustRecordMain" :apiCreate="AdjustRecordMainApi.createAdjustRecordMain" @searchTableSuccess="searchTableSuccess" :isBusiness="false" />
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="AdjustRecordMain.allSchemas" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { AdjustRecordMain, Rules } from './adjustRecordMain.data'
import * as AdjustRecordMainApi from '@/api/eam/item/adjustRecordMain'
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: 'AdjustRecordMain' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(AdjustRecordMain.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: AdjustRecordMainApi.getAdjustRecordMainPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({ hasPermi: 'eam::create' }), //
defaultButtons.defaultImportBtn({ hasPermi: 'eam::import' }), //
defaultButtons.defaultExportBtn({ hasPermi: 'eam::export' }), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({ hasPermi: 'eam::update' }), //
defaultButtons.mainListDeleteBtn({ hasPermi: 'eam::delete' }), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type : string, row ?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType, data) => {
var isHave =AdjustRecordMain.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;
}
}
if (data.activeTime == 0) data.activeTime = null;
if (data.expireTime == 0) data.expireTime = null;
if (formType === 'create') {
await AdjustRecordMainApi.createAdjustRecordMain(data)
message.success(t('common.createSuccess'))
} else {
await AdjustRecordMainApi.updateAdjustRecordMain(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row : any, titleName : any, titleValue : any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basic')
}
/** 删除按钮操作 */
const handleDelete = async (id : number) => {
try {
//
await message.delConfirm()
//
await AdjustRecordMainApi.deleteAdjustRecordMain(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch { }
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await AdjustRecordMainApi.exportAdjustRecordMain(tableObject.params)
download.excel(data, '备件盘点调整记录主.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
})
</script>

44
src/views/eam/item/countRecord/countRecord.data.ts

@ -8,7 +8,7 @@ const { t } = useI18n() // 国际化
*/
export const CountRecordMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '工单编号',
label: '任务编号',
field: 'number',
sort: 'custom',
isForm: false,
@ -18,6 +18,17 @@ export const CountRecordMain = useCrudSchemas(reactive<CrudSchema[]>([
fixed: 'left'
},
},
{
label: '工单编号',
field: 'jobNumber',
sort: 'custom',
isForm: false,
isSearch: true,
table: {
width: 180,
fixed: 'left'
},
},
{
label: '名称',
field: 'name',
@ -26,12 +37,33 @@ export const CountRecordMain = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: false,
},
{
label: '创建时间',
field: 'createTime',
label: '状态',
field: 'status',
sort: 'custom',
isForm: false,
isSearch: false,
dictType: DICT_TYPE.ADJUST_STATUS,
dictClass: 'string',
isTable: true,
isForm: true,
tableForm: {
type: 'Select'
}
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
isForm: false,
},
{
label: '操作',
field: 'action',
@ -62,7 +94,7 @@ export const CountRecordMainRules = reactive({
*/
export const CountRecordDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '工单编号',
label: '任务编号',
field: 'number',
sort: 'custom',
isForm: false,

4
src/views/eam/item/countRecord/index.vue

@ -211,10 +211,10 @@
const handleMainAdjust = async (id : number) => {
try {
//
await message.delConfirm()
await message.confirm('是否确认盘点调整?')
//
await CountRecordMainApi.adjustCountRecordMain(id)
message.success(t('common.delSuccess'))
message.success(t('盘点调整成功!'))
//
await getList()
} catch { }

3
src/views/eam/item/itemAccounts/itemAccounts.data.ts

@ -78,9 +78,6 @@ export const ItemAccounts = useCrudSchemas(reactive<CrudSchema[]>([
}
}
},
{
label: '规格',
field: 'itemDO.specifications',

Loading…
Cancel
Save