Browse Source

设备台账补充详情列表部分

master
ljlong_2630 9 months ago
parent
commit
d7ba4e7564
  1. 61
      src/api/eam/basic/fixedAssets/index.ts
  2. 19
      src/api/eam/mold/moldAccounts/index.ts
  3. 111
      src/components/Detail/src/DetailDeviceLedger.vue
  4. 146
      src/views/eam/basic/fixedAssets/fixedAssets.data.ts
  5. 244
      src/views/eam/basic/fixedAssets/index.vue
  6. 54
      src/views/eam/device/deviceAccounts/index.vue
  7. 285
      src/views/eam/mold/moldAccounts/index.vue
  8. 129
      src/views/eam/mold/moldAccounts/moldAccounts.data.ts

61
src/api/eam/basic/fixedAssets/index.ts

@ -1,61 +0,0 @@
import request from '@/config/axios'
export interface FixedAssetsVO {
number: string
name: string
accountingUnit: string
specifications: string
locationNumber: string
purchaseDate: Date
purchaseDept: string
supplierNumber: string
productionDate: Date
purchasePrice: number
manageDept: string
unit: string
qty: number
siteId: string
available: string
concurrencyStamp: number
}
// 查询固定资产列表
export const getFixedAssetsPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/fixed-assets/senior', data })
} else {
return await request.get({ url: `/eam/fixed-assets/page`, params })
}
}
// 查询固定资产详情
export const getFixedAssets = async (id: number) => {
return await request.get({ url: `/eam/fixed-assets/get?id=` + id })
}
// 新增固定资产
export const createFixedAssets = async (data: FixedAssetsVO) => {
return await request.post({ url: `/eam/fixed-assets/create`, data })
}
// 修改固定资产
export const updateFixedAssets = async (data: FixedAssetsVO) => {
return await request.put({ url: `/eam/fixed-assets/update`, data })
}
// 删除固定资产
export const deleteFixedAssets = async (id: number) => {
return await request.delete({ url: `/eam/fixed-assets/delete?id=` + id })
}
// 导出固定资产 Excel
export const exportFixedAssets = async (params) => {
return await request.download({ url: `/eam/fixed-assets/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/fixed-assets/get-import-template' })
}

19
src/api/eam/mold/moldAccounts/index.ts

@ -12,15 +12,12 @@ export interface MoldAccountsVO {
supplierNumber: string
productionDate: Date
purchasePrice: number
isClientAssets: string
frequency: number
beat: number
siteId: string
available: string
concurrencyStamp: number
}
// 查询模具台账列表
// 查询设备台账列表
export const getMoldAccountsPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
@ -31,27 +28,27 @@ export const getMoldAccountsPage = async (params) => {
}
}
// 查询模具台账详情
// 查询设备台账详情
export const getMoldAccounts = async (id: number) => {
return await request.get({ url: `/eam/mold-accounts/get?id=` + id })
}
// 新增模具台账
// 新增设备台账
export const createMoldAccounts = async (data: MoldAccountsVO) => {
return await request.post({ url: `/eam/mold-accounts/create`, data })
}
// 修改模具台账
// 修改设备台账
export const updateMoldAccounts = async (data: MoldAccountsVO) => {
return await request.put({ url: `/eam/mold-accounts/update`, data })
}
// 删除模具台账
// 删除设备台账
export const deleteMoldAccounts = async (id: number) => {
return await request.delete({ url: `/eam/mold-accounts/delete?id=` + id })
}
// 导出模具台账 Excel
// 导出设备台账 Excel
export const exportMoldAccounts = async (params) => {
return await request.download({ url: `/eam/mold-accounts/export-excel`, params })
}
@ -61,7 +58,9 @@ export const importTemplate = () => {
return request.download({ url: '/eam/mold-accounts/get-import-template' })
}
// 查询模型台账列表
// 查询设备台账列表
export const getMoldAccountsNoPage = async (params) => {
return await request.get({ url: `/eam/mold-accounts/selectData`, params })
}

111
src/components/Detail/src/DetailDeviceLedger.vue

@ -66,20 +66,29 @@
<!-- 单表切换tabs 展现table -->
<Table
v-if="isBasic && tabsExtend == 3"
:columns="detailAllSchemasRef.tableColumns"
:columns="detailAllSchemasRef.tableColumns.filter(column => column.field !== 'action')"
:data="tableObjectRef.tableList"
:loading="tableObjectRef.loading"
:pagination="{ total: tableObjectRef.total }"
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
>
<!-- <template #action="{ row }">
<ButtonBase
:Butttondata="buttondata"
@button-base-click="buttonTableClick($event, row)"
/>
</template> -->
<template #number="{ row }">
<el-button type="primary" link @click="openDialog(row, '编号', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
</Table>
<!-- 单表切换tabs 展现table -->
<Table
v-if="isBasic && tabsExtend == 4"
:columns="detailAllSchemasRef.tableColumns.filter(column => column.field !== 'action')"
:data="tableObjectRef.tableList"
:loading="tableObjectRef.loading"
:pagination="{ total: tableObjectRef.total }"
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
/>
<Table
v-if="!isBasic && fromeWhere != 'countPlan'"
:columns="detailAllSchemasRef.tableColumns"
@ -141,6 +150,17 @@
:formTypeDetail="formTypeDetail"
:countPlanAllList="countPlanAllList"
/>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<Table
v-if="true"
:columns="dialogAllSchemasRef.tableColumns.filter(column => column.field !== 'action')"
:data="dialogTableObjectRef.tableList"
:loading="dialogTableObjectRef.loading"
:pagination="{ total: dialogTableObjectRef.total }"
v-model:pageSize="dialogTableObjectRef.pageSize"
v-model:currentPage="dialogTableObjectRef.currentPage"
/>
</Dialog>
</div>
</template>
@ -166,6 +186,11 @@ const routeName = ref()
routeName.value = route.name
routeName.value = routeName.value.substring(0, routeName.value.length - 4) + 'Detail'
const updateKey = ref(0)
const dialogVisible = ref(false)
const dialogTitle = ref()
const dialogAllSchemasRef = ref()
const dialogTableObjectRef = ref()
const dialogTableMethodsRef = ref()
const props = defineProps({
//
@ -307,7 +332,25 @@ const props = defineProps({
type: Function,
required: false,
default: null
}
},
//
defaultParams: {
type: Object,
required: false,
default: null
},
//dialogapi
dialogApiPage: {
type: Function,
required: false,
default: null
},
// dialog
dialogAllSchemas: {
type: Object,
required: true,
default: null
},
})
const imageFormData = ref({
filePathList: []
@ -481,7 +524,7 @@ const tableMethodsRef = ref()
const detailAllSchemasRef = ref()
const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage //
getListApi: props.apiPage, //
})
tableObjectRef.value = tableObject
@ -612,13 +655,13 @@ const searchFormClick = async (searchData) => {
const { getList } = tableMethods
await getList()
updateKey.value += 1
// tableObjectRef.value.params = {
// isSearch: true,
// filters: searchData.filters
// ? searchData.filters
// : [{ column: 'masterId', action: '==', value: masterParmas.value.masterId }]
// }
// getList() //
tableObjectRef.value.params = {
isSearch: true,
filters: searchData.filters
? searchData.filters
: [{ column: 'masterId', action: '==', value: masterParmas.value.masterId }]
}
getList() //
}
//
const selectChangeDetail = (field, val) => {
@ -676,12 +719,13 @@ const uploadFile = async () => {
}
//
watch(
() => props.apiPage,
() => current.value,
() => {
const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage //
getListApi: props.apiPage, //
defaultParams: getDefaultParams()
})
tableObject.params.number = masterParmas.value.number
// tableObject.params.number = masterParmas.value.number
detailAllSchemasRef.value = props.detailAllSchemas
if (props.tableObjectExtend) {
props.tableObjectExtend.forEach((item) => {
@ -694,6 +738,35 @@ watch(
getList()
}
)
function getDefaultParams() {
if (props.defaultParams !== undefined && Object.keys(props.defaultParams).length !== 0) {
return props.defaultParams
} else {
return {}
}
}
function getDialogParams(row: any) {
return {
number: row.number
}
}
const openDialog = async(row: any, titleName: any, titleValue: any) => {
const { tableObject, tableMethods } = useTable({
getListApi: props.dialogApiPage, //
defaultParams: getDialogParams(row)
})
dialogAllSchemasRef.value = props.dialogAllSchemas
dialogTableObjectRef.value = tableObject
dialogTableMethodsRef.value = tableMethods
dialogTableObjectRef.value.tableList = []
const { getList } = tableMethods
await getList()
updateKey.value += 1
getList() //
}
</script>
<style lang="scss">
.el-drawer__body {

146
src/views/eam/basic/fixedAssets/fixedAssets.data.ts

@ -1,146 +0,0 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const FixedAssetsRules = reactive({
number: [required],
name: [required],
locationNumber: [required],
supplierNumber: [required],
purchasePrice: [required],
qty: [required],
concurrencyStamp: [required],
})
export const FixedAssets = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编号唯一标识',
field: 'number',
sort: 'custom',
isSearch: true,
},
{
label: '资产名称',
field: 'name',
sort: 'custom',
isSearch: true,
},
{
label: '会计单位',
field: 'accountingUnit',
sort: 'custom',
isSearch: true,
},
{
label: '规格型号',
field: 'specifications',
sort: 'custom',
},
{
label: '库位编号',
field: 'locationNumber',
sort: 'custom',
isSearch: true,
},
{
label: '购买时间',
field: 'purchaseDate',
sort: 'custom',
formatter: dateFormatter,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
},
{
label: '采购部门',
field: 'purchaseDept',
sort: 'custom',
},
{
label: '供应商编号',
field: 'supplierNumber',
sort: 'custom',
},
{
label: '出厂日期',
field: 'productionDate',
sort: 'custom',
formatter: dateFormatter,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
},
{
label: '购买价格',
field: 'purchasePrice',
sort: 'custom',
},
{
label: '管理部门',
field: 'manageDept',
sort: 'custom',
},
{
label: '单位',
field: 'unit',
sort: 'custom',
},
{
label: '数量',
field: 'qty',
sort: 'custom',
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
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: '地点ID',
field: 'siteId',
sort: 'custom',
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
isSearch: true,
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

244
src/views/eam/basic/fixedAssets/index.vue

@ -1,244 +0,0 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="FixedAssets.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="FixedAssets.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="FixedAssetsRules"
:formAllSchemas="FixedAssets.allSchemas"
:apiUpdate="FixedAssetsApi.updateFixedAssets"
:apiCreate="FixedAssetsApi.createFixedAssets"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="FixedAssets.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/fixed-assets/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { FixedAssets,FixedAssetsRules } from './fixedAssets.data'
import * as FixedAssetsApi from '@/api/eam/basic/fixedAssets'
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: 'FixedAssets' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(FixedAssets.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: FixedAssetsApi.getFixedAssetsPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:fixedAssets:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:fixedAssets:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:fixedAssets: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:fixedAssets:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:fixedAssets: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 =FixedAssets.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 FixedAssetsApi.createFixedAssets(data)
message.success(t('common.createSuccess'))
} else {
await FixedAssetsApi.updateFixedAssets(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, 'basicFixedAssets')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await FixedAssetsApi.deleteFixedAssets(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 FixedAssetsApi.exportFixedAssets(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 FixedAssetsApi.importTemplate()
})
</script>

54
src/views/eam/device/deviceAccounts/index.vue

@ -70,6 +70,9 @@
:tableObjectExtend="tableObjectExtend"
:getImageApi="uploadApi.getImage"
:uploadImage="uploadApi.uploadImage"
:defaultParams="defaultParams"
:dialogApiPage="dialogApiPage"
:dialogAllSchemas="dialogAllSchemas"
/>
<!-- 导入 -->
@ -98,8 +101,20 @@ import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import DetailDeviceLedger from '@/components/Detail/src/DetailDeviceLedger.vue'
import { DeviceRepair } from '@/views/eam/device/deviceRepair/deviceRepair.data'
import { DeviceItem } from '@/views/eam/basic/deviceItem/deviceItem.data'
import * as deviceRepairApi from '@/api/eam/device/deviceRepair'
import * as uploadApi from '@/api/eam/upload'
import * as DeviceMaintainOrderMainApi from '@/api/eam/device/deviceMaintainOrderMain'
import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain'
import * as deviceMaintenanceDetailApi from '@/api/eam/device/deviceMaintenanceDetail'
import {
DeviceMaintainOrderMain,
} from '../deviceMaintainOrderMain/deviceMaintainOrderMain.data'
import {
DeviceMaintenanceMain,
DeviceMaintenanceDetail
} from '../deviceMaintenanceMain/deviceMaintenanceMain.data'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
defineOptions({ name: 'DeviceAccounts' })
@ -118,6 +133,9 @@ const detailAllSchemas = ref()
const apiPage = ref()
const itemCodeRow = ref()
const tableObjectExtend = ref()
const defaultParams = ref({})
const dialogApiPage = ref()
const dialogAllSchemas = ref()
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
@ -308,21 +326,35 @@ const changeTabs = (item) => {
// apiPage.value = PurchaseDetailApi.getPurchaseDetailPage
// detailAllSchemas.value = PurchaseMain.allSchemas
} else if (item.prop == 'Part') {
tabsExtend.value = 3
// apiPage.value = deviceRepairApi.getDeviceRepairPage
// detailAllSchemas.value = DeviceRepair.allSchemas
tabsExtend.value = 4
defaultParams.value = {
deviceNumber: itemCodeRow
}
apiPage.value = getDeviceItemPage
detailAllSchemas.value = DeviceItem.allSchemas
} else if (item.prop == 'DeviceReportRecord') {
tabsExtend.value = 3
tabsExtend.value = 4
defaultParams.value = {
deviceNumber: itemCodeRow
}
apiPage.value = deviceRepairApi.getDeviceRepairPage
detailAllSchemas.value = DeviceRepair.allSchemas
} else if (item.prop == 'RepairRecord') {
tabsExtend.value = 3
// apiPage.value = ExpectinApi.getExpectinPage
// detailAllSchemas.value = Expectin.allSchemas
defaultParams.value = {
deviceNumber: itemCodeRow
}
apiPage.value = DeviceMaintenanceMainApi.getDeviceMaintenanceMainPage
detailAllSchemas.value = DeviceMaintenanceMain.allSchemas
dialogApiPage.value = deviceMaintenanceDetailApi.getDeviceMaintenanceDetailPage
dialogAllSchemas.value = DeviceMaintenanceDetail.allSchemas
} else if (item.prop == 'MaintenanceRecord') {
tabsExtend.value = 3
// apiPage.value = ExpectinApi.getExpectinPage
// detailAllSchemas.value = Expectin.allSchemas
defaultParams.value = {
deviceNumber: itemCodeRow
}
apiPage.value = DeviceMaintainOrderMainApi.getDeviceMaintainOrderMainPage
detailAllSchemas.value = DeviceMaintainOrderMain.allSchemas
}
// detailAllSchemas.value.tableColumns.map((item, index) => {
// if (item.field == 'action') {
@ -434,4 +466,10 @@ const getDeviceItemList = async () => {
tableObject.loading = false
}
}
const getDeviceItemBindData = async (params) => {
const response = await getDeviceItemPage(params);
return response?.data;
}
</script>

285
src/views/eam/mold/moldAccounts/index.vue

@ -1,18 +1,22 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="MoldAccounts.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search
:schema="MoldAccounts.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="MoldAccounts.allSchemas"
/>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="MoldAccounts.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
@ -27,13 +31,13 @@
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>
<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" @button-base-click="buttonTableClick($event, row)" />
</template>
</Table>
</ContentWrap>
@ -50,21 +54,53 @@
:isBusiness="false"
/>
<SearchTable ref="searchTableRef" @searchTableSuccess="submitItem" />
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="MoldAccounts.allSchemas" />
<DetailMoldLedger
ref="detailRef"
:tabs="MoldLedgerTabsList"
:subTabs="MoldLedgerSubTabsList"
:isBasic="true"
:allSchemas="allSchemas"
@changeTabs="changeTabs"
:detailAllSchemas="detailAllSchemas"
:apiPage="apiPage"
:tabsExtend="tabsExtend"
:tableObjectExtend="tableObjectExtend"
:getImageApi="uploadApi.getImage"
:uploadImage="uploadApi.uploadImage"
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/mold-accounts/import" :importTemplateData="importTemplateData" @success="importSuccess" />
<ImportForm
ref="importFormRef"
url="/eam/mold-accounts/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { MoldAccounts,MoldAccountsRules } from './moldAccounts.data'
import {
MoldAccounts,
MoldAccountsRules,
UpImage
} from './moldAccounts.data'
import { Item } from '@/views/eam/basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item'
// import { createMoldItemBatch, getMoldItemPage } from '@/api/eam/basic/rel'
import * as MoldAccountsApi from '@/api/eam/mold/moldAccounts'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
// import TableHead from '@/components/TableHead/src/TableHead.vue'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
// import Detail from '@/components/Detail/src/Detail.vue'
// import { MoldLedgerTabsList } from '@/utils/disposition/tabsList'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import DetailMoldLedger from '@/components/Detail/src/DetailDeviceLedger.vue'
import { MoldRepair } from '@/views/eam/mold/moldRepair/moldRepair.data'
import * as moldRepairApi from '@/api/eam/mold/moldRepair'
import * as uploadApi from '@/api/eam/upload'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
defineOptions({ name: 'MoldAccounts' })
@ -73,9 +109,16 @@ const { t } = useI18n() // 国际化
const route = useRoute() //
const routeName = ref()
const moldNumber = ref()
routeName.value = route.name
const tableColumns = ref(MoldAccounts.allSchemas.tableColumns)
const allSchemas = ref(MoldAccounts.allSchemas)
const detailAllSchemas = ref()
const apiPage = ref()
const itemCodeRow = ref()
const tableObjectExtend = ref()
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
@ -99,12 +142,12 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:moldAccounts:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:moldAccounts:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:moldAccounts:export'}), //
defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultImportBtn(null), //
defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
defaultButtons.defaultSetBtn(null) //
// {
// label: '',
// name: 'zdy',
@ -117,32 +160,44 @@ const HeadButttondata = [
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
if (val == 'add') {
//
openForm('create')
} else if (val == 'import') { //
} else if (val == 'import') {
//
handleImport()
} else if (val == 'export') { //
} else if (val == 'export') {
//
handleExport()
} else if (val == 'refresh') { //
} else if (val == 'refresh') {
//
getList()
} else if (val == 'filtrate') { //
} else { //
} else if (val == 'filtrate') {
//
} else {
//
console.log('其他按钮', item)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:moldAccounts:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:moldAccounts:delete'}), //
defaultButtons.mainListEditBtn(null), //
// defaultButtons.mainListDeleteBtn(null), //
defaultButtons.selectQrCodeBtn(null), //
defaultButtons.selectItemBtn(null) //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} else if (val == 'selectQrCode') {
//
openQrCode(row.number)
} else if (val == 'selectItem') {
openItem(row.number)
}
}
@ -153,18 +208,18 @@ const openForm = (type: string, row?: any) => {
}
// form
const formsSuccess = async (formType,data) => {
var isHave =MoldAccounts.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
const formsSuccess = async (formType, data) => {
var isHave = MoldAccounts.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime'
})
if (isHave) {
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间')
return;
return
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (data.activeTime == 0) data.activeTime = null
if (data.expireTime == 0) data.expireTime = null
if (formType === 'create') {
await MoldAccountsApi.createMoldAccounts(data)
message.success(t('common.createSuccess'))
@ -179,6 +234,8 @@ const formsSuccess = async (formType,data) => {
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
itemCodeRow.value = row.number
tabsExtend.value = 1
detailRef.value.openDetail(row, titleName, titleValue, 'basicMoldAccounts')
}
@ -204,7 +261,7 @@ const handleExport = async () => {
//
exportLoading.value = true
const data = await MoldAccountsApi.exportMoldAccounts(tableObject.params)
download.excel(data, '模具台账.xlsx')
download.excel(data, '设备台账.xlsx')
} catch {
} finally {
exportLoading.value = false
@ -219,7 +276,7 @@ const handleImport = () => {
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '模具台账导入模版.xlsx'
templateTitle: '设备台账导入模版.xlsx'
})
//
const importSuccess = () => {
@ -235,10 +292,146 @@ const searchFormClick = (searchData) => {
getList() //
}
const MoldLedgerSubTabsList = getStrDictOptions(DICT_TYPE.DEVICE_DOC_TYPE)
const tabsExtend = ref()
const funcCode = ref('mold_mould_picture')
// tabs
const changeTabs = (item) => {
if (item.prop == 'Image') {
tabsExtend.value = 1
funcCode.value = 'mold_mould_picture'
// apiPage.value = CustomeritemApi.getCustomeritemPage
// detailAllSchemas.value = Customeritem.allSchemas
} else if (item.prop == 'Word') {
tabsExtend.value = 2
funcCode.value = 'mold_mould_attachment'
// apiPage.value = PurchaseDetailApi.getPurchaseDetailPage
// detailAllSchemas.value = PurchaseMain.allSchemas
} else if (item.prop == 'Part') {
tabsExtend.value = 3
// apiPage.value = moldRepairApi.getMoldRepairPage
// detailAllSchemas.value = MoldRepair.allSchemas
} else if (item.prop == 'MoldReportRecord') {
tabsExtend.value = 3
apiPage.value = moldRepairApi.getMoldRepairPage
detailAllSchemas.value = MoldRepair.allSchemas
} else if (item.prop == 'RepairRecord') {
tabsExtend.value = 3
// apiPage.value = ExpectinApi.getExpectinPage
// detailAllSchemas.value = Expectin.allSchemas
} else if (item.prop == 'MaintenanceRecord') {
tabsExtend.value = 3
// apiPage.value = ExpectinApi.getExpectinPage
// detailAllSchemas.value = Expectin.allSchemas
}
// detailAllSchemas.value.tableColumns.map((item, index) => {
// if (item.field == 'action') {
// detailAllSchemas.value.tableColumns.splice(index, 1)
// }
// })
//
tableObjectExtend.value = [
{
key: 'itemCode',
value: itemCodeRow.value
}
]
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await MoldAccountsApi.importTemplate()
})
/** 二维码 */
const openQrCode = async (number: String) => {
// const data = await MoldAccountsApi.getQrCode(number)
// const url = window.URL.createObjectURL(new Blob([data]))
// const link = document.createElement('a')
// link.style.display = 'none'
// link.href = url
// link.setAttribute('download', '.png')
// document.body.appendChild(link)
// link.click()
// try {
// //
// await message.delConfirm()
// //
// await MoldAccountsApi.deleteMoldAccounts(id)
// message.success(t('common.delSuccess'))
// //
// await getList()
// } catch {}
}
const searchTableRef = ref()
/** 绑定备件操作 */
const openItem = async (number: String) => {
moldNumber.value = number
searchTableRef.value.open(
'选择备件',
Item.allSchemas,
getMoldItemList,
null,
Item.allSchemas.searchSchema,
true,
null,
null,
null,
null
)
}
const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => {
const moldItemRelList = selections.map((element) => ({
moldNumber: moldNumber.value,
itemNumber: element.number
}))
createMoldItemBatch(moldItemRelList).then((res) => {
console.log('res', res)
})
console.log('moldItemRelList', moldItemRelList)
}
const getItemWithOutBind = async () => {
try {
const res = await ItemApi.getItemPage({
...Item.allSchemas.searchSchema
})
if (res.list?.length > 0) {
// const response = await getMoldItemPage(MoldAccounts.allSchemas.searchSchema);
// const filteredList = res.list.filter(item => {
// return !response.list?.some(element => {
// return item.number === element.itemNumber
// });
// });
// console.log('filteredList',filteredList);
const filteredList = res.list
return filteredList //
}
return [] //
} catch (error) {
console.error(error)
throw error //
}
}
// getListApi getItemWithOutBind
const getMoldItemList = async () => {
tableObject.loading = true
try {
const res = await getItemWithOutBind()
let result = {
list: res,
total: res.length
}
return result
} catch (error) {
console.error(error)
} finally {
tableObject.loading = false
}
}
</script>

129
src/views/eam/mold/moldAccounts/moldAccounts.data.ts

@ -3,47 +3,48 @@ import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const MoldAccountsRules = reactive({
number: [required],
// number: [required],
name: [required],
factoryAreaNumber: [required],
purchaseTime: [required],
deptId: [required],
purchaser: [required],
supplierNumber: [required],
concurrencyStamp: [required],
// factoryAreaNumber: [required],
// purchaseTime: [required],
// deptId: [required],
// purchaser: [required],
// supplierNumber: [required],
concurrencyStamp: [required]
})
export const MoldAccounts = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编号',
label: '编号唯一标识',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: false,
},
{
label: '名称',
field: 'name',
sort: 'custom',
isSearch: true,
isSearch: true
},
{
label: '规格型号',
field: 'specification',
sort: 'custom',
sort: 'custom'
},
{
label: '模具类型',
label: '设备类型',
field: 'type',
sort: 'custom',
isSearch: true,
form: {
component: 'Select'
},
form: {
component: 'Select'
}
},
{
label: '所属厂区编号',
field: 'factoryAreaNumber',
sort: 'custom',
sort: 'custom'
},
{
label: '采购时间',
@ -57,29 +58,33 @@ export const MoldAccounts = useCrudSchemas(reactive<CrudSchema[]>([
valueFormat: 'x'
}
},
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
}
},
{
label: '采购部门',
field: 'deptId',
field: 'purchaseDept',
sort: 'custom',
isSearch: false,
isForm: true,
isTable: true,
form: {
component: 'InputNumber',
value: 0
},
component: 'Input',
}
},
{
label: '采购人',
field: 'purchaser',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
component: 'Input',
}
},
{
label: '供应商编号',
field: 'supplierNumber',
sort: 'custom',
sort: 'custom'
},
{
label: '出厂日期',
@ -92,69 +97,67 @@ export const MoldAccounts = useCrudSchemas(reactive<CrudSchema[]>([
type: 'datetime',
valueFormat: 'x'
}
},
}
},
{
label: '购买价格',
label: '价格',
field: 'purchasePrice',
sort: 'custom',
},
{
label: '是否客户资产TRUE/FALSE',
field: 'isClientAssets',
sort: 'custom',
},
{
label: '生产次数 用来产生保养计划,保养计划完成后归零。',
field: 'frequency',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '节拍 生产一个零件所需时间,对系统没影响',
field: 'beat',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
sort: 'custom'
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isForm: false,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
isForm: false
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
label: '维修状态',
field: 'status',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
dictType: DICT_TYPE.BASIC_STATUS,
dictClass: 'string',
isSearch: true,
isForm: false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
width: 200,
fixed: 'right'
}
},
isDetail: false,
}
]))
// 表单校验
export const UpImageRules = reactive({
filePath: [required],
})
export const UpImage = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '上传图片',
field: 'filePathList',
sort: 'custom',
isForm: true,
form:{
component:'UploadImgs',
}
},
]))
// // 表单校验
// export const UpFileRules = reactive({
// filePath: [required],
// })

Loading…
Cancel
Save