From 51b9e548b0e533e8a415ce141808f2bb747b381e Mon Sep 17 00:00:00 2001
From: zhuzhuanzhuan
Date: 星期一, 18 三月 2024 16:08:49 +0800
Subject: [PATCH] 1、mdc菜单下除特殊要求外,页面表格最少条数由10条调整为30条,每页最多条数区间由[10,20,30]调整为[30,50,100] 2、OEE基础管理和数据报表模块增加打印按钮,实现打印表格数据功能 3、设备管理、数据报表模块增加按照设备级别和设备类型查询表格数据 4、设备车间管理页面增加车间编码字段 5、修改组件名称以试图解决刷新后进入请求json页面问题

---
 src/views/mdc/base/EquipmentList.vue |  397 ++++++++++++++++++++------------------------------------
 1 files changed, 144 insertions(+), 253 deletions(-)

diff --git a/src/views/mdc/base/EquipmentList.vue b/src/views/mdc/base/EquipmentList.vue
index 279cd11..009143b 100644
--- a/src/views/mdc/base/EquipmentList.vue
+++ b/src/views/mdc/base/EquipmentList.vue
@@ -6,28 +6,41 @@
       <a-form layout="inline" @keyup.enter.native="searchQuery">
         <a-row :gutter="24">
 
-          <a-col :md="6" :sm="12">
+          <a-col :md="4" :sm="4">
             <a-form-item label="璁惧缂栧彿">
-              <!--<a-input placeholder="璇疯緭鍏ヨ处鍙锋煡璇�" v-model="queryParam.username"></a-input>-->
               <a-input placeholder="璇疯緭鍏ヨ澶囩紪鍙�" v-model="queryParam.equipmentId"></a-input>
             </a-form-item>
           </a-col>
 
-          <a-col :md="6" :sm="8">
+          <a-col :md="4" :sm="4">
             <a-form-item label="璁惧鍚嶇О">
-              <!--<a-input placeholder="璇疯緭鍏ヨ处鍙锋煡璇�" v-model="queryParam.username"></a-input>-->
               <a-input placeholder="璇疯緭鍏ヨ澶囧悕绉�" v-model="queryParam.equipmentName"></a-input>
             </a-form-item>
           </a-col>
 
-          <a-col :md="6" :sm="8">
+          <a-col :md="4" :sm="4">
             <a-form-item label="杞﹂棿鍚嶇О">
-              <!--<a-input placeholder="璇疯緭鍏ヨ处鍙锋煡璇�" v-model="queryParam.username"></a-input>-->
-              <a-input placeholder="璇疯緭鍏ヨ溅闂村悕绉�" v-model="queryParam.productionName"></a-input>
+              <!--<a-input placeholder="璇疯緭鍏ヨ溅闂村悕绉�" v-model="queryParam.productionName"></a-input>-->
+              <a-tree-select v-model="queryParam.productionName" :treeData="workshopTreeData" placeholder="璇烽�夋嫨杞﹂棿"
+                             :treeDefaultExpandedKeys="treeDefaultExpandedKeys"></a-tree-select>
             </a-form-item>
           </a-col>
 
-          <a-col :md="6" :sm="8">
+          <a-col :md="4" :sm="4">
+            <a-form-item label="璁惧绾у埆">
+              <j-dict-select-tag placeholder="璇烽�夋嫨璁惧绾у埆" dictCode="device_level" v-model="queryParam.deviceLevel"
+                                 allow-clear/>
+            </a-form-item>
+          </a-col>
+
+          <a-col :md="4" :sm="4">
+            <a-form-item label="璁惧绉嶇被">
+              <j-dict-select-tag placeholder="璇烽�夋嫨璁惧绉嶇被" dictCode="device_category" v-model="queryParam.deviceCategory"
+                                 allow-clear/>
+            </a-form-item>
+          </a-col>
+
+          <a-col :md="4" :sm="4">
             <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-col>
@@ -37,7 +50,7 @@
 
     <!-- 鎿嶄綔鎸夐挳鍖哄煙 -->
     <div class="table-operator" style="border-top: 5px">
-      <a-button @click="handleAdd" type="primary" icon="plus" >娣诲姞璁惧</a-button>
+      <a-button @click="handleAdd" type="primary" icon="plus">娣诲姞璁惧</a-button>
       <a-button type="primary" icon="download" @click="handleExportXls('璁惧淇℃伅')">瀵煎嚭</a-button>
       <a-dropdown v-if="selectedRowKeys.length > 0">
         <a-menu slot="overlay" @click="handleMenuClick">
@@ -56,7 +69,8 @@
     <!-- table鍖哄煙-begin -->
     <div>
       <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
-        <i class="anticon anticon-info-circle ant-alert-icon"></i>宸查�夋嫨&nbsp;<a style="font-weight: 600">{{ selectedRowKeys.length }}</a>椤�&nbsp;&nbsp;
+        <i class="anticon anticon-info-circle ant-alert-icon"></i>宸查�夋嫨&nbsp;<a style="font-weight: 600">{{
+        selectedRowKeys.length }}</a>椤�&nbsp;&nbsp;
         <a style="margin-left: 24px" @click="onClearSelected">娓呯┖</a>
       </div>
 
@@ -72,17 +86,10 @@
         :loading="loading"
         :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
         @change="handleTableChange">
-
-        <template slot="avatarslot" slot-scope="text, record, index">
-          <div class="anty-img-wrap">
-            <a-avatar shape="square" :src="getAvatarView(record.avatar)" icon="user"/>
-          </div>
-        </template>
-
         <span slot="action" slot-scope="text, record">
-          <a @click="handleEdit(record)" >缂栬緫</a>
+          <a @click="handleEdit(record)">缂栬緫</a>
 
-          <a-divider type="vertical" />
+          <a-divider type="vertical"/>
 
           <a-dropdown>
             <a class="ant-dropdown-link">
@@ -93,28 +100,11 @@
                 <a href="javascript:;" @click="handleDetail(record)">璇︽儏</a>
               </a-menu-item>
 
-              <!--<a-menu-item>-->
-                <!--<a href="javascript:;" @click="handleChangePassword(record.username)">瀵嗙爜</a>-->
-              <!--</a-menu-item>-->
-
               <a-menu-item>
                 <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)">
                   <a>鍒犻櫎</a>
                 </a-popconfirm>
               </a-menu-item>
-
-              <!--<a-menu-item v-if="record.status==1">-->
-                <!--<a-popconfirm title="纭畾鍐荤粨鍚�?" @confirm="() => handleFrozen(record.id,2,record.username)">-->
-                  <!--<a>鍐荤粨</a>-->
-                <!--</a-popconfirm>-->
-              <!--</a-menu-item>-->
-
-              <!--<a-menu-item v-if="record.status==2">-->
-                <!--<a-popconfirm title="纭畾瑙e喕鍚�?" @confirm="() => handleFrozen(record.id,1,record.username)">-->
-                  <!--<a>瑙e喕</a>-->
-                <!--</a-popconfirm>-->
-              <!--</a-menu-item>-->
-
             </a-menu>
           </a-dropdown>
         </span>
@@ -125,151 +115,129 @@
     <!-- table鍖哄煙-end -->
 
     <user-modal ref="modalForm" @ok="modalFormOk"></user-modal>
-
-    <password-modal ref="passwordmodal" @ok="passwordModalOk"></password-modal>
-
-    <sys-user-agent-modal ref="sysUserAgentModal"></sys-user-agent-modal>
-
-    <!-- 鐢ㄦ埛鍥炴敹绔� -->
-    <user-recycle-bin-modal :visible.sync="recycleBinVisible" @ok="modalFormOk"/>
-
   </a-card>
 </template>
 
 <script>
 
   import UserModal from './modules/EquipmentList/UserModal'
-  import PasswordModal from './modules/EquipmentList/PasswordModal'
-  import {putAction,getFileAccessHttpUrl} from '@/api/manage';
-  import {frozenBatch} from '@/api/api'
-  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
-  import SysUserAgentModal from "./modules/EquipmentList/SysUserAgentModal";
-  import JInput from '@/components/jeecg/JInput'
-  import UserRecycleBinModal from './modules/EquipmentList/UserRecycleBinModal'
-  import JSuperQuery from '@/components/jeecg/JSuperQuery'
-  import JThirdAppButton from '@/components/jeecgbiz/thirdApp/JThirdAppButton'
-  import {mapActions} from 'vuex'
+  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+  import { queryProductionTreeList } from '@/api/api'
+  import { mapActions } from 'vuex'
 
   export default {
-    name: "EquipmentList",
+    name: 'EquipmentList',
     mixins: [JeecgListMixin],
     components: {
-      JThirdAppButton,
-      SysUserAgentModal,
-      UserModal,
-      PasswordModal,
-      JInput,
-      UserRecycleBinModal,
-      JSuperQuery
+      UserModal
     },
     data() {
       return {
         description: '杩欐槸璁惧绠$悊椤甸潰',
         queryParam: {},
         recycleBinVisible: false,
+        /* 鍒嗛〉鍙傛暟 */
+        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;
+            key: 'rowIndex',
+            width: 60,
+            align: 'center',
+            customRender: function(t, r, index) {
+              return parseInt(index) + 1
             }
           },
           {
             title: '璁惧缂栧彿',
-            align: "center",
+            align: 'center',
             dataIndex: 'equipmentId',
-            width: 200,
-            // sorter: true
+            width: 200
           },
           {
             title: '璁惧鍚嶇О',
-            align: "center",
+            align: 'center',
             width: 200,
-            dataIndex: 'equipmentName',
+            dataIndex: 'equipmentName'
           },
           {
             title: '杞﹂棿',
-            align: "center",
+            align: 'center',
             width: 200,
             dataIndex: 'productionName'
           },
           {
             title: '璁惧绫诲瀷',
-            align: "center",
+            align: 'center',
             width: 200,
-            dataIndex: 'equipmentType',
-            // scopedSlots: {customRender: "avatarslot"}
+            dataIndex: 'equipmentType'
           },
-
           {
             title: '椹卞姩绫诲瀷',
-            align: "center",
+            align: 'center',
             width: 200,
-            dataIndex: 'driveType',
-            // sorter: true
+            dataIndex: 'driveType'
           },
           {
             title: '鏈哄簥IP',
-            align: "center",
+            align: 'center',
             width: 200,
             dataIndex: 'equipmentIp'
           },
           {
             title: '璁惧鍔熺巼',
-            align: "center",
+            align: 'center',
             width: 200,
             dataIndex: 'devicePower'
           },
           {
             title: '閮ㄩ棬',
-            align: "center",
+            align: 'center',
             width: 200,
             dataIndex: 'orgCodeTxt'
           },
 
           {
             title: '绯荤粺鐗堟湰',
-            align: "center",
+            align: 'center',
             width: 200,
             dataIndex: 'systemVersion'
           },
           {
             title: '鎿嶄綔',
             dataIndex: 'action',
-            scopedSlots: {customRender: 'action'},
-            align: "center",
+            scopedSlots: { customRender: 'action' },
+            align: 'center',
             width: 150,
-            fixed:'right'
+            fixed: 'right'
           }
 
         ],
-        // superQueryFieldList: [
-        //   { type: 'input', value: 'username', text: '鐢ㄦ埛璐﹀彿', },
-        //   { type: 'input', value: 'realname', text: '鐢ㄦ埛濮撳悕', },
-        //   { type: 'select', value: 'sex', dbType: 'int', text: '鎬у埆', dictCode: 'sex' },
-        // ],
         url: {
-          syncUser: "/act/process/extActProcess/doSyncUser",
-          list: "/mdc/mdcEquipment/list",
-          delete: "/mdc/mdcEquipment/delete",
-          deleteBatch: "/mdc/mdcEquipment/deleteBatch",
-          exportXlsUrl: "/mdc/mdcEquipment/exportXls",
-          // importExcelUrl: "sys/user/importExcel",
+          list: '/mdc/mdcEquipment/list',
+          delete: '/mdc/mdcEquipment/delete',
+          deleteBatch: '/mdc/mdcEquipment/deleteBatch',
+          exportXlsUrl: '/mdc/mdcEquipment/exportXls'
         },
-        isDepartType:''
+        isDepartType: '',
+        workshopTreeData: [],
+        treeDefaultExpandedKeys: []
       }
-    },
-    computed: {
-      // importExcelUrl: function(){
-      //   return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
-      // }
     },
     created() {
       this.queryTreeData()
+      this.getWorkshopListByApi()
     },
     methods: {
       ...mapActions(['QueryDepartTree']),
@@ -277,61 +245,60 @@
         this.QueryDepartTree().then(res => {
           if (res.success) {
             this.isDepartType = res.result[0].value
-            if(this.isDepartType == -1){
-              this.columns=[
+            if (this.isDepartType == -1) {
+              this.columns = [
                 {
                   title: '#',
                   dataIndex: '',
-                  key:'rowIndex',
-                  width:60,
-                  align:"center",
-                  customRender:function (t,r,index) {
-                    return parseInt(index)+1;
+                  key: 'rowIndex',
+                  width: 60,
+                  align: 'center',
+                  customRender: function(t, r, index) {
+                    return parseInt(index) + 1
                   }
                 },
                 {
                   title: '璁惧缂栧彿',
-                  align: "center",
+                  align: 'center',
                   dataIndex: 'equipmentId',
-                  width: 200,
+                  width: 200
                   // sorter: true
                 },
                 {
                   title: '璁惧鍚嶇О',
-                  align: "center",
+                  align: 'center',
                   width: 200,
-                  dataIndex: 'equipmentName',
+                  dataIndex: 'equipmentName'
                 },
                 {
                   title: '杞﹂棿',
-                  align: "center",
+                  align: 'center',
                   width: 200,
                   dataIndex: 'productionName'
                 },
                 {
                   title: '璁惧绫诲瀷',
-                  align: "center",
+                  align: 'center',
                   width: 200,
-                  dataIndex: 'equipmentType',
-                  // scopedSlots: {customRender: "avatarslot"}
+                  dataIndex: 'equipmentType'
                 },
 
                 {
                   title: '椹卞姩绫诲瀷',
-                  align: "center",
+                  align: 'center',
                   width: 200,
-                  dataIndex: 'driveType',
+                  dataIndex: 'driveType'
                   // sorter: true
                 },
                 {
                   title: '鏈哄簥IP',
-                  align: "center",
+                  align: 'center',
                   width: 200,
                   dataIndex: 'equipmentIp'
                 },
                 {
                   title: '璁惧鍔熺巼',
-                  align: "center",
+                  align: 'center',
                   width: 200,
                   dataIndex: 'devicePower'
                 },
@@ -344,98 +311,97 @@
 
                 {
                   title: '绯荤粺鐗堟湰',
-                  align: "center",
+                  align: 'center',
                   width: 200,
                   dataIndex: 'systemVersion'
                 },
                 {
                   title: '鎿嶄綔',
                   dataIndex: 'action',
-                  scopedSlots: {customRender: 'action'},
-                  align: "center",
+                  scopedSlots: { customRender: 'action' },
+                  align: 'center',
                   width: 150,
-                  fixed:'right'
+                  fixed: 'right'
                 }
 
               ]
-            }else{
-              this.columns=[
+            } else {
+              this.columns = [
                 {
                   title: '#',
                   dataIndex: '',
-                  key:'rowIndex',
-                  width:60,
-                  align:"center",
-                  customRender:function (t,r,index) {
-                    return parseInt(index)+1;
+                  key: 'rowIndex',
+                  width: 60,
+                  align: 'center',
+                  customRender: function(t, r, index) {
+                    return parseInt(index) + 1
                   }
                 },
                 {
                   title: '璁惧缂栧彿',
-                  align: "center",
+                  align: 'center',
                   dataIndex: 'equipmentId',
-                  width: 200,
+                  width: 200
                   // sorter: true
                 },
                 {
                   title: '璁惧鍚嶇О',
-                  align: "center",
+                  align: 'center',
                   width: 200,
-                  dataIndex: 'equipmentName',
+                  dataIndex: 'equipmentName'
                 },
                 {
                   title: '杞﹂棿',
-                  align: "center",
+                  align: 'center',
                   width: 200,
                   dataIndex: 'productionName'
                 },
                 {
                   title: '璁惧绫诲瀷',
-                  align: "center",
+                  align: 'center',
                   width: 200,
-                  dataIndex: 'equipmentType',
-                  // scopedSlots: {customRender: "avatarslot"}
+                  dataIndex: 'equipmentType'
                 },
 
                 {
                   title: '椹卞姩绫诲瀷',
-                  align: "center",
+                  align: 'center',
                   width: 200,
-                  dataIndex: 'driveType',
+                  dataIndex: 'driveType'
                   // sorter: true
                 },
                 {
                   title: '鏈哄簥IP',
-                  align: "center",
+                  align: 'center',
                   width: 200,
                   dataIndex: 'equipmentIp'
                 },
                 {
                   title: '璁惧鍔熺巼',
-                  align: "center",
+                  align: 'center',
                   width: 200,
                   dataIndex: 'devicePower'
                 },
                 {
                   title: '閮ㄩ棬',
-                  align: "center",
+                  align: 'center',
                   width: 200,
                   dataIndex: 'orgCodeTxt'
                 },
 
                 {
                   title: '绯荤粺鐗堟湰',
-                  align: "center",
+                  align: 'center',
                   width: 200,
                   dataIndex: 'systemVersion'
                 },
                 {
                   title: '鎿嶄綔',
                   dataIndex: 'action',
-                  scopedSlots: {customRender: 'action'},
-                  align: "center",
+                  scopedSlots: { customRender: 'action' },
+                  align: 'center',
                   width: 150,
-                  fixed:'right'
+                  fixed: 'right'
                 }
 
               ]
@@ -444,119 +410,44 @@
           } else {
             // this.$message.warn(res.message)
             this.$notification.warning({
-              message:'娑堟伅',
-              description:res.message
-            });
+              message: '娑堟伅',
+              description: res.message
+            })
           }
-        }).finally(() =>{
+        }).finally(() => {
         })
       },
-      handleEdit: function (record) {
-        this.$refs.modalForm.edit(record);
-        this.$refs.modalForm.title = "缂栬緫";
-        this.$refs.modalForm.disableSubmit = false;
-        this.$refs.modalForm.disSeach = true;
+      /**
+       * 璋冪敤鎺ュ彛鑾峰彇鏌ヨ鍖哄煙杞﹂棿鏍戝垪琛�
+       */
+      getWorkshopListByApi() {
+        queryProductionTreeList().then(res => {
+          if (res.success) {
+            this.workshopTreeData = res.result
+            this.treeDefaultExpandedKeys = [...res.result].map(item => item.key)
+          }
+        })
+      },
+      handleEdit: function(record) {
+        this.$refs.modalForm.edit(record)
+        this.$refs.modalForm.title = '缂栬緫'
+        this.$refs.modalForm.disableSubmit = false
+        this.$refs.modalForm.disSeach = true
         // 璋冪敤鎶藉眽琛ㄥ崟缁勪欢涓殑娓呴櫎琛ㄥ崟楠岃瘉鏂规硶
         this.$refs.modalForm.removeValidate()
       },
-      handleAdd: function () {
-        this.$refs.modalForm.add();
-        this.$refs.modalForm.title = "鏂板";
-        this.$refs.modalForm.disableSubmit = false;
-        this.$refs.modalForm.disSeach = false;
-      },
-      getAvatarView: function (avatar) {
-        return getFileAccessHttpUrl(avatar)
-      },
-      batchFrozen: function (status) {
-        if (this.selectedRowKeys.length <= 0) {
-          // this.$message.warning('璇烽�夋嫨涓�鏉¤褰曪紒');
-          this.$notification.warning({
-            message:'娑堟伅',
-            description:"璇烽�夋嫨涓�鏉¤褰�"
-          });
-          return false;
-        } else {
-          let ids = "";
-          let that = this;
-          let isAdmin = false;
-          that.selectionRows.forEach(function (row) {
-            if (row.username == 'admin') {
-              isAdmin = true;
-            }
-          });
-          if (isAdmin) {
-            that.$message.warning('绠$悊鍛樿处鍙蜂笉鍏佽姝ゆ搷浣�,璇烽噸鏂伴�夋嫨锛�');
-            return;
-          }
-          that.selectedRowKeys.forEach(function (val) {
-            ids += val + ",";
-          });
-          that.$confirm({
-            title: "纭鎿嶄綔",
-            content: "鏄惁" + (status == 1 ? "瑙e喕" : "鍐荤粨") + "閫変腑璐﹀彿?",
-            onOk: function () {
-              frozenBatch({ids: ids, status: status}).then((res) => {
-                if (res.success) {
-                  // that.$message.success(res.message);
-                  that.$notification.success({
-                    message:'娑堟伅',
-                    description:res.message
-                  });
-                  that.loadData();
-                  that.onClearSelected();
-                } else {
-                  // that.$message.warning(res.message);
-                  that.$notification.warning({
-                    message:'娑堟伅',
-                    description:res.message
-                  });
-
-                }
-              });
-            }
-          });
-        }
+      handleAdd: function() {
+        this.$refs.modalForm.add()
+        this.$refs.modalForm.title = '鏂板'
+        this.$refs.modalForm.disableSubmit = false
+        this.$refs.modalForm.disSeach = false
       },
       handleMenuClick(e) {
         if (e.key == 1) {
-          this.batchDel();
-        } else if (e.key == 2) {
-          this.batchFrozen(2);
-        } else if (e.key == 3) {
-          this.batchFrozen(1);
+          this.batchDel()
         }
-      },
-      // handleFrozen: function (id, status, username) {
-      //   let that = this;
-      //   //TODO 鍚庡彴鏍¢獙绠$悊鍛樿鑹�
-      //   if ('admin' == username) {
-      //     that.$message.warning('绠$悊鍛樿处鍙蜂笉鍏佽姝ゆ搷浣滐紒');
-      //     return;
-      //   }
-      //   frozenBatch({ids: id, status: status}).then((res) => {
-      //     if (res.success) {
-      //       that.$message.success(res.message);
-      //       that.loadData();
-      //     } else {
-      //       that.$message.warning(res.message);
-      //     }
-      //   });
-      // },
-      // handleChangePassword(username) {
-      //   this.$refs.passwordmodal.show(username);
-      // },
-      passwordModalOk() {
-        //TODO 瀵嗙爜淇敼瀹屾垚 涓嶉渶瑕佸埛鏂伴〉闈紝鍙互鎶奷atasource涓殑鏁版嵁鏇存柊涓�涓�
-      },
-      onSyncFinally({isToLocal}) {
-        // 鍚屾鍒版湰鍦版椂鍒锋柊涓嬫暟鎹�
-        if (isToLocal) {
-          this.loadData()
-        }
-      },
+      }
     }
-
   }
 </script>
 <style scoped>

--
Gitblit v1.9.3