| | |
| | | <template> |
| | | <zt-dialog ref="dialog" @confirm="formSubmit"> |
| | | <zt-dialog ref="dialog" @confirm="formSubmit" :hasConfirm="true"> |
| | | <el-form :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="120px"> |
| | | <zt-form-item label="上级系统" prop="pid" v-if="isTree"> |
| | | <zt-form-item label="上级节点" prop="pid" v-if="isShow"> |
| | | <zt-combo-tree v-model="dataForm.pid" :datas="productList"/> |
| | | </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="productType" rules="required"> |
| | | <zt-dict v-model="dataForm.productType" dict="product" @input="getDefaultImg"></zt-dict> |
| | | <zt-form-item v-if="dataForm.productType==='5'||dataForm.productType===5" prop="equipType" label="设备类型"> |
| | | <el-input v-model="dataForm.equipType"></el-input> |
| | | </zt-form-item> |
| | | <zt-form-item label="运行状态图" prop="operatImg" v-if="isShow"> |
| | | <el-input v-model="dataForm.operatImgName" @focus="selectPicture()" |
| | | :readonly="readonly"></el-input> |
| | | <zt-form-item label="节点类型" prop="productType" rules="required"> |
| | | <zt-dict v-model="dataForm.productType" dict="product" @input="changeType" |
| | | :disabled="disabled"></zt-dict> |
| | | </zt-form-item> |
| | | <zt-form-item v-if="dataForm.productType!=='1'" label="运行状态图" prop="operatImg"> |
| | | <el-input v-model="dataForm.operatImgName" @focus="selectPicture()"></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> |
| | | <el-input v-model="dataForm.sort" readonly="false"></el-input> |
| | | </zt-form-item> |
| | | </el-form> |
| | | <PictureSelect ref="pictureSelect" @setPicture="openAddWin"> |
| | |
| | | export default { |
| | | data() { |
| | | return { |
| | | url: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=`, |
| | | isTree: false, |
| | | disabled: false, |
| | | url: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getSvgImage?token=${Cookies.get('token')}&id=`, |
| | | isShow: true, |
| | | fileId: '', |
| | | productList: [], |
| | |
| | | id: '', |
| | | pid: '', |
| | | name: '', |
| | | shipId: '', |
| | | productType: '', |
| | | operatImg: '', |
| | | operatImgName: '', |
| | | sort: '', |
| | | equipType: '', |
| | | namePath:'', |
| | | status: '' |
| | | } |
| | | } |
| | |
| | | }, |
| | | methods: { |
| | | init(id, params) { |
| | | if (params.type === 'tree') { |
| | | this.isTree = true |
| | | console.log(params) |
| | | if (params.shipId) { |
| | | this.dataForm.shipId = params.shipId |
| | | } |
| | | if (params.type === 'xh') { |
| | | this.isShow = false |
| | | this.getProductList() |
| | | this.dataForm.pid = null |
| | | this.dataForm.productType = '1' |
| | | this.getDefaultImg(this.dataForm.productType) |
| | | } else if (params.type === 'zt') { |
| | | this.dataForm.pid = params.pid |
| | | this.dataForm.productType = '2' |
| | | this.getDefaultImg(this.dataForm.productType) |
| | | } else { |
| | | this.dataForm.pid = params.pid |
| | | this.dataForm.productType = params.type |
| | | this.dataForm.productType = parseInt(params.productType) |
| | | this.dataForm.namePath= params.namePath |
| | | this.getDefaultImg(this.dataForm.productType) |
| | | } |
| | | if (this.dataForm.productType==='10'){ |
| | | |
| | | if (this.dataForm.productType === '10' && id == null) { |
| | | this.isShow = false |
| | | this.getDefaultImg(this.dataForm.productType) |
| | | } |
| | | this.getProductList() |
| | | }, |
| | | |
| | | // 获取系统列表 |
| | | async getProductList() { |
| | | let res = await this.$http.get('/basicInfo/XhProductModel/getProductList') |
| | | let params = { |
| | | productType: this.dataForm.productType, |
| | | shipId: this.dataForm.shipId |
| | | } |
| | | let res = await this.$http.get('/basicInfo/XhProductModel/getProductList', {params: params}) |
| | | this.productList = res.data |
| | | console.log(this.productList, 'getProductList') |
| | | }, |
| | | changeType(selected) { |
| | | this.dataForm.productType = selected |
| | | this.getDefaultImg(selected) |
| | | this.getProductList() |
| | | }, |
| | | async getDefaultImg(selected) { |
| | | console.log(selected, 'async getDefaultImg') |
| | |
| | | productType: selected |
| | | } |
| | | let res = await this.$http.get(`/sysPictureBase/getDefaultImg`, {params: params}) |
| | | this.dataForm.operatImgName = res.data.name |
| | | this.dataForm.operatImg = res.data.id |
| | | if (res.data) { |
| | | this.dataForm.operatImgName = res.data.name |
| | | this.dataForm.operatImg = res.data.id |
| | | } |
| | | }, |
| | | selectPicture() { |
| | | this.$refs.pictureSelect.$refs.dialog.init(this.dataForm.productType) |
| | |
| | | // 表单提交 |
| | | async formSubmit() { |
| | | let flag = true |
| | | if (this.isTree){ |
| | | if (this.dataForm.productType !== '5' || this.dataForm.productType !== '4') { |
| | | if (this.isShow) { |
| | | if (this.dataForm.productType === '1') { |
| | | this.$alert("不支持新增此节点") |
| | | flag =false |
| | | } |
| | | }else{ |
| | | if (this.dataForm.productType === '5' || this.dataForm.productType === '4') { |
| | | this.$alert("不支持新增此节点") |
| | | flag =false |
| | | flag = false |
| | | } |
| | | } |
| | | |
| | | if (!flag){ |
| | | if (!flag) { |
| | | return |
| | | } |
| | | let res = await this.$http[!this.dataForm.id ? 'post' : 'put']('/basicInfo/XhProductModel/', this.dataForm) |
| | |
| | | await this.$tip.success() |
| | | this.$refs.dialog.close() |
| | | this.$emit('refreshDataList') |
| | | this.map.clear() |
| | | } |
| | | } |
| | | } |