Browse Source

解决冲突

master
ljlong_2630 10 months ago
parent
commit
4af35755be
  1. 53
      src/api/eam/item/transaction/index.ts
  2. 5
      src/utils/dict.ts
  3. 241
      src/views/eam/item/transaction/index.vue
  4. 102
      src/views/eam/item/transaction/transaction.data.ts
  5. 18
      src/views/system/dept/DeptForm.vue

53
src/api/eam/item/transaction/index.ts

@ -0,0 +1,53 @@
import request from '@/config/axios'
export interface TransactionVO {
itemNumber: string
locationNumber: string
transactionType: string
inventoryAction: string
businessType: string
inventoryStatus: string
uom: string
qty: number
}
// 查询库存事务列表
export const getTransactionPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/transaction/senior', data })
} else {
return await request.get({ url: `/eam/transaction/page`, params })
}
}
// 查询库存事务详情
export const getTransaction = async (id: number) => {
return await request.get({ url: `/eam/transaction/get?id=` + id })
}
// 新增库存事务
export const createTransaction = async (data: TransactionVO) => {
return await request.post({ url: `/eam/transaction/create`, data })
}
// 修改库存事务
export const updateTransaction = async (data: TransactionVO) => {
return await request.put({ url: `/eam/transaction/update`, data })
}
// 删除库存事务
export const deleteTransaction = async (id: number) => {
return await request.delete({ url: `/eam/transaction/delete?id=` + id })
}
// 导出库存事务 Excel
export const exportTransaction = async (params) => {
return await request.download({ url: `/eam/transaction/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/transaction/get-import-template' })
}

5
src/utils/dict.ts

@ -226,7 +226,6 @@ export enum DICT_TYPE {
BARCODE_PREFIX = 'barcode_prefix', // 条码前缀 BARCODE_PREFIX = 'barcode_prefix', // 条码前缀
SETTLEMENT_TYPE = 'settlement_type', // 结算类型 SETTLEMENT_TYPE = 'settlement_type', // 结算类型
FROZEN_REASON = 'frozen_reason', // 冻结原因 FROZEN_REASON = 'frozen_reason', // 冻结原因
INVENTORY_ACTION = 'inventory_action', // 库存动作
CONTAINER_TYPE = 'container_type', // 器具类型 CONTAINER_TYPE = 'container_type', // 器具类型
CONTAINER_CONTENT_TYPE = 'container_content_type', // 器具内容类型 CONTAINER_CONTENT_TYPE = 'container_content_type', // 器具内容类型
RESET_PERIOD = 'reset_period', // 重置周期 RESET_PERIOD = 'reset_period', // 重置周期
@ -277,9 +276,9 @@ export enum DICT_TYPE {
DEVICE_MOLD_TYPE = 'device_mold_type', // 设备/模具类型 DEVICE_MOLD_TYPE = 'device_mold_type', // 设备/模具类型
TRANSACTION_TYPE = 'transaction_Type', // 事务类型 TRANSACTION_TYPE = 'transaction_Type', // 事务类型
RESULT = 'result', // 维修结果 RESULT = 'result', // 维修结果
REQUEST_APPLY = 'class_type', // 班组类型
FAULT_TYPE = 'fault_type',//故障类型 FAULT_TYPE = 'fault_type',//故障类型
WEI_XIU_ORDER_STATUS = 'wei_xiu_order_status',//维修单状态 WEI_XIU_ORDER_STATUS = 'wei_xiu_order_status',//维修单状态
BASIC_STATUS = 'basic_status',//设备模具状态 BASIC_STATUS = 'basic_status',//设备模具状态
CLASS_TYPE = 'class_type', // 班组类型
INVENTORY_ACTION = 'inventory_action' //库存动作
} }

241
src/views/eam/item/transaction/index.vue

@ -0,0 +1,241 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="Transaction.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="Transaction.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="Transaction.allSchemas"
:apiUpdate="TransactionApi.updateTransaction"
:apiCreate="TransactionApi.createTransaction"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="Transaction.allSchemas" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { Transaction,Rules } from './transaction.data'
import * as TransactionApi from '@/api/eam/item/transaction'
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: 'Transaction' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(Transaction.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: TransactionApi.getTransactionPage //
})
//
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 =Transaction.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 TransactionApi.createTransaction(data)
message.success(t('common.createSuccess'))
} else {
await TransactionApi.updateTransaction(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 TransactionApi.deleteTransaction(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 TransactionApi.exportTransaction(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()
})
</script>

102
src/views/eam/item/transaction/transaction.data.ts

@ -0,0 +1,102 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
// 表单校验
export const Rules = reactive({
itemNumber: [required],
locationNumber: [required],
inventoryAction: [required],
businessType: [required],
uom: [required],
})
export const Transaction = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '事务编号',
field: 'number',
sort: 'custom',
isSearch: true,
},
{
label: '备件编号',
field: 'itemNumber',
sort: 'custom',
isSearch: true,
},
{
label: '库位编码',
field: 'locationNumber',
sort: 'custom',
isSearch: true,
},
{
label: '事务类型',
field: 'transactionType',
sort: 'custom',
dictType: DICT_TYPE.TRANSACTION_TYPE,
dictClass: 'string',
isSearch: false,
isTable: true,
table: {
width: 150
},
tableForm: {
type: 'Select'
}
},
{
label: '库存动作',
field: 'inventoryAction',
sort: 'custom',
dictType: DICT_TYPE.INVENTORY_ACTION,
dictClass: 'string',
isSearch: false,
isTable: true,
table: {
width: 150
},
tableForm: {
type: 'Select'
}
},
{
label: '业务类型',
field: 'businessType',
sort: 'custom',
isSearch: true,
form: {
component: 'Select'
},
},
{
label: '库存状态',
field: 'inventoryStatus',
sort: 'custom',
isSearch: true,
form: {
component: 'Radio'
},
},
{
label: '计量单位',
field: 'uom',
sort: 'custom',
isSearch: true,
},
{
label: '数量',
field: 'qty',
sort: 'custom',
isSearch: true,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

18
src/views/system/dept/DeptForm.vue

@ -51,9 +51,9 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="班组类型" prop="classType"> <el-select v-model="formData.classType" clearable placeholder="请选择班组类型"> <el-option v-for="dict in getIntDictOptions(DICT_TYPE.REQUEST_APPLY)" :key="dict.value" :label="dict.label" :value="dict.value" /> </el-select> </el-form-item> <el-form-item label="班组类型" prop="classType"> <el-select v-model="formData.classType" clearable placeholder="请选择班组类型"> <el-option v-for="dict in getStrDictOptions(DICT_TYPE.CLASS_TYPE)" :key="dict.value"
:label="dict.label"
:value="dict.value" /> </el-select> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -62,7 +62,7 @@
</Dialog> </Dialog>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions,getStrDictOptions } from '@/utils/dict'
import { defaultProps, handleTree } from '@/utils/tree' import { defaultProps, handleTree } from '@/utils/tree'
import * as DeptApi from '@/api/system/dept' import * as DeptApi from '@/api/system/dept'
import * as UserApi from '@/api/system/user' import * as UserApi from '@/api/system/user'
@ -104,6 +104,16 @@ const formRef = ref() // 表单 Ref
const deptTree = ref() // const deptTree = ref() //
const userList = ref<UserApi.UserVO[]>([]) // const userList = ref<UserApi.UserVO[]>([]) //
console.log(getIntDictOptions(DICT_TYPE.DEVICE_MOLD_TYPE))
/** 打开弹窗 */ /** 打开弹窗 */
const open = async (type: string, id?: number) => { const open = async (type: string, id?: number) => {
dialogVisible.value = true dialogVisible.value = true

Loading…
Cancel
Save