陈薪名 1 year ago
parent
commit
d333f98995
  1. 131
      src/components/BasicForm/src/BasicForm.vue
  2. 57
      src/views/wms/countManage/count/countPlanMain/index.vue

131
src/components/BasicForm/src/BasicForm.vue

@ -1,25 +1,36 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible" :width="isBusiness?'60%':'40%'">
<Form
ref="formRef"
v-loading="formLoading"
:rules="rules"
:schema="formSchema"
<Dialog :title="dialogTitle" v-model="dialogVisible" :width="isBusiness ? '60%' : '40%'">
<Form
ref="formRef"
v-loading="formLoading"
:rules="rules"
:schema="formSchema"
:is-col="true"
@opensearchTable="opensearchTable"
>
<template #crontab="formSchema">
<crontab v-model="formSchema.crontab" />
</template>
<template #crontab="formSchema">
<crontab v-model="formSchema.crontab" />
</template>
<template #type="formSchema">
<el-select v-model="formSchema.type" placeholder="选择盘点类型" @change="selectChange('type',$event)">
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.COUNT_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</template>
</Form>
<div class="table" v-if="isBusiness && formType == 'create'">
<TableForm ref="tableFormRef"
class="w-[100%]"
<TableForm
ref="tableFormRef"
class="w-[100%]"
:tableFields="tableAllSchemas.tableFormColumns"
:tableData="tableData"
:tableData="tableData"
:tableFormRules="tableFormRules"
:isShowButton="isShowButton"
@handleAddTable="handleAddTable"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@tableSelectionChange="tableSelectionChange"
@extendedButtonsClick="extendedButtonsClick"
@ -27,7 +38,8 @@
@tableSortChange="tableSortChange"
@selectCallback="selectCallback"
@handleTableSelect="handleTableSelect"
@inpuFocus="inpuFocus"/>
@inpuFocus="inpuFocus"
/>
</div>
<template #footer>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" />
@ -36,18 +48,19 @@
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" />
</template>
<script setup lang="ts">
import { SearchTable } from '@/components/SearchTable';
import { SearchTable } from '@/components/SearchTable'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import ButtonBase from '@/components/XButton/src/ButtonBase.vue'
import TableForm from '@/components/TableForm/src/TableForm.vue'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
const props = defineProps({
// TableForm /
isShowButton: {
type: Boolean,
default: true,
default: true
},
// rules
// rules
rules: {
type: Object,
required: true,
@ -66,7 +79,7 @@ const props = defineProps({
default: null
},
//
tableData:{
tableData: {
type: Array,
required: true,
default: null
@ -107,7 +120,7 @@ const props = defineProps({
default: true
},
// form
form:{
form: {
type: Object,
required: true,
default: null
@ -139,20 +152,34 @@ const formSchema = ref(props.formAllSchemas?.formSchema)
/** 弹层操作 */
// formField form
// searchField
// type type=tableForm
// searchField
// type type=tableForm
// searchCondition
const searchTableRef = ref()
const opensearchTable = (formField, searchField, searchTitle, searchAllSchemas, searchPage, searchCondition,multiple, type, row ) => {
const opensearchTable = (
formField,
searchField,
searchTitle,
searchAllSchemas,
searchPage,
searchCondition,
multiple,
type,
row
) => {
const _searchCondition = {}
//
if (searchCondition && searchCondition.length > 0) {
searchCondition.forEach(item => {
searchCondition.forEach((item) => {
// row
if (item.isMainValue) {
_searchCondition[item.key] = formRef.value.formModel[item.value]?
formRef.value.formModel[item.value]:props.detailData?
props.detailData[item.value]:row[item.value]?row[item.value]:''
_searchCondition[item.key] = formRef.value.formModel[item.value]
? formRef.value.formModel[item.value]
: props.detailData
? props.detailData[item.value]
: row[item.value]
? row[item.value]
: ''
} else {
_searchCondition[item.key] = item.value
}
@ -161,12 +188,22 @@ const opensearchTable = (formField, searchField, searchTitle, searchAllSchemas,
const _searchTableTitle = searchTitle
const _searchTableAllSchemas = searchAllSchemas
const _searchTablePage = searchPage
searchTableRef.value.open(_searchTableTitle, _searchTableAllSchemas, _searchTablePage, formField, searchField,multiple, type, row, _searchCondition)
searchTableRef.value.open(
_searchTableTitle,
_searchTableAllSchemas,
_searchTablePage,
formField,
searchField,
multiple,
type,
row,
_searchCondition
)
}
//
// val row
const searchTableSuccess = (formField,searchField, val, type, row) => {
emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row )
const searchTableSuccess = (formField, searchField, val, type, row) => {
emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row)
}
/** 打开弹窗 */
@ -177,8 +214,8 @@ const open = async (type: string, row?: any, masterParmas?: any) => {
resetForm()
//
// masterIdnumber
if(masterParmas){
if(!row){
if (masterParmas) {
if (!row) {
row = {
masterId: masterParmas.masterId,
number: masterParmas.number
@ -196,12 +233,12 @@ const open = async (type: string, row?: any, masterParmas?: any) => {
}
}
}
defineExpose({ open , formRef, opensearchTable, dialogVisible, formLoading }) // open
defineExpose({ open, formRef, opensearchTable, dialogVisible, formLoading }) // open
/** 弹窗按钮 */
const Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null), //
defaultButtons.formCloseBtn(null) //
]
/** 按钮事件 */
@ -209,7 +246,6 @@ const buttonBaseClick = (val) => {
//
if (val == 'save') {
submitForm()
}
//
else if (val == 'close') {
@ -244,14 +280,14 @@ const submitForm = async () => {
//
try {
const data = unref(formRef)?.formModel
emit('submitForm', formType.value, data )
emit('submitForm', formType.value, data)
} finally {
}
} else {
//
try {
const data = unref(formRef)?.formModel
emit('submitForm', formType.value, data )
emit('submitForm', formType.value, data)
} finally {
}
}
@ -260,7 +296,7 @@ const submitForm = async () => {
formLoading.value = true
try {
const data = unref(formRef)?.formModel
emit('success',formType.value,data)
emit('success', formType.value, data)
} finally {
formLoading.value = false
}
@ -287,6 +323,7 @@ const emit = defineEmits([
'searchTableSuccess',
'opensearchTable',
'submitForm',
'selectChange'
])
//
const formSelectChange = (field, val) => {
@ -320,20 +357,24 @@ const handleAddTable = () => {
}
//
const inpuFocus = (headerItem, row, index) => {
console.log(headerItem.tableForm.multiple);
console.log(headerItem.tableForm.multiple)
opensearchTable(
headerItem.field,
headerItem.tableForm.searchField,
headerItem.tableForm.searchTitle,
headerItem.tableForm.searchAllSchemas,
headerItem.tableForm.searchPage,
headerItem.field,
headerItem.tableForm.searchField,
headerItem.tableForm.searchTitle,
headerItem.tableForm.searchAllSchemas,
headerItem.tableForm.searchPage,
headerItem.tableForm.searchCondition,
headerItem.tableForm.multiple,
'tableForm',
row,
row
)
}
//
const selectChange=((field,val)=>{
emit('selectChange',field,val)
})
</script>
<style lang="scss" scoped>
.table {

57
src/views/wms/countManage/count/countPlanMain/index.vue

@ -1,18 +1,22 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="CountPlanMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search
:schema="CountPlanMain.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="CountPlanMain.allSchemas"
/>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="CountPlanMain.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
@ -27,13 +31,13 @@
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #number="{row}">
<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>
@ -54,6 +58,8 @@
@handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
@formSelectChange="formSelectChange"
@selectChange="selectChange"
/>
<!-- 详情 -->
@ -72,7 +78,12 @@
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/count-plan-main/import" :importTemplateData="importTemplateData" @success="importSuccess"/>
<ImportForm
ref="importFormRef"
url="/wms/count-plan-main/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template>
<script setup lang="ts">
@ -327,6 +338,26 @@ const searchFormClick = (searchData) => {
}
getList() //
}
//
const selectChange = (field,val)=>{
console.log(val)
if(field == 'type'){
console.log(CountPlanMain.allSchemas.formSchema)
if(val =='DYNAMIC'){
CountPlanMain.allSchemas.formSchema[3].label = '限值(%)'
CountPlanMain.allSchemas.formSchema[3].componentProps.min = 0
CountPlanMain.allSchemas.formSchema[3].componentProps.max = 100
CountPlanMain.allSchemas.formSchema[3].componentProps.disabled = false
}else if(val =='LOW' || val =='RANDOM'){
CountPlanMain.allSchemas.formSchema[3].label = '限值'
CountPlanMain.allSchemas.formSchema[3].componentProps.min = 0
CountPlanMain.allSchemas.formSchema[3].componentProps.max = Infinity
CountPlanMain.allSchemas.formSchema[3].componentProps.disabled = false
}else{
CountPlanMain.allSchemas.formSchema[3].componentProps.disabled = true
}
}
}
/** 初始化 **/
onMounted(async () => {

Loading…
Cancel
Save