gaosp
2024-01-14 0d626ae57149d5ed40a32bd8b808ca6069aa6d5e
update
已修改5个文件
321 ■■■■ 文件已修改
src/api/Api.js 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/component/index.vue 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/ledger/index.vue 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/maintenance/dailyMAdd.vue 237 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/maintenance/index.vue 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/Api.js
@@ -1,7 +1,7 @@
/*
 * @Date: 2024-01-10 20:37:45
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-14 15:03:32
 * @LastEditTime: 2024-01-14 16:17:20
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/api/Api.js
 */
import ajax from '@/utils/ajax'
@@ -25,6 +25,10 @@
    accountQuery: {
        url: '/account/remainings',
        method: 'GET'
    },
    accountDel: {
        url: '/account/delete',
        method: 'POST'
    },
    componentQuery: {
        url: '/component/pageQuery',
@@ -81,6 +85,10 @@
    machineUpdate: {
        url: '/machine/modify',
        method: 'POST'
    },
    userList: {
        url: '/user/list',
        method: 'GET'
    }
}
// 正式环境配置地址
src/container/component/index.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-01-06 17:40:19
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-13 22:13:05
 * @LastEditTime: 2024-01-14 15:36:44
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/component/index.vue
-->
<template>
@@ -64,7 +64,7 @@
            </template>
            <template slot="columns">
                <el-table-column
                    prop="date"
                    prop="machineId"
                    label="机床名"
                    width="180">
                </el-table-column>
@@ -74,12 +74,15 @@
                    width="180">
                </el-table-column>
                <el-table-column
                    prop="address"
                    prop="process"
                    label="工序号">
                </el-table-column>
                <el-table-column
                    prop="address"
                    prop="time"
                    label="加工时间">
                    <template slot-scope="scope">
                        <span>{{scope.row.time.slice(0,10)}}</span>
                    </template>
                </el-table-column>
            </template>
        </List>
src/container/ledger/index.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-01-06 17:40:19
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-13 22:13:17
 * @LastEditTime: 2024-01-14 16:31:53
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/ledger/index.vue
-->
<template>
@@ -53,7 +53,8 @@
                </div>
                <div class="item">
                    <span>投产日期</span>
                    <el-date-picker class="item-value" format="yyyy-MM-dd" value-format="yyyy-MM-dd" v-model="queryInfo.productionDate" type="date" clearable placeholder="选择日期"></el-date-picker>
                    <el-date-picker class="item-value" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                        v-model="queryInfo.productionDate" type="date" clearable placeholder="选择日期"></el-date-picker>
                </div>
                <div class="item">
                    <span>生产厂家</span>
@@ -128,6 +129,7 @@
                <el-table-column fixed="right" align="center" label="操作">
                    <template slot-scope="scope">
                        <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row)">编辑</el-button>
                        <el-button type="text" size="small" @click="del(scope.row)">删除</el-button>
                    </template>
                </el-table-column>
            </template>
@@ -139,7 +141,7 @@
</template>
<script>
import ManageAddUpdate from './Manage-add-update'
import { getUseDpts } from '@/api/Api'
import { getUseDpts, getRequest } from '@/api/Api'
import List from '../list/index.vue'
export default {
    components: {
@@ -218,7 +220,7 @@
        query() {
            this.$refs.list.pageQuery(this.queryInfo)
        },
        reset () {
        reset() {
            Object.keys(this.queryInfo).forEach(key => {
                this.queryInfo[key] = ''
            })
@@ -237,6 +239,26 @@
        addOrUpdateHandle(row) {
            this.row = row
            this.addOrUpdateVisible = true
        },
        del(row) {
            this.$confirm('确定要永久删除此项?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                getRequest('accountDel', { ids: [row.id].join(',') }).then(res => {
                    this.$message({
                        type: 'success',
                        message: '删除成功!'
                    })
                    this.submitForm()
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    })
                })
            })
        }
    },
}
@@ -250,9 +272,11 @@
            border: 1px solid #435F9E;
        }
    }
    .el-button--mini {
        background: transparent;
    }
    .el-button--primary {
        background-color: transparent;
    }
src/container/maintenance/dailyMAdd.vue
@@ -7,37 +7,17 @@
        :visible.sync="dialogVisibleAdd" class="role-select">
         <!-- 查询表单 -->
        <el-form :model="dataForm" ref="dataForm" label-width="150px" style="margin-top:10px;">
            <el-row :gutter="20">
                <el-col :xs="24":sm="6":md="6":lg="6":xl="6">
                    <el-form-item label="统一编号" prop="uuid">
                        <el-input type="text" v-model="dataForm.uuid" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
            <el-row :gutter="24">
                <el-col :xs="24":sm="6":md="6":lg="6":xl="6">
                    <el-form-item label="设备名称" prop="machineName">
                        <el-select v-model="dataForm.machineName" placeholder="---请选择---">
                        <el-select v-model="dataForm.machineId" placeholder="---请选择---">
                            <el-option
                            v-for="item in machineName"
                            v-for="item in machineList"
                            :key="item.id"
                            :label="item.label"
                            :value="item.value">
                            :label="item.name"
                            :value="item.id">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :xs="24":sm="6":md="6":lg="6":xl="6">
                    <el-form-item label="设备型号" prop="type">
                        <el-input size="mini" type="text" v-model="dataForm.type"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :xs="24":sm="6":md="6":lg="6":xl="6">
                    <el-form-item label="设备规格" prop="specification">
                        <el-input size="mini" type="text" v-model="dataForm.specification" @input="getMachineInfo"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :xs="24":sm="6":md="6":lg="6":xl="6">
                    <el-form-item label="安装地点" prop="location">
                        <el-input size="mini" type="text" v-model="dataForm.location"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :xs="24":sm="6":md="6":lg="6":xl="6">
@@ -56,32 +36,12 @@
                    <el-form-item label="保养者" prop="maintainPerson">
                        <el-select v-model="dataForm.maintainPerson" placeholder="---请选择---" clearable >
                            <el-option
                            v-for="item in maintainPerson"
                            v-for="item in userList"
                            :key="item.id"
                            :label="item.label"
                            :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <!-- <el-col :xs="24":sm="6":md="6":lg="6":xl="6">
                    <el-form-item label="保养周期" prop="maintainPeriod">
                        <el-input size="mini" type="text" v-model="dataForm.maintainPeriod"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :xs="24":sm="6":md="6":lg="6":xl="6">
                    <el-form-item label="投产日期" prop="productionDate">
                        <el-input size="mini" type="text" v-model="dataForm.productionDate"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :xs="24":sm="6":md="6":lg="6":xl="6">
                    <el-form-item label="生产厂家" prop="manufacturer">
                        <el-input size="mini" type="text" v-model="dataForm.manufacturer"></el-input>
                    </el-form-item>
                </el-col> -->
                <el-col :xs="24":sm="6":md="6":lg="6":xl="6">
                    <el-form-item label="计划状态" prop="planStatus">
                        <el-input size="mini" type="text" v-model="dataForm.planStatus" readonly></el-input>
                    </el-form-item>
                </el-col>
                <el-col :xs="24":sm="6":md="6":lg="6":xl="6">
@@ -97,32 +57,36 @@
                    </el-form-item>
                </el-col>
                <el-col :xs="24":sm="6":md="6":lg="6":xl="6">
                    <el-form-item label="保养内容与存在问题" prop="detail">
                        <el-input size="mini" type="text" v-model="dataForm.detail"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :xs="24":sm="6":md="6":lg="6":xl="6">
                </el-col>
                <el-col :xs="24":sm="10":md="10":lg="10":xl="10">
                    <el-form-item label="计划开始日期" prop="planStartDate">
                        <el-date-picker
                        format="yyyy 年 MM 月 dd 日"
                        value-format="yyyy-MM-dd"
                        v-model="dataForm.planStartDate"
                        range-separator="至"
                        type="daterange"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期">
                        </el-date-picker>
                    </el-form-item>
                </el-col>
                <el-col :xs="24":sm="6":md="6":lg="6":xl="6">
                <el-col :xs="24":sm="10":md="10":lg="10":xl="10">
                    <el-form-item label="计划完成日期" prop="planFinishDate">
                        <el-date-picker
                        format="yyyy 年 MM 月 dd 日"
                        value-format="yyyy-MM-dd"
                        v-model="dataForm.planFinishDate"
                        range-separator="至"
                        type="daterange"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期">
                        </el-date-picker>
                    </el-form-item>
                </el-col>
                <el-col :xs="24":sm="6":md="6":lg="6":xl="6">
                    <el-form-item label="保养内容与存在问题" prop="detail">
                        <el-input size="mini" type="text" v-model="dataForm.detail"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
@@ -140,32 +104,18 @@
import { getMachineList, maintainCreate, maintainUpdate, userList, departmentGet } from '@/api/MdcApi'
import { getRequest } from '@/api/Api'
export default {
  props: ['styles', 'departmentlist'],
  props: ['styles', 'departmentlist','machineList','userList'],
  data() {
    return {
      dataForm: {
        style: '日常保养',
        state: 1,
        machineName: '', // 设备名称
        uuid: '', // 同意编码
        type: '', // 设备类型
        specification: '', // 设备规格
        location: '', // 安装位置
        department: '', // 使用单位
        maintainPerson: '', // 保养者
        productionDate: '', // 投产日期
        manufacturer: '', // 生产厂家
        planStatus: '1', // 计划状态
        isQualified: '合格',
        planStartDate: '',
        planFinishDate: '',
        detail: '' // 保养内容与存在问题
        machineId: '',
        department: '',
        maintainPerson: '',
        isQualified: '',
        detail: '',
      },
      dialogVisibleAdd: false,
      // 下拉框
      machineName: [], // 设备名称
      department: [], // 使用部门
      maintainPerson: [], // 设备名称
      isQualified: [{ // 是否合格
        label: '合格',
        value: '合格'
@@ -183,42 +133,16 @@
    init(n, data) {
      this.data = data
      this.no = n
      if (this.styles === '1') {
        this.dataForm.style = '日常保养'
      } else if (this.styles === '2') {
        this.dataForm.style = '一级保养'
      } else if (this.styles === '3') {
        this.dataForm.style = '二级保养'
      } else {
        this.dataForm.style = '三级保养'
      }
      if (n === 1) {
        this.title = '新增' + this.dataForm.style
        this.dataForm.machineName = ''
        this.dataForm.uuid = ''
        this.dataForm.type = ''
        this.dataForm.specification = ''
        this.dataForm.location = ''
        this.dataForm.department = ''
        this.dataForm.maintainPerson = ''
        this.dataForm.productionDate = ''
        this.dataForm.manufacturer = ''
        this.dataForm.planStartDate = ''
        this.dataForm.planFinishDate = ''
        this.dataForm.isQualified = '合格'
        this.dataForm.detail = ''
        this.title = '新增' + this.style
        Object.keys(this.dataForm).forEach(key => {
          this.dataForm[key] = ''
        })
      } else {
        this.title = '修改' + this.dataForm.styles
        this.dataForm.machineName = this.data.machineName
        this.dataForm.uuid = this.data.uuid
        this.dataForm.type = this.data.type
        this.dataForm.specification = this.data.specification
        this.dataForm.location = this.data.location
        this.dataForm.department = this.data.department
        this.dataForm.maintainPerson = this.data.userName
        this.dataForm.isQualified = this.data.isQualified === '0' ? '不合格' : '合格'
        this.dataForm.manufacturer = this.data.manufacturer
        this.dataForm.detail = this.data.detail
        this.title = '修改' + this.style
        Object.keys(this.dataForm).forEach(key => {
          this.dataForm[key] = data[key]
        })
      }
      this.dialogVisibleAdd = true
      this.machineName = []
@@ -235,48 +159,65 @@
      const completeDateTo = this.dataForm.planFinishDate[1]
      const isQualified = this.dataForm.isQualified === '合格' ? 1 : 0
      if (this.no === 1) {
        getRequest('maintainCreate',{})
        // maintainCreate(
        //   this.styles, this.dataForm.uuid, this.dataForm.machineName, this.dataForm.type,
        //   this.dataForm.specification, this.dataForm.department, this.dataForm.location,
        //   startDateFrom, startDateTo, completeDateFrom, completeDateTo, isQualified,
        //   this.dataForm.state, this.dataForm.detail
        // ).then(res => {
        //   if (res.result === 'SUCCESS') {
        //     this.$message({
        //       type: 'success',
        //       message: '保存成功!'
        //     })
        //     this.$emit('reflash')
        //     // const that = this
        //     this.dialogVisibleAdd = false
        //   } else {
        //     this.$message({
        //       type: 'error',
        //       message: res.result
        //     })
        //   }
        // })
        console.log({
          ...this.dataForm,
          startDateFrom,
          startDateTo,
          completeDateFrom,
          completeDateTo,
          isQualified,
          styles: this.style
        })
        // return
        getRequest('maintainCreate',{
          ...this.dataForm,
          startDateFrom,
          startDateTo,
          completeDateFrom,
          completeDateTo,
          isQualified,
          styles: this.style
        }).then(res => {
          if (res.result === 'SUCCESS') {
            this.$message({
              type: 'success',
              message: '保存成功!'
            })
            this.$emit('reflash')
            // const that = this
            this.dialogVisibleAdd = false
          } else {
            this.$message({
              type: 'error',
              message: res.result
            })
          }
        })
      } else {
        getRequest('maintainUpdate',{})
        // 修改保存
        // maintainUpdate(this.styles, this.data.id, this.dataForm.uuid, this.dataForm.machineName, this.dataForm.type,
        //   this.dataForm.specification, this.dataForm.department, this.dataForm.location,
        //   startDateFrom, startDateTo, completeDateFrom, completeDateTo, isQualified,
        //   this.dataForm.state, this.dataForm.detail).then(res => {
        //   if (res.result === 'SUCCESS') {
        //     this.$message({
        //       type: 'success',
        //       message: '保存成功!'
        //     })
        //     this.$emit('reflash')
        //   } else {
        //     this.$message({
        //       type: 'error',
        //       message: res.result
        //     })
        //   }
        // })
        getRequest('maintainUpdate',{
          ...this.dataForm,
          startDateFrom,
          startDateTo,
          completeDateFrom,
          completeDateTo,
          isQualified,
          styles: this.style
        }).then(res => {
          if (res.result === 'SUCCESS') {
            this.$message({
              type: 'success',
              message: '保存成功!'
            })
            this.$emit('reflash')
            // const that = this
            this.dialogVisibleAdd = false
          } else {
            this.$message({
              type: 'error',
              message: res.result
            })
          }
        })
      }
    },
    /**
@@ -288,7 +229,7 @@
    }
  },
  created() {
    this.initDevices()
    // this.initDevices()
  }
}
</script>
src/container/maintenance/index.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-01-06 17:40:19
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-13 22:13:21
 * @LastEditTime: 2024-01-14 16:13:57
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/maintenance/index.vue
-->
<template>
@@ -16,18 +16,18 @@
                <div class="item">
                    <span>设备名称</span>
                    <el-select class="item-value" v-model="queryInfo.machineName" placeholder="请选择">
                        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
                        <el-option v-for="item in machineList" :key="item.id" :label="item.name" :value="item.id">
                        </el-option>
                    </el-select>
                </div>
                <div class="item">
                <!-- <div class="item">
                    <span>设备型号</span>
                    <el-input class="item-value" v-model="queryInfo.type"></el-input>
                </div>
                <div class="item">
                    <span>设备规格</span>
                    <el-input class="item-value" v-model="queryInfo.specification"></el-input>
                </div>
                </div> -->
                <div class="item">
                    <span>使用部门</span>
                    <el-select class="item-value" v-model="queryInfo.department">
@@ -35,10 +35,10 @@
                        </el-option>
                    </el-select>
                </div>
                <div class="item">
                <!-- <div class="item">
                    <span>安装位置</span>
                    <el-input class="item-value" v-model="queryInfo.location"></el-input>
                </div>
                </div> -->
                <div class="item">
                    <span>计划开始日期</span>
                    <el-date-picker class="item-value" v-model="queryInfo.planStartDate" align="right" type="date" placeholder="选择日期">
@@ -65,8 +65,8 @@
                align="center"
                width="55">
            </el-table-column> -->
                <el-table-column align="center" label="统一编号" prop="uuid">
                </el-table-column>
                <!-- <el-table-column align="center" label="统一编号" prop="uuid">
                </el-table-column> -->
                <el-table-column align="center" label="设备名称" width="150" :show-overflow-tooltip="true" prop="machineName">
                </el-table-column>
                <el-table-column align="center" label="设备型号" prop="type">
@@ -113,12 +113,13 @@
                </el-table-column>
            </template>
        </List>
        <DailyMAddD ref="dailyMAddD" @reflash="submitForm" :departmentlist="departmentlist"></DailyMAddD>
        <DailyMAddD ref="dailyMAddD" @reflash="submitForm" :style="navName" :departmentlist="departmentlist" :machineList="machineList" :userList="userList"></DailyMAddD>
    </div>
</template>
<script>
import List from '../list/index.vue'
import { getUseDpts,getRequest } from '@/api/Api'
import { userList } from '@/api/MdcApi'
import DailyMAddD from './dailyMAdd.vue'
export default {
    components: {
@@ -134,7 +135,8 @@
    data() {
        return {
            departmentlist: [],
            options: [],
            userList: [],
            machineList: [],
            queryInfo: {
                uuid: '',
                machineName: '',
@@ -163,6 +165,15 @@
                    }
                })
            })
            getRequest('machineList', {
            }).then(res => {
                this.machineList = res.data.list
                console.log(res)
            })
            getRequest('userList', {
            }).then(res => {
                this.userList = res.data.list
            })
        },
        query() {
            this.$refs.list.pageQuery(this.queryInfo)