From 42d2aa6117884b07d62f45d4255fcfb92614a374 Mon Sep 17 00:00:00 2001
From: yangkang <yangkang@xalxzn.com>
Date: 星期三, 13 九月 2023 15:42:50 +0800
Subject: [PATCH] 预测方案修改

---
 src/views/eam/modules/predictiveWorkPlan/PredictiveWorkPlanModal.vue |   60 ++------
 src/views/eam/PredictiveWorkPlanList.vue                             |   31 +++-
 src/views/eam/common/EquipmentList.vue                               |  314 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 354 insertions(+), 51 deletions(-)

diff --git a/src/views/eam/PredictiveWorkPlanList.vue b/src/views/eam/PredictiveWorkPlanList.vue
index 75fcca1..fe4d1b0 100644
--- a/src/views/eam/PredictiveWorkPlanList.vue
+++ b/src/views/eam/PredictiveWorkPlanList.vue
@@ -41,7 +41,7 @@
           >
             <a-form-item label="鐗堟湰鐘舵��">
               <a-radio-group
-                v-model="queryParam.versionStatus"
+                v-model="queryParam.status"
                 @change="onChange"
                 default-value="2"
               >
@@ -227,7 +227,7 @@
 
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 
-  import { requestPut } from '@/api/manage'
+  import { requestPut,deleteAction  } from '@/api/manage'
 
   import DailyMaintenanceStandardDetail from './modules/dailyMaintenanceStandard/DailyMaintenanceStandardDetail'
   //璁″垝鐢ㄦ枡
@@ -373,9 +373,8 @@
         isDel: false,
         url: {
           list: '/eam/predictiveworkplan/pagePredictiveWorkPlan',
-          delete: '/eam/maintenanceStandard/delete',
-          deleteBatch: '/eam/maintenanceStandard/deleteBatch',
-          versionTakeEffect: '/eam/maintenanceStandard/versionTakeEffect'
+          delete: '/eam/predictiveworkplan/delete',
+          versionTakeEffect: '/eam/predictiveworkplan/versionTakeEffect'
         }
       }
     },
@@ -395,6 +394,24 @@
         this.planId = ''
         this.equipmentId = ''
         this.isAdd = false
+      },
+      handleDelete: function(id) {
+        if (!this.url.delete) {
+          this.$message.error('璇疯缃畊rl.delete灞炴��!')
+          return
+        }
+        var that = this
+        deleteAction(that.url.delete, { id: id }).then((res) => {
+          if (res.success) {
+            //閲嶆柊璁$畻鍒嗛〉闂
+            that.reCalculatePage(1)
+            that.$message.success(res.message)
+            that.loadData()
+            that.onClearSelected()
+          } else {
+            that.$message.warning(res.message)
+          }
+        })
       },
       onSelectChange(selectedRowKeys, selectionRows) {
         this.selectedRowKeys = selectedRowKeys
@@ -425,7 +442,7 @@
       //鍗囩増
       handleRevise: function(record) {
         this.$refs.modalForm.edit(record)
-        this.$refs.modalForm.title = '淇濆吇鏍囧噯鐗堟湰鍗囩骇'
+        this.$refs.modalForm.title = '鍗囩骇'
         this.$refs.modalForm.disableSubmit = false
         this.$refs.modalForm.isRevise = true
       },
@@ -443,7 +460,7 @@
             requestPut(that.url.versionTakeEffect, {
               id: record.id,
               num: record.num,
-              versionStatus: '2'
+              status: '2'
             }).then((res) => {
               if (res.success) {
                 that.$message.success('鐗堟湰鐢熸晥鎴愬姛锛�')
diff --git a/src/views/eam/common/EquipmentList.vue b/src/views/eam/common/EquipmentList.vue
new file mode 100644
index 0000000..ef8e940
--- /dev/null
+++ b/src/views/eam/common/EquipmentList.vue
@@ -0,0 +1,314 @@
+<template>
+  <a-modal
+    :title="title"
+    :width="1250"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    :okButtonProps="{ props: {disabled: disableSubmit} }"
+    @ok="handleOk"
+    @cancel="handleCancel"
+    cancelText="鍏抽棴"
+  >
+    <a-spin :spinning="confirmLoading">
+      <a-form :form="form">
+        <div class="table-page-search-wrapper">
+          <a-form
+            layout="inline"
+            @keyup.enter.native="searchQuery"
+          >
+            <a-row :gutter="24">
+              <a-col
+                :md="6"
+                :sm="8"
+              >
+                <a-form-item label="璁惧缂栧彿">
+                  <j-input
+                    placeholder="璇疯緭鍏ユ爣鍑嗙紪鍙锋绱�"
+                    v-model="queryParam.num"
+                  ></j-input>
+                </a-form-item>
+              </a-col>
+
+              <a-col
+                :md="6"
+                :sm="8"
+              >
+                <a-form-item label="璁惧鍚嶇О">
+                  <j-input
+                    placeholder="璇疯緭鍏ヨ澶囧悕绉版绱�"
+                    v-model="queryParam.name"
+                  ></j-input>
+                </a-form-item>
+              </a-col>
+              <a-col
+                :md="6"
+                :sm="8"
+              >
+                <a-button
+                  type="primary"
+                  @click="searchQuery"
+                  icon="search"
+                >鏌ヨ</a-button>
+                <a-button
+                  @click="searchReset"
+                  icon="reload"
+                  style="margin-left:8px;"
+                >閲嶇疆</a-button>
+              </a-col>
+            </a-row>
+            <a-row :gutter="24">
+              <a-col :span="24">
+
+              </a-col>
+            </a-row>
+          </a-form>
+        </div>
+        <div style="margin-top:8px;">
+          <a-table
+            ref="table"
+            size="middle"
+            bordered
+            rowKey="id"
+            :columns="columns"
+            :dataSource="dataSource"
+            :pagination="ipagination"
+            :loading="loading"
+            @change="handleTableChange"
+            :customRow="clickThenCheck"
+            :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:type}"
+          >
+
+          </a-table>
+        </div>
+      </a-form>
+    </a-spin>
+
+  </a-modal>
+</template>
+
+<script>
+
+import { postAction, getAction } from '@/api/manage'
+import JDate from '@/components/jeecg/JDate'
+import Tooltip from 'ant-design-vue/es/tooltip'
+import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+import JEllipsis from '@/components/jeecg/JEllipsis'//寮曞叆杩囬暱瑁佸壀
+import store from '@/store'
+
+export default {
+  name: "EquipmentList",
+  mixins: [JeecgListMixin],
+  components: {
+    JDate,
+    Tooltip,
+    JEllipsis,
+  },
+  data() {
+    return {
+      title: "璁惧淇℃伅",
+      visible: false,
+      model: {},
+      dataSource: [],
+      disableSubmit: false,
+      type: "radio",
+      /* 鍒嗛〉鍙傛暟 */
+      ipagination: {
+        current: 1,
+        pageSize: 10,
+        pageSizeOptions: ['10', '20', '30'],
+        showTotal: (total, range) => {
+          return range[0] + "-" + range[1] + " 鍏�" + total + "鏉�"
+        },
+        showQuickJumper: true,
+        showSizeChanger: true,
+        total: 0
+      },
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 6 },
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 18 },
+      },
+      confirmLoading: false,
+      form: this.$form.createForm(this),
+      columns: [
+        {
+          title: '#',
+          dataIndex: '',
+          key: 'rowIndex',
+          align: 'center',
+          customRender: function (t, r, index) {
+            return parseInt(index) + 1
+          }
+        },
+        {
+          title: '璁惧缂栫爜',
+          align: 'center',
+          dataIndex: 'num',
+        },
+        {
+          title: '璁惧鍚嶇О',
+          align: 'center',
+          dataIndex: 'name',
+        },
+        {
+          title: '璁惧鍨嬪彿',
+          align: "center",
+          dataIndex: 'model'
+        },
+        {
+          title: '璁惧瑙勬牸',
+          align: "center",
+          dataIndex: 'specification'
+        },
+        {
+          title: '璁惧鐘舵��',
+          align: "center",
+          dataIndex: 'equipmentStatus_dictText'
+        },
+      ],
+      url: {
+        list: "/eam/equipment/pageEquipment",
+      },
+    }
+  },
+
+
+  methods: {
+
+    searchQuery() {
+      this.loadData(1);
+    },
+    searchReset() {
+      this.queryParam = { equipmentStatus: '1' };
+      this.loadData(1)
+    },
+    list(params) {
+      this.selectedRowKeys = [];
+      this.selectedRowRecord = [];
+      this.visible = true;
+      if (params == null || params == "") {
+        this.queryParam.useId = ""
+      } else {
+        this.queryParam.useId = params
+      }
+      this.queryParam.equipmentStatus = '1'
+      this.loadData(1);
+    },
+    clickThenCheck(record) {
+      return {
+        on: {
+          click: (e) => {
+            this.selectedRowRecord = record;
+            this.onSelectChange(record.id.split(","), [record]);
+          }
+        }
+      };
+    },
+    onSelectChange(selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys;
+      this.selectedRowRecord = selectedRows[0];
+    },
+    close() {
+      this.queryParam = {};
+      this.$emit('close');
+      this.visible = false;
+    },
+    handleOk() {
+      const that = this;
+      // 瑙﹀彂琛ㄥ崟楠岃瘉
+      if (that.selectedRowKeys.length > 0) {
+        if (that.selectedRowRecord.id != null && that.selectedRowRecord.id != "") {
+          that.$emit('sendEquipmentRecord', { record: that.selectedRowRecord });
+          that.close();
+        } else {
+          that.$message.error("璇烽�夋嫨璁惧淇℃伅锛�")
+        }
+      } else {
+        that.$message.error("璇烽�夋嫨璁惧淇℃伅锛�")
+      }
+    },
+
+    handleCancel() {
+      this.close();
+    },
+
+  },
+}
+</script>
+<style scoped>
+.ant-btn {
+  padding: 0 10px;
+  margin-left: 3px;
+}
+
+.ant-form-item-control {
+  line-height: 0px;
+}
+
+.fontweight {
+  font-weight: bold;
+}
+
+/** 涓昏〃鍗曡闂磋窛 */
+.ant-form .ant-form-item {
+  margin-bottom: 10px;
+}
+
+/** Tab椤甸潰琛岄棿璺� */
+.ant-tabs-content .ant-form-item {
+  margin-bottom: 0px;
+}
+.ant-table-tbody .ant-table-row td {
+  padding-top: 10px;
+  padding-bottom: 10px;
+}
+
+.anty-row-operator button {
+  margin: 0 5px;
+}
+
+.ant-btn-danger {
+  background-color: #ffffff;
+}
+
+.ant-modal-cust-warp {
+  height: 100%;
+}
+
+.ant-modal-cust-warp .ant-modal-body {
+  height: calc(100% - 110px) !important;
+  overflow-y: auto;
+}
+
+.ant-modal-cust-warp .ant-modal-content {
+  height: 90% !important;
+  overflow-y: hidden;
+}
+
+/deep/ .notshow {
+  display: none;
+}
+
+.frozenRowClass {
+  color: #c9c9c9;
+}
+.hight {
+  color: #f5222d;
+}
+.middle {
+  color: #fa8c16;
+}
+.low {
+  color: #52c41a;
+}
+.dataUnKnow {
+  color: #1890ff;
+}
+
+/deep/ .frozenRowClass {
+  color: #c9c9c9;
+}
+</style>
\ No newline at end of file
diff --git a/src/views/eam/modules/predictiveWorkPlan/PredictiveWorkPlanModal.vue b/src/views/eam/modules/predictiveWorkPlan/PredictiveWorkPlanModal.vue
index 5fcc5e4..8d605b5 100644
--- a/src/views/eam/modules/predictiveWorkPlan/PredictiveWorkPlanModal.vue
+++ b/src/views/eam/modules/predictiveWorkPlan/PredictiveWorkPlanModal.vue
@@ -181,39 +181,32 @@
       @sendEquipmentRecord='sendEquipmentRecord'
     ></equipment-list>
 
-    <!--    <j-select-maintenance-standard-modal ref="maintenanceStandardModalForm"></j-select-maintenance-standard-modal>-->
   </a-modal>
 
 </template>
 
 <script>
-  import { getAction, postAction, requestPut, deleteAction } from '@/api/manage'
+  import { postAction, requestPut } from '@/api/manage'
   import pick from 'lodash.pick'
   import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
-  import { duplicateCheck } from '@/api/api'
   import Tooltip from 'ant-design-vue/es/tooltip'
-  // import JSelectMaintenanceStandardModal from './JSelectMaintenanceStandardModal'
 
   import { preview } from 'vue-photo-preview'
-  import { ACCESS_TOKEN } from '@/store/mutation-types'
-  import Vue from 'vue'
   import PdfView from '@views/common/PdfView'
-  import { getFileAccessHttpUrl } from '@/api/manage'
-  import EquipmentList from '.././dailyInspectionStandard/EquipmentList'
+  import EquipmentList from '@/views/eam/common/EquipmentList'
 
   export default {
     name: 'MaintenanceStandardModal',
     components: {
       JMultiSelectTag,
       Tooltip,
-      // JSelectMaintenanceStandardModal,
-      // UploadModel,
       PdfView,
       preview,
       EquipmentList
     },
     data() {
-      return {title: '鎿嶄綔',
+      return {
+        title: '鎿嶄綔',
         visible: false,
         visible4Confirm: false,
         disableSubmit: false,
@@ -270,13 +263,10 @@
           }
         },
         url: {
-          list: '/eam/maintenanceStandardDetail/getMaintenanceStandardDetailListByIds',
           add: '/eam/predictiveworkplan/add',
           edit: '/eam/predictiveworkplan/edit',
-          addDetail: '/eam/maintenanceStandardDetail/add',
-          revise: '/eam/maintenanceStandard/revise',
-          getReviseVersion: '/eam/maintenanceStandard/getReviseVersion',
-          loadOptions: '/sys/sysDepart/loadDepartTreeOptions'
+          revise: '/eam/predictiveworkplan/revise',
+          getReviseVersion: '/eam/predictiveworkplan/getReviseVersion'
         },
 
         dataSource: [],
@@ -294,31 +284,23 @@
     methods: {
 
       add() {
-        this.edit({ maintenanceStandardDetaillist: [] })
+        this.edit()
       },
 
       edit(record) {
         let that = this
-        this.initOptions()
         this.dataSource = []
         this.form.resetFields()
         this.model = Object.assign({}, record)
         this.visible = true
-        if (record.maintenanceStandardDetaillist != undefined) {
-          const temp = [...record.maintenanceStandardDetaillist]
-          // for (let i = 0; i < temp.length; i++) {
-          //   let r = temp[i].upload;
-          //   r.src = this.getSrc(temp[i].upload);
-          // }
-          that.dataSource = temp
-        }
         that.$nextTick(() => {
-          that.model.equipmentId = record.id
+          that.model.equipmentId = record.equipmentId
           that.model.teamId = record.teamId
-          if (!record.status) {
-            that.model.status = 1
-          }
-          that.form.setFieldsValue(pick(that.model, 'num', 'equipmentName', 'useDepartName', 'teamName', 'assignMode', 'planVersion', 'remark'))
+          that.form.setFieldsValue(pick(that.model, 'num', 'name', 'monitorType', 'maintenanceMethod', 'assignMode', 'teamName', 'planVersion'))
+          that.form.setFieldsValue({
+            equipmentName: record.deviceNum + '/' + record.deviceName + '/' + record.deviceModel,
+            historyVersion: record.planVersion
+          })
         })
         if (record.id) {
           this.codeDisable = true
@@ -326,7 +308,7 @@
             if (that.isRevise) {
               requestPut(that.url.getReviseVersion, record).then((res) => {
                 if (res.success) {
-                  that.form.setFieldsValue({ planVersion: res.result, historyVersion: record.version })
+                  that.form.setFieldsValue({ planVersion: res.result })
                 }
               })
             }
@@ -337,16 +319,6 @@
             that.form.setFieldsValue({ 'planVersion': '1.0' })
           })
         }
-      },
-
-      initOptions() {
-        getAction(this.url.loadOptions).then(res => {
-          if (res.success) {
-            this.treeData = res.result
-          } else {
-            this.$message.warning(res.message)
-          }
-        })
       },
 
       onEquipmentList() {
@@ -381,11 +353,11 @@
             let formData = Object.assign(this.model, values)
             let obj
             if (!this.model.id) {
-              formData.planVersion = '1'
+              formData.status = '1'
               obj = postAction(this.url.add, formData)
             } else {
               if (this.isRevise) {
-                formData.planVersion = '1'
+                formData.status = '1'
                 obj = postAction(this.url.revise, formData)
               } else {
                 obj = requestPut(this.url.edit, formData, { id: this.model.id })

--
Gitblit v1.9.3