Browse Source

HL-5471检验工序可以拖动移动排序

hella_online_20240828
zhang_li 3 months ago
parent
commit
73ac7eb3b3
  1. 192
      src/views/qms/inspectionScheme/addForm.vue
  2. 206
      src/views/qms/inspectionTemplate/addForm.vue

192
src/views/qms/inspectionScheme/addForm.vue

@ -247,57 +247,43 @@
</el-col> --> </el-col> -->
</el-row> </el-row>
</el-form> </el-form>
<el-tabs <div class="main-body">
v-model="editableTabsValue" <div class="left">
closable <!-- <div class="plus-icon" @click="handleTabsEdit('', 'add')">
class="demo-tabs" <el-icon><Plus /></el-icon>
@edit="handleTabsEdit" </div> -->
type="border-card" <draggable
tab-position="left" :list="data.process"
:stretch="false" :disabled="!data.enabled"
item-key="name"
ghost-class="ghost"
chosen-class="chosen"
animation="300"
@change="handleChange"
> >
<el-tab-pane <template #item="{ element, index }">
v-for="item in data.process" <div
:key="item.name" class="tabs-label"
:label="item.description" :class="element.name == editableTabsValue ? 'active' : ''"
:name="item.name" @click.stop="chooseTabs(element, index)"
> >
<!-- <el-col :span="12"> <span>{{ element.description }}</span>
<el-form-item label="动态修改规则" prop="dynamicUpdateCode"> <!-- <el-icon
<div style="display: flex; width: 100%"> color="#67C23A"
<el-input @click.stop="copy(element)"
v-model="data.dynamicUpdateName" style="margin-left: 10px; margin-right: 10px"
disabled ><CopyDocument
placeholder="请选择动态修改规则" /></el-icon> -->
/> <el-icon color="#409efc" @click.stop="handleTabsEdit(element.name, 'remove')"
<el-button ><Close
type="info" /></el-icon>
plain
style="width: 40px"
@click="
opensearchTable(
'dynamicUpdateCode',
null,
'动态修改规则',
DynamicRule.allSchemas,
DynamicRuleApi.getDynamicRulePage,
[
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
],
false,
'main',
data
)
"
><Icon icon="ep:search"
/></el-button>
</div> </div>
</el-form-item> </template>
</el-col> --> </draggable>
</div>
<div class="right">
<div v-for="(item, index) in data.process" :key="index">
<div v-show="item.name == editableTabsValue">
<div class="small-title">检验工序</div> <div class="small-title">检验工序</div>
<el-form :model="item" label-width="auto" :rules="rules" ref="formProcessRef"> <el-form :model="item" label-width="auto" :rules="rules" ref="formProcessRef">
<el-row :gutter="20"> <el-row :gutter="20">
@ -322,7 +308,7 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="顺序号" prop="sequenceCode"> <el-form-item label="顺序号" prop="sequenceCode">
<el-input v-model="item.sequenceCode" /> <el-input v-model="item.sequenceCode" disabled/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -423,7 +409,11 @@
v-model="item.inspectionCharacteristicsBaseVO.samplingProcessCode" v-model="item.inspectionCharacteristicsBaseVO.samplingProcessCode"
placeholder="请选择采样过程" placeholder="请选择采样过程"
@blur=" @blur="
onBlur('samplingProcess', SamplingProcessApi.getSamplingProcessPage, item) onBlur(
'samplingProcess',
SamplingProcessApi.getSamplingProcessPage,
item
)
" "
@focus="onFocus" @focus="onFocus"
/> />
@ -501,7 +491,10 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="特征类型" prop="inspectionCharacteristicsBaseVO.featureType"> <el-form-item
label="特征类型"
prop="inspectionCharacteristicsBaseVO.featureType"
>
<!-- <el-input v-model="item.featureType" /> --> <!-- <el-input v-model="item.featureType" /> -->
<el-select <el-select
v-model="item.inspectionCharacteristicsBaseVO.featureType" v-model="item.inspectionCharacteristicsBaseVO.featureType"
@ -521,7 +514,10 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"> <el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0">
<el-form-item label="计量单位" prop="inspectionCharacteristicsBaseVO.quantifyUom"> <el-form-item
label="计量单位"
prop="inspectionCharacteristicsBaseVO.quantifyUom"
>
<el-input <el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyUom" v-model="item.inspectionCharacteristicsBaseVO.quantifyUom"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate" :disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
@ -641,7 +637,9 @@
<el-input <el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode" v-model="item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode"
placeholder="请选择选定集" placeholder="请选择选定集"
@blur="onBlur('quantifyQuantify', SelectedSetApi.getSelectedSetPage, item)" @blur="
onBlur('quantifyQuantify', SelectedSetApi.getSelectedSetPage, item)
"
@focus="onFocus" @focus="onFocus"
/> />
<el-button <el-button
@ -689,8 +687,10 @@
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
</el-tab-pane> </div>
</el-tabs> </div>
</div>
</div>
</div> </div>
<template #footer> <template #footer>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" :key="count" /> <ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" :key="count" />
@ -739,6 +739,8 @@ import { DynamicRule } from '@/views/qms/dynamicRule/dynamicRule.data' //动态
import * as SelectedSetApi from '@/api/qms/selectedSet' // import * as SelectedSetApi from '@/api/qms/selectedSet' //
import { SelectedSet } from '@/views/qms/selectedSet/selectedSet.data' // import { SelectedSet } from '@/views/qms/selectedSet/selectedSet.data' //
import { validateInteger, validateMaxNumber5, validateTwoNum } from '@/utils/validator' import { validateInteger, validateMaxNumber5, validateTwoNum } from '@/utils/validator'
import { Plus, Close, CopyDocument } from '@element-plus/icons-vue'
import draggable from 'vuedraggable'
const message = useMessage() // const message = useMessage() //
@ -785,6 +787,8 @@ const formFeaturesRef = ref()
const formProcessRef = ref() const formProcessRef = ref()
const data = ref({ const data = ref({
enabled: true,
dragging: false,
code: '', code: '',
itemCode: '', itemCode: '',
version: '', version: '',
@ -876,7 +880,7 @@ const rules = ref({
}) })
const isShowField = ref(0) //aql 0 0 const isShowField = ref(0) //aql 0 0
/** 打开弹窗 */ /** 打开弹窗 */
let tabIndex = 1 const sequenceCode = ref(0)
const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => { const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => {
dialogVisible.value = true dialogVisible.value = true
if (titleName) { if (titleName) {
@ -888,6 +892,8 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
isShowField.value = 0 //isShowField == 0aql isShowField.value = 0 //isShowField == 0aql
if (row) { if (row) {
data.value = JSON.parse(JSON.stringify(row)) data.value = JSON.parse(JSON.stringify(row))
data.value.enabled = true
data.value.dragging = false
// //
if (formType.value == 'create') { if (formType.value == 'create') {
data.value.id = '' data.value.id = ''
@ -996,6 +1002,8 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
} }
} else { } else {
data.value = { data.value = {
enabled: true,
dragging: false,
code: '', code: '',
itemCode: '', itemCode: '',
version: '', version: '',
@ -1014,8 +1022,7 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
process: [] process: []
} }
} }
sequenceCode.value = data.value.process.length + 1
tabIndex = data.value.process.length + 1
} }
defineExpose({ open, dialogVisible, formLoading }) // open defineExpose({ open, dialogVisible, formLoading }) // open
import type { TabPaneName } from 'element-plus' import type { TabPaneName } from 'element-plus'
@ -1027,6 +1034,7 @@ const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' |
if (action === 'add') { if (action === 'add') {
nameForm.value.name = '' nameForm.value.name = ''
dialogVisibleName.value = true dialogVisibleName.value = true
sequenceCode.value = data.value.process.length + 1
} else if (action === 'remove') { } else if (action === 'remove') {
const tabs = data.value.process const tabs = data.value.process
let activeName = editableTabsValue.value let activeName = editableTabsValue.value
@ -1042,6 +1050,9 @@ const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' |
} }
editableTabsValue.value = activeName editableTabsValue.value = activeName
data.value.process = tabs.filter((tab) => tab.name !== targetName) data.value.process = tabs.filter((tab) => tab.name !== targetName)
data.value.process.forEach((item, index) => {
item.sequenceCode = index + 1
})
} }
} }
/** 修改名称时间 */ /** 修改名称时间 */
@ -1051,8 +1062,11 @@ const buttonBaseClick1 = (val) => {
if (!nameRef.value) return if (!nameRef.value) return
nameRef.value.validate((valid, fields) => { nameRef.value.validate((valid, fields) => {
if (valid) { if (valid) {
const newTabName = `${++tabIndex}` let newTabName = 1
data.value.process.push({ if (data.value.process && data.value.process.length > 0) {
newTabName = data.value.process[data.value.process.length - 1].name + 1
}
let obj = {
description: nameForm.value.name, description: nameForm.value.name,
name: newTabName, name: newTabName,
inspectionCode: '', inspectionCode: '',
@ -1078,9 +1092,8 @@ const buttonBaseClick1 = (val) => {
quantifyDecimal: '', quantifyDecimal: '',
quantifyQuantifyCode: '' quantifyQuantifyCode: ''
} }
}) }
console.log(data.value.process) data.value.process.push(obj)
editableTabsValue.value = newTabName editableTabsValue.value = newTabName
dialogVisibleName.value = false dialogVisibleName.value = false
} else { } else {
@ -1449,7 +1462,7 @@ const changeIsTarget = (e, item) => {
} }
} }
// //
const onItemBlur= async (field, pageApi, item) => { const onItemBlur = async (field, pageApi, item) => {
const dataObj = item ? item.inspectionCharacteristicsBaseVO : data.value const dataObj = item ? item.inspectionCharacteristicsBaseVO : data.value
if (dataObj[field + 'Code']) { if (dataObj[field + 'Code']) {
const _searchCondition = {} const _searchCondition = {}
@ -1546,6 +1559,16 @@ const onFocus = () => {
] ]
count.value++ count.value++
} }
const chooseTabs = (element, index) => {
if (element.name == editableTabsValue.value) return
editableTabsValue.value = element.name
}
const handleChange = (e) => {
editableTabsValue.value = e.moved.element.name
data.value.process.forEach((item, index) => {
item.sequenceCode = index + 1
})
}
</script> </script>
<style scoped> <style scoped>
.small-title { .small-title {
@ -1554,6 +1577,47 @@ const onFocus = () => {
color: #1a8bfc; color: #1a8bfc;
font-size: 16px; font-size: 16px;
} }
.main-body {
display: flex;
.left {
width: 200px;
background: rgb(245, 247, 250);
border: 1px solid rgb(220, 223, 230);
min-height: 60px;
position: relative;
padding: 6px 0px;
.plus-icon {
cursor: pointer;
position: absolute;
right: 0px;
top: 0px;
border: 1px solid rgb(220, 223, 230);
background: rgb(245, 247, 250);
display: flex;
align-items: center;
justify-items: center;
padding: 1px;
}
}
}
.tabs-label {
padding: 4px 20px 4px 20px;
min-height: 30px;
justify-content: flex-end;
display: flex;
align-items: center;
cursor: pointer;
word-break: break-all;
}
.active {
background: white;
}
.right {
border: 1px solid rgb(220, 223, 230);
flex: 1;
width: 0px;
padding: 20px;
}
</style> </style>
<style> <style>
.el-tabs--left .el-tabs__header.is-left { .el-tabs--left .el-tabs__header.is-left {

206
src/views/qms/inspectionTemplate/addForm.vue

@ -75,32 +75,43 @@
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<el-tabs <div class="main-body">
v-model="editableTabsValue" <div class="left">
editable <div class="plus-icon" @click="handleTabsEdit('', 'add')">
class="demo-tabs" <el-icon><Plus /></el-icon>
@edit="handleTabsEdit" </div>
type="border-card" <draggable
tab-position="left" :list="data.process"
:stretch="false" :disabled="!data.enabled"
item-key="name"
ghost-class="ghost"
chosen-class="chosen"
animation="300"
@change="handleChange"
> >
<el-tab-pane <template #item="{ element, index }">
v-for="item in data.process" <div
:key="item.name" class="tabs-label"
:label="item.description" :class="element.name == editableTabsValue ? 'active' : ''"
:name="item.name" @click.stop="chooseTabs(element, index)"
> >
<template #label> <span>{{ element.description }}</span>
<span class="custom-tabs-label" style="display: flex; align-items: center"> <el-icon
<span>{{ item.description }}</span>
<Icon
icon="ep:document-copy"
color="#67C23A" color="#67C23A"
style="margin-left: 10px" @click.stop="copy(element)"
@click.stop="copy(item)" style="margin-left: 10px; margin-right: 10px"
/> ><CopyDocument
</span> /></el-icon>
<el-icon color="#409efc" @click.stop="handleTabsEdit(element.name, 'remove')"
><Close
/></el-icon>
</div>
</template> </template>
</draggable>
</div>
<div class="right">
<div v-for="(item, index) in data.process" :key="index">
<div v-show="item.name == editableTabsValue">
<div class="small-title">检验工序</div> <div class="small-title">检验工序</div>
<!-- <Form <!-- <Form
:ref="`formRefProcess`+index" :ref="`formRefProcess`+index"
@ -132,7 +143,7 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="顺序号" prop="sequenceCode"> <el-form-item label="顺序号" prop="sequenceCode">
<el-input v-model="item.sequenceCode" type="number" /> <el-input v-model="item.sequenceCode" type="number" disabled="true" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- <el-col :span="12"> <!-- <el-col :span="12">
@ -233,7 +244,11 @@
v-model="item.inspectionCharacteristicsBaseVO.samplingProcessCode" v-model="item.inspectionCharacteristicsBaseVO.samplingProcessCode"
placeholder="请选择采样过程" placeholder="请选择采样过程"
@blur=" @blur="
onBlur('samplingProcess', SamplingProcessApi.getSamplingProcessPage, item) onBlur(
'samplingProcess',
SamplingProcessApi.getSamplingProcessPage,
item
)
" "
@focus="onFocus" @focus="onFocus"
/> />
@ -308,7 +323,10 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="特征类型" prop="inspectionCharacteristicsBaseVO.featureType"> <el-form-item
label="特征类型"
prop="inspectionCharacteristicsBaseVO.featureType"
>
<!-- <el-input v-model="item.featureType" /> --> <!-- <el-input v-model="item.featureType" /> -->
<el-select <el-select
v-model="item.inspectionCharacteristicsBaseVO.featureType" v-model="item.inspectionCharacteristicsBaseVO.featureType"
@ -326,11 +344,10 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0">
<el-form-item <el-form-item
label="计量单位" label="计量单位"
prop="inspectionCharacteristicsBaseVO.quantifyUom" prop="inspectionCharacteristicsBaseVO.quantifyUom"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
> >
<el-select <el-select
v-model="item.inspectionCharacteristicsBaseVO.quantifyUom" v-model="item.inspectionCharacteristicsBaseVO.quantifyUom"
@ -345,11 +362,10 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0">
<el-form-item <el-form-item
label="小数位" label="小数位"
prop="inspectionCharacteristicsBaseVO.quantifyDecimal" prop="inspectionCharacteristicsBaseVO.quantifyDecimal"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
> >
<el-input <el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyDecimal" v-model="item.inspectionCharacteristicsBaseVO.quantifyDecimal"
@ -399,7 +415,10 @@
item.inspectionCharacteristicsBaseVO.quantifyIsCapping item.inspectionCharacteristicsBaseVO.quantifyIsCapping
" "
> >
<el-form-item label="上限值" prop="inspectionCharacteristicsBaseVO.quantifyCapping"> <el-form-item
label="上限值"
prop="inspectionCharacteristicsBaseVO.quantifyCapping"
>
<el-input <el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyCapping" v-model="item.inspectionCharacteristicsBaseVO.quantifyCapping"
type="number" type="number"
@ -430,7 +449,10 @@
item.inspectionCharacteristicsBaseVO.quantifyIsTarget item.inspectionCharacteristicsBaseVO.quantifyIsTarget
" "
> >
<el-form-item label="目标值" prop="inspectionCharacteristicsBaseVO.quantifyTarget"> <el-form-item
label="目标值"
prop="inspectionCharacteristicsBaseVO.quantifyTarget"
>
<el-input <el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyTarget" v-model="item.inspectionCharacteristicsBaseVO.quantifyTarget"
type="number" type="number"
@ -446,7 +468,9 @@
<el-input <el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode" v-model="item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode"
placeholder="请选择选定集" placeholder="请选择选定集"
@blur="onBlur('quantifyQuantify', SelectedSetApi.getSelectedSetPage, item)" @blur="
onBlur('quantifyQuantify', SelectedSetApi.getSelectedSetPage, item)
"
@focus="onFocus" @focus="onFocus"
/> />
<el-button <el-button
@ -493,15 +517,13 @@
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
</el-tab-pane> </div>
</el-tabs> </div>
</div>
</div>
</div> </div>
<template #footer> <template #footer>
<ButtonBase <ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" :key="count" />
:Butttondata="Butttondata"
@button-base-click="buttonBaseClick"
:key="count"
/>
</template> </template>
</Dialog> </Dialog>
<Dialog title="修改名称" v-model="dialogVisibleName" width="500px" :close-on-click-modal="false"> <Dialog title="修改名称" v-model="dialogVisibleName" width="500px" :close-on-click-modal="false">
@ -536,6 +558,8 @@ import * as DynamicRuleApi from '@/api/qms/dynamicRule' //动态修改规则
import { DynamicRule } from '@/views/qms/dynamicRule/dynamicRule.data' // import { DynamicRule } from '@/views/qms/dynamicRule/dynamicRule.data' //
import * as SelectedSetApi from '@/api/qms/selectedSet' // import * as SelectedSetApi from '@/api/qms/selectedSet' //
import { SelectedSet } from '@/views/qms/selectedSet/selectedSet.data' // import { SelectedSet } from '@/views/qms/selectedSet/selectedSet.data' //
import { Plus, Close, CopyDocument } from '@element-plus/icons-vue'
import draggable from 'vuedraggable'
import { import {
validateInteger, validateInteger,
validateTwoNum, validateTwoNum,
@ -587,6 +611,8 @@ const formFeaturesRef = ref()
const formProcessRef = ref() const formProcessRef = ref()
const data = ref({ const data = ref({
enabled: true,
dragging: false,
code: '', code: '',
description: '', description: '',
version: '', version: '',
@ -645,7 +671,7 @@ const rules = ref({
{ required: true, message: '请输入下限值', trigger: 'blur' } { required: true, message: '请输入下限值', trigger: 'blur' }
], ],
'inspectionCharacteristicsBaseVO.quantifyUom': [ 'inspectionCharacteristicsBaseVO.quantifyUom': [
{ required: true, message: '请选择计量单位', trigger: 'blur' } { required: true, message: '请选择计量单位', trigger: ['blur', 'change'] }
], ],
'inspectionCharacteristicsBaseVO.quantifyDecimal': [ 'inspectionCharacteristicsBaseVO.quantifyDecimal': [
{ required: true, message: '请输入小数位', trigger: 'blur' }, { required: true, message: '请输入小数位', trigger: 'blur' },
@ -658,7 +684,7 @@ const rules = ref({
}) })
/** 打开弹窗 */ /** 打开弹窗 */
let tabIndex = 1 const sequenceCode = ref(0)
const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => { const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => {
dialogVisible.value = true dialogVisible.value = true
if (titleName) { if (titleName) {
@ -668,10 +694,11 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
} }
formType.value = type formType.value = type
if (row) { if (row) {
console.log(row)
// //
if (formType.value == 'create') { if (formType.value == 'create') {
data.value = { data.value = {
enabled: true,
dragging: false,
code: '', code: '',
description: row.description, description: row.description,
version: String(row.version), version: String(row.version),
@ -734,6 +761,8 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
} else { } else {
data.value = JSON.parse(JSON.stringify(row)) data.value = JSON.parse(JSON.stringify(row))
data.value.version = String(data.value.version) data.value.version = String(data.value.version)
data.value.enabled = true
data.value.dragging = false
let list = await InspectionProcessPageApi.getListByTempleteCode(row.code) let list = await InspectionProcessPageApi.getListByTempleteCode(row.code)
editableTabsValue.value = '1' editableTabsValue.value = '1'
list.forEach((item, index) => { list.forEach((item, index) => {
@ -759,6 +788,8 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
} }
} else { } else {
data.value = { data.value = {
enabled: true,
dragging: false,
code: '', code: '',
description: '', description: '',
version: '', version: '',
@ -769,7 +800,7 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
} }
tabIndex = data.value.process.length + 1 sequenceCode.value = data.value.process.length + 1
} }
defineExpose({ open, dialogVisible, formLoading }) // open defineExpose({ open, dialogVisible, formLoading }) // open
import type { TabPaneName } from 'element-plus' import type { TabPaneName } from 'element-plus'
@ -781,6 +812,7 @@ const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' |
if (action === 'add') { if (action === 'add') {
nameForm.value.name = '' nameForm.value.name = ''
dialogVisibleName.value = true dialogVisibleName.value = true
sequenceCode.value = data.value.process.length + 1
} else if (action === 'remove') { } else if (action === 'remove') {
const tabs = data.value.process const tabs = data.value.process
let activeName = editableTabsValue.value let activeName = editableTabsValue.value
@ -796,6 +828,9 @@ const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' |
} }
editableTabsValue.value = activeName editableTabsValue.value = activeName
data.value.process = tabs.filter((tab) => tab.name !== targetName) data.value.process = tabs.filter((tab) => tab.name !== targetName)
data.value.process.forEach((item, index) => {
item.sequenceCode = index + 1
})
} }
} }
/** 修改名称时间 */ /** 修改名称时间 */
@ -805,13 +840,16 @@ const buttonBaseClick1 = (val) => {
if (!nameRef.value) return if (!nameRef.value) return
nameRef.value.validate((valid, fields) => { nameRef.value.validate((valid, fields) => {
if (valid) { if (valid) {
const newTabName = `${++tabIndex}` let newTabName = 1
data.value.process.push({ if (data.value.process && data.value.process.length > 0) {
newTabName = data.value.process[data.value.process.length - 1].name + 1
}
let obj = {
description: nameForm.value.name, description: nameForm.value.name,
name: newTabName, name: newTabName,
inspectionCode: '', inspectionCode: '',
dynamicUpdateCode: '', dynamicUpdateCode: '',
sequenceCode: '', sequenceCode: sequenceCode.value,
inspectionCharCode: '', inspectionCharCode: '',
inspectionCharacteristicsBaseVO: { inspectionCharacteristicsBaseVO: {
inspectionMethodCode: '', inspectionMethodCode: '',
@ -830,7 +868,8 @@ const buttonBaseClick1 = (val) => {
quantifyDecimal: '', quantifyDecimal: '',
quantifyQuantifyCode: '' quantifyQuantifyCode: ''
} }
}) }
data.value.process.push(obj)
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
@ -848,7 +887,6 @@ const buttonBaseClick1 = (val) => {
} }
} }
const buttonBaseClick = (val) => { const buttonBaseClick = (val) => {
console.log(val)
// //
if (val == 'save') { if (val == 'save') {
submitForm() submitForm()
@ -861,7 +899,7 @@ const buttonBaseClick = (val) => {
// //
const emit = defineEmits(['submitForm', 'searchTableSuccess']) const emit = defineEmits(['submitForm', 'searchTableSuccess'])
const validateForm = (formRef) => { const validateForm = (formRef) => {
// console.log(TableBaseForm_Ref.value) console.log(formRef)
let _lists = formRef?.map((v) => v.validate()) let _lists = formRef?.map((v) => v.validate())
return Promise.all(_lists) return Promise.all(_lists)
.then(() => { .then(() => {
@ -887,6 +925,7 @@ const submitForm = async () => {
// //
await validateForm(formProcessRef.value) await validateForm(formProcessRef.value)
await formMainRef.value.validate() await formMainRef.value.validate()
// //
if (!data.value.process || data.value.process.length == 0) { if (!data.value.process || data.value.process.length == 0) {
message.error(`请添加工序`) message.error(`请添加工序`)
@ -918,7 +957,6 @@ const submitForm = async () => {
return return
} }
// ,, // ,,
console.log(data.value.process)
const arr1 = data.value.process.filter( const arr1 = data.value.process.filter(
(item) => (item) =>
((item.inspectionCharacteristicsBaseVO.quantifyIsCapping && ((item.inspectionCharacteristicsBaseVO.quantifyIsCapping &&
@ -970,7 +1008,6 @@ const submitForm = async () => {
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyTarget))) parseFloat(item.inspectionCharacteristicsBaseVO.quantifyTarget)))
) )
}) })
console.log(99, arr2)
if (arr2 && arr2.length > 0) { if (arr2 && arr2.length > 0) {
const str = arr2.map((item) => item.description).join(',') const str = arr2.map((item) => item.description).join(',')
message.error(`${str}工序上限值应大于目标值大于下限值`) message.error(`${str}工序上限值应大于目标值大于下限值`)
@ -983,9 +1020,7 @@ const submitForm = async () => {
// //
emit('submitForm', formType.value, data) emit('submitForm', formType.value, data)
} }
} catch { } catch {}
console.log(111)
}
} }
/** 弹窗按钮 */ /** 弹窗按钮 */
let Butttondata: any = [] let Butttondata: any = []
@ -1007,7 +1042,6 @@ const changeFeatureType = (e, item) => {
item.inspectionCharacteristicsBaseVO.quantifyTarget = '' item.inspectionCharacteristicsBaseVO.quantifyTarget = ''
item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode = '' item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode = ''
item.inspectionCharacteristicsBaseVO.quantifyQuantifyName = '' item.inspectionCharacteristicsBaseVO.quantifyQuantifyName = ''
console.log(e)
if (e) { if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyQuantifyCode'][0].required = true rules.value['inspectionCharacteristicsBaseVO.quantifyQuantifyCode'][0].required = true
} else { } else {
@ -1026,7 +1060,6 @@ const opensearchTable = (
type, type,
row row
) => { ) => {
console.log(988, row)
const _searchCondition = {} const _searchCondition = {}
// //
if (searchCondition && searchCondition.length > 0) { if (searchCondition && searchCondition.length > 0) {
@ -1093,7 +1126,6 @@ const opensearchTable = (
// //
// val row // val row
const searchTableSuccess = (formField, searchField, val, type, row) => { const searchTableSuccess = (formField, searchField, val, type, row) => {
console.log(row)
if (type == 'features') { if (type == 'features') {
row.inspectionCharacteristicsBaseVO[formField] = val[0].code row.inspectionCharacteristicsBaseVO[formField] = val[0].code
if (formField == 'inspectionMethodCode') { if (formField == 'inspectionMethodCode') {
@ -1205,22 +1237,64 @@ const onFocus = () => {
] ]
count.value++ count.value++
} }
const chooseTabs = (element, index) => {
if (element.name == editableTabsValue.value) return
editableTabsValue.value = element.name
}
const handleChange = (e) => {
editableTabsValue.value = e.moved.element.name
data.value.process.forEach((item, index) => {
item.sequenceCode = index + 1
})
}
</script> </script>
<style scoped> <style scoped lang="scss">
.small-title { .small-title {
font-weight: bold; font-weight: bold;
padding: 0px 10px 10px; padding: 0px 10px 10px;
color: #1a8bfc; color: #1a8bfc;
font-size: 16px; font-size: 16px;
} }
</style> .main-body {
<style> display: flex;
.el-tabs--left .el-tabs__header.is-left { .left {
padding-bottom: 5000px; width: 200px;
margin-bottom: -5000px; background: rgb(245, 247, 250);
min-width: 150px !important; border: 1px solid rgb(220, 223, 230);
min-height: 60px;
position: relative;
padding: 6px 0px;
.plus-icon {
cursor: pointer;
position: absolute;
right: 0px;
top: 0px;
border: 1px solid rgb(220, 223, 230);
background: rgb(245, 247, 250);
display: flex;
align-items: center;
justify-items: center;
padding: 1px;
}
}
}
.tabs-label {
padding: 4px 20px 4px 20px;
min-height: 30px;
justify-content: flex-end;
display: flex;
align-items: center;
cursor: pointer;
word-break: break-all;
} }
.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left { .active {
min-width: 120px !important; background: white;
}
.right {
border: 1px solid rgb(220, 223, 230);
flex: 1;
width: 0px;
padding: 20px;
} }
</style> </style>

Loading…
Cancel
Save