Browse Source

动态修改规则代码

master_hella_20240701
ljlong_2630 7 months ago
parent
commit
3935f91c53
  1. 16
      src/api/qms/counter/index.ts
  2. 18
      src/api/qms/dynamicRule/index.ts
  3. 19
      src/api/qms/inspectionStage/index.ts
  4. 696
      src/components/BasicForm/src/BasicFormQms.vue
  5. 1
      src/components/Detail/src/Detail.vue
  6. 846
      src/components/Detail/src/DetailQms.vue
  7. 4
      src/utils/dict.ts
  8. 140
      src/views/qms/basicDataManage/dynamicRule/dynamicRule.data.ts
  9. 99
      src/views/qms/basicDataManage/dynamicRule/index.vue
  10. 2
      src/views/qms/basicDataManage/inspectionStage/inspectionStage.data.ts

16
src/api/qms/counter/index.ts

@ -26,38 +26,38 @@ export const getCounterPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/basic/counter/senior', data })
return await request.post({ url: '/qms/counter/senior', data })
} else {
return await request.get({ url: `/basic/counter/page`, params })
return await request.get({ url: `/qms/counter/page`, params })
}
}
// 查询物料检验计数器详情
export const getCounter = async (id: number) => {
return await request.get({ url: `/basic/counter/get?id=` + id })
return await request.get({ url: `/qms/counter/get?id=` + id })
}
// 新增物料检验计数器
export const createCounter = async (data: CounterVO) => {
return await request.post({ url: `/basic/counter/create`, data })
return await request.post({ url: `/qms/counter/create`, data })
}
// 修改物料检验计数器
export const updateCounter = async (data: CounterVO) => {
return await request.put({ url: `/basic/counter/update`, data })
return await request.put({ url: `/qms/counter/update`, data })
}
// 删除物料检验计数器
export const deleteCounter = async (id: number) => {
return await request.delete({ url: `/basic/counter/delete?id=` + id })
return await request.delete({ url: `/qms/counter/delete?id=` + id })
}
// 导出物料检验计数器 Excel
export const exportCounter = async (params) => {
return await request.download({ url: `/basic/counter/export-excel`, params })
return await request.download({ url: `/qms/counter/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/basic/counter/get-import-template' })
return request.download({ url: '/qms/counter/get-import-template' })
}

18
src/api/qms/dynamicRule/index.ts

@ -1,7 +1,7 @@
import request from '@/config/axios'
export interface DynamicRuleVO {
code: string
number: string
describe: string
available: string
deletionTime: Date
@ -16,38 +16,38 @@ export const getDynamicRulePage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/basic/dynamic-rule/senior', data })
return await request.post({ url: '/qms/dynamic-rule/senior', data })
} else {
return await request.get({ url: `/basic/dynamic-rule/page`, params })
return await request.get({ url: `/qms/dynamic-rule/page`, params })
}
}
// 查询动态修改规则详情
export const getDynamicRule = async (id: number) => {
return await request.get({ url: `/basic/dynamic-rule/get?id=` + id })
return await request.get({ url: `/qms/dynamic-rule/get?id=` + id })
}
// 新增动态修改规则
export const createDynamicRule = async (data: DynamicRuleVO) => {
return await request.post({ url: `/basic/dynamic-rule/create`, data })
return await request.post({ url: `/qms/dynamic-rule/create`, data })
}
// 修改动态修改规则
export const updateDynamicRule = async (data: DynamicRuleVO) => {
return await request.put({ url: `/basic/dynamic-rule/update`, data })
return await request.put({ url: `/qms/dynamic-rule/update`, data })
}
// 删除动态修改规则
export const deleteDynamicRule = async (id: number) => {
return await request.delete({ url: `/basic/dynamic-rule/delete?id=` + id })
return await request.delete({ url: `/qms/dynamic-rule/delete?id=` + id })
}
// 导出动态修改规则 Excel
export const exportDynamicRule = async (params) => {
return await request.download({ url: `/basic/dynamic-rule/export-excel`, params })
return await request.download({ url: `/qms/dynamic-rule/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/basic/dynamic-rule/get-import-template' })
return request.download({ url: '/qms/dynamic-rule/get-import-template' })
}

19
src/api/qms/inspectionStage/index.ts

@ -1,7 +1,8 @@
import request from '@/config/axios'
export interface InspectionStageVO {
code: string
number: string
masterId: number
dynamicModifyCode: string
describe: string
okTimes: number
@ -24,38 +25,38 @@ export const getInspectionStagePage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/basic/inspection-stage/senior', data })
return await request.post({ url: '/qms/inspection-stage/senior', data })
} else {
return await request.get({ url: `/basic/inspection-stage/page`, params })
return await request.get({ url: `/qms/inspection-stage/page`, params })
}
}
// 查询检验阶段详情
export const getInspectionStage = async (id: number) => {
return await request.get({ url: `/basic/inspection-stage/get?id=` + id })
return await request.get({ url: `/qms/inspection-stage/get?id=` + id })
}
// 新增检验阶段
export const createInspectionStage = async (data: InspectionStageVO) => {
return await request.post({ url: `/basic/inspection-stage/create`, data })
return await request.post({ url: `/qms/inspection-stage/create`, data })
}
// 修改检验阶段
export const updateInspectionStage = async (data: InspectionStageVO) => {
return await request.put({ url: `/basic/inspection-stage/update`, data })
return await request.put({ url: `/qms/inspection-stage/update`, data })
}
// 删除检验阶段
export const deleteInspectionStage = async (id: number) => {
return await request.delete({ url: `/basic/inspection-stage/delete?id=` + id })
return await request.delete({ url: `/qms/inspection-stage/delete?id=` + id })
}
// 导出检验阶段 Excel
export const exportInspectionStage = async (params) => {
return await request.download({ url: `/basic/inspection-stage/export-excel`, params })
return await request.download({ url: `/qms/inspection-stage/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/basic/inspection-stage/get-import-template' })
return request.download({ url: '/qms/inspection-stage/get-import-template' })
}

696
src/components/BasicForm/src/BasicFormQms.vue

@ -0,0 +1,696 @@
<template>
<Dialog
:title="dialogTitle"
v-model="dialogVisible"
:width="dialogWidth"
:close-on-click-modal="false"
:vLoading="formLoading"
>
<div
style="max-height: 60vh;overflow-y: auto;">
<Form
ref="formRef"
:rules="rules"
:schema="formSchema"
:is-col="true"
@opensearchTable="opensearchTable"
@onChange="onChange"
@onBlur="onBlur"
>
<template #crontab="formSchema" v-if="fromeWhere == 'countPlan'">
<crontab v-model="formSchema.crontab" />
</template>
<template #type="formSchema" v-if="fromeWhere == 'countPlan'">
<el-select
v-model="formSchema.type"
placeholder="选择盘点类型"
@change="selectChange('type', $event)"
v-if="!isDetail"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.COUNT_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<el-select
v-model="formSchema.type"
placeholder="选择盘点范围类型"
@change="selectChangeDetail('type', $event,formSchema)"
v-if="isDetail"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.COUNT_SCOPE_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</template>
<template #value="formSchema" v-if="fromeWhere == 'countPlan'">
<el-select
v-model="formSchema.value"
placeholder="选择盘点范围值"
v-if="isDetail&& formTypeDetail =='Select'"
>
<el-option
v-for="dict in countPlanAllList"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<el-input v-model="formSchema.value" v-if="isDetail && formTypeDetail =='InputString'"/>
</template>
</Form>
<div class="table" v-if="isBusiness && formType == 'create' && fromeWhere != 'countPlan'">
<TableForm
ref="tableFormRef"
class="w-[100%]"
:tableFields="tableAllSchemas.tableFormColumns"
:tableData="tableData"
:tableFormRules="tableFormRules"
:isShowButton="isShowButton"
:isShowReduceButton="isShowReduceButton"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@tableSelectionChange="tableSelectionChange"
@extendedButtonsClick="extendedButtonsClick"
@formSelectChange="formSelectChange"
@formSelectvVisibleChange="formSelectvVisibleChange"
@tableSortChange="tableSortChange"
@selectCallback="selectCallback"
@handleTableSelect="handleTableSelect"
@inpuFocus="inpuFocus"
@buttonOperationClick="buttonOperationClick"
@inputStringBlur="inputStringBlur"
@inputNumberChange="inputNumberChange"
@tableFormSelectOnBlur="tableFormSelectOnBlur"
@formFormDateChange="formFormDateChange"
/>
</div>
<div v-if="isBusiness && formType == 'create' && fromeWhere == 'countPlan'">
<TableFormCountPlan
:tableFields="tableAllSchemas.tableFormColumns"
:tableData="tableData"
:countScopeType="countScopeType"
:tableFormRules="tableFormRules"
ref="tableFormRef"
@tableFormChange="tableFormChange"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
/>
</div>
</div>
<template #footer>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" />
</template>
</Dialog>
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" />
</template>
<script setup lang="ts">
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 TableFormCountPlan from '@/components/TableFormCountPlan/src/TableFormCountPlan.vue'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
const props = defineProps({
//
basicFormWidth: {
type: String,
default: ''
},
// TableForm /
isShowButton: {
type: Boolean,
default: true
},
// tableForm
isShowReduceButton: {
type: Boolean,
default: true
},
// rules
rules: {
type: Object,
required: true,
default: null
},
//
formAllSchemas: {
type: Object,
required: true,
default: null
},
//
tableAllSchemas: {
type: Array,
required: true,
default: null
},
//
tableData: {
type: Array,
required: true,
default: null
},
tableFormRules: {
type: Array,
required: true,
default: null
},
//
// searchTableParams: {
// type: Array,
// required: false,
// default: null
// },
// APIVo
apiVo: {
type: Object,
required: true,
default: null
},
// API
apiCreate: {
type: Function,
required: true,
default: null
},
// API
apiUpdate: {
type: Function,
required: true,
default: null
},
// tableForm
isBusiness: {
type: Boolean,
required: true,
default: true
},
// form
form: {
type: Object,
required: true,
default: null
},
//
detailData: {
type: Object,
required: true,
default: null
},
// //
// masterParmas: {
// type: Object,
// required: false,
// default: null
// },
// countPlan
fromeWhere: {
type: String,
required: false,
default: ''
},
//
countScopeType: {
type: Array,
required: false,
default: null
},
//
isDetail: {
type: Boolean,
required: false,
default: false
},
//
formTypeDetail: {
type: String,
required: false,
default: 'InputString'
},
//
countPlanAllList: {
type: Array,
required: false,
default: null
},
// or
isShowFooterButtton: {
type: Boolean,
required: false,
default: true
},
//
tableFormDataLength: {
type: Boolean,
required: false,
default: true
},
//
footButttondata: {
type: Array,
required: false,
default: null
},
//
isOpenSearchTable:{
type: Boolean,
required: false,
default: false
},
myFuncTypeSign:{
type: String,
required: false,
default: null
},
})
const { t } = useI18n() //
const message = useMessage() //
const dialogWidth = ref()
if (props.basicFormWidth) {
dialogWidth.value = props.basicFormWidth + '%'
} else {
dialogWidth.value = props.isBusiness ? '60%' : '40%'
}
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formRef = ref() // Ref
const formSchema = ref(props.formAllSchemas?.formSchema)
const tableAllSchemas = ref(props.tableAllSchemas)
const tableFormRules = ref(props.tableFormRules)
// -
// const buttondata = [
// defaultButtons.mainListEditBtn(null), //
// defaultButtons.mainListDeleteBtn(null)
// ]
// // -
// const buttonTableClick = async (val, row) => {
// if (val == 'edit') {
// } else if (val == 'delete') {
// } else {
// }
// }
/** 弹层操作 */
// formField form
// searchField
// type type=tableForm
// searchCondition
const searchTableRef = ref()
const opensearchTable = (
formField,
searchField,
searchTitle,
searchAllSchemas,
searchPage,
searchCondition,
multiple,
type,
row
) => {
const _searchCondition = {}
//
if (searchCondition && searchCondition.length > 0) {
//
let filters: any[] = []
for (var i=0; i< searchCondition.length; i++ ) {
// searchCondition.forEach((item) => {
// row
if (searchCondition[i].isMainValue) {
_searchCondition[searchCondition[i].key] = formRef.value.formModel[searchCondition[i].value]
? formRef.value.formModel[searchCondition[i].value]
: props.detailData
? props.detailData[searchCondition[i].value]
: row
? row[searchCondition[i].value]
: ''
//
let isNull = false
if (_searchCondition[searchCondition[i].key] == '' || _searchCondition[searchCondition[i].key] == undefined) {
isNull = true
}
if (isNull) {
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!')
return
}
} else {
//
if (searchCondition[i].isSearch) {
filters.push({
action: searchCondition[i].action,
column: searchCondition[i].key,
value: searchCondition[i].value
})
} else {
_searchCondition[searchCondition[i].key] = searchCondition[i].value
}
}
}
if (filters.length > 0) {
_searchCondition.isSearch = true
_searchCondition.filters = filters
}
}
const _searchTableTitle = searchTitle
const _searchTableAllSchemas = searchAllSchemas
const _searchTablePage = searchPage
searchTableRef.value.open(
_searchTableTitle,
_searchTableAllSchemas,
_searchTablePage,
formField,
searchField,
multiple,
type,
row,
_searchCondition
)
}
//
// val row
const searchTableSuccess = (formField, searchField, val, type, row) => {
emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row)
}
/** 打开弹窗 */
const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => {
dialogVisible.value = true
if (titleName) {
dialogTitle.value = t('action.' + titleName)
} else {
dialogTitle.value = t('action.' + type)
}
formType.value = type
resetForm()
//
// masterIdnumber
if (masterParmas) {
if (!row) {
if(props.myFuncTypeSign=='InspectionStage'){
row = {
masterId: masterParmas.masterId,
number: masterParmas.number,
dynamicModifyCode: masterParmas.number,
}
}else{
row = {
masterId: masterParmas.masterId,
number: masterParmas.number,
}
}
}
}
if (row?.id || row?.masterId) {
formLoading.value = true
try {
nextTick(() => {
formRef.value.setValues(row)
})
} finally {
formLoading.value = false
}
}
}
defineExpose({ open, formRef, opensearchTable, dialogVisible, formLoading }) // open
/** 弹窗按钮 */
let Butttondata:any = []
if (props.isShowFooterButtton) {
Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null) //
]
}
if (props.footButttondata) {
Butttondata = props.footButttondata
}
/** 按钮事件 */
const buttonBaseClick = (val) => {
//
if (props.footButttondata) {
emit('footButtonClick',val)
}
//
else if (val == 'save') {
submitForm()
}
//
else if (val == 'close') {
dialogVisible.value = false
}
}
/** 提交表单 */
// const emit = defineEmits(['success']) // success
const tableFormRef = ref()
const submitForm = async () => {
const elForm = unref(formRef)?.getElFormRef()
//
if (!elForm) return
const valid = await elForm.validate()
if (!valid) return
//
if (props.isBusiness) {
formLoading.value = true
if (formType.value == 'create') {
const validateForm = await tableFormRef.value.validateForm()
if (!validateForm && props.tableFormDataLength) {
if (props.tableData.length == 0) {
message.warning('请填写明细信息!')
formLoading.value = false
return
}
formLoading.value = false
return
}
//
try {
const data = unref(formRef)?.formModel
emit('submitForm', formType.value, data)
} finally {
}
} else {
//
try {
const data = unref(formRef)?.formModel
emit('submitForm', formType.value, data)
} finally {
}
}
} else {
//
formLoading.value = true
try {
const data = unref(formRef)?.formModel
emit('success', formType.value, data)
} finally {
formLoading.value = false
}
}
}
/** 重置表单 */
const resetForm = () => {
unref(formRef)?.resetFields()
}
//
const emit = defineEmits([
'success',
'tableSelectionChange',
'tableFormSelectOnBlur',
'extendedButtonsClick',
'formSelectChange',
'formSelectvVisibleChange',
'tableSortChange',
'selectCallback',
'handleTableSelect',
'handleDeleteTable',
'handleAddTable',
'inpuFocus',
'searchTableSuccess',
'opensearchTable',
'submitForm',
'selectChange',
'selectChangeDetail',
'tableFormChange',
'buttonOperationClick',
'inputStringBlur',
'onChange',
'onBlur',
'inputNumberChange',
'formFormDateChange',
'footButtonClick'
])
//
const formSelectChange = (field, val, row) => {
emit('formSelectChange', field, val, row)
}
//
const formFormDateChange = (field, val,row, index) => {
emit('formFormDateChange', field, val,row, index)
}
const formSelectvVisibleChange = (field, val, row) => {
emit('formSelectvVisibleChange', field, val, row)
}
// selection
const tableSelectionChange = (val) => {
emit('tableSelectionChange', val)
}
// tableform select bulr
const tableFormSelectOnBlur = (field, val, row, index) => {
emit('tableFormSelectOnBlur', field, val, row, index)
}
//
const tableSortChange = (column, prop, order) => {
emit('tableSortChange', column, prop, order)
}
// -
const inputNumberChange = (field, index, row, val) => {
emit('inputNumberChange', field, index, row, val)
}
//
// const showSelect = (val, statusID) => {
// return getDictForStatusID(val, statusID)
// }
//
const handleTableSelect = (row, column, event) => {
emit('handleTableSelect', row, column, event)
}
//
const handleDeleteTable = (row, index) => {
emit('handleDeleteTable', row, index,formRef.value)
}
//
const handleAddTable = () => {
if(props.isOpenSearchTable){
const tableFormKeys = {}
tableAllSchemas.value.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
inpuFocus(tableAllSchemas.value.tableFormColumns[0],tableFormKeys,0)
}else{
emit('handleAddTable')
}
}
//
const inpuFocus = (headerItem, row, index) => {
opensearchTable(
headerItem.field,
headerItem.tableForm.searchField,
headerItem.tableForm.searchTitle,
headerItem.tableForm.searchAllSchemas,
headerItem.tableForm.searchPage,
headerItem.tableForm.searchCondition,
headerItem.tableForm.multiple,
'tableForm',
row
)
}
/**
* 监听改变事件
* @param field 当前操作字段
* @param cur 改变后值
*/
const onChange = (field, cur) => {
emit('onChange', field, cur)
}
/**
* 监听失焦事件
* @param field 当前操作字段
* @param e
*/
const onBlur = (field, e) => {
emit('onBlur', field, e)
}
//
const selectChange = (field, val) => {
emit('selectChange', field, val)
}
//
const selectChangeDetail = (field, val,formSchema) => {
formSchema.value = ''
emit('selectChangeDetail', field, val)
}
const tableFormChange = (field, val, row) => {
emit('tableFormChange', field, val, row)
}
const buttonOperationClick = (row, label, index)=> {
emit("buttonOperationClick", row, label, index);
}
const inputStringBlur = (headerItem, row, index)=> {
emit("inputStringBlur", headerItem, row, index);
}
</script>
<style lang="scss" scoped>
.table {
border: 1px solid #dedede;
border-radius: 8px;
padding: 10px;
width: calc(100% - 32px);
display: flex;
}
::v-deep(.el-table__body) {
padding: 10px 0px;
}
::v-deep(.el-table--default .el-table__cell) {
padding: 2px 0px;
border: none;
}
::v-deep(.el-table td.el-table__cell .el-form-item__content) {
display: flex !important;
align-items: center !important;
justify-content: center !important;
}
::v-deep(.el-table td.el-table__cell div) {
overflow: visible;
}
::v-deep(.el-icon) {
display: block;
}button
.button {
> div {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
> div {
margin-left: 6px;
text-decoration: underline;
color: #409eff;
}
}
}
</style>

1
src/components/Detail/src/Detail.vue

@ -457,6 +457,7 @@ const formRef = ref()
const titleNameRef = ref()
const titleValueRef = ref()
const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => {
debugger
titleNameRef.value = titleName
titleValueRef.value = titleValue
remarksData.data = {

846
src/components/Detail/src/DetailQms.vue

@ -0,0 +1,846 @@
<template>
<div>
<el-drawer
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 ref="tabRef" :tabsList="tabsList" :current="current" @change="change" />
<div class="flex">
<!-- 详情 -->
<ContentWrap class="w-[100%]" v-show="tabsList[current].label!='附件'&&tabsList[current].label!='备注'&&tabsList[current].label!='变更记录'"> <!-- 列表头部 -->
<TableHead
v-if="!isBasic"
:HeadButttondata="HeadButttondata"
:masterId="masterParmas.masterId"
@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>
<!-- 附件/备注/变更记录 -->
<ContentWrap class="w-[100%]" v-show="tabsList[current].label=='附件'||tabsList[current].label=='备注'||tabsList[current].label=='变更记录'" :style="{height:remarkHeight+'px'}">
<!-- 附件组件 -->
<ElScrollbar ref="scrollbar" :style="{height:(remarkHeight-40)+'px'}">
<Annex v-show="tabsList[current].label=='附件'"
:annexData="annexData"
@handleAnnexSuccess="handleAnnexSuccess"
@deleteAnnexSuccess="deleteAnnexSuccess"
:upData="remarksData.data"
/>
<!-- 备注组件 -->
<Remarks v-show="tabsList[current].label=='备注'"
:remarksData="remarksData"
class="mt-20px"
@remarksSubmitScuess="remarksSubmitScuess"
/>
<!-- 变更记录组件 -->
<ChangeRecord v-show="tabsList[current].label=='变更记录'" :changeRecordData="changeRecordData" class="mt-20px" />
</ElScrollbar>
</ContentWrap>
</div>
</el-drawer>
<!-- 表格弹窗 -->
<SearchTable ref="searchTableRef" @search-table-success="searchTableSuccess1" />
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="formRef"
@success="submitForm"
:rules="detailAllSchemasRules"
:formAllSchemas="detailAllSchemas"
:isBusiness="false"
:apiUpdate="apiUpdate"
:apiCreate="apiCreate"
:fromeWhere="fromeWhere"
:isDetail="true"
@searchTableSuccess="searchTableSuccess"
:detailData="detailData"
@submitForm="submitForm"
@selectChangeDetail="selectChangeDetail"
:formTypeDetail="formTypeDetail"
:countPlanAllList="countPlanAllList"
@onChange="detailBasicFormOnChange"
@onBlur="onBlur"
@formFormDateChange="formFormDateChange"
:myFuncTypeSign="myFuncTypeSign"
/>
</div>
</template>
<script lang="ts" setup>
import Annex from '@/components/Annex/src/Annex.vue'
import Remarks from '@/components/Remarks/src/Remarks.vue'
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/BasicFormQms.vue'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import DetailTable from '@/components/DetailTable/src/DetailTable.vue'
import { SearchTable } from '@/components/SearchTable'
defineOptions({ name: 'DetailQms' })
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
},
//
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
},
//
detailButtonIsShowFilter:{
type: Boolean,
required: false,
default: true
},
//
detailButtonIsShowAdd:{
type: Boolean,
required: false,
default: true
},
//
detailButtonIsShowEdit:{
type: Boolean,
required: false,
default: true
},
//
detailButtonIsShowDelete:{
type: Boolean,
required: false,
default: true
},
//
isOpenSearchTable:{
type: Boolean,
required: false,
default: false
},
//
myFuncTypeSign:{
type: String,
required: false,
default: null
},
})
const isShowDrawer = ref(false)
const detailLoading = ref(false)
const myFuncTypeSign = props.myFuncTypeSign
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'
}
]
}
}
const otherList = []
tabsList.value = [...tabsList?.value,...otherList]
if (!tabsList.value || tabsList.value && tabsList.value.length == otherList.length) {
tabsList.value.unshift({
label: '明细',
prop: 'Detail'
})
}
// Tabs
const tabRef = ref()
//
const scrollbar = ref()
//
const remarkHeight = computed(() => {
const tab = unref(tabRef)
const tabTop = tab?.$el.getBoundingClientRect().top
const tabHeight = tab?.$el.getBoundingClientRect().height
console.log('tabTop',tabTop)
const height = window.innerHeight - (tabTop) - (tabHeight) - 60
return height
})
//
const annexData = reactive({
annexList: []
})
//
const remarksData = reactive({
remarksList: [],
data: {}
})
//
const changeRecordData = reactive({
changeRecordList: []
})
const detailData = ref({}) //
//
const getFileList = async () => {
detailLoading.value = true
try {
annexData.annexList = await FileApi.getFileList(remarksData.data)
} finally {
detailLoading.value = false
}
}
/** 添加附件 */
const handleAnnexSuccess = () => {
getFileList()
getChangeRecordList()
}
//
const deleteAnnexSuccess = async () => {
getFileList()
getChangeRecordList()
}
// Tabs
const current = ref(0)
const change = (item, index) => {
current.value = index
emit('changeTabs', item)
if(otherList.find(other=>other.label==item.label)){
// // --
scrollbar.value.scrollTo({ top: 0});
}
}
//
const masterParmas = ref({
masterId: '', //id
number: '', //
status: '', //
})
//
const HeadButttondata = ref()
// -
const buttondata = ref()
/** 表格弹窗 */
const initModel = (schema: FormSchema[], formModel: Recordable) => {
const model: Recordable = { ...formModel }
schema.map((v) => {
// hidden
if (v.hidden) {
delete model[v.field]
} else if (v.component && v.component !== 'Divider') {
const hasField = Reflect.has(model, v.field)
//
model[v.field] = hasField ? model[v.field] : v.value !== void 0 ? v.value : ''
}
})
return model
}
const searchTableRef = ref()
//
const searchTableFormModel = ref<Recordable>({})
if(props.isOpenSearchTable){
searchTableFormModel.value = initModel(props.detailAllSchemas.formSchema, unref(searchTableFormModel))
}
const searchTableFormType = ref('') // create - update -
/** 打开弹窗 */
const formRef = 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.masterId = row.id
masterParmas.value.number = row.number
masterParmas.value.status = row.status
tableObjectRef.value.params = {
masterId: row.id
}
await getList()
}
isShowDrawer.value = true
if (row) {
detailLoading.value = true
try {
detailData.value = row
// getRemarkList()
// getFileList()
// getChangeRecordList()
//
let detailButtonFilter: any = []
let detailButtonAdd: any = []
if (props.detailButtonIsShowFilter) {
//
detailButtonFilter = [
defaultButtons.defaultFilterBtn(null)
]
}
if (props.detailButtonIsShowAdd) {
//
detailButtonAdd = [
defaultButtons.defaultAddBtn({
hide: isShowMainButton(row, ['1'])
})
]
}
HeadButttondata.value = [...detailButtonFilter,...detailButtonAdd]
//
if (routeName.value.indexOf('Job') > -1) {
HeadButttondata.value = [
defaultButtons.defaultFilterBtn(null) //
]
}
let detailButtonEdit: any = []
let detailButtonDelete: any = []
if (props.detailButtonIsShowEdit) {
//
detailButtonEdit = [
defaultButtons.mainListEditBtn({
hide: isShowMainButton(row, ['1'])
})
]
}
if (props.detailButtonIsShowDelete) {
//
detailButtonDelete = [
defaultButtons.mainListDeleteBtn({
hide: isShowMainButton(row, ['1'])
})
]
}
buttondata.value = [...detailButtonEdit,...detailButtonDelete,...props.buttondataTable]
} finally {
detailLoading.value = false
}
}
}
defineExpose({ openDetail, formRef }) // open
//
const getRemarkList = async () => {
detailLoading.value = true
try {
remarksData.remarksList = await RemarkApi.getRemarkPage(remarksData.data)
} finally {
detailLoading.value = false
}
}
//
const remarksSubmitScuess = async (remark) => {
detailLoading.value = false
getRemarkList()
getChangeRecordList()
}
//
const getChangeRecordList = async () => {
changeRecordData.changeRecordList = await RemarkApi.getChangeRecordPage(remarksData.data)
}
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) => {
// if (val.indexOf(row.status) > -1) {
// return false
// } else {
// return true
// }
return false
}
//
const { getList } = tableMethodsRef.value
//
const buttonBaseClick = (val, item) => {
if (val == 'add') {
//
if(props.isOpenSearchTable){
searchTableFormType.value = 'create'
//
searchTableFormModel.value = Object.assign(unref(searchTableFormModel), {
masterId: masterParmas.value.masterId,
number: masterParmas.value.number
})
const item = props.detailAllSchemas.formSchema[0]
opensearchTable(
item.field, item?.componentProps?.searchField,
item?.componentProps?.searchTitle,
item?.componentProps?.searchAllSchemas,
item?.componentProps?.searchPage,
item?.componentProps?.searchCondition,
item?.componentProps?.multiple,
undefined,undefined
)
}else{
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)
}
}
// --> isOpenSearchTable === true
const opensearchTable = (
formField,
searchField,
searchTitle,
searchAllSchemas,
searchPage,
searchCondition,
multiple,
type,
row
) => {
const _searchCondition = {}
//
if (searchCondition && searchCondition.length > 0) {
//
for (var i=0; i< searchCondition.length; i++ ) {
// row
if (searchCondition[i].isMainValue) {
_searchCondition[searchCondition[i].key] = detailData
? detailData.value[searchCondition[i].value]
: ''
}else{
_searchCondition[searchCondition[i].key] = searchCondition[i].value
}
}
}
console.log(searchCondition)
console.log(_searchCondition)
searchTableRef.value.open(
searchTitle,
searchAllSchemas,
searchPage,
formField,
searchField,
multiple,
type,
row,
_searchCondition
)
}
//
// const updataTableColumns = (val) => {
// detailAllSchemas.tableColumns.value = val
// }
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') {
//
if(props.isOpenSearchTable){
searchTableFormType.value = 'update'
if (row?.id || row?.masterId) {
searchTableFormModel.value = Object.assign(unref(searchTableFormModel), row)
}
const item = props.detailAllSchemas.formSchema[0]
opensearchTable(
item.field, item?.componentProps?.searchField,
item?.componentProps?.searchTitle,
item?.componentProps?.searchAllSchemas,
item?.componentProps?.searchPage,
item?.componentProps?.searchCondition,
item?.componentProps?.multiple,
undefined,undefined
)
}else{
openForm('update', row)
}
} else if (val == 'delete') {
//
handleDelete(row.id)
} else {
emit('tableFormButton',val, row)
}
}
/** 添加/修改操作 */
const openForm = async (type: string, row?: number) => {
formRef.value.open(type, row, masterParmas.value)
emit('detailOpenForm', type, row, masterParmas.value)
}
// form
const submitForm = async (formType, data) => {
try {
// detailValidate
const rs = (await props.detailValidate) ? await props.detailValidate(data) : true
if (!rs) return
if (formType === 'create') {
await props.apiCreate(data)
message.success(t('common.createSuccess'))
} else {
await props.apiUpdate(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
await getList()
updateKey.value += 1
} finally {
formRef.value.formLoading = false
}
}
const searchTableSuccess1 = (formField, searchField, val, formRef) => {
searchTableFormModel.value[formField] = val.map(item=>item[searchField]).join(',')
console.log('searchTableSuccess1',searchTableFormModel)
submitForm(searchTableFormType.value,searchTableFormModel.value)
emit('searchTableSuccessDetail', formField, searchField, val, formRef)
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
emit('searchTableSuccessDetail', formField, searchField, val, formRef)
}
//
const emit = defineEmits([
'searchTableSuccessDetail',
'changeTabs',
'selectChangeDetail',
'detailOpenForm',
'tableFormButton',
'openImage',
'onBlur',
'detailBasicFormOnChange',
'formFormDateChange'
])
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
tableObject.loading = true
//
await props.apiDelete(id)
tableObject.loading = false
message.success(t('common.delSuccess'))
//
await getList()
updateKey.value += 1
} catch {}
}
//
const searchFormClick = async (searchData) => {
const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage //
})
tableObject.params = {
isSearch: true,
filters: searchData.filters
? searchData.filters
: [{ column: 'masterId', action: '==', value: masterParmas.value.masterId }]
}
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)
}
/**
* 监听改变事件
* @param field 当前操作字段
* @param cur 改变后值
*/
const detailBasicFormOnChange = (field, cur) => {
emit('detailBasicFormOnChange', field, cur)
}
/**
* 监听失焦事件
* @param field 当前操作字段
* @param e
*/
const onBlur = (field, e) => {
emit('onBlur', field, e)
}
//
const formFormDateChange = (field, val,row, index) => {
emit('formFormDateChange', field, val,row, index)
}
//
watch(
() => props.apiPage,
() => {
const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage //
})
tableObject.params.masterId = masterParmas.value.masterId
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>

4
src/utils/dict.ts

@ -292,6 +292,7 @@ export enum DICT_TYPE {
EVALUATION_MODE = "evaluation_mode", // 评估模式
INSPECTION_CHARACTERISTICS_FEATURE_TYPE = "inspection_characteristics_feature_type", // 特征类型
INSPECTION_CHARACTERISTICS_RESULT_ENTRY = "inspection_characteristics_result_entry", // 结果录入方式
INSPECTION_SEVERITY = 'inspection_severity',//检验严重性
// ========== 业务 - mes -gaojs ==========
@ -302,6 +303,7 @@ export enum DICT_TYPE {
OPERSTEP_COLLECT_TYPE='operstep_collect_type',//操作步骤采集方式
REWORK_TYPE='rework_type',//工作类型:返工登记、返修登记
REWORK_STATUS='rework_status',//返工返修状态:待返修,返修中,返修完成
REWORK_REPLACE_FLAG='rework_replace_flag',//是否有替换件
REWORK_REPLACE_FLAG = 'rework_replace_flag',//是否有替换件
}

140
src/views/qms/basicDataManage/dynamicRule/dynamicRule.data.ts

@ -1,19 +1,27 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import { string } from 'vue-types'
const trueFalse = [{
label: '是',
value: true
}, {
label: '否',
value: false
}]
// 表单校验
export const DynamicRuleRules = reactive({
code: [required],
available: [required],
concurrencyStamp: [required]
describe: [required]
})
export const DynamicRule = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编码',
field: 'code',
field: 'number',
sort: 'custom',
isSearch: true
isSearch: true,
isForm: false,
},
{
label: '描述',
@ -22,84 +30,122 @@ export const DynamicRule = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true
},
{
label: '是否可用',
field: 'available',
label: '操作',
field: 'action',
isForm: false,
isDetail: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
// 表单校验
export const InspectionStageRules = reactive({
dynamicModifyCode: [required],
okTimes: [required],
okTimeStage: [required],
noOkTimes: [required],
noOkTimeStage: [required],
isStartStage: [required],
skipInspection: [required],
inspectionStringency: [required],
})
export const InspectionStage = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '描述',
field: 'describe',
sort: 'custom',
isSearch: true
},
{
label: '创建时间',
field: 'createTime',
label: 'OK次数',
field: 'okTimes',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
form: {
component: 'InputNumber',
value: 0
}
},
isForm: false
},
{
label: '删除时间',
field: 'deletionTime',
label: 'OK次数后的阶段',
field: 'okTimeStage',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
form: {
component: 'InputNumber',
value: 0
}
},
{
label: 'NOK次数',
field: 'noOkTimes',
sort: 'custom',
isSearch: true,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
component: 'InputNumber',
value: 0
}
},
{
label: '删除者ID',
field: 'deleterId',
label: 'NOK次数后的阶段',
field: 'noOkTimeStage',
sort: 'custom',
isSearch: true
isSearch: true,
form: {
component: 'InputNumber',
value: 0
}
},
{
label: '扩展属性',
field: 'extraProperties',
label: '是否是起始阶段',
field: 'isStartStage',
sort: 'custom',
isSearch: true
isSearch: true,
formatter: (_: Recordable, __: TableColumn, cellValue: boolean) => {
return trueFalse.find((account) => account.value == cellValue)?.label
},
form: {
component: 'Switch',
value:true
}
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
label: '是否略过检验',
field: 'skipInspection',
sort: 'custom',
isSearch: true,
formatter: (_: Recordable, __: TableColumn, cellValue: boolean) => {
return trueFalse.find((account) => account.value == cellValue)?.label
},
form: {
component: 'InputNumber',
value: 0
component: 'Switch',
value:true
}
},
{
label: '地点id',
field: 'siteId',
label: '检验严格性',
field: 'inspectionStringency',
sort: 'custom',
isSearch: true
isSearch: true,
dictType: DICT_TYPE.INSPECTION_SEVERITY,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
form: {
component: 'Select'
},
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
width: 300,
fixed: 'right'
}
},
isTableForm: false,
}
]))

99
src/views/qms/basicDataManage/dynamicRule/index.vue

@ -27,9 +27,9 @@
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
<template #number="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row }">
@ -44,14 +44,39 @@
@success="formsSuccess"
:rules="DynamicRuleRules"
:formAllSchemas="DynamicRule.allSchemas"
:tableAllSchemas="InspectionStage.allSchemas"
:tableFormRules="InspectionStageRules"
:tableData="tableData"
:apiUpdate="DynamicRuleApi.updateDynamicRule"
:apiCreate="DynamicRuleApi.createDynamicRule"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
:isBusiness="true"
@onChange="onChange"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@submitForm="submitForm"
:isSearchTableItem="true"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="DynamicRule.allSchemas" />
<DetailQms
ref="detailRef"
:isBasic="false"
:allSchemas="DynamicRule.allSchemas"
:detailAllSchemas="InspectionStage.allSchemas"
:detailAllSchemasRules="InspectionStageRules"
:apiCreate="InspectionStageApi.createInspectionStage"
:apiUpdate="InspectionStageApi.updateInspectionStage"
:apiPage="InspectionStageApi.getInspectionStagePage"
:apiDelete="InspectionStageApi.deleteInspectionStage"
:detailValidate="detailValidate"
@searchTableSuccessDetail="searchTableSuccessDetail"
:detailButtonIsShowEdit=true
:detailButtonIsShowAdd=true
:detailButtonIsShowDelete=true
@detailOpenForm="detailOpenForm"
myFuncTypeSign="InspectionStage"
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/basic/dynamic-rule/import" :importTemplateData="importTemplateData" @success="importSuccess" />
@ -59,9 +84,11 @@
<script setup lang="ts">
import download from '@/utils/download'
import { DynamicRule,DynamicRuleRules } from './dynamicRule.data'
import { DynamicRule,DynamicRuleRules,InspectionStage,InspectionStageRules } from './dynamicRule.data'
import * as DynamicRuleApi from '@/api/qms/dynamicRule'
import * as InspectionStageApi from '@/api/qms/inspectionStage'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
// import TableHead from '@/components/TableHead/src/TableHead.vue'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
// import Detail from '@/components/Detail/src/Detail.vue'
@ -73,6 +100,7 @@ const { t } = useI18n() // 国际化
const route = useRoute() //
const routeName = ref()
const tableData = ref([])
routeName.value = route.name
const tableColumns = ref(DynamicRule.allSchemas.tableColumns)
@ -99,9 +127,9 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:dynamicRule:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:dynamicRule:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:dynamicRule:export'}), //
defaultButtons.defaultAddBtn({hasPermi:'qms:dynamic-rule:create'}), //
// defaultButtons.defaultImportBtn({hasPermi:'qms:dynamic-rule:import'}), //
// defaultButtons.defaultExportBtn({hasPermi:'qms:dynamic-rule:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
@ -133,8 +161,8 @@ const buttonBaseClick = (val, item) => {
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:dynamicRule:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:dynamicRule:delete'}), //
defaultButtons.mainListEditBtn({hasPermi:'qms:dynamic-rule:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'qms:dynamic-rule:delete'}), //
]
// -
@ -148,7 +176,8 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
const openForm = async (type: string, row?: any) => {
tableData.value = []
basicFormRef.value.open(type, row)
}
@ -235,6 +264,52 @@ const searchFormClick = (searchData) => {
getList() //
}
const tableFormKeys = {}
InspectionStage.allSchemas.tableFormColumns.forEach((item) => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
//
const handleAddTable = () => {
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
}
//
const handleDeleteTable = (item, index) => {
tableData.value.splice(index, 1)
}
//
const submitForm = async (formType, data) => {
data.inspectionStageDOList = tableData.value//
console.log(data.subList)
try {
if (formType === 'create') {
await DynamicRuleApi.createDynamicRule(data)
message.success(t('common.createSuccess'))
} else {
await DynamicRuleApi.updateDynamicRule(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
//
getList()
} finally {
basicFormRef.value.formLoading = false
}
}
const detailValidate = (data) => {
let tag = true;
return tag
}
const detailOpenForm = (type, row, masterParmas) => {
if(type='create'){
}
}
/** 初始化 **/
onMounted(async () => {
getList()

2
src/views/qms/basicDataManage/inspectionStage/inspectionStage.data.ts

@ -19,7 +19,7 @@ export const InspectionStageRules = reactive({
export const InspectionStage = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编码',
field: 'code',
field: 'number',
sort: 'custom',
isSearch: true
},

Loading…
Cancel
Save