Commit a367d4c3 authored by 旭艳's avatar 旭艳

胶料调配卡流程中表单调试

parent 92b78efe
......@@ -80,6 +80,9 @@ export default {
},
{
'name': 'material'
},
{
'name': 'assignCardItems'
}],
'toValidateKeys': ''
}
......
<template>
<dee-dialog
:title="`${form.id ? '编辑分装' :'创建分装'}`"
:dialog-visible.sync="visible"
width="50%"
:before-close="handleClose"
>
<dee-form
ref="form"
:form="form"
:form-data="formFileds"
:rules="rules"
form-btn-position="center"
label-width="150px"
>
<section>
<el-button
:disabled="disabled"
type="primary"
size="small"
@click="save"
>确定</el-button>
<el-button
:disabled="disabled"
size="small"
@click="handleClose"
>取消</el-button>
</section>
</dee-form>
</dee-dialog>
</template>
<script>
import { post } from '@/utils/http'
export default {
props: {
cardId: {
type: Number,
default: () => null
},
newCardNo: {
type: String,
default: () => null
}
},
data() {
var weight = (rule, value, callback) => {
if (!value) {
callback(new Error('请输入重量'))
} else {
if ((value) <= 0) {
callback(new Error('重量不能小于0等于0'))
}
callback()
}
}
return {
visible: false,
disabled: false,
form: {},
row: {},
rules: {
weight: [{ required: true, validator: weight, trigger: 'change' }]
},
formFileds: [
{
split: 2,
data: [
{
title: '解冻领料时间',
key: 'thawPickTime',
component: {
disabled: false,
clearable: true,
name: 'el-date-picker',
placeholder: '请输入解冻领料时间',
type: 'datetime',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
}
},
{
title: '剩余活性期',
key: 'activeTime',
component: {
disabled: false,
clearable: true,
name: 'el-date-picker',
placeholder: '请输入剩余活性期',
type: 'datetime',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
}
},
{
title: '重量/g',
key: 'weight',
component: {
disabled: false,
clearable: true,
name: 'el-input',
placeholder: '请输入重量',
type: 'number',
min: '0'
}
}
]
}
]
}
},
created() {},
methods: {
// 打开弹出框
open(row = {}) {
this.form = { ...row }
if (row.id) {
this.$set(this.formFileds[0].data[2].component, 'disabled', true)
} else {
this.$set(this.formFileds[0].data[2].component, 'disabled', false)
}
this.visible = true
this.$refs.form && this.$refs.form.reset()
},
/**
* 保存功能
* 根据是否有id处理创建和编辑逻辑
*/
save() {
var params = {}
if (this.form.id) {
params = {
id: this.form.id,
operator: 'MODIFY',
assignCard: {
id: this.cardId, // 记录卡id
dxClassname: 'com.yonde.tf.mom.common.vo.schedule.AssignCardVO',
subTypeName: 'AssignCardLacquer',
cardNo: this.newCardNo // 记录卡编号
},
thawPickTime: this.form.thawPickTime, // 解冻领料时间,录入
activeTime: this.form.activeTime // 剩余活性期,录入
}
post('/AssignCardItem/recursion', params)
.then((res) => {
this.reset('编辑')
})
.catch((err) => console.log(err))
.finally(() => {
this.disabled = false
})
} else {
params = {
operator: 'ADD',
assignCard: {
id: this.cardId, // 记录卡id
dxClassname: 'com.yonde.tf.mom.common.vo.schedule.AssignCardVO',
subTypeName: 'AssignCardLacquer',
cardNo: this.newCardNo // 记录卡编号
},
...this.form
}
this.$refs.form.validate((valid) => {
if (!valid) {
this.$utils.showMessageWarning('请完整填写表单')
return false
}
this.disabled = true
post('/AssignCardItem/recursion', params)
.then((res) => {
this.reset('创建')
})
.catch((err) => console.log(err))
.finally(() => {
this.disabled = false
})
})
}
},
// 重置弹出框
reset(message) {
this.visible = false
this.$message({
message: `${message}成功`,
type: 'success'
})
this.$emit('reload')
},
// 取消
handleClose() {
this.$refs.form.reset()
this.visible = false
}
}
}
</script>
<template>
<div class="lacquerFreeze">
<section class="GlueBlendingCard-right-content-footer">
<el-form
ref="form2"
class="GlueBlendingCard-footer-form"
:model="form2"
label-width="130px"
:rules="rules2"
>
<el-row>
<el-col :span="6">
<el-form-item label="剩余施工期/mim" prop="leftWorkMinutes">
<el-input
v-model="form2.leftWorkMinutes"
class="input-with-select el-input--small"
placeholder="请输入剩余施工期"
clearable
:disabled="disabled"
type="Number"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="失效期" prop="validityEnd">
<el-date-picker
v-model="form2.validityEnd"
type="datetime"
class="input-with-select el-input--small"
placeholder="请选择失效期"
style="width: 220px"
:disabled="disabled"
format="yyyy 年 MM 月 dd 日 HH:mm"
value-format="yyyy-MM-dd HH:mm:ss"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="" prop="isFreezing">
<el-radio-group
v-model="form2.isFreezing"
:disabled="disabled"
>
<el-radio label="true">需要</el-radio>
<el-radio label="false">不需要</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col v-if="form2.isFreezing === 'true'" :span="6">
<el-form-item label="冷冻温度/℃" prop="freezTemperature">
<el-input
v-model="form2.freezTemperature"
placeholder="请输入冷冻温度/℃"
clearable
class="input-with-select el-input--small"
:disabled="disabled"
type="Number"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="table">
<!-- 表格 -->
<dee-table
:index-row="indexRow"
:columns="colums2"
:data="tableData2"
:options="tableOptions2"
@row-click="rowClick2"
>
<dee-tools slot="header" :tools="tools" mode="normal" />
</dee-table>
</div>
</section>
<Dialog
ref="dialog"
:new-card-no="basicData.cardNo"
:card-id="basicData.id"
@reload="reload"
/>
</div>
</template>
<script>
import Dialog from './dialog'
import { post } from '@/utils/http'
export default {
name: 'LacquerFreeze',
componentName: '流程中冷冻',
components: {
Dialog
},
props: {
basicData: {
type: Object,
default: () => null
}
},
data() {
return {
disabled: false,
loading: false,
// 左侧行ID
cardId: null,
// 左侧行编号
newCardNo: null,
tools: [{
name: '分装',
icon: '/icons/c-add.png',
handler: {
click: (e) => {
this.$refs.dialog.open()
}
}
}],
colums2: [
{
title: '操作',
show: true,
key: 'operate',
align: 'center',
hideTip: true,
component: {
show: true,
name: 'EditTableRow',
props: {
btns: [
{
operation: '编辑',
handleClick: (row, index) => this.$refs.dialog.open(row),
icon: '/icons/c-edit.png',
showFun: (row) => true
},
{
operation: '删除',
icon: '/icons/c-creatbackups.png',
showFun: (row) => true,
handleClick: (row, index) => {
const params = {
id: row.id, // 分装id
operator: 'REMOVE'
}
this.$confirm('确定删除此条数据?', '删除确认', {
type: 'error'
})
.then(() => {
this.HttpRequest(
'/AssignCardItem/deleteItem',
params,
'post'
)
.then((res) => {
this.reset('删除')
this.getLasousInstallation()
})
.catch((err) => console.log(err))
.finally(() => {})
})
.catch(() => {})
}
}
]
}
},
width: 100
},
{
title: '分装编号',
show: true,
key: 'itemNo',
sortable: true
},
{
title: '解冻领料时间',
show: true,
key: 'thawPickTime',
sortable: true
},
{
title: '剩余活性期',
show: true,
key: 'activeTime',
sortable: true
},
{ title: '重量', show: true, key: 'weight', sortable: true }
],
rules2: {
isFreezing: [
{ required: true, message: '请选择是否需要冷冻', trigger: 'blur' }
],
freezTemperature: [
{ required: true, message: '请输入冷冻温度', trigger: 'blur' }
]
},
form2: {
isFreezing: '', // 是否需要冷冻
freezTemperature: '', // 冷冻温度
leftWorkMinutes: '', // 剩余施工期
validityEnd: '' // 失效期
},
// 冷冻表格数据
// tableData2: [],
// 序号
indexRow: { title: '序号', align: 'center', width: '70' },
// 表格样式配置
tableOptions2: {
stripe: true,
border: true,
height: '29vh'
}
}
},
watch: {
basicData: {
immediate: true,
deep: true,
handler: function(val) {
if (val.assignCardItems && val.assignCardItems.length > 0) {
this.tableData2 = this.basicData.assignCardItems
}
}
}
},
methods: {
rowClick2(row) {
this.row2 = row.id
},
reload() {
this.getLasousInstallation()
},
getLasousInstallation() {
const params = {
pageFrom: 1,
pageSize: 99999,
indices: ['AssignCardItem'],
searchItems: {
items: [
{
fieldName: 'subTypeName',
operator: 'EQ',
value: 'AssignCardItem'
},
{
fieldName: 'assignCardId',
operator: 'EQ',
value: this.row.pboId // 记录卡id
}
],
operator: 'AND'
}
}
post('/AssignCardItem/find/recursion', params)
.then((res) => {
this.tableData2 = res.items.content
})
.catch((err) => console.log(err))
.finally(() => {})
},
// 重置弹出框
reset(message) {
this.$message({
message: `${message}成功`,
type: 'success'
})
if (message !== '保存') {
this.tableData = []
this.tableData2 = []
this.$refs.form.resetFields()
this.$refs.form2.resetFields()
this.$emit('reload')
}
}
}
}
</script>
<style lang="scss">
.lacquerFreeze {
.GlueBlendingCard-right-content-footer {
flex: 7.7;
// border: 1px solid #ccc;
// border-radius: 8px;
height: 100%;
overflow: hidden;
height: 100%;
box-sizing: border-box;
.header-title {
display: flex;
justify-content: space-between;
border-bottom: 1px solid #ccc;
height: 60px;
line-height: 60px;
box-sizing: border-box;
padding: 0 20px;
.left {
.icon,
.title {
vertical-align: middle;
margin-right: 10px;
cursor: default;
}
.title {
font-size: 20px;
}
}
.right {
.icon {
cursor: pointer;
padding: 10px 10px;
border-radius: 5px;
&:hover {
background-color: #e4e1e1;
}
.check,
.subpackage {
width: 16px;
height: 16px;
vertical-align: middle;
margin-right: 8px;
}
.b-rename {
width: 20px;
height: 20px;
vertical-align: middle;
}
> span {
vertical-align: middle;
}
}
}
}
.GlueBlendingCard-footer-form {
box-sizing: border-box;
padding: 10px 10px 5px 10px;
border-bottom: 1px solid #ccc;
.el-col {
padding: 0;
.el-form-item {
margin-bottom: 0;
}
}
.el-input {
height: 32px !important;
.el-input__inner {
height: 32px !important;
}
}
}
.table {
height: calc(100% - 118px);
//overflow: auto;
padding: 10px 20px 20px 20px;
}
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment