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. 484
      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', //是否打开 IS_OPEN = 'is_open', //是否打开
ITEM_APPLY_STATUS = 'item_apply_status',//备件申领状态 ITEM_APPLY_STATUS = 'item_apply_status',//备件申领状态
JX_DETAILS_STATUS = 'jx_details_status', //检修明细状态 JX_DETAILS_STATUS = 'jx_details_status', //检修明细状态
CLASSIFICATION = 'classification', //检修明细状态
} }

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

@ -83,7 +83,7 @@
// //
const HeadButttondata = [ const HeadButttondata = [
// defaultButtons.defaultAddBtn(null), // defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultExportBtn(null), // defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(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' type: 'Select'
} }
}, },
{
label: '备件分类',
field: 'classification',
sort: 'custom',
dictType: DICT_TYPE.CLASSIFICATION,
dictClass: 'string',
isSearch: false,
isTable: true,
tableForm: {
type: 'Select'
}
},
{ {
label: '单价', label: '单价',
field: 'singlePrice', field: 'singlePrice',

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

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

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

@ -1,244 +1,300 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="CountadjustWork.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search :schema="CountJobMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead <TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
:HeadButttondata="HeadButttondata" @updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick"
@button-base-click="buttonBaseClick" :allSchemas="CountJobMain.allSchemas" />
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="CountadjustWork.allSchemas"
/>
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table <Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{
: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:pageSize="tableObject.pageSize" v-model:sort="tableObject.sort">
v-model:currentPage="tableObject.currentPage" <template #number="{row}">
v-model:sort="tableObject.sort" <el-button type="primary" link @click="openDetail(row, '单据号', row.number)">
> <span>{{ row.number }}</span>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<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(row)" @button-base-click="buttonTableClick($event,row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm ref="formRef" @success="getList" :rules="CountJobMainRules" :formAllSchemas="CountJobMain.allSchemas"
ref="basicFormRef" :tableAllSchemas="CountJobDetail.allSchemas" :tableFormRules="CountJobDetailRules" :tableData="tableData"
@success="formsSuccess" :apiUpdate="CountJobMainApi.updateCountJobMain" :apiCreate="CountJobMainApi.createCountJobMain"
:rules="CountadjustWorkRules" :isBusiness="true" @handleAddTable="handleAddTable" @handleDeleteTable="handleDeleteTable"
:formAllSchemas="CountadjustWork.allSchemas" @searchTableSuccess="searchTableSuccess" @submitForm="submitForm" />
:apiUpdate="CountadjustWorkApi.updateCountadjustWork"
:apiCreate="CountadjustWorkApi.createCountadjustWork"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 --> <!-- 详情 -->
<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> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { CountadjustWork,CountadjustWorkRules } from './countadjustWork.data' import { CountJobMain, CountJobMainRules, CountJobDetail, CountJobDetailRules } from './countJobMain.data'
import * as CountadjustWorkApi from '@/api/eam/item/countadjustWork' import * as CountJobMainApi from '@/api/eam/item/countJobMain'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as CountJobDetailApi from '@/api/eam/item/countJobDetail'
import TableHead from '@/components/TableHead/src/TableHead.vue' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import Detail from '@/components/Detail/src/Detail.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
defineOptions({ name: 'CountadjustWork' }) //
defineOptions({ name: 'CountadjustWork' })
const message = useMessage() //
const { t } = useI18n() // const message = useMessage() //
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(CountadjustWork.allSchemas.tableColumns) const tableColumns = ref(CountJobMain.allSchemas.tableColumns)
// //
const searchTableSuccess = (formField, searchField, val, formRef) => { const updataTableColumns = (val) => {
nextTick(() => { tableColumns.value = val
const setV = {} }
setV[formField] = val[0][searchField]
formRef.setValues(setV) //
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: CountJobMainApi.getCountJobMainPage //
})
//
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.mainListEditBtn(null), //
defaultButtons.mainListDeleteBtn(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, 'basicCountJobMain')
}
/** 删除按钮操作 */
const handleDelete = async (id : number) => {
try {
//
await message.delConfirm()
//
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 () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
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'
}) })
}
//
// const importSuccess = () => {
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: CountadjustWorkApi.getCountadjustWorkPage //
})
//
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.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() getList()
} else if (val == 'filtrate') { // }
} else { //
console.log('其他按钮', item) //
} const searchFormClick = (searchData) => {
} tableObject.params = {
isSearch: true,
// - filters: searchData.filters
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:countadjustWork:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:countadjustWork: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 =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;
} }
getList() //
} }
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 detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicCountadjustWork')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await CountadjustWorkApi.deleteCountadjustWork(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 CountadjustWorkApi.exportCountadjustWork(tableObject.params)
download.excel(data, '备件盘点计划.xlsx')
} catch {
} finally {
exportLoading.value = 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 CountadjustWorkApi.importTemplate()
})
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await CountJobMainApi.importTemplate()
})
</script> </script>

Loading…
Cancel
Save