| | |
| | | <template> |
| | | <zt-dialog ref="dialog" @confirm="formSubmit" append-to-body> |
| | | <zt-dialog ref="dialog" append-to-body @confirm="formSubmit" :hasConfirm="true"> |
| | | <el-form :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="120px"> |
| | | <zt-form-item label="上级系统" prop="pid" > |
| | | <zt-select v-model="dataForm.pid" placeholder=" " :datas="productList"/> |
| | | <zt-form-item label="上级节点" prop="pid"> |
| | | <zt-select v-model="dataForm.pid" placeholder=" " :datas="productList" @input="selectDefaultProduct"/> |
| | | </zt-form-item> |
| | | <zt-form-item label="名称" prop="name" rules="required"> |
| | | <el-input v-model="dataForm.name"></el-input> |
| | | </zt-form-item> |
| | | <zt-form-item label="节点类型" prop="nodeType" rules="required"> |
| | | <zt-dict v-model="dataForm.nodeType" dict="product"></zt-dict> |
| | | <zt-dict v-model="dataForm.nodeType" dict="product" @input="getDefaultImg"></zt-dict> |
| | | </zt-form-item> |
| | | <zt-form-item label="基本计算" prop="baseCompute"> |
| | | <zt-dict v-model="dataForm.baseCompute" dict="is_or_not" placeholder="基本计算"></zt-dict> |
| | |
| | | <zt-form-item label="维修分布" prop="repairDistrib"> |
| | | <zt-dict v-model="dataForm.repairDistrib" dict="RepairDistribType" placeholder="请选择维修分布类型"></zt-dict> |
| | | </zt-form-item> |
| | | <zt-form-item label="运行状态图" prop="operationalStatus"> |
| | | <el-input v-model="dataForm.operationalStatus" @focus="selectPicture('operational')" :readonly="readonly"></el-input> |
| | | </zt-form-item> |
| | | <zt-form-item label="待机状态图" prop="standbyState"> |
| | | <el-input v-model="dataForm.standbyState" @focus="selectPicture('standby')" :readonly="readonly"></el-input> |
| | | </zt-form-item> |
| | | <zt-form-item label="故障状态图" prop="faultState"> |
| | | <el-input v-model="dataForm.faultState" @focus="selectPicture('fault')" :readonly="readonly"></el-input> |
| | | <zt-form-item label="运行图片" prop="operatImg"> |
| | | <el-input v-model="dataForm.operatImgName" @focus="selectPicture()" :readonly="readonly"></el-input> |
| | | <el-image v-if="dataForm.operatImg" :src="url+dataForm.operatImg" style="height: 50px;width: 50px"></el-image> |
| | | </zt-form-item> |
| | | <zt-form-item label="排序" prop="sort"> |
| | | <el-input v-model="dataForm.sort" :readonly="readonly"></el-input> |
| | |
| | | |
| | | <script> |
| | | import PictureSelect from "@/views/modules/basicInfo/SelectPicture"; |
| | | import Cookies from "js-cookie"; |
| | | |
| | | export default { |
| | | name: 'TyProductModel', |
| | | data() { |
| | | return { |
| | | map: new Map(), |
| | | fileId:'', |
| | | productList:[], |
| | | url: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getSvgImage?token=${Cookies.get('token')}&id=`, |
| | | fileId: '', |
| | | productList: [], |
| | | dataForm: { |
| | | id: '', |
| | | pid: '', |
| | |
| | | taskCompute: '', |
| | | reliabDistrib: '', |
| | | repairDistrib: '', |
| | | operationalStatus:'', |
| | | standbyState:'', |
| | | faultState:'', |
| | | operatImg: '', |
| | | operatImgName: '', |
| | | sort: '', |
| | | } |
| | | } |
| | | }, |
| | | components:{ |
| | | components: { |
| | | PictureSelect |
| | | }, |
| | | methods: { |
| | | init() { |
| | | this.getProductList() |
| | | }, |
| | | selectDefaultProduct() { |
| | | this.dataForm.nodeType = 5 |
| | | this.getDefaultImg(this.dataForm.nodeType) |
| | | }, |
| | | // 获取系统列表 |
| | | async getProductList() { |
| | | let res = await this.$http.get('/basicInfo/TyProductModel/getProductList') |
| | | this.productList = res.data |
| | | console.log(this.productList,'getProductList') |
| | | console.log(this.productList, 'getProductList') |
| | | }, |
| | | selectPicture(type){ |
| | | this.$refs.pictureSelect.$refs.dialog.init(type) |
| | | selectPicture() { |
| | | this.$refs.pictureSelect.$refs.dialog.init(this.dataForm.nodeType) |
| | | }, |
| | | openAddWin(row,type){ |
| | | console.log(type,'openAddWin(row)') |
| | | if (type==='operational'){ |
| | | this.dataForm.operationalStatus = row.name |
| | | for (let key in row.accessoryMap) { |
| | | let id = /_zt_oss_id=(\d+)/.exec(key) |
| | | this.fileId = id ? id[1] : '' |
| | | } |
| | | this.map.set(this.dataForm.operationalStatus,this.fileId); |
| | | console.log(this.map,'openAddWin(row)') |
| | | }else if(type==='standby'){ |
| | | this.dataForm.standbyState = row.name |
| | | for (let key in row.accessoryMap) { |
| | | let id = /_zt_oss_id=(\d+)/.exec(key) |
| | | this.fileId = id ? id[1] : '' |
| | | } |
| | | this.map.set(this.dataForm.standbyState,this.fileId); |
| | | console.log(this.map,'openAddWin(row)') |
| | | }else if(type==='fault'){ |
| | | this.dataForm.faultState = row.name |
| | | for (let key in row.accessoryMap) { |
| | | let id = /_zt_oss_id=(\d+)/.exec(key) |
| | | this.fileId = id ? id[1] : '' |
| | | } |
| | | this.map.set(this.dataForm.faultState,this.fileId); |
| | | console.log(this.map,'openAddWin(row)') |
| | | openAddWin(row) { |
| | | this.dataForm.operatImgName = row.name |
| | | this.dataForm.operatImg = row.id |
| | | console.log(row, 'openAddWin(row)') |
| | | }, |
| | | async getDefaultImg(selected) { |
| | | let params = { |
| | | productType: selected |
| | | } |
| | | let res = await this.$http.get(`/sysPictureBase/getDefaultImg`, {params: params}) |
| | | this.dataForm.operatImgName = res.data.name |
| | | this.dataForm.operatImg = res.data.id |
| | | }, |
| | | // 获取信息 |
| | | async getInfo() { |
| | |
| | | ...this.dataForm, |
| | | ...res.data |
| | | } |
| | | console.log(this.map,'getInfo') |
| | | if (this.dataForm.pid == null) { |
| | | this.dataForm.pid = '' |
| | | } |
| | | if (this.dataForm.baseCompute == null) { |
| | | this.dataForm.baseCompute = '' |
| | | } |
| | | if (this.dataForm.taskCompute == null) { |
| | | this.dataForm.taskCompute = '' |
| | | } |
| | | if (this.dataForm.reliabDistrib == null) { |
| | | this.dataForm.reliabDistrib = '' |
| | | } |
| | | if (this.dataForm.repairDistrib == null) { |
| | | this.dataForm.repairDistrib = '' |
| | | } |
| | | console.log(this.dataForm, 'this.dataForm') |
| | | }, |
| | | // 表单提交 |
| | | async formSubmit() { |
| | | this.dataForm.operationalStatus = this.map.get(this.dataForm.operationalStatus) |
| | | this.dataForm.standbyState = this.map.get(this.dataForm.standbyState) |
| | | this.dataForm.faultState = this.map.get(this.dataForm.faultState) |
| | | let res = await this.$http[!this.dataForm.id ? 'post' : 'put']('/basicInfo/TyProductModel/', this.dataForm) |
| | | if (res.success) { |
| | | await this.$tip.success() |