From 480d5a32deed36113a27c5d5f4c990ecd55065c2 Mon Sep 17 00:00:00 2001
From: zhaowei <zhaowei>
Date: 星期一, 21 十月 2024 15:39:29 +0800
Subject: [PATCH] 1、增加首页背景图 2、新增零部件管理页面并实现相应功能

---
 src/assets/dashboard.jpg                                            |    0 
 src/api/mdc.js                                                      |    9 +
 src/views/mdc/base/SparePartsManagement.vue                         |  190 +++++++++++++++++++++
 src/views/dashboard/Analysis.vue                                    |   26 +-
 src/views/mdc/base/modules/SparePartsManagement/SparePartsModal.vue |  278 ++++++++++++++++++++++++++++++
 src/components/layouts/TabLayout.vue                                |    3 
 src/components/page/GlobalLayout.vue                                |    2 
 7 files changed, 496 insertions(+), 12 deletions(-)

diff --git a/src/api/mdc.js b/src/api/mdc.js
index 8b5179c..adfd75a 100644
--- a/src/api/mdc.js
+++ b/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'),
diff --git a/src/assets/dashboard.jpg b/src/assets/dashboard.jpg
new file mode 100644
index 0000000..8eec68b
--- /dev/null
+++ b/src/assets/dashboard.jpg
Binary files differ
diff --git a/src/components/layouts/TabLayout.vue b/src/components/layouts/TabLayout.vue
index f4b8b07..97c75fd 100644
--- a/src/components/layouts/TabLayout.vue
+++ b/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;
   }
diff --git a/src/components/page/GlobalLayout.vue b/src/components/page/GlobalLayout.vue
index 22dd22b..cbd3a3f 100644
--- a/src/components/page/GlobalLayout.vue
+++ b/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>
 
diff --git a/src/views/dashboard/Analysis.vue b/src/views/dashboard/Analysis.vue
index 1b9ab1c..e87c134 100644
--- a/src/views/dashboard/Analysis.vue
+++ b/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>
\ No newline at end of file
+</style>
\ No newline at end of file
diff --git a/src/views/mdc/base/SparePartsManagement.vue b/src/views/mdc/base/SparePartsManagement.vue
new file mode 100644
index 0000000..780c91e
--- /dev/null
+++ b/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>
\ No newline at end of file
diff --git a/src/views/mdc/base/modules/SparePartsManagement/SparePartsModal.vue b/src/views/mdc/base/modules/SparePartsManagement/SparePartsModal.vue
new file mode 100644
index 0000000..6102800
--- /dev/null
+++ b/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>
\ No newline at end of file

--
Gitblit v1.9.3