123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 |
- <!--
- changeRea 厂商
- -->
- <template>
- <el-dialog title="关联资产" :visible.sync="dialog.changeRea" width="800px">
- <div>
- <div id="changeRea">
- <div class="title-search" style="margin-bottom: 10px;">
- <el-input
- placeholder="输入名称查询"
- v-model="search"
- size="small"
- style="width:300px;"
- clearable
- ></el-input>
- <el-button @click="getData" size="small">查找</el-button>
- </div>
- <div>
- <floor-cascader @change="changeFloor"></floor-cascader>
- </div>
- <el-radio-group v-model="radio" style="width:100%;">
- <el-table :data="tableData" style="width: 100%" height="300px">
- <el-table-column label="资产名称">
- <template slot-scope="scope">
- <el-radio
- v-model="radio"
- :label="scope.row.id"
- >{{scope.row.infos.EquipLocalName || scope.row.infos.EquipName}}</el-radio>
- </template>
- </el-table-column>
- <el-table-column label="本地编码">
- <template
- slot-scope="scope"
- >{{scope.row.infos.EquipLocalID || scope.row.infos.EquipID}}</template>
- </el-table-column>
- <el-table-column prop="name" label="所在楼层">
- <template slot-scope="scope">{{getFloor(scope.row.relation)}}</template>
- </el-table-column>
- <el-table-column label="设备族">
- <template slot-scope="scope">{{getFramily(scope.row.family)}}</template>
- </el-table-column>
- <el-table-column label="安装位置">
- <template slot-scope="scope">{{scope.row.infos.InstallLocation || "--"}}</template>
- </el-table-column>
- </el-table>
- </el-radio-group>
- <my-pagination :page="page" @change="changed" style="margin-top:10px;"></my-pagination>
- <div class="footer">
- <el-button
- type="primary"
- @click="clickTrue"
- style="display:block;margin: 10px auto 0;"
- >确 定</el-button>
- </div>
- </div>
- </div>
- <param-details :isLoad="isLoad" :data="data"></param-details>
- </el-dialog>
- </template>
- <script>
- import myPagination from "@/components/ledger/lib/myPagination";
- import paramDetails from "@/components/dialogs/list/paramDetails"
- import { getBillPropList, getEquipmentFamily, getSpaceFloor, getBussines2, upDateTableMain } from "@/api/scan/request"
- import floorCascader from "@/components/ledger/lib/floorCascader";
- import {mapGetters, mapActions} from "vuex"
- export default {
- components: {
- myPagination,
- paramDetails,
- floorCascader
- },
- props: {
- dialog: {
- type: Object,
- default: function () {
- return {
- changeRea: true
- };
- }
- },
- category: {
- type: Object,
- default: function () {
- return {}
- }
- }
- },
- data() {
- return {
- search: "", //搜索文案
- radio: "",
- tableData: [
- ],
- data: {},
- isLoad: {
- paramShow: false
- },
- page: {
- size: 50,
- sizes: [10, 30, 50, 100, 150, 200],
- total: 0,
- currentPage: 1
- },
- mess: {},
- codeListCode: [],
- floorList: []
- };
- },
- created() {
- this.getCode()
- },
- computed: {
- ...mapGetters("layout", [
- "projectId",
- "secret",
- "userId"
- ])
- },
- mounted() { },
- methods: {
- getFloor(relation) {
- let floor = !!relation ? relation.floor || "" : ""
- if (!!floor) {
- console.log(floor)
- let floorName = ""
- this.floorList.map(item => {
- if (!!item.floors && item.floors.length) {
- item.floors.map(child => {
- if (child.id == floor) {
- floorName = child.infos.FloorLocalName || child.infos.FloorName
- }
- })
- }
- })
- return floorName
- } else {
- return "--"
- }
- },
- clickTrue() {
- if (!!this.radio) {
- let param = {
- UserId: this.userId,
- ProjId: this.projectId
- }
- let paramList = [{
- EquipmentId: this.category.id,
- FmId: this.radio
- }]
- console.log(param, paramList)
- upDateTableMain(param, paramList).then(res => {
- this.$emit("close")
- this.dialog.changeRea = false
- })
- // upDateTableMain(param, res => {
- // })
- } else {
- this.$message("请先选择资产")
- }
- },
- getFramily(code) {
- console.log(code)
- let name = ""
- this.codeListCode.map(item => {
- if (item.code == code) {
- name = item.name
- }
- })
- return name || "--"
- },
- getCode() {
- getEquipmentFamily(res => {
- this.codeListCode = res.Content
- this.getFloorList()
- })
- },
- getFloorList() {
- let param = {
- secret: this.secret,
- ProjId: this.projectId
- }
- getSpaceFloor(param).then(res => {
- if (res.data.Result == "success") {
- this.floorList = res.data.Content
- } else {
- this.$message.error("请求错误:" + res.data.ResultMsg)
- }
- }).catch(_ => {
- this.$message.error("请求错误")
- })
- },
- changeFloor(val) {
- this.mess = {
- buildId: val[0] || "",
- floorId: val[1] || ""
- }
- this.getData()
- console.log(val)
- },
- changed() {
- this.getData()
- },
- //查询技术参数
- lookParam(data) {
- this.data = data
- this.isLoad.paramShow = true
- },
- getChange() {
- if (!!this.radio) {
- this.$emit("changechangeRea", this.radio)
- this.dialog.changeRea = false
- } else {
- this.$message("请选择型号")
- }
- },
- searchKey() {
- this.changePage()
- },
- changePage() {
- this.page = {
- size: 50,
- sizes: [10, 30, 50, 100, 150, 200],
- total: 0,
- currentPage: 1
- }
- this.getData()
- },
- getData() {
- // let param = {
- // data: {
- // filter: {
- // EquipLocalName: this.search
- // },
- // directOnly: false,
- // criteria: {
- // id: "",
- // graphType: "Pe2Eq",
- // side: -1,
- // type: ""
- // }
- // },
- // secret: this.secret,
- // ProjId: this.projectId
- // }
- let param = {
- data: {
- directOnly: false,
- criteria: {
- EquipLocalName: [this.search == ""? null: this.search],
- id: "",
- type: [],
- exclude: [{
- graphType: "Pe2Eq",
- side: "fromId",
- }]
- }
- },
- secret: this.secret,
- ProjId: this.projectId
- }
- if (this.mess.buildId == "all") {
- param.data.criteria.id = this.mess.ProjId
- } else if (this.mess.buildId == "noKnow") {
- param.data.criteria.id = this.mess.ProjId
- param.data.directOnly = true
- } else if (this.mess.floorId == "noKnow") {
- param.data.criteria.id = this.mess.buildId
- param.data.directOnly = true
- } else if (this.mess.floorId && this.mess.floorId != "all") {
- param.data.criteria.id = this.mess.floorId
- } else if (this.mess.floorId == 'all') {
- param.data.criteria.id = this.mess.buildId
- } else {
- param.data.criteria.id = this.projectId
- }
- param.data.criteria.type = [this.getType(this.category.category)]
- console.log(param)
- getBussines2(param).then(res => {
- this.tableData = res.data.Content
- console.log(this.tableData, "this.tableData")
- this.page.total = res.data.Count
- })
- },
- getType(code) {
- console.log(code, "code")
- console.log(code.substring(2, 6))
- let system = code.substring(2, 6), myCode = ""
- this.codeListCode.map(item => {
- if (!!item.content && item.content.length) {
- item.content.map(child => {
- if (child.code == system) {
- myCode = item.code
- }
- })
- }
- })
- console.log(myCode)
- return myCode
- }
- },
- watch: {
- dialog: {
- deep: true,
- handler: function () {
- if (this.dialog.changeRea) {
- this.changePage()
- this.radio = ""
- }
- }
- }
- }
- };
- </script>
- <style lang="less">
- #changeRea {
- .el-table thead {
- tr {
- th {
- background-color: #f5f7fa;
- }
- }
- }
- }
- </style>
|