Browse Source

BUG修改

master
yejiaxing 10 months ago
parent
commit
5753ac921d
  1. 10
      src/api/eam/item/applicationRecordMain/index.ts
  2. 574
      src/components/Detail/src/approveDetail.vue
  3. 30
      src/utils/disposition/defaultButtons.ts
  4. 21
      src/views/eam/item/applicationRecord/index.vue

10
src/api/eam/item/applicationRecordMain/index.ts

@ -46,6 +46,16 @@ export const deleteApplicationRecordMain = async (id: number) => {
return await request.delete({ url: `/eam/item-apply-main/delete?id=` + id }) return await request.delete({ url: `/eam/item-apply-main/delete?id=` + id })
} }
// 审批通过备件申领记录主
export const agreeApplicationRecordMain = async (id: number) => {
return await request.delete({ url: `/eam/item-apply-main/agree?id=` + id })
}
// 审批驳回备件申领记录主
export const disAgreeApplicationRecordMain = async (id: number) => {
return await request.delete({ url: `/eam/item-apply-main/disAgree?id=` + id })
}
// 导出备件申领记录主 Excel // 导出备件申领记录主 Excel
export const exportApplicationRecordMain = async (params) => { export const exportApplicationRecordMain = async (params) => {
return await request.download({ url: `/eam/item-apply-main/export-excel`, params }) return await request.download({ url: `/eam/item-apply-main/export-excel`, params })

574
src/components/Detail/src/approveDetail.vue

@ -0,0 +1,574 @@
<template>
<div>
<Dialog v-model="isShowDrawer" title="审批详情" direction="rtl" size="80%" v-loading="detailLoading">
<template #header>
<div class="font-size-18px">
{{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span>
</div>
</template>
<ContentWrap v-if="!isBasic">
<Descriptions :data="detailData" labelClassName="label-class-name" label-align="left" direction="vertical"
:column="8" :schema="allSchemas.detailSchema" :columns="2" width="200px" />
</ContentWrap>
<Tabs :tabsList="tabsList" :current="current" @change="change" />
<div class="flex">
<!-- 详情 -->
<ContentWrap class="w-[100%]">
<!-- 列表头部 -->
<!-- <TableHead
v-if="!isBasic"
:HeadButttondata="HeadButttondata"
:number="masterParmas.maintenanceNumber"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@searchFormClick="searchFormClick"
:allSchemas="detailAllSchemas"
/> -->
<!-- 默认单表展现 -->
<Descriptions v-if="isBasic && !tabsExtend" :data="detailData" :schema="allSchemas.detailSchema"
:columns="2" />
<!-- 单表切换tabs 展现table -->
<Table v-if="isBasic && tabsExtend" :columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList" :loading="tableObjectRef.loading"
:pagination="{ total: tableObjectRef.total }" v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage">
<!-- <template #action="{ row }">
<ButtonBase
:Butttondata="buttondata"
@button-base-click="buttonTableClick($event, row)"
/>
</template> -->
</Table>
<Table v-if="!isBasic && fromeWhere != 'countPlan'" :columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList" :loading="tableObjectRef.loading"
:pagination="{ total: tableObjectRef.total }" v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage">
<template #photos="{ row }">
<div v-for="(item, index) in row.photos.split(',')" :key="index" style="color: #409eff; cursor: pointer"
@click="openImage(item)">{{ item }}</div>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="buttondata" @button-base-click="buttonTableClick($event, row)" />
</template>
</Table>
<DetailTable v-if="!isBasic && fromeWhere == 'countPlan' && isShowDrawer"
:columns="detailAllSchemasRef.tableColumns" :data="tableObjectRef.tableList" :allList="allList"
:countScopeType="countScopeType" :key="updateKey">
<template #action="{ row }">
<ButtonBase :Butttondata="buttondata" @button-base-click="buttonTableClick($event, row)" />
</template>
</DetailTable>
</ContentWrap>
</div>
<template #footer>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" />
</template>
</Dialog>
</div>
</template>
<script lang="ts" setup>
import Tabs from '@/components/Tabs/src/Tabs.vue'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import DetailTable from '@/components/DetailTable/src/DetailTable.vue'
import { isString } from '@/utils/is'
import { Console } from 'console'
defineOptions({ name: 'Detail' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
routeName.value = routeName.value.substring(0, routeName.value.length - 4) + 'Detail'
const updateKey = ref(0)
const props = defineProps({
//
tabs: {
type: Object,
required: true,
default: null
},
//
isBasic: {
type: Boolean,
required: false,
default: false
},
//
allSchemas: {
type: Object,
required: true,
default: null
},
//
detailAllSchemas: {
type: Object,
required: true,
default: null
},
//
detailAllSchemasRules: {
type: Object,
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
},
// API
apiAgree: {
type: Function,
required: false,
default: null
},
// API
apiDisAgree: {
type: Function,
required: false,
default: null
},
//
detailValidate: {
type: Function,
required: false,
default: null
},
// countPlan
fromeWhere: {
type: String,
required: false,
default: ''
},
//
allList: {
type: Object,
required: true,
default: null
},
//
countScopeType: {
type: Array,
required: false,
default: null
},
//
formTypeDetail: {
type: String,
required: false,
default: 'InputString'
},
//
countPlanAllList: {
type: Array,
required: false,
default: null
},
//
buttondataTable: {
type: Array,
required: false,
default: () => {
return []
}
},
// tabs table false
tabsExtend: {
type: Boolean,
required: false,
default: false
},
// tableObject
tableObjectExtend: {
type: Array,
required: false,
default: null
},
//
detailButtonIsShow: {
type: Boolean,
required: false,
default: false
},
//
isSearchTableItem: {
type: Boolean,
required: false,
default: false
},
})
const isShowDrawer = ref(false)
const detailLoading = ref(false)
const formLoading = ref(false) // 12
const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : '')))
if (props.isBasic == true) {
if (tabsList.value && tabsList.value.length > 0) {
tabsList.value.unshift({
label: '详情',
prop: 'Detail'
})
}
} else {
if (tabsList.value && tabsList.value.length > 0) {
} else {
tabsList.value = [
{
label: '明细',
prop: 'Detail'
}
]
}
}
if (tabsList.value) {
}
// Tabs
const current = ref(0)
const change = (item, index) => {
current.value = index
emit('changeTabs', item)
}
//
const masterParmas = ref({
maintenanceNumber: '' //id
// number: '', //
// status: '' //
})
//
const HeadButttondata = ref()
// -
const buttondata = ref()
/** 打开弹窗 */
const detailData = ref()
const titleNameRef = ref()
const titleValueRef = ref()
const openDetail = async (row : any, titleName : any, titleValue : any, tableName : any) => {
titleNameRef.value = titleName
titleValueRef.value = titleValue
//
if (!props.isBasic) {
// id
masterParmas.value.maintenanceNumber = row.number
// masterParmas.value.number = row.number
// masterParmas.value.status = row.status
tableObjectRef.value.params = {
maintenanceNumber: row.number
}
await getList()
}
isShowDrawer.value = true
if (row) {
detailLoading.value = true
try {
detailData.value = row
setBeiJian()
let detailButtonAdd : any = []
detailButtonAdd = [
defaultButtons.defaultAddBtn({
hide: isShowMainButton(row, ['1'])
})
]
HeadButttondata.value = [...detailButtonAdd]
} finally {
detailLoading.value = false
}
}
}
//
const setBeiJian = () => {
let isItemNUmbersTrue = false
isItemNUmbersTrue = detailAllSchemasRef.value.tableColumns.some(
(item) => item.field == 'itemNumbers1'
)
if (!isItemNUmbersTrue) return
tableObjectRef.value.tableList.forEach((item) => {
if (item.itemNumbers?.length > 0) {
let str = ''
item.itemNumbers.forEach((element) => {
str += element.name + ':' + element.qty + ','
})
item.itemNumbers1 = str.substring(0, str.length - 1)
}
})
}
const tableObjectRef = ref()
const tableMethodsRef = ref()
const detailAllSchemasRef = ref()
const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage //
})
tableObjectRef.value = tableObject
tableMethodsRef.value = tableMethods
detailAllSchemasRef.value = props.detailAllSchemas
//
const isShowMainButton = (row, val) => {
return false
}
//
const { getList } = tableMethodsRef.value
//
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 if (val == 'agree') {
//
agree()
}
else if (val == 'disAgree') {
//
disAgree()
}
// else if (val == 'disagree') {
// //
// disagree()
// }
else {
//
console.log('其他按钮', item)
}
}
/** 审批通过按钮操作 */
const agree = async (id : number) => {
try {
//
await message.confirm("是否确认审批通过该数据项?")
//
await props.apiAgree(id)
message.success(t('common.success'))
//
await getList()
updateKey.value += 1
setBeiJian()
} catch { }
}
/** 审批驳回按钮操作 */
const disAgree = async (id : number) => {
try {
//
await message.confirm("是否确认审批驳回该数据项?")
//
await props.apiDisAgree(id)
message.success(t('common.success'))
//
await getList()
updateKey.value += 1
setBeiJian()
} catch { }
}
//
// const updataTableColumns = (val) => {
// detailAllSchemas.tableColumns.value = val
// }
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') {
//
openForm('update', row)
emit('detailOpenForm', row)
} else if (val == 'delete') {
//
handleDelete(row.id)
} else {
emit('tableFormButton', val, row)
}
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = async (type : string, row ?: number) => {
if (row) {
if (detailAllSchemasRef.value?.tableColumns?.length > 0) {
let isTrue = false
let isItemNUmbersTrue = false
isTrue = detailAllSchemasRef.value.tableColumns.some((item) => item.field == 'maintenances')
isItemNUmbersTrue = detailAllSchemasRef.value.tableColumns.some(
(item) => item.field == 'itemNumbers'
)
if (isTrue) {
if (row.maintenances && isString(row.maintenances)) {
row.maintenances = row.maintenances.split(',').map(Number)
}
}
}
}
formRef.value.open(type, row, masterParmas.value)
}
// form
const submitForm = async (formType, data) => {
try {
emit('detailSubmitForm', formType, data, getList, formRef.value)
} finally {
// formRef.value.formLoading = false
}
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
emit('searchTableSuccessDetail', formField, searchField, val, formRef)
}
//
const emit = defineEmits([
'searchTableSuccessDetail',
'changeTabs',
'selectChangeDetail',
'detailOpenForm',
'tableFormButton',
'openImage',
'detailSubmitForm'
])
/** 删除按钮操作 */
const handleDelete = async (id : number) => {
try {
//
await message.delConfirm()
//
await props.apiDelete(id)
message.success(t('common.delSuccess'))
//
await getList()
updateKey.value += 1
setBeiJian()
} catch { }
}
//
const searchFormClick = async (searchData) => {
const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage //
})
tableObject.params = {
isSearch: true,
filters: searchData.filters
? searchData.filters
: [{ column: 'number', action: '==', value: masterParmas.value.maintenanceNumber }]
}
detailAllSchemasRef.value = props.detailAllSchemas
tableObjectRef.value = tableObject
tableMethodsRef.value = tableMethods
tableObjectRef.value.tableList = []
const { getList } = tableMethods
await getList()
updateKey.value += 1
// tableObjectRef.value.params = {
// isSearch: true,
// filters: searchData.filters
// ? searchData.filters
// : [{ column: 'masterId', action: '==', value: masterParmas.value.masterId }]
// }
// getList() //
}
//
const selectChangeDetail = (field, val) => {
emit('selectChangeDetail', field, val)
}
//
const openImage = (item) => {
emit('openImage', item)
}
/** 弹窗按钮 */
const Butttondata = [
defaultButtons.agree(null), //
defaultButtons.disAgree(null) //
]
defineExpose({ openDetail, tableObject }) // open
//
watch(
() => props.apiPage,
() => {
const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage //
})
tableObject.params.maintenanceNumber = masterParmas.value.maintenanceNumber
detailAllSchemasRef.value = props.detailAllSchemas
if (props.tableObjectExtend) {
props.tableObjectExtend.forEach((item) => {
tableObject.params[item.key] = item.value
})
}
tableObjectRef.value = tableObject
tableMethodsRef.value = tableMethods
const { getList } = tableMethods
getList()
}
)
</script>
<style lang="scss">
.el-drawer__body {
background: #f5f5f5 !important;
}
::v-deep(.label-class-name) {
color: #dedede;
}
</style>
<style scoped lang="scss"></style>

30
src/utils/disposition/defaultButtons.ts

@ -788,6 +788,32 @@ export function chooseDeviceBtn(option:any) {
}) })
} }
// 审批通过按钮
export function agree(option:any) {
return __defaultBtnOption(option,{
label: '通过',
name: 'agree',
hide: false,
type: 'primary',
// icon: 'ep:plus',
color: 'green',
hasPermi: ''
})
}
// 审批驳回按钮
export function disAgree(option:any) {
return __defaultBtnOption(option,{
label: '驳回',
name: 'disAgree',
hide: false,
type: 'primary',
// icon: 'ep:plus',
color: 'red',
hasPermi: ''
})
}
// 主列表-撤销 // 主列表-撤销
export function backoutBtn(option:any) { export function backoutBtn(option:any) {
return __defaultBtnOption(option,{ return __defaultBtnOption(option,{
@ -892,10 +918,6 @@ export function finishOrderBtn(option:any) {
}) })
} }
// 默认按钮规则 // 默认按钮规则
function __defaultBtnOption(option:any,specific:any){ function __defaultBtnOption(option:any,specific:any){
return { return {

21
src/views/eam/item/applicationRecord/index.vue

@ -44,7 +44,13 @@
:apiPage="ApplicationRecordDetailApi.getApplicationRecordDetailPage" :apiPage="ApplicationRecordDetailApi.getApplicationRecordDetailPage"
:apiDelete="ApplicationRecordDetailApi.deleteApplicationRecordDetail" :apiDelete="ApplicationRecordDetailApi.deleteApplicationRecordDetail"
@searchTableSuccessDetail="searchTableSuccessDetail" /> @searchTableSuccessDetail="searchTableSuccessDetail" />
<!-- 审批详情 -->
<approveDetail ref="detailRef1" :isBasic="false" :allSchemas="ApplicationRecordMain.allSchemas"
:detailAllSchemas="ApplicationRecordDetail.allSchemas" :detailAllSchemasRules="ApplicationRecordDetailRules"
:apiAgree="ApplicationRecordMainApi.agreeApplicationRecordMain"
:apiDisAgree="ApplicationRecordMainApi.disAgreeApplicationRecordMain"
:apiPage="ApplicationRecordDetailApi.getApplicationRecordDetailPage"
@searchTableSuccessDetail="searchTableSuccessDetail" />
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/purchase-main/import" :importTemplateData="importTemplateData" <ImportForm ref="importFormRef" url="/wms/purchase-main/import" :importTemplateData="importTemplateData"
@success="importSuccess" :isShowOut="true" :updateIsDisable="true" :coverIsDisable="true" :mode="2" /> @success="importSuccess" :isShowOut="true" :updateIsDisable="true" :coverIsDisable="true" :mode="2" />
@ -58,6 +64,7 @@
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import approveDetail from '@/components/Detail/src/approveDetail.vue'
// //
defineOptions({ name: 'ApplicationRecord' }) defineOptions({ name: 'ApplicationRecord' })
@ -163,8 +170,8 @@
// - // -
const butttondata = (row) => { const butttondata = (row) => {
return [ return [
defaultButtons.approveBtn({ hide: isShowMainButton(row, ['0']) }), // defaultButtons.approveBtn({ hide: isShowMainButton(row, ['0']) }), //
// defaultButtons.mainListEditBtn(null), // defaultButtons.mainListEditBtn(null), //
// defaultButtons.mainListDeleteBtn(null), // // defaultButtons.mainListDeleteBtn(null), //
] ]
} }
@ -173,8 +180,8 @@
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') { //
openForm('update', row) openForm('update', row)
}else if (val == 'approve') { // } else if (val == 'approve') { //
// handleDelete(row.id) handleApprove(row, '单据号', row.number)
} else if (val == 'delete') { // } else if (val == 'delete') { //
handleDelete(row.id) handleDelete(row.id)
} }
@ -192,6 +199,10 @@
const openDetail = (row : any, titleName : any, titleValue : any) => { const openDetail = (row : any, titleName : any, titleValue : any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicApplicationRecordMain') detailRef.value.openDetail(row, titleName, titleValue, 'basicApplicationRecordMain')
} }
const detailRef1 = ref()
const handleApprove = (row : any, titleName : any, titleValue : any) => {
detailRef1.value.openDetail(row, titleName, titleValue, 'basicApplicationRecordMain')
}
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id : number) => { const handleDelete = async (id : number) => {

Loading…
Cancel
Save