소스 검색

增加扫码

chenyuehu 4 년 전
부모
커밋
9707945695

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

@@ -57,6 +57,16 @@ export function fetchUser (parameter) {
   })
 }
 
+export function fetchWorkUser (parameter) {
+  return axios({
+    url: `/upms/users/work/${parameter.userId}`,
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
 export function queryUser (parameter) {
   return axios({
     url: `/upms/users?${stringify(parameter)}`,
@@ -117,6 +127,14 @@ export function updateUserStatus (parameter) {
   })
 }
 
+export function updateUserWorkFlag (parameter) {
+  return axios({
+    url: `/upms/users/work/${parameter.userId}/${parameter.workFlag}`,
+    method: 'PUT',
+    data: parameter
+  })
+}
+
 export function deleteUsers (parameter) {
   return axios({
     url: `/upms/users`,

+ 6 - 0
src/router/generator-platform-routers.js

@@ -167,6 +167,7 @@ const constantRouterComponents = {
   'RepairCheckForm': () => import('@/views/repair/application-form/RepairCheckForm'),
   // 维修单
   'RepairForm': () => import('@/views/repair/application-form/RepairForm'),
+  'MRepairForm': () => import('@/views/repair/application-form/MyRepairForm'),
   'MyRepairForm': () => import('@/views/repair/form/MyRepairForm'),
   // 验收单
   'RepairCheck': () => import('@/views/repair/check/RepairCheck'),
@@ -315,6 +316,11 @@ export const constantRouterMap = [
         name: 'login',
         component: () => import(/* webpackChunkName: "user" */ '@/views/Login')
       },
+      {
+        path: '/work/scan',
+        name: 'scan',
+        component: () => import(/* webpackChunkName: "user" */ '@/views/Scan')
+      },
       {
         path: 'register',
         name: 'register',

+ 195 - 0
src/views/Scan.vue

@@ -0,0 +1,195 @@
+<template>
+  <div>
+    <div class="fh-login">
+      <h2 style="font-size:30px;text-align: center;color: #fff">CNTHB HITCH ABB</h2>
+      <h2 style="font-size:30px;text-align: center;color: #fff">设备管理系统</h2>
+      <div class="login-title">{{ user.realName }},辛苦了</div>
+      <a-form
+        :label-col="labelCol"
+        :wrapper-col="wrapperCol"
+        id="formLogin"
+        ref="formLogin"
+        :form="form"
+        class="login-form"
+        @submit="handleSubmit">
+        <a-form-item>
+          <a-input
+            size="large"
+            type="password"
+            autocomplete="false"
+            placeholder="请输入密码"
+            class="login-input"
+            max="6"
+            v-decorator="[
+              'password',
+              {rules: [{ required: true, message: '请输入密码' }], validateTrigger: 'blur'}
+            ]"
+          >
+            <a-icon slot="prefix" type="lock" :style="{ color: 'rgba(0,0,0,.25)' }"/>
+          </a-input>
+        </a-form-item>
+        <a-form-item>
+          <a-button class="btn" type="primary" htmlType="submit" :loading="loading">
+            {{ buttonText }}
+          </a-button>
+        </a-form-item>
+      </a-form>
+    </div>
+  </div>
+</template>
+
+<script>
+import { fetchWorkUser, updateUserWorkFlag } from '@/api/upms/user'
+import { encryptPassword } from '@/common/common'
+
+export default {
+  components: {
+
+  },
+  data () {
+    return {
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 5 }
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 12 }
+      },
+      form: this.$form.createForm(this),
+      buttonText: '上班',
+      password: null,
+      loading: false,
+      show: false,
+      user: {
+        realName: ''
+      }
+    }
+  },
+  created () {
+    const url = location.href.split('?')[1] // 获取url中"?"符后的字串
+    const userId = decodeURIComponent(url.split('=')[1])
+    this.init(userId)
+    this.loading = false
+    this.show = false
+  },
+  methods: {
+    init (userId) {
+      fetchWorkUser({ userId: userId }).then(res => {
+        this.user = res.data
+        this.buttonText = this.user.workFlag ? '下班' : '上班'
+      })
+    },
+    handleSubmit (e) {
+      e.preventDefault()
+      const { form: { validateFieldsAndScroll } } = this
+      this.loading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.loading = false
+          return
+        }
+
+        const params = {
+          userId: this.user.userId,
+          workFlag: this.user.workFlag ? 0 : 1,
+          password: values.password ? encryptPassword(values.password) : ''
+        }
+        updateUserWorkFlag(params).then(res => {
+          this.loading = false
+          this.init(this.user.userId)
+          setTimeout(() => {
+            this.$notification.success({
+              message: '操作成功',
+              description: this.user.realName + `,辛苦了`
+            })
+          }, 1000)
+        })
+      })
+    }
+  }
+
+}
+</script>
+
+<style scoped>
+  /*.fh-login {*/
+  /*  !*width: 830px;*!*/
+  /*  height: 435px;*/
+  /*  position: fixed;*/
+  /*  top: 50%;*/
+  /*  left: 50%;*/
+  /*  margin-top: -250px;*/
+  /*  margin-left: -440px;*/
+  /*  !*background: url('~@/assets/logn.png') no-repeat;*!*/
+  /*}*/
+  /*.fh-login .fh-login-left {*/
+  /*  float: left;*/
+  /*  width: 50%;*/
+  /*}*/
+  /*.fh-login .fh-login-left img {*/
+  /*  margin: 132px auto 0;*/
+  /*  display: block;*/
+  /*}*/
+  .fh-login-left h2 {
+    margin-top: 65px;
+    margin-left: 8%;
+    padding-bottom: 20px;
+    color: #ffffff;
+    font-size: 40px;
+    font-weight: 600;
+    text-align: center;
+  }
+ .login-title {
+    font-size: 24px;
+    color: #fff;
+    padding: 15px 0px;
+    /*border-bottom: 1px solid #ccc;*/
+    text-align: center;
+  }
+  .fh-login .btn {
+    display: inline-block;
+    color: #FFF !important;
+    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25) !important;
+    border: 5px solid #FFF;
+    border-radius: 0;
+    box-shadow: none !important;
+    -webkit-transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
+    -o-transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
+    transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
+    cursor: pointer;
+    vertical-align: middle;
+    width: 100%;
+    height: 52px;
+    border: none;
+    /*margin:30px;*/
+    margin-top: 30px;
+    background: rgb(82, 166, 212) !important;
+    color: rgb(255, 255, 255);
+    user-select: none;
+  }
+  .fh-login .login-input{
+    border: none!important;
+    outline: none!important;
+    /*background-color: #fff!important;*/
+    height: 42px!important;
+    width: 100%!important;
+    /*margin-left: 35px;*/
+  }
+  /*设置输入图标大小*/
+  .ant-input-affix-wrapper{
+    font-size: 24px;
+  }
+  .login-form{
+    /*margin-left: 35px;*/
+    /*margin-top: 35px;*/
+    padding: 20px 35px;
+  }
+  /*调整图标位置*/
+  .login-form .ant-input-affix-wrapper .ant-input-prefix {
+    left: 9px !important;
+  }
+  .login-form .ant-input-affix-wrapper .ant-input:not(:first-child){
+    padding-left: 38px;
+  }
+</style>

+ 299 - 0
src/views/repair/application-form/MyRepairForm.vue

@@ -0,0 +1,299 @@
+<template>
+  <a-card :bordered="false">
+    <div v-show="visible">
+      <div class="table-page-search-wrapper">
+        <a-form layout="inline">
+          <a-row :gutter="48">
+            <a-col :md="8" :sm="24">
+              <a-form-item label="关键字">
+                <a-input v-model="queryParam.keyword" placeholder="请输入名称/类型名称"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="8 || 24" :sm="24">
+              <span class="table-page-search-submitButtons">
+                <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
+                <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
+              </span>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+
+      <div class="table-operator">
+<!--        <a-button v-if="$auth('repair-application-forms-add')" type="primary" icon="plus" @click="$refs.baseModal.base({},{filter: -1})">新增</a-button>-->
+        <a-button style="margin-left: 8px" v-if="$auth('repair-application-forms-export')" type="primary" icon="download" @click="doExport">导出</a-button>
+        <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('repair-application-forms-del')">
+          <a-menu slot="overlay">
+            <a-popconfirm title="是否要删除所选数据?" @confirm="batchDelete()">
+              <a-menu-item key="1"><a-icon type="delete" /><a>删除</a></a-menu-item>
+            </a-popconfirm>
+          </a-menu>
+          <a-button style="margin-left: 8px">
+            批量操作 <a-icon type="down" />
+          </a-button>
+        </a-dropdown>
+      </div>
+
+      <s-table
+        ref="table"
+        size="default"
+        rowKey="id"
+        :columns="columns"
+        :data="loadData"
+        :alert="options.alert"
+        :rowSelection="options.rowSelection"
+        showPagination="auto"
+      >
+        <span slot="action" slot-scope="record">
+          <template>
+            <a @click="handleView(record)">查看</a>
+
+            <operation-button
+              v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-edit')"
+              @click="handleEdit(record)" >修改</operation-button>
+            <operation-button
+              v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-del')"
+              :type="2"
+              title="是否要删除该条数据?"
+              @confirm="batchDelete(record.id)">删除</operation-button>
+            <!--<operation-button
+              v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-dispatch')"
+              @click="handleDispatching(record)" >派工</operation-button>-->
+          </template>
+        </span>
+        <span slot="status" slot-scope="text">
+          <badge :text="BaseTool.Object.getField(statusMap,text)" :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_STATUS[text]"/>
+        </span>
+        <span slot="level" slot-scope="text">
+          <badge :text="BaseTool.Object.getField(levelMap,text)" :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_LEVEL[text]"/>
+        </span>
+      </s-table>
+    </div>
+    <base-form ref="baseModal" @ok="handleOk"/>
+    <detail ref="detailModal" @ok="handleOk"/>
+    <dispatch-base-form ref="dispatchBaseForm" @ok="handleOk" />
+  </a-card>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import BaseForm from './modules/BaseForm'
+import Detail from './modules/DetailRepair'
+import { getRepairApplicationFormPage, deleteRepairApplicationForms, fetchRepairApplicationForm, exportRepairApplicationForm } from '@/api/repair/application-form'
+import DispatchBaseForm from '@/views/repair/application-form/modules/DispatchBaseForm'
+
+export default {
+  name: 'MyRepairApplicationFormList',
+  components: {
+    STable,
+    Ellipsis,
+    BaseForm,
+    Detail,
+    DispatchBaseForm
+  },
+  data () {
+    return {
+      // 查询参数
+      queryParam: {
+        filter: 0,
+        searchType: 2
+      },
+      visible: true,
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          checked: true,
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '设备名称',
+          checked: true,
+          dataIndex: 'sbId',
+          customRender: (text, record, index) => {
+            return record.sbName
+          }
+        },
+        {
+          title: '报修人',
+          checked: true,
+          dataIndex: 'userName'
+        },
+        {
+          title: '报修来源',
+          checked: true,
+          dataIndex: 'source',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.sourceMap, text)
+          }
+        },
+        {
+          title: '报修时间',
+          checked: true,
+          dataIndex: 'applyTime'
+        },
+        {
+          title: '紧急等级',
+          checked: true,
+          dataIndex: 'level',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.levelMap, text)
+          }
+        },
+        {
+          title: '是否停机',
+          checked: true,
+          dataIndex: 'needStop',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.needStopMap,text)
+          }
+        },
+        {
+          title: '报修状态',
+          checked: true,
+          dataIndex: 'status',
+          scopedSlots: { customRender: 'status' }
+        },
+
+        {
+          title: '创建日期',
+          dataIndex: 'createdTime'
+        },
+        {
+          title: '操作',
+          checked: true,
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 下拉框map
+      sourceMap: {},
+      levelMap: {},
+      statusMap: {},
+      needStopMap: {},
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'update_time'
+          }
+        }
+        return getRepairApplicationFormPage(Object.assign(parameter, this.queryParam))
+          .then(res => {
+            return res.data
+          })
+      },
+      selectedRowKeys: [],
+      selectedRows: [],
+
+      options: {
+        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys,
+          onChange: this.onSelectChange
+        }
+      },
+      optionAlertShow: false
+    }
+  },
+  created () {
+    // 下拉框map
+    this.sourceMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_SOURCE)
+    this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_LEVEL)
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS)
+    this.needStopMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
+
+    this.tableOption()
+  },
+  methods: {
+    tableOption () {
+      if (!this.optionAlertShow) {
+        this.options = {
+          alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+          rowSelection: {
+            selectedRowKeys: this.selectedRowKeys,
+            onChange: this.onSelectChange,
+            getCheckboxProps: record => ({
+              props: {
+                disabled: false,
+                name: record.id
+              }
+            })
+          }
+        }
+        this.optionAlertShow = true
+      } else {
+        this.options = {
+          alert: false,
+          rowSelection: null
+        }
+        this.optionAlertShow = false
+      }
+    },
+    batchDelete (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]
+      }
+      deleteRepairApplicationForms(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleEdit (record) {
+      fetchRepairApplicationForm({ id: record.id }).then(res => {
+        const modal = this.$refs.baseModal
+        modal.base(res.data)
+      })
+    },
+    handleView (record) {
+      fetchRepairApplicationForm({ id: record.id }).then(res => {
+        this.visible = false
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+    handleOk () {
+      this.visible = true
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm () {
+      this.queryParam = {
+      }
+      this.$refs.table.refresh(true)
+    },
+    doExport () {
+      const parameter = {
+        ...this.queryParam
+      }
+      exportRepairApplicationForm(parameter).then(file => {
+        this.BaseTool.UPLOAD.downLoadExportExcel(file)
+      })
+    },
+    handleDispatching (record) {
+      const modal = this.$refs.dispatchBaseForm
+      modal.base(record)
+    }
+  }
+}
+</script>

+ 17 - 8
src/views/repair/application-form/RepairForm.vue

@@ -47,18 +47,20 @@
         <span slot="action" slot-scope="record">
           <template>
             <a @click="handleView(record)">查看</a>
-
             <operation-button
               v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-edit')"
               @click="handleEdit(record)" >修改</operation-button>
-            <operation-button
-              v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-del')"
-              :type="2"
-              title="是否要删除该条数据?"
-              @confirm="batchDelete(record.id)">删除</operation-button>
+<!--            <operation-button-->
+<!--              v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-del')"-->
+<!--              :type="2"-->
+<!--              title="是否要删除该条数据?"-->
+<!--              @confirm="batchDelete(record.id)">删除</operation-button>-->
             <!--<operation-button
               v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-dispatch')"
               @click="handleDispatching(record)" >派工</operation-button>-->
+             <operation-button
+               v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-edit')"
+               @click="handleAssign(record)" >派工</operation-button>
           </template>
         </span>
         <span slot="status" slot-scope="text">
@@ -71,6 +73,7 @@
     </div>
     <base-form ref="baseModal" @ok="handleOk"/>
     <detail ref="detailModal" @ok="handleOk"/>
+    <assign-form ref="assignForm" @ok="handleOk" />
     <dispatch-base-form ref="dispatchBaseForm" @ok="handleOk" />
   </a-card>
 </template>
@@ -78,6 +81,7 @@
 <script>
 import { STable, Ellipsis } from '@/components'
 import BaseForm from './modules/BaseForm'
+import AssignForm from './modules/AssignForm'
 import Detail from './modules/DetailRepair'
 import { getRepairApplicationFormPage, deleteRepairApplicationForms, fetchRepairApplicationForm, exportRepairApplicationForm } from '@/api/repair/application-form'
 import DispatchBaseForm from '@/views/repair/application-form/modules/DispatchBaseForm'
@@ -88,6 +92,7 @@ export default {
     STable,
     Ellipsis,
     BaseForm,
+    AssignForm,
     Detail,
     DispatchBaseForm
   },
@@ -95,7 +100,7 @@ export default {
     return {
       // 查询参数
       queryParam: {
-        filter: 0,
+        filter: -1,
         searchType: 2
       },
       visible: true,
@@ -148,7 +153,7 @@ export default {
           checked: true,
           dataIndex: 'needStop',
           customRender: (text, record, index) => {
-            return this.BaseTool.Object.getField(this.needStopMap,text)
+            return this.BaseTool.Object.getField(this.needStopMap, text)
           }
         },
         {
@@ -269,6 +274,10 @@ export default {
         modal.base(res.data)
       })
     },
+    handleAssign (record) {
+      const modal = this.$refs.assignForm
+      modal.base(record)
+    },
     handleOk () {
       this.visible = true
       this.$refs.table.refresh()

+ 126 - 0
src/views/repair/application-form/modules/AssignForm.vue

@@ -0,0 +1,126 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="800"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    @cancel="handleCancel"
+  >
+    <a-form :form="form">
+      <row-list :col="2">
+        <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="item in deptUserList"
+                :key="item.userId"
+                :label="item.realName"
+                :value="item.userId">{{ item.realName }}
+              </a-select-option>
+            </a-select>
+          </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="['repairDispatchRemark']"/>
+          </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 { dispatchModelByDTO } from '@/api/repair/application-form'
+import { queryUserDept } from '@/api/upms/user-dept'
+import { queryUser } from '@/api/upms/user'
+
+export default {
+  name: 'DispatchBaseForm',
+  data () {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      visible: false,
+      // 下拉框map
+      sourceMap: {},
+      levelMap: {},
+      statusMap: {},
+      record: {},
+      userList: [],
+      deptUserList: []
+    }
+  },
+  props: {
+  },
+  created () {
+    // 下拉框map
+    this.sourceMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_SOURCE)
+    this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_LEVEL)
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS)
+    this.getUsers()
+    this.getDeptUsers()
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      // 如果是空标识添加
+      this.modalTitle = '派工'
+      this.record = record
+    },
+    getDeptUsers () {
+      queryUserDept({ deptCode: this.DictCache.VALUE.SYS_DEPT_CODE.XIAN_CHANG_WEI_XIU_ZU, userStatus: 1 }).then(res => {
+        queryUserDept({ deptCode: this.DictCache.VALUE.SYS_DEPT_CODE.CHANG_NEI_WEI_XIU_ZU, userStatus: 1 }).then(res2 => {
+          this.deptUserList = res.data.concat(res2.data)
+        })
+      })
+    },
+    getUsers () {
+      queryUser({ status: 1 }).then(res => {
+        this.userList = res.data
+      })
+    },
+    save () {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        values.id = this.record.id
+        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>

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

@@ -1,13 +1,18 @@
 <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-assign') && (DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.UN_ALLOCATED === model.status)" style="margin-left: 8px" type="primary" @click="handleAssgin">分配</a-button>
+          <a-popconfirm v-if="$auth('repair-application-forms-deal') && (DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.ALLOCATED === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)" title="是否要接收?" @confirm="receive">
+            <a-button>接收</a-button>
+          </a-popconfirm>
+          <a-button v-if="$auth('repair-application-forms-dispatch') && (DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.ALLOCATED === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)" style="margin-left: 8px" type="primary" @click="handleDispatch">转派</a-button>
+          <a-button v-if="$auth('repair-application-forms-finish') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status" style="margin-left: 8px" type="primary" @click="handleFinish()">维修完成</a-button>
+          <!--          <a-button v-if="$auth('repair-application-forms-finish') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status" style="margin-left: 8px" type="primary" @click="handleSparePick">领用备件</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 +36,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>
@@ -306,12 +311,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

+ 9 - 1
src/views/repair/application-form/modules/DetailRepair.vue

@@ -3,7 +3,8 @@
     <a-row :gutter="48" slot="extra">
       <a-col :md="48" :sm="48">
         <span class="table-page-search-submitButtons" style="float: right">
-          <a-popconfirm v-if="$auth('repair-application-forms-deal') && (DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.ALLOCATED === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)" title="是否要接收?" @confirm="receive">
+          <a-button v-if="$auth('repair-application-forms-assign') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === model.status" type="primary" @click="handleAssign">派工</a-button>
+          <a-popconfirm v-if="$auth('repair-application-forms-deal') && (DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)" title="是否要接收?" @confirm="receive">
             <a-button>接收</a-button>
           </a-popconfirm>
           <a-button v-if="$auth('repair-application-forms-dispatch') && (DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.ALLOCATED === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)" style="margin-left: 8px" type="primary" @click="handleDispatch">转派</a-button>
@@ -132,6 +133,7 @@
     <check-form ref="checkForm" @ok="handleOk" />
     <finish-form ref="finishForm" @ok="handleOk" />
     <dispatch-form ref="dispatchForm" @ok="handleCancel" />
+    <assign-form ref="assignForm" @ok="handleCancel" />
     <spare-pick-base-form ref="baseModal" @ok="handleOk"/>
     <repair-project-select-Modal :type="'checkbox'" ref="repairProjectSelectModal" @selected="handleRepairProjectSelected"/>
     <!--    <spare-part-info-select-modal :type="'checkbox'" ref="spareSelectModal" @selected="handleSpareSelected"/>-->
@@ -146,6 +148,7 @@ import { fetchRepairApplicationForm, approve, receive } from '@/api/repair/appli
 import CheckForm from './CheckForm'
 import FinishForm from './FinishForm'
 import DispatchForm from './DispatchForm'
+import AssignForm from './AssignForm'
 import SparePickBaseForm from '../../../store/sparepickform/modules/BaseForm'
 import SparePartUsedSelectTable from '@/views/sqarepartmanage/sparepartused/modules/SparePartUsedSelectTable'
 import SparePickFormSelectTable from '@/views/store/sparepickform/modules/SparePickFormSelectTable'
@@ -167,6 +170,7 @@ export default {
     DetailListItem,
     FinishForm,
     DispatchForm,
+    AssignForm,
     SparePickBaseForm,
     SparePartUsedSelectTable,
     SparePickFormSelectTable,
@@ -377,6 +381,10 @@ export default {
       const modal = this.$refs.dispatchForm
       modal.base(this.model)
     },
+    handleAssign () {
+      const modal = this.$refs.assignForm
+      modal.base(this.model)
+    },
     handleSparePick () {
       const modal = this.$refs.baseModal
       modal.base(null, { repairId: this.model.id, repairNo: this.model.no, reason: '维修领用' })