|
|
@ -1,4 +1,5 @@ |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<el-drawer v-model="isShowDrawer" title="详情" direction="rtl" size="80%" v-loading="detailLoading"> |
|
|
|
<template #header> |
|
|
|
<div class="font-size-18px"> |
|
|
@ -9,6 +10,13 @@ |
|
|
|
<Descriptions :data="detailData" labelClassName="label-class-name" label-align="left" direction="vertical" |
|
|
|
:column="8" :schema="allSchemas.detailSchema" :columns="2" width="200px" /> |
|
|
|
</ContentWrap> |
|
|
|
<!-- 列表头部 --> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
/> |
|
|
|
<Tabs :tabsList="tabsList" :current="current" @change="change" /> |
|
|
|
<div class="flex" v-if="current == 0"> |
|
|
|
<!-- 详情 --> |
|
|
@ -21,7 +29,11 @@ |
|
|
|
:loading="tableObject.loading" |
|
|
|
:pagination="{ total: tableObject.total }" |
|
|
|
v-model:pageSize="tableObject.pageSize" |
|
|
|
v-model:currentPage="tableObject.currentPage" /> |
|
|
|
v-model:currentPage="tableObject.currentPage" > |
|
|
|
<template #action="{ row }"> |
|
|
|
<ButtonBase :Butttondata="buttondata(row)" @button-base-click="buttonTableClick($event, row)" /> |
|
|
|
</template> |
|
|
|
</Table> |
|
|
|
</ContentWrap> |
|
|
|
<ContentWrap class="w-[27%] ml-16px"> |
|
|
|
<!-- 附件组件 --> |
|
|
@ -34,6 +46,20 @@ |
|
|
|
</ContentWrap> |
|
|
|
</div> |
|
|
|
</el-drawer> |
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
|
<BasicForm |
|
|
|
ref="formRef" |
|
|
|
@success="getList" |
|
|
|
:rules="detailAllSchemasRules" |
|
|
|
:formAllSchemas="detailAllSchemas" |
|
|
|
:searchTableParams="searchTableParams" |
|
|
|
:isBusiness="false" |
|
|
|
:apiUpdate="apiUpdate" |
|
|
|
:apiCreate="apiCreate" |
|
|
|
:masterId="masterId" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script lang="ts" setup> |
|
|
@ -43,10 +69,19 @@ import ChangeRecord from '@/components/ChangeRecord/src/ChangeRecord.vue' |
|
|
|
import Tabs from '@/components/Tabs/src/Tabs.vue' |
|
|
|
import * as RemarkApi from '@/api/wms/remark' |
|
|
|
import * as FileApi from '@/api/wms/file' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import BasicForm from '@/components/BasicForm/src/BasicForm.vue' |
|
|
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
|
|
|
|
|
defineOptions({ name: 'Detail' }) |
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
|
const { t } = useI18n() // 国际化 |
|
|
|
|
|
|
|
const route = useRoute() // 路由信息 |
|
|
|
const routeName = ref() |
|
|
|
routeName.value = route.name |
|
|
|
|
|
|
|
defineOptions({ name: 'Detail' }) |
|
|
|
|
|
|
|
const props = defineProps({ |
|
|
|
// 标签参数 |
|
|
@ -73,18 +108,46 @@ const props = defineProps({ |
|
|
|
required: true, |
|
|
|
default: null |
|
|
|
}, |
|
|
|
// 主表API |
|
|
|
detailApi: { |
|
|
|
// 明细验证 |
|
|
|
detailAllSchemasRules: { |
|
|
|
type: Object, |
|
|
|
required: true, |
|
|
|
default: null |
|
|
|
} |
|
|
|
}, |
|
|
|
// 明细查询 |
|
|
|
searchTableParams: { |
|
|
|
type: Array, |
|
|
|
required: true, |
|
|
|
default: null |
|
|
|
}, |
|
|
|
// 子表新增API |
|
|
|
apiCreate: { |
|
|
|
type: Function, |
|
|
|
required: false, |
|
|
|
default: null |
|
|
|
}, |
|
|
|
// 子表编辑API |
|
|
|
apiUpdate: { |
|
|
|
type: Function, |
|
|
|
required: false, |
|
|
|
default: null |
|
|
|
}, |
|
|
|
// 子表分页列表API |
|
|
|
apiPage: { |
|
|
|
type: Function, |
|
|
|
required: false, |
|
|
|
default: null |
|
|
|
}, |
|
|
|
// 子表删除API |
|
|
|
apiDelete: { |
|
|
|
type: Function, |
|
|
|
required: false, |
|
|
|
default: null |
|
|
|
}, |
|
|
|
}) |
|
|
|
|
|
|
|
console.log(props.detailAllSchemas); |
|
|
|
const isShowDrawer = ref(false) |
|
|
|
|
|
|
|
const detailLoading = ref(false) |
|
|
|
|
|
|
|
const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : ''))) |
|
|
|
|
|
|
|
if (tabsList.value && tabsList.value.length > 0) { |
|
|
@ -144,7 +207,7 @@ const change = (item, index) => { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const masterId=ref('')//主表id |
|
|
|
/** 打开弹窗 */ |
|
|
|
const titleNameRef = ref() |
|
|
|
const titleValueRef = ref() |
|
|
@ -157,8 +220,10 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName: |
|
|
|
} |
|
|
|
// 加载明细列表 |
|
|
|
if(!props.isBasic) { |
|
|
|
// 设置主表id |
|
|
|
masterId.value = row.id |
|
|
|
tableObject.params = { |
|
|
|
id: row.id |
|
|
|
masterId: row.id |
|
|
|
} |
|
|
|
getList() |
|
|
|
} |
|
|
@ -199,11 +264,93 @@ const getChangeRecordList = async () => { |
|
|
|
} |
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
|
getListApi: props.detailApi?.getDetasListPage // 在主表API中添加根据主表ID获取明细列表分页方法 |
|
|
|
getListApi: props.apiPage // 分页接口 |
|
|
|
}) |
|
|
|
// 获得表格的各种操作 |
|
|
|
const { getList } = tableMethods |
|
|
|
// 列表头部按钮 |
|
|
|
const HeadButttondata = [ |
|
|
|
defaultButtons.defaultAddBtn({ hasPermi: 'wms:purchaseclaim-request-main:create' }), // 新增 |
|
|
|
] |
|
|
|
// 头部按钮事件 |
|
|
|
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 updataTableColumns = (val) => { |
|
|
|
tableColumns.value = val |
|
|
|
} |
|
|
|
// 列表-操作按钮 |
|
|
|
const buttondata = (row) => { |
|
|
|
return [ |
|
|
|
defaultButtons.mainListEditBtn({ hide: false, hasPermi: 'wms:purchaseclaim-request-main:update' }), // 编辑 |
|
|
|
defaultButtons.mainListDeleteBtn({ hide: false, hasPermi: 'wms:purchaseclaim-request-main:delete' }), // 删除 |
|
|
|
] |
|
|
|
} |
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'edit') { // 编辑 |
|
|
|
openForm('update', row) |
|
|
|
} else if (val == 'delete') { // 删除 |
|
|
|
handleDelete(row.id) |
|
|
|
} |
|
|
|
} |
|
|
|
/** 添加/修改操作 */ |
|
|
|
const formRef = ref() |
|
|
|
const openForm = async (type: string, row?: number) => { |
|
|
|
formRef.value.open(type, row) |
|
|
|
} |
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
|
|
|
nextTick(() => { |
|
|
|
if (type == 'tableForm') { |
|
|
|
} else { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
setV['ppNumber'] = val[0]['ppNumber'] |
|
|
|
setV['poLine'] = val[0]['poLine'] |
|
|
|
setV['batch'] = val[0]['batch'] |
|
|
|
setV['altBatch'] = val[0]['altBatch'] |
|
|
|
setV['reason'] = val[0]['reason'] |
|
|
|
setV['singlePrice'] = val[0]['singlePrice'] |
|
|
|
setV['amount'] = val[0]['amount'] |
|
|
|
setV['number'] = val[0]['number'] |
|
|
|
setV['itemCode'] = val[0]['itemCode'] |
|
|
|
setV['itemName'] = val[0]['itemName'] |
|
|
|
setV['itemDesc1'] = val[0]['itemDesc1'] |
|
|
|
setV['itemDesc2'] = val[0]['itemDesc2'] |
|
|
|
setV['projectCode'] = val[0]['projectCode'] |
|
|
|
setV['qty'] = val[0]['qty'] |
|
|
|
setV['uom'] = val[0]['uom'] |
|
|
|
setV['remark'] = val[0]['remark'] |
|
|
|
formRef.setValues(setV) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
/** 删除按钮操作 */ |
|
|
|
const handleDelete = async (id: number) => { |
|
|
|
try { |
|
|
|
// 删除的二次确认 |
|
|
|
await message.delConfirm() |
|
|
|
// 发起删除 |
|
|
|
await props.apiDelete(id) |
|
|
|
message.success(t('common.delSuccess')) |
|
|
|
// 刷新列表 |
|
|
|
await getList() |
|
|
|
} catch { } |
|
|
|
} |
|
|
|
</script> |
|
|
|
<style lang="scss"> |
|
|
|
.el-drawer__body { |
|
|
|