ljlong_2630 9 months ago
parent
commit
307ae3c641
  1. 51
      src/api/eam/item/countadjustWork/index.ts
  2. 2
      src/utils/dict.ts
  3. 2
      src/views/eam/basic/item/index.vue
  4. 12
      src/views/eam/basic/item/item.data.ts
  5. 49
      src/views/eam/item/countadjustPlan/countadjustPlan.data.ts
  6. 52
      src/views/eam/item/countadjustWork/countadjustWork.data.ts
  7. 232
      src/views/eam/item/countadjustWork/index.vue

51
src/api/eam/item/countadjustWork/index.ts

@ -1,51 +0,0 @@
import request from '@/config/axios'
export interface CountadjustPlanVO {
id : number
number : string
name : string
classification : string
isInAccount : string
status : string
}
// 查询备件盘点计划列表
export const getCountadjustWorkPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = { ...params }
return await request.post({ url: '/eam/countadjust-plan/senior', data })
} else {
return await request.get({ url: `/eam/countadjust-plan/page`, params })
}
}
// 查询备件盘点计划详情
export const getCountadjustWork = async (id : number) => {
return await request.get({ url: `/eam/countadjust-plan/get?id=` + id })
}
// 新增备件盘点计划
export const createCountadjustWork = async (data : CountadjustPlanVO) => {
return await request.post({ url: `/eam/countadjust-plan/create`, data })
}
// 修改备件盘点计划
export const updateCountadjustWork = async (data : CountadjustPlanVO) => {
return await request.put({ url: `/eam/countadjust-plan/update`, data })
}
// 删除备件盘点计划
export const deleteCountadjustWork = async (id : number) => {
return await request.delete({ url: `/eam/countadjust-plan/delete?id=` + id })
}
// 导出备件盘点计划 Excel
export const exportCountadjustWork = async (params) => {
return await request.download({ url: `/eam/countadjust-plan/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/countadjust-plan/get-import-template' })
}

2
src/utils/dict.ts

@ -291,6 +291,8 @@ export enum DICT_TYPE {
IS_OPEN = 'is_open', //是否打开
ITEM_APPLY_STATUS = 'item_apply_status',//备件申领状态
JX_DETAILS_STATUS = 'jx_details_status', //检修明细状态
CLASSIFICATION = 'classification', //检修明细状态
}

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

@ -83,7 +83,7 @@
//
const HeadButttondata = [
// defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //

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

@ -76,6 +76,18 @@ export const Item = useCrudSchemas(reactive<CrudSchema[]>([
type: 'Select'
}
},
{
label: '备件分类',
field: 'classification',
sort: 'custom',
dictType: DICT_TYPE.CLASSIFICATION,
dictClass: 'string',
isSearch: false,
isTable: true,
tableForm: {
type: 'Select'
}
},
{
label: '单价',
field: 'singlePrice',

49
src/views/eam/item/countadjustPlan/countadjustPlan.data.ts

@ -20,26 +20,53 @@ export const CountadjustPlan = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
isSearch: true,
},
// {
// label: '盘点类型',
// field: 'classification',
// sort: 'custom',
// isSearch: false,
// },
{
label: '盘点类型',
field: 'classification',
sort: 'custom',
isSearch: false,
field: 'type',
sort: 'classification',
dictType: DICT_TYPE.CLASSIFICATION,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 150
},
tableForm: {
type: 'Select',
disabled: false
}
},
{
label: '是否账内库',
field: 'isInAccount',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
},
{
label: '状态',
field: 'status',
isTable: true,
sort: 'custom',
isSearch: false,
form: {
component: 'Radio'
table: {
width: 140
},
tableForm: {
type: 'Select',
inactiveValue: 'FALSE',
disabled: true
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '操作',

52
src/views/eam/item/countadjustWork/countadjustWork.data.ts

@ -1,52 +0,0 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
// 表单校验
export const CountadjustWorkRules = reactive({
number: [required],
name: [required],
})
export const CountadjustWork = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '计划编号',
field: 'number',
sort: 'custom',
isSearch: true,
},
{
label: '名称',
field: 'name',
sort: 'custom',
isSearch: true,
},
{
label: '盘点类型',
field: 'classification',
sort: 'custom',
isSearch: false,
},
{
label: '是否账内库',
field: 'isInAccount',
sort: 'custom',
isSearch: false,
},
{
label: '状态',
field: 'status',
sort: 'custom',
isSearch: false,
form: {
component: 'Radio'
},
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

232
src/views/eam/item/countadjustWork/index.vue

@ -1,97 +1,110 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="CountadjustWork.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search :schema="CountJobMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="CountadjustWork.allSchemas"
/>
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick"
:allSchemas="CountJobMain.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}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
}" 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" @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="CountadjustWorkRules"
:formAllSchemas="CountadjustWork.allSchemas"
:apiUpdate="CountadjustWorkApi.updateCountadjustWork"
:apiCreate="CountadjustWorkApi.createCountadjustWork"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<BasicForm ref="formRef" @success="getList" :rules="CountJobMainRules" :formAllSchemas="CountJobMain.allSchemas"
:tableAllSchemas="CountJobDetail.allSchemas" :tableFormRules="CountJobDetailRules" :tableData="tableData"
:apiUpdate="CountJobMainApi.updateCountJobMain" :apiCreate="CountJobMainApi.createCountJobMain"
:isBusiness="true" @handleAddTable="handleAddTable" @handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess" @submitForm="submitForm" />
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="CountadjustWork.allSchemas" />
<Detail ref="detailRef" :isBasic="false" :allSchemas="CountJobMain.allSchemas"
:detailAllSchemas="CountJobDetail.allSchemas" :detailAllSchemasRules="CountJobDetailRules"
:apiCreate="CountJobDetailApi.createCountJobDetail" :apiUpdate="CountJobDetailApi.updateCountJobDetail"
:apiPage="CountJobDetailApi.getCountJobDetailPage" :apiDelete="CountJobDetailApi.deleteCountJobDetail"
@searchTableSuccessDetail="searchTableSuccessDetail" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/plan/countadjust-plan/import" :importTemplateData="importTemplateData" @success="importSuccess" />
<ImportForm ref="importFormRef" url="/wms/purchase-main/import" :importTemplateData="importTemplateData"
@success="importSuccess" :isShowOut="true" :updateIsDisable="true" :coverIsDisable="true" :mode="2" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { CountadjustWork,CountadjustWorkRules } from './countadjustWork.data'
import * as CountadjustWorkApi from '@/api/eam/item/countadjustWork'
import { CountJobMain, CountJobMainRules, CountJobDetail, CountJobDetailRules } from './countJobMain.data'
import * as CountJobMainApi from '@/api/eam/item/countJobMain'
import * as CountJobDetailApi from '@/api/eam/item/countJobDetail'
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: 'CountadjustWork' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(CountadjustWork.allSchemas.tableColumns)
const tableColumns = ref(CountJobMain.allSchemas.tableColumns)
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
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 updataTableColumns = (val) => {
tableColumns.value = val
//
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: CountadjustWorkApi.getCountadjustWorkPage //
getListApi: CountJobMainApi.getCountJobMainPage //
})
//
@ -99,9 +112,9 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:countadjustWork:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:countadjustWork:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:countadjustWork:export'}), //
defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultImportBtn(null), //
defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
@ -131,55 +144,47 @@ const buttonBaseClick = (val, item) => {
}
}
//
const isShowMainButton = (row, val) => {
if (val.indexOf(row.available) > -1) {
return false
} else {
return true
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:countadjustWork:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:countadjustWork:delete'}), //
const butttondata = (row) => {
return [
defaultButtons.mainListEditBtn(null), //
defaultButtons.mainListDeleteBtn(null), //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
}
else if (val == 'mainOrderClo') { //
handleClose(row.id)
}
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 =CountadjustWork.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 CountadjustWorkApi.createCountadjustWork(data)
message.success(t('common.createSuccess'))
} else {
await CountadjustWorkApi.updateCountadjustWork(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
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, 'basicCountadjustWork')
detailRef.value.openDetail(row, titleName, titleValue, 'basicCountJobMain')
}
/** 删除按钮操作 */
@ -188,13 +193,26 @@ const handleDelete = async (id: number) => {
//
await message.delConfirm()
//
await CountadjustWorkApi.deleteCountadjustWork(id)
await CountJobMainApi.deleteCountJobMain(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch { }
}
/** 关闭按钮操作 */
const handleClose = async (id : number) => {
try {
//
await message.confirm('是否关闭所选中数据?')
//
await CountJobMainApi.closeCountJobMain(id)
message.success(t('关闭成功!'))
//
await getList()
} catch { }
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
@ -203,24 +221,63 @@ const handleExport = async () => {
await message.exportConfirm()
//
exportLoading.value = true
const data = await CountadjustWorkApi.exportCountadjustWork(tableObject.params)
download.excel(data, '备件盘点计划.xlsx')
const data = await CountJobMainApi.exportCountJobMain(tableObject.params)
download.excel(data, '备件申领记录主.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/**
* tableForm方法
*/
const tableFormKeys = {}
CountJobDetail.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 CountJobMainApi.createCountJobMain(data)
message.success(t('common.createSuccess'))
} else {
await CountJobMainApi.updateCountJobMain(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'
templateTitle: '采购订单主导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
@ -238,7 +295,6 @@ const searchFormClick = (searchData) => {
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await CountadjustWorkApi.importTemplate()
importTemplateData.templateUrl = await CountJobMainApi.importTemplate()
})
</script>

Loading…
Cancel
Save