wyh il y a 1 an
Parent
commit
86286a730d

+ 38 - 2
src/views/module_ems/cmmsSpotcheckContent/CmmsSpotcheckContentList.vue

@@ -63,7 +63,7 @@
           <!-- <a-popconfirm title="确定删除吗?" @confirm="() => statusChange(record)">
             <a-switch :default-checked= "record.status == 0 ? true : false" @change="statusChange(record,$event)" />
           </a-popconfirm> -->
-          <a-switch :default-checked= "record.status == 0 ? true : false" @click="statusChange(record,$event)" />
+          <a-switch :checked= "record.status == 0 ? true : false" @click="statusChange(record,$event)" />
           <!-- <a-switch checkedChildren="禁用" unCheckedChildren="启用" :default-checked= "record.status == 0 ? true : false" @change="statusChange(record,$event)" /> -->
         </template>
 
@@ -120,6 +120,7 @@
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   import CmmsSpotcheckContentModal from './modules/CmmsSpotcheckContentModal'
   import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
+  import { httpAction, getAction } from '@/api/manage'
 
   export default {
     name: 'CmmsSpotcheckContentList',
@@ -178,7 +179,7 @@
           deleteBatch: "/cmmsSpotcheckContent/cmmsSpotcheckContent/deleteBatch",
           exportXlsUrl: "/cmmsSpotcheckContent/cmmsSpotcheckContent/exportXls",
           importExcelUrl: "cmmsSpotcheckContent/cmmsSpotcheckContent/importExcel",
-
+          edit: "/cmmsSpotcheckContent/cmmsSpotcheckContent/edit",
         },
         dictOptions:{},
         superFieldList:[],
@@ -196,6 +197,12 @@
     methods: {
       initDictConfig(){
       },
+      modalFormOk() {
+        // 新增/修改 成功时,重载列表
+        this.loadData();
+        //清空列表选中
+        this.onClearSelected()
+      },
       getSuperFieldList(){
         let fieldList=[];
         fieldList.push({type:'string',value:'contentcode',text:'点检内容编号',dictCode:''})
@@ -206,6 +213,35 @@
       },
       statusChange(record,$event){
         console.log(record.status,$event)
+        let text = record.status === "0" ? "停用" : "启用";
+        const that = this
+        that.$confirm({
+          title: "提示",
+          content: "确认要" + text + "该内容吗?",
+          onOk() {
+            let httpurl = '';
+            let method = 'put';
+            httpurl+=that.url.edit;
+            if (record.status == 1) {
+              that.model = record
+              that.model.status = 0
+            } else {
+              that.model = record
+              that.model.status = 1
+            }
+            httpAction(httpurl,that.model,method).then((res)=>{
+              if(res.success){
+                that.$message.success(res.message);
+                that.modalFormOk()
+              }else{
+                that.$message.warning(res.message);
+              }
+            })
+          },
+          onCancel() {
+            // that.modalFormOk()
+          }
+        });
       }
     }
   }

+ 6 - 6
src/views/module_ems/cmmsSpotcheckContent/modules/CmmsSpotcheckContentModal.vue

@@ -1,29 +1,29 @@
 <template>
-  <j-modal
+  <u-modal
     :title="title"
-    :width="width"
-    :visible="visible"
+    :visible.sync="visible"
     switchFullscreen
     @ok="handleOk"
     :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
     @cancel="handleCancel"
     cancelText="关闭">
     <cmms-spotcheck-content-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></cmms-spotcheck-content-form>
-  </j-modal>
+  </u-modal>
 </template>
 
 <script>
+import UModal from '../../../../components/module_ems/UModal/UModal.vue'
 
   import CmmsSpotcheckContentForm from './CmmsSpotcheckContentForm'
   export default {
     name: 'CmmsSpotcheckContentModal',
     components: {
-      CmmsSpotcheckContentForm
+      CmmsSpotcheckContentForm,
+        UModal
     },
     data () {
       return {
         title:'',
-        width:800,
         visible: false,
         disableSubmit: false
       }

+ 6 - 7
src/views/module_ems/tpmTag/modulesPL/TpmTagModalPL.vue

@@ -1,29 +1,28 @@
 <template>
-  <j-modal
+  <u-modal
     :title="title"
-    :width="width"
-    v-bind:body-style="{height:'700px'}"
-    :visible="visible"
+    :visible.sync="visible"
     switchFullscreen
     @ok="handleOk"
     :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
     @cancel="handleCancel"
     cancelText="关闭">
     <TpmTagFormPL1 ref="realForm" @ok="submitCallback"></TpmTagFormPL1>
-  </j-modal>
+  </u-modal>
 </template>
 
 <script>
+import UModal from '../../../../components/module_ems/UModal/UModal.vue';
   import TpmTagFormPL1 from './TpmTagFormPL1'
   export default {
     name: 'TpmTagModalPL',
     components: {
-      TpmTagFormPL1
+      TpmTagFormPL1,
+        UModal
     },
     data () {
       return {
         title:'',
-        width:1700,
         visible: false,
         disableSubmit: false
       }