gaosp
2024-01-14 48bc1beba0c69524a9c716f1a205e83a58c8171d
update
已修改8个文件
已添加2个文件
594 ■■■■ 文件已修改
src/api/Api.js 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/Map/Map.vue 78 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/Map/addMachine.vue 142 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/deviceType/index.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/devicemaintenance/Manage-add-update.vue 135 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/devicemaintenance/index.vue 167 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/home/index.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/workshop/device.vue 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/workshop/index.vue 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/Api.js
@@ -1,7 +1,7 @@
/*
 * @Date: 2024-01-10 20:37:45
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-13 21:27:18
 * @LastEditTime: 2024-01-14 15:03:32
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/api/Api.js
 */
import ajax from '@/utils/ajax'
@@ -68,6 +68,18 @@
    machineConcern: {
        url: '/machine/concern',
        method: 'POST'
    },
    machineQuery: {
        url: '/machine/pageQuery',
        method: 'POST'
    },
    machineSave: {
        url: '/machine/save',
        method: 'POST'
    },
    machineUpdate: {
        url: '/machine/modify',
        method: 'POST'
    }
}
// æ­£å¼çŽ¯å¢ƒé…ç½®åœ°å€
src/container/Map/Map.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-01-05 23:47:53
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-13 23:22:52
 * @LastEditTime: 2024-01-14 15:07:18
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/Map/Map.vue
-->
<template>
@@ -16,13 +16,14 @@
                <div class="plant-name" v-if="status===2">{{plantName}}</div>
                <el-input class="plant-name" v-if="status!==2" v-model="plantName" placeholder="请输入厂名"/>
            </div>
            <div class="table" >
            <div class="table" :class="$route.name ==='preview' ? 'active' : ''" >
                <div class="table-action" :style="position" v-show="showAction && status !== 2">
                    <div @click="merge">合并</div>
                    <div @click="split">拆分</div>
                    <div @click="sign(1)">过道</div>
                    <div @click="sign(2)">机床</div>
                    <div @click="sign(0)">取消</div>
                    <div @click="edit" v-if="showEdit">修改机床</div>
                    <!-- <div>增加行</div> -->
                    <!-- <div>删除行</div> -->
                    <!-- <div>增加列</div> -->
@@ -70,16 +71,12 @@
                                </div> -->
                                <Device v-if="v.id" :id="v.id" style="width: 100%;height: 100%;"></Device>
                            </td>
                            <!-- <td></td> -->
                        </tr>
                        <!-- <tr>
                            <td></td>
                        </tr> -->
                    </table>
                </div>
            </div>
        </div>
        <addMachine :id="id" @setmachineId="setmachineId" v-else @close="close"/>
        <addMachine :id="id" :machineid="machineid" @setmachineId="setmachineId" v-else @close="close"/>
    </div>
    
</template>
@@ -114,6 +111,34 @@
        },
        id: {
            type: [Number,String]
        }
    },
    computed: {
        showEdit() {
            try {
                const { x, x1, y, y1 } = this.range
                if (this.range && x && x1 && y && y1) {
                    let start = this.map[x][y]
                    return this.map[x][y].id && (start.rowIndex + start.rowspan -1) === x1 && (start.colIndex + start.colspan -1) === y1
                }
            } catch (error) {
                return false
            }
        },
        machineid () {
            try {
                const { x, x1, y, y1 } = this.range
                if (this.range && x && x1 && y && y1) {
                    let start = this.map[x][y]
                     if (this.map[x][y].id && (start.rowIndex + start.rowspan -1) === x1 && (start.colIndex + start.colspan -1) === y1) {
                        return start.id
                    } else {
                        return ''
                    }
                }
            } catch (error) {
                return ''
            }
        }
    },
    data() {
@@ -180,6 +205,15 @@
                if (this.currentMap.length > 0) this.map = this.currentMap
                this.rows = this.currentMap.length;
                this.cols = this.currentMap[0].length;
                if (this.$route.name === 'preview') {
                    this.$nextTick(() => {
                            let {width} = document.querySelector('.table div').getBoundingClientRect()
                            console.log(document.querySelector('.table div').getBoundingClientRect())
                                // document.querySelector('.table').scrollLeft
                                // document.querySelector('.table').scrollTo({left: })
                    })
                }
            },
            immediate: true
        },
@@ -196,9 +230,8 @@
        try {
            this.height = (document.querySelector('.table').getBoundingClientRect().height - 30) / 20
        } catch (error) {
        }
        console.log(this.$route.name)
    },
    beforeUpdate() {
        try {
@@ -235,7 +268,8 @@
        },
        contextmenu(e) {
            console.log(e)
            if(this.status ===2) return
            if(this.status ===2) return
            if (!this.range.x) return
            // if (this.range.x !=='') return 
            e.preventDefault()
            e.stopPropagation()
@@ -359,6 +393,11 @@
        close () {
            this.addStatus = false
        },
        edit (e) {
            if(this.status ===2) return
            e.stopPropagation()
            this.addStatus = true
        },
        setmachineId (id) {
            console.log(id)
            if (!id) return
@@ -373,6 +412,19 @@
}
</script>
<style lang="scss" scoped>
@keyframes move {
    0% {
        // left: 100%;
        // transform: translate(0,0);
        // scrollTop: 0
    }
    100% {
        // left: 100%;
        // transform: translate(-100%,0);
        // scrollTop: 100%
    }
}
.map {
    width: 100%;
    height: 100%;
@@ -413,6 +465,11 @@
    }
}
.table.active {
    // position: relative;
    // left: 100%;
    // animation: move 6s infinite alternate;
}
.table {
    // margin-top: 10px;
    // display: flex;
@@ -421,6 +478,7 @@
    height: 100%;
    position: relative;
    overflow-x: scroll;
    .table-action {
        position: absolute;
        z-index: 999;
src/container/Map/addMachine.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-01-10 22:28:38
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-12 21:21:48
 * @LastEditTime: 2024-01-14 15:04:42
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/Map/addMachine.vue
-->
<template>
@@ -11,12 +11,12 @@
            <el-input class="value" v-model="addInfo.name"></el-input>
        </div>
        <div class="map-add-item">
                <span>机床</span>
                <el-select class="value" v-model="addInfo.id" placeholder="请选择">
                    <el-option v-for="item in accountList" :key="item.machineId" :label="item.uuid" :value="item.machineId">
                    </el-option>
                </el-select>
            </div>
            <span>机床</span>
            <el-select :disabled="!!machineid" class="value" v-model="addInfo.id" placeholder="请选择">
                <el-option v-for="item in accountList" :key="item.machineId" :label="item.uuid" :value="item.machineId">
                </el-option>
            </el-select>
        </div>
        <div class="map-add-item">
            <span>IP</span>
            <el-input class="value" v-model="addInfo.ip"></el-input>
@@ -68,10 +68,10 @@
    </div>
</template>
<script>
import { getWsl,getPcl,getRequest } from '@/api/Api'
import { getWsl, getPcl, getRequest } from '@/api/Api'
export default {
    props: ['id'],
    data () {
    props: ['id', 'machineid'],
    data() {
        return {
            shiftTypes: [
                {
@@ -104,76 +104,112 @@
            },
        }
    },
    created () {
    watch: {
        machineid: {
            handler(val) {
                if (val) {
                    setTimeout(() => {
                        getRequest('machineQuery', { size: 10, machineId: val }).then(res => {
                            this.changewsl(res.data.records[0].workshopId)
                            this.$nextTick(() => {
                                try {
                                    Object.keys(this.addInfo).forEach(item => {
                                        this.addInfo[item] = res.data.records[0][item]
                                    })
                                    // this.addInfo.id = res.data.records[0].id
                                } catch (error) {
                                    console.error(error)
                                }
                            })
                        })
                    }, 1000)
                }
            },
            immediate: true
        }
    },
    created() {
        getPcl().then(res => {
            this.protocolList = res.data
        })
        getWsl().then(res => {
            this.workshopList = res.data
        })
        getRequest('accountQuery',{}).then(res => {
        getRequest('accountQuery', {}).then(res => {
            console.log(res)
            try {
                this.accountList = res.data
            } catch (error) {
                this.accountList = []
            }
        })
    },
    methods: {
        saveDevice () {
            this.$emit('setmachineId',this.addInfo.id)
            return
            this.$http.postJson('/machine/save',{
                ...this.addInfo,
                plantId: this.id
            }).then(res => {
                this.$emit('setmachineId',this.addInfo.id)
            })
        saveDevice() {
            let url = '/machine/save'
            if (this.machineid) {
                getRequest('machineUpdate',{
                    ...this.addInfo,
                    plantId: this.id
                }).then(res => {
                    this.$emit('setmachineId', this.addInfo.id)
                })
            } else {
                getRequest('machineSave',{
                    ...this.addInfo,
                    plantId: this.id
                }).then(res => {
                    this.$emit('setmachineId', this.addInfo.id)
                })
            }
        },
        changewsl (val) {
            console.log(val)
        changewsl(val) {
            console.log(val, 'changewsl')
            try {
                this.sectionIds = this.workshopList.find(item => item.id ===val).sections
                this.sectionIds = this.workshopList.find(item => item.id === val).sections
            } catch (error) {
                this.sectionIds = []
            }
        },
        close () {
        close() {
            this.$emit('close')
        }
    },
}
</script>
<style lang="scss" scoped>
    .map-add {
        width: 100%;
        height: 100%;
        overflow: auto;
        position: relative;
        .map-add-item {
            margin-top: 24px;
            display: flex;
            justify-content: center;
            align-items: center;
            span {
                width: 150px;
                font-size: 16px;
                color: #C6DCE0;
                text-align: right;
                margin-right: 16px;
            }
            .value {
                width: 400px;
            }
        }
        .map-add-footer {
            position: absolute;
            bottom: 0;
.map-add {
    width: 100%;
    height: 100%;
    overflow: auto;
    position: relative;
    .map-add-item {
        margin-top: 24px;
        display: flex;
        justify-content: center;
        align-items: center;
        span {
            width: 150px;
            font-size: 16px;
            color: #C6DCE0;
            text-align: right;
            padding-right: 30px;
            width: 100%;
            margin-right: 16px;
        }
        .value {
            width: 400px;
        }
    }
</style>
    .map-add-footer {
        position: absolute;
        bottom: 0;
        text-align: right;
        padding-right: 30px;
        width: 100%;
    }
}</style>
src/container/deviceType/index.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-01-06 17:40:19
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-13 11:35:29
 * @LastEditTime: 2024-01-14 14:12:18
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/deviceType/index.vue
-->
<template>
@@ -14,8 +14,6 @@
                    <el-input class="item-value" v-model="queryInfo.name"></el-input>
                    
                </div>
                <div class="item">
                    <el-button type="primary" size="small" @click="query">查询</el-button>
                </div>
src/container/devicemaintenance/Manage-add-update.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,135 @@
<template>
  <div>
    <el-dialog
      :title="!dataForm.id ? '新建' : '编辑'"
      :close-on-click-modal="false"
      width="80%"
      :visible.sync="addVisible">
      <!-- æ·»åР内容-->
      <el-form  :model="dataForm" label-width="100px" ref="dataForm">
          <el-row :gutter="20">
          <el-col :xs="24":sm="6":md="6":lg="6":xl="6">
            <el-form-item label="名称" prop="name">
              <el-input v-model="dataForm.name" placeholder="名称" clearable></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <!-- æŒ‰é’® -->
        <span slot="footer" class="dialog-footer">
        <el-button size="mini" @click="cancel">取消</el-button>
        <el-button size="mini" type="primary" @click="dataFormSubmit()">保存</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
  import { deviceTypeUpdate,deviceTypeCreate } from '@/api/Api'
  export default {
    props: ['addVisible','row'],
    data() {
      return {
        visible: false,
        dataForm: {
          id: 0, // title显示新增还是修改
          name: ''
        }
      }
    },
    watch: {
      addVisible: {
        handler (val) {
          if (val) {
              this.init()
          }
        },
        immediate: true
      }
    },
    created () {
        console.log('add create');
      this.init(this.row)
    },
    methods: {
      init(row) {
        if (this.$refs['dataForm']) {
          this.$refs['dataForm'].resetFields()
        }
        if (row !== undefined) {
          this.dataForm.id = row.id
          this.dataForm.name = row.name
        } else {
            this.dataForm.id = ''
        }
      },
      /* æŸ¥è¯¢ä½¿ç”¨éƒ¨é—¨*/
      cancel  () {
        this.$emit('close')
      },
      /* æäº¤*/
      dataFormSubmit() {
        if (this.dataForm.id === '') { // æ–°å¢ž
          deviceTypeCreate(this.dataForm).then(res => {
            this.$message({
              message: '新增成功',
              type: 'success',
              duration: 1500,
              onClose: () => {
                this.$emit('confirm')
                this.visible = false
              }
            })
          })
        } else {
          deviceTypeUpdate(this.dataForm).then(res => {
            this.$message({
              message: '修改成功',
              type: 'success',
              duration: 1500,
              onClose: () => {
                this.$emit('confirm')
                this.visible = false
              }
            })
          })
        }
      }
    }
  }
</script>
<style lang="scss">
  .el-form-item__content {
    .el-select,.el-input {
      width: 100%;
    }
  }
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
</style>
src/container/devicemaintenance/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,167 @@
<!--
 * @Date: 2024-01-06 17:40:19
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-14 14:11:17
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/devicemaintenance/index.vue
-->
<template>
    <div class="maintenance">
        <div class="nav">机床维护</div>
        <List ref="list" :url="url">
            <template slot="search">
                <div class="item">
                    <span>名称</span>
                    <el-input class="item-value" v-model="queryInfo.name"></el-input>
                </div>
                <div class="item">
                    <el-button type="primary" size="small" @click="query">查询</el-button>
                </div>
                <div class="item">
                    <el-button type="primary" size="small" @click="reset">重置</el-button>
                </div>
            </template>
            <template slot="table-tool">
                <el-button type="primary" size="mini" @click="add">添加设备类型</el-button>
            </template>
            <template slot="columns">
                <el-table-column
                    prop="id"
                    label="ID"
                    width="180">
                </el-table-column>
                <el-table-column
                    prop="name"
                    label="名称"
                    width="180">
                </el-table-column>
            </template>
        </List>
        <manage-add-update v-if="addOrUpdateVisible" :addVisible="addOrUpdateVisible" @close="close" @confirm="confirm"
             :row="row"></manage-add-update>
    </div>
</template>
<script>
    import List from '../list/index.vue'
    import ManageAddUpdate from './Manage-add-update'
    import { getUrl } from '@/api/Api'
    export default {
        components: {
            List,
            ManageAddUpdate
        },
        data () {
            return {
                url: '',
                queryInfo: {
                    name: ''
                },
                row: {},
                addOrUpdateVisible: false
            }
        },
        created () {
            this.url = getUrl('machineQuery')
        },
        methods: {
            reset () {
                Object.keys(this.queryInfo).forEach(key => {
                    this.queryInfo[key] = ''
                })
            },
            query () {
                this.$refs.list.pageQuery(this.queryInfo)
            },
            add() {
                this.row = {id:''}
                this.addOrUpdateVisible = true
            },
            close() {
                this.addOrUpdateVisible = false
            },
            confirm() {
                this.query()
                this.close()
            },
            addOrUpdateHandle(row) {
                this.row = row
                this.addOrUpdateVisible = true
            }
        },
    }
</script>
<style lang="scss">
.maintenance {
    .item-value {
        .el-input__inner {
            background: transparent;
            border-radius: 2px;
            border: 1px solid #435F9E;
        }
    }
    .el-button--mini {
        background: transparent;
    }
    .el-button--primary {
        background-color: transparent;
    }
}
</style>
<style lang="scss" scoped>
.maintenance {
    width: 100%;
    height: 100%;
    overflow: hidden;
    color: #FFF;
    display: flex;
    flex-direction: column;
    .nav {
        padding: 10px 30px;
    }
    .item {
        margin-top: 20px;
        margin-left: 50px;
        display: flex;
        align-items: center;
        span {
            width: 120px;
            font-size: 16px;
            font-family: PingFangSC, PingFang SC;
            color: #C6DCE0;
            text-align: right;
            padding-right: 20px;
        }
        .item-value {
            width: 200px;
            border: 1px solid #435F9E;
        }
        .btn {
            line-height: 1.5;
            width: 100px;
            text-align: center;
            font-size: 16px;
            cursor: pointer;
        }
        .reset {
            background: #AAB6BA;
            color: #FFF;
        }
        .query {
            background: #5DD1FC;
            color: #FFF;
        }
    }
}
</style>
src/container/home/index.vue
@@ -50,6 +50,7 @@
                        <ul v-if="showSub">
                            <li @click="navigateTo('ledger')">台账</li>
                            <li @click="navigateTo('deviceType')">设备类型管理</li>
                            <!-- <li @click="navigateTo('devicemaintenance')">机床维护</li> -->
                        </ul>
                    </li>
                </ul>
@@ -95,7 +96,8 @@
                7: 'component',
                ledger: 'ledger',
                deviceType: 'deviceType',
                preview: 'preview'
                preview: 'preview',
                devicemaintenance: 'devicemaintenance'
            }
            
            if (['3','4','5','8'].includes(name)) {
src/container/workshop/device.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-01-13 20:46:33
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-13 23:35:27
 * @LastEditTime: 2024-01-14 13:18:54
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/workshop/device.vue
-->
<template>
@@ -20,21 +20,21 @@
                <li>
                    <img src="./img/sd.png" alt="">
                    <div>
                        <p>{{ item.cycleCount || 0 }}</p>
                        <p>{{ efficiency}}</p>
                        <p>能力利用率</p>
                    </div>
                </li>
                <li>
                    <img src="./img/sd.png" alt="">
                    <div>
                        <p>{{ item.cycleCount || 0 }}</p>
                        <p>{{ utilizationDaily}}</p>
                        <p>日利用率</p>
                    </div>
                </li>
                <li>
                    <img src="./img/sd.png" alt="">
                    <div>
                        <p>{{ item.cycleCount || 0 }}</p>
                        <p>{{ info.cycleCount}}</p>
                        <p>完工件数</p>
                    </div>
                </li>
@@ -45,17 +45,38 @@
<script>
import { getRequest,getUrl } from '@/api/Api'
export default {
    props: ['id'],
    props: {
        id: {
            type: [String,Number]
        },
        info: {
            type: Object,
            default: function () {
                return {}
            }
        }
    },
    data () {
        return {
            care: false,
            item: {}
        }
    },
    computed: {
        efficiency () {
            return this.info.efficiency || 0
        },
        utilizationDaily () {
            return this.info.utilizationDaily || 0
        },
        cycleCount () {
            return this.info.cycleCount || 0
        }
    },
    methods: {
        change (val) {
            console.log(val)
            getRequest('machineConcern',{concern: val ? 1 : 0,id: this.item.id}).then(res => {
            getRequest('machineConcern',{concern: val ? 1 : 0,id: this.id}).then(res => {
                console.log(res)
            })
        },
src/container/workshop/index.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-01-06 17:40:19
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-13 22:38:31
 * @LastEditTime: 2024-01-14 13:24:19
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/workshop/index.vue
-->
<template>
@@ -12,9 +12,9 @@
            <div class="right">
                <Status class="right-status" :info="info" style="justify-content: flex-start;">
                    <template slot="before">
                        <div style="margin-right: 200px;">
                            <el-button type="primary" size="mini" :class="concernFlag === 0 ? 'active' : ''"
                                @click="query(0)">全部</el-button>
                        <div style="margin-right: auto;">
                            <el-button type="primary" size="mini" :class="concernFlag === '' ? 'active' : ''"
                                @click="query('')">全部</el-button>
                            <el-button type="primary" size="mini" :class="concernFlag === 1 ? 'active' : ''"
                                @click="query(1)">关注</el-button>
                            <!-- <el-button type="primary" size="mini" style="margin-right: auto;">我的关注</el-button> -->
@@ -28,7 +28,7 @@
                </Status>
                <div class="list-box">
                    <div class="list">
                        <Item v-for="item in list" :id="item.id" :key="item.id"></Item>
                        <Item v-for="item in list" :id="item.id" :info="item" :key="item.id"></Item>
                    </div>
                </div>
@@ -49,7 +49,7 @@
    },
    data() {
        return {
            concernFlag: 0,
            concernFlag: '',
            searchWord: '',
            list: [],
            info: {
src/router/index.js
@@ -69,6 +69,11 @@
        component: () => import('@/container/deviceType/index')
      },
      {
        path: 'devicemaintenance',
        name: 'devicemaintenance',
        component: () => import('@/container/devicemaintenance/index')
      },
      {
        path: 'preview',
        name: 'preview',
        component: () => import('@/container/preview/index')