<template>
|
<zt-dialog ref="dialog" @confirm="formSubmit">
|
<el-form :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="120px">
|
<zt-form-item label="上级系统" prop="pid" v-if="isTree">
|
<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"></zt-dict>
|
</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>
|
<zt-form-item label="排序" prop="sort">
|
<el-input v-model="dataForm.sort" :readonly="readonly"></el-input>
|
</zt-form-item>
|
</el-form>
|
<PictureSelect ref="pictureSelect" @setPicture="openAddWin">
|
</PictureSelect>
|
</zt-dialog>
|
</template>
|
|
<script>
|
import PictureSelect from "@/views/modules/basicInfo/SelectPicture";
|
|
export default {
|
data() {
|
return {
|
isTree: false,
|
isShow: true,
|
fileId: '',
|
productList: [],
|
dataForm: {
|
id: '',
|
pid: '',
|
name: '',
|
productType: '',
|
operatImg: '',
|
operatImgName:'',
|
sort: '',
|
status: ''
|
}
|
}
|
},
|
components: {
|
PictureSelect
|
},
|
methods: {
|
init(id,params) {
|
if (params.type === 'tree') {
|
this.isTree = true
|
this.isShow = false
|
this.getProductList()
|
} else {
|
this.dataForm.pid = params.pid
|
this.dataForm.productType = params.type
|
}
|
},
|
// 获取系统列表
|
async getProductList() {
|
let res = await this.$http.get('/basicInfo/XhProductModel/getProductList')
|
this.productList = res.data
|
console.log(this.productList, 'getProductList')
|
},
|
selectPicture() {
|
this.$refs.pictureSelect.$refs.dialog.init()
|
},
|
openAddWin(row) {
|
this.dataForm.operatImgName = row.name
|
this.dataForm.operatImg = row.id
|
console.log(row, 'openAddWin(row)')
|
},
|
// 获取信息
|
async getInfo() {
|
let res = await this.$http.get(`/basicInfo/XhProductModel/${this.dataForm.id}`)
|
this.dataForm = {
|
...this.dataForm,
|
...res.data
|
}
|
},
|
// 表单提交
|
async formSubmit() {
|
let res = await this.$http[!this.dataForm.id ? 'post' : 'put']('/basicInfo/XhProductModel/', this.dataForm)
|
if (res.success) {
|
await this.$tip.success()
|
this.$refs.dialog.close()
|
this.$emit('refreshDataList')
|
this.map.clear()
|
}
|
}
|
}
|
}
|
</script>
|