|
@@ -24,18 +24,18 @@
|
|
|
<saga-button
|
|
|
v-if="!isChangeVender"
|
|
|
@click="create"
|
|
|
- >增加 {{obj.name}} “ {{fm.Infos[key] || ""}} ”</saga-button>
|
|
|
+ >增加 {{obj.name}} “ {{val ? val : fm.Infos[key]}} ”</saga-button>
|
|
|
<saga-button v-if="isChangeVender" @click="changeVender">更新厂商库中此{{obj.name}}对应值</saga-button>
|
|
|
</template>
|
|
|
<!-- <template v-else>
|
|
|
<p>{{ !!message ? message : "请确定该信息点内有值"}}</p>
|
|
|
</template>-->
|
|
|
</div>
|
|
|
- <div class="saga-change-name">
|
|
|
+ <div class="saga-change-name" v-if="elseBtnsShow">
|
|
|
<h3 class="saga-gray saga-explain">您可能需要其他快捷操作</h3>
|
|
|
<!-- <saga-button @click="checkVenders">先维护 xxx 信息点</saga-button> -->
|
|
|
<saga-button @click="checkVenders" v-if="showBtn">批量维护 {{!!obj ? obj.name : ""}} 相关信息点</saga-button>
|
|
|
- <saga-button v-if="!showBtn">先维护 {{!!obj ? obj.name : ""}} 信息点</saga-button>
|
|
|
+ <saga-button v-if="!showBtn">先维护 {{objMsg}}</saga-button>
|
|
|
<!-- <saga-button @click="checkVenders"></saga-button> -->
|
|
|
</div>
|
|
|
</div>
|
|
@@ -97,7 +97,11 @@ export default {
|
|
|
isChangeFor: false,
|
|
|
isChangeVender: false,
|
|
|
isChangeId: true,//是否为修改id
|
|
|
- noIdChangeVal: ""
|
|
|
+ noIdChangeVal: "",
|
|
|
+ elseBtnsShow: true, //是否显示修改按钮
|
|
|
+ msgTable: true,
|
|
|
+ content: {},//厂商库信息点
|
|
|
+ objMsg: "相关信息点"
|
|
|
}
|
|
|
},
|
|
|
created() { },
|
|
@@ -183,8 +187,9 @@ export default {
|
|
|
this.message = ""
|
|
|
this.key = infosKey.split(".")[1]
|
|
|
this.obj = getJson(this.infosKey.split(".")[1])
|
|
|
- console.log(this.obj)
|
|
|
+ console.log("数据请求", this.obj)
|
|
|
if (!!this.obj) {
|
|
|
+ console.log("有data")
|
|
|
this.hasData = true
|
|
|
this.getDataForm()
|
|
|
} else {
|
|
@@ -200,44 +205,56 @@ export default {
|
|
|
keysArr = ["DPInsurerID", "DPSupplierID", "DPMaintainerID"]
|
|
|
//如果是三大厂商的网址
|
|
|
if (webArr.indexOf(this.key) > -1) {
|
|
|
- console.log("三大网址")
|
|
|
let param = {
|
|
|
venderId: this.fm.Infos[this.obj.infosKey],
|
|
|
website: this.fm.Infos[this.key]
|
|
|
}
|
|
|
- console.log(param, "param")
|
|
|
this.obj.updateVender(param, res => {
|
|
|
- this.loadFm()
|
|
|
+ this.updateKey(this.key, this.fm)
|
|
|
})
|
|
|
return false
|
|
|
} else if (keysArr.indexOf(this.obj.infosKey) > -1) {
|
|
|
- console.log("三大厂商的联系人")
|
|
|
let param = {
|
|
|
venderId: this.fm.Infos[this.obj.infosKey],
|
|
|
- projectId: this.$route.query.projId,
|
|
|
- [this.getKey(this.obj.options, this.key)]: this.fm.Infos[this.key]
|
|
|
+ projectId: this.$route.query.projId
|
|
|
+ }
|
|
|
+ //如果存在content的联系人
|
|
|
+ console.log(this.content, "content")
|
|
|
+ if (this.content.hasOwnProperty("contact")) {
|
|
|
+ let contents = this.content.contact
|
|
|
+ for (let k in contents) {
|
|
|
+ param[k] = contents[k]
|
|
|
+ }
|
|
|
}
|
|
|
- console.log(param, "param")
|
|
|
+ param[[this.getKey(this.obj.options, this.key)]] = this.fm.Infos[this.key]
|
|
|
this.obj.update(param, res => {
|
|
|
- this.loadFm()
|
|
|
+ this.updateKey(this.key, this.fm)
|
|
|
})
|
|
|
return false
|
|
|
} else {
|
|
|
- console.log("型号")
|
|
|
let param = {
|
|
|
specificationId: this.fm.Infos.DPSpecificationID,
|
|
|
infos: {
|
|
|
[this.key]: this.fm.Infos[this.key]
|
|
|
}
|
|
|
}
|
|
|
- console.log(param, "param")
|
|
|
- this.obj.updateVenderSpecification(param, res => {
|
|
|
- this.loadFm()
|
|
|
+ this.obj.updateVender(param, res => {
|
|
|
+ this.updateKey(this.key, this.fm)
|
|
|
})
|
|
|
return false
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ updateKey(key, obj) {
|
|
|
+ let param = {
|
|
|
+ FmId: obj.FmId,
|
|
|
+ Infos: {
|
|
|
+ [key]: null
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.updateMain(param)
|
|
|
+ },
|
|
|
+
|
|
|
/**
|
|
|
* @param arr 传入的数组
|
|
|
* @param key 传入的key
|
|
@@ -269,7 +286,7 @@ export default {
|
|
|
},
|
|
|
//falg为是否存在id
|
|
|
falgChange(falg) {
|
|
|
- if (!!this.fm.Infos[this.key]) {
|
|
|
+ if (this.val || !!this.fm.Infos[this.key]) {
|
|
|
|
|
|
//存在id且单元格存在值
|
|
|
if (falg) {
|
|
@@ -285,19 +302,24 @@ export default {
|
|
|
}
|
|
|
} else {
|
|
|
//不存在值
|
|
|
- this.changeList = []
|
|
|
- this.changeMsg = "请确定该单元格内存在值"
|
|
|
+ // this.isChangeFor = false
|
|
|
+ // this.isSameForCreate = true
|
|
|
+ // this.changeList = []
|
|
|
+ this.noIdDo()
|
|
|
+ // this.changeMsg = "请确定该单元格内存在值"
|
|
|
}
|
|
|
},
|
|
|
|
|
|
//没有id执行
|
|
|
noIdDo() {
|
|
|
- this.createShow = true
|
|
|
- this.showBtn = false
|
|
|
+ console.log("没有id")
|
|
|
let param = {
|
|
|
infoCode: this.key,
|
|
|
infoValue: this.val || this.fm.Infos[this.key]
|
|
|
- }
|
|
|
+ }, falg = true
|
|
|
+ this.createShow = true
|
|
|
+ this.showBtn = false
|
|
|
+ this.elseBtnsShow = true
|
|
|
if (this.key == "Brand") {
|
|
|
param.manufacturerID = this.fm.Infos.DPManufacturerID
|
|
|
}
|
|
@@ -306,29 +328,111 @@ export default {
|
|
|
param.brandID = this.fm.Infos.DPBrandID
|
|
|
param.eqFamily = this.fm.Family
|
|
|
}
|
|
|
+
|
|
|
+ for (let k in param) {
|
|
|
+ if (!param[k]) {
|
|
|
+ falg = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(falg, "falg")
|
|
|
+ //如果传参中某个值为空不发生请求
|
|
|
+ if (!falg) {
|
|
|
+ this.noShowTop12()
|
|
|
+ return false
|
|
|
+ } else {
|
|
|
+ this.elseBtnsShow = false
|
|
|
+ }
|
|
|
+
|
|
|
console.log(this.obj.infosArr[0], this.infosKey, "this.infosKey")
|
|
|
if (this.obj.infosArr[0] != this.key) {
|
|
|
- this.isSameForCreate = true
|
|
|
- this.isChangeFor = true
|
|
|
+ console.log("其他信息点")
|
|
|
+ this.noShowTop12()
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
getVenderRecommend(param, res => {
|
|
|
this.changeList = res.content || []
|
|
|
+ this.isChangeId = true
|
|
|
this.isSameForCreate = false
|
|
|
this.isChangeFor = false
|
|
|
+ console.log(this.changeList, "changeList")
|
|
|
if (!!this.changeList && this.changeList.length == 1) {
|
|
|
if (this.changeList[0].value == this.fm.Infos[this.key]
|
|
|
&& this.changeList[0].id == this.fm.Infos["DP" + this.key + "ID"]) {
|
|
|
this.isSameForCreate = true
|
|
|
this.isChangeFor = true
|
|
|
+ if (!!this.val && this.val != this.fm.Infos[this.key]) {
|
|
|
+ this.isChangeFor = false
|
|
|
+ this.isSameForCreate = false
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- if (this.changeList.length < 0) {
|
|
|
+ if (this.changeList.length <= 0) {
|
|
|
this.changeMsg = "该生产商下不存在符合条件的推荐"
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+ //第一栏第二栏不显示
|
|
|
+ noShowTop12() {
|
|
|
+ this.elseBtnsShow = true
|
|
|
+ console.log(this.obj.infosKey, this.fm.Infos)
|
|
|
+ //型号
|
|
|
+ if (this.obj.infosKey == "DPSpecificationID") {
|
|
|
+ if (!this.fm.Infos.DPManufacturerID) {
|
|
|
+ this.objMsg = "生产厂家"
|
|
|
+ } else if (!this.fm.Infos.DPBrandID) {
|
|
|
+ this.objMsg = "品牌"
|
|
|
+ } else if (!this.DPSpecificationID) {
|
|
|
+ this.objMsg = "设备型号"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!this.val && !this.fm.Infos[this.key]) {
|
|
|
+ this.elseBtnsShow = false
|
|
|
+ }
|
|
|
+
|
|
|
+ //品牌
|
|
|
+ if (this.obj.infosKey == "DPBrandID") {
|
|
|
+ if (!this.fm.Infos.DPManufacturerID) {
|
|
|
+ this.objMsg = "生产厂家"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //生产厂家
|
|
|
+ if (this.obj.infosKey == "DPManufacturerID") {
|
|
|
+ this.elseBtnsShow = false
|
|
|
+ }
|
|
|
+
|
|
|
+ //供应商
|
|
|
+ if (this.obj.infosKey == "DPSupplierID") {
|
|
|
+ if (!this.fm.Infos.DPSupplierID) {
|
|
|
+ console.log("没有供应商id")
|
|
|
+ this.elseBtnsShow = true
|
|
|
+ this.objMsg = "供应商单位名称"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //维修商
|
|
|
+ if (this.obj.infosKey == "DPMaintainerID") {
|
|
|
+ if (!this.fm.Infos.DPMaintainerID) {
|
|
|
+ console.log("没有维修商id")
|
|
|
+ this.elseBtnsShow = true
|
|
|
+ this.objMsg = "维修商单位名称"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //保险公司
|
|
|
+ if (this.obj.infosKey == "DPInsurerID") {
|
|
|
+ if (!this.fm.Infos.DPInsurerID) {
|
|
|
+ console.log("没有保险id")
|
|
|
+ this.elseBtnsShow = true
|
|
|
+ this.objMsg = "保险公司名称"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.isSameForCreate = true
|
|
|
+ this.isChangeFor = true
|
|
|
+ },
|
|
|
+
|
|
|
//当前单元格内存在id且单元格存在值
|
|
|
getVendersList() {
|
|
|
//四大厂商名称
|
|
@@ -337,6 +441,7 @@ export default {
|
|
|
vendersArr = ["Manufacturer", "Supplier", "Maintainer", "Insurer", "Brand"],
|
|
|
infosKey = this.obj.infosKey
|
|
|
this.showBtn = true
|
|
|
+ this.elseBtnsShow = true
|
|
|
//获取label
|
|
|
let ownLabel = ""
|
|
|
this.obj.options.map(item => {
|
|
@@ -362,21 +467,27 @@ export default {
|
|
|
} else {
|
|
|
optContent = res.content[optArr[0]][optArr[1]]
|
|
|
}
|
|
|
- console.log(optContent, this.val, this.fm.Infos[this.key])
|
|
|
if (optContent == (this.val || this.fm.Infos[this.key])) {
|
|
|
//厂商库中的值与现有的值相等
|
|
|
this.isChangeFor = true
|
|
|
this.isSameForCreate = true
|
|
|
+ let keysBtns = ["DPBrandID", "DPManufacturerID"]
|
|
|
+ if (keysBtns.indexOf(this.obj.infosKey) > -1) {
|
|
|
+ this.elseBtnsShow = false
|
|
|
+ }
|
|
|
} else {
|
|
|
if (!optContent) {
|
|
|
//如果厂商库中没有值
|
|
|
console.log("没有该信息点")
|
|
|
- this.isChangeFor = false
|
|
|
+ this.isChangeFor = true
|
|
|
+ this.isChangeVender = true
|
|
|
+ this.isSameForCreate = false
|
|
|
} else {
|
|
|
//有值
|
|
|
console.log("有值,且值不同")
|
|
|
this.isChangeId = false
|
|
|
this.hasData = true
|
|
|
+ this.content = res.content
|
|
|
//修改的值(其实做置空操作)
|
|
|
this.noIdChangeVal = optContent
|
|
|
this.isChangeFor = false
|
|
@@ -393,15 +504,19 @@ export default {
|
|
|
}
|
|
|
this.obj.getList(paramData, res => {
|
|
|
let optContent = res.content.infos[this.key]
|
|
|
- console.log(optContent, "optContent")
|
|
|
- if (optContent == (this.val || this.fm.Infos.Specification)) {
|
|
|
+ console.log(optContent, this.val, this.fm.Infos[this.key], "optContent")
|
|
|
+ if (optContent == (this.val || this.fm.Infos[this.key])) {
|
|
|
+ console.log("有值,且值相同")
|
|
|
this.isChangeFor = true
|
|
|
this.isSameForCreate = true
|
|
|
+ this.elseBtnsShow = false
|
|
|
} else {
|
|
|
if (!optContent) {
|
|
|
//如果厂商库中没有值
|
|
|
console.log("没有该信息点")
|
|
|
- this.isChangeFor = false
|
|
|
+ this.isChangeFor = true
|
|
|
+ this.isChangeVender = true
|
|
|
+ this.isSameForCreate = false
|
|
|
} else {
|
|
|
//有值
|
|
|
console.log("有值,且值不同")
|
|
@@ -448,9 +563,9 @@ export default {
|
|
|
Infos: {
|
|
|
}
|
|
|
}
|
|
|
- console.log(this.obj, "obj")
|
|
|
+ console.log(this.obj, "obj", this.obj.options[0].optLabel, this.key)
|
|
|
param.Infos[this.obj.infosKey] = data.id
|
|
|
- param.Infos[this.obj.options[0].optLabel] = null
|
|
|
+ // param.Infos[this.obj.options[0].optLabel] = null
|
|
|
if (this.obj.infosKey == "DPManufacturerID") {
|
|
|
param.Infos.DPSpecificationID = null
|
|
|
param.Infos.DPBrandID = null
|