Browse Source

基础数据物料管理完善

master
陈薪名 1 year ago
parent
commit
9f138f1ac2
  1. 88
      src/components/BasicForm/src/BasicForm.vue
  2. 16
      src/components/SearchTable/src/SearchTable.vue
  3. 354
      src/utils/disposition/tableColumns.ts
  4. 202
      src/views/wms/bom/BomForm.vue
  5. 430
      src/views/wms/bom/index.vue
  6. 176
      src/views/wms/itembasic/ItembasicDetail.vue
  7. 156
      src/views/wms/itembasic/ItembasicForm.vue
  8. 133
      src/views/wms/itembasic/ItembasicImportForm.vue
  9. 26
      src/views/wms/itembasic/index.vue
  10. 48
      src/views/wms/itempackaging/index.vue
  11. 162
      src/views/wms/productionlineitem/ProductionlineitemForm.vue
  12. 43
      src/views/wms/productionlineitem/index.vue
  13. 177
      src/views/wms/stdcostprice/StdcostpriceForm.vue
  14. 31
      src/views/wms/stdcostprice/index.vue

88
src/components/BasicForm/src/BasicForm.vue

@ -1,6 +1,40 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<Form ref="formRef" v-loading="formLoading" :rules="rules" :schema="formSchema" :is-col="true" />
<Form ref="formRef" v-loading="formLoading" :rules="rules" :schema="formSchema" :is-col="true" >
<!-- <template #productItemCode="form">
<slot name="productItemCode" :param="form"></slot>
</template> -->
<template #itemCode="form">
<div class="w-[100%] flex">
<el-input v-model="form['itemCode']" :placeholder="'请选择物料代码'" @click="opensearchTable('itemCode', 'code')" />
</div>
</template>
<template #productItemCode="form">
<div class="w-[100%] flex">
<el-input v-model="form['productItemCode']" :placeholder="'请选择物料代码'" @click="opensearchTable('productItemCode', 'code')" />
</div>
</template>
<template #componentItemCode="form">
<div class="w-[100%] flex">
<el-input v-model="form['componentItemCode']" :placeholder="'请选择物料代码'" @click="opensearchTable('componentItemCode', 'code')" />
</div>
</template>
<template #supplierCode="form">
<div class="w-[100%] flex">
<el-input v-model="form['supplierCode']" :placeholder="'请选择供应商代码'" @click="opensearchTable('supplierCode', 'code')" />
</div>
</template>
<template #productionLineCode="form">
<div class="w-[100%] flex">
<el-input v-model="form['productionLineCode']" :placeholder="'请选择生产线代码'" @click="opensearchTable('productionLineCode', 'code')" />
</div>
</template>
<template #fgLocationCode="form">
<div class="w-[100%] flex">
<el-input v-model="form['fgLocationCode']" :placeholder="'请选择库位代码'" @click="opensearchTable('fgLocationCode', 'code')" />
</div>
</template>
</Form>
<div class="table" v-if="isBusiness">
<TableForm ref="tableFormRef"
class="w-[100%]"
@ -21,7 +55,7 @@
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" />
</template>
</Dialog>
<SearchTable ref="searchTableRef" :dialogTitle="searchTableTitle" />
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" />
</template>
<script setup lang="ts">
import { SearchTable } from '@/components/SearchTable';
@ -59,22 +93,10 @@ const props = defineProps({
required: true,
default: null
},
//
searchTableTitle: {
type: String,
//
searchTableParams: {
type: Array,
required: false,
default: '查询'
},
// Schemas
searchTableAllSchemas: {
type: Object,
required: true,
default: null
},
// APIpagelist
searchTablePage: {
type: Object,
required: true,
default: null
},
// APIVo
@ -100,6 +122,12 @@ const props = defineProps({
type: Boolean,
required: true,
default: true
},
// form
form:{
type: Object,
required: true,
default: null
}
})
@ -115,9 +143,20 @@ const formRef = ref() // 表单 Ref
const formSchema = ref(props.formAllSchemas.formSchema)
/** 弹层操作 */
// formField form
// searchField
const searchTableRef = ref()
const opensearchTable = () => {
searchTableRef.value.open('物品基础信息', props.searchTableAllSchemas, props.searchTablePage)
const opensearchTable = (formField, searchField) => {
const _searchTableParamsObject:any = props.searchTableParams.find((item:any) => (item.formField == formField))
const _searchTableTitle = _searchTableParamsObject.searchTableTitle
const _searchTableAllSchemas = _searchTableParamsObject.searchTableAllSchemas
const _searchTablePage = _searchTableParamsObject.searchTablePage
searchTableRef.value.open(_searchTableTitle, _searchTableAllSchemas, _searchTablePage, formField, searchField)
}
//
// val row
const searchTableSuccess = (formField,searchField, val) => {
emit('searchTableSuccess', formField, searchField, val, formRef.value )
}
/** 打开弹窗 */
@ -138,7 +177,7 @@ const open = async (type: string, row?: any) => {
}
}
}
defineExpose({ open }) // open
defineExpose({ open , formRef, opensearchTable}) // open
/** 弹窗按钮 */
const Butttondata = [
@ -170,11 +209,11 @@ const submitForm = async () => {
const valid = await elForm.validate()
if (!valid) return
if (props.isBusiness) {
const validateForm = await tableFormRef.value.validateForm()
console.log(tableFormRef.value);
console.log(validateForm);
if (!validateForm) return;
}
//
formLoading.value = true
try {
@ -212,7 +251,8 @@ const emit = defineEmits([
'handleTableSelect',
'handleDeleteTable',
'handleAddTable',
'inpuFocus'
'inpuFocus',
'searchTableSuccess'
])
//
const formSelectChange = (field, val) => {

16
src/components/SearchTable/src/SearchTable.vue

@ -34,7 +34,6 @@ const message = useMessage() // 消息弹窗
const searchDialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
/** 打开弹窗 */
const setSearchParamsRef = ref()
@ -42,15 +41,17 @@ const tableObjectRef = ref()
const getPage:any = ref()
const searchSchema = ref()
const tableColumns = ref()
const open = (type: string, allSchemas: any,getApiPage: any ) => {
const formFieldRef = ref()
const searchFieldRef = ref()
const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, searchField: any ) => {
searchDialogVisible.value = true
console.log(45,allSchemas )
formFieldRef.value = formField
searchFieldRef.value = searchField
searchSchema.value = allSchemas.searchSchema
tableColumns.value = allSchemas.tableColumns
getPage.value = getApiPage
// dialogTitle.value = t('action.' + type)
dialogTitle.value = type
formType.value = type
dialogTitle.value = titleName
const {tableObject, tableMethods } = useTable({
getListApi: getPage.value //
})
@ -67,7 +68,7 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
const searchTableRef = ref()
/** 提交表单 */
const emit = defineEmits(['success']) // success
const emit = defineEmits(['searchTableSuccess']) // searchTableSuccess
const submitForm = async () => {
//
formLoading.value = true
@ -80,7 +81,8 @@ const submitForm = async () => {
searchDialogVisible.value = false
//
emit('success')
emit('searchTableSuccess', formFieldRef.value, searchFieldRef.value, selections)
searchDialogVisible.value = false
} finally {
formLoading.value = false
}

354
src/utils/disposition/tableColumns.ts

@ -9,25 +9,23 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
label: '代码',
field: 'code',
sort: 'custom',
isSearch: true,
table: {
width: 150
},
tableForm:{
minWidth:200,
sortable:false
}
// tableForm:{
// minWidth:200,
// sortable:false
// }
},
{
label: '名称',
field: 'name',
sort: 'custom',
isSearch: true,
table: {
width: 150
},
tableForm:{
minWidth:200,
sortable:false
}
},
{
label: '描述1',
@ -36,7 +34,7 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: 150
} ,
isTableForm:false
// isTableForm:false
},
{
label: '描述2',
@ -45,7 +43,6 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: 150
} ,
isTableForm:false
},
{
label: '状态',
@ -61,12 +58,13 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
} ,
form: {
component: 'Switch',
},
tableForm:{
width: 100,
type:'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: '计量单位',
field: 'uom',
@ -78,10 +76,6 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: 120
} ,
tableForm:{
width: 200,
type:'Select',
}
},
{
label: '替代计量单位',
@ -89,12 +83,10 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 150
} ,
isTableForm:false
},
{
label: '是否标包',
@ -102,34 +94,41 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 120
},
form: {
component: 'Switch',
},
tableForm:{
width: 180,
type:'Radio',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
// tableForm:{
// width: 180,
// type:'Radio',
// }
},
{
label: '可采购',
field: 'enableBuy',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 100
},
form: {
component: 'Radio',
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
isTableForm:false
},
{
label: '可制造',
@ -137,34 +136,37 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 100
} ,
form: {
component: 'Radio',
},
tableForm:{
width: 180,
type:'Checkbox',
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: '可委外加工',
field: 'enableOutsourcing',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 120
} ,
form: {
component: 'Radio',
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
isTableForm:false
},
{
label: '回收件',
@ -172,15 +174,18 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 100
},
form: {
component: 'Radio',
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
isTableForm:false
},
{
label: '虚零件',
@ -188,15 +193,18 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 100
} ,
form: {
component: 'Radio',
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
isTableForm:false
},
{
label: 'ABC类',
@ -204,12 +212,10 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.ABC_CLASS,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 100
} ,
isTableForm:false
},
{
label: '类型',
@ -217,12 +223,10 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.ITEM_TYPE,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 100
} ,
isTableForm:false
},
{
label: '种类',
@ -230,12 +234,10 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.ITEM_CATEGORY,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 100
} ,
isTableForm:false
},
{
label: '分组',
@ -243,12 +245,10 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.ITEM_GROUP,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 100
} ,
isTableForm:false
},
{
label: '颜色',
@ -256,12 +256,10 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.ITEM_COLOR,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 100
} ,
isTableForm:false
},
{
label: '配置',
@ -269,12 +267,10 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.ITEM_CONFIGURATION,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 100
} ,
isTableForm:false
},
{
label: '项目',
@ -283,7 +279,6 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: 100
} ,
isTableForm:false
},
{
label: '质量等级',
@ -291,12 +286,10 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.EQ_LEVEL,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 120
} ,
isTableForm:false
},
{
label: '有效天数',
@ -308,7 +301,6 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
form: {
component: 'InputNumber',
},
isTableForm:false
},
{
label: '是否可用',
@ -316,15 +308,18 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 120
},
form: {
component: 'Radio',
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
isTableForm:false
},
{
label: '生效时间',
@ -336,18 +331,18 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 120
width: 180
} ,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetimerange',
type: 'datetime',
}
},
tableForm:{
width: 200,
type:'FormDateTime',
}
// tableForm:{
// width: 200,
// type:'FormDateTime',
// }
},
{
label: '失效时间',
@ -359,15 +354,14 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 120
width: 180
} ,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetimerange',
type: 'datetime',
}
},
isTableForm:false
},
{
label: '创建时间',
@ -380,12 +374,16 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 120
width: 180
} ,
isTableForm:false
},
{ label: '备注', field: 'remark', sort: 'custom', isTable: false,isTableForm:false},
{ label: '创建者ID', field: 'creator', sort: 'custom', isTable: false, isForm: false,isTableForm:false },
{
label: '创建者',
field: 'creator',
isForm: false,
isTable: false
},
{ label: '备注', field: 'remark', sort: 'custom', isTable: false},
{
label: '操作',
field: 'action',
@ -394,7 +392,6 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: 150
},
isTableForm:false
}
]))
@ -479,6 +476,7 @@ export const Itempackaging = useCrudSchemas(reactive<CrudSchema[]>([
label: '物品代码',
field: 'itemCode',
sort: 'custom',
isSearch: true,
table: {
width: 150
}
@ -511,8 +509,12 @@ export const Itempackaging = useCrudSchemas(reactive<CrudSchema[]>([
label: '包装数量',
field: 'stdPackQty',
sort: 'custom',
isSearch: true,
table: {
width: 120
},
form: {
component: 'InputNumber',
}
},
{
@ -521,7 +523,6 @@ export const Itempackaging = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.PACK_UNIT,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 150
@ -533,6 +534,9 @@ export const Itempackaging = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
table: {
width: 120
},
form: {
component: 'InputNumber',
}
},
{
@ -541,7 +545,6 @@ export const Itempackaging = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.PACK_UNIT,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 150
@ -553,6 +556,9 @@ export const Itempackaging = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
table: {
width: 120
},
form: {
component: 'InputNumber',
}
},
{
@ -561,7 +567,6 @@ export const Itempackaging = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.PACK_UNIT,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 150
@ -573,6 +578,9 @@ export const Itempackaging = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
table: {
width: 120
},
form: {
component: 'InputNumber',
}
},
{
@ -591,6 +599,9 @@ export const Itempackaging = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
table: {
width: 120
},
form: {
component: 'InputNumber',
}
},
{
@ -613,7 +624,13 @@ export const Itempackaging = useCrudSchemas(reactive<CrudSchema[]>([
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 120
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
}
}
},
{
@ -626,34 +643,40 @@ export const Itempackaging = useCrudSchemas(reactive<CrudSchema[]>([
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 120
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
}
}
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
isForm: false,
isTable: true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 120
width: 180
}
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
table: {
width: 120
}
isForm: false,
isTable: false
},
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 150
}
@ -676,6 +699,7 @@ export const Bom = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '父物料代码',
field: 'productItemCode',
isSearch: true,
table: {
width: 150
}
@ -683,6 +707,7 @@ export const Bom = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '子物料代码',
field: 'componentItemCode',
isSearch: true,
table: {
width: 150
}
@ -697,7 +722,11 @@ export const Bom = useCrudSchemas(reactive<CrudSchema[]>([
},
{
label: '子物料数量',
field: 'componentQty'
field: 'componentQty',
isSearch: true,
form: {
component: 'InputNumber',
}
},
{
label: '工序代码',
@ -709,13 +738,14 @@ export const Bom = useCrudSchemas(reactive<CrudSchema[]>([
},
{
label: '层级',
field: 'layer'
},
{
label: '是否可用',
field : 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string'
field: 'layer',
// form: {
// component: 'Input',
// componentProps: {
// // focus: ()=>{console.log('111111111111111111111')},
// modelValue: '11111'
// }
// }
},
{
label: '生效时间',
@ -724,6 +754,15 @@ export const Bom = useCrudSchemas(reactive<CrudSchema[]>([
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
}
}
},
{
@ -733,6 +772,33 @@ export const Bom = useCrudSchemas(reactive<CrudSchema[]>([
formatter : dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
}
}
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
table: {
width: 120
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
@ -745,8 +811,13 @@ export const Bom = useCrudSchemas(reactive<CrudSchema[]>([
dateFormat: 'YYYY-MM-DD HH:mm:ss'
}
},
{
label: '创建者',
field: 'creator',
isForm: false,
isTable: false
},
{ label: '备注', field: 'remark', isTable: false },
{ label: '创建者ID', field: 'creator', isTable: false, isForm: false },
{
label: '操作',
field: 'action',
@ -787,6 +858,7 @@ export const Stdcostprice = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '供应商代码',
field: 'supplierCode',
isSearch: true,
table: {
width: 150
}
@ -794,6 +866,7 @@ export const Stdcostprice = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '物料代码',
field: 'itemCode',
isSearch: true,
table: {
width: 150
}
@ -808,15 +881,26 @@ export const Stdcostprice = useCrudSchemas(reactive<CrudSchema[]>([
},
{
label: '价格',
field: 'price'
field: 'price',
isSearch: true
},
{
label: '是否可用',
field: 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true
isTable: true,
table: {
width: 120
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '生效时间',
@ -825,6 +909,15 @@ export const Stdcostprice = useCrudSchemas(reactive<CrudSchema[]>([
formatter : dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
}
}
},
{
@ -834,23 +927,36 @@ export const Stdcostprice = useCrudSchemas(reactive<CrudSchema[]>([
formatter : dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
}
},
{
label: '创建者',
field: 'creator'
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
}
}
},
{
label: '创建时间',
field: 'createTime',
isForm: false,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
}
},
{
label: '创建者',
field: 'creator',
isForm: false,
isTable: false
},
{
label: '备注',
field: 'remark'
field: 'remark',
isTable: false
},
{
label: '操作',
@ -889,6 +995,7 @@ export const Productionlineitem = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '完工收货库位',
field: 'fgLocationCode',
isSearch: true,
table: {
width: 150
}
@ -896,6 +1003,7 @@ export const Productionlineitem = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '产线代码' ,
field: 'productionLineCode',
isSearch: true,
table: {
width: 150
}
@ -903,6 +1011,7 @@ export const Productionlineitem = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '物品代码',
field: 'itemCode',
isSearch: true,
table: {
width: 150
}
@ -913,7 +1022,18 @@ export const Productionlineitem = useCrudSchemas(reactive<CrudSchema[]>([
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true
isTable: true,
table: {
width: 120
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '生效时间',
@ -921,6 +1041,15 @@ export const Productionlineitem = useCrudSchemas(reactive<CrudSchema[]>([
formatter : dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
}
}
},
{
@ -929,15 +1058,26 @@ export const Productionlineitem = useCrudSchemas(reactive<CrudSchema[]>([
formatter : dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
}
}
},
{
label:'备注',
field: 'remark'
field: 'remark',
isTable: false
},
{
label: '创建时间',
field: 'createTime',
isForm: false,
formatter: dateFormatter,
detail: {
dateFormat : 'YYYY-MM-DD HH:mm:ss'
@ -945,7 +1085,9 @@ export const Productionlineitem = useCrudSchemas(reactive<CrudSchema[]>([
},
{
label: '创建者',
field: 'creator'
field: 'creator',
isForm: false,
isTable: false
},
{
label: '操作',

202
src/views/wms/bom/BomForm.vue

@ -1,202 +0,0 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<div class="p-20px m--10px" style="max-height: 600px;overflow-y: auto;">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-row>
<el-col :span="12">
<el-form-item label="父物料代码" prop="productItemCode">
<el-input v-model="formData.productItemCode" placeholder="请输入父物料代码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="子物料代码" prop="componentItemCode">
<el-input v-model="formData.componentItemCode" placeholder="请输入子物料代码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="子物料计量单位" prop="componentUom">
<el-select v-model="formData.componentUom" placeholder="请选择子物料计量单位">
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.UOM)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="子物料数量" prop="componentQty">
<el-input v-model="formData.componentQty" placeholder="请输入子物料数量" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工序代码" prop="processCode">
<el-input v-model="formData.processCode" placeholder="请输入工序代码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="版本" prop="version">
<el-input v-model="formData.version" placeholder="请输入版本" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="层级" prop="layer">
<el-input v-model="formData.layer" placeholder="请输入层级" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否可用" prop="available">
<el-select v-model="formData.available" placeholder="请选择是否可用">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.TRUE_FALSE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="生效时间" prop="activeTime">
<el-date-picker
v-model="formData.activeTime"
type="date"
value-format="x"
placeholder="选择生效时间"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="失效时间" prop="expireTime">
<el-date-picker
v-model="formData.expireTime"
type="date"
value-format="x"
placeholder="选择失效时间"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict'
import * as BomApi from '@/api/wms/bom'
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
productItemCode: undefined,
componentItemCode: undefined,
componentUom: undefined,
componentQty: undefined,
processCode: undefined,
version: undefined,
layer: undefined,
available: undefined,
activeTime: undefined,
expireTime: undefined,
remark: undefined
})
const formRules = reactive({
productItemCode: [{ required: true, message: '父物料代码不能为空', trigger: 'blur' }],
componentItemCode: [{ required: true, message: '子物料代码不能为空', trigger: 'blur' }],
componentUom: [{ required: true, message: '子物料计量单位不能为空', trigger: 'change' }],
componentQty: [{ required: true, message: '子物料数量不能为空', trigger: 'blur' }],
processCode: [{ required: true, message: '工序代码不能为空', trigger: 'blur' }],
available: [{ required: true, message: '是否可用不能为空', trigger: 'change' }]
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await BomApi.getBom(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
if (!formRef) return
const valid = await formRef.value.validate()
if (!valid) return
//
formLoading.value = true
try {
const data = formData.value as unknown as BomApi.BomVO
if (formType.value === 'create') {
await BomApi.createBom(data)
message.success(t('common.createSuccess'))
} else {
await BomApi.updateBom(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
productItemCode: undefined,
componentItemCode: undefined,
componentUom: undefined,
componentQty: undefined,
processCode: undefined,
version: undefined,
layer: undefined,
available: undefined,
activeTime: undefined,
expireTime: undefined,
remark: undefined
}
formRef.value?.resetFields()
}
</script>

430
src/views/wms/bom/index.vue

@ -1,305 +1,177 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="父物料代码" prop="productItemCode">
<el-input
v-model="queryParams.productItemCode"
placeholder="请输入父物料代码"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="子物料代码" prop="componentItemCode">
<el-input
v-model="queryParams.componentItemCode"
placeholder="请输入子物料代码"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="子物料计量单位" prop="componentUom">
<el-select
v-model="queryParams.componentUom"
placeholder="请选择子物料计量单位"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.UOM)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="子物料数量" prop="componentQty">
<el-input
v-model="queryParams.componentQty"
placeholder="请输入子物料数量"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="工序代码" prop="processCode">
<el-input
v-model="queryParams.processCode"
placeholder="请输入工序代码"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="版本" prop="version">
<el-input
v-model="queryParams.version"
placeholder="请输入版本"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="层级" prop="layer">
<el-input
v-model="queryParams.layer"
placeholder="请输入层级"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="是否可用" prop="available">
<el-select
v-model="queryParams.available"
placeholder="请选择是否可用"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.TRUE_FALSE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="生效时间" prop="activeTime">
<el-date-picker
v-model="queryParams.activeTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="失效时间" prop="expireTime">
<el-date-picker
v-model="queryParams.expireTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
v-model="queryParams.remark"
placeholder="请输入备注"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="创建者ID" prop="creator">
<el-input
v-model="queryParams.creator"
placeholder="请输入创建者ID"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item>
<el-button type="info" plain @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button type="info" plain @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<el-button type="primary" @click="openForm('create')" v-hasPermi="['wms:bom:create']">
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['wms:bom:export']"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
</el-form-item>
</el-form>
<Search :schema="Bom.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" />
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="父物料代码" align="center" prop="productItemCode" width="150px" />
<el-table-column label="子物料代码" align="center" prop="componentItemCode" width="150px" />
<el-table-column label="子物料计量单位" align="center" prop="componentUom" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.UOM" :value="scope.row.componentUom" />
</template>
</el-table-column>
<el-table-column label="子物料数量" align="center" prop="componentQty" width="150px" />
<el-table-column label="工序代码" align="center" prop="processCode" width="150px" />
<el-table-column label="版本" align="center" prop="version" width="150px" />
<el-table-column label="层级" align="center" prop="layer" width="150px" />
<el-table-column label="是否可用" align="center" prop="available" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TRUE_FALSE" :value="scope.row.available" />
</template>
</el-table-column>
<el-table-column
label="生效时间"
align="center"
prop="activeTime"
:formatter="dateFormatter"
width="150px"
/>
<el-table-column
label="失效时间"
align="center"
prop="expireTime"
:formatter="dateFormatter"
width="150px"
/>
<el-table-column label="备注" align="center" prop="remark" width="150px" />
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="150px"
/>
<el-table-column label="创建者ID" align="center" prop="creator" width="150px" />
<el-table-column label="操作" align="center" width="150px" fixed="right">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['wms:bom:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['wms:bom:delete']"
<Table
:columns="Bom.allSchemas.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 #productItemCode="{row}">
<el-button type="primary" link @click="openDetail(row, '物料代码', row.productItemCode)">
<span>{{ row.productItemCode }}</span>
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BomForm ref="formRef" @success="getList" />
<BasicForm
ref="basicFormRef"
@success="getList"
:rules="BomRules"
:formAllSchemas="Bom.allSchemas"
:searchTableParams="searchTableParams"
:apiUpdate="BomApi.updateBom"
:apiCreate="BomApi.createBom"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
>
<template #productItemCode="form">
<div class="w-[100%] flex">
<el-input v-model="form['productItemCode']" :placeholder="'fffffffff'" @click="opensearchTable('productItemCode', 'code')" />
</div>
</template>
</BasicForm>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="Bom.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/bom/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import * as BomApi from '@/api/wms/bom'
import BomForm from './BomForm.vue'
import * as ItembasicApi from '@/api/wms/itembasic'
import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import { Bom, BomRules, ItemBasic } from '@/utils/disposition/tableColumns'
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: 'Bom' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const total = ref(0) //
const list = ref([]) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
productItemCode: null,
componentItemCode: null,
componentUom: null,
componentQty: null,
processCode: null,
version: null,
layer: null,
available: null,
activeTime: [],
expireTime: [],
remark: null,
createTime: [],
creator: null
//
const searchTableParams = ref([{
formField: 'productItemCode',
searchTableTitle: '物料信息',
searchTableAllSchemas: ItemBasic.allSchemas,
searchTablePage: ItembasicApi.getItembasicPage
},{
formField: 'componentItemCode',
searchTableTitle: '物料信息',
searchTableAllSchemas: ItemBasic.allSchemas,
searchTablePage: ItembasicApi.getItembasicPage
}])
const { tableObject, tableMethods } = useTable({
getListApi: BomApi.getBomPage //
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await BomApi.getBomPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:bom:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:bom:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:bom:export'}), //
// defaultButtons.defaultFilterBtn(), //
defaultButtons.defaultFreshBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
//
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 resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:bom:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:bom:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
// const res = await BomApi.getItempackaging(row.id)
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
const form = ref()
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
const opensearchTable = (formField, searchField) => {
form.value = basicFormRef.value.formRef
basicFormRef.value.opensearchTable(formField, searchField)
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
console.log(144, formField)
console.log(145, searchField)
console.log(146, val)
console.log(147, formRef)
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue)
}
/** 删除按钮操作 */
@ -316,20 +188,36 @@ const handleDelete = async (id: number) => {
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await BomApi.exportBom(queryParams)
download.excel(data, '物料清单.xls')
const data = await BomApi.exportBom(setSearchParams)
download.excel(data, '物品清单信息 .xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '物品清单信息导入模版.xls'
})
//
const importSuccess = () => {
getList()
}
/** 初始化 **/
onMounted(() => {
getList()

176
src/views/wms/itembasic/ItembasicDetail.vue

@ -1,176 +0,0 @@
<template>
<ContentWrap>
<div class="font-size-18px">
{{ detailData.code }} <span class="ml-20px font-size-16px">{{ detailData.name }}</span>
</div>
</ContentWrap>
<Tabs :tabsList="tabsList" :current="current" @change="change" />
<div class="flex" v-if="current == 0">
<!-- 详情 -->
<ContentWrap class="w-[73%]">
<Descriptions :data="detailData" :schema="ItemBasic.allSchemas.detailSchema" :columns="2" />
</ContentWrap>
<ContentWrap class="w-[27%] ml-16px">
<!-- 附件组件 -->
<Annex :data="annexData" @handleImport="handleImport" @deleteAnnex="deleteAnnexSuccess" />
<!-- 备注组件 -->
<Remarks :data="remarksData" class="mt-20px" @submitSucss="remarksSubmitSucss" />
<!-- 变更记录组件 -->
<ChangeRecord :data="changeRecordData" class="mt-20px" />
</ContentWrap>
<!-- 用户导入对话框 -->
<ImportForm ref="importFormRef" :importTemplateData="importTemplateData" @success="importSuccess" />
</div>
<ContentWrap v-else>
<Table :columns="ItemBasic.allSchemas.tableColumns" :data="tableObject.tableList" :loading="tableObject.loading"
:pagination="{
total: tableObject.total
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage" />
</ContentWrap>
</template>
<script lang="ts" setup>
defineOptions({ name: 'Detail' })
import Annex from '@/components/Annex/src/Annex.vue'
import Remarks from '@/components/Remarks/src/Remarks.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import ChangeRecord from '@/components/ChangeRecord/src/ChangeRecord.vue'
import Tabs from '@/components/Tabs/src/Tabs.vue'
import { ItemBasic } from '@/utils/disposition/tableColumns.ts'
import { ItemBasicTabsList } from '@/utils/disposition/tabsList.ts'
import { getItembasic } from '@/api/wms/itembasic'
const { query } = useRoute() //
import * as ItembasicApi from '@/api/wms/itembasic'
const tabsList = ref(JSON.parse(JSON.stringify(ItemBasicTabsList)))
tabsList.value.unshift({
label: '详情',
prop: 'Detail'
})
//
const queryParams = reactive({
title: '',
name: undefined,
status: undefined,
pageNo: 1,
pageSize: 100
})
const queryFormRef = ref() //
// const formLabel = ref(ItemBasic)//formlabel
//
const annexData = reactive({
annexList: [{
title: '文件名文件名2023-12-12.docx',
size: '150.02KB',
people: '贾先生',
time: '2023年5月6日 17:16:00',
}, {
title: '文件名文件名2023-12-15.docx',
size: '242KB',
people: '张张',
time: '2022年12月12日 17:16:00',
}]
})
//
const remarksData = reactive({
remarksList: [{
name: '诸葛亮',
text: '转朱阁,低绮户,照无眠。不应有恨,何事长向别时圆?人有悲欢离合,月有阴晴圆缺,此事古难全。但愿人长久,千里共婵娟。',
time: '2023年5月6日 17:16:00',
}, {
name: '刘备',
text: '转朱阁,低绮户,照无眠。不应有恨,何事长向别时圆?人有悲欢离合,月有阴晴圆缺,此事古难全。但愿人长久,千里共婵娟。',
time: '2022年12月12日 17:16:00',
}]
})
//
const changeRecordData = reactive({
changeRecordList: [{
name: '诸葛亮',
type: 1,
time: '2023年5月6日 17:16:00',
}, {
name: '刘备',
type: 2,
time: '2023年5月6日 17:16:00',
}, {
name: '曹操',
type: 3,
time: '2023年5月6日 17:16:00',
file: [{
name: '这是个附件的名字.docx',
url: 'http://localhost:12080//wms/itembasic/get-import-template'
}, {
name: '这是个附件的名字.docx',
url: 'http://localhost:12080/wms/itembasic/get-import-template'
}]
}]
})
const detailData = ref("")//
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '导入模版99.xls'
})
onMounted(async () => {
//
detailData.value = await getItembasic(query.id)
importTemplateData.templateUrl = await ItembasicApi.importTemplate()
})
//
const importSuccess = () => {
}
/** 搜索按钮操作 */
const handleQuery = () => {
importFormRef.value.open()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryParams.pageNo = 1
queryFormRef.value.resetFields()
}
/** 用户导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const deleteAnnexSuccess = async () => {
console.log('删除成功');
}
//
const remarksSubmitSucss = () => {
console.log('提交成功');
}
//
// const supplierItems = reactive({
// supplierItemsList: [{
// code: '646456',
// name: '978978'
// }],
// total: 20,
// pageSize: 1,
// currentPage: 2
// })
const current = ref(0)
//
const { tableObject, tableMethods } = useTable({
getListApi: ItembasicApi.getItembasicPage //
})
const change = (item, index) => {
current.value = index
}
//
const { getList, setSearchParams } = tableMethods
getList()
</script>

156
src/views/wms/itembasic/ItembasicForm.vue

@ -1,156 +0,0 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<div class="p-20px m--10px" style="max-height: 500px;overflow-y: auto;">
<Form ref="formRef" v-loading="formLoading" :rules="ItemBasicRules" :schema="ItemBasic.allSchemas.formSchema"
:model="formData" :is-col="true" />
<div class="table">
<TableForm ref="tableFormRef" :tableFields="PurchaseclaimRequestMain.allSchemas.tableFormColumns" :tableData="tableData" class="w-[100%]" @handleAdd="handleAdd" :tableFormRules="ItemBasicRules" @handleDelete="handleDelete" @inpuFocus="inpuFocus"/>
</div>
</div>
<template #footer>
<!-- 列表头部 -->
<TableHead :HeadButttondata="Butttondata" @buttonBaseClick="buttonBaseClick" />
</template>
</Dialog>
</template>
<script setup lang="ts">
import * as ItembasicApi from '@/api/wms/itembasic'
import { ItemBasic, ItemBasicRules, PurchaseclaimRequestMain } from '@/utils/disposition/tableColumns.ts'
import TableForm from '@/components/TableForm/src/TableForm.vue'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formData = ref('')
const formType = ref('') // create - update -
const formRef = ref() // Ref
const tableFormRef = ref()
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
const data = await ItembasicApi.getItembasic(id)
formRef.value.setValues(data)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
if (!formRef) return
const valid = await formRef.value.validate()
if (!valid) return
//
formLoading.value = true
try {
const data = formData.value as unknown as ItembasicApi.ItembasicVO
if (formType.value === 'create') {
await ItembasicApi.createItembasic(data)
message.success(t('common.createSuccess'))
} else {
await ItembasicApi.updateItembasic(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
code: undefined,
name: undefined,
desc1: undefined,
desc2: undefined,
status: undefined,
uom: undefined,
altUom: undefined,
isStdPack: undefined,
enableBuy: undefined,
enableMake: undefined,
enableOutsourcing: undefined,
isRecycled: undefined,
isPhantom: undefined,
abcClass: undefined,
type: undefined,
category: undefined,
itemGroup: undefined,
color: undefined,
configuration: undefined,
project: undefined,
eqLevel: undefined,
validityDays: undefined,
available: undefined,
activeTime: undefined,
expireTime: undefined,
remark: undefined
}
formRef.value?.resetFields()
}
//
const Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null), //
]
//
const buttonBaseClick = (val, item) => {
//
if (val == 'save') {
tableFormRef.value.validateForm()
}
//
else if (val == 'close') {
dialogVisible.value = false
}
}
const tableFormKeys ={}
PurchaseclaimRequestMain.allSchemas.tableFormColumns.forEach(item=>{
tableFormKeys[item.field]=item.default? item.default:''
})
const tableData = ref([])
//
const handleAdd = ()=>{
tableData.value.push(tableFormKeys)
}
//
const handleDelete =(item,index)=>{
tableData.value.splice(index,1)
}
// input
const inpuFocus = () => {
console.log(1);
}
</script>
<style scoped>
.table {
border: 1px solid #dedede;
border-radius: 8px;
padding: 10px;
display: flex;
}
</style>

133
src/views/wms/itembasic/ItembasicImportForm.vue

@ -1,133 +0,0 @@
<template>
<Dialog v-model="dialogVisible" title="物品基本信息导入" width="400">
<el-upload
ref="uploadRef"
v-model:file-list="fileList"
:action="importUrl + '?updateSupport=' + updateSupport"
:auto-upload="false"
:disabled="formLoading"
:headers="uploadHeaders"
:limit="1"
:on-error="submitFormError"
:on-exceed="handleExceed"
:on-success="submitFormSuccess"
accept=".xlsx, .xls"
drag
>
<Icon icon="ep:upload" />
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<template #tip>
<div class="el-upload__tip text-center">
<div class="el-upload__tip">
<el-checkbox v-model="updateSupport" />
是否更新已经存在的物品基本信息数据
</div>
<span>仅允许导入 xlsxlsx 格式文件</span>
<el-link
:underline="false"
style="font-size: 12px; vertical-align: baseline"
type="primary"
@click="importTemplate"
>
下载模板
</el-link>
</div>
</template>
</el-upload>
<template #footer>
<el-button :disabled="formLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script lang="ts" setup>
import * as ItembasicApi from '@/api/wms/itembasic'
import { getAccessToken, getTenantId } from '@/utils/auth'
import download from '@/utils/download'
defineOptions({ name: 'WmsItembasicImportForm' })
const message = useMessage() //
const dialogVisible = ref(false) //
const formLoading = ref(false) //
const uploadRef = ref()
const importUrl =
import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/wms/itembasic/import'
const uploadHeaders = ref() // Header
const fileList = ref([]) //
const updateSupport = ref(0) //
/** 打开弹窗 */
const open = () => {
dialogVisible.value = true
resetForm()
}
defineExpose({ open }) // open
/** 提交表单 */
const submitForm = async () => {
if (fileList.value.length == 0) {
message.error('请上传文件')
return
}
//
uploadHeaders.value = {
Authorization: 'Bearer ' + getAccessToken(),
'tenant-id': getTenantId()
}
formLoading.value = true
uploadRef.value!.submit()
}
/** 文件上传成功 */
const emits = defineEmits(['success'])
const submitFormSuccess = (response: any) => {
if (response.code !== 0) {
message.error(response.msg)
formLoading.value = false
return
}
//
const data = response.data
let text = '上传成功数量:' + data.createUsernames.length + ';'
for (let username of data.createUsernames) {
text += '< ' + username + ' >'
}
text += '更新成功数量:' + data.updateUsernames.length + ';'
for (const username of data.updateUsernames) {
text += '< ' + username + ' >'
}
text += '更新失败数量:' + Object.keys(data.failureUsernames).length + ';'
for (const username in data.failureUsernames) {
text += '< ' + username + ': ' + data.failureUsernames[username] + ' >'
}
message.alert(text)
//
emits('success')
}
/** 上传错误提示 */
const submitFormError = (): void => {
message.error('上传失败,请您重新上传!')
formLoading.value = false
}
/** 重置表单 */
const resetForm = () => {
//
formLoading.value = false
uploadRef.value?.clearFiles()
}
/** 文件数超出提示 */
const handleExceed = (): void => {
message.error('最多只能上传一个文件!')
}
/** 下载模板操作 */
const importTemplate = async () => {
const res = await ItembasicApi.importUserTemplate()
download.excel(res, '物品基本信息导入模版.xls')
}
</script>

26
src/views/wms/itembasic/index.vue

@ -5,7 +5,7 @@
</ContentWrap>
<!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @buttonBaseClick="buttonBaseClick" />
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" />
<!-- 列表 -->
<ContentWrap>
@ -28,21 +28,29 @@
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<ItembasicForm ref="formRef" @success="getList" />
<!-- 导入 -->
<ImportForm ref="importFormRef" :url="ItembasicApi.importUrl" :importTemplateData="importTemplateData"
@success="importSuccess" />
<BasicForm
ref="basicFormRef"
@success="getList"
:rules="ItemBasicRules"
:formAllSchemas="ItemBasic.allSchemas"
:apiUpdate="ItembasicApi.updateItembasic"
:apiCreate="ItembasicApi.createItembasic"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :tabs="ItemBasicTabsList" :isBasic="true" :allSchemas="ItemBasic.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" :url="ItembasicApi.importUrl" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import * as ItembasicApi from '@/api/wms/itembasic'
import ItembasicForm from './ItembasicForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import { ItemBasic } from '@/utils/disposition/tableColumns'
import { ItemBasic, ItemBasicRules } from '@/utils/disposition/tableColumns'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { ItemBasicTabsList } from '@/utils/disposition/tabsList'
@ -128,9 +136,9 @@ const importSuccess = () => {
getList()
}
/** 添加/修改操作 */
const formRef = ref()
const basicFormRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
basicFormRef.value.open(type, id)
}
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {

48
src/views/wms/itempackaging/index.vue

@ -37,16 +37,11 @@
@success="getList"
:rules="ItempackagingRules"
:formAllSchemas="Itempackaging.allSchemas"
:tableAllSchemas="PurchaseclaimRequestDetail.allSchemas"
:tableFormRules="PurchaseclaimRequestDetailRules"
:tableData="tableData"
searchTableTitle="物料基础信息"
:searchTableAllSchemas="ItemBasic.allSchemas"
:searchTablePage="ItembasicApi.getItembasicPage"
:searchTableParams="searchTableParams"
:apiUpdate="ItempackagingApi.updateItempackaging"
:apiCreate="ItempackagingApi.createItempackaging"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
@ -61,18 +56,25 @@ import download from '@/utils/download'
import * as ItempackagingApi from '@/api/wms/itempackaging'
import * as ItembasicApi from '@/api/wms/itembasic'
import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import { Itempackaging, ItempackagingRules, ItemBasic, PurchaseclaimRequestDetail,PurchaseclaimRequestDetailRules } from '@/utils/disposition/tableColumns'
import { Itempackaging, ItempackagingRules, ItemBasic } from '@/utils/disposition/tableColumns'
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: 'Itempackaging' })
console.log(PurchaseclaimRequestDetail.allSchemas);
const message = useMessage() //
const { t } = useI18n() //
//
const searchTableParams = ref([{
formField: 'itemCode',
searchTableTitle: '物料信息',
searchTableAllSchemas: ItemBasic.allSchemas,
searchTablePage: ItembasicApi.getItembasicPage
}])
const { tableObject, tableMethods } = useTable({
getListApi: ItempackagingApi.getItempackagingPage //
})
@ -135,6 +137,15 @@ const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
@ -184,23 +195,6 @@ const importTemplateData = reactive({
const importSuccess = () => {
getList()
}
/**
* tableForm方法
*/
const tableFormKeys = {}
PurchaseclaimRequestDetail.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
//
const handleAddTable = () => {
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
console.log(tableData.value)
}
//
const handleDeleteTable = (item, index) => {
tableData.value.splice(index, 1)
}
/** 初始化 **/
onMounted(() => {

162
src/views/wms/productionlineitem/ProductionlineitemForm.vue

@ -1,162 +0,0 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<div class="p-20px m--10px" style="max-height: 600px;overflow-y: auto;">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-row>
<el-col :span="12">
<el-form-item label="完工收货库位" prop="fgLocationCode">
<el-input v-model="formData.fgLocationCode" placeholder="请输入完工收货库位" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="产线代码" prop="productionLineCode">
<el-input v-model="formData.productionLineCode" placeholder="请输入产线代码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物品代码" prop="itemCode">
<el-input v-model="formData.itemCode" placeholder="请输入物品代码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否可用" prop="available">
<el-select v-model="formData.available" placeholder="请选择是否可用">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.TRUE_FALSE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="生效时间" prop="activeTime">
<el-date-picker
v-model="formData.activeTime"
type="date"
value-format="x"
placeholder="选择生效时间"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="失效时间" prop="expireTime">
<el-date-picker
v-model="formData.expireTime"
type="date"
value-format="x"
placeholder="选择失效时间"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import * as ProductionlineitemApi from '@/api/wms/productionlineitem'
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
fgLocationCode: undefined,
productionLineCode: undefined,
itemCode: undefined,
available: undefined,
activeTime: undefined,
expireTime: undefined,
remark: undefined
})
const formRules = reactive({
fgLocationCode: [{ required: true, message: '完工收货库位不能为空', trigger: 'blur' }],
productionLineCode: [{ required: true, message: '产线代码不能为空', trigger: 'blur' }],
itemCode: [{ required: true, message: '物品代码不能为空', trigger: 'blur' }],
available: [{ required: true, message: '是否可用不能为空', trigger: 'change' }]
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await ProductionlineitemApi.getProductionlineitem(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
if (!formRef) return
const valid = await formRef.value.validate()
if (!valid) return
//
formLoading.value = true
try {
const data = formData.value as unknown as ProductionlineitemApi.ProductionlineitemVO
if (formType.value === 'create') {
await ProductionlineitemApi.createProductionlineitem(data)
message.success(t('common.createSuccess'))
} else {
await ProductionlineitemApi.updateProductionlineitem(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
fgLocationCode: undefined,
productionLineCode: undefined,
itemCode: undefined,
available: undefined,
activeTime: undefined,
expireTime: undefined,
remark: undefined
}
formRef.value?.resetFields()
}
</script>

43
src/views/wms/productionlineitem/index.vue

@ -43,6 +43,18 @@
:apiUpdate="ProductionlineitemApi.updateProductionlineitem"
:apiCreate="ProductionlineitemApi.createProductionlineitem"
/>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="getList"
:rules="ProductionlineitemRules"
:formAllSchemas="Productionlineitem.allSchemas"
:searchTableParams="searchTableParams"
:apiUpdate="ProductionlineitemApi.updateProductionlineitem"
:apiCreate="ProductionlineitemApi.createProductionlineitem"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="Productionlineitem.allSchemas" />
@ -53,10 +65,12 @@
<script setup lang="ts">
import download from '@/utils/download'
import * as LocationApi from '@/api/wms/location'
import * as ProductionlineitemApi from '@/api/wms/productionlineitem'
import * as ItembasicApi from '@/api/wms/itembasic'
import * as ProductionLineCodeApi from '@/api/wms/productionline'
import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import { Productionlineitem, ProductionlineitemRules, ItemBasic } from '@/utils/disposition/tableColumns'
import { Productionlineitem, ProductionlineitemRules, ItemBasic, Productionline, Location } from '@/utils/disposition/tableColumns'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
@ -67,6 +81,24 @@ defineOptions({ name: 'Productionlineitem' })
const message = useMessage() //
const { t } = useI18n() //
//
const searchTableParams = ref([{
formField: 'fgLocationCode',
searchTableTitle: '库位信息',
searchTableAllSchemas: Location.allSchemas,
searchTablePage: LocationApi.getLocationPage
},{
formField: 'itemCode',
searchTableTitle: '物料信息',
searchTableAllSchemas: ItemBasic.allSchemas,
searchTablePage: ItembasicApi.getItembasicPage
},{
formField: 'productionLineCode',
searchTableTitle: '生产线信息',
searchTableAllSchemas: Productionline.allSchemas,
searchTablePage: ProductionLineCodeApi.getProductionlinePage
}])
const { tableObject, tableMethods } = useTable({
getListApi: ProductionlineitemApi.getProductionlineitemPage //
})
@ -129,6 +161,15 @@ const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {

177
src/views/wms/stdcostprice/StdcostpriceForm.vue

@ -1,177 +0,0 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<div class="p-20px m--10px" style="max-height: 600px;overflow-y: auto;">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-row>
<el-col :span="12">
<el-form-item label="供应商代码" prop="supplierCode">
<el-input v-model="formData.supplierCode" placeholder="请输入供应商代码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料代码" prop="itemCode">
<el-input v-model="formData.itemCode" placeholder="请输入物料代码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="货币" prop="currency">
<el-select v-model="formData.currency" placeholder="请选择货币">
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.CURRENCY)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="价格" prop="price">
<el-input v-model="formData.price" placeholder="请输入价格" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否可用" prop="available">
<el-select v-model="formData.available" placeholder="请选择是否可用">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.TRUE_FALSE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="生效时间" prop="activeTime">
<el-date-picker
v-model="formData.activeTime"
type="date"
value-format="x"
placeholder="选择生效时间"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="失效时间" prop="expireTime">
<el-date-picker
v-model="formData.expireTime"
type="date"
value-format="x"
placeholder="选择失效时间"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict'
import * as StdcostpriceApi from '@/api/wms/stdcostprice'
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
supplierCode: undefined,
itemCode: undefined,
currency: undefined,
price: undefined,
available: undefined,
activeTime: undefined,
expireTime: undefined,
remark: undefined
})
const formRules = reactive({
supplierCode: [{ required: true, message: '供应商代码不能为空', trigger: 'blur' }],
itemCode: [{ required: true, message: '物料代码不能为空', trigger: 'blur' }],
currency: [{ required: true, message: '货币不能为空', trigger: 'change' }],
price: [{ required: true, message: '价格不能为空', trigger: 'blur' }],
available: [{ required: true, message: '是否可用不能为空', trigger: 'change' }]
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await StdcostpriceApi.getStdcostprice(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
if (!formRef) return
const valid = await formRef.value.validate()
if (!valid) return
//
formLoading.value = true
try {
const data = formData.value as unknown as StdcostpriceApi.StdcostpriceVO
if (formType.value === 'create') {
await StdcostpriceApi.createStdcostprice(data)
message.success(t('common.createSuccess'))
} else {
await StdcostpriceApi.updateStdcostprice(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
supplierCode: undefined,
itemCode: undefined,
currency: undefined,
price: undefined,
available: undefined,
activeTime: undefined,
expireTime: undefined,
remark: undefined
}
formRef.value?.resetFields()
}
</script>

31
src/views/wms/stdcostprice/index.vue

@ -37,11 +37,11 @@
@success="getList"
:rules="StdcostpriceRules"
:formAllSchemas="Stdcostprice.allSchemas"
searchTableTitle="物料基础信息"
:searchTableAllSchemas="ItemBasic.allSchemas"
:searchTablePage="ItembasicApi.getItembasicPage"
:searchTableParams="searchTableParams"
:apiUpdate="StdcostpriceApi.updateStdcostprice"
:apiCreate="StdcostpriceApi.createStdcostprice"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
@ -54,9 +54,10 @@
<script setup lang="ts">
import download from '@/utils/download'
import * as StdcostpriceApi from '@/api/wms/stdcostprice'
import * as SupplierApi from '@/api/wms/supplier'
import * as ItembasicApi from '@/api/wms/itembasic'
import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import { Stdcostprice, StdcostpriceRules, ItemBasic } from '@/utils/disposition/tableColumns'
import { Stdcostprice, StdcostpriceRules, Supplier, ItemBasic } from '@/utils/disposition/tableColumns'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
@ -67,6 +68,19 @@ defineOptions({ name: 'Stdcostprice' })
const message = useMessage() //
const { t } = useI18n() //
//
const searchTableParams = ref([{
formField: 'supplierCode',
searchTableTitle: '供应商信息',
searchTableAllSchemas: Supplier.allSchemas,
searchTablePage: SupplierApi.getSupplierPage
},{
formField: 'itemCode',
searchTableTitle: '物料信息',
searchTableAllSchemas: ItemBasic.allSchemas,
searchTablePage: ItembasicApi.getItembasicPage
}])
const { tableObject, tableMethods } = useTable({
getListApi: StdcostpriceApi.getStdcostpricePage //
})
@ -129,6 +143,15 @@ const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {

Loading…
Cancel
Save