guarantee-lsq 1 gadu atpakaļ
vecāks
revīzija
4487784fd6

+ 8 - 0
src/api/preparation/preparation.js

@@ -241,3 +241,11 @@ export function finish (parameter) {
     data: parameter
   })
 }
+
+export function handleVerifyByDTO (parameter) {
+  return axios({
+    url: '/preparation/preparations/verify/' + parameter.id,
+    method: 'PUT',
+    data: parameter
+  })
+}

+ 10 - 0
src/api/upms/user.js

@@ -239,3 +239,13 @@ export function queryUserByRoleName (parameter) {
     }
   })
 }
+
+export function queryUserByRoleNameAndDept (parameter) {
+  return axios({
+    url: `/upms/users/query/roleName/${parameter.roleName}/{${parameter.deptId}}`,
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}

+ 15 - 6
src/utils/dict.js

@@ -940,12 +940,21 @@ DictCache.VALUE = {
     CALLER_REPAIR_VERIFY_SUCCESS_THREE: 22 // 计划维修报修成功
   },
   REPAIR_PREPARATION_STATUS: {
-    NOT_ALLOCATED: 1, // 待审核
-    VERIFY_SUCCESS: 2, // 待接单
-    VERIFY_FAIL: 3, // 审核被拒
-    WAIT_DISPATCH: 4, // 待分配
-    PROCESSING: 5, // 执行中
-    FINISHED: 6 // 已完成
+    NOT_ALLOCATED: 1, // 待主管审核
+    APPLY_MANAGER_VERIFY_SUCCESS: 2, // 待申请部门负责人审核
+    APPLY_MANAGER_VERIFY_BACK: 4, // 申请部门主管审核退回
+    APPLY_LEADER_VERIFY_SUCCESS: 5, // 收件部处理中
+    APPLY_LEADER_VERIFY_BACK: 7, // 申请部门负责人审核回退
+    PROCESSING: 8, // 材料费用处理中
+    RECEIVE_VERIFY_BACK: 10, // 收件负责人回退
+    FIRST_PROCESSING_VERIFYING: 11, // 材料费用审核中
+    FIRST_PROCESSING_VERIFY_BACK: 13, // 材料费用审核-回退
+    SECOND_PROCESSING: 14, // 执行中
+    SECOND_PROCESSING_VERIFYING: 15, // 验收中
+    FINISHED: 16, // 已完成
+    SECOND_PROCESSING_BACK: 17, //
+    CLOSE: 18 // 审核拒绝
+
   },
   /**
    * 维修状态

+ 2 - 13
src/views/preparation/preparation/Preparation.vue

@@ -52,13 +52,12 @@
       >
         <span slot="action" slot-scope="record">
           <template>
-            <a @click="handleView(record)">主页数据</a>
+            <a @click="handleView(record)">工单详情</a>
             <!--            <operation-button
               v-if="$auth('preparation-preparations-edit')"
               @click="handleEdit(record)"
             >修改</operation-button>-->
-            <a-divider v-if="record.status === 1" type="vertical" />
-            <a v-if="record.status === 1" @click="handleAssign(record)">派单</a>
+<!--            <a-divider v-if="record.status === 1" type="vertical" />-->
             <a-divider type="vertical" />
             <a @click="handlePrint(record)">打印</a>
           </template>
@@ -70,9 +69,7 @@
     </div>
     <base-form ref="baseModal" @ok="handleOk"/>
     <detail ref="detailModal" @ok="handleOk"/>
-    <assign-form ref="assignForm" @ok="handleOk" />
     <ticket-form ref="ticketForm" @ok="handleOk" />
-
   </a-card>
 </template>
 
@@ -81,7 +78,6 @@ import { STable, Ellipsis } from '@/components'
 import BaseForm from './modules/BaseForm'
 import Detail from './modules/Detail'
 import { getPreparationPage, deletePreparations, fetchPreparation, exportPreparation } from '@/api/preparation/preparation'
-import AssignForm from './modules/AssignForm'
 import TicketForm from './modules/TicketForm'
 
 export default {
@@ -91,7 +87,6 @@ export default {
     Ellipsis,
     BaseForm,
     Detail,
-    AssignForm,
     TicketForm
   },
   props: {
@@ -297,12 +292,6 @@ export default {
     handleEnter () {
       this.$refs.table.refresh(true)
     },
-    handleAssign (record) {
-      fetchPreparation({ id: record.id }).then(res => {
-        const modal = this.$refs.assignForm
-        modal.base(res.data)
-      })
-    },
     handlePrint (record) {
       this.visible = false
       console.log(record)

+ 29 - 6
src/views/preparation/preparation/modules/BaseForm.vue

@@ -14,6 +14,16 @@
       </a-form-item>
 
       <row-list :col="2">
+        <row-item>
+          <a-form-item
+            label="任务名称"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['name', {rules: [{required: true, message: '任务名称不能为空'}]}]" />
+          </a-form-item>
+        </row-item>
         <row-item>
           <a-form-item
             label="公司"
@@ -94,7 +104,7 @@
         </row-item>
         <row-item>
           <a-form-item
-            label="执行部门"
+            label="收件部门"
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
@@ -102,7 +112,7 @@
               style="width: 100%"
               :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
               :treeData="executeDeptList"
-              v-decorator="['executeDept', {initValue: '09', rules: [{required: true, message: '申请部门不能为空'}]}]"
+              v-decorator="['receiveDept', {initValue: '09', rules: [{required: true, message: '收件部门不能为空'}]}]"
               :treeNodeFilterProp="'title'"
               :showSearch="true"
               placeholder="请选择"
@@ -114,13 +124,26 @@
       <row-list :col="1">
         <row-item>
           <a-form-item
-            label="问题描述"
+            label="任务内容"
+            :labelCol="BaseTool.Constant.labelCol2"
+            :wrapperCol="BaseTool.Constant.wrapperCol2"
+          >
+            <a-textarea
+              :rows="4"
+              v-decorator="['content', {rules: [{required: true, message: '任务内容描述不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+      </row-list>
+      <row-list :col="1">
+        <row-item>
+          <a-form-item
+            label="申请原因"
             :labelCol="BaseTool.Constant.labelCol2"
             :wrapperCol="BaseTool.Constant.wrapperCol2"
           >
             <a-textarea
               :rows="4"
-              v-decorator="['content', {rules: [{required: true, message: '委托内容描述不能为空'}]}]"/>
+              v-decorator="['applyReason', {rules: [{required: true, message: '申请原因不能为空'}]}]"/>
           </a-form-item>
         </row-item>
       </row-list>
@@ -189,10 +212,10 @@ export default {
       this.visible = true
       // 如果是空标识添加
       if (this.BaseTool.Object.isBlank(record)) {
-        this.modalTitle = '添加'
+        this.modalTitle = '添加建筑物工单'
         return
       }
-      this.modalTitle = '编辑'
+      this.modalTitle = '编辑建筑物工单'
       const { form: { setFieldsValue } } = this
       // 日期处理
       record.applyTime = this.BaseTool.Moment(record.applyTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)

+ 40 - 17
src/views/preparation/preparation/modules/Detail.vue

@@ -1,26 +1,25 @@
 <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 style="margin-left: 8px" type="default" @click="handleCancel()">返回</a-button>
-              </span>
-      </a-col>-->
     </a-row>
     <a-descriptions :column="3" bordered>
+      <a-descriptions-item label="任务名称">{{ model.name }}</a-descriptions-item>
       <a-descriptions-item label="单据号">{{ model.no }}</a-descriptions-item>
       <a-descriptions-item label="公司">{{ BaseTool.Object.getField(preparationMap,model.parentPositionId) }}</a-descriptions-item>
       <a-descriptions-item label="申请人">{{ model.createdUserName }}</a-descriptions-item>
       <a-descriptions-item label="申请部门">{{ model.deptName }}</a-descriptions-item>
-      <a-descriptions-item label="审批主管">{{ model.applyVerifyUser }}</a-descriptions-item>
-      <a-descriptions-item label="工单状态"><badge :text="BaseTool.Object.getField(statusMap,model.status)" :status="DictCache.COLOR.REPAIR_FORM_STATUS[model.status]"/></a-descriptions-item>
-      <a-descriptions-item label="建筑物">{{ model.positionName }}</a-descriptions-item>
+      <a-descriptions-item label="申请建筑物">{{ model.positionName }}</a-descriptions-item>
+      <a-descriptions-item label="申请原因" :span="3"> <span v-html="model.applyReason "></span></a-descriptions-item>
       <a-descriptions-item label="申请时间">{{ model.applyTime }}</a-descriptions-item>
       <a-descriptions-item label="要求完成日期">{{ model.limitHours }}</a-descriptions-item>
-      <a-descriptions-item label="问题描述" :span="3"> <span v-html="model.content "></span></a-descriptions-item>
+      <a-descriptions-item label="审批主管">{{ model.applyVerifyUser }}</a-descriptions-item>
+      <a-descriptions-item label="部门负责人">{{ model.applyVerifyLeaderName }}</a-descriptions-item>
+      <a-descriptions-item label="工单状态"><badge :text="BaseTool.Object.getField(statusMap,model.status)" :status="DictCache.COLOR.REPAIR_FORM_STATUS[model.status]"/></a-descriptions-item>
+      <a-descriptions-item label="备注">{{ model.remark }}</a-descriptions-item>
+      <a-descriptions-item label="任务描述" :span="3"> <span v-html="model.content "></span></a-descriptions-item>
+      <a-descriptions-item label="收件部门">{{ model.receiveDeptName }}</a-descriptions-item>
+      <a-descriptions-item label="收件部门负责人">{{ model.receiveVerifyLeaderName }}</a-descriptions-item>
       <a-descriptions-item label="执行部门">{{ model.executeDeptName }}</a-descriptions-item>
-      <a-descriptions-item v-if='model.status == DictCache.VALUE.REPAIR_PREPARATION_STATUS.VERIFY_SUCCESS || model.status == DictCache.VALUE.REPAIR_PREPARATION_STATUS.VERIFY_FAIL || model.status == DictCache.VALUE.REPAIR_PREPARATION_STATUS.NOT_ALLOCATED' label="可接单执行主管">{{ model.executeMangers }}</a-descriptions-item>
-      <a-descriptions-item v-if='model.status == DictCache.VALUE.REPAIR_PREPARATION_STATUS.WAIT_DISPATCH || model.status == DictCache.VALUE.REPAIR_PREPARATION_STATUS.FINISHED || model.status == DictCache.VALUE.REPAIR_PREPARATION_STATUS.PROCESSING' label="执行主管">{{ model.executeMangers }}</a-descriptions-item>
       <a-descriptions-item label="执行人">{{ model.repairUserName }}</a-descriptions-item>
       <a-descriptions-item label="执行开始时间">{{ model.repairStartTime }}</a-descriptions-item>
       <a-descriptions-item label="执行结束时间">{{ model.repairEndTime }}</a-descriptions-item>
@@ -46,20 +45,27 @@
     </a-descriptions>
     <div class="btn">
       <a-button style="margin-left: 8px" type="primary" @click="handleCancel">返回</a-button>
-      <a-button v-if="DictCache.VALUE.REPAIR_PREPARATION_STATUS.NOT_ALLOCATED === model.status " style="margin-left: 16px" type="default" @click="handleAssign">审核</a-button>
-      <a-button v-if="DictCache.VALUE.REPAIR_PREPARATION_STATUS.VERIFY_SUCCESS === model.status " style="margin-left: 16px" type="default" @click="handleAssign">接单</a-button>
+      <a-button v-if="DictCache.VALUE.REPAIR_PREPARATION_STATUS.NOT_ALLOCATED === model.status ||
+      DictCache.VALUE.REPAIR_PREPARATION_STATUS.APPLY_MANAGER_VERIFY_SUCCESS === model.status"
+                style="margin-left: 16px"
+                type="default"
+                @click="handleVerify()">审核</a-button>
       <a-button v-if="DictCache.VALUE.REPAIR_PREPARATION_STATUS.WAIT_DISPATCH === model.status " style="margin-left: 16px" type="default" @click="handleAssign">派单</a-button>
       <a-button v-if="DictCache.VALUE.REPAIR_PREPARATION_STATUS.PROCESSING === model.status" style="margin-left: 8px" type="default" @click="handleFinish()">完成维修</a-button>
     </div>
     <assign-form ref="assignForm" @ok="handleCancel" />
     <finish-form ref="finishForm" @ok="handleCancel" />
+    <verify-form ref="verifyForm" @ok="handleCancel" />
+    <dispatch-form ref="dispatchForm" @ok="handleCancel" />
   </a-card>
 </template>
 
 <script>
 import DetailList from '@/components/tools/DetailList'
-import AssignForm from './AssignForm'
+import DispatchForm from './DispatchForm'
 import FinishForm from './FinishForm'
+import VerifyForm from './VerifyForm'
+import DictCache from '@/utils/dict'
 import { fetchPreparation } from '@/api/preparation/preparation'
 const DetailListItem = DetailList.Item
 
@@ -68,8 +74,9 @@ export default {
   components: {
     DetailList,
     DetailListItem,
-    AssignForm,
-    FinishForm
+    DispatchForm,
+    FinishForm,
+    VerifyForm
   },
   data () {
     return {
@@ -105,7 +112,12 @@ export default {
         'dispatchUserName': null,
         'executeDeptName': null,
         'applyVerifyUser': null,
-        'executeMangers': null
+        'executeMangers': null,
+        'name': null,
+        'applyReason': null,
+        'applyVerifyLeaderName': null,
+        'receiveVerifyLeaderName': null,
+        'receiveDeptName': null
       }
     }
   },
@@ -131,6 +143,17 @@ export default {
         modal.base(res.data)
       })
     },
+    // 审核 - 主管 - 负责人 - 收件负责人
+    handleVerify () {
+      // 派单审核
+      if (this.model.status === DictCache.VALUE.REPAIR_PREPARATION_STATUS.APPLY_LEADER_VERIFY_SUCCESS) {
+        const modal = this.$refs.dispatchForm
+        modal.base({ id: this.model.id })
+      } else { // 其他审核
+        const modal = this.$refs.verifyForm
+        modal.base({ status: this.model.status, id: this.model.id })
+      }
+    },
     handleFinish () {
       const modal = this.$refs.finishForm
       modal.base(this.model)

+ 169 - 0
src/views/preparation/preparation/modules/DispatchForm.vue

@@ -0,0 +1,169 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="800"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    class="ant-modal2"
+    @cancel="handleCancel"
+  >
+    <a-form :form="form">
+      <a-form-item v-show="false" >
+        <a-input v-decorator="['id']" type="hidden"/>
+      </a-form-item>
+      <row-list :col="1">
+        <row-item>
+          <a-form-item
+            label="审核派单"
+            :labelCol="BaseTool.Constant.labelCol2"
+            :wrapperCol="BaseTool.Constant.wrapperCol2"
+          >
+            <a-radio-group v-model="verifyStatus">
+              <a-radio :value="1">派单</a-radio>
+              <a-radio :value="2">拒绝</a-radio>
+              <a-radio :value="3">回退</a-radio>
+            </a-radio-group>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="执行部门"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-tree-select
+              style="width: 100%"
+              :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
+              :treeData="executeDeptList"
+              v-decorator="['executeDept', {initValue: '09', rules: [{required: true, message: '执行部门不能为空'}]}]"
+              :treeNodeFilterProp="'title'"
+              :showSearch="true"
+              @change="handleChange"
+              placeholder="请选择"
+            >
+            </a-tree-select>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="执行人"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-select v-decorator="['repairUserId', { rules: [{required: true, message: '执行人不能为空'}]}]" placeholder="请选择">
+              <a-select-option
+                v-for="({realName,userId}) in repairUserList"
+                :key="userId"
+                :label="realName"
+                :value="userId">{{ realName }}
+              </a-select-option>
+            </a-select>
+          </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="['verifyRemark']"/>
+          </a-form-item>
+        </row-item>
+      </row-list>
+    </a-form>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import pick from 'lodash.pick'
+import { dispatchModelByDTO } from '@/api/preparation/preparation'
+import { queryUserByRoleNameAndDept } from '@/api/upms/user'
+import { getDeptTreePreparation } from '@/api/upms/dept'
+export default {
+  name: 'VerifyForm',
+  data () {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      visible: false,
+      verifyStatus: 1,
+      executeDeptList: {},
+      repairUserList: [],
+      // 下拉框map
+      model: null
+    }
+  },
+  components: {
+  },
+  props: {
+  },
+  created () {
+    this.getDept()
+  },
+  methods: {
+    getDept () {
+      // 获取执行部门
+      const parameter = {
+      }
+      getDeptTreePreparation(parameter).then(res => {
+        this.executeDeptList = res.data
+      })
+    },
+    handleChange (value, label, extra) {
+      alert(value)
+      this.getRepairUser(value)
+    },
+    getRepairUser (deptId) {
+      // 获取执行人集合
+      queryUserByRoleNameAndDept({ roleName: 'PREPARATION_USER', deptId: deptId }).then(res => {
+        this.verifyUserList = res.data
+      })
+    },
+    base (record) {
+      this.visible = true
+      this.model = record
+      this.modalTitle = '审核派单'
+      const { form: { setFieldsValue } } = this
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign(pick(record, [
+          'id'
+        ])))
+      })
+    },
+    save () {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        // 具体处理
+        values.verifyStatus = this.verifyStatus
+        console.log(values)
+        dispatchModelByDTO(values)
+          .then(() => {
+            this.handleCancel(values)
+          }).catch(() => {
+            this.confirmLoading = false
+          })
+      })
+    },
+    handleCancel (values) {
+      this.visible = false
+      this.confirmLoading = false
+      this.form.resetFields()
+      if (this.BaseTool.Object.isNotBlank(values)) {
+        this.$emit('ok')
+      }
+    }
+
+  }
+}
+</script>

+ 122 - 0
src/views/preparation/preparation/modules/VerifyForm.vue

@@ -0,0 +1,122 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="800"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    class="ant-modal2"
+    @cancel="handleCancel"
+  >
+    <a-form :form="form">
+      <a-form-item v-show="false" >
+        <a-input v-decorator="['id']" type="hidden"/>
+      </a-form-item>
+      <row-list :col="1">
+        <row-item>
+          <a-form-item
+            label="审核"
+            :labelCol="BaseTool.Constant.labelCol2"
+            :wrapperCol="BaseTool.Constant.wrapperCol2"
+          >
+            <a-radio-group v-model="verifyStatus">
+              <a-radio :value="1">通过</a-radio>
+              <a-radio :value="2">拒绝</a-radio>
+              <a-radio :value="3">回退</a-radio>
+            </a-radio-group>
+          </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="['verifyRemark']"/>
+          </a-form-item>
+        </row-item>
+      </row-list>
+    </a-form>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import pick from 'lodash.pick'
+import DictCache from '@/utils/dict'
+import { handleVerifyByDTO } from '@/api/preparation/preparation'
+export default {
+  name: 'VerifyForm',
+  data () {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      visible: false,
+      verifyStatus: 1,
+      // 下拉框map
+      model: null
+    }
+  },
+  components: {
+  },
+  props: {
+  },
+  created () {
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      this.model = record
+      if (record.status === DictCache.VALUE.REPAIR_PREPARATION_STATUS.NOT_ALLOCATED) {
+        this.modalTitle = '申请部门主管审核'
+      } else if (record.status === DictCache.VALUE.REPAIR_PREPARATION_STATUS.APPLY_MANAGER_VERIFY_SUCCESS) {
+        this.modalTitle = '申请部门负责人审核'
+      } else if (record.status === DictCache.VALUE.REPAIR_PREPARATION_STATUS.APPLY_LEADER_VERIFY_SUCCESS) {
+        this.modalTitle = '收件部门负责人审核'
+      } else if (record.status === DictCache.VALUE.REPAIR_PREPARATION_STATUS.FIRST_PROCESSING_VERIFYING) {
+        this.modalTitle = '建筑费用审核'
+      } else if (record.status === DictCache.VALUE.REPAIR_PREPARATION_STATUS.SECOND_PROCESSING_VERIFYING) {
+        this.modalTitle = '验收审核'
+      }
+      const { form: { setFieldsValue } } = this
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign(pick(record, [
+          'id'
+        ])))
+      })
+    },
+    save () {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        // 具体处理
+        values.verifyStatus = this.verifyStatus
+        console.log(values)
+        handleVerifyByDTO(values)
+          .then(() => {
+            this.handleCancel(values)
+          }).catch(() => {
+            this.confirmLoading = false
+          })
+      })
+    },
+    handleCancel (values) {
+      this.visible = false
+      this.confirmLoading = false
+      this.form.resetFields()
+      if (this.BaseTool.Object.isNotBlank(values)) {
+        this.$emit('ok')
+      }
+    }
+
+  }
+}
+</script>