|
@@ -76,19 +76,13 @@
|
|
|
<el-form-item label="合同类型" prop="contractTypes"
|
|
|
:rules="[{required: true, message: '合同类型不能为空', trigger: 'blur'}
|
|
|
]" >
|
|
|
- <div style="width: 100%;" v-if="method !=='view'">
|
|
|
- <el-cascader v-model="inputForm.contractTypes" :options="typeData" @change="handleChange" clearable :props="{
|
|
|
- checkStrictly: true,
|
|
|
- value: 'value',
|
|
|
- label: 'label', // 显示名称
|
|
|
- children: 'children', // 子级字段名
|
|
|
- multiple: true
|
|
|
- }"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div v-else-if="method ==='view'">
|
|
|
- <el-input maxlength="64" :readonly="true" v-model="inputForm.contractTypes" placeholder="请输入合同类型"></el-input>
|
|
|
- </div>
|
|
|
+ <el-cascader style="width: 100%" v-model="inputForm.contractTypes" :options="typeData" @change="handleChange" clearable :props="{
|
|
|
+ value: 'value',
|
|
|
+ label: 'label', // 显示名称
|
|
|
+ children: 'children', // 子级字段名
|
|
|
+ multiple: true
|
|
|
+ }"
|
|
|
+ />
|
|
|
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -534,6 +528,10 @@
|
|
|
primaryLinkman:'',
|
|
|
}
|
|
|
this.inputForm.id = id
|
|
|
+
|
|
|
+ this.typeData.forEach(option => {
|
|
|
+ option.disabled = false
|
|
|
+ })
|
|
|
if (method === 'add') {
|
|
|
// this.inputForm.id = 'add'
|
|
|
this.title = `新建合同`
|
|
@@ -554,10 +552,12 @@
|
|
|
this.contractService.findContractById(this.inputForm.id).then((data) => {
|
|
|
this.inputForm = this.recover(this.inputForm, data)
|
|
|
this.inputForm.contractNo=data.no
|
|
|
- this.inputForm.contractTypes=data.contractTypes[0][1].split(data.contractTypes[0][1].lastIndexOf(","))
|
|
|
+ this.inputForm.contractTypes=data.contractTypeList
|
|
|
+ if(data.contractType){
|
|
|
+ this.showType(data.contractType)
|
|
|
+ }
|
|
|
this.inputForm.department=data.department
|
|
|
- // this.inputForm.cwWorkClientContactDTOList=data.cwWorkClientContactDTOList
|
|
|
- console.log('data',data)
|
|
|
+ console.log('data',data.contractTypes)
|
|
|
if (this.commonJS.isEmpty(this.inputForm.department)) {
|
|
|
this.inputForm.department = this.$store.state.user.office.id
|
|
|
}
|
|
@@ -828,15 +828,68 @@
|
|
|
},
|
|
|
//将合同类型进行绑定
|
|
|
handleChange(value){
|
|
|
- this.inputForm.contractTypes=value
|
|
|
- this.inputForm.contractTypes.forEach((item)=>{
|
|
|
- if (this.inputForm.contractTypes[0][0]!==item[0]){
|
|
|
- this.$message.warning(`一级合同类型只能选择一个`)
|
|
|
- this.inputForm.contractTypes=[]
|
|
|
+ if(value.length > 0 ){
|
|
|
+ // 处理禁用状态
|
|
|
+ this.$nextTick(() => {
|
|
|
+ var options = []
|
|
|
+ var optionKey = '';
|
|
|
+ this.typeData.forEach(option => {
|
|
|
+ if (value.find(array => array[0] === option.value)) {
|
|
|
+ option.disabled = false
|
|
|
+ optionKey = option.value
|
|
|
+ } else {
|
|
|
+ option.disabled = true
|
|
|
+ }
|
|
|
+ options.push(option)
|
|
|
+ })
|
|
|
+
|
|
|
+ this.typeData.forEach(option => {
|
|
|
+ if (option.value === optionKey) {
|
|
|
+ option.children.forEach(child => {
|
|
|
+ child.disabled = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ option.disabled = true
|
|
|
+ }
|
|
|
+ options.push(option)
|
|
|
+ })
|
|
|
+ // 重新进行赋值
|
|
|
+ this.options = options
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.typeData.forEach(option => {
|
|
|
+ option.disabled = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ /*修改或查询详情是合同类型展示处理*/
|
|
|
+ showType(typeList){
|
|
|
+ var optionKey = '';
|
|
|
+ this.typeData.forEach(option => {
|
|
|
+ console.log(option.value)
|
|
|
+ option.children.forEach(child => {
|
|
|
+ if(typeList.indexOf(child.value) != -1) {
|
|
|
+ child.disabled = false
|
|
|
+ optionKey = option.value
|
|
|
+ }else{
|
|
|
+ child.disabled = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+ this.typeData.forEach(option => {
|
|
|
+ if (option.value === optionKey) {
|
|
|
+ option.children.forEach(child => {
|
|
|
+ child.disabled = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ option.disabled = true
|
|
|
}
|
|
|
})
|
|
|
- this.inputForm.contractTypes = JSON.parse(JSON.stringify(value))
|
|
|
- console.log('value',this.inputForm.contractTypes)
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|