|
|
@ -11,9 +11,20 @@ |
|
|
|
<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" |
|
|
|
<TableForm |
|
|
|
ref="tableFormRef" |
|
|
|
class="w-[100%]" |
|
|
|
:tableFields="tableAllSchemas.tableFormColumns" |
|
|
|
:tableData="tableData" |
|
|
@ -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,16 +48,17 @@ |
|
|
|
<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: { |
|
|
@ -143,16 +156,30 @@ const formSchema = ref(props.formAllSchemas?.formSchema) |
|
|
|
// 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,7 +188,17 @@ 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 数据 |
|
|
@ -201,7 +238,7 @@ defineExpose({ open , formRef, opensearchTable, dialogVisible, formLoading }) // |
|
|
|
/** 弹窗按钮 */ |
|
|
|
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') { |
|
|
@ -287,6 +323,7 @@ const emit = defineEmits([ |
|
|
|
'searchTableSuccess', |
|
|
|
'opensearchTable', |
|
|
|
'submitForm', |
|
|
|
'selectChange' |
|
|
|
]) |
|
|
|
//普通下拉改变事件 |
|
|
|
const formSelectChange = (field, val) => { |
|
|
@ -320,7 +357,7 @@ const handleAddTable = () => { |
|
|
|
} |
|
|
|
// 输入框聚焦 |
|
|
|
const inpuFocus = (headerItem, row, index) => { |
|
|
|
console.log(headerItem.tableForm.multiple); |
|
|
|
console.log(headerItem.tableForm.multiple) |
|
|
|
|
|
|
|
opensearchTable( |
|
|
|
headerItem.field, |
|
|
@ -331,9 +368,13 @@ const inpuFocus = (headerItem, row, index) => { |
|
|
|
headerItem.tableForm.searchCondition, |
|
|
|
headerItem.tableForm.multiple, |
|
|
|
'tableForm', |
|
|
|
row, |
|
|
|
row |
|
|
|
) |
|
|
|
} |
|
|
|
// 修改盘点类型 |
|
|
|
const selectChange=((field,val)=>{ |
|
|
|
emit('selectChange',field,val) |
|
|
|
}) |
|
|
|
</script> |
|
|
|
<style lang="scss" scoped> |
|
|
|
.table { |
|
|
|