feat(production-master-data): 新增工艺流程管理完整模块
- 添加工艺流程、流程卡工序的全套CRUD及复制接口 - 新增工艺流程列表页与流程卡详情页的路由和页面组件 - 补充产品、工序分类、工序子类的全量查询接口 - 优化弹窗表单组件,支持字段禁用与focus/blur/change事件回调 - 修复工序单元页面的国际化调用和权限配置问题 - 补充中英文多语言国际化文案 - 新增该模块的功能测试文档
This commit is contained in:
@@ -0,0 +1,592 @@
|
||||
<template>
|
||||
<d2-container>
|
||||
<template #header>
|
||||
<el-page-header @back="$router.go(-1)" :content="flowName" style="margin: 10px 0" />
|
||||
</template>
|
||||
|
||||
<el-descriptions
|
||||
v-if="flowInfo"
|
||||
class="margin-top"
|
||||
:title="$t(key('flow_info'))"
|
||||
:column="4"
|
||||
direction="vertical"
|
||||
border
|
||||
>
|
||||
<template #title>
|
||||
<span style="color: #409EFF; font-size: 14px;">| {{ $t(key('flow_info')) }}</span>
|
||||
</template>
|
||||
<el-descriptions-item :label="$t(key('flow_name'))">{{ flowInfo.name }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t(key('category'))">{{ flowInfo.flow_category_name }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t(key('product'))">{{ flowInfo.product_model_name }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t(key('batch_bound'))">
|
||||
<el-tag v-if="isBindingBatch" size="small">{{ $t(key('yes')) }}</el-tag>
|
||||
<el-tag v-else size="small" type="info">{{ $t(key('no')) }}</el-tag>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<div class="card-toolbar">
|
||||
<strong v-for="(btn, index) in toolbarButtons" :key="index">
|
||||
<el-button
|
||||
v-if="btn.hasPermission && __judgeToolbarButton(btn.key)"
|
||||
:type="btn.type"
|
||||
:size="btn.size || 'mini'"
|
||||
:icon="btn.icon"
|
||||
@click="btn.onClick"
|
||||
:style="btn.cssStyle"
|
||||
>
|
||||
{{ $t(btn.label) }}
|
||||
</el-button>
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
<page-table
|
||||
ref="pageTable"
|
||||
:columns="columns"
|
||||
:data="tableData"
|
||||
:loading="loading"
|
||||
:toolbar-buttons="[]"
|
||||
:row-buttons="[]"
|
||||
:pagination="null"
|
||||
auto-height
|
||||
:table-attrs="{ border: true }"
|
||||
>
|
||||
<template #col-up="{ row, index }">
|
||||
<i
|
||||
v-show="index > 0"
|
||||
v-if="$permission('/production_configuration/technology_model/technology_flow_process/sort')"
|
||||
class="el-icon-sort-up"
|
||||
style="cursor: pointer"
|
||||
@click="handleMoveUp(row, index)"
|
||||
/>
|
||||
</template>
|
||||
<template #col-down="{ row, index }">
|
||||
<i
|
||||
v-show="index < tableData.length - 1"
|
||||
v-if="$permission('/production_configuration/technology_model/technology_flow_process/sort')"
|
||||
class="el-icon-sort-down"
|
||||
style="cursor: pointer"
|
||||
@click="handleMoveDown(row, index)"
|
||||
/>
|
||||
</template>
|
||||
<template #col-sort="{ row }">
|
||||
{{ row.sort }}
|
||||
</template>
|
||||
<template #col-handle="{ row, index }">
|
||||
<strong v-for="(btn, btnIdx) in rowOperationButtons" :key="btnIdx">
|
||||
<i
|
||||
:class="btn.icon"
|
||||
:style="btn.cssStyle"
|
||||
v-if="$permission(btn.auth) && __judgeRowButton(row, btn.key)"
|
||||
@click="btn.onClick(row, index)"
|
||||
>
|
||||
{{ btn.label }}
|
||||
</i>
|
||||
</strong>
|
||||
</template>
|
||||
</page-table>
|
||||
|
||||
<page-dialog-form
|
||||
ref="dialogForm"
|
||||
:visible.sync="dialogVisible"
|
||||
:title="dialogTitle"
|
||||
:width="'35%'"
|
||||
:form-cols="formCols"
|
||||
:form-data="formData"
|
||||
:rules="rules"
|
||||
:label-width="'130px'"
|
||||
:submitting="submitting"
|
||||
:confirm-text="key('confirm')"
|
||||
:cancel-text="key('cancel')"
|
||||
@submit="onDialogSubmit"
|
||||
@close="onDialogClose"
|
||||
/>
|
||||
|
||||
<technology-flow-model
|
||||
:visible.sync="settingVisible"
|
||||
:title="settingTitle"
|
||||
:type="settingType"
|
||||
:code="settingCode"
|
||||
:width="settingWidth"
|
||||
:plugin-data="settingPluginData"
|
||||
@close="settingVisible = false"
|
||||
@submit="handleSettingSubmit"
|
||||
/>
|
||||
|
||||
<result-param
|
||||
:visible.sync="resultVisible"
|
||||
:title="resultTitle"
|
||||
:workingsubclass-id="resultWorkingsubclassId"
|
||||
@close="resultVisible = false"
|
||||
/>
|
||||
|
||||
<el-drawer
|
||||
:title="$t(key('view_log'))"
|
||||
:visible.sync="drawer"
|
||||
size="35%"
|
||||
:with-header="false"
|
||||
>
|
||||
<div style="margin: 20px">
|
||||
<div
|
||||
v-for="(item, index) in operationLogs"
|
||||
:key="index"
|
||||
style="padding-bottom: 20px; margin-bottom: 30px"
|
||||
>
|
||||
<div style="margin-bottom: 10px; color: rgba(0,0,0,.36); font-size: 14px">
|
||||
<i class="el-icon-star-on" style="color: #409EFF" />
|
||||
<span style="margin-right: 10px; margin-left: 2px">{{ item.nyr_date }}</span>
|
||||
<span>{{ item.week }}</span>
|
||||
</div>
|
||||
<div style="margin-bottom: 10px; display: flex; align-items: center; justify-content: flex-start">
|
||||
<div style="margin-right: 10px"><el-avatar size="small"> user </el-avatar></div>
|
||||
<div style="color: #8BCF70">{{ item.username }}</div>
|
||||
</div>
|
||||
<div style="margin-left: 40px; margin-bottom: 10px">
|
||||
<span>{{ item.action_name }}</span>
|
||||
<span style="color: rgba(0,0,0,.36); font-size: 14px">
|
||||
<span style="margin-left: 10px; margin-right: 5px">{{ item.yr_date }}</span>
|
||||
<span>{{ item.ampm }}</span>
|
||||
<span style="margin-left: 5px">{{ item.time }}</span>
|
||||
</span>
|
||||
</div>
|
||||
<div style="margin-left: 40px; margin-bottom: 10px" v-if="item.process_name">
|
||||
<span style="color: rgba(0,0,0,.36); font-size: 14px">
|
||||
{{ $t(key('log_operation_step')) }}{{ item.process_name }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</d2-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { useTableColumns } from '@/composables/useTableColumns'
|
||||
import { useTableButtons } from '@/composables/useTableButtons'
|
||||
import { i18nMixin } from '@/composables/useI18n'
|
||||
import { confirmMixin } from '@/composables/useConfirmHandle'
|
||||
import {
|
||||
getProcessCardAll,
|
||||
createProcessCard,
|
||||
editProcessCard,
|
||||
deleteProcessCard,
|
||||
moveUp,
|
||||
moveDown,
|
||||
setSetting
|
||||
} from '@/api/production-master-data/process-routing-card'
|
||||
import { getWorkingsubclassAll } from '@/api/production-master-data/process-step'
|
||||
import PageTable from '@/components/page-table'
|
||||
import PageDialogForm from '@/components/page-dialog-form'
|
||||
import TechnologyFlowModel from '../process-step/components/technology-flow-model.vue'
|
||||
import ResultParam from '../process-step/components/result-param.vue'
|
||||
|
||||
export default {
|
||||
name: 'production-master-data-process-routing-card',
|
||||
components: { PageTable, PageDialogForm, TechnologyFlowModel, ResultParam },
|
||||
mixins: [i18nMixin('page.production_master_data.process_model.process_routing.card'), confirmMixin],
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
submitting: false,
|
||||
flowId: '',
|
||||
flowName: '',
|
||||
flowInfo: null,
|
||||
isBindingBatch: false,
|
||||
tableData: [],
|
||||
drawer: false,
|
||||
operationLogs: [],
|
||||
workingsubclassOptions: [],
|
||||
workingsubclassRawData: [],
|
||||
dialogVisible: false,
|
||||
dialogTitle: '',
|
||||
editId: '',
|
||||
handleType: 'create',
|
||||
settingVisible: false,
|
||||
settingTitle: '',
|
||||
settingType: '',
|
||||
settingCode: '',
|
||||
settingWidth: '60%',
|
||||
settingPluginData: {},
|
||||
settingRowId: '',
|
||||
resultVisible: false,
|
||||
resultTitle: '',
|
||||
resultWorkingsubclassId: '',
|
||||
formData: {
|
||||
workingsubclass_id: '',
|
||||
code: '',
|
||||
name: '',
|
||||
pin_check: '0'
|
||||
},
|
||||
rules: {
|
||||
workingsubclass_id: [
|
||||
{ required: true, message: this.key('select_process_unit'), trigger: 'change' }
|
||||
],
|
||||
code: [
|
||||
{ required: true, message: this.key('enter_step_code'), trigger: 'blur' },
|
||||
{ min: 1, max: 100, message: this.key('length_1_100'), trigger: 'blur' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: this.key('enter_step_name'), trigger: 'blur' },
|
||||
{ min: 1, max: 100, message: this.key('length_1_100'), trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
columns: [],
|
||||
toolbarButtons: [],
|
||||
rowOperationButtons: [],
|
||||
formCols: [
|
||||
[
|
||||
{
|
||||
type: 'select',
|
||||
prop: 'workingsubclass_id',
|
||||
label: this.key('process_unit'),
|
||||
placeholder: this.key('select_process_unit'),
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
style: { width: '90%' },
|
||||
options: [],
|
||||
onChange: this.onWorkingsubclassChange
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
type: 'input',
|
||||
prop: 'code',
|
||||
label: this.key('step_code'),
|
||||
placeholder: this.key('enter_step_code'),
|
||||
clearable: true,
|
||||
disabled: false,
|
||||
style: { width: '90%' }
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
type: 'input',
|
||||
prop: 'name',
|
||||
label: this.key('step_name'),
|
||||
placeholder: this.key('enter_step_name'),
|
||||
clearable: true,
|
||||
style: { width: '90%' }
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
type: 'select',
|
||||
prop: 'pin_check',
|
||||
label: this.$t(this.key('pin_check')),
|
||||
placeholder: this.$t(this.key('select_pin_check')),
|
||||
clearable: false,
|
||||
style: { width: '90%' },
|
||||
options: [
|
||||
{ label: this.$t(this.key('enable')), value: '1' },
|
||||
{ label: this.$t(this.key('disable')), value: '0' }
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.flowId = this.$route.params.flow_id || ''
|
||||
this.flowName = this.$route.query.flow_name || ''
|
||||
this.columns = useTableColumns([
|
||||
{ prop: 'up', label: '', slot: 'up', width: 40 },
|
||||
{ prop: 'down', label: '', slot: 'down', width: 40 },
|
||||
{ prop: 'sort', label: this.key('sort'), slot: 'sort', width: 80 },
|
||||
{ prop: 'code', label: this.key('step_code'), minWidth: 120 },
|
||||
{ prop: 'name', label: this.key('step_name'), minWidth: 140 },
|
||||
{ prop: 'workingsubclass_name', label: this.key('process_unit_name'), minWidth: 140 },
|
||||
{ prop: 'handle', label: this.key('operation'), slot: 'handle', width: 500 }
|
||||
])
|
||||
|
||||
const btns = useTableButtons({
|
||||
toolbar: [
|
||||
{
|
||||
key: 'add',
|
||||
label: this.key('add_step'),
|
||||
icon: 'el-icon-plus',
|
||||
type: 'primary',
|
||||
auth: '/production_configuration/technology_model/technology_flow_process/create',
|
||||
onClick: this.openAdd
|
||||
},
|
||||
{
|
||||
key: 'viewLog',
|
||||
label: this.key('view_log'),
|
||||
icon: 'el-icon-view',
|
||||
type: 'warning',
|
||||
auth: '/production_configuration/technology_model/technology_flow_process/view_log',
|
||||
onClick: this.openLog
|
||||
}
|
||||
]
|
||||
}, this.$permission)
|
||||
this.toolbarButtons = btns.toolbarButtons
|
||||
|
||||
this.rowOperationButtons = [
|
||||
{
|
||||
key: 'edit',
|
||||
label: '编辑',
|
||||
icon: 'el-icon-edit',
|
||||
cssStyle: { marginRight: '10px', cursor: 'pointer' },
|
||||
auth: '/production_configuration/technology_model/technology_flow_process/edit',
|
||||
onClick: this.openEdit
|
||||
},
|
||||
{
|
||||
key: 'delete',
|
||||
label: '删除',
|
||||
icon: 'el-icon-delete',
|
||||
cssStyle: { color: 'red', marginRight: '10px', cursor: 'pointer' },
|
||||
auth: '/production_configuration/technology_model/technology_flow_process/delete',
|
||||
onClick: this.handleDelete
|
||||
},
|
||||
{
|
||||
key: 'setting',
|
||||
label: '设定值',
|
||||
icon: 'el-icon-setting',
|
||||
cssStyle: { color: '#409EFF', marginRight: '10px', cursor: 'pointer' },
|
||||
auth: '/production_configuration/technology_model/technology_flow_process/setting',
|
||||
onClick: this.openSettingDrawer
|
||||
},
|
||||
{
|
||||
key: 'resultParam',
|
||||
label: '结果参数',
|
||||
icon: 'el-icon-s-promotion',
|
||||
cssStyle: { color: '#E6A23C', marginRight: '10px', cursor: 'pointer' },
|
||||
auth: '/production_configuration/technology_model/technology_flow_process/result_params',
|
||||
onClick: this.openResultParamDrawer
|
||||
},
|
||||
{
|
||||
key: 'temperature',
|
||||
label: '温度补偿',
|
||||
icon: 'el-icon-magic-stick',
|
||||
cssStyle: { color: '#67C23A', marginRight: '10px', cursor: 'pointer' },
|
||||
auth: '/production_configuration/technology_model/technology_flow_process/temperature',
|
||||
onClick: this.openTemperatureDrawer
|
||||
},
|
||||
{
|
||||
key: 'calculationScript',
|
||||
label: '计算脚本',
|
||||
icon: 'el-icon-monitor',
|
||||
cssStyle: { color: '#67C23A', marginRight: '10px', cursor: 'pointer' },
|
||||
auth: '/production_configuration/technology_model/technology_flow_process/calculation_script',
|
||||
onClick: this.openCalculationScriptDrawer
|
||||
}
|
||||
]
|
||||
|
||||
if (this.flowId) {
|
||||
this.fetchData()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async fetchData () {
|
||||
this.loading = true
|
||||
try {
|
||||
const res = await getProcessCardAll({ flow_id: this.flowId })
|
||||
const data = res.data || res || {}
|
||||
this.tableData = data.process || []
|
||||
this.flowInfo = data.flow_data || null
|
||||
this.flowName = this.flowName || (this.flowInfo && this.flowInfo.name) || ''
|
||||
this.isBindingBatch = data.is_binding_batch === 1
|
||||
this.operationLogs = data.technology_flow_operate_log || []
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
__judgeToolbarButton (key) {
|
||||
if (key === 'add' && this.isBindingBatch) return false
|
||||
return true
|
||||
},
|
||||
__judgeRowButton (row, key) {
|
||||
if (key === 'setting' && row.setting_plugin) return true
|
||||
if (key === 'delete' && !this.isBindingBatch) return true
|
||||
if (key === 'temperature' &&
|
||||
['FORMATION', 'YC', 'HC', 'IC', 'FORMATION_SS'].indexOf(row.device_category_code) !== -1) {
|
||||
return false
|
||||
}
|
||||
if (key === 'resultParam') return true
|
||||
if (key === 'calculationScript') return false
|
||||
if (key === 'edit') return true
|
||||
return false
|
||||
},
|
||||
async handleMoveUp (row, index) {
|
||||
if (this.isBindingBatch) {
|
||||
this.$message.warning(this.$t(this.key('batch_bound_no_move')))
|
||||
return
|
||||
}
|
||||
if (index <= 0) return
|
||||
try {
|
||||
await moveUp({
|
||||
flow_id: this.flowId,
|
||||
move_id: row.id,
|
||||
quilt_move_id: this.tableData[index - 1].id,
|
||||
move_sort: row.sort,
|
||||
quilt_move_sort: this.tableData[index - 1].sort
|
||||
})
|
||||
this.fetchData()
|
||||
} catch (e) { /* 拦截器已处理 */ }
|
||||
},
|
||||
async handleMoveDown (row, index) {
|
||||
if (this.isBindingBatch) {
|
||||
this.$message.warning(this.$t(this.key('batch_bound_no_move')))
|
||||
return
|
||||
}
|
||||
if (index >= this.tableData.length - 1) return
|
||||
try {
|
||||
await moveDown({
|
||||
flow_id: this.flowId,
|
||||
move_id: row.id,
|
||||
quilt_move_id: this.tableData[index + 1].id,
|
||||
move_sort: row.sort,
|
||||
quilt_move_sort: this.tableData[index + 1].sort
|
||||
})
|
||||
this.fetchData()
|
||||
} catch (e) { /* 拦截器已处理 */ }
|
||||
},
|
||||
loadWorkingsubclassOptions () {
|
||||
if (this.workingsubclassOptions.length > 0) return Promise.resolve()
|
||||
return getWorkingsubclassAll().then(res => {
|
||||
const list = res.data || res || []
|
||||
this.workingsubclassRawData = list
|
||||
this.workingsubclassOptions = list.map(item => ({
|
||||
label: item.name,
|
||||
value: item.id
|
||||
}))
|
||||
this.formCols[0][0].options = this.workingsubclassOptions
|
||||
})
|
||||
},
|
||||
onWorkingsubclassChange (value) {
|
||||
if (!value) return
|
||||
const raw = this.workingsubclassRawData.find(item => item.id === value)
|
||||
if (!raw) return
|
||||
const wsCode = raw.code
|
||||
const wsName = raw.name
|
||||
|
||||
const identicalData = this.tableData.filter(
|
||||
v => v.workingsubclass_code === wsCode
|
||||
)
|
||||
|
||||
if (identicalData.length > 0) {
|
||||
const firstCode = identicalData[0].code
|
||||
const firstName = identicalData[0].name
|
||||
const len = identicalData.length
|
||||
this.formData.code = firstCode + '_' + len
|
||||
this.formData.name = firstName + '_' + len
|
||||
} else {
|
||||
this.formData.code = this.flowId + '_' + wsCode
|
||||
this.formData.name = this.flowId + '_' + wsName
|
||||
}
|
||||
|
||||
const autoPinDevices = ['IC', 'HC', 'YC', 'OCV01', 'OCV02', 'OCV03', 'OCV04', 'OCV05', 'OCV06', 'DCIR', 'FORMATION', 'FORMATION_SS']
|
||||
this.formData.pin_check = autoPinDevices.includes(wsCode) ? '1' : '0'
|
||||
},
|
||||
resetForm () {
|
||||
this.formData = { workingsubclass_id: '', code: '', name: '', pin_check: '0' }
|
||||
this.editId = ''
|
||||
this.$nextTick(() => {
|
||||
this.formCols[0][0].disabled = false
|
||||
this.formCols[1][0].disabled = false
|
||||
this.formCols[2][0].disabled = false
|
||||
})
|
||||
},
|
||||
openAdd () {
|
||||
this.handleType = 'create'
|
||||
this.dialogTitle = this.key('add_step')
|
||||
this.loadWorkingsubclassOptions().then(() => {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dialogForm && this.$refs.dialogForm.reset()
|
||||
this.resetForm()
|
||||
this.dialogVisible = true
|
||||
})
|
||||
})
|
||||
},
|
||||
openEdit (row) {
|
||||
this.handleType = 'edit'
|
||||
this.dialogTitle = this.key('edit_step')
|
||||
this.editId = row.id
|
||||
this.formData = {
|
||||
workingsubclass_id: row.workingsubclass_id || '',
|
||||
code: row.code,
|
||||
name: row.name,
|
||||
pin_check: row.pin_check !== undefined ? String(row.pin_check) : '0'
|
||||
}
|
||||
this.loadWorkingsubclassOptions().then(() => {
|
||||
this.$nextTick(() => {
|
||||
this.formCols[0][0].disabled = true
|
||||
this.formCols[1][0].disabled = true
|
||||
this.formCols[2][0].disabled = true
|
||||
})
|
||||
})
|
||||
this.dialogVisible = true
|
||||
},
|
||||
async onDialogSubmit () {
|
||||
this.submitting = true
|
||||
try {
|
||||
if (this.handleType === 'create') {
|
||||
await createProcessCard({ ...this.formData, flow_id: this.flowId })
|
||||
} else {
|
||||
await editProcessCard({ ...this.formData, id: this.editId, flow_id: this.flowId })
|
||||
}
|
||||
this.$message.success(this.$t(this.key('operation_success')))
|
||||
this.dialogVisible = false
|
||||
this.fetchData()
|
||||
} finally {
|
||||
this.submitting = false
|
||||
}
|
||||
},
|
||||
onDialogClose () {
|
||||
this.resetForm()
|
||||
},
|
||||
async handleDelete (row, index) {
|
||||
const cancelled = await this.$confirmAction(
|
||||
{
|
||||
message: this.key('confirm_delete'),
|
||||
title: this.key('tip')
|
||||
},
|
||||
() => deleteProcessCard({ id: [row.id], flow_id: this.flowId })
|
||||
)
|
||||
if (cancelled) return
|
||||
this.$message.success(this.$t(this.key('operation_success')))
|
||||
this.fetchData()
|
||||
},
|
||||
openLog () {
|
||||
this.drawer = true
|
||||
},
|
||||
openSettingDrawer (row) {
|
||||
this.settingRowId = row.id
|
||||
this.settingTitle = this.key('setting')
|
||||
this.settingType = row.setting_plugin || row.device_category_code || ''
|
||||
this.settingCode = row.workingsubclass_code || row.code || ''
|
||||
this.settingPluginData = row.setting || {}
|
||||
this.settingVisible = true
|
||||
},
|
||||
openResultParamDrawer (row) {
|
||||
this.resultTitle = this.key('result_param')
|
||||
this.resultWorkingsubclassId = row.workingsubclass_id || ''
|
||||
this.resultVisible = true
|
||||
},
|
||||
openTemperatureDrawer (row) {
|
||||
this.$message.warning('当前项目暂未接入温度补偿功能')
|
||||
},
|
||||
openCalculationScriptDrawer (row) {
|
||||
this.$message.warning('当前项目暂未接入计算脚本功能')
|
||||
},
|
||||
async handleSettingSubmit (data) {
|
||||
await setSetting({
|
||||
id: this.settingRowId,
|
||||
flow_id: this.flowId,
|
||||
setting: JSON.stringify(data)
|
||||
})
|
||||
this.$message.success(this.$t(this.key('operation_success')))
|
||||
this.settingVisible = false
|
||||
this.fetchData()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.card-toolbar {
|
||||
margin-bottom: 15px;
|
||||
margin-top: -10px;
|
||||
}
|
||||
/deep/ .el-page-header__content {
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,467 @@
|
||||
<template>
|
||||
<d2-container>
|
||||
<template #header>
|
||||
<div class="search-bar">
|
||||
<el-form :inline="true" size="mini">
|
||||
<el-form-item :label="$t(key('code'))">
|
||||
<el-input
|
||||
v-model="search.code"
|
||||
:placeholder="$t(key('enter_code'))"
|
||||
clearable
|
||||
style="width:180px"
|
||||
@keyup.enter.native="onSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t(key('name'))">
|
||||
<el-input
|
||||
v-model="search.name"
|
||||
:placeholder="$t(key('enter_name'))"
|
||||
clearable
|
||||
style="width:180px"
|
||||
@keyup.enter.native="onSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t(key('category'))">
|
||||
<el-select
|
||||
v-model="search.flow_category_id"
|
||||
:placeholder="$t(key('select_category'))"
|
||||
clearable
|
||||
filterable
|
||||
size="mini"
|
||||
style="width:180px"
|
||||
@focus="loadSearchCategories"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in searchCategoryOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t(key('product'))">
|
||||
<el-select
|
||||
v-model="search.product_model_id"
|
||||
:placeholder="$t(key('select_product'))"
|
||||
clearable
|
||||
filterable
|
||||
size="mini"
|
||||
style="width:180px"
|
||||
@focus="loadSearchProducts"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in searchProductOptions"
|
||||
:key="item.product_model_id"
|
||||
:label="item.name"
|
||||
:value="item.product_model_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="onSearch">
|
||||
{{ $t(key('search')) }}
|
||||
</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="onReset">
|
||||
{{ $t(key('reset')) }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<page-table
|
||||
ref="pageTable"
|
||||
:columns="columns"
|
||||
:data="tableData"
|
||||
:loading="loading"
|
||||
:toolbar-buttons="toolbarButtons"
|
||||
:row-buttons="rowButtons"
|
||||
:pagination="pagination"
|
||||
help-url="/help/process-routing"
|
||||
:help-text="$t(ckey('help'))"
|
||||
auto-height
|
||||
@page-change="onPageChange"
|
||||
@selection-change="onSelect"
|
||||
/>
|
||||
|
||||
<page-dialog-form
|
||||
ref="dialogForm"
|
||||
:visible.sync="dialogVisible"
|
||||
:title="dialogTitle"
|
||||
:width="'35%'"
|
||||
:form-cols="formCols"
|
||||
:form-data="formData"
|
||||
:rules="rules"
|
||||
:label-width="'120px'"
|
||||
:submitting="submitting"
|
||||
:confirm-text="key('confirm')"
|
||||
:cancel-text="key('cancel')"
|
||||
@submit="onDialogSubmit"
|
||||
@close="onDialogClose"
|
||||
/>
|
||||
</d2-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { useTableColumns } from '@/composables/useTableColumns'
|
||||
import { useTableButtons } from '@/composables/useTableButtons'
|
||||
import { i18nMixin } from '@/composables/useI18n'
|
||||
import { confirmMixin } from '@/composables/useConfirmHandle'
|
||||
import {
|
||||
getProcessRoutingList,
|
||||
createProcessRouting,
|
||||
editProcessRouting,
|
||||
deleteProcessRouting,
|
||||
copyProcessRouting
|
||||
} from '@/api/production-master-data/process-routing'
|
||||
import { getProcessCategoryAll } from '@/api/production-master-data/process-category'
|
||||
import { getProductBatteryAll } from '@/api/production-master-data/product-management'
|
||||
import PageTable from '@/components/page-table'
|
||||
import PageDialogForm from '@/components/page-dialog-form'
|
||||
|
||||
export default {
|
||||
name: 'production-master-data-process-routing',
|
||||
components: { PageTable, PageDialogForm },
|
||||
mixins: [i18nMixin('page.production_master_data.process_model.process_routing'), confirmMixin],
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
submitting: false,
|
||||
tableData: [],
|
||||
selectedRows: [],
|
||||
dialogVisible: false,
|
||||
dialogTitle: '',
|
||||
editId: '',
|
||||
handleType: 'create',
|
||||
search: { code: '', name: '', flow_category_id: '', product_model_id: '' },
|
||||
pagination: { current: 1, size: 10, total: 0 },
|
||||
formData: {
|
||||
code: '',
|
||||
name: '',
|
||||
flow_category_id: '',
|
||||
product_model_id: '',
|
||||
remark: ''
|
||||
},
|
||||
categoryOptions: [],
|
||||
productOptions: [],
|
||||
searchCategoryOptions: [],
|
||||
searchProductOptions: [],
|
||||
rules: {
|
||||
code: [
|
||||
{ required: true, message: this.key('enter_code'), trigger: 'blur' },
|
||||
{ min: 1, max: 100, message: this.key('remark_length'), trigger: 'blur' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: this.key('enter_name'), trigger: 'blur' },
|
||||
{ min: 1, max: 100, message: this.key('remark_length'), trigger: 'blur' }
|
||||
],
|
||||
flow_category_id: [
|
||||
{ required: true, message: this.key('select_category'), trigger: 'change' }
|
||||
],
|
||||
product_model_id: [
|
||||
{ required: true, message: this.key('select_product'), trigger: 'change' }
|
||||
]
|
||||
},
|
||||
columns: [],
|
||||
toolbarButtons: [],
|
||||
rowButtons: [],
|
||||
formCols: [
|
||||
[
|
||||
{
|
||||
type: 'input',
|
||||
prop: 'code',
|
||||
label: this.key('code'),
|
||||
placeholder: this.key('enter_code'),
|
||||
clearable: true,
|
||||
disabled: false,
|
||||
style: { width: '90%' }
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
type: 'input',
|
||||
prop: 'name',
|
||||
label: this.key('name'),
|
||||
placeholder: this.key('enter_name'),
|
||||
clearable: true,
|
||||
style: { width: '90%' }
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
type: 'select',
|
||||
prop: 'flow_category_id',
|
||||
label: this.key('category'),
|
||||
placeholder: this.key('select_category'),
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
style: { width: '90%' },
|
||||
options: []
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
type: 'select',
|
||||
prop: 'product_model_id',
|
||||
label: this.key('product'),
|
||||
placeholder: this.key('select_product'),
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
style: { width: '90%' },
|
||||
options: []
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
type: 'input',
|
||||
prop: 'remark',
|
||||
inputType: 'textarea',
|
||||
autosize: { minRows: 2, maxRows: 6 },
|
||||
label: this.key('remark'),
|
||||
placeholder: this.key('enter_remark'),
|
||||
clearable: true,
|
||||
style: { width: '90%' }
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.columns = useTableColumns([
|
||||
{ prop: 'sort', label: this.key('sort'), width: 80 },
|
||||
{ prop: 'code', label: this.key('code'), minWidth: 120 },
|
||||
{ prop: 'name', label: this.key('name'), minWidth: 140 },
|
||||
{ prop: 'flow_category_name', label: this.key('category'), minWidth: 120 },
|
||||
{ prop: 'product_model_code', label: this.key('product'), minWidth: 140 },
|
||||
{ prop: 'remark', label: this.key('remark'), minWidth: 120 },
|
||||
{ prop: 'username', label: this.key('creator'), minWidth: 100 },
|
||||
{ prop: 'create_time', label: this.key('create_time'), width: 160 },
|
||||
{ prop: '_actions', label: this.key('operation'), width: 240, fixed: 'right' }
|
||||
])
|
||||
const btns = useTableButtons({
|
||||
toolbar: [
|
||||
{
|
||||
key: 'add',
|
||||
label: this.key('add'),
|
||||
icon: 'el-icon-plus',
|
||||
type: 'primary',
|
||||
auth: '/production_configuration/technology_model/technology_flow/create',
|
||||
onClick: this.openAdd
|
||||
}
|
||||
],
|
||||
row: [
|
||||
{
|
||||
key: 'edit',
|
||||
label: this.key('edit'),
|
||||
icon: 'el-icon-edit',
|
||||
auth: '/production_configuration/technology_model/technology_flow/edit',
|
||||
onClick: this.openEdit
|
||||
},
|
||||
{
|
||||
key: 'setProcess',
|
||||
label: this.key('set_process'),
|
||||
icon: 'el-icon-s-operation',
|
||||
color: 'primary',
|
||||
auth: '/production_configuration/technology_model/technology_flow/set_process',
|
||||
onClick: this.openProcessCard
|
||||
},
|
||||
{
|
||||
key: 'copy',
|
||||
label: this.key('copy'),
|
||||
icon: 'el-icon-document-copy',
|
||||
color: 'warning',
|
||||
auth: '/production_configuration/technology_model/technology_flow/copy',
|
||||
onClick: this.handleCopy
|
||||
},
|
||||
{
|
||||
key: 'delete',
|
||||
label: this.key('delete'),
|
||||
icon: 'el-icon-delete',
|
||||
color: 'danger',
|
||||
auth: '/production_configuration/technology_model/technology_flow/delete',
|
||||
onClick: this.handleDelete
|
||||
}
|
||||
]
|
||||
}, this.$permission)
|
||||
this.toolbarButtons = btns.toolbarButtons
|
||||
this.rowButtons = btns.rowButtons
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
async fetchData () {
|
||||
this.loading = true
|
||||
try {
|
||||
const res = await getProcessRoutingList({
|
||||
...this.search,
|
||||
page_no: this.pagination.current,
|
||||
page_size: this.pagination.size
|
||||
})
|
||||
const list = Array.isArray(res) ? res : (res.data || [])
|
||||
const total = Array.isArray(res) ? res.length : (res.count || 0)
|
||||
this.tableData = list
|
||||
this.pagination.total = total
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
onSearch () {
|
||||
this.pagination.current = 1
|
||||
this.fetchData()
|
||||
},
|
||||
onReset () {
|
||||
this.search = { code: '', name: '', flow_category_id: '', product_model_id: '' }
|
||||
this.pagination.current = 1
|
||||
this.fetchData()
|
||||
},
|
||||
onPageChange (page) {
|
||||
this.pagination.current = page.current
|
||||
this.pagination.size = page.size
|
||||
this.fetchData()
|
||||
},
|
||||
onSelect (rows) {
|
||||
this.selectedRows = rows
|
||||
},
|
||||
resetForm () {
|
||||
this.formData = {
|
||||
code: '',
|
||||
name: '',
|
||||
flow_category_id: '',
|
||||
product_model_id: '',
|
||||
remark: ''
|
||||
}
|
||||
this.editId = ''
|
||||
this.$nextTick(() => {
|
||||
this.formCols[0][0].disabled = false
|
||||
})
|
||||
},
|
||||
loadDialogCategories () {
|
||||
if (this.categoryOptions.length > 0) return
|
||||
getProcessCategoryAll().then(res => {
|
||||
this.categoryOptions = (res.data || res || []).map(item => ({
|
||||
label: item.name,
|
||||
value: item.id
|
||||
}))
|
||||
this.formCols[2][0].options = this.categoryOptions
|
||||
})
|
||||
},
|
||||
loadDialogProducts () {
|
||||
if (this.productOptions.length > 0) return
|
||||
getProductBatteryAll().then(res => {
|
||||
this.productOptions = (res.data || res || []).map(item => ({
|
||||
label: item.name,
|
||||
value: item.product_model_id
|
||||
}))
|
||||
this.formCols[3][0].options = this.productOptions
|
||||
})
|
||||
},
|
||||
loadSearchCategories () {
|
||||
if (this.searchCategoryOptions.length > 0) return
|
||||
getProcessCategoryAll().then(res => {
|
||||
this.searchCategoryOptions = res.data || res || []
|
||||
})
|
||||
},
|
||||
loadSearchProducts () {
|
||||
if (this.searchProductOptions.length > 0) return
|
||||
getProductBatteryAll().then(res => {
|
||||
this.searchProductOptions = res.data || res || []
|
||||
})
|
||||
},
|
||||
openAdd () {
|
||||
this.handleType = 'create'
|
||||
this.dialogTitle = this.key('add_title')
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dialogForm && this.$refs.dialogForm.reset()
|
||||
this.resetForm()
|
||||
this.loadDialogCategories()
|
||||
this.loadDialogProducts()
|
||||
this.dialogVisible = true
|
||||
})
|
||||
},
|
||||
openEdit (row) {
|
||||
this.handleType = 'edit'
|
||||
this.dialogTitle = this.key('edit_title')
|
||||
this.editId = row.id
|
||||
this.formData = {
|
||||
code: row.code,
|
||||
name: row.name,
|
||||
flow_category_id: row.flow_category_id || '',
|
||||
product_model_id: row.product_model_id || '',
|
||||
remark: row.remark || ''
|
||||
}
|
||||
this.loadDialogCategories()
|
||||
this.loadDialogProducts()
|
||||
this.$nextTick(() => {
|
||||
this.formCols[0][0].disabled = true
|
||||
})
|
||||
this.dialogVisible = true
|
||||
},
|
||||
openProcessCard (row) {
|
||||
this.$router.push({
|
||||
name: 'production_configuration-technology_model-technology_flow-process',
|
||||
params: { flow_id: row.id },
|
||||
query: { flow_name: row.name }
|
||||
})
|
||||
},
|
||||
async onDialogSubmit () {
|
||||
this.submitting = true
|
||||
try {
|
||||
if (this.handleType === 'create') {
|
||||
await createProcessRouting(this.formData)
|
||||
} else {
|
||||
await editProcessRouting({ ...this.formData, id: this.editId })
|
||||
}
|
||||
this.$message.success(this.$t(this.key('operation_success')))
|
||||
this.dialogVisible = false
|
||||
this.fetchData()
|
||||
} finally {
|
||||
this.submitting = false
|
||||
}
|
||||
},
|
||||
onDialogClose () {
|
||||
this.resetForm()
|
||||
},
|
||||
async handleDelete (row) {
|
||||
if (row.is_binding_batch === 1) {
|
||||
this.$message.warning(this.$t(this.key('batch_bound_no_delete')))
|
||||
return
|
||||
}
|
||||
const cancelled = await this.$confirmAction(
|
||||
{
|
||||
message: this.key('confirm_delete'),
|
||||
title: this.key('tip')
|
||||
},
|
||||
() => deleteProcessRouting({ id: [row.id] })
|
||||
)
|
||||
if (cancelled) return
|
||||
this.$message.success(this.$t(this.key('operation_success')))
|
||||
this.pagination.current = Math.min(
|
||||
this.pagination.current,
|
||||
Math.ceil((this.pagination.total - 1) / this.pagination.size) || 1
|
||||
)
|
||||
this.fetchData()
|
||||
},
|
||||
async handleCopy (row) {
|
||||
const cancelled = await this.$confirmAction(
|
||||
{
|
||||
message: this.key('confirm_copy'),
|
||||
title: this.key('tip')
|
||||
},
|
||||
() => copyProcessRouting({ id: [row.id] })
|
||||
)
|
||||
if (cancelled) return
|
||||
this.$message.success(this.$t(this.key('operation_success')))
|
||||
this.pagination.current = 1
|
||||
this.fetchData()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.search-bar {
|
||||
padding: 10px 0;
|
||||
}
|
||||
/deep/ .el-form-item--mini.el-form-item {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="title"
|
||||
:title="$t(title)"
|
||||
:visible.sync="visible"
|
||||
:append-to-body="true"
|
||||
:close-on-click-modal="false"
|
||||
@@ -86,7 +86,7 @@
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
:title="dialogTitle"
|
||||
:title="$t(dialogTitle)"
|
||||
:visible.sync="innerVisible"
|
||||
append-to-body
|
||||
width="600px"
|
||||
@@ -258,13 +258,13 @@ export default {
|
||||
this.innerVisible = true
|
||||
},
|
||||
handleDelete (row) {
|
||||
this.$confirm(this.key('confirm_delete_data'), this.key('tips'), {
|
||||
confirmButtonText: this.key('confirm'),
|
||||
cancelButtonText: this.key('cancel'),
|
||||
this.$confirm(this.$t(this.key('confirm_delete_data')), this.$t(this.key('tips')), {
|
||||
confirmButtonText: this.$t(this.key('confirm')),
|
||||
cancelButtonText: this.$t(this.key('cancel')),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteOptionalParams({ workingsubclass_id: this.workingsubclass_id, id: row.id }).then(() => {
|
||||
this.$message.success(this.key('operation_success'))
|
||||
this.$message.success(this.$t(this.key('operation_success')))
|
||||
this.fetchData()
|
||||
})
|
||||
}).catch(() => {})
|
||||
@@ -274,11 +274,8 @@ export default {
|
||||
if (!valid) return
|
||||
const action = this.formData.id ? editOptionalParams : createOptionalParams
|
||||
const data = { workingsubclass_id: this.workingsubclass_id, ...this.formData }
|
||||
if (this.formData.id) {
|
||||
delete data.id
|
||||
}
|
||||
action(data).then(() => {
|
||||
this.$message.success(this.key('operation_success'))
|
||||
this.$message.success(this.$t(this.key('operation_success')))
|
||||
this.innerVisible = false
|
||||
this.$refs.form.resetFields()
|
||||
this.fetchData()
|
||||
@@ -286,7 +283,7 @@ export default {
|
||||
})
|
||||
},
|
||||
handleImport () {
|
||||
this.$message.info(this.key('import_tip'))
|
||||
this.$message.info(this.$t(this.key('import_tip')))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="title"
|
||||
:title="$t(title)"
|
||||
:visible.sync="visible"
|
||||
:append-to-body="true"
|
||||
:close-on-click-modal="false"
|
||||
@@ -14,10 +14,17 @@
|
||||
:closable="false"
|
||||
show-icon
|
||||
/>
|
||||
<div class="setting-placeholder">
|
||||
<p>{{ $t(key('setting_placeholder')) }}</p>
|
||||
<el-tag type="warning">{{ type }}</el-tag>
|
||||
<div class="setting-meta">
|
||||
<el-tag v-if="type" type="warning" size="mini">{{ type }}</el-tag>
|
||||
<el-tag v-if="code" type="info" size="mini">{{ code }}</el-tag>
|
||||
</div>
|
||||
<el-input
|
||||
v-model="jsonText"
|
||||
type="textarea"
|
||||
:rows="16"
|
||||
resize="vertical"
|
||||
:placeholder="jsonPlaceholder"
|
||||
/>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleClose">{{ $t(key('cancel')) }}</el-button>
|
||||
@@ -57,18 +64,65 @@ export default {
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
jsonText: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
settingTip () {
|
||||
return this.$t(this.key('setting_tip'))
|
||||
},
|
||||
jsonPlaceholder () {
|
||||
return '{\n "key": "value"\n}'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
visible: {
|
||||
handler (val) {
|
||||
if (val) {
|
||||
this.resetJsonText()
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
pluginData: {
|
||||
handler () {
|
||||
if (this.visible) {
|
||||
this.resetJsonText()
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
resetJsonText () {
|
||||
const data = this.pluginData
|
||||
if (data === undefined || data === null || data === '') {
|
||||
this.jsonText = '{}'
|
||||
return
|
||||
}
|
||||
if (typeof data === 'string') {
|
||||
this.jsonText = data.trim() ? data : '{}'
|
||||
return
|
||||
}
|
||||
this.jsonText = JSON.stringify(data, null, 2)
|
||||
},
|
||||
handleClose () {
|
||||
this.$emit('close')
|
||||
},
|
||||
handleSubmit () {
|
||||
this.$message.success(this.key('operation_success'))
|
||||
this.$emit('close')
|
||||
const raw = (this.jsonText || '').trim()
|
||||
if (!raw) {
|
||||
this.$emit('submit', {})
|
||||
return
|
||||
}
|
||||
try {
|
||||
const parsed = JSON.parse(raw)
|
||||
this.$emit('submit', parsed)
|
||||
} catch (error) {
|
||||
this.$message.error('JSON 格式不正确')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,14 +132,9 @@ export default {
|
||||
.setting-content {
|
||||
padding: 10px 0;
|
||||
}
|
||||
.setting-placeholder {
|
||||
margin-top: 20px;
|
||||
text-align: center;
|
||||
padding: 40px 0;
|
||||
color: #909399;
|
||||
}
|
||||
.setting-placeholder p {
|
||||
margin-bottom: 15px;
|
||||
font-size: 14px;
|
||||
.setting-meta {
|
||||
margin: 16px 0 12px;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -93,8 +93,10 @@ import {
|
||||
getProcessStepList,
|
||||
createProcessStep,
|
||||
editProcessStep,
|
||||
deleteProcessStep
|
||||
deleteProcessStep,
|
||||
settingSubmit
|
||||
} from '@/api/production-master-data/process-step'
|
||||
import { getDeviceCategoryAll } from '@/api/production-master-data/device-category'
|
||||
import PageTable from '@/components/page-table'
|
||||
import PageDialogForm from '@/components/page-dialog-form'
|
||||
import TechnologyFlowModel from './components/technology-flow-model.vue'
|
||||
@@ -193,7 +195,7 @@ export default {
|
||||
},
|
||||
created () {
|
||||
this.columns = useTableColumns([
|
||||
{ prop: 'sort', label: this.key('sort'), width: 80 },
|
||||
{ prop: 'sort ', label: this.key('sort'), width: 80 },
|
||||
{ prop: 'code', label: this.key('process_unit_code'), minWidth: 120 },
|
||||
{ prop: 'name', label: this.key('process_unit_name'), minWidth: 120 },
|
||||
{ prop: 'device_category_name', label: this.key('device_category'), minWidth: 120 },
|
||||
@@ -216,7 +218,7 @@ export default {
|
||||
key: 'edit',
|
||||
label: this.key('edit'),
|
||||
icon: 'el-icon-edit',
|
||||
auth: '/production_configuration/technology_model/technology_flow_workingsubclass/edit',
|
||||
auth: '/production_configuration/technology_model/technology_flow_process/edit',
|
||||
onClick: this.openEdit
|
||||
},
|
||||
{
|
||||
@@ -250,6 +252,16 @@ export default {
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
loadDeviceCategoryOptions () {
|
||||
if (this.formCols[2][0].options.length > 0) return Promise.resolve()
|
||||
return getDeviceCategoryAll().then(res => {
|
||||
const list = res.data || res || []
|
||||
this.formCols[2][0].options = list.map(item => ({
|
||||
label: item.name,
|
||||
value: item.id
|
||||
}))
|
||||
})
|
||||
},
|
||||
async fetchData () {
|
||||
this.loading = true
|
||||
try {
|
||||
@@ -293,10 +305,12 @@ export default {
|
||||
openAdd () {
|
||||
this.handleType = 'create'
|
||||
this.dialogTitle = this.key('add_process_unit')
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dialogForm && this.$refs.dialogForm.reset()
|
||||
this.resetForm()
|
||||
this.dialogVisible = true
|
||||
this.loadDeviceCategoryOptions().then(() => {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dialogForm && this.$refs.dialogForm.reset()
|
||||
this.resetForm()
|
||||
this.dialogVisible = true
|
||||
})
|
||||
})
|
||||
},
|
||||
openEdit (row) {
|
||||
@@ -312,7 +326,9 @@ export default {
|
||||
this.$nextTick(() => {
|
||||
this.formCols[0][0].disabled = true
|
||||
})
|
||||
this.dialogVisible = true
|
||||
this.loadDeviceCategoryOptions().then(() => {
|
||||
this.dialogVisible = true
|
||||
})
|
||||
},
|
||||
async onDialogSubmit () {
|
||||
this.submitting = true
|
||||
@@ -351,14 +367,20 @@ export default {
|
||||
openSetting (row) {
|
||||
this.currentRowId = row.id
|
||||
this.settingTitle = this.key('preset_setting')
|
||||
this.settingType = row.device_category_id || ''
|
||||
this.settingType = row.device_category_code || row.device_category_name || ''
|
||||
this.settingCode = row.code
|
||||
this.settingWidth = '60%'
|
||||
this.settingPluginData = row.setting || {}
|
||||
this.settingVisible = true
|
||||
},
|
||||
handleSettingSubmit (data) {
|
||||
async handleSettingSubmit (data) {
|
||||
await settingSubmit({
|
||||
id: this.currentRowId,
|
||||
setting: JSON.stringify(data)
|
||||
})
|
||||
this.$message.success(this.$t(this.key('operation_success')))
|
||||
this.settingVisible = false
|
||||
this.fetchData()
|
||||
},
|
||||
openResult (row) {
|
||||
this.currentRowId = row.id
|
||||
|
||||
Reference in New Issue
Block a user