12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159 |
- <template>
- <div slot="content" class="bgColor newIncident">
- <div class="header">新建事件</div>
- <div class="navBar">
- <div class="fl">
- <a
- :class="{ active: label == 'incidentInfo' }"
- href="javascript:;"
- @click="toInfo('incidentInfo')"
- >事件信息</a
- >
- </div>
- <div class="fl">
- <a
- :class="{ active: label == 'handlerInfo' }"
- href="javascript:;"
- @click="toInfo('handlerInfo')"
- >处理信息</a
- >
- </div>
- </div>
- <div class="label" id="incidentInfo">事件信息</div>
- <cube-form
- :model="model"
- @validate="validateHandler"
- @submit="submitHandler"
- >
- <cube-form-group>
- <cube-form-item
- :field="fields[20]"
- v-if="valConfig == 2"
- class="btn_plcaeholde btn_local"
- >
- <!-- <cube-button @click="showPlacePicker()">{{selectedPlaceTxt?selectedPlaceTxt:'请输入故障地点'}}</cube-button> -->
- <input
- type="text"
- class="inp_local"
- placeholder="请输入报修科室"
- v-model="deptInpVal"
- @input="changeDeptList()"
- @click="showDeptPicker()"
- />
- </cube-form-item>
- <cube-form-item
- v-if="valConfig == 1"
- :field="fields[0]"
- ></cube-form-item>
- <cube-form-item
- v-if="valConfig == 2"
- :field="fields[21]"
- ></cube-form-item>
- <cube-form-item :field="fields[1]"></cube-form-item>
- <cube-form-item :field="fields[2]" class="btn_plcaeholde">
- <cube-button @click="showPlacePicker()">{{
- selectedPlaceTxt ? selectedPlaceTxt : "请选择校区区域地点"
- }}</cube-button>
- </cube-form-item>
- <cube-form-item :field="fields[23]" v-if="ifRoom == 1"></cube-form-item>
- <!-- 故障地点: -->
- <!-- <cube-form-item :field="fields[19]" class="btn_plcaeholde btn_local"> -->
- <!-- <cube-button @click="showPlacePicker()">{{selectedPlaceTxt?selectedPlaceTxt:'请输入故障地点'}}</cube-button> -->
- <!-- <input
- type="text"
- class="inp_local"
- placeholder="请输入故障地点"
- v-model="inpLocalVal"
- @input="changeLocalList()"
- @click="showPlacePicker()"
- />
- </cube-form-item> -->
- <cube-form-item :field="fields[3]"></cube-form-item>
- <cube-form-item :field="fields[4]" class="btn_plcaeholde">
- <cube-button @click="showCategoryPicker()">{{
- selectedCategoryTxt ? selectedCategoryTxt : "请选择事件分类"
- }}</cube-button>
- </cube-form-item>
- <cube-form-item
- :field="fields[5]"
- class="btn_plcaeholde"
- ></cube-form-item>
- <!-- <cube-form-item :field="fields[6]" class="btn_plcaeholde incidentTitle">
- <div class="titleRefer">
- <textarea
- class="titleTxtArea fl"
- placeholder="请输入事件主题"
- v-model="incidentTitle"
- @input="inpTitle()"
- ></textarea>
- <span class="abtn fl" @click="referKnowledge()">引入知识库</span>
- </div>
- </cube-form-item>-->
- <cube-form-item :field="fields[7]"></cube-form-item>
- <div class="label formLabel">
- 报修图片
- <span>(最多可上传3张JPG或PNG,每张不能超过10M)</span>
- </div>
- <div class="uplod">
- <cube-upload
- ref="upload"
- :max="3"
- :action="action"
- :simultaneous-uploads="3"
- @files-added="filesAdded"
- @file-submitted="fileSubmitted"
- />
- </div>
- <!-- <cube-form-item :field="fields[8]" class="btn_plcaeholde"></cube-form-item>
- <cube-form-item :field="fields[9]" class="btn_plcaeholde"></cube-form-item>-->
- <cube-form-item
- :field="fields[10]"
- class="btn_plcaeholde"
- ></cube-form-item>
- <div class="zc" v-if="wxIncidentWithCmdb == 1">
- <cube-form-item
- :field="fields[22]"
- class="btn_plcaeholde zc-item"
- ></cube-form-item>
- <span class="icon dash dash-saoyisao zc-sao" @click="scan()"></span>
- </div>
- <div class="label" id="handlerInfo">处理信息</div>
- <div class="handleRadio">
- <cube-radio-group
- v-model="order"
- :options="handleTypes"
- position="right"
- :hollow-style="true"
- @input="changeHandleTypes"
- />
- </div>
- <!-- 直接处理 begin -->
- <cube-form-item
- v-if="order == 1"
- :field="fields[11]"
- class="btn_plcaeholde"
- ></cube-form-item>
- <cube-form-item
- v-if="order == 1"
- :field="fields[12]"
- class="btn_plcaeholde"
- ></cube-form-item>
- <cube-form-item
- v-if="order == 1 && isShowDes"
- :field="fields[13]"
- class="btn_plcaeholde"
- ></cube-form-item>
- <div v-if="order == 1" class="label formLabel">
- 报修图片
- <span>(最多可上传3张JPG或PNG,每张不能超过10M)</span>
- </div>
- <div class="uplod" v-if="order == 1">
- <cube-upload
- ref="upload1"
- :max="3"
- :action="action1"
- :simultaneous-uploads="3"
- @files-added="filesAdded1"
- @file-submitted="fileSubmitted1"
- />
- </div>
- <cube-form-item v-if="order == 1" :field="fields[14]"></cube-form-item>
- <cube-form-item
- v-if="order == 1 && model.knowledge == true"
- :field="fields[15]"
- class="btn_plcaeholde"
- ></cube-form-item>
- <!-- 直接处理 end -->
- <!-- 派单 begin -->
- <cube-form-item v-if="order == 2" :field="fields[16]"></cube-form-item>
- <cube-form-item
- v-if="order == 2 && model.handleUserOrGroup == true"
- :field="fields[17]"
- class="btn_plcaeholde"
- ></cube-form-item>
- <cube-form-item
- v-if="order == 2 && model.handleUserOrGroup == false"
- :field="fields[18]"
- class="btn_plcaeholde"
- ></cube-form-item>
- <!-- 派单 end -->
- </cube-form-group>
- <cube-form-group class="sub">
- <cube-button type="submit" @click="subVali()">提交</cube-button>
- </cube-form-group>
- </cube-form>
- <load-ing v-show="loadShow"></load-ing>
- <promp-ting
- :conents="promptingConent"
- :status="promptingStatus"
- ></promp-ting>
- <seiminModel ref="seiminModel"></seiminModel>
- </div>
- </template>
- <script>
- import seiminModel from "./../custom/seiminModel";
- import CubePage from "./../components/cube-page.vue";
- import CubeButtonGroup from "./../components/cube-button-group.vue";
- import DatePicker from "./../components/date-picker.vue";
- import CubeExtendPopup from "./../components/extend-popup.vue";
- import LoadIng from "./../views/loading.vue";
- import PrompTing from "./../views/prompting.vue";
- import { SM } from "./../http/http";
- // import host from "../request/host";
- // 知识库类型
- const solution = {
- props: {
- value: {
- default() {
- return [];
- }
- }
- },
- data() {
- return {
- selected: [],
- selectData: [],
- initVal: JSON.parse(localStorage.getItem("solution")) || [0, 0, 0],
- allPlace: {}, //存放请求到的所有校区区域地点
- sleectHouseNumber: {}, //校区区域地点
- initSjList: [], //原始事件列表
- // initAreaList: [], //原始区域列表
- };
- },
- render(createElement) {
- return createElement(
- "cube-button",
- {
- on: {
- click: this.showPicker
- }
- },
- this.selected.length
- ? this.selected[this.selected.length - 1]
- : "请选择知识库类型"
- );
- },
- created() {
- this.getTree();
- },
- mounted() {},
- methods: {
- showPicker() {
- this.picker.show();
- },
- selectHandler(selectedVal, selectedIndex, selectedTxt) {
- var selected = [];
- selectedTxt.forEach(function(v, i) {
- if (v != "") {
- selected.push(v);
- }
- });
- this.selected = selected;
- this.$emit("input", selectedVal);
- localStorage.setItem("solution", JSON.stringify(selectedIndex));
- },
- // 获取事件分类数据
- getTree() {
- let that = this;
- that.$http
- .post("service/solution/fetchDataList/solutionType", {
- idx: 0,
- sum: 100
- })
- .then(function(res) {
- // console.log(res);
- var list = res.data.list;
- var tree = [];
- list.forEach((v, i) => {
- if (!v.parent) {
- tree[i] = {
- value: v.id,
- text: v.typeName,
- children: []
- };
- } else {
- tree.forEach((val, idx) => {
- if (
- v.parent &&
- !v.parent.parent &&
- val.text == v.parent.typeName
- ) {
- tree[idx].children.push({
- value: v.id,
- text: v.typeName,
- children: []
- });
- } else if (v.parent.parent) {
- tree[idx].children.forEach((value, index) => {
- if (value.text == v.parent.typeName) {
- tree[idx].children[index].children.push({
- value: v.id,
- text: v.typeName
- });
- }
- });
- }
- });
- }
- });
- var arrTree = [];
- tree.forEach(function(v) {
- arrTree.push(v);
- });
- that.selectData = arrTree;
- console.log(arrTree);
- that.picker = that.$createCascadePicker({
- title: "知识库类型选择",
- data: that.selectData,
- selectedIndex: that.initVal,
- onSelect: that.selectHandler
- });
- });
- }
- }
- };
- export default {
- data() {
- return {
- validity: {},
- valid: undefined,
- action: {
- target:
- this.$host + "/service/common/common/uploadAttachment/incident/",
- data: {}
- },
- action1: {
- target:
- this.$host + "/service/common/common/uploadAttachment/incident/",
- data: {}
- },
- isUploading: false,
- loadShow: false,
- incidentWithConsumable: localStorage.getItem("incidentWithConsumable"), //是否绑定耗材
- wxIncidentWithCmdb: localStorage.getItem("wxIncidentWithCmdb"), //是否绑定资产
- ifRoom: localStorage.getItem("ifRoom"), //是否增加房间号选择
- loginUser: JSON.parse(localStorage.getItem("loginUser")),
- integralMechanism: localStorage.getItem("integralMechanism"),
- integralRole: localStorage.getItem("integralRole"),
- valConfig: JSON.parse(localStorage.getItem("valConfig")) - 0, //报修主体
- name: "",
- phone: "",
- label: "incidentInfo", //顶部快速定位
- modelData: {
- incident: {}
- }, //上传的model
- timer: null,
- incidentTitle: "", //事件主题
- referenceInfo: {}, //引用信息
- placeSelectData: [], //校区区域地点下拉框选项
- inpLocalVal: "", //故障地点输入框
- faultLocationList: [], //校区区域地点拼接下拉框选项
- deptInpVal: "", //报修科室输入框
- deptList: [], //报修科室下拉选项
- deptRes: "", //下拉框科室信息
- model: {
- contactsInformation: "",
- placeValue: [],
- address: "", //故障地点
- requester: "", //报修科室
- houseNumber: "", //详细地址
- description: "", //事件描述
- // bxcode: "",
- assetId: "", //资产
- category: [],
- source: "", //事件来源
- title: "", //事件主题
- priority: "", //优先级
- emergency: "", //紧急度
- influence: "", //影响度
- handleCategory: "", //处理方式
- closecode: "", //处理结果
- handleDescription: "", //处理方案
- knowledge: false, //是否提交知识库
- handlerUser: "", //处理人
- candidateGroups: "", //处理组
- solutionType: [], //知识库类型
- handleUserOrGroup: false, //处理人or处理组
- room: "" //房间号
- },
- selectedCategoryTxt: "", //事件分类选中展示
- selectedPlaceTxt: "", //校区区域地点选中展示
- // showPrompting:false,
- promptingConent: "",
- promptingStatus: "",
- order: 1, //处理方式 1:直接处理,2:派单
- sourceArr: [], //事件来源数组
- priorityArr: [], //优先级数组
- emergencyArr: [], //紧急度数组
- influenceArr: [], //影响度数组
- handleCategoryArr: [], //处理方式数组
- closecodeArr: [], //处理结果数组
- handlerUserArr: [], //处理人数组
- candidateGroupsArr: [], //处理组数组
- isShowDes: false,
- handleTypes: [
- {
- label: "直接处理",
- value: 1
- },
- {
- label: "派单",
- value: 2
- }
- ],
- vali: false,
- fields: [
- {
- type: "input",
- modelKey: "contacts",
- label: "联系人:",
- props: {
- placeholder: "请输入联系人"
- },
- rules: {
- required: true
- }
- },
- {
- type: "input",
- modelKey: "contactsInformation",
- label: "联系电话:",
- props: {
- placeholder: "请输入联系电话"
- },
- rules: {
- required: true
- }
- },
- {
- component: "button",
- modelKey: "placeValue",
- label: "校区区域地点:",
- rules: {
- required: false
- },
- messages: {
- required: "请选择校区区域地点"
- }
- },
- {
- type: "textarea",
- modelKey: "houseNumber",
- label: "详细地址:",
- props: {
- placeholder: "请输入详细地址"
- },
- rules: {
- required: false
- },
- debounce: 100
- },
- {
- component: "button",
- modelKey: "category",
- label: "事件分类:",
- rules: {
- required: true
- }
- // messages: {
- // required: "请选择事件分类"
- // }
- },
- {
- type: "select",
- modelKey: "source",
- label: "事件来源:",
- props: {
- options: this.sourceArr,
- title: "请选择事件来源",
- placeholder: "请选择事件来源"
- },
- rules: {
- required: true
- }
- },
- {
- // component: Place,
- type: "input",
- modelKey: "title",
- label: "事件主题:",
- rules: {
- required: true
- },
- messages: {
- required: "请选择事件主题"
- }
- },
- {
- type: "textarea",
- modelKey: "description",
- label: "事件描述:",
- props: {
- placeholder: "请详细描述故障,并上传故障图片,例如:网络故障。"
- },
- rules: {
- required: true
- },
- debounce: 100
- },
- {
- type: "select",
- modelKey: "influence",
- label: "影响度:",
- props: {
- options: this.influenceArr,
- title: "请选择影响度",
- placeholder: "请选择影响度"
- },
- rules: {
- required: false
- },
- events: {
- change: (value, index, text) => {
- console.log(value, index, text);
- console.log(this.model);
- var that = this;
- if (this.model.emergency) {
- this.$http
- .post("service/bpm/data/fetchDataList/prioritymatrix", {
- idx: 0,
- sum: 1000,
- prioritymatrix: {
- emergency: { id: this.model.emergency },
- influence: { id: this.model.influence }
- }
- })
- .then(function(res) {
- if (res.data.list.length) {
- that.model.priority = res.data.list[0].priority.id;
- }
- });
- }
- }
- }
- },
- {
- type: "select",
- modelKey: "emergency",
- label: "紧急度:",
- props: {
- options: this.emergencyArr,
- title: "请选择紧急度",
- placeholder: "请选择紧急度"
- },
- rules: {
- required: false
- },
- events: {
- change: (value, index, text) => {
- console.log(value, index, text);
- console.log(this.model);
- var that = this;
- if (this.model.influence) {
- this.$http
- .post("service/bpm/data/fetchDataList/prioritymatrix", {
- idx: 0,
- sum: 1000,
- prioritymatrix: {
- emergency: { id: this.model.emergency },
- influence: { id: this.model.influence }
- }
- })
- .then(function(res) {
- console.log(res.data);
- if (res.data.list.length) {
- that.model.priority = res.data.list[0].priority.id;
- }
- });
- }
- }
- }
- },
- {
- type: "select",
- modelKey: "priority",
- label: "优先级:",
- props: {
- options: this.priorityArr,
- title: "请选择优先级",
- placeholder: "请选择优先级"
- },
- rules: {
- required: true
- }
- },
- {
- type: "select",
- modelKey: "handleCategory",
- label: "处理方式:",
- props: {
- options: this.handleCategoryArr,
- title: "请选择处理方式",
- placeholder: "请选择处理方式"
- },
- rules: {
- required: true
- }
- },
- {
- type: "select",
- modelKey: "closecode",
- label: "处理结果:",
- props: {
- options: this.closecodeArr,
- title: "请选择处理结果",
- placeholder: "请选择处理结果"
- },
- rules: {
- required: true
- }
- },
- {
- type: "textarea",
- modelKey: "handleDescription",
- label: "处理方案:",
- props: {
- placeholder: "请填写处理方案"
- },
- rules: {
- required: true
- },
- debounce: 100
- },
- {
- type: "switch",
- modelKey: "knowledge",
- label: "是否提交知识库:",
- rules: {
- required: false
- }
- },
- {
- component: solution,
- modelKey: "solutionType",
- label: "知识库类型:",
- rules: {
- required: true
- },
- messages: {
- required: ""
- }
- },
- {
- type: "switch",
- modelKey: "handleUserOrGroup",
- label: "是否选择处理人:",
- rules: {
- required: false
- }
- },
- {
- type: "select",
- modelKey: "handlerUser",
- label: "处理人:",
- props: {
- options: this.handlerUserArr,
- title: "请选择处理人",
- placeholder: "请选择处理人"
- },
- rules: {
- required: true
- }
- },
- {
- type: "select",
- modelKey: "candidateGroups",
- label: "处理组:",
- props: {
- options: this.candidateGroupsArr,
- title: "请选择处理组",
- placeholder: "请选择处理组"
- },
- rules: {
- required: true
- }
- },
- {
- type: "select",
- modelKey: "address",
- label: "故障地点:",
- props: {
- options: this.faultLocationList,
- title: "请选择故障地点",
- placeholder: "请选择故障地点"
- },
- rules: {
- required: true
- }
- },
- {
- type: "select",
- modelKey: "requester",
- label: "报修科室:",
- props: {
- options: this.requesterList,
- title: "请选择报修科室",
- placeholder: "请选择报修科室"
- },
- rules: {
- required: true
- }
- },
- {
- type: "input",
- modelKey: "contacts",
- label: "联系人:",
- props: {
- placeholder: "请输入联系人"
- },
- rules: {
- required: false
- }
- },
- {
- type: "input",
- modelKey: "assetId",
- label: "资产:",
- rules: {
- required: false
- },
- props: {
- placeholder: "请选择资产",
- disabled: true
- }
- },
- {
- type: "select",
- modelKey: "room",
- label: "房间号",
- props: {
- placeholder: "请选择房间号",
- options: []
- },
- rules: {
- required: false
- }
- }
- ]
- };
- },
- watch: {
- // "model.category": {
- // deep: true,
- // handler: function(n, o) {
- // this.model.houseNumber = houseNumber;
- // console.log(this.model.houseNumber);
- // }
- // }
- "model.room": {
- handler(newV) {
- if (newV) {
- this.fields.forEach(item => {
- if (item.modelKey == "room") {
- this.model.houseNumber = item.props.options.find(
- v => v.value == newV
- ).text;
- }
- });
- } else {
- this.model.houseNumber = "";
- }
- }
- }
- },
- methods: {
- // 切换处理方式
- changeHandleTypes() {
- let reverseArr = this.model.category.filter(Boolean).reverse(); //数组翻转,取第一项不为空的
- let sjId = reverseArr[0]; //事件Id baba
- let sj = this.initSjList.filter(v => v.id == sjId)[0];
- console.log(this.order, sj);
- this.isShowDes = !(this.order == 1 && sj && sj.hasSimple == 1);
- },
- //扫资产
- scan() {
- SM(this).then(ress1 => {
- this.model.assetId = ress1;
- });
- },
- // 输入事件描述
- inpTitle() {
- this.model.title = this.incidentTitle;
- },
- // 快速定位
- toInfo(id) {
- this.label = id;
- $("body,html").animate(
- {
- scrollTop:
- $("#" + id).offset().top -
- $(".header")[0].offsetHeight -
- $(".navBar")[0].offsetHeight
- },
- 260
- );
- },
- subVali() {
- this.vali = true;
- },
- // 获取事件单号
- getsjnum() {
- var that = this;
- this.$http.get("service/bpm/bpm/restful/sj", {}).then(function(res) {
- that.modelData.incident.incidentsign = res.data.data;
- });
- },
- // 获取事件来源
- getSource() {
- var that = this;
- this.$http
- .post("service/common/common/getDictionary", {
- key: "incident_source",
- type: "list"
- })
- .then(function(res) {
- res.data.forEach(function(v, i) {
- that.sourceArr.push({
- text: v.name,
- value: v.id
- });
- });
- that.fields[5].props.options = that.sourceArr;
- });
- },
- // 获取优先级
- getPriority() {
- var that = this;
- this.$http
- .post("service/common/common/getDictionary", {
- key: "incident_priority",
- type: "list"
- })
- .then(function(res) {
- res.data.forEach(function(v, i) {
- that.priorityArr.push({
- text: v.name,
- value: v.id
- });
- });
- that.fields[10].props.options = that.priorityArr;
- });
- },
- // 获取紧急度
- getMergency() {
- var that = this;
- this.$http
- .post("service/common/common/getDictionary", {
- key: "incident_emergency",
- type: "list"
- })
- .then(function(res) {
- res.data.forEach(function(v, i) {
- that.emergencyArr.push({
- text: v.name,
- value: v.id
- });
- });
- that.fields[9].props.options = that.emergencyArr;
- });
- },
- // 获取影响度
- getInfluence() {
- var that = this;
- this.$http
- .post("service/common/common/getDictionary", {
- key: "incident_influence",
- type: "list"
- })
- .then(function(res) {
- res.data.forEach(function(v, i) {
- that.influenceArr.push({
- text: v.name,
- value: v.id
- });
- });
- that.fields[8].props.options = that.influenceArr;
- });
- },
- // 获取处理方式
- getHandleCategory() {
- var that = this;
- this.$http
- .post("service/common/common/getDictionary", {
- key: "incident_handleCategory",
- type: "list"
- })
- .then(function(res) {
- res.data.forEach(function(v, i) {
- that.handleCategoryArr.push({
- text: v.name,
- value: v.id
- });
- });
- that.fields[11].props.options = that.handleCategoryArr;
- });
- },
- // 获取处理结果
- getClosecode() {
- var that = this;
- this.$http
- .post("service/common/common/getDictionary", {
- key: "incident_closecode",
- type: "list"
- })
- .then(function(res) {
- res.data.forEach(function(v, i) {
- that.closecodeArr.push({
- text: v.desc,
- value: v.id
- });
- });
- that.fields[12].props.options = that.closecodeArr;
- });
- },
- // 获取处理人
- getHandlerUser() {
- var that = this;
- this.$http
- .post("service/user/data/fetchDataList/user", {
- idx: 0,
- sum: 1000,
- user: {
- roledata: { rolecode: "first-line support" },
- selectType: "1"
- }
- })
- .then(function(res) {
- res.data.list.forEach(function(v, i) {
- that.handlerUserArr.push({
- text: v.name,
- value: v.id
- });
- });
- that.fields[17].props.options = that.handlerUserArr;
- });
- },
- // 获取处理组
- getCandidateGroups() {
- var that = this;
- this.$http
- .post("service/user/data/fetchDataList/group", {
- idx: 0,
- sum: 1000,
- group: { selectType: "nouser" }
- })
- .then(function(res) {
- res.data.list.forEach(function(v, i) {
- that.candidateGroupsArr.push({
- text: v.groupName,
- value: v.id
- });
- });
- that.fields[18].props.options = that.candidateGroupsArr;
- });
- },
- // 暂时存值
- setLocalStroageData() {
- var that = this;
- var a1 = [],
- a2 = [],
- category = [],
- solutionType = [];
- that.model.category.forEach(function(v, i) {
- if (v) {
- a1.push(v);
- }
- });
- category = a1;
- that.model.solutionType.forEach(function(v, i) {
- if (v) {
- a2.push(v);
- }
- });
- solutionType = a2;
- // if (that.model.placeValue.length == 2) {
- // that.model.areaId =
- // that.model.placeValue[that.model.placeValue.length - 2];
- // that.model.placeId =
- // that.model.placeValue[that.model.placeValue.length - 1];
- // } else if (that.model.placeValue.length == 1) {
- // that.model.areaId =
- // that.model.placeValue[that.model.placeValue.length - 1];
- // that.model.placeId = "";
- // }
- if (that.model.placeValue.length === 3){
- that.model.branchId = that.model.placeValue[0];
- that.model.areaId = that.model.placeValue[1];
- that.model.placeId = that.model.placeValue[2];
- }
- // that.modelData.incident.houseNumber = that.model.address[0];
- that.modelData.incident["repairType"] = that.valConfig;
- if (that.valConfig == 1) {
- // that.modelData.incident.requester = that.loginUser;
- // that.modelData.incident.account = that.loginUser.account;
- // that.modelData.requestershow = that.loginUser;
- } else if (that.valConfig == 2) {
- that.modelData.incident.department = that.model.requester;
- }
- if (that.wxIncidentWithCmdb == 1) {
- that.modelData.incident.assetId = that.model.assetId;
- }
- that.modelData.incident.branch = that.model.branchId?{ id: that.model.branchId }:undefined;
- that.modelData.incident.area = that.model.areaId?{ id: that.model.areaId }:undefined;
- that.modelData.incident.place = that.model.placeId?{ id: that.model.placeId }:undefined;
- that.modelData.incident.category = {
- id: category[category.length - 1]
- };
- that.modelData.initUser = that.loginUser.id;
- that.modelData.loginUser = that.loginUser;
- that.modelData.fromWeChat = true;
- that.modelData.incident.contactsInformation =
- that.model.contactsInformation;
- that.modelData.incident.contacts = that.model.contacts;
- that.modelData.incident.houseNumber = that.model.houseNumber;
- if (that.ifRoom == 1) {
- that.modelData.incident.room = { id: that.model.room };
- }
- that.modelData.incident.acceptUser = that.loginUser;
- that.modelData.incident.requester = {};
- that.modelData.incident.handlingPersonnelUser = { id: that.loginUser.id };
- that.modelData.incident.source = { id: that.model.source };
- that.modelData.incident.title = that.model.title;
- that.modelData.incident.description = that.model.description;
- // that.modelData.incident.emergency = { id: that.model.emergency };
- // that.modelData.incident.influence = { id: that.model.influence };
- if(that.model.priority){
- that.modelData.incident.priority = { id: that.model.priority };
- }
- that.modelData.incident.alarmType = false;
- if (that.order == 1) {
- // 直接处理
- that.modelData.handler_code = "resolve";
- that.modelData.start_code = "close";
- that.modelData.incident.directProcess = 1;
- that.modelData.incident.handleDescription =
- that.model.handleDescription;
- that.modelData.incident.handleCategory = {
- id: that.model.handleCategory
- };
- that.modelData.incident.closecode = { id: that.model.closecode };
- that.modelData.bpm_activiti = {
- solutionType: {
- id: solutionType[solutionType.length - 1]
- }
- };
- that.modelData.isSolution = that.model.knowledge;
- } else if (that.order == 2) {
- // 派单
- that.modelData.start_code = "assignment";
- if (that.model.handleUserOrGroup) {
- // 处理人
- that.modelData.assignee = that.model.handlerUser;
- that.modelData.incident.handlingPersonnelUser = {
- id: that.model.handlerUser
- };
- } else {
- // 处理组
- that.modelData.candidateGroups = that.model.candidateGroups;
- if (that.modelData.assignee) {
- delete that.modelData.assignee;
- }
- if (that.modelData.incident.handlerUser) {
- delete that.modelData.incident.handlerUser;
- }
- }
- if (that.modelData.incident.handlingPersonnelUser) {
- delete that.modelData.incident.handlingPersonnelUser;
- }
- if (that.modelData.incident.handleDescription) {
- delete that.modelData.incident.handleDescription;
- }
- if (that.modelData.incident.closecode) {
- delete that.modelData.incident.closecode;
- }
- if (that.modelData.incident.degree) {
- delete that.modelData.incident.degree;
- }
- if (that.modelData.isSolution) {
- delete that.modelData.isSolution;
- }
- }
- console.log(that.modelData);
- that.model.fileUrl = "url";
- that.loadShow = true;
- },
- // 事件主题引入知识库
- referKnowledge() {
- var that = this;
- if (!that.model.title) return;
- that.setLocalStroageData();
- localStorage.setItem("modelData", JSON.stringify(that.modelData));
- localStorage.setItem("model", JSON.stringify(that.model));
- localStorage.setItem("order", that.order);
- this.$router.push({
- name: "ReferenceList",
- params: { data: that.model.title }
- });
- },
- // 获取页面数据
- getMessage() {
- var that = this;
- if (that.$route.params.data) {
- var inspecInfo = that.$route.params.data;
- // 巡检生成事件
- if (that.wxIncidentWithCmdb == 1) {
- that.model.assetId = inspecInfo.assetId;
- }
- console.log(that.$route.params.abnormal);
- that.model.contacts = inspecInfo.processUser.name;
- that.model.contactsInformation = inspecInfo.processUser.phone
- ? inspecInfo.processUser.phone
- : "";
- that.order = 2;
- that.model.handleUserOrGroup = true;
- that.model.source = 1552; //巡检生成事件来源默认为其他
- // 处理人
- if (inspecInfo.handlerUser) {
- that.model.handlerUser = inspecInfo.handlerUser.id;
- }
- // that.modelData.incident.handlingPersonnelUser = {
- // id: that.model.handlerUser
- // };
- if (that.$route.params.abnormal) {
- that.model.description = that.modelData.incident.description =
- that.$route.params.abnormal;
- }
- } else {
- that.name = that.loginUser.name;
- that.model.contactsInformation = that.loginUser.phone;
- that.model.contacts = that.loginUser.name;
- that.model.houseNumber = that.loginUser.houseNumber;
- }
- if (that.loginUser.place && that.loginUser.place.length) {
- if (that.loginUser.place.id) {
- if (that.loginUser.place.area) {
- that.model.placeValue[0] = that.loginUser.place.area.id;
- }
- that.model.placeValue[1] = that.loginUser.place.id;
- }
- }
- if (localStorage.getItem("model")) {
- that.model = JSON.parse(localStorage.getItem("model"));
- that.incidentTitle = that.model.title;
- }
- if (localStorage.getItem("modelData")) {
- that.modelData = JSON.parse(localStorage.getItem("modelData"));
- }
- if (localStorage.getItem("referenceInfo")) {
- that.referenceInfo = JSON.parse(localStorage.getItem("referenceInfo"));
- that.incidentTitle = that.model.title = that.referenceInfo.title;
- that.model.handleDescription = that.referenceInfo.content;
- }
- if (localStorage.getItem("order")) {
- that.order = localStorage.getItem("order") - 0;
- }
- // if (localStorage.getItem("category")) {
- // that.selectedCategoryTxt = JSON.parse(
- // localStorage.getItem("category")
- // ).txt;
- // console.log(that.selectedCategoryTxt);
- // }
- // if (localStorage.getItem("place")) {
- // that.selectedPlaceTxt = JSON.parse(localStorage.getItem("place")).txt;
- // console.log(that.selectedPlaceTxt);
- // }
- },
- // 提交
- submitHandler() {
- $("#fade").fadeOut();
- var that = this;
- that.setLocalStroageData();
- if (that.selectHouseNumber && that.selectHouseNumber.place) {
- that.modelData.incident.place = that.selectHouseNumber;
- }
- console.log(
- that.modelData,
- that.selectHouseNumber,
- "2020年4月25日14:09:29"
- );
- console.log(that.modelData.incident.category.id, this.initSjList, "事件");
- // debugger;//测试
- let integralRoles = [];
- let currentUserRoles = [];
- let intersection = [];
- if(this.integralMechanism == 1){
- integralRoles = sessionStorage.getItem("integralRole") ? sessionStorage.getItem("integralRole").split(',') : [];
- currentUserRoles = this.loginUser.role ? this.loginUser.role.map(v=>String(v.id)) : [];
- intersection = integralRoles.filter(function (val) { return currentUserRoles.indexOf(val) > -1 })
- }
- if (
- this.order == 1 &&
- ((this.integralMechanism == 1 && intersection.length && integralRoles.length) ||
- (this.integralMechanism == 2 && this.loginUser.userType.value == 2))
- ) {
- // 直接处理,积分机制
- let category = this.initSjList.find(
- v => v.id == this.modelData.incident.category.id
- );
- this.$refs.seiminModel.show({
- category,
- type: "now",
- btns: [
- {
- click: () => {
- this.loadShow = false;
- this.$refs.seiminModel.close();
- }
- },
- {
- click: () => {
- console.log(this.$refs.seiminModel)
- if (!this.$refs.seiminModel.complexity) {
- this.$createDialog({
- type: "alert",
- title: "操作失败",
- content: "请选择工时!",
- icon: "cubeic-wrong"
- }).show();
- return;
- }
- if (!this.$refs.seiminModel.auditor) {
- this.$createDialog({
- type: "alert",
- title: "操作失败",
- content: "请选择审核人!",
- icon: "cubeic-wrong"
- }).show();
- return;
- }
- if (this.$refs.seiminModel.complexitySource != this.$refs.seiminModel.complexity && !this.$refs.seiminModel.updateReason.trim()) {
- this.$createDialog({
- type: "alert",
- title: "操作失败",
- content: "请填写升级原因!",
- icon: "cubeic-wrong"
- }).show();
- return;
- }
- this.$refs.seiminModel.close();
- console.log("确定");
- this.handlerFn();
- }
- }
- ]
- });
- } else {
- this.handlerFn();
- }
- event.preventDefault();
- },
- commonFn() {
- let that = this;
- $("#fade").fadeIn();
- that.promptingConent = "恭喜您,新建报修成功!";
- that.promptingStatus = true;
- that.dialog = that
- .$createDialog({
- type: "alert",
- title: "新建成功",
- content: "点击返回首页",
- icon: "cubeic-right",
- onConfirm: (e, promptValue) => {
- that.$router.push({ path: "/main" });
- }
- })
- .show();
- // localStorage.removeItem("category");
- localStorage.removeItem("model");
- localStorage.removeItem("modelData");
- // localStorage.removeItem("placeIndex");
- localStorage.removeItem("referenceInfo");
- localStorage.removeItem("solution");
- localStorage.removeItem("order");
- setTimeout(function() {
- $("#fade").fadeOut();
- }, 2000);
- },
- handlerFn() {
- let that = this;
- that.$http
- .post("service/bpm/bpm/start/bpm_incident", that.modelData)
- .then(res => {
- if (res.data) {
- that.action.target = that.action.target + res.data.id;
- that.action1.target = that.action1.target + res.data.id;
- setTimeout(function() {
- that.$refs.upload.start();
- if (that.order == 1) {
- that.$refs.upload1.start();
- }
- }, 100);
- let integralRoles = [];
- let currentUserRoles = [];
- let intersection = [];
- if(this.integralMechanism == 1){
- integralRoles = sessionStorage.getItem("integralRole") ? sessionStorage.getItem("integralRole").split(',') : [];
- currentUserRoles = this.loginUser.role ? this.loginUser.role.map(v=>String(v.id)) : [];
- intersection = integralRoles.filter(function (val) { return currentUserRoles.indexOf(val) > -1 })
- }
- if (
- this.order == 1 &&
- ((this.integralMechanism == 1 && intersection.length && integralRoles.length) ||
- (this.integralMechanism == 2 &&
- this.loginUser.userType.value == 2))
- ) {
- this.$http
- .post("service/common/common/getDictionary", {
- key: "incident_integral_state",
- type: "list"
- })
- .then(result => {
- result = result.data;
- let auditState = result.find(v => v.value == 0);
- let postData = {
- incidentIntegral: {
- incidentId: res.data.bussId,
- auditState: auditState,
- auditUser: this.$refs.seiminModel.auditor,
- handlerUser: this.loginUser.id,
- handlerUserName: this.loginUser.name,
- sourceScore: this.$refs.seiminModel.complexitySource,
- currentScore: this.$refs.seiminModel.complexity,
- updateReason:
- this.$refs.seiminModel.updateReason.trim() || undefined
- }
- };
- this.$http
- .post("service/bpm/data/addData/incidentIntegral", postData)
- .then(result1 => {
- if (result1.data.status == 200) {
- this.commonFn();
- } else {
- this.$createDialog({
- type: "alert",
- title: "系统错误,请稍后再试!",
- content: "",
- icon: "cubeic-wrong"
- }).show();
- }
- });
- });
- } else {
- this.commonFn();
- }
- } else {
- $("#fade").fadeIn();
- that.promptingConent = "系统错误,请稍后再试!";
- that.promptingStatus = false;
- that.loadShow = false;
- that.dialog = that
- .$createDialog({
- type: "alert",
- title: "系统错误,请稍后再试!",
- content: "点击返回首页",
- icon: "cubeic-wrong",
- onConfirm: (e, promptValue) => {
- that.$router.push({ path: "/main" });
- }
- })
- .show();
- setTimeout(function() {
- $("#fade").fadeOut();
- }, 2000);
- }
- });
- },
- validateHandler(result) {
- // this.submitHandler()
- console.log(result);
- this.resule = result;
- var that = this;
- that.validity = result.validity;
- that.valid = result.valid;
- // if (that.vali == true) {
- // $("#fade").fadeIn();
- // that.promptingConent = "提交失败,请填写必填信息!";
- // that.promptingStatus = false;
- // setTimeout(function() {
- // $("#fade").fadeOut();
- // }, 2000);
- // }
- // that.vali = false;
- },
- dateSelectHandler(selectedVal) {
- this.model.dateValue = new Date(
- selectedVal[0],
- selectedVal[1] - 1,
- selectedVal[2]
- ).toDateString();
- },
- filesAdded(files) {
- let hasIgnore = false;
- const maxSize = 1000 * 1024 * 1024; // 1M
- for (let k in files) {
- const file = files[k];
- if (file.size > maxSize) {
- file.ignore = true;
- hasIgnore = true;
- }
- }
- hasIgnore &&
- this.$createToast({
- type: "warn",
- time: 1000,
- txt: "不能上传超过100M的文件"
- }).show();
- },
- filesAdded1(files) {
- let hasIgnore = false;
- const maxSize = 1000 * 1024 * 1024; // 1M
- for (let k in files) {
- const file = files[k];
- if (file.size > maxSize) {
- file.ignore = true;
- hasIgnore = true;
- }
- }
- hasIgnore &&
- this.$createToast({
- type: "warn",
- time: 1000,
- txt: "不能上传超过100M的文件"
- }).show();
- },
- fileSubmitted(files) {
- this.action.data = { fileName: files.name };
- },
- fileSubmitted1(files) {
- this.action1.data = { fileName: files.name };
- },
- // 展示事件分类选择器
- showCategoryPicker() {
- this.categoryPicker.show();
- },
- // 选择事件分类
- selectCategoryHandler(selectedVal, selectedIndex, selectedTxt) {
- // console.log(this.initSjList, "事件分类列表");
- // console.log(this.model.category.slice(-1)[0], "事件分类");
- var selected = [];
- selectedTxt.forEach(function(v, i) {
- if (v != "") {
- selected.push(v);
- }
- });
- this.selectedCategoryTxt = this.model.title = this.model.description = this.incidentTitle =
- selected[selected.length - 1];
- this.model.category = selectedVal;
- // var category = {
- // index: selectedIndex,
- // txt: this.selectedCategoryTxt
- // };
- // localStorage.setItem("category", JSON.stringify(category));
- // ----------------------回显其他数据---------------------
- console.log(selectedVal, "seimin");
- let reverseArr = selectedVal.filter(Boolean).reverse(); //数组翻转,取第一项不为空的
- let sjId = reverseArr[0]; //事件Id
- let sj = this.initSjList.filter(v => v.id == sjId)[0];
- console.log(sj);
- this.model.priority = sj.priority?sj.priority.id:null;
- if (sj.branchType == 0) {
- if (sj.userOrGroupType === 1) {
- //派人
- this.order = 2;
- this.model.handleUserOrGroup = true;
- this.model.handlerUser = sj.handleUser ? sj.handleUser.id : "";
- } else if (sj.userOrGroupType === 2) {
- //派组
- this.order = 2;
- this.model.handleUserOrGroup = false;
- this.model.candidateGroups = sj.group ? sj.group.id : "";
- } else {
- this.order = 1;
- this.model.handleUserOrGroup = false;
- this.model.handlerUser = "";
- this.model.candidateGroups = "";
- }
- } else if (sj.branchType == 1) {
- // 分校区
- let branchId = this.model.placeValue[0]; //校区id
- if (branchId) {
- // 选择了校区
- let branchUserGroup =
- sj.branchUserGroups.find(v => v.branchId == branchId) || {};
- if (branchUserGroup.branchUserOrGroupType == 1) {
- //派人
- this.order = 2;
- this.model.handleUserOrGroup = true;
- this.model.handlerUser = branchUserGroup.userId
- ? branchUserGroup.userId
- : undefined;
- } else if (branchUserGroup.branchUserOrGroupType === 2) {
- //派组
- this.order = 2;
- this.model.handleUserOrGroup = false;
- this.model.candidateGroups = branchUserGroup.groupId
- ? branchUserGroup.groupId
- : undefined;
- } else {
- this.order = 1;
- this.model.handleUserOrGroup = false;
- this.model.handlerUser = "";
- this.model.candidateGroups = "";
- }
- } else {
- this.order = 1;
- this.model.handleUserOrGroup = false;
- this.model.handlerUser = "";
- this.model.candidateGroups = "";
- }
- }
- console.log(this.order, sj.hasSimple);
- if (this.order == 1 && sj.hasSimple == 1) {
- // 直接处理 && 简单处理
- this.isShowDes = false;
- } else {
- this.isShowDes = true;
- }
- },
- // 事件分类
- getIncidentcategory() {
- this.loadShow = true;
- var that = this;
- this.$http
- .post("service/bpm/data/fetchDataList/incidentcategory", {
- idx: 0,
- sum: 1000
- })
- .then(function(res) {
- that.initSjList = JSON.parse(JSON.stringify(res.data.list));
- var list = res.data.list;
- var tree = [];
- list.forEach((v, i) => {
- if (!v.parent) {
- tree[i] = {
- value: v.id,
- text: v.category,
- children: []
- };
- } else {
- tree.forEach((val, idx) => {
- if (
- v.parent &&
- !v.parent.parent &&
- val.text == v.parent.category
- ) {
- tree[idx].children.push({
- value: v.id,
- text: v.category,
- children: []
- });
- } else if (v.parent.parent) {
- tree[idx].children.forEach((value, index) => {
- if (value.text == v.parent.category) {
- tree[idx].children[index].children.push({
- value: v.id,
- text: v.category
- });
- }
- });
- }
- });
- }
- });
- that.selectData = tree;
- that.categoryPicker = that.$createCascadePicker({
- title: "事件分类选择",
- data: that.selectData,
- // selectedIndex: localStorage.getItem("category")
- // ? JSON.parse(localStorage.getItem("category")).index
- // : [0, 0, 0],
- selectedIndex:[0, 0, 0],
- onSelect: that.selectCategoryHandler
- });
- that.loadShow = false;
- });
- },
- getRoomData(placeId) {
- this.$http
- .post("service/user/data/fetchDataList/room", {
- idx: 0,
- sum: 1000,
- room: { place: { id: placeId } }
- })
- .then(result => {
- let arr = [];
- result.data.list = result.data.list || [];
- result.data.list.forEach(item => {
- arr.push({ value: item.id, text: item.room });
- });
- this.fields.forEach(item => {
- // 初始化房间号下拉框列表
- if (item.modelKey == "room") {
- item.props.options = arr;
- }
- });
- });
- },
- // 校区区域地点
- showPlacePicker() {
- this.placePicker.show();
- },
- selectPlaceHandler(selectedVal, selectedIndex, selectedTxt) {
- console.log(selectedVal, selectedIndex, selectedTxt);
- console.log(selectedVal[0], "校区");
- console.log(this.initSjList, "事件分类列表");
- console.log(this.model.category.slice(-1)[0], "事件分类");
- if (this.ifRoom == 1) {
- this.getRoomData(selectedVal[1]);
- }
- this.model.placeValue = selectedVal;
- this.selectedPlaceTxt = selectedTxt.join(" ");
- // 分院区
- // --------------------start---------------------
- let categoryId = this.model.category.slice(-1)[0];
- if (categoryId) {
- // 选择了事件分类
- let categoryObj = this.initSjList.find(v => v.id == categoryId);
- if (categoryObj) {
- if (categoryObj.branchType == 1) {
- // 分院区开关打开的情况下
- let branchId = this.model.placeValue[0];
- let branchUserGroup =
- categoryObj.branchUserGroups.find(v => v.branchId == branchId) ||
- {};
- if (branchUserGroup.branchUserOrGroupType == 1) {
- //派人
- this.order = 2;
- this.model.handleUserOrGroup = true;
- this.model.handlerUser = branchUserGroup.userId
- ? branchUserGroup.userId
- : undefined;
- } else if (branchUserGroup.branchUserOrGroupType === 2) {
- //派组
- this.order = 2;
- this.model.handleUserOrGroup = false;
- this.model.candidateGroups = branchUserGroup.groupId
- ? branchUserGroup.groupId
- : undefined;
- } else {
- this.order = 1;
- this.model.handleUserOrGroup = false;
- this.model.handlerUser = "";
- this.model.candidateGroups = "";
- }
- } else {
- this.order = 1;
- this.model.handleUserOrGroup = false;
- this.model.handlerUser = "";
- this.model.candidateGroups = "";
- }
- } else {
- this.order = 1;
- this.model.handleUserOrGroup = false;
- this.model.handlerUser = "";
- this.model.candidateGroups = "";
- }
- } else {
- this.order = 1;
- this.model.handleUserOrGroup = false;
- this.model.handlerUser = "";
- this.model.candidateGroups = "";
- }
- // --------------------end---------------------
- // var place = {
- // index: selectedIndex,
- // txt: this.model.houseNumber
- // };
- // localStorage.setItem("place", JSON.stringify(place));
- },
- // 报修科室
- showDeptPicker() {
- this.deptPicker.show();
- },
- // 选中报修科室
- selectDeptHandler(selectedVal, selectedIndex, selectedTxt) {
- console.log(selectedVal, selectedIndex, selectedTxt);
- this.deptInpVal = selectedTxt;
- this.model.requester = this.deptRes[selectedIndex];
- console.log(this.deptRes[selectedIndex]);
- this.inpLocalVal = this.model.address = this.deptRes[selectedIndex].place
- .area
- ? this.deptRes[selectedIndex].place.area.area
- ? this.deptRes[selectedIndex].place.place
- ? this.deptRes[selectedIndex].place.area.area +
- this.deptRes[selectedIndex].place.place
- : this.deptRes[selectedIndex].place.area.area
- : this.deptRes[selectedIndex].place.area
- : this.deptRes[selectedIndex].place.place;
- if (this.deptRes[selectedIndex].phone) {
- this.model.contactsInformation = this.deptRes[selectedIndex].phone;
- }
- // this.model.houseNumber = this.selectedPlaceTxt = selectedTxt.join(" ");
- // var place = {
- // index: selectedIndex,
- // txt: this.model.houseNumber
- // };
- // localStorage.setItem("place", JSON.stringify(place));
- },
- // 取消选中报修科室
- cancelDeptHandler() {
- if (this.model.requester) {
- this.deptInpVal = this.model.requester.dept;
- } else if (!this.model.requester) {
- this.deptInpVal = "";
- this.model.requester = "";
- }
- // this.model.houseNumber = this.selectedPlaceTxt = selectedTxt.join(" ");
- // var place = {
- // index: selectedIndex,
- // txt: this.model.houseNumber
- // };
- // localStorage.setItem("place", JSON.stringify(place));
- },
- // getBranchData() {
- // this.$http
- // .post("service/user/data/fetchDataList/branch", {
- // idx: 0,
- // sum: 1000,
- // })
- // .then(res => {
- // let data = res.data.list;
- // for (let i = 0; i < data.length; i++) {
- // this.placeSelectData.push({
- // text: data[i].hosName,
- // value: data[i].id,
- // children: []
- // });
- // }
- // console.log(this.placeSelectData,'校区');
- // this.getAreaData();
- // });
- // },
- // getAreaData() {
- // this.$http
- // .post("service/user/data/fetchDataList/area", {
- // idx: 0,
- // sum: 1000,
- // area: {
- // wechatArea: true
- // }
- // })
- // .then(res => {
- // this.initAreaList = JSON.parse(JSON.stringify(res.data.list));
- // let data = res.data.list;
- // for (let i = 0; i < data.length; i++) {
- // for (let j = 0; j < this.placeSelectData.length; j++) {
- // if (data[i].branch == this.placeSelectData[j].value) {
- // this.placeSelectData[j].children.push({
- // text: data[i].area,
- // value: data[i].id
- // });
- // }
- // }
- // }
- // console.log(this.placeSelectData,'区域');
- // this.getPlaceData();
- // });
- // },
- getPlaceData() {
- this.$http
- .post("service/user/data/fetchDataList/place", {
- idx: 0,
- sum: 1000,
- area: {
- wechatAreaId: ""
- }
- })
- .then((res) => {
- let data = res.data.list;
- // for (let i = 0; i < data.length; i++) {
- // for (let j = 0; j < this.placeSelectData.length; j++) {
- // if (data[i].area.id == this.placeSelectData[j].value) {
- // this.placeSelectData[j].children.push({
- // text: data[i].place,
- // value: data[i].id
- // });
- // }
- // }
- // }
- console.log(data, 'data');
- this.placeSelectData = [];
- const collectionBranch = {};
- data.forEach((v) => {
- if(collectionBranch[v.area.branch]){
- collectionBranch[v.area.branch].push(v);
- }else{
- this.placeSelectData.push({text:v.area.branchName, value: v.area.branch, children: []})
- collectionBranch[v.area.branch] = [v];
- }
- })
- this.placeSelectData.forEach(v => {
- let areaByPlace = collectionBranch[v.value];
- let areaCollection = {};
- let areaArr = [];
- areaByPlace.forEach(vv => {
- if(areaCollection[vv.area.id]){
- areaCollection[vv.area.id].push({text:vv.place, value: vv.id});
- }else{
- areaArr.push({text:vv.area.area, value: vv.area.id, children: []})
- areaCollection[vv.area.id] = [{text:vv.place, value: vv.id}];
- }
- })
- areaArr.forEach(vv => {
- vv.children = areaCollection[vv.value];
- })
- v.children = areaArr;
- })
- console.log(collectionBranch,'collectionBranch集合');
- console.log(this.placeSelectData,'地点');
- this.placePicker = this.$createCascadePicker({
- title: "校区区域地点选择",
- data: this.placeSelectData,
- selectedIndex: [0, 0, 0],
- onSelect: this.selectPlaceHandler
- });
- });
- },
- // 故障地点
- getFaultLocation(type) {
- var that = this;
- this.$http
- .post("service/apply/bpm/searchFaultLocation", {
- searchKey: this.inpLocalVal || ""
- })
- .then(function(res) {
- var data = res.data.result;
- that.allPlace = JSON.parse(JSON.stringify(res.data.result));
- if (type == 1) {
- that.faultLocationList.length = 0;
- that.$set(that.faultLocationList, true, []);
- that.faultLocationList;
- }
- for (var i = 0; i < data.length; i++) {
- that.faultLocationList.push({
- text: data[i].area
- ? data[i].area.area
- ? data[i].place
- ? data[i].area.area + data[i].place
- : data[i].area.area
- : data[i].area
- : data[i].place,
- value: data[i].id
- });
- }
- console.log(that.faultLocationList);
- that.placePicker = that.$createCascadePicker({
- title: "校区区域地点选择",
- data: that.faultLocationList,
- // selectedIndex: localStorage.getItem("place")
- // ? JSON.parse(localStorage.getItem("place")).index
- // : [0, 0],
- onSelect: that.selectPlaceHandler
- });
- // that.fields[19].props.options = that.faultLocationList;
- });
- },
- // 故障地点输入框节流阀
- changeLocalList() {
- var that = this;
- this.model.address = this.inpLocalVal;
- console.log(this.inpLocalVal);
- clearTimeout(that.timer);
- that.timer = setTimeout(() => {
- this.getFaultLocation(1);
- }, 600);
- },
- // 报修科室
- getDept(type) {
- var that = this;
- this.$http
- .post("service/user/data/fetchDataList/department", {
- idx: 0,
- sum: 50,
- department: { dept: that.deptInpVal || "" }
- })
- .then(function(res) {
- var data = res.data.list;
- if (type == 1) {
- that.deptList.length = 0;
- that.$set(that.deptList, true, []);
- that.deptList;
- }
- that.deptRes = res.data.list;
- for (var i = 0; i < data.length; i++) {
- that.deptList.push({
- text: data[i].dept,
- value: data[i].id
- });
- }
- that.deptPicker = that.$createCascadePicker({
- title: "报修科室选择",
- data: that.deptList,
- onSelect: that.selectDeptHandler,
- onCancel: that.cancelDeptHandler
- });
- });
- },
- changeDeptList() {
- var that = this;
- clearTimeout(that.timer);
- that.timer = setTimeout(() => {
- this.getDept(1);
- }, 600);
- }
- },
- created() {
- console.log(this.$route.params.data);
- //获取事件来源
- this.getSource();
- // 优先级
- this.getPriority();
- // 紧急度
- this.getMergency();
- // 影响度
- this.getInfluence();
- // 处理方式
- this.getHandleCategory();
- // 处理结果
- this.getClosecode();
- // 处理人
- this.getHandlerUser();
- // 处理组
- this.getCandidateGroups();
- // this.getbxcode();
- this.getMessage();
- // 事件单号
- this.getsjnum();
- // 事件分类
- this.getIncidentcategory();
- this.getPlaceData();
- // 获取故障地点
- // this.getFaultLocation();
- if (this.valConfig == 2) {
- this.getDept();
- }
- },
- beforeRouteLeave(to, from, next) {
- console.log(to);
- if (to.name == "InspectionDetail") {
- this.$router.push({ name: "Inspection" });
- } else {
- next();
- }
- },
- mounted() {
- this.$refs.upload.pause();
- if (this.$refs.upload1) {
- this.$refs.upload1.pause();
- }
- },
- components: {
- seiminModel,
- CubePage,
- CubeButtonGroup,
- DatePicker,
- // JsonView
- CubeExtendPopup,
- LoadIng,
- PrompTing
- }
- };
- </script>
- <style scoped>
- .newIncident .cube-form-group {
- border-bottom: 0.02rem solid rgb(245, 245, 245);
- }
- .newIncident .sub .cube-btn {
- margin-top: 1.1rem;
- }
- .btn_plcaeholde .cube-btn {
- padding-left: 0;
- padding-right: 0;
- text-align: left;
- color: inherit;
- background: none;
- border: none;
- white-space: normal;
- }
- .inp_local {
- outline: none;
- width: 100%;
- height: 36px;
- color: #666;
- }
- .btn_plcaeholde .cube-btn::after {
- content: ">";
- float: right;
- margin-right: 0.15rem;
- }
- .cube-form_standard .cube-upload-def .cube-upload-btn,
- .cube-form_standard .cube-upload-def .cube-upload-file {
- margin-left: 3% !important;
- }
- .sub .cube-btn {
- background-color: #005395 !important;
- width: 90%;
- margin: 0 auto;
- border-radius: 8px;
- }
- .cube-picker-wheel-item {
- text-overflow: ellipsis;
- }
- </style>
- <style lang="less" scoped>
- .zc {
- display: flex;
- position: relative;
- .zc-item {
- flex: 7;
- }
- .zc-sao {
- flex: 3;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 0.6rem;
- }
- }
- .header {
- width: 100%;
- height: 0.88rem;
- line-height: 0.88rem;
- text-align: center;
- color: #fff;
- font-size: 0.37rem;
- background: linear-gradient(#2e2f32, #414246);
- position: fixed;
- top: 0;
- z-index: 6;
- }
- .incidentTitle {
- .titleRefer {
- display: flex;
- align-items: center;
- justify-content: space-between;
- .titleTxtArea {
- font-size: 0.3rem;
- color: #333;
- height: auto;
- width: 62%;
- &:focus {
- outline: none;
- }
- }
- .abtn {
- display: inline-block;
- width: 37%;
- text-align: center;
- height: 0.48rem;
- color: #005395;
- font-size: 0.28rem;
- }
- }
- }
- .form-custom {
- .cube-form-item {
- .cube-btn {
- padding-left: 0;
- padding-right: 0;
- text-align: left;
- color: inherit;
- background: none;
- border: none;
- }
- }
- }
- .label {
- background-color: rgb(238, 238, 238);
- height: 0.6rem;
- line-height: 0.6rem;
- padding-left: 0.2rem;
- font-size: 0.24rem;
- color: #666666;
- span {
- font-size: 0.2rem;
- display: inline-block;
- margin-left: 0.08rem;
- color: #999999;
- }
- &.formLabel {
- background-color: #fff;
- }
- }
- .zhidu {
- display: flex;
- height: 0.7rem;
- line-height: 0.7rem;
- border-bottom: 0.02rem solid rgb(245, 245, 245);
- div:nth-child(1) {
- width: 27.5%;
- padding-left: 6%;
- }
- }
- .bgColor {
- background-color: white;
- &.newIncident {
- padding-top: 1.84rem;
- }
- }
- .uplod {
- padding: 0 0.24rem;
- border-bottom: 0.02rem solid rgb(245, 245, 245);
- }
- .navBar {
- width: 100%;
- height: 0.96rem;
- line-height: 0.96rem;
- background-color: #e5e5e5;
- font-size: 0.28rem;
- position: fixed;
- top: 0.88rem;
- z-index: 6;
- div {
- width: 49%;
- text-align: center;
- a {
- display: inline-block;
- height: 0.9rem;
- width: 1.7rem;
- padding: 0 0.3rem;
- &.active {
- color: #005395;
- border-bottom: 0.06rem solid #005395;
- }
- }
- }
- }
- .handleRadio {
- border-bottom: 0.02rem solid rgb(245, 245, 245);
- }
- </style>
|