chenyuehu il y a 4 ans
Parent
commit
5603445735

+ 116 - 12
src/views/repair/application-form/modules/Detail.vue

@@ -1,13 +1,13 @@
 <template>
   <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
     <a-row :gutter="48" slot="extra">
-       <a-col :md="48" :sm="48">
-         <span class="table-page-search-submitButtons" style="float: right">
-           <a-button v-if="$auth('repair-application-forms-approve') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ACCEPTANCE === model.status" style="margin-left: 8px" type="primary" @click="handleApprove()">验收</a-button>
-           <a-button v-if="$auth('repair-application-forms-reback') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ACCEPTANCE === model.status" style="margin-left: 8px" type="danger" @click="handleReturn()">驳回</a-button>
-           <a-button style="margin-left: 8px" @click="handleCancel">返回</a-button>
-         </span>
-       </a-col>
+      <a-col :md="48" :sm="48">
+        <span class="table-page-search-submitButtons" style="float: right">
+          <a-button v-if="$auth('repair-application-forms-approve') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ACCEPTANCE === model.status" style="margin-left: 8px" type="primary" @click="handleApprove()">验收</a-button>
+          <a-button v-if="$auth('repair-application-forms-reback') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ACCEPTANCE === model.status" style="margin-left: 8px" type="danger" @click="handleReturn()">驳回</a-button>
+          <a-button style="margin-left: 8px" @click="handleCancel">返回</a-button>
+        </span>
+      </a-col>
     </a-row>
     <a-layout>
       <a-layout-content style="background-color: rgb(255, 255, 255)">
@@ -31,7 +31,7 @@
           <upload-image-detail :images-list="model.applicationFileList"/>
         </detail-list>
         <a-divider orientation="left">维修详情</a-divider>
-        <detail-list title=""  :col="3">
+        <detail-list title="" :col="3">
           <detail-list-item term="故障类别">{{ model.repairErrorTypeName }}</detail-list-item>
           <detail-list-item term="维修开始时间">{{ model.repairStartTime }}</detail-list-item>
           <detail-list-item term="维修结束时间">{{ model.repairEndTime }}</detail-list-item>
@@ -101,6 +101,33 @@
       rowKey="id">
 
     </a-table>
+
+    <title-divider title="费用清单" width="90px"></title-divider>
+    <div class="table-operator" v-if="$auth('repair-application-forms-finish') && ( DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)">
+      <a-button type="primary" @click="handleAddFee">
+        <a-icon type="plus"/>
+        添加
+      </a-button>
+    </div>
+    <a-table
+      :data-source="dataFee"
+      :columns="columnsFee"
+      tableLayout="auto"
+      rowKey="id">
+      <span slot="action" slot-scope="record">
+        <template>
+          <operation-button
+            v-if="$auth('repair-application-forms-finish') && ( DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)"
+            @click="handleEditFee(record)" >修改</operation-button>
+
+          <operation-button
+            v-if="$auth('repair-application-forms-finish') && ( DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)"
+            :type="2"
+            title="确认删除该笔费用?"
+            @confirm="batchDeleteFee(record.id)" >删除</operation-button>
+        </template>
+      </span>
+    </a-table>
     <!--<q-tabs :activeKey="activeKey" @change="changeTab">
       <q-tab-pane key="a" tab="配件更换">
         <spare-part-used-select-table :type="1" :table-params="{sbId: model.sbId, modelId: model.modelId, repairId: model.id}" ref="sparePartUsedSelectTable"/>
@@ -110,6 +137,7 @@
       </q-tab-pane>
     </q-tabs>-->
     <check-form ref="checkForm" @ok="handleOk" />
+    <fee-base-form ref="feeForm" @ok="handleOk" />
     <finish-form ref="finishForm" @ok="handleOk" />
     <dispatch-form ref="dispatchForm" @ok="handleCancel" />
   </a-card>
@@ -125,6 +153,8 @@ import SparePartUsedSelectTable from '@/views/sqarepartmanage/sparepartused/modu
 import SparePickFormSelectTable from '@/views/store/sparepickform/modules/SparePickFormSelectTable'
 import { selectSparePartUsedListByRepairId } from '@/api/sqarepartmanage/sparepartused'
 import { selectRepairProjectListByRepairId } from '@/api/repair/repairprojectrelation'
+import FeeBaseForm from '@/views/repair/fee/modules/BaseForm'
+import { deleteRepairFees, fetchRepairFee } from '@/api/repair/fee'
 const DetailListItem = DetailList.Item
 
 export default {
@@ -134,6 +164,7 @@ export default {
     DetailList,
     DetailListItem,
     FinishForm,
+    FeeBaseForm,
     DispatchForm,
     SparePartUsedSelectTable,
     SparePickFormSelectTable
@@ -152,10 +183,12 @@ export default {
       levelMap: {},
       descripitionMap: {},
       statusMap: {},
+      typeMap: {},
       repairProjectMap: {},
       repairTechnologyMap: {},
       data: [],
       dataSpare: [],
+      dataFee: [],
       // 表头
       columns: [
         {
@@ -228,6 +261,48 @@ export default {
           dataIndex: 'totalPrice'
         }
       ],
+      columnsFee: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${index + 1}`
+          }
+        },
+        {
+          title: '费用金额',
+          dataIndex: 'fee',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '费用类别',
+          dataIndex: 'type',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.typeMap, text)
+          }
+        },
+        {
+          title: '费用原因',
+          dataIndex: 'reason'
+        },
+        {
+          title: '费用描述',
+          dataIndex: 'descripition'
+        },
+        {
+          title: '备注',
+          dataIndex: 'remark'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
       model: {
         'id': null,
         'sbId': null,
@@ -264,6 +339,7 @@ export default {
     this.repairProjectMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_PROJECT_TYPE)
     this.repairTechnologyMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_TECHNOLOGY_TYPE)
     this.descripitionMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_QUESTION)
+    this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_FEE_TYPE)
   },
   methods: {
     base (record) {
@@ -289,6 +365,34 @@ export default {
         this.handleOk()
       })
     },
+    batchDeleteFee (id) {
+      let ids = []
+      if (this.BaseTool.String.isBlank(id)) {
+        const length = this.selectedRows.length
+        if (length === 0) {
+          this.$message.info('请选择要删除的记录')
+          return
+        }
+        ids = this.selectedRows.map(item => item.id)
+      } else {
+        ids = [id]
+      }
+      deleteRepairFees(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleAddFee () {
+      const modal = this.$refs.feeForm
+      modal.base(null, this.model)
+    },
+    handleEditFee (record) {
+      fetchRepairFee({ id: record.id }).then(res => {
+        const modal = this.$refs.feeForm
+        modal.base(res.data, this.model)
+      })
+    },
     handleApprove () {
       approve(this.model).then(() => {
         this.$message.info('操作成功')
@@ -306,12 +410,12 @@ export default {
       })
     },
     handleFinish () {
-        const modal = this.$refs.finishForm
-        modal.base(this.model)
+      const modal = this.$refs.finishForm
+      modal.base(this.model)
     },
     handleDispatch () {
-        const modal = this.$refs.dispatchForm
-        modal.base(this.model)
+      const modal = this.$refs.dispatchForm
+      modal.base(this.model)
     },
     changeTab (activeKey) {
       this.activeKey = activeKey

+ 110 - 0
src/views/repair/application-form/modules/DetailRepair.vue

@@ -122,6 +122,32 @@
         </template>
       </span>
     </a-table>
+    <title-divider title="费用清单" width="90px"></title-divider>
+    <div class="table-operator" v-if="$auth('repair-application-forms-finish') && ( DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)">
+      <a-button type="primary" @click="handleAddFee">
+        <a-icon type="plus"/>
+        添加
+      </a-button>
+    </div>
+    <a-table
+      :data-source="dataFee"
+      :columns="columnsFee"
+      tableLayout="auto"
+      rowKey="id">
+      <span slot="action" slot-scope="record">
+        <template>
+          <operation-button
+            v-if="$auth('repair-application-forms-finish') && ( DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)"
+            @click="handleEditFee(record)" >修改</operation-button>
+
+          <operation-button
+            v-if="$auth('repair-application-forms-finish') && ( DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)"
+            :type="2"
+            title="确认删除该笔费用?"
+            @confirm="batchDeleteFee(record.id)" >删除</operation-button>
+        </template>
+      </span>
+    </a-table>
     <!--    <q-tabs :activeKey="activeKey" @change="changeTab">
       <q-tab-pane key="a" tab="配件更换">
        <spare-part-used-select-table :type="2" :table-params="{sbId: model.sbId, modelId: model.modelId, repairId: model.id}" ref="sparePartUsedSelectTable"/>
@@ -139,6 +165,7 @@
     <!--    <spare-part-info-select-modal :type="'checkbox'" ref="spareSelectModal" @selected="handleSpareSelected"/>-->
     <base-form-for-repair ref="baseFormForRepair" @ok="handleOk" />
     <spare-store-select-modal ref="spareStoreSelectModal" @selected="handleSpareStoreSelected"/>
+    <fee-base-form ref="feeForm" @ok="handleOk" />
   </a-card>
 </template>
 
@@ -159,6 +186,8 @@ import BaseFormForRepair from '@/views/sqarepartmanage/sparepartused/modules/Bas
 import { selectSparePartUsedListByRepairId, addSparePartUsedBatch, deleteSparePartUseds } from '@/api/sqarepartmanage/sparepartused'
 import SpareStoreSelectModal from '@/views/store/sparestore/modules/SpareStoreSelectModal'
 import BaseTool from '@/utils/tool'
+import FeeBaseForm from '@/views/repair/fee/modules/BaseForm'
+import { deleteRepairFees, fetchRepairFee, queryRepairFee } from '@/api/repair/fee'
 
 const DetailListItem = DetailList.Item
 
@@ -171,6 +200,7 @@ export default {
     FinishForm,
     DispatchForm,
     AssignForm,
+    FeeBaseForm,
     SparePickBaseForm,
     SparePartUsedSelectTable,
     SparePickFormSelectTable,
@@ -189,6 +219,7 @@ export default {
       visible: false,
       // 下拉框map
       sourceMap: {},
+      typeMap: {},
       levelMap: {},
       descripitionMap: {},
       selectedRowKeys: [],
@@ -198,6 +229,7 @@ export default {
       activeKey: 'a',
       data: [],
       dataSpare: [],
+      dataFee: [],
       // 表头
       columns: [
         {
@@ -288,6 +320,48 @@ export default {
           scopedSlots: { customRender: 'actionSpare' }
         }
       ],
+      columnsFee: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${index + 1}`
+          }
+        },
+        {
+          title: '费用金额',
+          dataIndex: 'fee',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '费用类别',
+          dataIndex: 'type',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.typeMap, text)
+          }
+        },
+        {
+          title: '费用原因',
+          dataIndex: 'reason'
+        },
+        {
+          title: '费用描述',
+          dataIndex: 'descripition'
+        },
+        {
+          title: '备注',
+          dataIndex: 'remark'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
       model: {
         'id': null,
         'sbId': null,
@@ -324,6 +398,7 @@ export default {
     this.repairProjectMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_PROJECT_TYPE)
     this.repairTechnologyMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_TECHNOLOGY_TYPE)
     this.descripitionMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIRE_ACTION)
+    this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_FEE_TYPE)
   },
   methods: {
     base (record) {
@@ -338,6 +413,9 @@ export default {
       selectSparePartUsedListByRepairId({ id: record.id }).then(res => {
         this.dataSpare = res.data
       })
+      queryRepairFee({ repairId: record.id }).then(res => {
+        this.dataFee = res.data
+      })
     },
     handleCancel () {
       this.visible = false
@@ -351,6 +429,35 @@ export default {
         // modal.base(that.model)
       })
     },
+    batchDeleteFee (id) {
+      let ids = []
+      if (this.BaseTool.String.isBlank(id)) {
+        const length = this.selectedRows.length
+        if (length === 0) {
+          this.$message.info('请选择要删除的记录')
+          return
+        }
+        ids = this.selectedRows.map(item => item.id)
+      } else {
+        ids = [id]
+      }
+      deleteRepairFees(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+      })
+    },
+    handleAddFee () {
+      const modal = this.$refs.feeForm
+      modal.base(null, this.model)
+    },
+    handleEditFee (record) {
+      fetchRepairFee({ id: record.id }).then(res => {
+        const modal = this.$refs.feeForm
+        const data = res.data
+        data.repairNo = this.model.no
+        modal.base(data, this.model)
+      })
+    },
     handleApprove () {
       approve(this.model).then(() => {
         this.$message.info('操作成功')
@@ -372,6 +479,9 @@ export default {
       selectSparePartUsedListByRepairId({ id: this.model.id }).then(res => {
         this.dataSpare = res.data
       })
+      queryRepairFee({ repairId: this.model.id }).then(res => {
+        this.dataFee = res.data
+      })
     },
     handleFinish () {
       const modal = this.$refs.finishForm

+ 6 - 6
src/views/repair/fee/modules/BaseForm.vue

@@ -62,24 +62,24 @@
         :labelCol="BaseTool.Constant.labelCol"
         :wrapperCol="BaseTool.Constant.wrapperCol"
       >
-        <a-input
-          v-decorator="['reason', {rules: [{required: true, message: '费用原因不能为空'}]}]" />
+        <a-textarea
+          v-decorator="['reason']" />
       </a-form-item>
       <a-form-item
         label="费用描述"
         :labelCol="BaseTool.Constant.labelCol"
         :wrapperCol="BaseTool.Constant.wrapperCol"
       >
-        <a-input
-          v-decorator="['descripition', {rules: [{required: true, message: '费用描述不能为空'}]}]" />
+        <a-textarea
+          v-decorator="['descripition']" />
       </a-form-item>
       <a-form-item
         label="备注"
         :labelCol="BaseTool.Constant.labelCol"
         :wrapperCol="BaseTool.Constant.wrapperCol"
       >
-        <a-input
-          v-decorator="['remark', {rules: [{required: false, message: '备注不能为空'}]}]" />
+        <a-textarea
+          v-decorator="['remark']" />
       </a-form-item>
     </a-form>
     <template slot="footer">