Browse Source

检验任务执行和承接按钮合并

linshi20240813
zhang_li 3 months ago
parent
commit
d170cb2747
  1. 5
      src/views/qms/inspectionJob/addForm.vue
  2. 62
      src/views/qms/inspectionJob/index.vue

5
src/views/qms/inspectionJob/addForm.vue

@ -925,8 +925,9 @@ const buttonBaseClick = async (val) => {
} }
// //
else if (val == 'close') { else if (val == 'close') {
// await InspectionJobMainApi.abandonInspectionJobMain(data.value.id) await InspectionJobMainApi.abandonInspectionJobMain(data.value.id)
dialogVisible.value = false dialogVisible.value = false
emit('close')
} }
// //
else if (val == 'staging') { else if (val == 'staging') {
@ -934,7 +935,7 @@ const buttonBaseClick = async (val) => {
} }
} }
// //
const emit = defineEmits(['submitForm', 'searchTableSuccess']) const emit = defineEmits(['submitForm', 'searchTableSuccess','close'])
const validateForm = (formRef) => { const validateForm = (formRef) => {
let _lists = formRef?.map((v) => v.validate()) let _lists = formRef?.map((v) => v.validate())
return Promise.all(_lists) return Promise.all(_lists)

62
src/views/qms/inspectionJob/index.vue

@ -20,7 +20,8 @@
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table v-clientTable <Table
v-clientTable
:columns="tableColumns" :columns="tableColumns"
:data="tableObject.tableList" :data="tableObject.tableList"
:loading="tableObject.loading" :loading="tableObject.loading"
@ -57,6 +58,7 @@
:rules="InspectionJobMainRules" :rules="InspectionJobMainRules"
:formAllSchemas="InspectionJobMain.allSchemas" :formAllSchemas="InspectionJobMain.allSchemas"
@submitForm="submitForm" @submitForm="submitForm"
@close="getList"
/> />
<!-- 详情 --> <!-- 详情 -->
<Detail <Detail
@ -119,6 +121,7 @@ import TableHead from '@/components/TableHead/src/TableHead.vue'
import AddForm from './addForm.vue' import AddForm from './addForm.vue'
import Detail from './detail.vue' import Detail from './detail.vue'
import { getReportUrl } from '@/utils/systemParam' import { getReportUrl } from '@/utils/systemParam'
import { useUserStore } from '@/store/modules/user'
// //
defineOptions({ name: 'inspectionJobMain' }) defineOptions({ name: 'inspectionJobMain' })
@ -129,6 +132,7 @@ const route = useRoute() // 路由信息
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(InspectionJobMain.allSchemas.tableColumns) const tableColumns = ref(InspectionJobMain.allSchemas.tableColumns)
const userStore = useUserStore()
// //
const updataTableColumns = (val) => { const updataTableColumns = (val) => {
@ -199,7 +203,7 @@ const buttonBaseClick = (val, item) => {
handleExport() handleExport()
} else if (val == 'refresh') { } else if (val == 'refresh') {
// //
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { if (tableObject.params.filters && tableObject.params.filters.length > 0) {
searchFormClick({ searchFormClick({
filters: tableObject.params.filters filters: tableObject.params.filters
}) })
@ -231,24 +235,35 @@ const isShowMainButton2 = (row, val) => {
return true return true
} }
} }
//
const isShowMainButton1 = (row, val) => {
if (val.indexOf(row.status) > -1) {
if (userStore.getUser.id == row.acceptUserId) {
return false
} else {
return true
}
} else {
return true
}
}
// - // -
const butttondata = (row) => { const butttondata = (row) => {
return [ return [
defaultButtons.mainListJobAccBtn({ // defaultButtons.mainListJobAccBtn({
hide: isShowMainButton(row, ['1']), // hide: isShowMainButton(row, ['1']),
hasPermi: 'qms:inspection-job-main:accept' // hasPermi: 'qms:inspection-job-main:accept'
}), // // }), //
defaultButtons.mainListJobCloBtn({ defaultButtons.mainListJobCloBtn({
hide: isShowMainButton(row, ['1']), hide: isShowMainButton(row, ['1']),
hasPermi: 'qms:inspection-job-main:close' hasPermi: 'qms:inspection-job-main:close'
}), // }), //
defaultButtons.mainListJobAbaBtn({ defaultButtons.mainListJobAbaBtn({
hide: isShowMainButton(row, ['2']), hide: isShowMainButton1(row, ['2']),
hasPermi: 'qms:inspection-job-main:abandon' hasPermi: 'qms:inspection-job-main:abandon'
}), // }), //
defaultButtons.mainListJobExeBtn({ defaultButtons.mainListJobExeBtn({
hide: isShowMainButton(row, ['2']), hide: isShowMainButton(row, ['1', '2']),
hasPermi: 'qms:inspection-job-main:execute' hasPermi: 'qms:inspection-job-main:execute'
}), // }), //
defaultButtons.mainListOrderPubBtn({ defaultButtons.mainListOrderPubBtn({
@ -312,10 +327,19 @@ const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicInspectionJobMain') detailRef.value.openDetail(row, titleName, titleValue, 'basicInspectionJobMain')
} }
// //
const formRef = ref() const formRef = ref()
const execute = async (type: string, row?: number) => { const execute = async (type: string, row?: any) => {
if (row.status == '2') {
if (userStore.getUser.id == row.acceptUserId) {
formRef.value.open(type, row) formRef.value.open(type, row)
} else {
message.error('承接人与当前登录人不一致')
}
} else if (row.status == '1') {
await handleAccept(row.id)
formRef.value.open(type, row)
await getList()
}
} }
/** 关闭按钮操作 */ /** 关闭按钮操作 */
const handleClose = async (id: number) => { const handleClose = async (id: number) => {
@ -326,7 +350,7 @@ const handleClose = async (id: number) => {
await InspectionJobMainApi.closeInspectionJobMain(id) await InspectionJobMainApi.closeInspectionJobMain(id)
message.success(t('common.closeSuccess')) message.success(t('common.closeSuccess'))
// //
buttonBaseClick('refresh',null) buttonBaseClick('refresh', null)
} catch {} } catch {}
} }
/** 发布按钮操作 */ /** 发布按钮操作 */
@ -338,19 +362,19 @@ const handleRelease = async (id: number) => {
await InspectionJobMainApi.releaseInspectionJobMain(id) await InspectionJobMainApi.releaseInspectionJobMain(id)
message.success('发布成功!') message.success('发布成功!')
// //
buttonBaseClick('refresh',null) buttonBaseClick('refresh', null)
} catch {} } catch {}
} }
// //
const handleAccept = async (id: number) => { const handleAccept = async (id: number) => {
try { try {
// //
await message.confirm(t('common.confirmAccept')) // await message.confirm(t('common.confirmAccept'))
// //
await InspectionJobMainApi.acceptInspectionJobMain(id) await InspectionJobMainApi.acceptInspectionJobMain(id)
message.success(t('common.acceptSuccess')) // message.success(t('common.acceptSuccess'))
// (TB) // (TB)
buttonBaseClick('refresh',null) // buttonBaseClick('refresh',null)
} catch {} } catch {}
} }
// //
@ -362,7 +386,7 @@ const handleAbandon = async (id: number) => {
await InspectionJobMainApi.abandonInspectionJobMain(id) await InspectionJobMainApi.abandonInspectionJobMain(id)
message.success(t('common.giveupSuccess')) message.success(t('common.giveupSuccess'))
// //
buttonBaseClick('refresh',null) buttonBaseClick('refresh', null)
} catch {} } catch {}
} }
@ -408,8 +432,8 @@ const submitForm = async (formType, data) => {
// //
if (formType === 'create') { if (formType === 'create') {
getList() getList()
}else{ } else {
buttonBaseClick('refresh',null) buttonBaseClick('refresh', null)
} }
} finally { } finally {
formRef.value.formLoading = false formRef.value.formLoading = false

Loading…
Cancel
Save