newIncident.vue 53 KB

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