newIncident.vue 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988
  1. <template>
  2. <div slot="content" class="bgColor newIncident">
  3. <div class="header">新建事件</div>
  4. <div class="navBar">
  5. <div class="fl">
  6. <a
  7. :class="{ active: label == 'incidentInfo' }"
  8. href="javascript:;"
  9. @click="toInfo('incidentInfo')"
  10. >事件信息</a
  11. >
  12. </div>
  13. <div class="fl">
  14. <a
  15. :class="{ active: label == 'handlerInfo' }"
  16. href="javascript:;"
  17. @click="toInfo('handlerInfo')"
  18. >处理信息</a
  19. >
  20. </div>
  21. </div>
  22. <div class="label" id="incidentInfo">事件信息</div>
  23. <cube-form
  24. :model="model"
  25. @validate="validateHandler"
  26. @submit="submitHandler"
  27. >
  28. <cube-form-group>
  29. <cube-form-item :field="fields[24]" class="btn_plcaeholde" v-if="valConfig == 2"></cube-form-item>
  30. <cube-form-item :field="fields[20]" v-if="valConfig == 2" class="btn_plcaeholde btn_local">
  31. <input type="text" class="inp_local" placeholder="请选择报修科室" v-model="model.requester" @click="toSearchDept()" />
  32. </cube-form-item>
  33. <cube-form-item
  34. v-if="valConfig == 1"
  35. :field="fields[0]"
  36. ></cube-form-item>
  37. <cube-form-item
  38. v-if="valConfig == 2"
  39. :field="fields[21]"
  40. ></cube-form-item>
  41. <cube-form-item :field="fields[1]"></cube-form-item>
  42. <cube-form-item :field="fields[2]" class="btn_plcaeholde">
  43. <cube-button @click="showPlacePicker()">{{
  44. selectedPlaceTxt ? selectedPlaceTxt : "请选择区域地点"
  45. }}</cube-button>
  46. </cube-form-item>
  47. <cube-form-item :field="fields[23]" v-if="ifRoom == 1"></cube-form-item>
  48. <cube-form-item :field="fields[3]"></cube-form-item>
  49. <cube-form-item :field="fields[4]" class="btn_plcaeholde">
  50. <cube-button @click="showCategoryPicker()">{{
  51. selectedCategoryTxt ? selectedCategoryTxt : "请选择故障现象"
  52. }}</cube-button>
  53. </cube-form-item>
  54. <cube-form-item
  55. :field="fields[5]"
  56. class="btn_plcaeholde"
  57. ></cube-form-item>
  58. <cube-form-item :field="fields[7]"></cube-form-item>
  59. <div class="label formLabel">
  60. 报修图片
  61. <span>(最多可上传3张JPG或PNG,每张不能超过10M)</span>
  62. </div>
  63. <div class="uplod">
  64. <cube-upload
  65. ref="upload"
  66. :max="3"
  67. :action="action"
  68. :simultaneous-uploads="3"
  69. @files-added="filesAdded"
  70. @file-submitted="fileSubmitted"
  71. />
  72. </div>
  73. <!-- <cube-form-item :field="fields[8]" class="btn_plcaeholde"></cube-form-item>
  74. <cube-form-item :field="fields[9]" class="btn_plcaeholde"></cube-form-item>-->
  75. <cube-form-item
  76. :field="fields[10]"
  77. class="btn_plcaeholde"
  78. ></cube-form-item>
  79. <div class="zc" v-if="wxIncidentWithCmdb == 1">
  80. <cube-form-item
  81. :field="fields[22]"
  82. class="btn_plcaeholde zc-item"
  83. ></cube-form-item>
  84. <span class="icon dash dash-saoyisao zc-sao" @click="scan()"></span>
  85. </div>
  86. <div class="label" id="handlerInfo">处理信息</div>
  87. <div class="handleRadio">
  88. <cube-radio-group
  89. v-model="order"
  90. :options="handleTypes"
  91. position="right"
  92. :hollow-style="true"
  93. @input="changeHandleTypes"
  94. />
  95. </div>
  96. <!-- 直接处理 begin -->
  97. <cube-form-item
  98. v-if="order == 1"
  99. :field="fields[11]"
  100. class="btn_plcaeholde"
  101. ></cube-form-item>
  102. <cube-form-item
  103. v-if="order == 1"
  104. :field="fields[12]"
  105. class="btn_plcaeholde"
  106. ></cube-form-item>
  107. <cube-form-item
  108. v-if="order == 1 && isShowDes"
  109. :field="fields[13]"
  110. class="btn_plcaeholde"
  111. ></cube-form-item>
  112. <div v-if="order == 1" class="label formLabel">
  113. 报修图片
  114. <span>(最多可上传3张JPG或PNG,每张不能超过10M)</span>
  115. </div>
  116. <div class="uplod" v-if="order == 1">
  117. <cube-upload
  118. ref="upload1"
  119. :max="3"
  120. :action="action1"
  121. :simultaneous-uploads="3"
  122. @files-added="filesAdded1"
  123. @file-submitted="fileSubmitted1"
  124. />
  125. </div>
  126. <cube-form-item v-if="order == 1" :field="fields[14]"></cube-form-item>
  127. <cube-form-item
  128. v-if="order == 1 && model.knowledge == true"
  129. :field="fields[15]"
  130. class="btn_plcaeholde"
  131. ></cube-form-item>
  132. <!-- 直接处理 end -->
  133. <!-- 派单 begin -->
  134. <cube-form-item v-if="order == 2" :field="fields[16]"></cube-form-item>
  135. <cube-form-item
  136. v-if="order == 2 && model.handleUserOrGroup == true"
  137. :field="fields[17]"
  138. class="btn_plcaeholde"
  139. ></cube-form-item>
  140. <cube-form-item
  141. v-if="order == 2 && model.handleUserOrGroup == false"
  142. :field="fields[18]"
  143. class="btn_plcaeholde"
  144. ></cube-form-item>
  145. <!-- 派单 end -->
  146. </cube-form-group>
  147. <cube-form-group class="sub">
  148. <cube-button type="submit" @click="subVali()">提交</cube-button>
  149. </cube-form-group>
  150. </cube-form>
  151. <load-ing v-show="loadShow"></load-ing>
  152. <promp-ting
  153. :conents="promptingConent"
  154. :status="promptingStatus"
  155. ></promp-ting>
  156. <seiminModel ref="seiminModel"></seiminModel>
  157. </div>
  158. </template>
  159. <script>
  160. import seiminModel from "./../custom/seiminModel";
  161. import CubePage from "./../components/cube-page.vue";
  162. import CubeButtonGroup from "./../components/cube-button-group.vue";
  163. import DatePicker from "./../components/date-picker.vue";
  164. import CubeExtendPopup from "./../components/extend-popup.vue";
  165. import LoadIng from "./../views/loading.vue";
  166. import PrompTing from "./../views/prompting.vue";
  167. import { SM } from "./../http/http";
  168. // import host from "../request/host";
  169. // 知识库类型
  170. const solution = {
  171. props: {
  172. value: {
  173. default() {
  174. return [];
  175. }
  176. }
  177. },
  178. data() {
  179. return {
  180. selected: [],
  181. selectData: [],
  182. initVal: JSON.parse(localStorage.getItem("solution")) || [0, 0, 0],
  183. allPlace: {}, //存放请求到的所有区域地点
  184. sleectHouseNumber: {}, //区域地点
  185. initSjList: [], //原始事件列表
  186. initAreaList: [], //原始区域列表
  187. };
  188. },
  189. render(createElement) {
  190. return createElement(
  191. "cube-button",
  192. {
  193. on: {
  194. click: this.showPicker
  195. }
  196. },
  197. this.selected.length
  198. ? this.selected[this.selected.length - 1]
  199. : "请选择知识库类型"
  200. );
  201. },
  202. created() {
  203. this.getTree();
  204. },
  205. mounted() {},
  206. methods: {
  207. showPicker() {
  208. this.picker.show();
  209. },
  210. selectHandler(selectedVal, selectedIndex, selectedTxt) {
  211. var selected = [];
  212. selectedTxt.forEach(function(v, i) {
  213. if (v != "") {
  214. selected.push(v);
  215. }
  216. });
  217. this.selected = selected;
  218. this.$emit("input", selectedVal);
  219. localStorage.setItem("solution", JSON.stringify(selectedIndex));
  220. },
  221. // 获取故障现象数据
  222. getTree() {
  223. let that = this;
  224. that.$http
  225. .post("service/solution/fetchDataList/solutionType", {
  226. idx: 0,
  227. sum: 100
  228. })
  229. .then(function(res) {
  230. // console.log(res);
  231. var list = res.data.list;
  232. var tree = [];
  233. list.forEach((v, i) => {
  234. if (!v.parent) {
  235. tree[i] = {
  236. value: v.id,
  237. text: v.typeName,
  238. children: []
  239. };
  240. } else {
  241. tree.forEach((val, idx) => {
  242. if (
  243. v.parent &&
  244. !v.parent.parent &&
  245. val.text == v.parent.typeName
  246. ) {
  247. tree[idx].children.push({
  248. value: v.id,
  249. text: v.typeName,
  250. children: []
  251. });
  252. } else if (v.parent.parent) {
  253. tree[idx].children.forEach((value, index) => {
  254. if (value.text == v.parent.typeName) {
  255. tree[idx].children[index].children.push({
  256. value: v.id,
  257. text: v.typeName
  258. });
  259. }
  260. });
  261. }
  262. });
  263. }
  264. });
  265. var arrTree = [];
  266. tree.forEach(function(v) {
  267. arrTree.push(v);
  268. });
  269. that.selectData = arrTree;
  270. console.log(arrTree);
  271. that.picker = that.$createCascadePicker({
  272. title: "知识库类型选择",
  273. data: that.selectData,
  274. selectedIndex: that.initVal,
  275. onSelect: that.selectHandler
  276. });
  277. });
  278. }
  279. }
  280. };
  281. export default {
  282. data() {
  283. return {
  284. validity: {},
  285. valid: undefined,
  286. action: {
  287. target:
  288. this.$host + "/service/common/common/uploadAttachment/incident/",
  289. data: {}
  290. },
  291. action1: {
  292. target:
  293. this.$host + "/service/common/common/uploadAttachment/incident/",
  294. data: {}
  295. },
  296. isUploading: false,
  297. loadShow: false,
  298. incidentWithConsumable: localStorage.getItem("incidentWithConsumable"), //是否绑定耗材
  299. wxIncidentWithCmdb: localStorage.getItem("wxIncidentWithCmdb"), //是否绑定资产
  300. ifRoom: localStorage.getItem("ifRoom"), //是否增加房间号选择
  301. loginUser: JSON.parse(localStorage.getItem("loginUser")),
  302. integralMechanism: localStorage.getItem("integralMechanism"),
  303. valConfig: JSON.parse(localStorage.getItem("valConfig")) - 0, //报修主体
  304. name: "",
  305. phone: "",
  306. label: "incidentInfo", //顶部快速定位
  307. modelData: {
  308. incident: {}
  309. }, //上传的model
  310. timer: null,
  311. incidentTitle: "", //事件主题
  312. placeSelectData: [], //区域地点下拉框选项
  313. inpLocalVal: "", //故障地点输入框
  314. faultLocationList: [], //区域地点拼接下拉框选项
  315. deptList: [], //报修科室下拉选项
  316. deptRes: "", //下拉框科室信息
  317. branchList: [], //院区下拉列表
  318. // branchRes: [], //院区下拉列表(完整)
  319. model: {
  320. duty: null,
  321. branch: "",
  322. contactsInformation: "",
  323. placeValue: [],
  324. address: "", //故障地点
  325. requester: "", //报修科室
  326. houseNumber: "", //详细地址
  327. description: "", //故障描述
  328. assetId: "", //资产
  329. category: [],
  330. source: "", //事件来源
  331. title: "", //事件主题
  332. priority: "", //优先级
  333. emergency: "", //紧急度
  334. influence: "", //影响度
  335. handleCategory: "", //处理方式
  336. closecode: "", //关闭代码
  337. handleDescription: "", //处理方案
  338. knowledge: false, //是否提交知识库
  339. handlerUser: "", //处理人
  340. candidateGroups: "", //处理组
  341. solutionType: [], //知识库类型
  342. handleUserOrGroup: false, //处理人or处理组
  343. room: "" //房间号
  344. },
  345. selectedCategoryTxt: "", //故障现象选中展示
  346. selectedPlaceTxt: "", //区域地点选中展示
  347. promptingConent: "",
  348. promptingStatus: "",
  349. order: 1, //处理方式 1:直接处理,2:派单
  350. sourceArr: [], //事件来源数组
  351. priorityArr: [], //优先级数组
  352. emergencyArr: [], //紧急度数组
  353. influenceArr: [], //影响度数组
  354. handleCategoryArr: [], //处理方式数组
  355. closecodeArr: [], //关闭代码数组
  356. handlerUserArr: [], //处理人数组
  357. candidateGroupsArr: [], //处理组数组
  358. isShowDes: false,
  359. handleTypes: [
  360. {
  361. label: "直接处理",
  362. value: 1
  363. },
  364. {
  365. label: "派单",
  366. value: 2
  367. }
  368. ],
  369. vali: false,
  370. fields: [
  371. {
  372. type: "input",
  373. modelKey: "contacts",
  374. label: "联系人:",
  375. props: {
  376. placeholder: "请输入联系人"
  377. },
  378. rules: {
  379. required: true
  380. }
  381. },
  382. {
  383. type: "input",
  384. modelKey: "contactsInformation",
  385. label: "联系电话:",
  386. props: {
  387. placeholder: "请输入联系电话"
  388. },
  389. rules: {
  390. required: true
  391. }
  392. },
  393. {
  394. component: "button",
  395. modelKey: "placeValue",
  396. label: "区域地点:",
  397. rules: {
  398. required: false
  399. },
  400. messages: {
  401. required: "请选择区域地点"
  402. }
  403. },
  404. {
  405. type: "textarea",
  406. modelKey: "houseNumber",
  407. label: "详细地址:",
  408. props: {
  409. placeholder: "请输入详细地址"
  410. },
  411. rules: {
  412. required: false
  413. },
  414. debounce: 100
  415. },
  416. {
  417. component: "button",
  418. modelKey: "category",
  419. label: "故障现象:",
  420. rules: {
  421. required: true
  422. },
  423. messages: {
  424. required: "请选择故障现象"
  425. }
  426. },
  427. {
  428. type: "select",
  429. modelKey: "source",
  430. label: "事件来源:",
  431. props: {
  432. options: this.sourceArr,
  433. title: "请选择事件来源",
  434. placeholder: "请选择事件来源"
  435. },
  436. rules: {
  437. required: true
  438. }
  439. },
  440. {
  441. // component: Place,
  442. type: "input",
  443. modelKey: "title",
  444. label: "事件主题:",
  445. rules: {
  446. required: true
  447. },
  448. messages: {
  449. required: "请选择事件主题"
  450. }
  451. },
  452. {
  453. type: "textarea",
  454. modelKey: "description",
  455. label: "故障描述:",
  456. props: {
  457. placeholder: "请详细描述故障,并上传故障图片,例如:网络故障。"
  458. },
  459. rules: {
  460. required: true
  461. },
  462. debounce: 100
  463. },
  464. {
  465. type: "select",
  466. modelKey: "influence",
  467. label: "影响度:",
  468. props: {
  469. options: this.influenceArr,
  470. title: "请选择影响度",
  471. placeholder: "请选择影响度"
  472. },
  473. rules: {
  474. required: false
  475. },
  476. events: {
  477. change: (value, index, text) => {
  478. console.log(value, index, text);
  479. console.log(this.model);
  480. var that = this;
  481. if (this.model.emergency) {
  482. this.$http
  483. .post("service/bpm/data/fetchDataList/prioritymatrix", {
  484. idx: 0,
  485. sum: 1000,
  486. prioritymatrix: {
  487. emergency: { id: this.model.emergency },
  488. influence: { id: this.model.influence }
  489. }
  490. })
  491. .then(function(res) {
  492. if (res.data.list.length) {
  493. that.model.priority = res.data.list[0].priority.id;
  494. }
  495. });
  496. }
  497. }
  498. }
  499. },
  500. {
  501. type: "select",
  502. modelKey: "emergency",
  503. label: "紧急度:",
  504. props: {
  505. options: this.emergencyArr,
  506. title: "请选择紧急度",
  507. placeholder: "请选择紧急度"
  508. },
  509. rules: {
  510. required: false
  511. },
  512. events: {
  513. change: (value, index, text) => {
  514. console.log(value, index, text);
  515. console.log(this.model);
  516. var that = this;
  517. if (this.model.influence) {
  518. this.$http
  519. .post("service/bpm/data/fetchDataList/prioritymatrix", {
  520. idx: 0,
  521. sum: 1000,
  522. prioritymatrix: {
  523. emergency: { id: this.model.emergency },
  524. influence: { id: this.model.influence }
  525. }
  526. })
  527. .then(function(res) {
  528. console.log(res.data);
  529. if (res.data.list.length) {
  530. that.model.priority = res.data.list[0].priority.id;
  531. }
  532. });
  533. }
  534. }
  535. }
  536. },
  537. {
  538. type: "select",
  539. modelKey: "priority",
  540. label: "优先级:",
  541. props: {
  542. options: this.priorityArr,
  543. title: "请选择优先级",
  544. placeholder: "请选择优先级"
  545. },
  546. rules: {
  547. required: true
  548. }
  549. },
  550. {
  551. type: "select",
  552. modelKey: "handleCategory",
  553. label: "处理方式:",
  554. props: {
  555. options: this.handleCategoryArr,
  556. title: "请选择处理方式",
  557. placeholder: "请选择处理方式"
  558. },
  559. rules: {
  560. required: true
  561. }
  562. },
  563. {
  564. type: "select",
  565. modelKey: "closecode",
  566. label: "关闭代码:",
  567. props: {
  568. options: this.closecodeArr,
  569. title: "请选择关闭代码",
  570. placeholder: "请选择关闭代码"
  571. },
  572. rules: {
  573. required: true
  574. }
  575. },
  576. {
  577. type: "textarea",
  578. modelKey: "handleDescription",
  579. label: "处理方案:",
  580. props: {
  581. placeholder: "请填写处理方案"
  582. },
  583. rules: {
  584. required: true
  585. },
  586. debounce: 100
  587. },
  588. {
  589. type: "switch",
  590. modelKey: "knowledge",
  591. label: "是否提交知识库:",
  592. rules: {
  593. required: false
  594. }
  595. },
  596. {
  597. component: solution,
  598. modelKey: "solutionType",
  599. label: "知识库类型:",
  600. rules: {
  601. required: true
  602. },
  603. messages: {
  604. required: ""
  605. }
  606. },
  607. {
  608. type: "switch",
  609. modelKey: "handleUserOrGroup",
  610. label: "是否选择处理人:",
  611. rules: {
  612. required: false
  613. }
  614. },
  615. {
  616. type: "select",
  617. modelKey: "handlerUser",
  618. label: "处理人:",
  619. props: {
  620. options: this.handlerUserArr,
  621. title: "请选择处理人",
  622. placeholder: "请选择处理人"
  623. },
  624. rules: {
  625. required: true
  626. }
  627. },
  628. {
  629. type: "select",
  630. modelKey: "candidateGroups",
  631. label: "处理组:",
  632. props: {
  633. options: this.candidateGroupsArr,
  634. title: "请选择处理组",
  635. placeholder: "请选择处理组"
  636. },
  637. rules: {
  638. required: true
  639. }
  640. },
  641. {
  642. type: "select",
  643. modelKey: "address",
  644. label: "故障地点:",
  645. props: {
  646. options: this.faultLocationList,
  647. title: "请选择故障地点",
  648. placeholder: "请选择故障地点"
  649. },
  650. rules: {
  651. required: true
  652. }
  653. },
  654. {
  655. type: "select",
  656. modelKey: "requester",
  657. label: "报修科室:",
  658. props: {
  659. options: this.requesterList,
  660. title: "请选择报修科室",
  661. placeholder: "请选择报修科室"
  662. },
  663. rules: {
  664. required: true
  665. }
  666. },
  667. {
  668. type: "input",
  669. modelKey: "contacts",
  670. label: "联系人:",
  671. props: {
  672. placeholder: "请输入联系人"
  673. },
  674. rules: {
  675. required: false
  676. }
  677. },
  678. {
  679. type: "input",
  680. modelKey: "assetId",
  681. label: "资产:",
  682. rules: {
  683. required: false
  684. },
  685. props: {
  686. placeholder: "请选择资产",
  687. disabled: true
  688. }
  689. },
  690. {
  691. type: "select",
  692. modelKey: "room",
  693. label: "房间号",
  694. props: {
  695. placeholder: "请选择房间号",
  696. options: []
  697. },
  698. rules: {
  699. required: false
  700. }
  701. },
  702. {
  703. type: "select",
  704. modelKey: "branch",
  705. label: "院区:",
  706. props: {
  707. options: this.branchList,
  708. title: "请选择院区",
  709. placeholder: "请选择院区"
  710. },
  711. rules: {
  712. required: true
  713. }
  714. },
  715. ]
  716. };
  717. },
  718. methods: {
  719. // 切换处理方式
  720. changeHandleTypes() {
  721. let reverseArr = this.model.category.filter(Boolean).reverse(); //数组翻转,取第一项不为空的
  722. let sjId = reverseArr[0]; //事件Id baba
  723. let sj = this.initSjList ? this.initSjList.filter(v => v.id == sjId)[0] : null;
  724. console.log(this.order, sj);
  725. this.isShowDes = !(this.order == 1 && sj && sj.hasSimple == 1);
  726. },
  727. //扫资产
  728. scan() {
  729. SM(this).then(ress1 => {
  730. this.model.assetId = ress1;
  731. });
  732. },
  733. // 输入故障描述
  734. inpTitle() {
  735. this.model.title = this.incidentTitle;
  736. },
  737. // 快速定位
  738. toInfo(id) {
  739. this.label = id;
  740. $("body,html").animate(
  741. {
  742. scrollTop:
  743. $("#" + id).offset().top -
  744. $(".header")[0].offsetHeight -
  745. $(".navBar")[0].offsetHeight
  746. },
  747. 260
  748. );
  749. },
  750. subVali() {
  751. this.vali = true;
  752. },
  753. // 获取事件单号
  754. getsjnum() {
  755. var that = this;
  756. this.$http.get("service/bpm/bpm/restful/sj", {}).then(function(res) {
  757. that.modelData.incident.incidentsign = res.data.data;
  758. });
  759. },
  760. // 获取事件来源
  761. getSource() {
  762. var that = this;
  763. this.$http
  764. .post("service/common/common/getDictionary", {
  765. key: "incident_source",
  766. type: "list"
  767. })
  768. .then(function(res) {
  769. res.data.forEach(function(v, i) {
  770. that.sourceArr.push({
  771. text: v.name,
  772. value: v.id
  773. });
  774. });
  775. that.fields[5].props.options = that.sourceArr;
  776. });
  777. },
  778. // 获取优先级
  779. getPriority() {
  780. var that = this;
  781. this.$http
  782. .post("service/common/common/getDictionary", {
  783. key: "incident_priority",
  784. type: "list"
  785. })
  786. .then(function(res) {
  787. res.data.forEach(function(v, i) {
  788. that.priorityArr.push({
  789. text: v.name,
  790. value: v.id
  791. });
  792. });
  793. that.fields[10].props.options = that.priorityArr;
  794. });
  795. },
  796. // 获取紧急度
  797. getMergency() {
  798. var that = this;
  799. this.$http
  800. .post("service/common/common/getDictionary", {
  801. key: "incident_emergency",
  802. type: "list"
  803. })
  804. .then(function(res) {
  805. res.data.forEach(function(v, i) {
  806. that.emergencyArr.push({
  807. text: v.name,
  808. value: v.id
  809. });
  810. });
  811. that.fields[9].props.options = that.emergencyArr;
  812. });
  813. },
  814. // 获取影响度
  815. getInfluence() {
  816. var that = this;
  817. this.$http
  818. .post("service/common/common/getDictionary", {
  819. key: "incident_influence",
  820. type: "list"
  821. })
  822. .then(function(res) {
  823. res.data.forEach(function(v, i) {
  824. that.influenceArr.push({
  825. text: v.name,
  826. value: v.id
  827. });
  828. });
  829. that.fields[8].props.options = that.influenceArr;
  830. });
  831. },
  832. // 获取处理方式
  833. getHandleCategory() {
  834. var that = this;
  835. this.$http
  836. .post("service/common/common/getDictionary", {
  837. key: "incident_handleCategory",
  838. type: "list"
  839. })
  840. .then(function(res) {
  841. res.data.forEach(function(v, i) {
  842. that.handleCategoryArr.push({
  843. text: v.name,
  844. value: v.id
  845. });
  846. });
  847. that.fields[11].props.options = that.handleCategoryArr;
  848. });
  849. },
  850. // 获取关闭代码
  851. getClosecode() {
  852. var that = this;
  853. this.$http
  854. .post("service/common/common/getDictionary", {
  855. key: "incident_closecode",
  856. type: "list"
  857. })
  858. .then(function(res) {
  859. res.data.forEach(function(v, i) {
  860. that.closecodeArr.push({
  861. text: v.desc,
  862. value: v.id
  863. });
  864. });
  865. that.fields[12].props.options = that.closecodeArr;
  866. });
  867. },
  868. // 获取处理人
  869. getHandlerUser() {
  870. var that = this;
  871. let postData = {
  872. idx: 0,
  873. sum: 1000,
  874. user: {
  875. roledata: { rolecode: "first-line support" },
  876. selectType: "1"
  877. }
  878. };
  879. // 当前所属院区或责任科室
  880. if(this.loginUser.duty){
  881. postData.user = { duty: this.loginUser.duty };
  882. }else if(this.loginUser.branch){
  883. postData.user = { branch: this.loginUser.branch }
  884. }
  885. this.$http
  886. .post("service/user/data/fetchDataList/user", postData)
  887. .then(function(res) {
  888. res.data.list.forEach(function(v, i) {
  889. that.handlerUserArr.push({
  890. text: v.name,
  891. value: v.id
  892. });
  893. });
  894. that.fields[17].props.options = that.handlerUserArr;
  895. });
  896. },
  897. // 获取处理组
  898. getCandidateGroups() {
  899. var that = this;
  900. this.$http
  901. .post("service/user/data/fetchDataList/group", {
  902. idx: 0,
  903. sum: 1000,
  904. group: { selectType: "nouser" }
  905. })
  906. .then(function(res) {
  907. res.data.list.forEach(function(v, i) {
  908. that.candidateGroupsArr.push({
  909. text: v.groupName,
  910. value: v.id
  911. });
  912. });
  913. that.fields[18].props.options = that.candidateGroupsArr;
  914. });
  915. },
  916. // 暂时存值
  917. setLocalStroageData() {
  918. var that = this;
  919. var a1 = [],
  920. a2 = [],
  921. category = [],
  922. solutionType = [];
  923. that.model.category.forEach(function(v, i) {
  924. if (v) {
  925. a1.push(v);
  926. }
  927. });
  928. category = a1;
  929. that.model.solutionType.forEach(function(v, i) {
  930. if (v) {
  931. a2.push(v);
  932. }
  933. });
  934. solutionType = a2;
  935. if (that.model.placeValue.length == 2) {
  936. that.model.areaId =
  937. that.model.placeValue[that.model.placeValue.length - 2];
  938. that.model.placeId =
  939. that.model.placeValue[that.model.placeValue.length - 1];
  940. } else if (that.model.placeValue.length == 1) {
  941. that.model.areaId =
  942. that.model.placeValue[that.model.placeValue.length - 1];
  943. that.model.placeId = "";
  944. }
  945. // that.modelData.incident.houseNumber = that.model.address[0];
  946. that.modelData.incident["repairType"] = that.valConfig;
  947. if (that.valConfig == 1) {
  948. // that.modelData.incident.requester = that.loginUser;
  949. // that.modelData.incident.account = that.loginUser.account;
  950. // that.modelData.requestershow = that.loginUser;
  951. } else if (that.valConfig == 2) {
  952. that.modelData.incident.branch = that.model.branch;
  953. if(that.$route.query.id){
  954. that.modelData.incident.department = {id: +that.$route.query.id};
  955. }
  956. }
  957. if (that.wxIncidentWithCmdb == 1) {
  958. that.modelData.incident.assetId = that.model.assetId;
  959. }
  960. that.modelData.incident.area = { id: that.model.areaId };
  961. that.modelData.incident.place = { id: that.model.placeId };
  962. that.modelData.incident.category = {
  963. id: category[category.length - 1]
  964. };
  965. that.modelData.initUser = that.loginUser.id;
  966. that.modelData.loginUser = that.loginUser;
  967. that.modelData.fromWeChat = true;
  968. that.modelData.incident.contactsInformation =
  969. that.model.contactsInformation;
  970. that.modelData.incident.contacts = that.model.contacts;
  971. that.modelData.incident.houseNumber = that.model.houseNumber;
  972. if (that.ifRoom == 1) {
  973. that.modelData.incident.room = { id: that.model.room };
  974. }
  975. that.modelData.incident.acceptUser = that.loginUser;
  976. // that.modelData.incident.requester = {};
  977. that.modelData.incident.handlingPersonnelUser = { id: that.loginUser.id };
  978. that.modelData.incident.source = { id: that.model.source };
  979. that.modelData.incident.title = that.model.title;
  980. that.modelData.incident.description = that.model.description;
  981. // that.modelData.incident.emergency = { id: that.model.emergency };
  982. // that.modelData.incident.influence = { id: that.model.influence };
  983. if(that.model.priority){
  984. that.modelData.incident.priority = { id: that.model.priority };
  985. }
  986. that.modelData.incident.alarmType = false;
  987. if (that.order == 1) {
  988. // 直接处理
  989. that.modelData.handler_code = "resolve";
  990. that.modelData.start_code = "close";
  991. that.modelData.incident.directProcess = 1;
  992. that.modelData.incident.handleDescription =
  993. that.model.handleDescription;
  994. that.modelData.incident.handleCategory = {
  995. id: that.model.handleCategory
  996. };
  997. that.modelData.incident.closecode = { id: that.model.closecode };
  998. that.modelData.bpm_activiti = {
  999. solutionType: {
  1000. id: solutionType[solutionType.length - 1]
  1001. }
  1002. };
  1003. that.modelData.isSolution = that.model.knowledge;
  1004. } else if (that.order == 2) {
  1005. // 派单
  1006. that.modelData.start_code = "assignment";
  1007. if (that.model.handleUserOrGroup) {
  1008. // 处理人
  1009. that.modelData.assignee = that.model.handlerUser;
  1010. that.modelData.incident.handlingPersonnelUser = {
  1011. id: that.model.handlerUser
  1012. };
  1013. } else {
  1014. // 处理组
  1015. that.modelData.candidateGroups = that.model.candidateGroups;
  1016. if (that.modelData.assignee) {
  1017. delete that.modelData.assignee;
  1018. }
  1019. if (that.modelData.incident.handlerUser) {
  1020. delete that.modelData.incident.handlerUser;
  1021. }
  1022. }
  1023. if (that.modelData.incident.handlingPersonnelUser) {
  1024. delete that.modelData.incident.handlingPersonnelUser;
  1025. }
  1026. if (that.modelData.incident.handleDescription) {
  1027. delete that.modelData.incident.handleDescription;
  1028. }
  1029. if (that.modelData.incident.closecode) {
  1030. delete that.modelData.incident.closecode;
  1031. }
  1032. if (that.modelData.incident.degree) {
  1033. delete that.modelData.incident.degree;
  1034. }
  1035. if (that.modelData.isSolution) {
  1036. delete that.modelData.isSolution;
  1037. }
  1038. }
  1039. console.log(that.modelData);
  1040. that.model.fileUrl = "url";
  1041. that.loadShow = true;
  1042. },
  1043. // 获取页面数据
  1044. getMessage() {
  1045. var that = this;
  1046. if (that.$route.params.data) {
  1047. var inspecInfo = that.$route.params.data;
  1048. // 巡检生成事件
  1049. if (that.wxIncidentWithCmdb == 1) {
  1050. that.model.assetId = inspecInfo.assetId;
  1051. }
  1052. console.log(that.$route.params.abnormal);
  1053. that.model.contacts = inspecInfo.processUser.name;
  1054. that.model.contactsInformation = inspecInfo.processUser.phone
  1055. ? inspecInfo.processUser.phone
  1056. : "";
  1057. that.order = 2;
  1058. that.model.handleUserOrGroup = true;
  1059. that.model.source = 1552; //巡检生成事件来源默认为其他
  1060. // 处理人
  1061. if (inspecInfo.handlerUser) {
  1062. that.model.handlerUser = inspecInfo.handlerUser.id;
  1063. }
  1064. // that.modelData.incident.handlingPersonnelUser = {
  1065. // id: that.model.handlerUser
  1066. // };
  1067. if (that.$route.params.abnormal) {
  1068. that.model.description = that.modelData.incident.description =
  1069. that.$route.params.abnormal;
  1070. }
  1071. } else {
  1072. // that.name = that.loginUser.name;
  1073. // that.model.contactsInformation = that.loginUser.phone;
  1074. // that.model.contacts = that.loginUser.name;
  1075. // that.model.houseNumber = that.loginUser.houseNumber;
  1076. }
  1077. // if (that.loginUser.place && that.loginUser.place.length) {
  1078. // if (that.loginUser.place.id) {
  1079. // if (that.loginUser.place.area) {
  1080. // that.model.placeValue[0] = that.loginUser.place.area.id;
  1081. // }
  1082. // that.model.placeValue[1] = that.loginUser.place.id;
  1083. // }
  1084. // }
  1085. if (localStorage.getItem("model")) {
  1086. that.model = JSON.parse(localStorage.getItem("model"));
  1087. that.incidentTitle = that.model.title;
  1088. }
  1089. if (localStorage.getItem("modelData")) {
  1090. that.modelData = JSON.parse(localStorage.getItem("modelData"));
  1091. }
  1092. if (localStorage.getItem("order")) {
  1093. that.order = localStorage.getItem("order") - 0;
  1094. }
  1095. },
  1096. // 提交
  1097. submitHandler() {
  1098. $("#fade").fadeOut();
  1099. var that = this;
  1100. if (that.valConfig == 2) {
  1101. if(that.model.duty){
  1102. that.modelData.incident.duty = that.model.duty
  1103. }else{
  1104. let categoryId = this.model.category.slice(-1)[0];
  1105. let category = this.initSjList.find(v => v.id == categoryId);
  1106. this.$createDialog({
  1107. type: "alert",
  1108. title: "校验失败",
  1109. content: "故障现象【"+ category.category +"】没有设置责任科室!",
  1110. icon: "cubeic-wrong"
  1111. }).show();
  1112. return;
  1113. }
  1114. }
  1115. that.setLocalStroageData();
  1116. if (that.selectHouseNumber && that.selectHouseNumber.place) {
  1117. that.modelData.incident.place = that.selectHouseNumber;
  1118. }
  1119. console.log(
  1120. that.modelData,
  1121. that.selectHouseNumber,
  1122. "2020年4月25日14:09:29"
  1123. );
  1124. console.log(that.modelData.incident.category.id, this.initSjList, "事件");
  1125. if (
  1126. this.order == 1 &&
  1127. (this.integralMechanism == 1 ||
  1128. (this.integralMechanism == 2 && this.loginUser.userType.value == 2))
  1129. ) {
  1130. // 直接处理,积分机制
  1131. let category = this.initSjList.find(
  1132. v => v.id == this.modelData.incident.category.id
  1133. );
  1134. this.$refs.seiminModel.show({
  1135. category,
  1136. type: "now",
  1137. btns: [
  1138. {
  1139. click: () => {
  1140. this.loadShow = false;
  1141. this.$refs.seiminModel.close();
  1142. }
  1143. },
  1144. {
  1145. click: () => {
  1146. if (!this.$refs.seiminModel.complexity) {
  1147. this.$createDialog({
  1148. type: "alert",
  1149. title: "操作失败",
  1150. content: "请选择工时!",
  1151. icon: "cubeic-wrong"
  1152. }).show();
  1153. return;
  1154. }
  1155. if (this.$refs.seiminModel.complexitySource != this.$refs.seiminModel.complexity && !this.$refs.seiminModel.updateReason.trim()) {
  1156. this.$createDialog({
  1157. type: "alert",
  1158. title: "操作失败",
  1159. content: "请填写升级原因!",
  1160. icon: "cubeic-wrong"
  1161. }).show();
  1162. return;
  1163. }
  1164. this.$refs.seiminModel.close();
  1165. console.log("确定");
  1166. this.handlerFn();
  1167. }
  1168. }
  1169. ]
  1170. });
  1171. } else {
  1172. this.handlerFn();
  1173. }
  1174. event.preventDefault();
  1175. },
  1176. commonFn() {
  1177. let that = this;
  1178. $("#fade").fadeIn();
  1179. that.promptingConent = "恭喜您,新建报修成功!";
  1180. that.promptingStatus = true;
  1181. that.dialog = that
  1182. .$createDialog({
  1183. type: "alert",
  1184. title: "新建成功",
  1185. content: "点击返回首页",
  1186. icon: "cubeic-right",
  1187. onConfirm: (e, promptValue) => {
  1188. that.$router.push({ path: "/main" });
  1189. }
  1190. })
  1191. .show();
  1192. localStorage.removeItem("model");
  1193. localStorage.removeItem("modelData");
  1194. localStorage.removeItem("solution");
  1195. localStorage.removeItem("order");
  1196. setTimeout(function() {
  1197. $("#fade").fadeOut();
  1198. }, 2000);
  1199. },
  1200. handlerFn() {
  1201. let that = this;
  1202. that.$http
  1203. .post("service/bpm/bpm/start/bpm_incident", that.modelData)
  1204. .then(res => {
  1205. if (res.data) {
  1206. that.action.target = that.action.target + res.data.id;
  1207. that.action1.target = that.action1.target + res.data.id;
  1208. setTimeout(function() {
  1209. that.$refs.upload.start();
  1210. if (that.order == 1) {
  1211. that.$refs.upload1.start();
  1212. }
  1213. }, 100);
  1214. if (
  1215. this.order == 1 &&
  1216. (this.integralMechanism == 1 ||
  1217. (this.integralMechanism == 2 &&
  1218. this.loginUser.userType.value == 2))
  1219. ) {
  1220. this.$http
  1221. .post("service/common/common/getDictionary", {
  1222. key: "incident_integral_state",
  1223. type: "list"
  1224. })
  1225. .then(result => {
  1226. result = result.data;
  1227. let auditState = result.find(v => v.value == 0);
  1228. let postData = {
  1229. incidentIntegral: {
  1230. incidentId: res.data.bussId,
  1231. auditState: auditState,
  1232. handlerUser: this.loginUser.id,
  1233. handlerUserName: this.loginUser.name,
  1234. sourceScore: this.$refs.seiminModel.complexitySource,
  1235. currentScore: this.$refs.seiminModel.complexity,
  1236. updateReason:
  1237. this.$refs.seiminModel.updateReason.trim() || undefined
  1238. }
  1239. };
  1240. this.$http
  1241. .post("service/bpm/data/addData/incidentIntegral", postData)
  1242. .then(result1 => {
  1243. if (result1.data.status == 200) {
  1244. this.commonFn();
  1245. } else {
  1246. this.$createDialog({
  1247. type: "alert",
  1248. title: "系统错误,请稍后再试!",
  1249. content: "",
  1250. icon: "cubeic-wrong"
  1251. }).show();
  1252. }
  1253. });
  1254. });
  1255. } else {
  1256. this.commonFn();
  1257. }
  1258. } else {
  1259. $("#fade").fadeIn();
  1260. that.promptingConent = "系统错误,请稍后再试!";
  1261. that.promptingStatus = false;
  1262. that.loadShow = false;
  1263. that.dialog = that
  1264. .$createDialog({
  1265. type: "alert",
  1266. title: "系统错误,请稍后再试!",
  1267. content: "点击返回首页",
  1268. icon: "cubeic-wrong",
  1269. onConfirm: (e, promptValue) => {
  1270. that.$router.push({ path: "/main" });
  1271. }
  1272. })
  1273. .show();
  1274. setTimeout(function() {
  1275. $("#fade").fadeOut();
  1276. }, 2000);
  1277. }
  1278. });
  1279. },
  1280. validateHandler(result) {
  1281. console.log(result);
  1282. this.resule = result;
  1283. var that = this;
  1284. that.validity = result.validity;
  1285. that.valid = result.valid;
  1286. },
  1287. dateSelectHandler(selectedVal) {
  1288. this.model.dateValue = new Date(
  1289. selectedVal[0],
  1290. selectedVal[1] - 1,
  1291. selectedVal[2]
  1292. ).toDateString();
  1293. },
  1294. filesAdded(files) {
  1295. let hasIgnore = false;
  1296. const maxSize = 1000 * 1024 * 1024; // 1M
  1297. for (let k in files) {
  1298. const file = files[k];
  1299. if (file.size > maxSize) {
  1300. file.ignore = true;
  1301. hasIgnore = true;
  1302. }
  1303. }
  1304. hasIgnore &&
  1305. this.$createToast({
  1306. type: "warn",
  1307. time: 1000,
  1308. txt: "不能上传超过100M的文件"
  1309. }).show();
  1310. },
  1311. filesAdded1(files) {
  1312. let hasIgnore = false;
  1313. const maxSize = 1000 * 1024 * 1024; // 1M
  1314. for (let k in files) {
  1315. const file = files[k];
  1316. if (file.size > maxSize) {
  1317. file.ignore = true;
  1318. hasIgnore = true;
  1319. }
  1320. }
  1321. hasIgnore &&
  1322. this.$createToast({
  1323. type: "warn",
  1324. time: 1000,
  1325. txt: "不能上传超过100M的文件"
  1326. }).show();
  1327. },
  1328. fileSubmitted(files) {
  1329. this.action.data = { fileName: files.name };
  1330. },
  1331. fileSubmitted1(files) {
  1332. this.action1.data = { fileName: files.name };
  1333. },
  1334. // 展示故障现象选择器
  1335. showCategoryPicker() {
  1336. this.categoryPicker.show();
  1337. },
  1338. // 选择故障现象
  1339. selectCategoryHandler(selectedVal, selectedIndex, selectedTxt) {
  1340. // console.log(this.initSjList, "故障现象列表");
  1341. // console.log(this.model.category.slice(-1)[0], "故障现象");
  1342. var selected = [];
  1343. selectedTxt.forEach(function(v, i) {
  1344. if (v != "") {
  1345. selected.push(v);
  1346. }
  1347. });
  1348. this.selectedCategoryTxt = this.model.title = this.model.description = this.incidentTitle =
  1349. selected[selected.length - 1];
  1350. this.model.category = selectedVal;
  1351. if(this.model.category.length){
  1352. let category = this.initSjList.find(v => v.id == this.model.category.slice(-1)[0]);
  1353. if(category && category.priority){
  1354. // 回显优先级
  1355. this.model.priority = category.priority.id;
  1356. }
  1357. // 选择了院区,科室,故障现象,责任科室
  1358. this.showUserOrGroup();
  1359. // 处理责任科室数据
  1360. this.handlerDuty();
  1361. }
  1362. // ----------------------回显其他数据---------------------
  1363. // console.log(selectedVal, "seimin");
  1364. // let reverseArr = selectedVal.filter(Boolean).reverse(); //数组翻转,取第一项不为空的
  1365. // let sjId = reverseArr[0]; //事件Id
  1366. // let sj = this.initSjList.filter(v => v.id == sjId)[0];
  1367. // console.log(sj);
  1368. // this.model.priority = sj.priority?sj.priority.id:null;
  1369. // if (sj.branchType == 0) {
  1370. // if (sj.userOrGroupType === 1) {
  1371. // //派人
  1372. // this.order = 2;
  1373. // this.model.handleUserOrGroup = true;
  1374. // this.model.handlerUser = sj.handleUser ? sj.handleUser.id : "";
  1375. // } else if (sj.userOrGroupType === 2) {
  1376. // //派组
  1377. // this.order = 2;
  1378. // this.model.handleUserOrGroup = false;
  1379. // this.model.candidateGroups = sj.group ? sj.group.id : "";
  1380. // } else {
  1381. // this.order = 1;
  1382. // this.model.handleUserOrGroup = false;
  1383. // this.model.handlerUser = "";
  1384. // this.model.candidateGroups = "";
  1385. // }
  1386. // } else if (sj.branchType == 1) {
  1387. // // 分院区
  1388. // let areaId = this.model.placeValue[0]; //区域id
  1389. // console.log(this.initAreaList);
  1390. // if (areaId) {
  1391. // // 选择了区域
  1392. // let areaObj = this.initAreaList.find(v => v.id == areaId);
  1393. // if (areaObj) {
  1394. // let branchId = areaObj.branch;
  1395. // let branchUserGroup =
  1396. // sj.branchUserGroups.find(v => v.branchId == branchId) || {};
  1397. // if (branchUserGroup.branchUserOrGroupType == 1) {
  1398. // //派人
  1399. // this.order = 2;
  1400. // this.model.handleUserOrGroup = true;
  1401. // this.model.handlerUser = branchUserGroup.userId
  1402. // ? branchUserGroup.userId
  1403. // : undefined;
  1404. // } else if (branchUserGroup.branchUserOrGroupType === 2) {
  1405. // //派组
  1406. // this.order = 2;
  1407. // this.model.handleUserOrGroup = false;
  1408. // this.model.candidateGroups = branchUserGroup.groupId
  1409. // ? branchUserGroup.groupId
  1410. // : undefined;
  1411. // } else {
  1412. // this.order = 1;
  1413. // this.model.handleUserOrGroup = false;
  1414. // this.model.handlerUser = "";
  1415. // this.model.candidateGroups = "";
  1416. // }
  1417. // } else {
  1418. // this.order = 1;
  1419. // this.model.handleUserOrGroup = false;
  1420. // this.model.handlerUser = "";
  1421. // this.model.candidateGroups = "";
  1422. // }
  1423. // } else {
  1424. // this.order = 1;
  1425. // this.model.handleUserOrGroup = false;
  1426. // this.model.handlerUser = "";
  1427. // this.model.candidateGroups = "";
  1428. // }
  1429. // }
  1430. // console.log(this.order, sj.hasSimple);
  1431. // if (this.order == 1 && sj.hasSimple == 1) {
  1432. // // 直接处理 && 简单处理
  1433. // this.isShowDes = false;
  1434. // } else {
  1435. // this.isShowDes = true;
  1436. // }
  1437. // ----------------------回显其他数据---------------------
  1438. },
  1439. // 故障现象
  1440. getIncidentcategory() {
  1441. this.loadShow = true;
  1442. var that = this;
  1443. let postData = {
  1444. idx: 0,
  1445. sum: 9999,
  1446. };
  1447. // 当前所属院区或责任科室
  1448. if(this.loginUser.duty){
  1449. postData.incidentcategory = { duty: this.loginUser.duty.id };
  1450. }else if(this.loginUser.branch){
  1451. postData.incidentcategory = { branch: this.loginUser.branch.id }
  1452. }
  1453. this.$http
  1454. .post("service/bpm/data/fetchDataList/incidentcategory", postData)
  1455. .then(function(res) {
  1456. that.initSjList = JSON.parse(JSON.stringify(res.data.list));
  1457. var list = res.data.list;
  1458. var tree = [];
  1459. list.forEach((v, i) => {
  1460. if (!v.parent) {
  1461. tree[i] = {
  1462. value: v.id,
  1463. text: v.category,
  1464. children: []
  1465. };
  1466. } else {
  1467. tree.forEach((val, idx) => {
  1468. if (
  1469. v.parent &&
  1470. !v.parent.parent &&
  1471. val.text == v.parent.category
  1472. ) {
  1473. tree[idx].children.push({
  1474. value: v.id,
  1475. text: v.category,
  1476. children: []
  1477. });
  1478. } else if (v.parent.parent) {
  1479. tree[idx].children.forEach((value, index) => {
  1480. if (value.text == v.parent.category) {
  1481. tree[idx].children[index].children.push({
  1482. value: v.id,
  1483. text: v.category
  1484. });
  1485. }
  1486. });
  1487. }
  1488. });
  1489. }
  1490. });
  1491. that.selectData = tree;
  1492. that.categoryPicker = that.$createCascadePicker({
  1493. title: "故障现象选择",
  1494. data: that.selectData,
  1495. selectedIndex:[0, 0, 0],
  1496. onSelect: that.selectCategoryHandler
  1497. });
  1498. that.loadShow = false;
  1499. });
  1500. },
  1501. getRoomData(placeId) {
  1502. this.$http
  1503. .post("service/user/data/fetchDataList/room", {
  1504. idx: 0,
  1505. sum: 1000,
  1506. room: { place: { id: placeId } }
  1507. })
  1508. .then(result => {
  1509. let arr = [];
  1510. result.data.list = result.data.list || [];
  1511. result.data.list.forEach(item => {
  1512. arr.push({ value: item.id, text: item.room });
  1513. });
  1514. this.fields.forEach(item => {
  1515. // 初始化房间号下拉框列表
  1516. if (item.modelKey == "room") {
  1517. item.props.options = arr;
  1518. }
  1519. });
  1520. });
  1521. },
  1522. // 区域地点
  1523. showPlacePicker() {
  1524. this.placePicker.show();
  1525. },
  1526. selectPlaceHandler(selectedVal, selectedIndex, selectedTxt) {
  1527. console.log(selectedVal, selectedIndex, selectedTxt);
  1528. console.log(selectedVal[0], "区域");
  1529. console.log(this.initSjList, "故障现象列表");
  1530. console.log(this.model.category.slice(-1)[0], "故障现象");
  1531. if (this.ifRoom == 1) {
  1532. this.getRoomData(selectedVal[1]);
  1533. }
  1534. this.model.placeValue = selectedVal;
  1535. this.selectedPlaceTxt = selectedTxt.join(" ");
  1536. // 分院区
  1537. // --------------------start---------------------
  1538. let categoryId = this.model.category.slice(-1)[0];
  1539. if (categoryId) {
  1540. // 选择了故障现象
  1541. let categoryObj = this.initSjList.find(v => v.id == categoryId);
  1542. if (categoryObj) {
  1543. if (categoryObj.branchType == 1) {
  1544. // 分院区开关打开的情况下
  1545. let areaId = this.model.placeValue[0]; //区域id
  1546. let areaObj = this.initAreaList.find(v => v.id == areaId);
  1547. let branchId = areaObj.branch;
  1548. let branchUserGroup =
  1549. categoryObj.branchUserGroups.find(v => v.branchId == branchId) ||
  1550. {};
  1551. if (branchUserGroup.branchUserOrGroupType == 1) {
  1552. //派人
  1553. this.order = 2;
  1554. this.model.handleUserOrGroup = true;
  1555. this.model.handlerUser = branchUserGroup.userId
  1556. ? branchUserGroup.userId
  1557. : undefined;
  1558. } else if (branchUserGroup.branchUserOrGroupType === 2) {
  1559. //派组
  1560. this.order = 2;
  1561. this.model.handleUserOrGroup = false;
  1562. this.model.candidateGroups = branchUserGroup.groupId
  1563. ? branchUserGroup.groupId
  1564. : undefined;
  1565. } else {
  1566. this.order = 1;
  1567. this.model.handleUserOrGroup = false;
  1568. this.model.handlerUser = "";
  1569. this.model.candidateGroups = "";
  1570. }
  1571. } else {
  1572. this.order = 1;
  1573. this.model.handleUserOrGroup = false;
  1574. this.model.handlerUser = "";
  1575. this.model.candidateGroups = "";
  1576. }
  1577. } else {
  1578. this.order = 1;
  1579. this.model.handleUserOrGroup = false;
  1580. this.model.handlerUser = "";
  1581. this.model.candidateGroups = "";
  1582. }
  1583. } else {
  1584. this.order = 1;
  1585. this.model.handleUserOrGroup = false;
  1586. this.model.handlerUser = "";
  1587. this.model.candidateGroups = "";
  1588. }
  1589. // --------------------end---------------------
  1590. },
  1591. // 跳转到报修科室搜索页面
  1592. toSearchDept() {
  1593. this.$router.push(`/searchDept?type=searchDept`);
  1594. },
  1595. getAreaData(branchId) {
  1596. this.$http
  1597. .post("service/user/data/fetchDataList/area", {
  1598. idx: 0,
  1599. sum: 9999,
  1600. area: {
  1601. branch: branchId,
  1602. }
  1603. })
  1604. .then(res => {
  1605. this.initAreaList = JSON.parse(JSON.stringify(res.data.list));
  1606. var data = res.data.list;
  1607. for (var i = 0; i < data.length; i++) {
  1608. this.placeSelectData.push({
  1609. text: data[i].area,
  1610. value: data[i].id,
  1611. children: []
  1612. });
  1613. }
  1614. this.getPlaceData(branchId);
  1615. });
  1616. },
  1617. getPlaceData(branchId) {
  1618. this.$http
  1619. .post("service/user/data/fetchDataList/place", {
  1620. idx: 0,
  1621. sum: 9999,
  1622. area: {
  1623. branch: branchId,
  1624. }
  1625. })
  1626. .then((res) => {
  1627. var data = res.data.list;
  1628. for (var i = 0; i < data.length; i++) {
  1629. for (var j = 0; j < this.placeSelectData.length; j++) {
  1630. if (data[i].area.id == this.placeSelectData[j].value) {
  1631. this.placeSelectData[j].children.push({
  1632. text: data[i].place,
  1633. value: data[i].id
  1634. });
  1635. }
  1636. }
  1637. }
  1638. console.log(this.initAreaList, data);
  1639. console.log(this.placeSelectData);
  1640. this.placePicker = this.$createCascadePicker({
  1641. title: "区域地点选择",
  1642. data: this.placeSelectData,
  1643. selectedIndex: [0, 0],
  1644. onSelect: this.selectPlaceHandler
  1645. });
  1646. });
  1647. },
  1648. // 获取院区列表
  1649. getBranchList() {
  1650. this.$http
  1651. .post("service/user/data/fetchDataList/branch", {
  1652. idx: 0,
  1653. sum: 9999,
  1654. })
  1655. .then((res) => {
  1656. res.data.list.forEach((v) => {
  1657. this.branchList.push({
  1658. text: v.hosName,
  1659. value: v.id
  1660. });
  1661. });
  1662. this.fields[24].props.options = this.branchList;
  1663. });
  1664. },
  1665. // 回显处理人或组
  1666. showUserOrGroup(){
  1667. this.order = 2;
  1668. this.model.handleUserOrGroup = true;
  1669. this.model.handlerUser = this.loginUser.id;
  1670. },
  1671. // 处理顶部责任科室数据
  1672. handlerDuty(){
  1673. console.log(this.model.category)
  1674. if(!this.model.category.length){
  1675. return;
  1676. }
  1677. let categoryId = this.model.category.slice(-1)[0];
  1678. let category = this.initSjList.find(v => v.id == categoryId);
  1679. if(category.branchType == 1){
  1680. // 分院区
  1681. if(this.model.branch){
  1682. var dutyConfig = category.branchUserGroups.find(v=>v.branchId == this.model.branch);
  1683. if(dutyConfig && dutyConfig.dutyId && dutyConfig.dutyName){
  1684. this.model.duty = {id:dutyConfig.dutyId,dept:dutyConfig.dutyName};
  1685. }else{
  1686. this.model.duty = null;
  1687. }
  1688. }else{
  1689. this.model.duty = null;
  1690. }
  1691. }else{
  1692. // 不分院区
  1693. this.model.duty = category.dutyDepartment;
  1694. }
  1695. },
  1696. },
  1697. watch: {
  1698. "model.room": {
  1699. handler(newV) {
  1700. if (newV) {
  1701. this.fields.forEach(item => {
  1702. if (item.modelKey == "room") {
  1703. this.model.houseNumber = item.props.options.find(
  1704. v => v.value == newV
  1705. ).text;
  1706. }
  1707. });
  1708. } else {
  1709. this.model.houseNumber = "";
  1710. }
  1711. }
  1712. },
  1713. 'model.branch': {
  1714. handler(newVal, oldVal){
  1715. console.log(newVal, oldVal);
  1716. this.showUserOrGroup();
  1717. newVal && this.getAreaData(newVal);
  1718. this.handlerDuty();
  1719. }
  1720. },
  1721. },
  1722. created() {
  1723. //获取事件来源
  1724. this.getSource();
  1725. // 优先级
  1726. this.getPriority();
  1727. // 紧急度
  1728. this.getMergency();
  1729. // 影响度
  1730. this.getInfluence();
  1731. // 处理方式
  1732. this.getHandleCategory();
  1733. // 关闭代码
  1734. this.getClosecode();
  1735. // 处理人
  1736. this.getHandlerUser();
  1737. // 处理组
  1738. this.getCandidateGroups();
  1739. this.getMessage();
  1740. // 事件单号
  1741. this.getsjnum();
  1742. // 故障现象
  1743. this.getIncidentcategory();
  1744. if (this.valConfig == 2) {
  1745. // 获取院区列表
  1746. this.getBranchList();
  1747. // 回显选择的报修科室
  1748. if(this.$route.query.id && this.$route.query.dept){
  1749. this.model.requester = this.$route.query.dept;
  1750. // 回显科室信息
  1751. this.showUserOrGroup();
  1752. if(this.$route.query.areaId && this.$route.query.placeId && this.$route.query.areaName && this.$route.query.placeName){
  1753. this.model.placeValue = [+this.$route.query.areaId, +this.$route.query.placeId];
  1754. this.selectedPlaceTxt = this.$route.query.areaName + ' ' + this.$route.query.placeName;
  1755. }else{
  1756. this.model.placeValue = [];
  1757. this.selectedPlaceTxt = '';
  1758. }
  1759. this.model.contactsInformation = this.$route.query.phone;
  1760. }
  1761. // 回显院区
  1762. this.model.branch = this.loginUser.duty ? this.loginUser.duty.branch : this.loginUser.branch.id;
  1763. }
  1764. },
  1765. beforeRouteLeave(to, from, next) {
  1766. console.log(to);
  1767. if (to.name == "InspectionDetail") {
  1768. this.$router.push({ name: "Inspection" });
  1769. } else {
  1770. next();
  1771. }
  1772. },
  1773. mounted() {
  1774. this.$refs.upload.pause();
  1775. if (this.$refs.upload1) {
  1776. this.$refs.upload1.pause();
  1777. }
  1778. },
  1779. components: {
  1780. seiminModel,
  1781. CubePage,
  1782. CubeButtonGroup,
  1783. DatePicker,
  1784. CubeExtendPopup,
  1785. LoadIng,
  1786. PrompTing
  1787. }
  1788. };
  1789. </script>
  1790. <style lang="less" scoped>
  1791. .newIncident .cube-form-group {
  1792. border-bottom: 0.02rem solid rgb(245, 245, 245);
  1793. }
  1794. .newIncident .sub .cube-btn {
  1795. margin-top: 1.1rem;
  1796. }
  1797. .btn_plcaeholde .cube-btn {
  1798. padding-left: 0;
  1799. padding-right: 0;
  1800. text-align: left;
  1801. color: inherit;
  1802. background: none;
  1803. border: none;
  1804. }
  1805. .inp_local {
  1806. outline: none;
  1807. width: 100%;
  1808. height: 36px;
  1809. color: #666;
  1810. }
  1811. .btn_plcaeholde .cube-btn::after {
  1812. content: ">";
  1813. float: right;
  1814. margin-right: 0.15rem;
  1815. }
  1816. .cube-form_standard .cube-upload-def .cube-upload-btn,
  1817. .cube-form_standard .cube-upload-def .cube-upload-file {
  1818. margin-left: 3% !important;
  1819. }
  1820. .sub .cube-btn {
  1821. background-color: #005395 !important;
  1822. width: 90%;
  1823. margin: 0 auto;
  1824. border-radius: 8px;
  1825. }
  1826. .cube-picker-wheel-item {
  1827. text-overflow: ellipsis;
  1828. }
  1829. .zc {
  1830. display: flex;
  1831. position: relative;
  1832. .zc-item {
  1833. flex: 7;
  1834. }
  1835. .zc-sao {
  1836. flex: 3;
  1837. display: flex;
  1838. justify-content: center;
  1839. align-items: center;
  1840. font-size: 0.6rem;
  1841. }
  1842. }
  1843. .header {
  1844. width: 100%;
  1845. height: 0.88rem;
  1846. line-height: 0.88rem;
  1847. text-align: center;
  1848. color: #fff;
  1849. font-size: 0.37rem;
  1850. background: linear-gradient(#2e2f32, #414246);
  1851. position: fixed;
  1852. top: 0;
  1853. z-index: 6;
  1854. }
  1855. .incidentTitle {
  1856. .titleRefer {
  1857. display: flex;
  1858. align-items: center;
  1859. justify-content: space-between;
  1860. .titleTxtArea {
  1861. font-size: 0.3rem;
  1862. color: #333;
  1863. height: auto;
  1864. width: 62%;
  1865. &:focus {
  1866. outline: none;
  1867. }
  1868. }
  1869. .abtn {
  1870. display: inline-block;
  1871. width: 37%;
  1872. text-align: center;
  1873. height: 0.48rem;
  1874. color: #005395;
  1875. font-size: 0.28rem;
  1876. }
  1877. }
  1878. }
  1879. .form-custom {
  1880. .cube-form-item {
  1881. .cube-btn {
  1882. padding-left: 0;
  1883. padding-right: 0;
  1884. text-align: left;
  1885. color: inherit;
  1886. background: none;
  1887. border: none;
  1888. }
  1889. }
  1890. }
  1891. .label {
  1892. background-color: rgb(238, 238, 238);
  1893. height: 0.6rem;
  1894. line-height: 0.6rem;
  1895. padding-left: 0.2rem;
  1896. font-size: 0.24rem;
  1897. color: #666666;
  1898. span {
  1899. font-size: 0.2rem;
  1900. display: inline-block;
  1901. margin-left: 0.08rem;
  1902. color: #999999;
  1903. }
  1904. &.formLabel {
  1905. background-color: #fff;
  1906. }
  1907. }
  1908. .zhidu {
  1909. display: flex;
  1910. height: 0.7rem;
  1911. line-height: 0.7rem;
  1912. border-bottom: 0.02rem solid rgb(245, 245, 245);
  1913. div:nth-child(1) {
  1914. width: 27.5%;
  1915. padding-left: 6%;
  1916. }
  1917. }
  1918. .bgColor {
  1919. background-color: white;
  1920. &.newIncident {
  1921. padding-top: 1.84rem;
  1922. }
  1923. }
  1924. .uplod {
  1925. padding: 0 0.24rem;
  1926. border-bottom: 0.02rem solid rgb(245, 245, 245);
  1927. }
  1928. .navBar {
  1929. width: 100%;
  1930. height: 0.96rem;
  1931. line-height: 0.96rem;
  1932. background-color: #e5e5e5;
  1933. font-size: 0.28rem;
  1934. position: fixed;
  1935. top: 0.88rem;
  1936. z-index: 6;
  1937. div {
  1938. width: 49%;
  1939. text-align: center;
  1940. a {
  1941. display: inline-block;
  1942. height: 0.9rem;
  1943. width: 1.7rem;
  1944. padding: 0 0.3rem;
  1945. &.active {
  1946. color: #005395;
  1947. border-bottom: 0.06rem solid #005395;
  1948. }
  1949. }
  1950. }
  1951. }
  1952. .handleRadio {
  1953. border-bottom: 0.02rem solid rgb(245, 245, 245);
  1954. }
  1955. </style>