Browse Source

表单 详情 查询页 table 组件修改

master
陈薪名 1 year ago
parent
commit
4334710e35
  1. 13
      src/components/BasicForm/src/BasicForm.vue
  2. 4
      src/components/Detail/src/Detail.vue
  3. 10
      src/components/SearchTable/src/SearchTable.vue
  4. 11
      src/components/TableForm/src/TableForm.vue

13
src/components/BasicForm/src/BasicForm.vue

@ -210,18 +210,19 @@ const formSchema = ref(props.formAllSchemas.formSchema)
/** 弹层操作 */ /** 弹层操作 */
// formField form // formField form
// searchField // searchField
// type type=tableForm
const searchTableRef = ref() const searchTableRef = ref()
const opensearchTable = (formField, searchField) => { const opensearchTable = (formField, searchField, type, row) => {
const _searchTableParamsObject:any = props.searchTableParams.find((item:any) => (item.formField == formField)) const _searchTableParamsObject:any = props.searchTableParams.find((item:any) => (item.formField == formField))
const _searchTableTitle = _searchTableParamsObject.searchTableTitle const _searchTableTitle = _searchTableParamsObject.searchTableTitle
const _searchTableAllSchemas = _searchTableParamsObject.searchTableAllSchemas const _searchTableAllSchemas = _searchTableParamsObject.searchTableAllSchemas
const _searchTablePage = _searchTableParamsObject.searchTablePage const _searchTablePage = _searchTableParamsObject.searchTablePage
searchTableRef.value.open(_searchTableTitle, _searchTableAllSchemas, _searchTablePage, formField, searchField) searchTableRef.value.open(_searchTableTitle, _searchTableAllSchemas, _searchTablePage, formField, searchField, type, row)
} }
// //
// val row // val row
const searchTableSuccess = (formField,searchField, val) => { const searchTableSuccess = (formField,searchField, val, type, row) => {
emit('searchTableSuccess', formField, searchField, val, formRef.value ) emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row )
} }
/** 打开弹窗 */ /** 打开弹窗 */
@ -357,8 +358,8 @@ const handleAddTable = () => {
emit('handleAddTable') emit('handleAddTable')
} }
// //
const inpuFocus = (headerItem) => { const inpuFocus = (headerItem, row, index) => {
opensearchTable() opensearchTable(headerItem.field, 'poNumber', 'tableForm', row)
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

4
src/components/Detail/src/Detail.vue

@ -155,7 +155,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
tableId: row.id, tableId: row.id,
tableName: tableName, tableName: tableName,
} }
getList() // if(!props.isBasic) getList() //
isShowDrawer.value = true isShowDrawer.value = true
if (row) { if (row) {
detailLoading.value = true detailLoading.value = true
@ -190,8 +190,8 @@ const remarksSubmitScuess = async (remark) => {
// //
const getChangeRecordList = async () => { const getChangeRecordList = async () => {
changeRecordData.changeRecordList = await RemarkApi.getChangeRecordPage(remarksData.data) changeRecordData.changeRecordList = await RemarkApi.getChangeRecordPage(remarksData.data)
} }
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: props.detailApi?.getDetasListPage // APIID getListApi: props.detailApi?.getDetasListPage // APIID
}) })

10
src/components/SearchTable/src/SearchTable.vue

@ -39,13 +39,17 @@ const searchSchema = ref()
const tableColumns = ref() const tableColumns = ref()
const formFieldRef = ref() const formFieldRef = ref()
const searchFieldRef = ref() const searchFieldRef = ref()
const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, searchField: any ) => { const typeRef = ref()
const rowRef = ref()
const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, searchField: any, type: any, row: any ) => {
searchDialogVisible.value = true searchDialogVisible.value = true
formFieldRef.value = formField formFieldRef.value = formField
searchFieldRef.value = searchField searchFieldRef.value = searchField
searchSchema.value = allSchemas.searchSchema searchSchema.value = allSchemas.searchSchema
tableColumns.value = allSchemas.tableColumns tableColumns.value = allSchemas.tableColumns
getPage.value = getApiPage getPage.value = getApiPage
typeRef.value = type
rowRef.value = row
// dialogTitle.value = t('action.' + type) // dialogTitle.value = t('action.' + type)
dialogTitle.value = titleName dialogTitle.value = titleName
const {tableObject, tableMethods } = useTable({ const {tableObject, tableMethods } = useTable({
@ -75,11 +79,9 @@ const submitForm = async () => {
return return
} }
try { try {
searchDialogVisible.value = false searchDialogVisible.value = false
// //
emit('searchTableSuccess', formFieldRef.value, searchFieldRef.value, selections) emit('searchTableSuccess', formFieldRef.value, searchFieldRef.value, selections, typeRef.value, rowRef.value)
searchDialogVisible.value = false
} finally { } finally {
formLoading.value = false formLoading.value = false
} }

11
src/components/TableForm/src/TableForm.vue

@ -40,12 +40,12 @@
/> />
<el-table-column <el-table-column
v-slot="{ row }" v-slot="{ row }"
v-for="headerItem in tableFields" v-for="(headerItem,index) in tableFields"
:key="headerItem" :key="headerItem"
:fixed="headerItem.tableForm?.fixed" :fixed="headerItem.tableForm?.fixed"
:label="headerItem.label" :prop="headerItem.field" :label="headerItem.label" :prop="headerItem.field"
:align="headerItem?.tableForm?.align || 'center'" :align="headerItem?.tableForm?.align || 'center'"
:sortable="headerItem?.tableForm?.sortable || ''" :sortable="headerItem?.tableForm?.sortable || false"
:width="headerItem?.tableForm?.width || '200'" :width="headerItem?.tableForm?.width || '200'"
:min-width="headerItem?.tableForm?.minWidth || 'auto'"> :min-width="headerItem?.tableForm?.minWidth || 'auto'">
<el-form <el-form
@ -65,7 +65,7 @@
:placeholder="headerItem?.tableForm?.placeholder || '请输入' + headerItem.label" :placeholder="headerItem?.tableForm?.placeholder || '请输入' + headerItem.label"
:disabled="itemIsDisabled(headerItem, row)" :disabled="itemIsDisabled(headerItem, row)"
style="width: 100%;" style="width: 100%;"
@focus="inpuFocus(headerItem)" @click="inpuFocus(headerItem,row,index)"
/> />
</el-form-item> </el-form-item>
<!-- 金额输入框 --> <!-- 金额输入框 -->
@ -387,10 +387,9 @@ const handleAddTable = () => {
emit('handleAddTable') emit('handleAddTable')
} }
// //
const inpuFocus = (headerItem)=>{ const inpuFocus = (headerItem, row, index)=>{
if(headerItem?.tableForm?.isInpuFocusShow){ if(headerItem?.tableForm?.isInpuFocusShow){
emit('inpuFocus') emit('inpuFocus', headerItem, row, index)
} }
} }

Loading…
Cancel
Save