| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060 |
- <template>
- <div style="margin: 0 10px !important">
- <el-form
- ref="ruleForm"
- :model="ruleForm"
- :rules="rules"
- label-width="120px"
- >
- <el-row :gutter="24">
- <el-row>
- <el-col :span="12">
- <el-form-item label="工号搜索">
- <el-input
- v-model="usercodeSearch"
- placeholder="请输入工号"
- @blur="getUserData"
- />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="申请科室" prop="repairDeptid">
- <select-dept-tree
- :isdisabled="true"
- :deptparam="deptidArr"
- @post-deptid="getDeptid"
- />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="科室电话" prop="DeptPhone">
- <el-input
- v-model="ruleForm.DeptPhone"
- placeholder="请输入科室电话"
- />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="申请人" prop="repairmanid">
- <el-select
- :disabled="true"
- v-model="ruleForm.repairmanid"
- clearable
- filterable
- placeholder="请选择申请人"
- style="width: 100%"
- @change="changeRepairman"
- >
- <el-option
- v-for="item in repairman"
- :key="item.usercode"
- :label="item.username"
- :value="item.usercode"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="申请电话" prop="repairmanphone">
- <el-input
- v-model="ruleForm.repairmanphone"
- placeholder="请输入申请电话"
- />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="联系电话" prop="repairmanCallNumber">
- <el-input
- v-model="ruleForm.repairmanCallNumber"
- placeholder="请输入联系电话"
- />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="科室位置" prop="repairAddress">
- <el-input
- v-model="ruleForm.repairAddress"
- placeholder="请输入科室位置"
- />
- </el-form-item>
- </el-col>
- </el-row>
- <!-- <el-row></el-row> -->
- <el-row v-if="worktypeInfo === 'gzbx_shebei'">
- <el-col :span="24">
- <el-form-item label="设备资产编码" prop="F_DeviceEncode">
- <el-input
- v-model="ruleForm.F_DeviceEncode"
- placeholder="请输入设备资产编码"
- />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="24">
- <el-form-item label="报修内容" prop="repairCenter">
- <el-input
- v-model="ruleForm.repairCenter"
- :autosize="{ minRows: 4, maxRows: 8 }"
- show-word-limit
- maxlength="100"
- type="textarea"
- placeholder="请详细描述具体故障位置或者床号及故障详细描述"
- />
- </el-form-item>
- </el-col>
- </el-row>
- <!-- <el-row>
- <el-col :span="24">
- <el-form-item label="报修地点" prop="repairAddress">
- <el-input
- v-model="ruleForm.repairAddress"
- placeholder="请输入报修地点"
- />
- </el-form-item>
- </el-col>
- </el-row> -->
- <el-row v-if="iswomanage != 1">
- <el-col :span="12">
- <el-form-item label="指派科室" prop="assignDepart">
- <select-dept-tree
- :deptparam="assignArr"
- @post-deptid="geAssigntDeptid"
- />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="指派人" prop="assignMant">
- <el-select
- v-model="ruleForm.assignMant"
- clearable
- filterable
- placeholder="请选择指派人"
- style="width: 100%"
- @change="changeUser"
- >
- <el-option
- v-for="item in assignman"
- :key="item.usercode"
- :label="item.username + '(' + item.count + ')'"
- :value="item.usercode"
- />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="24">
- <el-form-item label="附件图片" prop="repairImageid">
- <el-upload
- :before-upload="beforeUpload"
- :headers="headers"
- :file-list="fileList"
- :on-remove="handle_remove"
- :on-success="handle_success"
- :action="imgUrl"
- list-type="picture-card"
- accept=".mp4, .jpg, .jpeg, .png"
- >
- <i class="el-icon-plus" />
- </el-upload>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="紧急情况" prop="EmergencyTypes">
- <el-radio-group v-model="ruleForm.EmergencyTypes">
- <el-radio label="一般">一般</el-radio>
- <el-radio label="紧急">紧急</el-radio>
- </el-radio-group>
- </el-form-item>
- </el-col>
- </el-row>
- <el-form-item>
- <el-button
- type="primary"
- @click="submitForm('ruleForm')"
- >提交工单</el-button
- >
- </el-form-item>
- </el-row>
- </el-form>
- <!-- //24小时历史工单 -->
- <p v-if="isAddorder == true" style="margin: 20px 0 10px 0">
- <span class="msgbox"/><span
- style="line-height: 30px; font-size: 14px; color: #333"
- >历史工单</span
- >
- </p>
- <el-table
- v-if="isAddorder == true"
- ref="multipleTable"
- :data="dataLists"
- border
- stripe
- >
- <el-table-column
- prop="F_WoCode"
- label="工单编号"
- align="center"
- min-width="110"
- >
- <template slot-scope="scope">
- <span
- style="color: #409eff; cursor: pointer"
- @click="hadndleOrderCode(scope.row)"
- >{{ scope.row.F_WoCode }}</span
- >
- <el-tag
- v-if="scope.row.F_UrgeCount > 0"
- type="success"
- >催{{ scope.row.F_UrgeCount }}</el-tag
- >
- </template>
- </el-table-column>
- <el-table-column
- prop="F_ProposerName"
- label="申请人"
- align="center"
- min-width
- />
- <el-table-column
- :formatter="formtOrder"
- prop="F_SonType"
- label="工单类别"
- align="center"
- min-width
- />
- <el-table-column
- prop="F_Content"
- label="工单内容"
- align="center"
- min-width
- />
- <el-table-column
- prop="StateName"
- label="工单状态"
- align="center"
- min-width
- />
- <el-table-column
- prop="F_CreateTime"
- label="创建时间"
- align="center"
- min-width
- />
- </el-table>
- <pagination
- v-if="isAddorder == true"
- v-show="pageParams.total > 0"
- :total="pageParams.total"
- :pageindex.sync="pageParams.pageindex"
- :pagesize.sync="pageParams.pagesize"
- class="pagination"
- @pagination="getList"
- />
- </div>
- </template>
- <script>
- import selectDeptTree from '@/components/context/commonSelect/selectDeptTree.vue'
- import selectOrderTypeTwo from '@/components/context/commonSelect/selectOrderTypeTwo.vue'
- import { GetPerson, getClassByDeptId, GetUsersByDeptId } from '@/api/commonAPI'
- import { getUserMsg } from '@/api/orderManagement/orderList'
- import {
- GetFaultRepairDetail,
- UpdateFaultRepair
- } from '@/api/orderManagement/orderList'
- import { getAddRepairbase } from '@/api/faultRepairManagement/faultRepair'
- import { getTypeDetail } from '@/api/systemSetup/roleSetting/department'
- import { Send, ws } from '../../../utils/telWebsocket.js'
- import { mapGetters } from 'vuex'
- import Pagination from '@/components/context/Pagination' // 对el-pagination 二次封装
- import detail from '../../../views/orderManage/components/orderDetail.vue'
- import { comOrderList } from '@/api/orderManagement/orderList'
- import { encrypt, decrypt } from '@/utils/secretKey'
- export default {
- name: 'AddRepairbase',
- components: {
- Pagination,
- selectDeptTree,
- selectOrderTypeTwo
- },
- props: {
- wid: {
- type: String,
- default: ''
- },
- fid: {
- type: String,
- default: ''
- },
- layerid: {
- type: String,
- default: ''
- },
- callid: {
- type: String,
- default: ''
- },
- iswomanage: {
- type: String,
- default: ''
- },
- orderTypeData: {
- type: Object,
- default() {
- return {}
- }
- }
- },
- data() {
- return {
- isAddorder: false,
- pageParams: {
- pageindex: 1, // 当前第几页
- pagesize: Number(this.$store.getters.serverConfig.PAGESIZE), // 每页几条数据
- total: 0 // 总共多少数据
- },
- dataLists: [],
- secondOrderType: {
- typeid: 2,
- pid: 3000
- },
- deptMents: this.$store.getters.deptmap,
- worktypeInfo: '',
- cid: '',
- usercodeSearch: '',
- orderarr: [],
- isedit: false,
- ordertypeArr: [],
- imgUrl:
- this.$store.getters.serverConfig.BASE_API +
- 'FaultRepair/UploadFile?token=' +
- localStorage.getItem('Admin-Token'),
- fileList: [],
- repairman: [], // 申请人数据
- deptidArr: [], // 申请部门默认值
- assignman: [], // 指派人
- assignArr: [], // 默认指派部门
- autodeptid: '',
- ruleForm: {
- repairDeptid: '', // 申请部门
- repairmanid: '', // 申请人
- repairmanphone: '', // 申请电话
- DeptPhone: '',
- repairmanCallNumber: '', // 联系电话
- repairOrderType: [], // 工单类别
- F_Type2: '',
- repairCenter: '', // 报修内容
- repairAddress: '', // 报修地点
- repairImageid: '', // 附件
- repairOper: '0', // 下不流程
- EmergencyTypes: '一般',
- assignDepart: '', // 指派部门
- assignMant: '' // 指派人
- },
- headers: {
- Authorization: 'Bearer ' + localStorage.getItem('Admin-Token')
- },
- imageUrl: 'http://192.168.1.37:8000/FaultRepair/UploadFile',
- rules: {
- repairmanphone: [
- {
- required: true,
- message: '申请电话不能为空',
- trigger: 'blur'
- }
- // {
- // pattern: /^((0\d{2,3}-\d{5,8})|(1[345789]\d{9}))$/,
- // message: '请输入正确的电话号码或者固话号码',
- // trigger: 'blur'
- // }
- ],
- repairDeptid: [
- {
- required: true,
- message: '请选择申请部门',
- trigger: 'change'
- }
- ],
- repairmanid: [
- {
- required: true,
- message: '请选择申请人',
- trigger: 'change'
- }
- ],
- repairmanCallNumber: [
- {
- required: true,
- message: '请输入联系电话',
- trigger: 'blur'
- }
- ],
- repairOrderType: [
- {
- required: true,
- message: '请选择工单类别',
- trigger: 'change'
- }
- ],
- repairCenter: [
- {
- required: true,
- message: '请详细描述具体故障位置或者床号及故障详细描述',
- trigger: 'blur'
- }
- ],
- // F_DeviceEncode: [{
- // required: true,
- // message: '请输入设备资产编码',
- // trigger: 'blur'
- // }],
- repairAddress: [
- {
- required: true,
- message: '请输入科室位置',
- trigger: 'blur'
- }
- ]
- }
- }
- },
- watch: {
- 'orderTypeData.F_Type2': function() {
- this.ruleForm.repairOrderType = this.orderTypeData.F_Type2
- console.log(this.ruleForm.repairOrderType)
- this.worktypeInfo =
- this.$store.getters.workTypeMap[
- parseInt(this.orderTypeData.type2Arr[0])
- ].tag
- this.getList() // 24小时工单
- // this.autodeptid = this.$store.getters.workTypeMap[parseInt(this.ruleForm.repairOrderType)].autoDept
- // 默认
- if (this.orderTypeData.F_Type2) {
- this.getAuto()
- }
- // console.log(this.ruleForm.repairOrderType,this.worktypeInfo,this.autodeptid)
- // if(this.worktypeInfo != 'gzbx_jjhq'){
- // this.ruleForm.assignDepart = this.$store.getters.workTypeMap[parseInt(this.ruleForm.repairOrderType)].autoDept
- // this.assignArr = this.$store.getters.deptmap[parseInt(this.autodeptid)].ids
- // this.getClassUser()
- // }
- // if((this.worktypeInfo == 'gzbx_jjhq' && this.deptidArr[0] != '1') && (this.worktypeInfo == 'gzbx_jjhq' && this.deptidArr[0] != '4005')){//基建类申请人不是总院
- // console.log(123123);
- // if(this.deptidArr[0] == '2'){//2分院3西院4004东院区4006南院区4008北院区
- // this.getDeptByCode(this.deptMents,'fenyuanqu')
- // }
- // if(this.deptidArr[0] == '3'){//2分院3西院
- // this.getDeptByCode(this.deptMents,'xiyuanqu')
- // }
- // if(this.deptidArr[0] == '4004'){//4004东院区
- // this.getDeptByCode(this.deptMents,'JJHQ_DYQBZZ')
- // }
- // if(this.deptidArr[0] == '4006'){//4006南院区
- // this.getDeptByCode(this.deptMents,'JJHQ_NYQBZZ')
- // }
- // if(this.deptidArr[0] == '4008'){//4008北院区
- // this.getDeptByCode(this.deptMents,'JJHQ_BYQBZZ')
- // }
- // }else{
- // console.log(1333333123);
- // this.ruleForm.assignDepart = this.$store.getters.workTypeMap[parseInt(this.ruleForm.repairOrderType)].autoDept
- // this.assignArr = this.$store.getters.deptmap[parseInt(this.autodeptid)].ids
- // this.getClassUser()
- // }
- }
- // 'deptidArr':function(){
- // if((this.worktypeInfo == 'gzbx_jjhq' && this.deptidArr[0] != '1') && (this.worktypeInfo == 'gzbx_jjhq' && this.deptidArr[0] != '4005')){//基建类申请人不是总院
- // if(this.deptidArr[0] == '2'){//2分院3西院
- // this.getDeptByCode(this.deptMents,'fenyuanqu')
- // }
- // if(this.deptidArr[0] == '3'){//2分院3西院
- // this.getDeptByCode(this.deptMents,'xiyuanqu')
- // }
- // if(this.deptidArr[0] == '4004'){//4004东院区
- // this.getDeptByCode(this.deptMents,'JJHQ_DYQBZZ')
- // }
- // if(this.deptidArr[0] == '4006'){//4006南院区
- // this.getDeptByCode(this.deptMents,'JJHQ_NYQBZZ')
- // }
- // if(this.deptidArr[0] == '4008'){//4008北院区
- // this.getDeptByCode(this.deptMents,'JJHQ_BYQBZZ')
- // }
- // }else{
- // // console.log(this.$store.getters.deptmap[parseInt(this.autodeptid)].ids,'9999')
- // this.assignArr = this.$store.getters.deptmap[parseInt(this.autodeptid)].ids
- // this.ruleForm.assignDepart = this.$store.getters.workTypeMap[parseInt(this.ruleForm.repairOrderType)].autoDept
- // this.getClassUser()
- // }
- // }
- },
- computed: {
- ...mapGetters([
- 'telTopRightState' // 状态信息
- ])
- },
- created() {
- if (window.location.href.indexOf('addWorkOrder') >= 0) {
- this.isAddorder = true
- } else {
- this.isAddorder = false
- }
- this.cid = this.callid
- if (!this.cid) {
- this.cid = window.localStorage.getItem('callidSave')
- }
- if (this.wid) {
- this.getWoDetail(this.wid, '0')
- }
- if (this.iswomanage === '1') {
- this.usercodeSearch = window.localStorage.getItem('storageUsercode')
- const deptid = this.$store.getters.teamId
- this.deptidArr = this.$store.getters.deptmap[parseInt(deptid)].ids
- this.ruleForm.repairDeptid = deptid
- this.getRepairman(deptid, 0)
- this.getDeptAddress(deptid)
- this.ruleForm.repairmanid = this.$store.getters.usercode
- this.ruleForm.repairmanphone = decrypt(localStorage.getItem('storageUserphoneShow'))
- this.ruleForm.repairmanCallNumber = this.ruleForm.repairmanphone
- this.ruleForm.repairAddress = this.$store.getters.location
- }
- },
- methods: {
- getAuto() {
- this.assignArr = []
- this.assignman = []
- this.ruleForm.assignDepart = ''
- this.ruleForm.assignMant = ''
- if (this.$store.getters.workTypeMap[parseInt(this.orderTypeData.F_Type2)]) {
- const autoData = JSON.parse(
- this.$store.getters.workTypeMap[parseInt(this.orderTypeData.F_Type2)]
- .autoDept || '[]'
- )
- const applyHos = this.deptidArr[0]
- console.log(autoData, applyHos)
- if (!autoData) {
- return
- }
- var hosall = []
- for (var i = 0; i < autoData.length; i++) {
- hosall.push(autoData[i].autoyq)
- }
- for (var i = 0; i < autoData.length; i++) {
- if (autoData[i].autoyq == applyHos) {
- // 有院区
- this.assignArr =
- this.$store.getters.deptmap[parseInt(autoData[i].autodept)].ids
- this.ruleForm.assignDepart = autoData[i].autodept
- this.getClassUserArr(autoData[i].autodept)
- this.ruleForm.assignMant = autoData[i].autousercode
- } else if (autoData[i].autoyq == '0' && hosall.indexOf(applyHos) < 0) {
- // 全部
- this.assignArr =
- this.$store.getters.deptmap[parseInt(autoData[i].autodept)].ids
- this.ruleForm.assignDepart = autoData[i].autodept
- this.getClassUserArr(autoData[i].autodept)
- this.ruleForm.assignMant = autoData[i].autousercode
- }
- }
- }
- },
- getUserData() {
- if (!this.usercodeSearch) {
- return
- }
- const params = {
- usercode: this.usercodeSearch
- }
- getUserMsg(params).then((res) => {
- const data = res.data
- this.ruleForm.repairDeptid = data.F_DeptId
- this.deptidArr =
- this.$store.getters.deptmap[parseInt(data.F_DeptId)].ids
- this.getRepairman(data.F_DeptId, 0)
- this.getDeptAddress(data.F_DeptId)
- this.ruleForm.repairmanid = data.F_UserCode
- this.ruleForm.repairmanphone = data.F_Telephone ? decrypt(data.F_TelephoneShow) : ''
- this.ruleForm.repairmanCallNumber = data.F_Telephone ? decrypt(data.F_TelephoneShow) : ''
- this.ruleForm.repairAddress = data.F_Location
- this.getAuto()
- })
- },
- // 部门
- getDeptid(data) {
- this.ruleForm.repairDeptid = data[data.length - 1]
- this.deptidArr = data
- this.ruleForm.repairmanid = ''
- this.getRepairman(this.ruleForm.repairDeptid, 0)
- this.getDeptAddress(data[data.length - 1])
- this.getAuto()
- this.getList()
- },
- geAssigntDeptid(data) {
- this.ruleForm.assignDepart = data[data.length - 1]
- this.getClassUserArr(data[data.length - 1])
- },
- getDeptAddress(id) {
- getTypeDetail(id).then((res) => {
- this.ruleForm.repairAddress = res.data.F_Location ? decrypt(res.data.F_LocationShow) : ''
- this.ruleForm.DeptPhone = res.data.F_OfficeTelephone ? decrypt(res.data.F_OfficeTelephoneShow) : ''
- })
- },
- getClassUserArr(id) {
- if (!id) return
- const params = {
- deptid: id
- }
- this.assignman = []
- this.ruleForm.assignMant = ''
- if (id) {
- getClassByDeptId(params).then((res) => {
- this.assignman = res.rows
- })
- }
- },
- // 获取申请人数据
- getRepairman(id, state) {
- return new Promise((resolve) => {
- const params = {
- deptid: id // 字典管理的工单标识
- }
- GetUsersByDeptId(params).then((res) => {
- if (res.state == 'error') {
- this.$message.warning(res.message)
- }
- if (state === 0) {
- this.repairman = res.rows
- } else if (state === 1) {
- this.assignman = res.rows
- }
- })
- resolve()
- })
- },
- // 申请人
- changeRepairman(data) {
- this.ruleForm.repairmanid = data
- const user = this.repairman.find((o) => {
- return o.usercode === data.toString()
- })
- if (user) {
- this.ruleForm.repairmanphone = user.usertelphone
- this.ruleForm.repairmanCallNumber = user.usertelphone
- }
- },
- changeUser(data) {
- // 指派人
- this.ruleForm.assignMant = data
- },
- // 详情
- getWoDetail(rid, type) {
- const params = {
- WorkOrderCode: rid,
- type: type
- }
- GetFaultRepairDetail(params).then((response) => {
- if (response.data[0]) {
- this.deptidArr =
- this.$store.getters.deptmap[
- parseInt(response.data[0].F_ApplicationDept)
- ].ids
- console.log(this.deptidArr, '666')
- if (response.data[0].F_MaintenanceDept) {
- this.assignArr =
- this.$store.getters.deptmap[
- parseInt(response.data[0].F_MaintenanceDept)
- ].ids
- }
- console.log(1222)
- this.getRepairman(response.data[0].F_ApplicationDept)
- this.getDeptAddress(response.data[0].F_ApplicationDept)
- this.ruleForm.repairmanid = response.data[0].F_Applicant
- this.ruleForm.repairmanphone = decrypt(response.data[0].F_ApplicantsphoneShow)
- this.ruleForm.repairmanCallNumber = decrypt(response.data[0].F_PhoneShow)
- this.ruleForm.F_Type2 = response.data[0].F_WorkOrderCategory
- this.isedit = true
- this.ruleForm.repairOrderType =
- this.$store.getters.workTypeMap[
- parseInt(response.data[0].F_WorkOrderCategory)
- ].ids // 工单类别
- console.log(this.ruleForm.repairOrderType)
- this.ruleForm.repairOrderType = this.ruleForm.repairOrderType.slice(
- 1,
- this.ruleForm.repairOrderType.length
- )
- console.log(this.ruleForm.repairOrderType)
- this.ruleForm.repairDeptid = response.data[0].F_ApplicationDept // 部门
- this.ruleForm.repairCenter = response.data[0].F_Content
- this.ruleForm.repairAddress = response.data[0].F_PlaceOfRepair
- this.ruleForm.assignDepart = response.data[0].F_MaintenanceDept
- this.ruleForm.assignMant = response.data[0].F_Maintenancer
- this.usercodeSearch = response.data[0].F_Applicant
- this.ruleForm.EmergencyTypes = response.data[0].F_EmergencyTypes
- if (response.data[0].FileUrl) {
- // this.imgUrl = response.data[0].FileUrl[0].F_FileUrl
- for (var i = 0; i < response.data[0].FileUrl.length; i++) {
- this.ruleForm.repairImageid +=
- response.data[0].FileUrl[i].F_FileId + ','
- this.fileList.push({
- F_FileId: response.data[0].FileUrl[i].F_FileId,
- name: response.data[0].FileUrl[i].F_FileName,
- url: response.data[0].FileUrl[i].F_FileUrl
- })
- }
- }
- }
- })
- },
- // 工单类型
- getSecondOOrderType(data) {
- this.ruleForm.assignDepart = ''
- this.assignArr = []
- this.ruleForm.repairOrderType = data.value
- console.log(this.ruleForm.repairOrderType)
- this.autodeptid =
- this.$store.getters.workTypeMap[
- parseInt(this.ruleForm.repairOrderType)
- ].autoDept
- this.ruleForm.assignDepart =
- this.$store.getters.workTypeMap[
- parseInt(this.ruleForm.repairOrderType)
- ].autoDept
- this.assignArr =
- this.$store.getters.deptmap[parseInt(this.autodeptid)].ids
- console.log(this.autodeptid, '7788')
- this.getClassUser()
- },
- getgzbxClassUser(id) {
- const params = {
- deptid: id
- }
- this.assignman = []
- this.ruleForm.assignMant = ''
- if (id) {
- getClassByDeptId(params).then((res) => {
- this.assignman = res.rows
- })
- }
- },
- getClassUser() {
- const params = {
- deptid: this.autodeptid
- }
- this.assignman = []
- this.ruleForm.assignMant = ''
- if (this.autodeptid) {
- getClassByDeptId(params).then((res) => {
- this.assignman = res.rows
- })
- }
- },
- beforeUpload(file) {
- const FILE_NAME = file.name
- if (FILE_NAME.substring(FILE_NAME.lastIndexOf('.')) !== '.mp4' && FILE_NAME.substring(FILE_NAME.lastIndexOf('.')) !== '.jpg' && FILE_NAME.substring(FILE_NAME.lastIndexOf('.')) !== '.jpeg' && FILE_NAME.substring(FILE_NAME.lastIndexOf('.')) !== '.png') {
- this.$message.warning('仅支持.mp4,.jpg,.jpeg,.png文件')
- return false
- }
- const isLt1M = file.size / 1024 / 1024 < 20
- if (isLt1M) {
- this.file = file
- return true
- }
- this.$message.warning('请上传不超过20M的文件.')
- return false
- },
- handle_success(res) {
- this.ruleForm.repairImageid += res.data[0].F_FileId + ','
- },
- handle_remove(res) {
- if (res.F_FileId) {
- var oldstr = res.F_FileId + ','
- }
- if (res.response) {
- var str = res.response.data[0].F_FileId + ','
- }
- if (oldstr) {
- this.ruleForm.repairImageid = this.ruleForm.repairImageid.replace(
- oldstr,
- ''
- )
- }
- if (str) {
- this.ruleForm.repairImageid = this.ruleForm.repairImageid.replace(
- str,
- ''
- )
- }
- },
- submitForm(formName) {
- if (this.telTopRightState == '通话中') {
- if (window.location.href.indexOf('callScreen') >= 0) {
- this.$message('请挂断后再提交工单')
- return
- }
- }
- if (this.orderTypeData.type2Arr.length == 0) {
- this.$message.error('请选择工单类别')
- return
- }
- var resTypeArr = this.$store.getters.workTypeMap[parseInt(this.orderTypeData.type2Arr[this.orderTypeData.type2Arr.length - 1])].ids
- if(resTypeArr[0] != 3000){
- this.$message.error('业务类别与工单类别不匹配,请重新选择')
- return
- }
- // console.log(resTypeArr)
- // return
- this.$refs[formName].validate((valid) => {
- if (valid) {
- if (this.ruleForm.repairImageid === '') {
- this.ruleForm.repairImageid = ''
- } else {
- this.ruleForm.repairImageid = this.ruleForm.repairImageid.slice(
- 0,
- this.ruleForm.repairImageid.length - 1
- )
- }
- if (this.iswomanage == 1) {
- this.ruleForm.assignDepart = ''
- this.ruleForm.assignMant = ''
- }
- this.$refs.ruleForm.validate((valid) => {
- if (valid) {
- if (this.wid) {
- // 编辑
- if (this.ruleForm.F_Type2) {
- this.ruleForm.repairOrderType = this.ruleForm.F_Type2
- }
- const params = {
- WorkOrderCode: this.wid,
- Applicant: this.ruleForm.repairmanid, // 申请人
- ApplicationDept: this.ruleForm.repairDeptid, // 申请部门
- Applicantsphone: this.ruleForm.repairmanphone, // 申请电话
- Phone: this.ruleForm.repairmanCallNumber, // 联系方式
- DeptPhone: this.ruleForm.DeptPhone,
- WorkOrderCategory: this.ruleForm.repairOrderType, // 工单类别
- Content: this.ruleForm.repairCenter, // 工单内容
- PlaceOfRepair: this.ruleForm.repairAddress, // 报修地点
- File: this.ruleForm.repairImageid, // 附件
- DeviceEncode: this.ruleForm.F_DeviceEncode, // 设备资产编码
- MaintenanceDept: this.ruleForm.assignDepart, // 指派部门
- IsEnd: '0', // 是否完结
- EmergencyTypes: this.ruleForm.EmergencyTypes,
- Maintenancer: this.ruleForm.assignMant, // 指派人
- OrderSource: window.localStorage.getItem('loginway') || 'pc'
- }
- UpdateFaultRepair(params).then((res) => {
- if (res.state.toLowerCase() === 'success') {
- // this.$parent.$layer.close(this.layerid)
- // this.$parent.getList()
- this.$emit('closeLayer')
- this.usercodeSearch = ''
- this.$message({
- message: '恭喜你,编辑工单成功!',
- type: 'success',
- duration: 1000
- })
- }
- })
- }
- if (this.wid === '') {
- const params = {
- LeaveRecordId: this.fid,
- CallId: this.cid,
- Applicant: this.ruleForm.repairmanid, // 申请人
- ApplicationDept: this.ruleForm.repairDeptid, // 申请部门
- Applicantsphone: this.ruleForm.repairmanphone, // 申请电话
- Phone: this.ruleForm.repairmanCallNumber, // 联系方式
- DeptPhone: this.ruleForm.DeptPhone,
- WorkOrderCategory: this.ruleForm.repairOrderType, // 工单类别
- Content: this.ruleForm.repairCenter, // 工单内容
- PlaceOfRepair: this.ruleForm.repairAddress, // 报修地点
- File: this.ruleForm.repairImageid, // 附件
- DeviceEncode: this.ruleForm.F_DeviceEncode, // 设备资产编码
- MaintenanceDept: this.ruleForm.assignDepart, // 指派部门
- IsEnd: '0', // 是否完结
- EmergencyTypes: this.ruleForm.EmergencyTypes,
- Maintenancer: this.ruleForm.assignMant, // 指派人
- OrderSource: window.localStorage.getItem('loginway') || 'pc'
- }
- console.log(params)
- // return;
- getAddRepairbase(params).then((res) => {
- if (res.state.toLowerCase() === 'success') {
- this.getUrl()
- this.$parent.$layer.closeAll()
- // this.$refs.ruleForm.resetFields()
- // this.deptidArr = []
- // this.assignArr = []
- // this.usercodeSearch = ''
- if (window.location.href.indexOf('addWorkOrder') >= 0) {
- this.$message({
- message: '工单已提交成功!',
- type: 'success',
- duration: 500
- })
- this.$router.push({
- path: '/orderManage/mySubmit'
- })
- } else {
- this.$message({
- message: '恭喜你,添加工单成功!',
- type: 'success',
- duration: 1000
- })
- }
- this.getList()
- }
- })
- }
- } else {
- return false
- }
- })
- } else {
- console.log('error submit!!')
- return false
- }
- })
- },
- getUrl() {
- if (window.location.href.indexOf('callScreen') >= 0) {
- this.$store.dispatch('delView', this.$route)
- const scoketDatas = {
- Type: 'SayFree',
- AgentID: window.localStorage.getItem('storageUsercode'),
- AgentExten: window.localStorage.getItem('ext')
- }
- if (this.telTopRightState == '话后处理中') {
- Send(scoketDatas)
- }
- window.sessionStorage.setItem('isBusyOrFree', 1) // 0是置忙1是置闲
- this.$router.push({
- path: '/Dashboard'
- })
- }
- // else {
- // window.location.reload()
- // }
- },
- getDeptByCode(datas, code) {
- console.log(code)
- for (const key in datas) {
- if (datas[key].deptcode === code) {
- this.assignArr = datas[key].ids
- this.ruleForm.assignDepart =
- this.assignArr[this.assignArr.length - 1]
- this.getgzbxClassUser(this.assignArr[this.assignArr.length - 1])
- // return datas[key].ids
- }
- }
- },
- getList() {
- return new Promise((resolve) => {
- const params = {
- time: 1,
- loweltype: this.orderTypeData.F_Type2,
- deptid: this.ruleForm.repairDeptid,
- pageindex: this.pageParams.pageindex, // int 第几页
- pagesize: this.pageParams.pagesize // int 每页几条信息
- }
- comOrderList(params).then((response) => {
- if (response.state.toLowerCase() === 'success') {
- this.pageParams.total = response.total
- this.dataLists = response.rows
- }
- })
- resolve()
- })
- },
- formtOrder(row, column) {
- if (row.F_SonType) {
- const typeText =
- this.$store.getters.workTypeMap[parseInt(row.F_SonType)].text
- // return typeText.split('/').slice(1).join('/');
- return typeText
- }
- },
- hadndleOrderCode(row) {
- if (row.F_Type === 3000) {
- this.$layer.iframe({
- content: {
- content: detail, // 传递的组件对象
- parent: this, // 当前的vue对象
- data: {
- rowid: row.F_WoCode
- } // props
- },
- area: ['80%', '90%'],
- title: '工单详情'
- })
- }
- }
- }
- }
- </script>
- <style rel="stylesheet/scss" lang="scss">
- .msgbox {
- display: inline-block;
- vertical-align: middle;
- margin-right: 3px;
- width: 6px;
- height: 30px;
- line-height: 30px;
- border-radius: 1px;
- padding-left: 5px;
- color: #f5f5f6;
- background-color: #409eff;
- }
- .order_form {
- .form_select {
- width: 100%;
- }
- .form_date {
- width: 100%;
- }
- }
- // .wrap {
- // margin: o auto;
- // }
- .el-input--small .el-input__inner {
- height: 45px !important;
- line-height: 45px !important;
- }
- .avatar-uploader .el-upload {
- border: 1px dashed #d9d9d9;
- border-radius: 6px;
- cursor: pointer;
- position: relative;
- overflow: hidden;
- }
- .avatar-uploader .el-upload:hover {
- border-color: #409eff;
- }
- .avatar-uploader-icon {
- font-size: 28px;
- color: #8c939d;
- width: 148px;
- height: 148px;
- line-height: 178px;
- text-align: center;
- }
- .avatar {
- width: 178px;
- height: 178px;
- display: block;
- }
- </style>
|