|
@@ -36,7 +36,7 @@
|
|
|
</a-col>
|
|
|
|
|
|
<a-col :md="6" :sm="8">
|
|
|
- <a-form-model-item label="报关品名" prop="declarationName">
|
|
|
+ <a-form-model-item label="报关品名" prop="declarationName" :rules="[{ required: true, message: '请输入报关品名!' }]">
|
|
|
<a-input placeholder="请输入报关品名" v-model="declareElements.declarationName"></a-input>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
@@ -47,7 +47,7 @@
|
|
|
</a-form-model-item>
|
|
|
</a-col> -->
|
|
|
<a-col :md="6" :sm="8">
|
|
|
- <a-form-model-item label="HSCODE" prop="hsCode">
|
|
|
+ <a-form-model-item label="HSCODE" prop="hsCode" :rules="[{ required: true, message: '请输入HSCODE!' }]">
|
|
|
<a-input placeholder="请输入HSCODE" v-model="declareElements.hsCode"></a-input>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
@@ -58,7 +58,7 @@
|
|
|
</a-form-model-item>
|
|
|
</a-col> -->
|
|
|
<a-col :md="6" :sm="8">
|
|
|
- <a-form-model-item label="英文品名" prop="englishProductName">
|
|
|
+ <a-form-model-item label="英文品名" prop="englishProductName" :rules="[{ required: true, message: '请输入英文品名!' }]">
|
|
|
<a-input placeholder="请输入英文品名" v-model="declareElements.englishProductName"></a-input>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
@@ -94,7 +94,7 @@
|
|
|
<template slot="typeValueSlot" slot-scope="text, record, index">
|
|
|
<a-form-model-item prop="typeValue">
|
|
|
<j-dict-select-tag v-model="record.typeValue" placeholder="请选择类型" style="text-align:left;"
|
|
|
- dictCode="sys_dict_item,item_text,item_text,dict_id='1536626597689970689'" >
|
|
|
+ dictCode="sys_dict_item,item_text,item_text,dict_id='1536626597689970689'" :disabled="pushState">
|
|
|
</j-dict-select-tag>
|
|
|
</a-form-model-item>
|
|
|
</template>
|
|
@@ -102,15 +102,22 @@
|
|
|
<!-- 描述 输入框-->
|
|
|
<template slot="describeText" slot-scope="text, record, index">
|
|
|
<a-form-model-item prop="describeText">
|
|
|
- <a-input style="width:100%" type="text" v-model="record.describeText" />
|
|
|
+ <a-input style="width:100%" type="text" v-model="record.describeText" :disabled="pushState"/>
|
|
|
+ </a-form-model-item>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template slot="state" slot-scope="text, record, index">
|
|
|
+ <a-form-model-item prop="state">
|
|
|
+ <a-input style="width:100%" type="text" v-model="state" />
|
|
|
</a-form-model-item>
|
|
|
</template>
|
|
|
|
|
|
<!-- 操作 -->
|
|
|
- <span slot="operationSlot" slot-scope="text, record, index">
|
|
|
- <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(index)">
|
|
|
- <a href="javascript:void(0);" style="color:red;">删除</a>
|
|
|
+ <span slot="operationSlot" slot-scope="text, record, index" >
|
|
|
+ <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(index)" v-if="!pushState">
|
|
|
+ <a href="javascript:void(0);" style="color:red;">删除</a>
|
|
|
</a-popconfirm>
|
|
|
+ <a style="color:red;" v-if="pushState" @click="handleNotDelete">删除</a>
|
|
|
</span>
|
|
|
</a-table>
|
|
|
</a-form-model>
|
|
@@ -158,6 +165,7 @@ export default {
|
|
|
|
|
|
return {
|
|
|
loading: false, // 表格加载
|
|
|
+ pushState: false, //是否推送
|
|
|
// 子表表头
|
|
|
declareElementsColumns: [
|
|
|
{
|
|
@@ -200,7 +208,7 @@ export default {
|
|
|
// 接收父组件 方法
|
|
|
props: {},
|
|
|
|
|
|
- created() {},
|
|
|
+ created() { },
|
|
|
methods: {
|
|
|
// 増行
|
|
|
handleAddColumn() {
|
|
@@ -215,12 +223,22 @@ export default {
|
|
|
},
|
|
|
// 报关要素 保存
|
|
|
addSave() {
|
|
|
- var type = []
|
|
|
+ //表单验证
|
|
|
+ this.$refs.form.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ var type = [],
|
|
|
+ sta = true
|
|
|
this.declareElementsData.map(item => {
|
|
|
type.push(item.typeValue)
|
|
|
+ if(item.typeValue === '' || item.describeText === ''){
|
|
|
+ sta = false
|
|
|
+ }
|
|
|
})
|
|
|
var typeSet = [...new Set(type)]
|
|
|
- if(typeSet.length !== type.length){
|
|
|
+ //类型/描述为空时
|
|
|
+ if(!sta){
|
|
|
+ this.$message.error("类型/描述均不可为空!");
|
|
|
+ } else if(typeSet.length !== type.length){ //类名重复时
|
|
|
this.$message.error("类型不能重复选择!");
|
|
|
} else {
|
|
|
console.log('点击报关要素对话框 保存')
|
|
@@ -246,6 +264,9 @@ export default {
|
|
|
// 刷新
|
|
|
}
|
|
|
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
},
|
|
|
handletypeValue(e) {
|
|
|
console.log('类型下拉菜单click', e)
|
|
@@ -254,8 +275,18 @@ export default {
|
|
|
handleDelete(index) {
|
|
|
console.log('index', index)
|
|
|
console.log('删除报关要素数据', index)
|
|
|
- return this.declareElementsData.splice(index, 1)
|
|
|
+ if(this.declareElementsData.length === 1){
|
|
|
+ this.$message.error("明细至少有一行!");
|
|
|
+ }else {
|
|
|
+ return this.declareElementsData.splice(index, 1)
|
|
|
+ }
|
|
|
},
|
|
|
+
|
|
|
+ //已推送的情况下删除
|
|
|
+ handleNotDelete(){
|
|
|
+ this.$message.error("不可删除!");
|
|
|
+ },
|
|
|
+
|
|
|
close() {
|
|
|
this.$emit('close')
|
|
|
this.declareElementsModVis = false
|