浏览代码

Merge remote-tracking branch 'origin/demo_' into demo_

hfxc226 2 年之前
父节点
当前提交
1cb11b89ee

+ 7 - 3
src/views/repair/application-form/modules/DetailRepair.vue

@@ -448,18 +448,22 @@ export default {
           title: '备件名称',
           dataIndex: 'spareName'
         },
+        {
+          title: '备件编码',
+          dataIndex: 'no'
+        },
         {
           title: '规格型号',
           dataIndex: 'ggxh'
         },
         {
-          title: '本次更换日期',
+          title: '更换日期',
           dataIndex: 'startDate'
         },
-        {
+        /* {
           title: '下次更换日期',
           dataIndex: 'startDate'
-        },
+        }, */
         {
           title: '更换备注',
           dataIndex: 'remark'

+ 101 - 46
src/views/repair/application-form/modules/LongYanSelectSpareForm.vue

@@ -1,57 +1,66 @@
 <template>
   <a-modal
     :title="modalTitle"
-    :width="600"
+    :width="1000"
     :visible="visible"
     :confirmLoading="confirmLoading"
     class="ant-modal2"
     @cancel="handleCancel"
   >
     <a-form :form="form">
-      <row-list :col="1">
-        <row-item>
-          <a-form-item
-            label="备件"
-            :labelCol="BaseTool.Constant.labelCol2"
-            :wrapperCol="BaseTool.Constant.wrapperCol2"
-          >
-            <a-input
-              style="width: 70%"
-              disabled
-              v-model="spareName" />
-            <a-button style="width: 30%" type="primary" @click="handleSpareLongYanSelect">选择备件</a-button>
-          </a-form-item>
-        </row-item>
 
-        <row-item>
-          <a-form-item
-            label="备件寿命"
-            :labelCol="BaseTool.Constant.labelCol2"
-            :wrapperCol="BaseTool.Constant.wrapperCol2"
-          >
-            <a-input
-              style="width: 100%"
-              suffix="天"
-              v-decorator="['sparePeriod']" />
-          </a-form-item>
-        </row-item>
-        <row-item>
-          <a-form-item
-            label="更换备注"
-            :labelCol="BaseTool.Constant.labelCol2"
-            :wrapperCol="BaseTool.Constant.wrapperCol2"
-          >
-            <a-textarea
-              :rows="4"
-              v-decorator="['remark']"/>
-          </a-form-item>
-        </row-item>
-      </row-list>
+      <a-form-item
+        label="备件"
+        :labelCol="BaseTool.Constant.labelCol2"
+        :wrapperCol="BaseTool.Constant.wrapperCol2"
+      >
+        <a-input
+          style="width: 300px"
+          disabled
+          v-model="spareName" />
+        <a-button style="width: 100px" type="primary" @click="handleSpareLongYanSelect">选择备件</a-button>
+      </a-form-item>
+
     </a-form>
+    <a-table
+      :columns="columns"
+      :data-source="spareRows"
+      bordered
+      :defaultExpandAllRows="true"
+    >
+      <template v-slot:index="text,record,index">
+        {{ index+1 }}
+      </template>
+      <template v-slot:startDate="text,record">
+        <div>
+          <a-date-picker
+            style="width: 150px"
+            :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
+            v-model="record.startDate" />
+        </div>
+      </template>
+      <template v-slot:num="text,record">
+        <div>
+          <a-input
+            type="number"
+            :min="0"
+            style="width: 100%"
+            v-model="record.num"/>
+        </div>
+      </template>
+      <template v-slot:remark="text,record">
+        <div>
+          <a-input
+            type="textarea"
+            style="width: 100%"
+            v-model="record.remark"/>
+        </div>
+      </template>
+    </a-table>
     <template slot="footer">
       <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
     </template>
-    <spare-long-yan-select-modal ref='spareLongYanSelectModal' @selected="handleSpareLongYanSelected"/>
+    <spare-long-yan-select-modal ref="spareLongYanSelectModal" @selected="handleSpareLongYanSelected"/>
   </a-modal>
 </template>
 
@@ -70,7 +79,49 @@ export default {
       spareRows: [],
       // 下拉框map
       isSpecial: 0,
-      spareName: null
+      spareName: null,
+      columns: [
+        {
+          title: '序号',
+          key: 'index',
+          align: 'center',
+          width: 50,
+          scopedSlots: { customRender: 'index' }
+        },
+        {
+          title: '备件名称',
+          width: 100,
+          dataIndex: 'spareName'
+        },
+        {
+          title: '备件编码',
+          dataIndex: 'no',
+          width: 120
+        },
+        {
+          title: '规格型号',
+          dataIndex: 'ggxh',
+          width: 150
+        },
+        {
+          title: '更换日期',
+          dataIndex: 'startDate',
+          width: 150,
+          scopedSlots: { customRender: 'startDate' }
+        },
+        {
+          title: '更换数量',
+          dataIndex: 'num',
+          width: 150,
+          scopedSlots: { customRender: 'num' }
+        },
+        {
+          title: '备注',
+          dataIndex: 'remark',
+          width: 150,
+          scopedSlots: { customRender: 'remark' }
+        }
+      ]
     }
   },
   components: {
@@ -84,6 +135,7 @@ export default {
   methods: {
     base (queryParam, model) {
       this.visible = true
+      this.spareName = null
       this.spareRows = []
       this.isSpecial = queryParam.isSpecial
       this.model = model
@@ -98,7 +150,7 @@ export default {
         }
         const data = []
         for (let i = 0; i < this.spareRows.length; i++) {
-          data.push({ remark: values.remark, sparePeriod: values.sparePeriod, isSpecial: this.isSpecial, sbId: this.model.sbId, spareId: this.spareRows[i].id, repairId: this.model.id, num: 1, spareName: this.spareRows[i].name, ggxh: this.spareRows[i].ggxh })
+          data.push({ remark: this.spareRows[i].remark, isSpecial: this.isSpecial, sbId: this.model.sbId, no: this.spareRows[i].no, repairId: this.model.id, spareName: this.spareRows[i].spareName, ggxh: this.spareRows[i].ggxh, num: this.spareRows[i].num, startDate: this.BaseTool.Date.formatter(this.spareRows[i].startDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN) })
         }
         addLongYanSparePartUsedBatch(data)
           .then((response) => {
@@ -119,10 +171,13 @@ export default {
       this.$refs.spareLongYanSelectModal.base({ isSpecial: this.isSpecial }, { isSpecial: this.isSpecial, sbId: this.model.sbId })
     },
     handleSpareLongYanSelected (record, keys, rows) {
-      this.spareRows = rows
-      for (let i = 0; i < rows.length; i++) {
-        this.spareName = this.spareName + ',' + rows[i].name
-      }
+      this.spareRows = rows.map(item => {
+        item.num = 1
+        item.remark = ''
+        return item
+      })
+
+      this.spareName = rows.length
     }
   }
 }

+ 12 - 3
src/views/store/sparestore/modules/SpareLongYanSelectModal.vue

@@ -14,13 +14,18 @@
             <a-form layout="inline">
               <a-row :gutter="48">
                 <a-col :md="8" :sm="24">
-                  <a-form-item label="关键字">
-                    <a-input v-model.trim="queryParam.keyword" placeholder="请输入备件名称"/>
+                  <a-form-item label="备件名称">
+                    <a-input v-model.trim="queryParam.spareName" placeholder="请输入备件名称"/>
+                  </a-form-item>
+                </a-col>
+                <a-col :md="8" :sm="24">
+                  <a-form-item label="备件编码">
+                    <a-input v-model.trim="queryParam.spareNo" placeholder="请输入备件编码"/>
                   </a-form-item>
                 </a-col>
                 <a-col :md="8" :sm="24">
                   <a-form-item label="规格型号">
-                    <a-input v-model="queryParam.ggxh" placeholder="模糊查询"/>
+                    <a-input v-model="queryParam.ggxh" placeholder="请输入规格型号"/>
                   </a-form-item>
                 </a-col>
 <!--                <a-col :md="8" :sm="24">
@@ -147,6 +152,10 @@ export default {
           title: '备件名称',
           dataIndex: 'spareName'
         },
+        {
+          title: '备件编码',
+          dataIndex: 'no'
+        },
         {
           title: '规格型号',
           dataIndex: 'ggxh'