人民医院前端

addRepairbase.vue 35KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060
  1. <template>
  2. <div style="margin: 0 10px !important">
  3. <el-form
  4. ref="ruleForm"
  5. :model="ruleForm"
  6. :rules="rules"
  7. label-width="120px"
  8. >
  9. <el-row :gutter="24">
  10. <el-row>
  11. <el-col :span="12">
  12. <el-form-item label="工号搜索">
  13. <el-input
  14. v-model="usercodeSearch"
  15. placeholder="请输入工号"
  16. @blur="getUserData"
  17. />
  18. </el-form-item>
  19. </el-col>
  20. </el-row>
  21. <el-row>
  22. <el-col :span="12">
  23. <el-form-item label="申请科室" prop="repairDeptid">
  24. <select-dept-tree
  25. :isdisabled="true"
  26. :deptparam="deptidArr"
  27. @post-deptid="getDeptid"
  28. />
  29. </el-form-item>
  30. </el-col>
  31. <el-col :span="12">
  32. <el-form-item label="科室电话" prop="DeptPhone">
  33. <el-input
  34. v-model="ruleForm.DeptPhone"
  35. placeholder="请输入科室电话"
  36. />
  37. </el-form-item>
  38. </el-col>
  39. <el-col :span="12">
  40. <el-form-item label="申请人" prop="repairmanid">
  41. <el-select
  42. :disabled="true"
  43. v-model="ruleForm.repairmanid"
  44. clearable
  45. filterable
  46. placeholder="请选择申请人"
  47. style="width: 100%"
  48. @change="changeRepairman"
  49. >
  50. <el-option
  51. v-for="item in repairman"
  52. :key="item.usercode"
  53. :label="item.username"
  54. :value="item.usercode"
  55. />
  56. </el-select>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :span="12">
  60. <el-form-item label="申请电话" prop="repairmanphone">
  61. <el-input
  62. v-model="ruleForm.repairmanphone"
  63. placeholder="请输入申请电话"
  64. />
  65. </el-form-item>
  66. </el-col>
  67. <el-col :span="12">
  68. <el-form-item label="联系电话" prop="repairmanCallNumber">
  69. <el-input
  70. v-model="ruleForm.repairmanCallNumber"
  71. placeholder="请输入联系电话"
  72. />
  73. </el-form-item>
  74. </el-col>
  75. <el-col :span="12">
  76. <el-form-item label="科室位置" prop="repairAddress">
  77. <el-input
  78. v-model="ruleForm.repairAddress"
  79. placeholder="请输入科室位置"
  80. />
  81. </el-form-item>
  82. </el-col>
  83. </el-row>
  84. <!-- <el-row></el-row> -->
  85. <el-row v-if="worktypeInfo === 'gzbx_shebei'">
  86. <el-col :span="24">
  87. <el-form-item label="设备资产编码" prop="F_DeviceEncode">
  88. <el-input
  89. v-model="ruleForm.F_DeviceEncode"
  90. placeholder="请输入设备资产编码"
  91. />
  92. </el-form-item>
  93. </el-col>
  94. </el-row>
  95. <el-row>
  96. <el-col :span="24">
  97. <el-form-item label="报修内容" prop="repairCenter">
  98. <el-input
  99. v-model="ruleForm.repairCenter"
  100. :autosize="{ minRows: 4, maxRows: 8 }"
  101. show-word-limit
  102. maxlength="100"
  103. type="textarea"
  104. placeholder="请详细描述具体故障位置或者床号及故障详细描述"
  105. />
  106. </el-form-item>
  107. </el-col>
  108. </el-row>
  109. <!-- <el-row>
  110. <el-col :span="24">
  111. <el-form-item label="报修地点" prop="repairAddress">
  112. <el-input
  113. v-model="ruleForm.repairAddress"
  114. placeholder="请输入报修地点"
  115. />
  116. </el-form-item>
  117. </el-col>
  118. </el-row> -->
  119. <el-row v-if="iswomanage != 1">
  120. <el-col :span="12">
  121. <el-form-item label="指派科室" prop="assignDepart">
  122. <select-dept-tree
  123. :deptparam="assignArr"
  124. @post-deptid="geAssigntDeptid"
  125. />
  126. </el-form-item>
  127. </el-col>
  128. <el-col :span="12">
  129. <el-form-item label="指派人" prop="assignMant">
  130. <el-select
  131. v-model="ruleForm.assignMant"
  132. clearable
  133. filterable
  134. placeholder="请选择指派人"
  135. style="width: 100%"
  136. @change="changeUser"
  137. >
  138. <el-option
  139. v-for="item in assignman"
  140. :key="item.usercode"
  141. :label="item.username + '(' + item.count + ')'"
  142. :value="item.usercode"
  143. />
  144. </el-select>
  145. </el-form-item>
  146. </el-col>
  147. </el-row>
  148. <el-row>
  149. <el-col :span="24">
  150. <el-form-item label="附件图片" prop="repairImageid">
  151. <el-upload
  152. :before-upload="beforeUpload"
  153. :headers="headers"
  154. :file-list="fileList"
  155. :on-remove="handle_remove"
  156. :on-success="handle_success"
  157. :action="imgUrl"
  158. list-type="picture-card"
  159. accept=".mp4, .jpg, .jpeg, .png"
  160. >
  161. <i class="el-icon-plus" />
  162. </el-upload>
  163. </el-form-item>
  164. </el-col>
  165. </el-row>
  166. <el-row>
  167. <el-col :span="12">
  168. <el-form-item label="紧急情况" prop="EmergencyTypes">
  169. <el-radio-group v-model="ruleForm.EmergencyTypes">
  170. <el-radio label="一般">一般</el-radio>
  171. <el-radio label="紧急">紧急</el-radio>
  172. </el-radio-group>
  173. </el-form-item>
  174. </el-col>
  175. </el-row>
  176. <el-form-item>
  177. <el-button
  178. type="primary"
  179. @click="submitForm('ruleForm')"
  180. >提交工单</el-button
  181. >
  182. </el-form-item>
  183. </el-row>
  184. </el-form>
  185. <!-- //24小时历史工单 -->
  186. <p v-if="isAddorder == true" style="margin: 20px 0 10px 0">
  187. <span class="msgbox"/><span
  188. style="line-height: 30px; font-size: 14px; color: #333"
  189. >历史工单</span
  190. >
  191. </p>
  192. <el-table
  193. v-if="isAddorder == true"
  194. ref="multipleTable"
  195. :data="dataLists"
  196. border
  197. stripe
  198. >
  199. <el-table-column
  200. prop="F_WoCode"
  201. label="工单编号"
  202. align="center"
  203. min-width="110"
  204. >
  205. <template slot-scope="scope">
  206. <span
  207. style="color: #409eff; cursor: pointer"
  208. @click="hadndleOrderCode(scope.row)"
  209. >{{ scope.row.F_WoCode }}</span
  210. >
  211. <el-tag
  212. v-if="scope.row.F_UrgeCount > 0"
  213. type="success"
  214. >催{{ scope.row.F_UrgeCount }}</el-tag
  215. >
  216. </template>
  217. </el-table-column>
  218. <el-table-column
  219. prop="F_ProposerName"
  220. label="申请人"
  221. align="center"
  222. min-width
  223. />
  224. <el-table-column
  225. :formatter="formtOrder"
  226. prop="F_SonType"
  227. label="工单类别"
  228. align="center"
  229. min-width
  230. />
  231. <el-table-column
  232. prop="F_Content"
  233. label="工单内容"
  234. align="center"
  235. min-width
  236. />
  237. <el-table-column
  238. prop="StateName"
  239. label="工单状态"
  240. align="center"
  241. min-width
  242. />
  243. <el-table-column
  244. prop="F_CreateTime"
  245. label="创建时间"
  246. align="center"
  247. min-width
  248. />
  249. </el-table>
  250. <pagination
  251. v-if="isAddorder == true"
  252. v-show="pageParams.total > 0"
  253. :total="pageParams.total"
  254. :pageindex.sync="pageParams.pageindex"
  255. :pagesize.sync="pageParams.pagesize"
  256. class="pagination"
  257. @pagination="getList"
  258. />
  259. </div>
  260. </template>
  261. <script>
  262. import selectDeptTree from '@/components/context/commonSelect/selectDeptTree.vue'
  263. import selectOrderTypeTwo from '@/components/context/commonSelect/selectOrderTypeTwo.vue'
  264. import { GetPerson, getClassByDeptId, GetUsersByDeptId } from '@/api/commonAPI'
  265. import { getUserMsg } from '@/api/orderManagement/orderList'
  266. import {
  267. GetFaultRepairDetail,
  268. UpdateFaultRepair
  269. } from '@/api/orderManagement/orderList'
  270. import { getAddRepairbase } from '@/api/faultRepairManagement/faultRepair'
  271. import { getTypeDetail } from '@/api/systemSetup/roleSetting/department'
  272. import { Send, ws } from '../../../utils/telWebsocket.js'
  273. import { mapGetters } from 'vuex'
  274. import Pagination from '@/components/context/Pagination' // 对el-pagination 二次封装
  275. import detail from '../../../views/orderManage/components/orderDetail.vue'
  276. import { comOrderList } from '@/api/orderManagement/orderList'
  277. import { encrypt, decrypt } from '@/utils/secretKey'
  278. export default {
  279. name: 'AddRepairbase',
  280. components: {
  281. Pagination,
  282. selectDeptTree,
  283. selectOrderTypeTwo
  284. },
  285. props: {
  286. wid: {
  287. type: String,
  288. default: ''
  289. },
  290. fid: {
  291. type: String,
  292. default: ''
  293. },
  294. layerid: {
  295. type: String,
  296. default: ''
  297. },
  298. callid: {
  299. type: String,
  300. default: ''
  301. },
  302. iswomanage: {
  303. type: String,
  304. default: ''
  305. },
  306. orderTypeData: {
  307. type: Object,
  308. default() {
  309. return {}
  310. }
  311. }
  312. },
  313. data() {
  314. return {
  315. isAddorder: false,
  316. pageParams: {
  317. pageindex: 1, // 当前第几页
  318. pagesize: Number(this.$store.getters.serverConfig.PAGESIZE), // 每页几条数据
  319. total: 0 // 总共多少数据
  320. },
  321. dataLists: [],
  322. secondOrderType: {
  323. typeid: 2,
  324. pid: 3000
  325. },
  326. deptMents: this.$store.getters.deptmap,
  327. worktypeInfo: '',
  328. cid: '',
  329. usercodeSearch: '',
  330. orderarr: [],
  331. isedit: false,
  332. ordertypeArr: [],
  333. imgUrl:
  334. this.$store.getters.serverConfig.BASE_API +
  335. 'FaultRepair/UploadFile?token=' +
  336. localStorage.getItem('Admin-Token'),
  337. fileList: [],
  338. repairman: [], // 申请人数据
  339. deptidArr: [], // 申请部门默认值
  340. assignman: [], // 指派人
  341. assignArr: [], // 默认指派部门
  342. autodeptid: '',
  343. ruleForm: {
  344. repairDeptid: '', // 申请部门
  345. repairmanid: '', // 申请人
  346. repairmanphone: '', // 申请电话
  347. DeptPhone: '',
  348. repairmanCallNumber: '', // 联系电话
  349. repairOrderType: [], // 工单类别
  350. F_Type2: '',
  351. repairCenter: '', // 报修内容
  352. repairAddress: '', // 报修地点
  353. repairImageid: '', // 附件
  354. repairOper: '0', // 下不流程
  355. EmergencyTypes: '一般',
  356. assignDepart: '', // 指派部门
  357. assignMant: '' // 指派人
  358. },
  359. headers: {
  360. Authorization: 'Bearer ' + localStorage.getItem('Admin-Token')
  361. },
  362. imageUrl: 'http://192.168.1.37:8000/FaultRepair/UploadFile',
  363. rules: {
  364. repairmanphone: [
  365. {
  366. required: true,
  367. message: '申请电话不能为空',
  368. trigger: 'blur'
  369. }
  370. // {
  371. // pattern: /^((0\d{2,3}-\d{5,8})|(1[345789]\d{9}))$/,
  372. // message: '请输入正确的电话号码或者固话号码',
  373. // trigger: 'blur'
  374. // }
  375. ],
  376. repairDeptid: [
  377. {
  378. required: true,
  379. message: '请选择申请部门',
  380. trigger: 'change'
  381. }
  382. ],
  383. repairmanid: [
  384. {
  385. required: true,
  386. message: '请选择申请人',
  387. trigger: 'change'
  388. }
  389. ],
  390. repairmanCallNumber: [
  391. {
  392. required: true,
  393. message: '请输入联系电话',
  394. trigger: 'blur'
  395. }
  396. ],
  397. repairOrderType: [
  398. {
  399. required: true,
  400. message: '请选择工单类别',
  401. trigger: 'change'
  402. }
  403. ],
  404. repairCenter: [
  405. {
  406. required: true,
  407. message: '请详细描述具体故障位置或者床号及故障详细描述',
  408. trigger: 'blur'
  409. }
  410. ],
  411. // F_DeviceEncode: [{
  412. // required: true,
  413. // message: '请输入设备资产编码',
  414. // trigger: 'blur'
  415. // }],
  416. repairAddress: [
  417. {
  418. required: true,
  419. message: '请输入科室位置',
  420. trigger: 'blur'
  421. }
  422. ]
  423. }
  424. }
  425. },
  426. watch: {
  427. 'orderTypeData.F_Type2': function() {
  428. this.ruleForm.repairOrderType = this.orderTypeData.F_Type2
  429. console.log(this.ruleForm.repairOrderType)
  430. this.worktypeInfo =
  431. this.$store.getters.workTypeMap[
  432. parseInt(this.orderTypeData.type2Arr[0])
  433. ].tag
  434. this.getList() // 24小时工单
  435. // this.autodeptid = this.$store.getters.workTypeMap[parseInt(this.ruleForm.repairOrderType)].autoDept
  436. // 默认
  437. if (this.orderTypeData.F_Type2) {
  438. this.getAuto()
  439. }
  440. // console.log(this.ruleForm.repairOrderType,this.worktypeInfo,this.autodeptid)
  441. // if(this.worktypeInfo != 'gzbx_jjhq'){
  442. // this.ruleForm.assignDepart = this.$store.getters.workTypeMap[parseInt(this.ruleForm.repairOrderType)].autoDept
  443. // this.assignArr = this.$store.getters.deptmap[parseInt(this.autodeptid)].ids
  444. // this.getClassUser()
  445. // }
  446. // if((this.worktypeInfo == 'gzbx_jjhq' && this.deptidArr[0] != '1') && (this.worktypeInfo == 'gzbx_jjhq' && this.deptidArr[0] != '4005')){//基建类申请人不是总院
  447. // console.log(123123);
  448. // if(this.deptidArr[0] == '2'){//2分院3西院4004东院区4006南院区4008北院区
  449. // this.getDeptByCode(this.deptMents,'fenyuanqu')
  450. // }
  451. // if(this.deptidArr[0] == '3'){//2分院3西院
  452. // this.getDeptByCode(this.deptMents,'xiyuanqu')
  453. // }
  454. // if(this.deptidArr[0] == '4004'){//4004东院区
  455. // this.getDeptByCode(this.deptMents,'JJHQ_DYQBZZ')
  456. // }
  457. // if(this.deptidArr[0] == '4006'){//4006南院区
  458. // this.getDeptByCode(this.deptMents,'JJHQ_NYQBZZ')
  459. // }
  460. // if(this.deptidArr[0] == '4008'){//4008北院区
  461. // this.getDeptByCode(this.deptMents,'JJHQ_BYQBZZ')
  462. // }
  463. // }else{
  464. // console.log(1333333123);
  465. // this.ruleForm.assignDepart = this.$store.getters.workTypeMap[parseInt(this.ruleForm.repairOrderType)].autoDept
  466. // this.assignArr = this.$store.getters.deptmap[parseInt(this.autodeptid)].ids
  467. // this.getClassUser()
  468. // }
  469. }
  470. // 'deptidArr':function(){
  471. // if((this.worktypeInfo == 'gzbx_jjhq' && this.deptidArr[0] != '1') && (this.worktypeInfo == 'gzbx_jjhq' && this.deptidArr[0] != '4005')){//基建类申请人不是总院
  472. // if(this.deptidArr[0] == '2'){//2分院3西院
  473. // this.getDeptByCode(this.deptMents,'fenyuanqu')
  474. // }
  475. // if(this.deptidArr[0] == '3'){//2分院3西院
  476. // this.getDeptByCode(this.deptMents,'xiyuanqu')
  477. // }
  478. // if(this.deptidArr[0] == '4004'){//4004东院区
  479. // this.getDeptByCode(this.deptMents,'JJHQ_DYQBZZ')
  480. // }
  481. // if(this.deptidArr[0] == '4006'){//4006南院区
  482. // this.getDeptByCode(this.deptMents,'JJHQ_NYQBZZ')
  483. // }
  484. // if(this.deptidArr[0] == '4008'){//4008北院区
  485. // this.getDeptByCode(this.deptMents,'JJHQ_BYQBZZ')
  486. // }
  487. // }else{
  488. // // console.log(this.$store.getters.deptmap[parseInt(this.autodeptid)].ids,'9999')
  489. // this.assignArr = this.$store.getters.deptmap[parseInt(this.autodeptid)].ids
  490. // this.ruleForm.assignDepart = this.$store.getters.workTypeMap[parseInt(this.ruleForm.repairOrderType)].autoDept
  491. // this.getClassUser()
  492. // }
  493. // }
  494. },
  495. computed: {
  496. ...mapGetters([
  497. 'telTopRightState' // 状态信息
  498. ])
  499. },
  500. created() {
  501. if (window.location.href.indexOf('addWorkOrder') >= 0) {
  502. this.isAddorder = true
  503. } else {
  504. this.isAddorder = false
  505. }
  506. this.cid = this.callid
  507. if (!this.cid) {
  508. this.cid = window.localStorage.getItem('callidSave')
  509. }
  510. if (this.wid) {
  511. this.getWoDetail(this.wid, '0')
  512. }
  513. if (this.iswomanage === '1') {
  514. this.usercodeSearch = window.localStorage.getItem('storageUsercode')
  515. const deptid = this.$store.getters.teamId
  516. this.deptidArr = this.$store.getters.deptmap[parseInt(deptid)].ids
  517. this.ruleForm.repairDeptid = deptid
  518. this.getRepairman(deptid, 0)
  519. this.getDeptAddress(deptid)
  520. this.ruleForm.repairmanid = this.$store.getters.usercode
  521. this.ruleForm.repairmanphone = decrypt(localStorage.getItem('storageUserphoneShow'))
  522. this.ruleForm.repairmanCallNumber = this.ruleForm.repairmanphone
  523. this.ruleForm.repairAddress = this.$store.getters.location
  524. }
  525. },
  526. methods: {
  527. getAuto() {
  528. this.assignArr = []
  529. this.assignman = []
  530. this.ruleForm.assignDepart = ''
  531. this.ruleForm.assignMant = ''
  532. if (this.$store.getters.workTypeMap[parseInt(this.orderTypeData.F_Type2)]) {
  533. const autoData = JSON.parse(
  534. this.$store.getters.workTypeMap[parseInt(this.orderTypeData.F_Type2)]
  535. .autoDept || '[]'
  536. )
  537. const applyHos = this.deptidArr[0]
  538. console.log(autoData, applyHos)
  539. if (!autoData) {
  540. return
  541. }
  542. var hosall = []
  543. for (var i = 0; i < autoData.length; i++) {
  544. hosall.push(autoData[i].autoyq)
  545. }
  546. for (var i = 0; i < autoData.length; i++) {
  547. if (autoData[i].autoyq == applyHos) {
  548. // 有院区
  549. this.assignArr =
  550. this.$store.getters.deptmap[parseInt(autoData[i].autodept)].ids
  551. this.ruleForm.assignDepart = autoData[i].autodept
  552. this.getClassUserArr(autoData[i].autodept)
  553. this.ruleForm.assignMant = autoData[i].autousercode
  554. } else if (autoData[i].autoyq == '0' && hosall.indexOf(applyHos) < 0) {
  555. // 全部
  556. this.assignArr =
  557. this.$store.getters.deptmap[parseInt(autoData[i].autodept)].ids
  558. this.ruleForm.assignDepart = autoData[i].autodept
  559. this.getClassUserArr(autoData[i].autodept)
  560. this.ruleForm.assignMant = autoData[i].autousercode
  561. }
  562. }
  563. }
  564. },
  565. getUserData() {
  566. if (!this.usercodeSearch) {
  567. return
  568. }
  569. const params = {
  570. usercode: this.usercodeSearch
  571. }
  572. getUserMsg(params).then((res) => {
  573. const data = res.data
  574. this.ruleForm.repairDeptid = data.F_DeptId
  575. this.deptidArr =
  576. this.$store.getters.deptmap[parseInt(data.F_DeptId)].ids
  577. this.getRepairman(data.F_DeptId, 0)
  578. this.getDeptAddress(data.F_DeptId)
  579. this.ruleForm.repairmanid = data.F_UserCode
  580. this.ruleForm.repairmanphone = data.F_Telephone ? decrypt(data.F_TelephoneShow) : ''
  581. this.ruleForm.repairmanCallNumber = data.F_Telephone ? decrypt(data.F_TelephoneShow) : ''
  582. this.ruleForm.repairAddress = data.F_Location
  583. this.getAuto()
  584. })
  585. },
  586. // 部门
  587. getDeptid(data) {
  588. this.ruleForm.repairDeptid = data[data.length - 1]
  589. this.deptidArr = data
  590. this.ruleForm.repairmanid = ''
  591. this.getRepairman(this.ruleForm.repairDeptid, 0)
  592. this.getDeptAddress(data[data.length - 1])
  593. this.getAuto()
  594. this.getList()
  595. },
  596. geAssigntDeptid(data) {
  597. this.ruleForm.assignDepart = data[data.length - 1]
  598. this.getClassUserArr(data[data.length - 1])
  599. },
  600. getDeptAddress(id) {
  601. getTypeDetail(id).then((res) => {
  602. this.ruleForm.repairAddress = res.data.F_Location ? decrypt(res.data.F_LocationShow) : ''
  603. this.ruleForm.DeptPhone = res.data.F_OfficeTelephone ? decrypt(res.data.F_OfficeTelephoneShow) : ''
  604. })
  605. },
  606. getClassUserArr(id) {
  607. if (!id) return
  608. const params = {
  609. deptid: id
  610. }
  611. this.assignman = []
  612. this.ruleForm.assignMant = ''
  613. if (id) {
  614. getClassByDeptId(params).then((res) => {
  615. this.assignman = res.rows
  616. })
  617. }
  618. },
  619. // 获取申请人数据
  620. getRepairman(id, state) {
  621. return new Promise((resolve) => {
  622. const params = {
  623. deptid: id // 字典管理的工单标识
  624. }
  625. GetUsersByDeptId(params).then((res) => {
  626. if (res.state == 'error') {
  627. this.$message.warning(res.message)
  628. }
  629. if (state === 0) {
  630. this.repairman = res.rows
  631. } else if (state === 1) {
  632. this.assignman = res.rows
  633. }
  634. })
  635. resolve()
  636. })
  637. },
  638. // 申请人
  639. changeRepairman(data) {
  640. this.ruleForm.repairmanid = data
  641. const user = this.repairman.find((o) => {
  642. return o.usercode === data.toString()
  643. })
  644. if (user) {
  645. this.ruleForm.repairmanphone = user.usertelphone
  646. this.ruleForm.repairmanCallNumber = user.usertelphone
  647. }
  648. },
  649. changeUser(data) {
  650. // 指派人
  651. this.ruleForm.assignMant = data
  652. },
  653. // 详情
  654. getWoDetail(rid, type) {
  655. const params = {
  656. WorkOrderCode: rid,
  657. type: type
  658. }
  659. GetFaultRepairDetail(params).then((response) => {
  660. if (response.data[0]) {
  661. this.deptidArr =
  662. this.$store.getters.deptmap[
  663. parseInt(response.data[0].F_ApplicationDept)
  664. ].ids
  665. console.log(this.deptidArr, '666')
  666. if (response.data[0].F_MaintenanceDept) {
  667. this.assignArr =
  668. this.$store.getters.deptmap[
  669. parseInt(response.data[0].F_MaintenanceDept)
  670. ].ids
  671. }
  672. console.log(1222)
  673. this.getRepairman(response.data[0].F_ApplicationDept)
  674. this.getDeptAddress(response.data[0].F_ApplicationDept)
  675. this.ruleForm.repairmanid = response.data[0].F_Applicant
  676. this.ruleForm.repairmanphone = decrypt(response.data[0].F_ApplicantsphoneShow)
  677. this.ruleForm.repairmanCallNumber = decrypt(response.data[0].F_PhoneShow)
  678. this.ruleForm.F_Type2 = response.data[0].F_WorkOrderCategory
  679. this.isedit = true
  680. this.ruleForm.repairOrderType =
  681. this.$store.getters.workTypeMap[
  682. parseInt(response.data[0].F_WorkOrderCategory)
  683. ].ids // 工单类别
  684. console.log(this.ruleForm.repairOrderType)
  685. this.ruleForm.repairOrderType = this.ruleForm.repairOrderType.slice(
  686. 1,
  687. this.ruleForm.repairOrderType.length
  688. )
  689. console.log(this.ruleForm.repairOrderType)
  690. this.ruleForm.repairDeptid = response.data[0].F_ApplicationDept // 部门
  691. this.ruleForm.repairCenter = response.data[0].F_Content
  692. this.ruleForm.repairAddress = response.data[0].F_PlaceOfRepair
  693. this.ruleForm.assignDepart = response.data[0].F_MaintenanceDept
  694. this.ruleForm.assignMant = response.data[0].F_Maintenancer
  695. this.usercodeSearch = response.data[0].F_Applicant
  696. this.ruleForm.EmergencyTypes = response.data[0].F_EmergencyTypes
  697. if (response.data[0].FileUrl) {
  698. // this.imgUrl = response.data[0].FileUrl[0].F_FileUrl
  699. for (var i = 0; i < response.data[0].FileUrl.length; i++) {
  700. this.ruleForm.repairImageid +=
  701. response.data[0].FileUrl[i].F_FileId + ','
  702. this.fileList.push({
  703. F_FileId: response.data[0].FileUrl[i].F_FileId,
  704. name: response.data[0].FileUrl[i].F_FileName,
  705. url: response.data[0].FileUrl[i].F_FileUrl
  706. })
  707. }
  708. }
  709. }
  710. })
  711. },
  712. // 工单类型
  713. getSecondOOrderType(data) {
  714. this.ruleForm.assignDepart = ''
  715. this.assignArr = []
  716. this.ruleForm.repairOrderType = data.value
  717. console.log(this.ruleForm.repairOrderType)
  718. this.autodeptid =
  719. this.$store.getters.workTypeMap[
  720. parseInt(this.ruleForm.repairOrderType)
  721. ].autoDept
  722. this.ruleForm.assignDepart =
  723. this.$store.getters.workTypeMap[
  724. parseInt(this.ruleForm.repairOrderType)
  725. ].autoDept
  726. this.assignArr =
  727. this.$store.getters.deptmap[parseInt(this.autodeptid)].ids
  728. console.log(this.autodeptid, '7788')
  729. this.getClassUser()
  730. },
  731. getgzbxClassUser(id) {
  732. const params = {
  733. deptid: id
  734. }
  735. this.assignman = []
  736. this.ruleForm.assignMant = ''
  737. if (id) {
  738. getClassByDeptId(params).then((res) => {
  739. this.assignman = res.rows
  740. })
  741. }
  742. },
  743. getClassUser() {
  744. const params = {
  745. deptid: this.autodeptid
  746. }
  747. this.assignman = []
  748. this.ruleForm.assignMant = ''
  749. if (this.autodeptid) {
  750. getClassByDeptId(params).then((res) => {
  751. this.assignman = res.rows
  752. })
  753. }
  754. },
  755. beforeUpload(file) {
  756. const FILE_NAME = file.name
  757. 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') {
  758. this.$message.warning('仅支持.mp4,.jpg,.jpeg,.png文件')
  759. return false
  760. }
  761. const isLt1M = file.size / 1024 / 1024 < 20
  762. if (isLt1M) {
  763. this.file = file
  764. return true
  765. }
  766. this.$message.warning('请上传不超过20M的文件.')
  767. return false
  768. },
  769. handle_success(res) {
  770. this.ruleForm.repairImageid += res.data[0].F_FileId + ','
  771. },
  772. handle_remove(res) {
  773. if (res.F_FileId) {
  774. var oldstr = res.F_FileId + ','
  775. }
  776. if (res.response) {
  777. var str = res.response.data[0].F_FileId + ','
  778. }
  779. if (oldstr) {
  780. this.ruleForm.repairImageid = this.ruleForm.repairImageid.replace(
  781. oldstr,
  782. ''
  783. )
  784. }
  785. if (str) {
  786. this.ruleForm.repairImageid = this.ruleForm.repairImageid.replace(
  787. str,
  788. ''
  789. )
  790. }
  791. },
  792. submitForm(formName) {
  793. if (this.telTopRightState == '通话中') {
  794. if (window.location.href.indexOf('callScreen') >= 0) {
  795. this.$message('请挂断后再提交工单')
  796. return
  797. }
  798. }
  799. if (this.orderTypeData.type2Arr.length == 0) {
  800. this.$message.error('请选择工单类别')
  801. return
  802. }
  803. var resTypeArr = this.$store.getters.workTypeMap[parseInt(this.orderTypeData.type2Arr[this.orderTypeData.type2Arr.length - 1])].ids
  804. if(resTypeArr[0] != 3000){
  805. this.$message.error('业务类别与工单类别不匹配,请重新选择')
  806. return
  807. }
  808. // console.log(resTypeArr)
  809. // return
  810. this.$refs[formName].validate((valid) => {
  811. if (valid) {
  812. if (this.ruleForm.repairImageid === '') {
  813. this.ruleForm.repairImageid = ''
  814. } else {
  815. this.ruleForm.repairImageid = this.ruleForm.repairImageid.slice(
  816. 0,
  817. this.ruleForm.repairImageid.length - 1
  818. )
  819. }
  820. if (this.iswomanage == 1) {
  821. this.ruleForm.assignDepart = ''
  822. this.ruleForm.assignMant = ''
  823. }
  824. this.$refs.ruleForm.validate((valid) => {
  825. if (valid) {
  826. if (this.wid) {
  827. // 编辑
  828. if (this.ruleForm.F_Type2) {
  829. this.ruleForm.repairOrderType = this.ruleForm.F_Type2
  830. }
  831. const params = {
  832. WorkOrderCode: this.wid,
  833. Applicant: this.ruleForm.repairmanid, // 申请人
  834. ApplicationDept: this.ruleForm.repairDeptid, // 申请部门
  835. Applicantsphone: this.ruleForm.repairmanphone, // 申请电话
  836. Phone: this.ruleForm.repairmanCallNumber, // 联系方式
  837. DeptPhone: this.ruleForm.DeptPhone,
  838. WorkOrderCategory: this.ruleForm.repairOrderType, // 工单类别
  839. Content: this.ruleForm.repairCenter, // 工单内容
  840. PlaceOfRepair: this.ruleForm.repairAddress, // 报修地点
  841. File: this.ruleForm.repairImageid, // 附件
  842. DeviceEncode: this.ruleForm.F_DeviceEncode, // 设备资产编码
  843. MaintenanceDept: this.ruleForm.assignDepart, // 指派部门
  844. IsEnd: '0', // 是否完结
  845. EmergencyTypes: this.ruleForm.EmergencyTypes,
  846. Maintenancer: this.ruleForm.assignMant, // 指派人
  847. OrderSource: window.localStorage.getItem('loginway') || 'pc'
  848. }
  849. UpdateFaultRepair(params).then((res) => {
  850. if (res.state.toLowerCase() === 'success') {
  851. // this.$parent.$layer.close(this.layerid)
  852. // this.$parent.getList()
  853. this.$emit('closeLayer')
  854. this.usercodeSearch = ''
  855. this.$message({
  856. message: '恭喜你,编辑工单成功!',
  857. type: 'success',
  858. duration: 1000
  859. })
  860. }
  861. })
  862. }
  863. if (this.wid === '') {
  864. const params = {
  865. LeaveRecordId: this.fid,
  866. CallId: this.cid,
  867. Applicant: this.ruleForm.repairmanid, // 申请人
  868. ApplicationDept: this.ruleForm.repairDeptid, // 申请部门
  869. Applicantsphone: this.ruleForm.repairmanphone, // 申请电话
  870. Phone: this.ruleForm.repairmanCallNumber, // 联系方式
  871. DeptPhone: this.ruleForm.DeptPhone,
  872. WorkOrderCategory: this.ruleForm.repairOrderType, // 工单类别
  873. Content: this.ruleForm.repairCenter, // 工单内容
  874. PlaceOfRepair: this.ruleForm.repairAddress, // 报修地点
  875. File: this.ruleForm.repairImageid, // 附件
  876. DeviceEncode: this.ruleForm.F_DeviceEncode, // 设备资产编码
  877. MaintenanceDept: this.ruleForm.assignDepart, // 指派部门
  878. IsEnd: '0', // 是否完结
  879. EmergencyTypes: this.ruleForm.EmergencyTypes,
  880. Maintenancer: this.ruleForm.assignMant, // 指派人
  881. OrderSource: window.localStorage.getItem('loginway') || 'pc'
  882. }
  883. console.log(params)
  884. // return;
  885. getAddRepairbase(params).then((res) => {
  886. if (res.state.toLowerCase() === 'success') {
  887. this.getUrl()
  888. this.$parent.$layer.closeAll()
  889. // this.$refs.ruleForm.resetFields()
  890. // this.deptidArr = []
  891. // this.assignArr = []
  892. // this.usercodeSearch = ''
  893. if (window.location.href.indexOf('addWorkOrder') >= 0) {
  894. this.$message({
  895. message: '工单已提交成功!',
  896. type: 'success',
  897. duration: 500
  898. })
  899. this.$router.push({
  900. path: '/orderManage/mySubmit'
  901. })
  902. } else {
  903. this.$message({
  904. message: '恭喜你,添加工单成功!',
  905. type: 'success',
  906. duration: 1000
  907. })
  908. }
  909. this.getList()
  910. }
  911. })
  912. }
  913. } else {
  914. return false
  915. }
  916. })
  917. } else {
  918. console.log('error submit!!')
  919. return false
  920. }
  921. })
  922. },
  923. getUrl() {
  924. if (window.location.href.indexOf('callScreen') >= 0) {
  925. this.$store.dispatch('delView', this.$route)
  926. const scoketDatas = {
  927. Type: 'SayFree',
  928. AgentID: window.localStorage.getItem('storageUsercode'),
  929. AgentExten: window.localStorage.getItem('ext')
  930. }
  931. if (this.telTopRightState == '话后处理中') {
  932. Send(scoketDatas)
  933. }
  934. window.sessionStorage.setItem('isBusyOrFree', 1) // 0是置忙1是置闲
  935. this.$router.push({
  936. path: '/Dashboard'
  937. })
  938. }
  939. // else {
  940. // window.location.reload()
  941. // }
  942. },
  943. getDeptByCode(datas, code) {
  944. console.log(code)
  945. for (const key in datas) {
  946. if (datas[key].deptcode === code) {
  947. this.assignArr = datas[key].ids
  948. this.ruleForm.assignDepart =
  949. this.assignArr[this.assignArr.length - 1]
  950. this.getgzbxClassUser(this.assignArr[this.assignArr.length - 1])
  951. // return datas[key].ids
  952. }
  953. }
  954. },
  955. getList() {
  956. return new Promise((resolve) => {
  957. const params = {
  958. time: 1,
  959. loweltype: this.orderTypeData.F_Type2,
  960. deptid: this.ruleForm.repairDeptid,
  961. pageindex: this.pageParams.pageindex, // int 第几页
  962. pagesize: this.pageParams.pagesize // int 每页几条信息
  963. }
  964. comOrderList(params).then((response) => {
  965. if (response.state.toLowerCase() === 'success') {
  966. this.pageParams.total = response.total
  967. this.dataLists = response.rows
  968. }
  969. })
  970. resolve()
  971. })
  972. },
  973. formtOrder(row, column) {
  974. if (row.F_SonType) {
  975. const typeText =
  976. this.$store.getters.workTypeMap[parseInt(row.F_SonType)].text
  977. // return typeText.split('/').slice(1).join('/');
  978. return typeText
  979. }
  980. },
  981. hadndleOrderCode(row) {
  982. if (row.F_Type === 3000) {
  983. this.$layer.iframe({
  984. content: {
  985. content: detail, // 传递的组件对象
  986. parent: this, // 当前的vue对象
  987. data: {
  988. rowid: row.F_WoCode
  989. } // props
  990. },
  991. area: ['80%', '90%'],
  992. title: '工单详情'
  993. })
  994. }
  995. }
  996. }
  997. }
  998. </script>
  999. <style rel="stylesheet/scss" lang="scss">
  1000. .msgbox {
  1001. display: inline-block;
  1002. vertical-align: middle;
  1003. margin-right: 3px;
  1004. width: 6px;
  1005. height: 30px;
  1006. line-height: 30px;
  1007. border-radius: 1px;
  1008. padding-left: 5px;
  1009. color: #f5f5f6;
  1010. background-color: #409eff;
  1011. }
  1012. .order_form {
  1013. .form_select {
  1014. width: 100%;
  1015. }
  1016. .form_date {
  1017. width: 100%;
  1018. }
  1019. }
  1020. // .wrap {
  1021. // margin: o auto;
  1022. // }
  1023. .el-input--small .el-input__inner {
  1024. height: 45px !important;
  1025. line-height: 45px !important;
  1026. }
  1027. .avatar-uploader .el-upload {
  1028. border: 1px dashed #d9d9d9;
  1029. border-radius: 6px;
  1030. cursor: pointer;
  1031. position: relative;
  1032. overflow: hidden;
  1033. }
  1034. .avatar-uploader .el-upload:hover {
  1035. border-color: #409eff;
  1036. }
  1037. .avatar-uploader-icon {
  1038. font-size: 28px;
  1039. color: #8c939d;
  1040. width: 148px;
  1041. height: 148px;
  1042. line-height: 178px;
  1043. text-align: center;
  1044. }
  1045. .avatar {
  1046. width: 178px;
  1047. height: 178px;
  1048. display: block;
  1049. }
  1050. </style>