浏览代码

Merge branch 'master' of http://152.136.206.27:3000/dongjh/ems_client

dongjh 1 年之前
父节点
当前提交
b6c3563db4

+ 33 - 4
src/views/module_cmms/spotcheck/SpotcheckList.vue

@@ -4,11 +4,12 @@
     <div class="table-page-search-wrapper">
       <a-form layout="inline" @keyup.enter.native="searchQuery">
         <a-row :gutter="24">
-          <a-col :xl="10" :lg="11" :md="12" :sm="24">
+          <a-col :xl="6" :lg="11" :md="12" :sm="24">
             <a-form-item label="点检时间">
-              <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.spotcheckdate_begin"></j-date>
+              <a-range-picker date-format="YYYY-MM-DD" v-model="queryParam.date" @change="onChangeDate" />
+              <!-- <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.spotcheckdate_begin"></j-date>
               <span class="query-group-split-cust"></span>
-              <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.spotcheckdate_end"></j-date>
+              <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.spotcheckdate_end"></j-date> -->
             </a-form-item>
           </a-col>
           <a-col :xl="6" :lg="7" :md="8" :sm="24">
@@ -112,7 +113,7 @@
     </div>
 
     <!-- <cmms-spotcheck-modal ref="modalForm" @ok="modalFormOk"></cmms-spotcheck-modal> -->
-    <spotcheck-modal ref="modalForm" @ok="modalFormOk"></spotcheck-modal>
+    <spotcheck-modal ref="modalForm" @ok="modalFormOk" :dataList="dataList"></spotcheck-modal>
   </a-card>
 </template>
 
@@ -210,6 +211,11 @@
         },
         dictOptions:{},
         superFieldList:[],
+        // 弹框中所有数据
+        dataList: {
+          cmmsSpotcheckTitemList: [],
+          files: []
+        }
       }
     },
     created() {
@@ -221,6 +227,12 @@
       },
     },
     methods: {
+      // 时间处理
+      onChangeDate(date, dateString){
+        console.log(date, dateString);
+        this.queryParam.spotcheckdate_begin= dateString[0]
+        this.queryParam.spotcheckdate_end= dateString[1]
+      },
       loadData(arg) {
         if(!this.url.list){
           this.$message.error("请设置url.list属性!")
@@ -256,6 +268,23 @@
         this.queryParam.equipmentid = this.selectData.id
         this.loadData()
       },
+      // 新增
+      handleAdd: function () {
+        console.log(this.queryParam.equipmentid)
+        if (this.selectData.id == undefined) {
+          this.$message.warning("请先选择设备");
+        } else {
+          getAction(`/cmmsSpotcheck/cmmsSpotcheck/getInfoByEquipmentid/${this.selectData.id}`).then((res) => {
+            console.log("000",res)
+            this.dataList = res.result
+            console.log(1111,this.dataList)
+            this.$refs.modalForm.add();
+            this.$refs.modalForm.title = "新增";
+            this.$refs.modalForm.disableSubmit = false;
+          })
+        }
+        
+      },
       initDictConfig(){
       },
       getSuperFieldList(){

+ 121 - 16
src/views/module_cmms/spotcheck/modules/SpotcheckForm.vue

@@ -4,25 +4,30 @@
       <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
         <div class="cmms-dialog-item-title">基本信息</div>
         <a-row>
-          <a-col :span="12">
-            <a-form-model-item label="所属点检内容编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="contentcode">
+          <!-- <a-col :span="12">
+            <a-form-model-item label="点检内容编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="contentcode">
               <a-input v-model="model.contentcode" placeholder="请输入所属点检内容编号"  ></a-input>
             </a-form-model-item>
-          </a-col>
+          </a-col> -->
           <a-col :span="12">
-            <a-form-model-item label="所属点检内容名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="contentname">
+            <a-form-model-item label="点检内容名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="contentname">
               <a-input v-model="model.contentname" placeholder="请输入所属点检内容名称"  ></a-input>
             </a-form-model-item>
           </a-col>
           <a-col :span="12">
-            <a-form-model-item label="设备ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentid">
+            <a-form-model-item label="设备名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentid">
               <j-search-select-tag v-model="model.equipmentid" dict="tpm_equipment,equipmentname,id"  />
             </a-form-model-item>
           </a-col>
-          <a-col :span="12">
-            <a-form-model-item label="所属点检内容ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="spotcheckcontid">
+          <!-- <a-col :span="12">
+            <a-form-model-item label="所属点检内容" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="spotcheckcontid">
               <j-search-select-tag v-model="model.spotcheckcontid" dict="cmms_spotcheck_content,contentname,id"  />
             </a-form-model-item>
+          </a-col> -->
+          <a-col :span="12">
+            <a-form-model-item label="点检结果" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="result">
+              <j-dict-select-tag type="list" v-model="model.result" dictCode="spotcheck_result" placeholder="请选择点检结果" />
+            </a-form-model-item>
           </a-col>
           <a-col :span="12">
             <a-form-model-item label="点检时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="spotcheckdate">
@@ -30,17 +35,52 @@
             </a-form-model-item>
           </a-col>
           <a-col :span="12">
-            <a-form-model-item label="点检结果" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="result">
-              <j-dict-select-tag type="list" v-model="model.result" dictCode="spotcheck_result" placeholder="请选择点检结果" />
+            <a-form-model-item label="点检描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="description">
+              <a-input v-model="model.description" placeholder="请输入点检描述"  ></a-input>
             </a-form-model-item>
           </a-col>
           <a-col :span="12">
-            <a-form-model-item label="点检描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="description">
-              <a-input v-model="model.description" placeholder="请输入点检描述"  ></a-input>
+            <a-form-model-item label="点检备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
+              <a-input v-model="model.remark" placeholder="请输入点检备注"  ></a-input>
             </a-form-model-item>
           </a-col>
         </a-row>
-        <div class="cmms-dialog-item-title">点检列表</div>
+        <div class="cmms-dialog-item-title u-flex-jab">
+          <div>点检列表</div>
+          <div>
+            <a-button type="link">一键正常</a-button>
+            <a-button type="link">一键异常</a-button>
+          </div>
+        </div>
+        <a-table
+          ref="table"
+          size="middle"
+          :scroll="{x:true}"
+          bordered
+          rowKey="itemcode"
+          :columns="columns"
+          :dataSource="model.cmmsSpotcheckTitemList"
+          :pagination="false"
+          class="j-table-force-nowrap">
+
+          <template slot="iresult" slot-scope="text, record,index">
+              <a-form-model-item :prop="'cmmsSpotcheckTitemList.'+index+'.iresult'" :rules="validatorRules.iresult" style="margin-bottom: 0px;">
+                  <a-radio-group name="radioGroup" v-model="record.iresult">
+                    <a-radio :value="0">
+                      正常
+                    </a-radio>
+                    <a-radio :value="1">
+                      异常
+                    </a-radio>
+                  </a-radio-group>
+              </a-form-model-item>
+          </template>
+          <template slot="iremark" slot-scope="text, record,index">
+              <a-form-model-item :prop="'cmmsSpotcheckTitemList.'+index+'.iremark'" :rules="validatorRules.iremark" style="margin-bottom: 0px;">
+                  <a-input v-model="record.iremark" placeholder="请输入点检备注"></a-input>
+              </a-form-model-item>
+          </template>
+        </a-table>
       </a-form-model>
     </j-form-container>
   </a-spin>
@@ -61,12 +101,19 @@
         type: Boolean,
         default: false,
         required: false
-      }
+      },
+      dataList: {
+        type: Object,
+        default: function(){
+            return {} // 使用工厂函数返回默认值
+        }
+      },
     },
     data () {
       return {
         model:{
-         },
+          cmmsSpotcheckTitemList: []
+        },
         labelCol: {
           xs: { span: 24 },
           sm: { span: 5 },
@@ -75,8 +122,59 @@
           xs: { span: 24 },
           sm: { span: 16 },
         },
+        columns: [
+          // {
+          //   title: '#',
+          //   dataIndex: '',
+          //   key:'rowIndex',
+          //   width:60,
+          //   align:"center",
+          //   customRender:function (t,r,index) {
+          //     return parseInt(index)+1;
+          //   }
+          // },
+          {
+            title:'点检项编号',
+            align:"center",
+            dataIndex: 'itemcode'
+          },
+          {
+            title:'点检项名称',
+            align:"center",
+            dataIndex: 'itemname'
+          },
+          {
+            title:'标准',
+            align:"center",
+            dataIndex: 'conditions',
+          },
+          {
+            title:'点检结果',
+            align:"center",
+            dataIndex: 'iresult',
+            scopedSlots: { customRender: 'iresult' }
+          },
+          {
+            title:'点检备注',
+            align:"center",
+            dataIndex: 'iremark',
+            scopedSlots: { customRender: 'iremark' }
+          }
+        ],
         confirmLoading: false,
         validatorRules: {
+          contentname: [
+            { required: true, message: '请输入点检内容名称!'},
+          ],
+          equipmentid: [
+            { required: true, message: '请选择设备!'},
+          ],
+          result: [
+            { required: true, message: '请输入点检结果!'},
+          ],
+          spotcheckdate: [
+            { required: true, message: '请选择点检时间!'},
+          ],
         },
         url: {
           add: "/cmmsSpotcheck/cmmsSpotcheck/add",
@@ -96,7 +194,9 @@
     },
     methods: {
       add () {
-        this.edit(this.modelDefault);
+        // this.edit(this.modelDefault);
+        console.log(222,this.dataList)
+        this.model = this.dataList
       },
       edit (record) {
         this.model = Object.assign({}, record);
@@ -117,6 +217,7 @@
               httpurl+=this.url.edit;
                method = 'put';
             }
+            console.log(99,this.model)
             httpAction(httpurl,this.model,method).then((res)=>{
               if(res.success){
                 that.$message.success(res.message);
@@ -133,4 +234,8 @@
       },
     }
   }
-</script>
+</script>
+
+<style scoped>
+@import "~@/assets/less/uStyle.less";
+</style>

+ 9 - 1
src/views/module_cmms/spotcheck/modules/SpotcheckModal.vue

@@ -8,7 +8,7 @@
     :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
     @cancel="handleCancel"
     cancelText="关闭">
-    <spotcheck-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></spotcheck-form>
+    <spotcheck-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" :dataList="dataList"></spotcheck-form>
   </u-modal>
 </template>
 
@@ -20,6 +20,14 @@
     components: {
         SpotcheckForm
     },
+    props: {
+      dataList: {
+        type: Object,
+        default: function(){
+            return {} // 使用工厂函数返回默认值
+        }
+      },
+    },
     data () {
       return {
         title:'',