maintenance-detail.vue 12.0 KB
Newer Older
宋雄's avatar
宋雄 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
<template>
  <div class="page-content">
    <a-spin :spinning="confirmLoading">
      <div style="padding:24px 30px;font-weight:600;">报修流程</div>
      <div class="row-box">
        <a-steps :current="currentStep">
          <a-step v-for="(item, index) in auditList" :key="index" :title="item.title" :description="item.time" />
        </a-steps>
      </div>
      <a-divider />
      <div style="padding:0 30px 24px;font-weight:600;">报修信息</div>
      <j-form-container :disabled="true">
        <a-form-model ref="form" :model="model" slot="detail">
          <a-row>
            <a-col :span="12">
              <a-form-model-item label="报修主题" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairTitle">
                <a-input v-model="model.repairTitle" placeholder="请输入"></a-input>
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item label="报修单号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="id">
                <a-input v-model="model.id" placeholder="请输入"></a-input>
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item label="报修物品" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairArticle">
                <a-input v-model="model.repairArticle" placeholder="请输入"></a-input>
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item label="预约上门时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="reservationTime">
                <a-input v-model="model.reservationTime" placeholder="请输入"></a-input>
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item label="报修人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ownerName">
                <a-input v-model="model.ownerName" placeholder="请输入"></a-input>
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item label="报修位置" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairAddress">
                <a-input v-model="model.repairAddress" placeholder="请输入"></a-input>
              </a-form-model-item>
            </a-col>
            <a-col :span="24">
何忠建's avatar
何忠建 committed
46 47
              <a-form-model-item label="报修描述" :labelCol="{ xs: { span: 24 }, sm: { span: 2 } }" :wrapperCol="wrapperCol"
                prop="repairDesc">
宋雄's avatar
宋雄 committed
48 49 50 51 52
                <a-textarea v-model="model.repairDesc" placeholder="请输入" style="width:80%" />
              </a-form-model-item>
            </a-col>

            <a-col :span="24">
何忠建's avatar
何忠建 committed
53 54 55 56
              <a-form-model-item label="报修图片" :labelCol="{ xs:{ span: 24 }, sm:{ span: 2 } }" :wrapperCol="wrapperCol"
                prop="repairPhotoList">
                <j-image-upload :isMultiple="true" text="点击上传" bizPath="scott/pic"
                  v-model="model.repairPhotoList"></j-image-upload>
宋雄's avatar
宋雄 committed
57 58 59
              </a-form-model-item>
            </a-col>

何忠建's avatar
何忠建 committed
60
            <template v-if="model.maintenanceName">
宋雄's avatar
宋雄 committed
61 62 63 64 65 66
              <a-col :span="12">
                <a-form-model-item label="维修员" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="maintenanceName">
                  <a-input v-model="model.maintenanceName" placeholder="请输入"></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="24">
何忠建's avatar
何忠建 committed
67 68 69 70
                <a-form-model-item label="维修记录" :labelCol="{ xs:{ span: 24 }, sm:{ span: 2 } }" :wrapperCol="wrapperCol"
                  prop="maintenancePhoto">
                  <j-image-upload :isMultiple="true" text="点击上传" bizPath="scott/pic"
                    v-model="model.maintenancePhoto"></j-image-upload>
宋雄's avatar
宋雄 committed
71 72 73
                </a-form-model-item>
              </a-col>
            </template>
何忠建's avatar
何忠建 committed
74 75 76 77 78 79 80 81 82 83 84 85
            <a-col :span="12">
              <a-form-model-item label="工单状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairStatusName">
                <a-input v-model="model.repairStatusName" placeholder="请输入"></a-input>
              </a-form-model-item>
            </a-col>
            <a-col :span="24"
              v-if="(model.repairStatus === 'initiateRefuse' || model.repairStatus === 'finishRefuse') && model.auditOpinion">
              <a-form-model-item label="驳回理由" :labelCol="{ xs: { span: 24 }, sm: { span: 2 } }" :wrapperCol="wrapperCol"
                prop="auditOpinion">
                <a-textarea v-model="model.auditOpinion" placeholder="请输入" style="width:80%" />
              </a-form-model-item>
            </a-col>
宋雄's avatar
宋雄 committed
86 87 88
          </a-row>
        </a-form-model>
      </j-form-container>
何忠建's avatar
何忠建 committed
89
      <j-form-container v-if="formShow">
宋雄's avatar
宋雄 committed
90 91 92
        <a-form-model ref="form" :model="form" slot="detail">
          <a-row>
            <a-col :span="24">
何忠建's avatar
何忠建 committed
93 94
              <a-form-model-item label="审核意见" :labelCol="{ xs: { span: 24 }, sm: { span: 2 } }" :wrapperCol="wrapperCol"
                prop="repairStatus">
宋雄's avatar
宋雄 committed
95
                <a-select v-model="form.repairStatus" placeholder="请选择与业主关系" style="width:50%">
宋雄's avatar
宋雄 committed
96 97 98 99 100 101 102 103
                  <template v-if="model.repairStatus === 'initiateWaitAudit'">
                    <a-select-option value="waitDispatch">审核通过</a-select-option>
                    <a-select-option value="initiateRefuse">审核驳回</a-select-option>
                  </template>
                  <template v-if="model.repairStatus === 'finishWaitAudit'">
                    <a-select-option value="finishAuditPass">审核通过</a-select-option>
                    <a-select-option value="finishRefuse">审核驳回</a-select-option>
                  </template>
宋雄's avatar
宋雄 committed
104 105 106
                </a-select>
              </a-form-model-item>
            </a-col>
何忠建's avatar
何忠建 committed
107
            <a-col :span="24" v-if="form.repairStatus === 'initiateRefuse' || form.repairStatus === 'finishRefuse'">
何忠建's avatar
何忠建 committed
108 109
              <a-form-model-item label="驳回理由" :labelCol="{ xs: { span: 24 }, sm: { span: 2 } }" :wrapperCol="wrapperCol"
                prop="auditOpinion">
宋雄's avatar
宋雄 committed
110 111 112 113 114 115 116 117 118
                <a-textarea v-model="form.auditOpinion" placeholder="请输入" style="width:80%" />
              </a-form-model-item>
            </a-col>
          </a-row>
        </a-form-model>
      </j-form-container>

      <div style="text-align:center">
        <a-button @click="onReturn">返回</a-button>
何忠建's avatar
何忠建 committed
119
        <a-button style="margin-left: 16px" type="primary" v-if="formShow" @click="onSubmit">提交</a-button>
宋雄's avatar
宋雄 committed
120 121 122 123 124 125
      </div>
    </a-spin>
  </div>
</template>

<script>
何忠建's avatar
何忠建 committed
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
import { auditCommunityRepairApi, queryCommunityRepairApi } from '@/api/api'
import { REPAIR_STATUS, filterDictTextByStatic } from '@/assets/static.js'
const initiatewaitAuditList = [
  { title: '提交维修信息', time: '' },
  { title: '报单待审核', time: '' },
  { title: '待派单', time: '' },
  { title: '维修中', time: '' },
  { title: '提单待审核', time: '' },
  { title: '完成', time: '' },
]
export default {
  name: 'PropertyChargruleForm',
  inject: ['closeCurrent'],
  data() {
    return {
      repairStatus: REPAIR_STATUS,
      auditList: [],
      currentStep: 1,
      model: {},
      form: {
何忠建's avatar
何忠建 committed
146
        repairStatus: '',
何忠建's avatar
何忠建 committed
147
        auditOpinion: '',
宋雄's avatar
宋雄 committed
148
      },
何忠建's avatar
何忠建 committed
149 150 151
      labelCol: {
        xs: { span: 24 },
        sm: { span: 4 },
宋雄's avatar
宋雄 committed
152
      },
何忠建's avatar
何忠建 committed
153 154 155
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 20 },
宋雄's avatar
宋雄 committed
156
      },
何忠建's avatar
何忠建 committed
157
      confirmLoading: false,
宋雄's avatar
宋雄 committed
158 159 160 161 162 163 164 165
      initiatewaitAuditList: [
        { title: '提交维修信息', time: '' },
        { title: '报单待审核', time: '' },
        { title: '待派单', time: '' },
        { title: '维修中', time: '' },
        { title: '提单待审核', time: '' },
        { title: '完成', time: '' },
      ]
宋雄's avatar
宋雄 committed
166
    }
何忠建's avatar
何忠建 committed
167 168
  },
  computed: {
何忠建's avatar
何忠建 committed
169 170
    formShow() {
      return this.$route.query.type === 'audit'
何忠建's avatar
何忠建 committed
171 172 173 174 175 176 177 178 179 180 181 182 183 184
    },
  },
  created() {
    //备份model原始值
    this.getDetail()
  },
  methods: {
    async getDetail() {
      this.confirmLoading = true
      let { result } = await queryCommunityRepairApi({ id: this.$route.query.id })
      result.repairPhotoList = result.repairPhoto.split(',')
      this.model = { ...result }
      this.confirmLoading = false
      this.model.repairStatusName = filterDictTextByStatic(REPAIR_STATUS, this.model.repairStatus)
宋雄's avatar
宋雄 committed
185 186 187 188
      if (result.repairStatus === 'initiateRefuse') {
        this.initiatewaitAuditList[0].time = '提交成功' + result.createTime
        this.initiatewaitAuditList[1].time = '审核驳回' + result.initiateAuditTime
        this.auditList = [...this.initiatewaitAuditList]
何忠建's avatar
何忠建 committed
189
      } else if (result.repairStatus === 'waitDispatch') {
宋雄's avatar
宋雄 committed
190 191 192
        this.initiatewaitAuditList[0].time = '提交成功' + result.createTime
        this.initiatewaitAuditList[1].time = '审核通过' + result.initiateAuditTime
        this.auditList = [...this.initiatewaitAuditList]
何忠建's avatar
何忠建 committed
193
        this.currentStep = 2
何忠建's avatar
何忠建 committed
194
      } else if (result.repairStatus === 'waitReceive') {
宋雄's avatar
宋雄 committed
195 196 197 198 199
        this.initiatewaitAuditList[0].time = '提交成功' + result.createTime
        this.initiatewaitAuditList[1].time = '审核通过' + result.initiateAuditTime
        this.initiatewaitAuditList[2].time = '派单成功待接收' + result.updateTime
        this.auditList = [...this.initiatewaitAuditList]
        this.currentStep = 3
何忠建's avatar
何忠建 committed
200
      } else if (result.repairStatus === 'inRepair') {
宋雄's avatar
宋雄 committed
201 202 203 204
        this.initiatewaitAuditList[0].time = '提交成功' + result.createTime
        this.initiatewaitAuditList[1].time = '审核通过' + result.initiateAuditTime
        this.initiatewaitAuditList[2].time = '派单成功待接收' + result.updateTime
        this.auditList = [...this.initiatewaitAuditList]
何忠建's avatar
何忠建 committed
205
        this.currentStep = 3
宋雄's avatar
宋雄 committed
206 207 208 209 210 211 212 213 214 215 216 217 218 219
      } else if (result.repairStatus === 'finishWaitAudit') {
        this.initiatewaitAuditList[0].time = '提交成功' + result.createTime
        this.initiatewaitAuditList[1].time = '审核通过'
        this.initiatewaitAuditList[2].time = '派单成功' + result.dispatchTime
        this.initiatewaitAuditList[3].time = `维修员'${result.updateBy}'维修成功 ${result.updateTime}`
        this.auditList = [...this.initiatewaitAuditList]
        this.currentStep = 4
      } else if(result.repairStatus === 'finishRefuse') {
        this.initiatewaitAuditList[0].time = '提交成功' + result.createTime
        this.initiatewaitAuditList[1].time = '审核通过' + result.initiateAuditTime
        this.initiatewaitAuditList[2].time = '派单成功' + result.dispatchTime
        this.initiatewaitAuditList[3].time = `维修员'${result.updateBy}'维修成功 ${result.updateTime}`
        this.initiatewaitAuditList[4].time = '审核驳回' + result.updateTime
        this.auditList = [...this.initiatewaitAuditList]
何忠建's avatar
何忠建 committed
220
        this.currentStep = 4
宋雄's avatar
宋雄 committed
221 222 223 224 225 226 227
      } else if (result.repairStatus === 'finishAuditPass') {
        this.initiatewaitAuditList[0].time = '提交成功' + result.createTime
        this.initiatewaitAuditList[1].time = '审核通过'
        this.initiatewaitAuditList[2].time = '派单成功' + result.dispatchTime
        this.initiatewaitAuditList[3].time = `维修员'${result.updateBy}'维修成功`
        this.initiatewaitAuditList[4].time = '审核通过' + result.updateTime
        this.auditList = [...this.initiatewaitAuditList]
何忠建's avatar
何忠建 committed
228
        this.currentStep = 5
宋雄's avatar
宋雄 committed
229 230 231
      } else {  // 提单待审核
        this.initiatewaitAuditList[0].time = '提交成功' + result.createTime
        this.auditList = [...this.initiatewaitAuditList]
何忠建's avatar
何忠建 committed
232 233 234
      }
    },
    onReturn() {
宋雄's avatar
宋雄 committed
235 236 237
      // this.$store.dispatch('tags/delView', this.$route.path)
      // this.$router.go(-1)
      this.closeCurrent()
何忠建's avatar
何忠建 committed
238 239
    },
    async onSubmit() {
何忠建's avatar
何忠建 committed
240 241 242 243 244 245 246 247 248 249 250
      if (this.form.repairStatus) {
        let res = await auditCommunityRepairApi({
          id: this.$route.query.id,
          repairStatus: this.form.repairStatus,
          auditOpinion: this.form.auditOpinion,
        })
        this.$message.success(res.message)
        this.onReturn()
      }else{
        this.$message.warning('请选择审核意见');
      }
何忠建's avatar
何忠建 committed
251 252 253
    },
  },
}
宋雄's avatar
宋雄 committed
254 255 256 257 258 259 260 261 262 263 264 265
</script>

<style scoped lang="less">
.page-content {
  min-height: 430px;
  background-color: #fff;
  padding: 0 15px 50px 5px;
  .row-box {
    padding: 0 50px;
  }
}
</style>