Browse Source

设备点检优化

wyh 1 year ago
parent
commit
7c10c5b16b

+ 32 - 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,22 @@
         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) => {
+            this.dataList = res.result
+            console.log(1111,this.dataList)
+            this.$refs.modalForm.add();
+            this.$refs.modalForm.title = "新增";
+            this.$refs.modalForm.disableSubmit = false;
+          })
+        }
+        
+      },
       initDictConfig(){
       },
       getSuperFieldList(){

+ 65 - 5
src/views/module_cmms/spotcheck/modules/SpotcheckForm.vue

@@ -15,7 +15,7 @@
             </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>
@@ -41,6 +41,17 @@
           </a-col>
         </a-row>
         <div class="cmms-dialog-item-title">点检列表</div>
+        <a-table
+          ref="table"
+          size="middle"
+          :scroll="{x:true}"
+          bordered
+          rowKey="id"
+          :columns="columns"
+          :dataSource="model.cmmsSpotcheckTitemList"
+          :pagination="false"
+          class="j-table-force-nowrap">
+        </a-table>
       </a-form-model>
     </j-form-container>
   </a-spin>
@@ -61,12 +72,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,6 +93,43 @@
           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',
+          },
+          {
+            title:'点检备注',
+            align:"center",
+            dataIndex: 'iremark'
+          }
+        ],
         confirmLoading: false,
         validatorRules: {
         },
@@ -96,7 +151,8 @@
     },
     methods: {
       add () {
-        this.edit(this.modelDefault);
+        // this.edit(this.modelDefault);
+        console.log(222,this.dataList)
       },
       edit (record) {
         this.model = Object.assign({}, record);
@@ -133,4 +189,8 @@
       },
     }
   }
-</script>
+</script>
+
+<style scoped>
+@import "~@/assets/less/uStyle.less";
+</style>