zhaowei
2024-10-21 480d5a32deed36113a27c5d5f4c990ecd55065c2
1、增加首页背景图
2、新增零部件管理页面并实现相应功能
已添加3个文件
已修改4个文件
508 ■■■■■ 文件已修改
src/api/mdc.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/dashboard.jpg 补丁 | 查看 | 原始文档 | blame | 历史
src/components/layouts/TabLayout.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/page/GlobalLayout.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dashboard/Analysis.vue 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/SparePartsManagement.vue 190 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/SparePartsManagement/SparePartsModal.vue 278 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/mdc.js
@@ -17,6 +17,15 @@
  deleteParamThresholdApi: id => deleteAction('/mdc/mdcEquipmentThreshold/delete', { id }),
  // åˆ é™¤è®¾å¤‡å‚数阈值
  deleteBatchParamThresholdApi: ids => deleteAction('/mdc/mdcEquipmentThreshold/deleteBatch', { ids }),
  // -------------------------------------零部件管理页面--------------------------------------------
  // å¢žåŠ è®¾å¤‡å‚æ•°é˜ˆå€¼
  addSparePartApi: params => postAction('/mdc/mdcComponentInfo/add', params),
  // ç¼–辑设备参数阈值
  editSparePartApi: params => postAction('/mdc/mdcComponentInfo/edit', params),
  // èŽ·å–ç”Ÿäº§çº¿
  getProductionLineApi: () => getAction('/mdc/mdcProduction/productionList'),
  // èŽ·å–ç”Ÿäº§çº¿ä¸­è®¾å¤‡åˆ—è¡¨
  getEquipmentListByProductionIdApi: productionId => getAction('/mdc/mdcEquipment/equipmentListByProduction', { productionId }),
  // -------------------------------------总控车间看板页面--------------------------------------------
  // èŽ·å–æ˜¨æ—¥æ¦‚å†µ
  getYesterdayOverviewApi: () => getAction('/mdc/largeScreen/yesterdayOverview'),
src/assets/dashboard.jpg
src/components/layouts/TabLayout.vue
@@ -18,7 +18,7 @@
        <span slot="tab" :pagekey="page.fullPath">{{ page.meta.title }}</span>
      </a-tab-pane>
    </a-tabs>
    <div style="margin: 12px 12px 0;">
    <div :style="{margin:$route.meta.title!=='首页'? '12px 12px 0':0,flex:1,display: 'flex',flexDirection: 'column'}">
      <!-- update-begin-author:taoyan date:20201221 for:此处删掉transition标签 ä¸çŸ¥é“为什么加上后 é¡µé¢è·¯ç”±åˆ‡æ¢çš„æ—¶å€™å³1及菜单切到2及菜单的时候 ä¸¤ä¸ªèœå•页面会同时出现300-500秒左右 -->
      <keep-alive v-if="multipage">
        <router-view v-if="reloadFlag"/>
@@ -385,7 +385,6 @@
 * You can easily play with the page transition by editing
 * these styles.
 */
  .page-transition-enter {
    opacity: 0;
  }
src/components/page/GlobalLayout.vue
@@ -69,7 +69,7 @@
      />
      <!-- layout content -->
      <a-layout-content :style="{ height: '100%', paddingTop: fixedHeader ? '59px' : '0' }">
      <a-layout-content :style="{ height: '100%', paddingTop: fixedHeader ? '59px' : '0' ,display:'flex',flexDirection:'column'}">
        <slot></slot>
      </a-layout-content>
src/views/dashboard/Analysis.vue
@@ -1,6 +1,6 @@
<template>
  <div>
  <div class="container">
    <img src="@/assets/dashboard.jpg">
  </div>
</template>
@@ -8,20 +8,28 @@
  export default {
    name: "Analysis",
    components: {
    },
    name: 'Analysis',
    components: {},
    data() {
      return {
        indexStyle:1
        indexStyle: 1
      }
    },
    created() {
    },
    methods: {
    methods: {}
  }
</script>
<style scoped lang="less">
  .container {
    flex: 1;
    display: flex;
    flex-direction: column;
    img {
      width: 100%;
      flex: 1;
    }
  }
</script>
</style>
src/views/mdc/base/SparePartsManagement.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,190 @@
<template>
  <a-card :bordered="false">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="零件名称">
              <j-input placeholder="请输入零件名称" v-model="queryParam.componentName"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <!--<a @click="handleToggleSearch" style="margin-left: 8px">-->
              <!--{{ toggleSearchStatus ? '收起' : '展开' }}-->
              <!--<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>-->
              <!--</a>-->
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- æŸ¥è¯¢åŒºåŸŸ-END -->
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel">
            <a-icon type="delete"/>
            åˆ é™¤
          </a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> æ‰¹é‡æ“ä½œ
          <a-icon type="down"/>
        </a-button>
      </a-dropdown>
    </div>
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> å·²é€‰æ‹© <a style="font-weight: 600">{{
        selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange"
        :scroll="{x:'max-content',y:465}"
      >
        <span slot="overallFlag" slot-scope="text">
          {{text=='Y'?'是':'否'}}
        </span>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical"/>
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
        </span>
      </a-table>
    </div>
    <SparePartsModal ref="modalForm" @ok="modalFormOk"></SparePartsModal>
  </a-card>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import SparePartsModal from './modules/SparePartsManagement/SparePartsModal'
  export default {
    name: 'SparePartsManagement',
    mixins: [JeecgListMixin],
    components: {
      SparePartsModal
    },
    data() {
      return {
        description: '零部件管理页面',
        /* åˆ†é¡µå‚æ•° */
        ipagination: {
          current: 1,
          pageSize: 30,
          pageSizeOptions: ['30', '50', '100'],
          showTotal: (total, range) => {
            return range[0] + '-' + range[1] + ' å…±' + total + '条'
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        // è¡¨å¤´
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            title: '零件号',
            align: 'center',
            dataIndex: 'componentNo',
            width: 300
          },
          {
            title: '零件名称',
            align: 'center',
            dataIndex: 'componentName',
            width: 300
          },
          {
            title: '班产能',
            align: 'center',
            dataIndex: 'scheduleNum',
            width: 175
          },
          {
            title: '日产能',
            align: 'center',
            dataIndex: 'dayNum',
            width: 175
          },
          {
            title: '产线',
            align: 'center',
            dataIndex: 'productionId_dictText',
            width: 300
          },
          {
            title: '是否为自动线',
            align: 'center',
            dataIndex: 'overallFlag',
            scopedSlots: { customRender: 'overallFlag' },
            width: 175
          },
          {
            title: '生产设备',
            align: 'center',
            dataIndex: 'equipmentId',
            width: 175
          },
          {
            title: '操作',
            dataIndex: 'action',
            align: 'center',
            scopedSlots: { customRender: 'action' },
            width: 150,
            fixed: 'right'
          }
        ],
        url: {
          list: '/mdc/mdcComponentInfo/list',
          delete: '/mdc/mdcComponentInfo/delete',
          deleteBatch: '/mdc/mdcComponentInfo/deleteBatch'
        }
      }
    },
    created() {
    },
    computed: {},
    methods: {}
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
src/views/mdc/base/modules/SparePartsManagement/SparePartsModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,278 @@
<template>
  <a-modal
    :title="title"
    :maskClosable="true"
    :width="modalWidth"
    @cancel="handleModalClose"
    :visible="visible">
    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form" :form="form" :model="model" :rules="validatorRules">
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-model-item prop="componentNo" label="零件号" :labelCol="labelColLong"
                               :wrapperCol="wrapperColLong">
              <a-input v-model="model.componentNo" placeholder="请输入零件号"></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-model-item prop="componentName" label="零件名称" :labelCol="labelColLong"
                               :wrapperCol="wrapperColLong">
              <a-input v-model="model.componentName" placeholder="请输入零件名称"></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-model-item prop="scheduleNum" label="班产能" :labelCol="labelCol"
                               :wrapperCol="wrapperCol">
              <a-input v-model="model.scheduleNum" placeholder="请输入班产能"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item prop="dayNum" label="天产能" :labelCol="labelCol"
                               :wrapperCol="wrapperCol">
              <a-input v-model="model.dayNum" placeholder="请输入天产能"></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-model-item prop="productionId" label="生产线" :labelCol="labelColLong"
                               :wrapperCol="wrapperColLong">
              <a-select v-model="model.productionId" @change="handleProductionLineChange"
                        placeholder="请选择生产线">
                <a-select-option v-for="(item,index) in productionList" :key="index" :value="item.id">
                  {{item.productionName}}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-model-item prop="overallFlag" label="是否为自动线" :labelCol="{xs: { span: 24 },sm: { span: 8 }}"
                               :wrapperCol="{xs: { span: 24 },sm: { span: 16 }}">
              <j-switch v-model="model.overallFlag"></j-switch>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item prop="equipmentId" label="生产设备" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-select v-model="model.equipmentId" placeholder="请选择生产设备" style="width: 100%">
                <a-select-option v-for="(item,index) in equipmentList" :key="index" :value="item.equipmentId">
                  {{item.equipmentId}}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </a-spin>
    <template slot="footer">
      <a-popconfirm title="确定放弃操作?" @confirm="visible=false" okText="确定" cancelText="取消">
        <a-button style="margin-right: .8rem">取消</a-button>
      </a-popconfirm>
      <a-button @click="handleSubmit" type="primary" :loading="confirmLoading">提交</a-button>
    </template>
  </a-modal>
</template>
<script>
  import pick from 'lodash.pick'
  import api from '@/api/mdc'
  export default {
    name: 'SparePartsModal',
    components: {},
    props: {
      driveTypeList: {
        type: Array
      }
    },
    data() {
      return {
        modalWidth: 700,
        form: this.$form.createForm(this),
        validatorRules: {
          componentNo: [
            {
              required: true, message: '请输入零件号'
            }
          ],
          componentName: [
            {
              required: true, message: '请输入零件名称'
            }
          ],
          scheduleNum: [
            {
              required: true, message: '请输入班产能'
            }
          ],
          dayNum: [
            {
              required: true, message: '请输入天产能'
            }
          ],
          productionId: [
            {
              required: true, message: '请选择生产线'
            }
          ]
        },
        title: '操作',
        visible: false,
        model: {
          componentNo: '',
          componentName: '',
          scheduleNum: '',
          dayNum: '',
          overallFlag: 'Y'
        },
        labelCol: {
          xs: { span: 24 },
          sm: { span: 6 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 18 }
        },
        labelColLong: {
          xs: { span: 24 },
          sm: { span: 3 }
        },
        wrapperColLong: {
          xs: { span: 24 },
          sm: { span: 21 }
        },
        confirmLoading: false,
        productionList: [],
        equipmentList: []
      }
    },
    created() {
    },
    methods: {
      add() {
        this.visible = true
        this.model = {
          componentNo: '',
          componentName: '',
          scheduleNum: '',
          dayNum: '',
          overallFlag: 'Y'
        }
        this.getProductionLineByApi()
        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model, 'componentNo', 'componentName', 'scheduleNum', 'dayNum', 'overallFlag'))
        })
      },
      edit(record) {
        this.visible = true
        this.model = Object.assign({}, record)
        console.log('model', this.model)
        this.getProductionLineByApi()
        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model, 'componentNo', 'componentName', 'scheduleNum', 'dayNum', 'productionId', 'overallFlag', 'equipmentId'))
        })
      },
      handleSubmit() {
        const that = this
        // è§¦å‘表单验证
        this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true
            let obj
            if (this.title == '新增') {
              obj = api.addSparePartApi(this.model)
            } else {
              obj = api.editSparePartApi(this.model)
            }
            obj.then((res) => {
              if (res.success) {
                that.$notification.success({
                  message: '消息',
                  description: res.message
                })
                that.$emit('ok')
              } else {
                that.$notification.warning({
                  message: '消息',
                  description: res.message
                })
              }
            }).finally(() => {
              that.confirmLoading = false
              this.visible = false
            })
          } else {
            return false
          }
        })
      },
      getProductionLineByApi() {
        api.getProductionLineApi()
          .then(res => {
            if (res.success) {
              console.log('res', res)
              this.productionList = res.result
              if (this.model.productionId) {
                if (!this.model.equipmentId) delete this.model.equipmentId
                this.getEquipmentListByProductionId()
              }
            }
          })
      },
      /**
       * ç”Ÿäº§çº¿é€‰ä¸­åŽèŽ·å–å¯¹åº”ç”Ÿäº§è®¾å¤‡
       */
      handleProductionLineChange() {
        delete this.model.equipmentId
        this.getEquipmentListByProductionId()
      },
      getEquipmentListByProductionId() {
        api.getEquipmentListByProductionIdApi(this.model.productionId)
          .then(res => {
            console.log('res=-', res)
            this.equipmentList = res.result.records
          })
      },
      handleModalClose() {
        this.visible = false
        this.equipmentList = []
      },
      /**
       * ç¼–辑或查看详情数据时清除抽屉表单验证
       */
      removeValidate() {
        if (this.$refs.form) this.$refs.form.clearValidate()
      }
    }
  }
</script>
<style scoped>
</style>