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

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

@ -1,18 +1,22 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="CountPlanMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search
:schema="CountPlanMain.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead <TableHead
:HeadButttondata="HeadButttondata" :HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick" @button-base-click="buttonBaseClick"
:routeName="routeName" :routeName="routeName"
@updataTableColumns="updataTableColumns" @updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick" @searchFormClick="searchFormClick"
:allSchemas="CountPlanMain.allSchemas" :allSchemas="CountPlanMain.allSchemas"
/> />
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
@ -27,13 +31,13 @@
v-model:currentPage="tableObject.currentPage" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort" v-model:sort="tableObject.sort"
> >
<template #number="{row}"> <template #number="{ row }">
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)"> <el-button type="primary" link @click="openDetail(row, '单据号', row.number)">
<span>{{ row.number }}</span> <span>{{ row.number }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -54,6 +58,8 @@
@handleDeleteTable="handleDeleteTable" @handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
@submitForm="submitForm" @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> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -327,6 +338,26 @@ const searchFormClick = (searchData) => {
} }
getList() // 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 () => { onMounted(async () => {

Loading…
Cancel
Save