assign.vue 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726
  1. <template>
  2. <view class="handler">
  3. <view class="head">
  4. <view class="tab" :class="{active: tab.value === dataInfo.tabActiveValue}" v-for="tab in dataInfo.tabs" :key="tab.id" @click="clickTab(tab.value)">
  5. {{tab.name}}<text v-if="tab.num !== ''">({{tab.num}})</text>
  6. </view>
  7. </view>
  8. <!-- <scroll-view scroll-y class="body page_padding"> -->
  9. <view class="body page_padding view-body">
  10. <!-- 故障处理 -->
  11. <template v-if="dataInfo.tabActiveValue === 'direct'">
  12. <view class="form_item column" v-if="HandleData.simpleness != 1">
  13. <view class="title title-width">
  14. <text class="required newicon newicon-bitian"></text>
  15. <view class="title-fl-sb">
  16. 解决方案:
  17. <view @click="importRep('reissue','direct')" class="import-rep">引入知识库({{dataInfo.introduceCount}})</view>
  18. </view>
  19. </view>
  20. <uni-easyinput class="value" type="textarea" v-model="dataInfo.handleDescription" placeholder="请输入解决方案" :class="{formRed: isSubmit && !dataInfo.handleDescription.trim()}" />
  21. </view>
  22. <view class="form_item" v-if="HandleData.simpleness != 1">
  23. <view class="title"><text class="required newicon newicon-bitian"></text>故障现象:</view>
  24. <view class="value category" @click="selectCategory">
  25. <text class="categoryName ellipsis-multiline">{{dataInfo.category.mutiCategory}}</text>
  26. <text class="newicon newicon-weibiaoti2010104"></text>
  27. </view>
  28. </view>
  29. <view class="form_item">
  30. <view class="title select"><text class="required newicon newicon-bitian"></text>处理方式:</view>
  31. <!-- <uni-data-select class="value" v-model="dataInfo.handleCategory" :localdata="dataInfo.handleCategoryList" :clear="false" placeholder="请选择处理方式" :class="{formRed: isSubmit && !dataInfo.handleCategory}"></uni-data-select> -->
  32. <uni-data-picker class="value" placeholder="请选择处理方式"
  33. :localdata="dataInfo.handleCategoryList" v-model="dataInfo.handleCategory"
  34. :clear-icon="false" :class="{formRed: isSubmit && !dataInfo.handleCategory}">
  35. </uni-data-picker>
  36. </view>
  37. <view class="form_item" v-if="HandleData.simpleness != 1">
  38. <view class="title select"><text class="required newicon newicon-bitian"></text>处理结果:</view>
  39. <!-- <uni-data-select class="value" v-model="dataInfo.closecode" :localdata="dataInfo.closecodeList" :clear="false" placeholder="请选择处理结果" :class="{formRed: isSubmit && !dataInfo.closecode}"></uni-data-select> -->
  40. <uni-data-picker class="value" placeholder="请选择处理结果"
  41. :localdata="dataInfo.closecodeList" v-model="dataInfo.closecode"
  42. :clear-icon="false" :class="{formRed: isSubmit && !dataInfo.closecode}">
  43. </uni-data-picker>
  44. </view>
  45. <view class="form_item">
  46. <view class="title"><text class="required newicon newicon-bitian transparent"></text>协同人员:</view>
  47. <text class="synergeticNames ellipsis">{{ synergeticArr}}</text>
  48. <button type="primary" plain size="mini" class="primaryPlainButton synergeticAdd" @click="synergeticAdd">+立即添加</button>
  49. </view>
  50. <view class="form_item_column">
  51. <view class="form_item">
  52. <view class="title"><text class="required newicon newicon-bitian transparent"></text>处理图片:</view>
  53. <view class="value">
  54. <uni-file-picker ref="handlerImgRef" v-model="dataInfo.handlerImgList" limit="3" @success="handlerImgSuccess" @fail="handlerImgFail" @select="handlerImgSelect" @delete="handlerImgDelete"></uni-file-picker>
  55. </view>
  56. </view>
  57. <view class="form_item">
  58. <view class="title transparent"><text class="required newicon newicon-bitian transparent"></text>处理图片:</view>
  59. <view class="value">
  60. <text class="imgTips ellipsis">(支持JPG/PNG格式图片,单张大小10M以内)</text>
  61. </view>
  62. </view>
  63. </view>
  64. </template>
  65. <!-- 补单 -->
  66. <template v-if="dataInfo.tabActiveValue === 'supplement' && dataInfo.supplementFlag">
  67. <view class="form_item">
  68. <view class="title select"><text class="required newicon newicon-bitian"></text>登记时间:</view>
  69. <uni-datetime-picker class="value" type="datetime" v-model="dataInfo.acceptDate" :class="{formRed: isSubmit && !dataInfo.acceptDate}" />
  70. </view>
  71. <view class="form_item">
  72. <view class="title select"><text class="required newicon newicon-bitian"></text>接单时间:</view>
  73. <uni-datetime-picker class="value" type="datetime" v-model="dataInfo.responseHandleTime" :class="{formRed: isSubmit && !dataInfo.responseHandleTime}" />
  74. </view>
  75. <view class="form_item">
  76. <view class="title select"><text class="required newicon newicon-bitian"></text>解决时间:</view>
  77. <uni-datetime-picker class="value" type="datetime" v-model="dataInfo.handleTime" :class="{formRed: isSubmit && !dataInfo.handleTime}" />
  78. </view>
  79. <view class="form_item">
  80. <view class="title select"><text class="required newicon newicon-bitian"></text>处理人:</view>
  81. <uni-data-picker class="value" placeholder="请选择处理人"
  82. :localdata="dataInfo.userList" v-model="dataInfo.handlingPersonnelUserId"
  83. :clear-icon="false" :class="{formRed: isSubmit && !dataInfo.handlingPersonnelUserId}">
  84. </uni-data-picker>
  85. </view>
  86. </template>
  87. <!-- 补单-下一步 -->
  88. <template v-if="dataInfo.tabActiveValue === 'supplement' && !dataInfo.supplementFlag">
  89. <view class="form_item column" v-if="HandleData.simpleness != 1">
  90. <view class="title title-width">
  91. <text class="required newicon newicon-bitian"></text>
  92. <view class="title-fl-sb">
  93. 解决方案:
  94. <view @click="importRep('reissue','reissue')" class="import-rep">引入知识库({{dataInfo.introduceCount}})</view>
  95. </view>
  96. </view>
  97. <uni-easyinput class="value" type="textarea" v-model="dataInfo.handleDescription" placeholder="请输入解决方案" :class="{formRed: isSubmit && !dataInfo.handleDescription.trim()}" />
  98. </view>
  99. <view class="form_item" v-if="HandleData.simpleness != 1">
  100. <view class="title"><text class="required newicon newicon-bitian"></text>故障现象:</view>
  101. <view class="value category" @click="selectCategory('assign_supplement')">
  102. <text class="categoryName ellipsis-multiline">{{dataInfo.category.mutiCategory}}</text>
  103. <text class="newicon newicon-weibiaoti2010104"></text>
  104. </view>
  105. </view>
  106. <view class="form_item">
  107. <view class="title select"><text class="required newicon newicon-bitian"></text>处理方式:</view>
  108. <uni-data-picker class="value" placeholder="请选择处理方式"
  109. :localdata="dataInfo.handleCategoryList" v-model="dataInfo.handleCategory"
  110. :clear-icon="false" :class="{formRed: isSubmit && !dataInfo.handleCategory}">
  111. </uni-data-picker>
  112. </view>
  113. <view class="form_item" v-if="HandleData.simpleness != 1">
  114. <view class="title select"><text class="required newicon newicon-bitian"></text>处理结果:</view>
  115. <uni-data-picker class="value" placeholder="请选择处理结果"
  116. :localdata="dataInfo.closecodeList" v-model="dataInfo.closecode"
  117. :clear-icon="false" :class="{formRed: isSubmit && !dataInfo.closecode}">
  118. </uni-data-picker>
  119. </view>
  120. <view class="form_item">
  121. <view class="title"><text class="required newicon newicon-bitian transparent"></text>协同人员:</view>
  122. <text class="synergeticNames ellipsis">{{synergeticArr}}</text>
  123. <button type="primary" plain size="mini" class="primaryPlainButton synergeticAdd" @click="synergeticAdd('assign_supplement')">+立即添加</button>
  124. </view>
  125. <view class="form_item_column">
  126. <view class="form_item">
  127. <view class="title"><text class="required newicon newicon-bitian transparent"></text>处理图片:</view>
  128. <view class="value">
  129. <uni-file-picker ref="handlerImgRef" v-model="dataInfo.handlerImgList" limit="3" @success="handlerImgSuccess" @fail="handlerImgFail" @select="handlerImgSelect" @delete="handlerImgDelete"></uni-file-picker>
  130. </view>
  131. </view>
  132. <view class="form_item">
  133. <view class="title transparent"><text class="required newicon newicon-bitian transparent"></text>处理图片:</view>
  134. <view class="value">
  135. <text class="imgTips ellipsis">(支持JPG/PNG格式图片,单张大小10M以内)</text>
  136. </view>
  137. </view>
  138. </view>
  139. </template>
  140. <!-- 派单 -->
  141. <template v-if="dataInfo.tabActiveValue === 'assign'">
  142. <view class="form_item">
  143. <view class="title select"><text class="required newicon newicon-bitian"></text>工作组:</view>
  144. <!-- <uni-data-select class="value" v-model="dataInfo.groupId" :localdata="dataInfo.groupList" :clear="false" placeholder="请选择工作组" @change="changeGroup" :class="{formRed: isSubmit && !dataInfo.groupId}"></uni-data-select> -->
  145. <uni-data-picker class="value" placeholder="请选择工作组"
  146. :localdata="dataInfo.groupList" v-model="dataInfo.groupId"
  147. :clear-icon="false" @change="changeGroup" :class="{formRed: isSubmit && !dataInfo.groupId}">
  148. </uni-data-picker>
  149. </view>
  150. <view class="form_item">
  151. <view class="title radio"><text class="required newicon newicon-bitian"></text>是否转派到人:</view>
  152. <uni-data-checkbox class="value" v-model="dataInfo.isAssignUser" :localdata="dataInfo.isAssignUserList" @change="changeIsAssignUser" />
  153. </view>
  154. <view class="form_item" v-if="dataInfo.isAssignUser === 1">
  155. <view class="title select"><text class="required newicon newicon-bitian"></text>转派对象:</view>
  156. <!-- <uni-data-select class="value" v-model="dataInfo.userId" :localdata="dataInfo.userList" :clear="false" placeholder="请选择转派对象" :class="{formRed: isSubmit && dataInfo.groupId && dataInfo.isAssignUser == 1 && !dataInfo.userId}"></uni-data-select> -->
  157. <uni-data-picker class="value" placeholder="请选择转派对象"
  158. :localdata="dataInfo.userList" v-model="dataInfo.userId"
  159. :clear-icon="false" :class="{formRed: isSubmit && dataInfo.groupId && dataInfo.isAssignUser == 1 && !dataInfo.userId}">
  160. </uni-data-picker>
  161. </view>
  162. <!-- <view class="form_item_column">
  163. <view class="form_item">
  164. <view class="title"><text class="required newicon newicon-bitian transparent"></text>处理图片:</view>
  165. <view class="value">
  166. <uni-file-picker ref="handlerImgRef" v-model="dataInfo.handlerImgList" limit="3" @success="handlerImgSuccess" @fail="handlerImgFail" @select="handlerImgSelect" @delete="handlerImgDelete"></uni-file-picker>
  167. </view>
  168. </view>
  169. <view class="form_item">
  170. <view class="title transparent"><text class="required newicon newicon-bitian transparent"></text>处理图片:</view>
  171. <view class="value">
  172. <text class="imgTips ellipsis">(支持JPG/PNG格式图片,单张大小10M以内)</text>
  173. </view>
  174. </view>
  175. </view> -->
  176. </template>
  177. </view>
  178. <!-- </scroll-view> -->
  179. <view class="foot_common_btns">
  180. <template v-if="dataInfo.tabActiveValue === 'supplement' && dataInfo.supplementFlag">
  181. <button @click="goBack" type="default" class="primaryButton btn">上一步</button>
  182. <button @click="next" type="default" class="primaryButton btn">下一步</button>
  183. </template>
  184. <template v-else>
  185. <button @click="previous" type="default" class="primaryButton btn" v-if="dataInfo.tabActiveValue === 'supplement'">上一步</button>
  186. <button @click="goBackView" type="default" class="cancelButton btn" v-else>返回</button>
  187. <button @click="submit" type="default" class="primaryButton btn">提交</button>
  188. </template>
  189. </view>
  190. </view>
  191. </template>
  192. <script setup>
  193. import { ref, reactive, computed } from 'vue'
  194. import { onLoad } from '@dcloudio/uni-app'
  195. import { generateNumberArray } from '@/utils/index.js'
  196. import { api_group, getFetchDataList, api_incidentDetail, api_getSolution, api_user, api_incidentTask, api_branch, api_dutyDepartment, api_getDictionary, api_querySummaryDoc, api_addSummaryDoc, api_systemConfiguration, api_sj } from "@/http/api.js"
  197. import { defaultColor } from '@/static/js/theme.js'
  198. import { useSetTitle } from '@/share/useSetTitle.js'
  199. import { useMakePhoneCall } from '@/share/useMakePhoneCall.js'
  200. import { useUploadFile } from '@/share/useUploadFile.js'
  201. import { useGoBack } from '@/share/useGoBack.js'
  202. import { useLoginUserStore } from '@/stores/loginUser'
  203. import { useHandlerStore } from '@/stores/handler'
  204. import { useIncidentBuildStore } from '@/stores/incidentBuild'
  205. useSetTitle();
  206. const loginUserStore = useLoginUserStore();
  207. const handlerStore = useHandlerStore();
  208. const incidentBuildStore = useIncidentBuildStore();
  209. const { makePhoneCall } = useMakePhoneCall();
  210. const { uploadFile } = useUploadFile();
  211. const { goBack } = useGoBack();
  212. // 主题颜色
  213. const primaryColor = ref(defaultColor)
  214. // 知识库id
  215. const solutionId = ref(null)
  216. // 楼层id
  217. const floorId = ref(null)
  218. // 是否简单处理
  219. const HandleData = reactive({
  220. simpleness:null
  221. })
  222. // 协同人员
  223. const synergeticArr = ref(null)
  224. const dicData = ref(null)
  225. const dutyList = ref(null)
  226. const userTypes = ref(null)
  227. const shijianliebiao_supplement = ref(false)
  228. // 数据
  229. const dataInfo = reactive({
  230. tabs: [
  231. {id: 5, name: '直接处理', value: 'direct', num: ''},
  232. // {id: 7, name: '补单', value: 'supplement', num: ''},
  233. {id: 6, name: '派单', value: 'assign', num: ''},
  234. ],
  235. tabActiveValue: 0,//当前选择的tab
  236. incidentId: undefined,//事件ID
  237. incidentData: {},//事件对象
  238. groupList: [], //工作组列表
  239. groupId: undefined, //工作组ID
  240. userIdList: [], //延期天数列表
  241. userIdId: undefined, //延期天数ID
  242. deferralRemark: '',//延期说明
  243. summaryObj: {
  244. consumableList: [],//耗材列表
  245. workHourManagementList: [],//工时列表
  246. },//汇总单信息
  247. summaryId: undefined,//汇总单Id
  248. isNumber: false,//修改数量弹窗
  249. evtNumber: 1,//弹窗返回的数量
  250. selectData: {},//选择的对象
  251. selectType: {},//选择的对象类型
  252. handleDescription: '',//解决方案
  253. handleCategory: undefined,//处理方式
  254. handleCategoryList: [],//处理方式列表
  255. closecode: undefined,//处理结果
  256. closecodeList: [],//处理结果列表
  257. handlerImgList: [],//处理图片列表
  258. category: {},//故障现象
  259. synergetic: null,//协同人员
  260. isAssignUser: 1, //工作组是否转派到人
  261. isAssignUserList: [
  262. { text: '是', value: 1 },
  263. { text: '否', value: 0 },
  264. ], //工作组是否转派到人选项
  265. supplementFlag: true,//补单是否有下一步
  266. acceptDate: undefined,//补单-登记时间
  267. responseHandleTime: undefined,//补单-接单时间
  268. handleTime: undefined,//补单-解决时间
  269. handlingPersonnelUserId: undefined,//补单-处理人
  270. // introduceCount :0 //引入次数
  271. })
  272. // 是否提交
  273. const isSubmit = ref(false)
  274. // 处理图片
  275. const handlerImgRef = ref(null)
  276. // 上传报修图片
  277. function handlerImgSuccessNew(){
  278. let requestList = [];
  279. // 报修图片
  280. dataInfo.incidentData.repairImgList.forEach(v => {
  281. let repairOrderImg$ = repairOrderImg(v);
  282. requestList.push(repairOrderImg$);
  283. })
  284. Promise.all(requestList).then(resList => {
  285. uni.hideLoading();
  286. console.log(resList);
  287. incidentBuildStore.clearIncidentBuildData();
  288. uni.showToast({
  289. icon: 'none',
  290. title: '建单成功',
  291. mask: true,
  292. });
  293. setTimeout(() => {
  294. uni.reLaunch({
  295. url: '/pages/incidentList/incidentList',
  296. })
  297. }, 1500)
  298. })
  299. }
  300. // 返回引用知识库
  301. function goBackView(){
  302. handlerStore.setHandlerData(dataInfo, 'assign', 'assign');
  303. goBack()
  304. }
  305. // 上传处理图片成功
  306. function handlerImgSuccess(e){
  307. dataInfo.handlerImgList.forEach(v => {
  308. v.url = v.path;
  309. })
  310. console.log(dataInfo.handlerImgList);
  311. let requestList = [];
  312. // 处理图片
  313. dataInfo.handlerImgList.forEach(v => {
  314. let handlerOrderImg$ = handlerOrderImg(v);
  315. requestList.push(handlerOrderImg$);
  316. })
  317. // 报修图片
  318. dataInfo.incidentData.repairImgList.forEach(v => {
  319. let repairOrderImg$ = repairOrderImg(v);
  320. requestList.push(repairOrderImg$);
  321. })
  322. Promise.all(requestList).then(resList => {
  323. uni.hideLoading();
  324. console.log(resList);
  325. incidentBuildStore.clearIncidentBuildData();
  326. uni.showToast({
  327. icon: 'none',
  328. title: '建单成功',
  329. mask: true,
  330. });
  331. setTimeout(() => {
  332. uni.reLaunch({
  333. url: '/pages/incidentList/incidentList',
  334. })
  335. }, 1500)
  336. })
  337. }
  338. // 上传处理图片失败
  339. function handlerImgFail(e){
  340. dataInfo.handlerImgList.forEach(v => {
  341. v.url = v.path;
  342. })
  343. console.log(dataInfo.handlerImgList);
  344. }
  345. // 选择上传图片
  346. function handlerImgSelect(e){
  347. dataInfo.handlerImgList = dataInfo.handlerImgList.concat(e.tempFiles);
  348. console.log(dataInfo.handlerImgList);
  349. }
  350. // 删除上传图片
  351. function handlerImgDelete(e){
  352. dataInfo.handlerImgList = dataInfo.handlerImgList.filter(v => e.tempFile.uuid != v.uuid);
  353. console.log(dataInfo.handlerImgList);
  354. }
  355. // 添加协同人员
  356. function synergeticAdd(sign = 'assign'){
  357. handlerStore.setHandlerData(dataInfo, 'assign', sign);
  358. uni.navigateTo({
  359. url: `/pages/synergeticAdd/synergeticAdd?incidentId=${dataInfo.incidentId}`
  360. })
  361. }
  362. // 选择故障现象
  363. function selectCategory(sign = 'assign'){
  364. handlerStore.setHandlerData(dataInfo, 'assign', sign);
  365. uni.navigateTo({
  366. url: `/pages/categoryOne/categoryOne?incidentId=${dataInfo.incidentId}`
  367. })
  368. }
  369. // 点击修改数量
  370. function numberClick(data, type){
  371. if(type === 'editConsumable'){
  372. dataInfo.evtNumber = data.consumablesNum;
  373. }else if(type === 'editWorkHourManagement'){
  374. dataInfo.evtNumber = data.workHourNum2;
  375. }
  376. dataInfo.isNumber = true;
  377. dataInfo.selectData = data;
  378. dataInfo.selectType = type;
  379. }
  380. // 确认修改数量
  381. function conformNumber(evtNumber){
  382. dataInfo.evtNumber = evtNumber;
  383. dataInfo.isNumber = false;
  384. addSummaryDoc();
  385. }
  386. // 移除数量
  387. function removeNumber(evtNumber){
  388. dataInfo.evtNumber = evtNumber;
  389. dataInfo.isNumber = false;
  390. removeSummaryDoc();
  391. }
  392. // 关闭修改数量
  393. function cancelNumber(){
  394. dataInfo.isNumber = false;
  395. }
  396. // 修改耗材/工时
  397. function addSummaryDoc(){
  398. uni.showLoading({
  399. title: "加载中",
  400. mask: true,
  401. });
  402. let postData = {
  403. "summaryId": dataInfo.summaryId,
  404. "modifyNum": 'edit',
  405. };
  406. if(dataInfo.selectType === 'editConsumable'){
  407. postData.consumableList = [
  408. {
  409. "consumablesId": dataInfo.selectData.consumableId,
  410. "consumablesNum": dataInfo.evtNumber,
  411. }
  412. ];
  413. }else if(dataInfo.selectType === 'editWorkHourManagement'){
  414. postData.workHourManagementList = [
  415. {
  416. "workHourId": dataInfo.selectData.id,
  417. "workHourNum": dataInfo.evtNumber,
  418. }
  419. ];
  420. }
  421. api_addSummaryDoc(postData).then(res => {
  422. uni.hideLoading();
  423. if(res.status == 200){
  424. uni.showToast({
  425. icon: 'none',
  426. title: '修改数量成功',
  427. mask: true,
  428. });
  429. getSummaryList();
  430. }else{
  431. uni.showToast({
  432. icon: 'none',
  433. title: res.msg || '请求数据失败!'
  434. });
  435. }
  436. })
  437. }
  438. // 移除耗材/工时
  439. function removeSummaryDoc(){
  440. uni.showLoading({
  441. title: "加载中",
  442. mask: true,
  443. });
  444. let postData = {
  445. "summaryId": dataInfo.summaryId,
  446. "remove": 'remove',
  447. };
  448. if(dataInfo.selectType === 'editConsumable'){
  449. postData.consumableList = [
  450. {
  451. "consumablesId": dataInfo.selectData.consumableId,
  452. "consumablesNum": dataInfo.evtNumber,
  453. }
  454. ];
  455. }else if(dataInfo.selectType === 'editWorkHourManagement'){
  456. postData.workHourManagementList = [
  457. {
  458. "workHourId": dataInfo.selectData.id,
  459. "workHourNum": dataInfo.evtNumber,
  460. }
  461. ];
  462. }
  463. api_addSummaryDoc(postData).then(res => {
  464. uni.hideLoading();
  465. if(res.status == 200){
  466. uni.showToast({
  467. icon: 'none',
  468. title: '移除成功',
  469. mask: true,
  470. });
  471. getSummaryList();
  472. }else{
  473. uni.showToast({
  474. icon: 'none',
  475. title: res.msg || '请求数据失败!'
  476. });
  477. }
  478. })
  479. }
  480. // 重置
  481. function reset(){
  482. dataInfo.userList = [];//处理人列表
  483. dataInfo.repairTypeList = []; //延期原因列表
  484. dataInfo.groupId = undefined; //延期原因ID
  485. dataInfo.userIdList = []; //延期天数列表
  486. dataInfo.userIdId = undefined; //延期天数ID
  487. dataInfo.deferralRemark = '';//延期说明
  488. dataInfo.summaryObj = {
  489. consumableList: [],//耗材列表
  490. workHourManagementList: [],//工时列表
  491. };//汇总单信息
  492. dataInfo.summaryId = undefined;//汇总单Id
  493. dataInfo.isNumber = false;//修改数量弹窗
  494. dataInfo.evtNumber = 1;//弹窗返回的数量
  495. dataInfo.selectData = {};//选择的对象
  496. dataInfo.selectType = {};//选择的对象类型
  497. dataInfo.handleDescription = '';//解决方案
  498. solutionId.value = null;//引用知识库id
  499. dataInfo.handleCategory = undefined;//处理方式
  500. dataInfo.handleCategoryList = [];//处理方式列表
  501. dataInfo.closecode = undefined;//处理结果
  502. dataInfo.closecodeList = [];//处理结果列表
  503. dataInfo.handlerImgList = [];//处理图片列表
  504. dataInfo.category = {};//故障现象
  505. dataInfo.synergetic = [];//协同人员
  506. }
  507. // 初始化表单
  508. function initForm(){
  509. if(dataInfo.tabActiveValue === 'direct'){
  510. getHandleCategorys();
  511. getClosecodes();
  512. }else if(dataInfo.tabActiveValue === 'supplement'){
  513. getDicGu();
  514. getHandleCategorys();
  515. getClosecodes();
  516. }else if(dataInfo.tabActiveValue === 'assign'){
  517. getGroups();
  518. }
  519. }
  520. // 点击tab
  521. function clickTab(tabValue){
  522. if(dataInfo.tabActiveValue == tabValue){
  523. return;
  524. }
  525. dataInfo.tabActiveValue = tabValue;
  526. isSubmit.value = false;
  527. reset();
  528. dataInfo.category = dataInfo.incidentData.category || {};
  529. if(dataInfo.incidentData.synergetic&&dataInfo.incidentData.synergetic.length>0){
  530. synergeticArr.value = dataInfo.incidentData.synergetic.map(v => v.name).join(',');
  531. }
  532. initForm();
  533. }
  534. // 选择工作组
  535. function changeGroup(){
  536. dataInfo.userId = undefined;
  537. dataInfo.userList = [];
  538. let postData = {
  539. "key": 'usertype',
  540. "type": "list",
  541. };
  542. api_getDictionary(postData).then((data) => {
  543. userTypes.value = data;
  544. getUsers('');
  545. });
  546. }
  547. function getDicGu(){
  548. let postData = {
  549. "key": 'usertype',
  550. "type": "list",
  551. };
  552. api_getDictionary(postData).then((data) => {
  553. userTypes.value = data;
  554. getUsers('har');
  555. });
  556. }
  557. // 选择是否转派到人
  558. function changeIsAssignUser(){
  559. dataInfo.userId = undefined;
  560. }
  561. // 获取工作组列表
  562. function getGroups(){
  563. if(!dutyList.value){
  564. uni.hideLoading();
  565. dataInfo.groupList = [];
  566. return;
  567. }
  568. uni.showLoading({
  569. title: "加载中",
  570. mask: true,
  571. });
  572. let postData = {
  573. "idx": 0,
  574. "sum": 9999,
  575. "group2": {
  576. "hospitals": dutyList.value.id,
  577. }
  578. };
  579. api_group(postData).then(res => {
  580. uni.hideLoading();
  581. if(res.status == 200){
  582. res.list = res.list || [];
  583. let arr = res.list.filter(i=>i.type==3)
  584. dataInfo.groupList = arr.map(v => ({
  585. text: v.groupName,
  586. value: v.id,
  587. }));
  588. }else{
  589. uni.showToast({
  590. icon: 'none',
  591. title: res.msg || '请求数据失败!'
  592. });
  593. }
  594. })
  595. }
  596. /**
  597. * 获取用户列表
  598. * @param {boolean} noGroup 是否查询组里的用户
  599. */
  600. function getUsers(type,noGroup = false){
  601. uni.showLoading({
  602. title: "加载中",
  603. mask: true,
  604. });
  605. let postData = {
  606. "idx": 0,
  607. "sum": 9999,
  608. "user": {
  609. roledata:{
  610. rolecode:'',
  611. },
  612. roleCodes:'',
  613. // "hospital": dutyList.value.id,
  614. "groupdata": (dataInfo.groupId && !noGroup) ? { "id": dataInfo.groupId } : undefined,
  615. userTypeIds:String(userTypes.value.map(v => v.id)),
  616. }
  617. };
  618. if(type=='har'){
  619. postData.user.roledata.rolecode = 'first-line support'
  620. delete postData.user.roleCodes
  621. }else{
  622. postData.user.roleCodes = 'first-line support,second-line support'
  623. delete postData.user.roledata.rolecode
  624. }
  625. api_user(postData).then(res => {
  626. uni.hideLoading();
  627. if(res.status == 200){
  628. res.list = res.list || [];
  629. dataInfo.userList = res.list.map(v => ({
  630. text: v.name,
  631. value: v.id,
  632. }));
  633. }else{
  634. uni.showToast({
  635. icon: 'none',
  636. title: res.msg || '请求数据失败!'
  637. });
  638. }
  639. })
  640. }
  641. // 获取处理方式列表
  642. function getHandleCategorys(){
  643. uni.showLoading({
  644. title: "加载中",
  645. mask: true,
  646. });
  647. let postData = {
  648. "key": 'incident_handle_type',
  649. "type": "list",
  650. };
  651. api_getDictionary(postData).then(res => {
  652. uni.hideLoading();
  653. res = res || [];
  654. dataInfo.handleCategoryList = res.map(v => ({
  655. text: v.name,
  656. value: v.id,
  657. key: v.value,
  658. }));
  659. if(!dataInfo.handleCategory){
  660. let handleCategory = dataInfo.handleCategoryList.find(v => v.key == 'SUPPORT');
  661. dataInfo.handleCategory = handleCategory ? handleCategory.value : undefined;
  662. }
  663. })
  664. }
  665. // 获取处理结果列表
  666. function getClosecodes(){
  667. uni.showLoading({
  668. title: "加载中",
  669. mask: true,
  670. });
  671. let postData = {
  672. "key": 'incident_closecode',
  673. "type": "list",
  674. };
  675. api_getDictionary(postData).then(res => {
  676. uni.hideLoading();
  677. res = res || [];
  678. dataInfo.closecodeList = res.map(v => ({
  679. text: v.name,
  680. value: v.id,
  681. key: v.value,
  682. }));
  683. if(!dataInfo.closecode){
  684. let closecode = dataInfo.closecodeList.find(v => v.key == '1');
  685. dataInfo.closecode = closecode ? closecode.value : undefined;
  686. }
  687. })
  688. }
  689. // 添加耗材
  690. function addConsumable(){
  691. uni.navigateTo({
  692. url: `/pages/consumableList/consumableList?incidentId=${dataInfo.incidentId}&summaryId=${dataInfo.summaryId}`
  693. })
  694. }
  695. // 添加工时
  696. function addWorkHourManagement(){
  697. uni.navigateTo({
  698. url: `/pages/workHourManagementOne/workHourManagementOne?incidentId=${dataInfo.incidentId}&summaryId=${dataInfo.summaryId}`
  699. })
  700. }
  701. // 补单-上一步
  702. function previous(){
  703. dataInfo.supplementFlag = true;
  704. }
  705. // 补单-下一步
  706. function next(){
  707. console.log(dataInfo)
  708. isSubmit.value = true;
  709. if(!dataInfo.acceptDate){
  710. uni.showToast({
  711. icon: 'none',
  712. title: '请选择登记时间'
  713. });
  714. return;
  715. }
  716. if(!dataInfo.responseHandleTime){
  717. uni.showToast({
  718. icon: 'none',
  719. title: '请选择接单时间'
  720. });
  721. return;
  722. }
  723. if(!dataInfo.handleTime){
  724. uni.showToast({
  725. icon: 'none',
  726. title: '请选择解决时间'
  727. });
  728. return;
  729. }
  730. if(!dataInfo.handlingPersonnelUserId){
  731. uni.showToast({
  732. icon: 'none',
  733. title: '请选择处理人'
  734. });
  735. return;
  736. }
  737. dataInfo.supplementFlag = false;
  738. isSubmit.value = false;
  739. }
  740. // 提交
  741. function submit(){
  742. isSubmit.value = true;
  743. if(dataInfo.incidentData.priority){
  744. dataInfo.incidentData.priorityId = dataInfo.incidentData.priority
  745. }
  746. // dataInfo.incidentData.duty = dutyList.value.id
  747. if(loginUserStore.loginUser.user.currentHospital.parent){
  748. dataInfo.incidentData.hosId = loginUserStore.loginUser.user.currentHospital.parent.id
  749. }else{
  750. dataInfo.incidentData.hosId = loginUserStore.loginUser.user.currentHospital.id
  751. }
  752. if(dataInfo.tabActiveValue === 'direct'){
  753. delete dataInfo.incidentData.entranceType
  754. delete dataInfo.incidentData.AttachmentId
  755. submitHandler();
  756. }else if(dataInfo.tabActiveValue === 'supplement'){
  757. submitSupplement();
  758. }else if(dataInfo.tabActiveValue === 'assign'){
  759. delete dataInfo.incidentData.entranceType
  760. delete dataInfo.incidentData.AttachmentId
  761. submitAssign();
  762. }
  763. }
  764. // 处理提交事件
  765. async function handlerOrder(){
  766. let repairIncidentTypeList = await api_getDictionary({
  767. "key": 'repair_incident_type',
  768. "type": "list",
  769. })
  770. repairIncidentTypeList = repairIncidentTypeList || [];
  771. let postData = {
  772. incident: dataInfo.incidentData,
  773. solutionId: solutionId.value
  774. }
  775. // let result = await beforeBuild();
  776. // if(result[0].status == 200 && result[1].status == 200){
  777. // postData.incident.repairType = result[0].list.length ? result[0].list[0].valueconfig : undefined;
  778. // postData.incident.incidentsign = result[1].data || undefined;
  779. // }else{
  780. // uni.showToast({
  781. // icon: 'none',
  782. // title: '请求数据失败!'
  783. // });
  784. // return;
  785. // }
  786. if(!postData.incident.repairIncidentType){
  787. postData.incident.repairIncidentType = repairIncidentTypeList.find(v => v.value === 'dept');
  788. }
  789. postData.incident.place = {}
  790. postData.incident.place.id = floorId.value
  791. postData.incident.handleDescription = dataInfo.handleDescription;
  792. postData.incident.handleCategory = {id: dataInfo.handleCategory};
  793. postData.incident.closecode = {id: dataInfo.closecode};
  794. postData.incident.category = dataInfo.category;
  795. if(dataInfo.synergetic && dataInfo.synergetic.length>0){
  796. postData.incident.synergetic = dataInfo.synergetic
  797. }else{
  798. postData.incident.synergetic = null
  799. }
  800. console.log(999, postData.incident)
  801. postData.incident.directProcess = 1;//直接解决
  802. return api_incidentTask('accept', postData);
  803. }
  804. // 补单提交事件
  805. async function supplementOrder(){
  806. let repairIncidentTypeList = await api_getDictionary({
  807. "key": 'repair_incident_type',
  808. "type": "list",
  809. })
  810. repairIncidentTypeList = repairIncidentTypeList || [];
  811. let postData = {
  812. incident: dataInfo.incidentData,
  813. solutionId: solutionId.value
  814. }
  815. // let result = await beforeBuild();
  816. // if(result[0].status == 200 && result[1].status == 200){
  817. // postData.incident.repairType = result[0].list.length ? result[0].list[0].valueconfig : undefined;
  818. // postData.incident.incidentsign = result[1].data || undefined;
  819. // }else{
  820. // uni.showToast({
  821. // icon: 'none',
  822. // title: '请求数据失败!'
  823. // });
  824. // return;
  825. // }
  826. // if(HandleData.simpleness==1){
  827. // dataInfo.closecode = '1'
  828. // }
  829. if(!postData.incident.repairIncidentType){
  830. postData.incident.repairIncidentType = repairIncidentTypeList.find(v => v.value === 'dept');
  831. }
  832. postData.incident.place = {}
  833. postData.incident.place.id = floorId.value
  834. postData.incident.handleDescription = dataInfo.handleDescription;
  835. postData.incident.handleCategory = {id: dataInfo.handleCategory};
  836. postData.incident.closecode = {id: dataInfo.closecode};
  837. postData.incident.category = dataInfo.category;
  838. if(dataInfo.synergetic && dataInfo.synergetic.length>0){
  839. postData.incident.synergetic = dataInfo.synergetic
  840. }else{
  841. postData.incident.synergetic = null
  842. }
  843. postData.incident.directProcess = 1;//直接解决
  844. postData.incident.acceptDate = dataInfo.acceptDate;
  845. postData.incident.responseHandleTime = dataInfo.responseHandleTime;
  846. postData.incident.handleTime = dataInfo.handleTime;
  847. postData.incident.handlingPersonnelUser = { id: dataInfo.handlingPersonnelUserId };
  848. return api_incidentTask('patchOrder', postData);
  849. }
  850. // 建单前的接口
  851. function beforeBuild(){
  852. let repairMain$ = api_systemConfiguration({
  853. "idx": 0,
  854. "sum": 1,
  855. "systemConfiguration": {
  856. "keyconfig": "repairMain"
  857. }
  858. })
  859. let sj$ = api_sj();
  860. return Promise.all([repairMain$, sj$])
  861. }
  862. // 派单提交事件
  863. async function assignOrder(){
  864. let repairIncidentTypeList = await api_getDictionary({
  865. "key": 'repair_incident_type',
  866. "type": "list",
  867. })
  868. repairIncidentTypeList = repairIncidentTypeList || [];
  869. let postData = {
  870. incident: dataInfo.incidentData,
  871. }
  872. // let result = await beforeBuild();
  873. // if(result[0].status == 200 && result[1].status == 200){
  874. // postData.incident.repairType = result[0].list.length ? result[0].list[0].valueconfig : undefined;
  875. // postData.incident.incidentsign = result[1].data || undefined;
  876. // }else{
  877. // uni.showToast({
  878. // icon: 'none',
  879. // title: '请求数据失败!'
  880. // });
  881. // return;
  882. // }
  883. if(!postData.incident.repairIncidentType){
  884. postData.incident.repairIncidentType = repairIncidentTypeList.find(v => v.value === 'dept');
  885. }
  886. postData.incident.place = {}
  887. postData.incident.place.id = floorId.value
  888. postData.incident.candidateGroupId = dataInfo.groupId;
  889. if(dataInfo.userId){
  890. // 派人
  891. postData.incident.assignee = dataInfo.userId;
  892. delete postData.incident.candidateGroups
  893. } else {
  894. // 派组
  895. postData.incident.candidateGroups = dataInfo.groupId;
  896. delete postData.incident.assignee
  897. }
  898. return api_incidentTask('accept', postData);
  899. }
  900. // 处理图片
  901. function handlerOrderImg(imgObj){
  902. return uploadFile(imgObj, 'incident', dataInfo.incidentId)
  903. }
  904. // 报修图片
  905. function repairOrderImg(imgObj){
  906. return uploadFile(imgObj, 'wechatRequesterIncident', dataInfo.incidentId)
  907. }
  908. // 引入知识库
  909. function importRep(type,tabType){
  910. dataInfo.operateType = type
  911. dataInfo.tabType = tabType
  912. handlerStore.setHandlerData(dataInfo, 'assign', 'assign');
  913. uni.navigateTo({
  914. url: `/pages/repository/repository?incidentId=${dataInfo.incidentId}`
  915. })
  916. }
  917. // 处理提交
  918. function submitHandler(){
  919. if(!dataInfo.handleDescription.trim() && HandleData.simpleness != 1){
  920. uni.showToast({
  921. icon: 'none',
  922. title: '请填写解决方案'
  923. });
  924. return;
  925. }
  926. if(!dataInfo.category.id && HandleData.simpleness != 1){
  927. uni.showToast({
  928. icon: 'none',
  929. title: '请选择故障现象'
  930. });
  931. return;
  932. }
  933. if(!dataInfo.handleCategory){
  934. uni.showToast({
  935. icon: 'none',
  936. title: '请选择处理方式'
  937. });
  938. return;
  939. }
  940. if(!dataInfo.closecode && HandleData.simpleness != 1){
  941. uni.showToast({
  942. icon: 'none',
  943. title: '请选择处理结果'
  944. });
  945. return;
  946. }
  947. if(!dutyList.value){
  948. uni.showToast({
  949. icon: 'none',
  950. title: '您选择的故障现象没有设置责任科室'
  951. });
  952. return;
  953. }
  954. uni.showLoading({
  955. title: "加载中",
  956. mask: true,
  957. });
  958. // if(HandleData.simpleness==1){
  959. // dataInfo.closecode = '1'
  960. // }
  961. if(dataInfo.handlerImgList.length){
  962. // 有处理图片
  963. let handlerOrder$ = handlerOrder();
  964. let requestList = [handlerOrder$];
  965. Promise.all(requestList).then(resList => {
  966. console.log(resList);
  967. if(resList[0].state == 200){
  968. dataInfo.incidentId = resList[0].data.id;
  969. handlerImgRef.value.upload();
  970. }else{
  971. uni.hideLoading();
  972. uni.showToast({
  973. icon: 'none',
  974. title: resList[0].msg || '请求数据失败!'
  975. });
  976. }
  977. })
  978. }else if(dataInfo.incidentData.repairImgList.length){
  979. // 有报修图片,无处理图片
  980. let handlerOrder$ = handlerOrder();
  981. let requestList = [handlerOrder$];
  982. Promise.all(requestList).then(resList => {
  983. console.log(resList);
  984. if(resList[0].state == 200){
  985. dataInfo.incidentId = resList[0].data.id;
  986. handlerImgSuccessNew();
  987. }else{
  988. uni.hideLoading();
  989. uni.showToast({
  990. icon: 'none',
  991. title: resList[0].msg || '请求数据失败!'
  992. });
  993. }
  994. })
  995. }else{
  996. // 没有图片
  997. let handlerOrder$ = handlerOrder();
  998. let requestList = [handlerOrder$];
  999. Promise.all(requestList).then(resList => {
  1000. uni.hideLoading();
  1001. console.log(resList);
  1002. if(resList[0].state == 200){
  1003. incidentBuildStore.clearIncidentBuildData();
  1004. uni.showToast({
  1005. icon: 'none',
  1006. title: '建单成功',
  1007. mask: true,
  1008. });
  1009. setTimeout(() => {
  1010. uni.reLaunch({
  1011. url: '/pages/incidentList/incidentList',
  1012. })
  1013. }, 1500)
  1014. }else{
  1015. uni.showToast({
  1016. icon: 'none',
  1017. title: resList[0].msg || '请求数据失败!'
  1018. });
  1019. }
  1020. })
  1021. }
  1022. }
  1023. // 派单提交
  1024. function submitAssign(){
  1025. console.log(444,dutyList.value)
  1026. if(!dataInfo.groupId){
  1027. uni.showToast({
  1028. icon: 'none',
  1029. title: '请选择工作组'
  1030. });
  1031. return;
  1032. }
  1033. if(dataInfo.isAssignUser == 1 && !dataInfo.userId){
  1034. uni.showToast({
  1035. icon: 'none',
  1036. title: '请选择指派对象'
  1037. });
  1038. return;
  1039. }
  1040. if(!dutyList.value){
  1041. uni.showToast({
  1042. icon: 'none',
  1043. title: '您选择的故障现象没有设置责任科室'
  1044. });
  1045. return;
  1046. }
  1047. uni.showLoading({
  1048. title: "加载中",
  1049. mask: true,
  1050. });
  1051. if(dataInfo.incidentData.repairImgList.length){
  1052. // 有图片
  1053. let assignOrder$ = assignOrder();
  1054. let requestList = [assignOrder$];
  1055. Promise.all(requestList).then(resList => {
  1056. console.log(resList);
  1057. if(resList[0].state == 200){
  1058. dataInfo.incidentId = resList[0].data.id;
  1059. // handlerImgRef.value.upload();
  1060. handlerImgSuccessNew();
  1061. }else{
  1062. uni.hideLoading();
  1063. uni.showToast({
  1064. icon: 'none',
  1065. title: resList[0].msg || '请求数据失败!'
  1066. });
  1067. }
  1068. })
  1069. }else{
  1070. // 没有图片
  1071. let assignOrder$ = assignOrder();
  1072. let requestList = [assignOrder$];
  1073. Promise.all(requestList).then(resList => {
  1074. uni.hideLoading();
  1075. console.log(resList);
  1076. if(resList[0].state == 200){
  1077. incidentBuildStore.clearIncidentBuildData();
  1078. uni.showToast({
  1079. icon: 'none',
  1080. title: '建单成功',
  1081. mask: true,
  1082. });
  1083. setTimeout(() => {
  1084. uni.reLaunch({
  1085. url: '/pages/incidentList/incidentList',
  1086. })
  1087. }, 1500)
  1088. }else{
  1089. uni.showToast({
  1090. icon: 'none',
  1091. title: resList[0].msg || '请求数据失败!'
  1092. });
  1093. }
  1094. })
  1095. }
  1096. }
  1097. // 补单提交
  1098. function submitSupplement(){
  1099. console.log(dataInfo);
  1100. if(!dataInfo.handleDescription.trim() && HandleData.simpleness != 1){
  1101. uni.showToast({
  1102. icon: 'none',
  1103. title: '请填写解决方案'
  1104. });
  1105. return;
  1106. }
  1107. if(!dataInfo.category.id && HandleData.simpleness != 1){
  1108. uni.showToast({
  1109. icon: 'none',
  1110. title: '请选择故障现象'
  1111. });
  1112. return;
  1113. }
  1114. if(!dataInfo.handleCategory){
  1115. uni.showToast({
  1116. icon: 'none',
  1117. title: '请选择处理方式'
  1118. });
  1119. return;
  1120. }
  1121. if(!dataInfo.closecode && HandleData.simpleness != 1){
  1122. uni.showToast({
  1123. icon: 'none',
  1124. title: '请选择处理结果'
  1125. });
  1126. return;
  1127. }
  1128. if(!dutyList.value){
  1129. uni.showToast({
  1130. icon: 'none',
  1131. title: '您选择的故障现象没有设置责任科室'
  1132. });
  1133. return;
  1134. }
  1135. console.log(dataInfo)
  1136. console.log(dataInfo.handlerImgList)
  1137. console.log(dataInfo.incidentData.repairImgList)
  1138. uni.showLoading({
  1139. title: "加载中",
  1140. mask: true,
  1141. });
  1142. if(dataInfo.handlerImgList.length){
  1143. // 有处理图片
  1144. let supplementOrder$ = supplementOrder();
  1145. let requestList = [supplementOrder$];
  1146. Promise.all(requestList).then(resList => {
  1147. console.log(resList);
  1148. if(resList[0].state == 200){
  1149. dataInfo.incidentId = resList[0].data.id;
  1150. handlerImgRef.value.upload();
  1151. }else{
  1152. uni.hideLoading();
  1153. uni.showToast({
  1154. icon: 'none',
  1155. title: resList[0].msg || '请求数据失败!'
  1156. });
  1157. }
  1158. })
  1159. }else if(dataInfo.incidentData.repairImgList.length){
  1160. // 有报修图片,无处理图片
  1161. let supplementOrder$ = supplementOrder();
  1162. let requestList = [supplementOrder$];
  1163. Promise.all(requestList).then(resList => {
  1164. console.log(resList);
  1165. if(resList[0].state == 200){
  1166. dataInfo.incidentId = resList[0].data.id;
  1167. handlerImgSuccessNew();
  1168. }else{
  1169. uni.hideLoading();
  1170. uni.showToast({
  1171. icon: 'none',
  1172. title: resList[0].msg || '请求数据失败!'
  1173. });
  1174. }
  1175. })
  1176. }else{
  1177. // 没有图片
  1178. let supplementOrder$ = supplementOrder();
  1179. let requestList = [supplementOrder$];
  1180. Promise.all(requestList).then(resList => {
  1181. uni.hideLoading();
  1182. console.log(resList);
  1183. if(resList[0].state == 200){
  1184. incidentBuildStore.clearIncidentBuildData();
  1185. uni.showToast({
  1186. icon: 'none',
  1187. title: '建单成功',
  1188. mask: true,
  1189. });
  1190. setTimeout(() => {
  1191. uni.reLaunch({
  1192. url: '/pages/incidentList/incidentList',
  1193. })
  1194. }, 1500)
  1195. }else{
  1196. uni.showToast({
  1197. icon: 'none',
  1198. title: resList[0].msg || '请求数据失败!'
  1199. });
  1200. }
  1201. })
  1202. }
  1203. }
  1204. // 菜单权限
  1205. function menuAuthHandle(){
  1206. let menu = JSON.parse(uni.getStorageSync("menuList")) || []; //菜单
  1207. menu.forEach((e) => {
  1208. if (e.title=='故障管理') {
  1209. e.childrens.forEach((el) => {
  1210. if(el.link=='incidentManagement'){
  1211. el.childrens.forEach(item =>{
  1212. if (item.link == "replenishment") {
  1213. shijianliebiao_supplement.value = true
  1214. }
  1215. })
  1216. }
  1217. });
  1218. }
  1219. });
  1220. console.log(dataInfo.incidentData)
  1221. }
  1222. // 获取知识库数量
  1223. function getIntroduceCount(categoryId){
  1224. uni.showLoading({
  1225. title: "加载中",
  1226. mask: true,
  1227. });
  1228. let postData = {
  1229. idx: 0,
  1230. sum: 9999,
  1231. solution: {
  1232. deleteFlag:0,
  1233. hosId: loginUserStore.loginUser.user.currentHospital.id,
  1234. categoryId: categoryId,
  1235. status:{id:dicData.value?.id},
  1236. }
  1237. }
  1238. api_getSolution(postData).then(res => {
  1239. uni.hideLoading();
  1240. if(res.status == 200){
  1241. dataInfo.introduceCount = res.totalNum
  1242. }else{
  1243. uni.showToast({
  1244. icon: 'none',
  1245. title: res.msg || '请求数据失败!'
  1246. });
  1247. }
  1248. })
  1249. }
  1250. // 获取文本内容
  1251. function getHtml(html) {
  1252. const tempDiv = document.createElement('div');
  1253. tempDiv.innerHTML = html;
  1254. return tempDiv.textContent || tempDiv.innerText || '';
  1255. }
  1256. // 获取字典
  1257. function getDic(){
  1258. let postData = {
  1259. "key": 'solution_status',
  1260. "type": "list",
  1261. };
  1262. api_getDictionary(postData).then(res => {
  1263. dicData.value = res.find(v => v.value == '3');
  1264. // 跳转页面选择了选项
  1265. if(handlerStore.handler.data){
  1266. Object.assign(dataInfo, handlerStore.handler.data);
  1267. if(dataInfo.synergetic){
  1268. synergeticArr.value = dataInfo.synergetic.map(v => v.name).join(',')
  1269. }
  1270. if(handlerStore.handler.sign === 'assign'){
  1271. dataInfo.tabActiveValue = 'direct';
  1272. }else if(handlerStore.handler.sign === 'assign_supplement'){
  1273. dataInfo.tabActiveValue = 'supplement';
  1274. next();
  1275. }
  1276. let storeData = handlerStore.handler.data
  1277. console.log(8888,dataInfo.incidentData )
  1278. if(storeData.type == 'rep'){
  1279. dataInfo.handleDescription = null;
  1280. if(storeData.handleDescription){
  1281. dataInfo.handleDescription = storeData.handleDescription;
  1282. solutionId.value = storeData.solutionId
  1283. }
  1284. if(storeData.tabType == 'direct'){
  1285. dataInfo.tabActiveValue = 'direct'
  1286. }else{
  1287. dataInfo.tabActiveValue = 'supplement'
  1288. dataInfo.supplementFlag = false
  1289. }
  1290. }
  1291. // console.log(12233, dataInfo)
  1292. // 补单
  1293. if(shijianliebiao_supplement.value && !dataInfo.incidentData.entranceType){
  1294. let index = dataInfo.tabs.findIndex(v => v.value === 'assign');
  1295. let item = dataInfo.tabs.find(i=> i.value == 'supplement')
  1296. if(!item){
  1297. dataInfo.tabs.splice(index, 0, {id: 7, name: '补单', value: 'supplement', num: ''});
  1298. }
  1299. }
  1300. handlerStore.clearHandlerData();
  1301. if(dataInfo.category){
  1302. dataInfo.incidentData.category = dataInfo.category;
  1303. if(dataInfo.incidentData.place.floor){
  1304. floorId.value = JSON.parse(JSON.stringify(dataInfo.incidentData.place.floor.id))
  1305. }else{
  1306. floorId.value = JSON.parse(JSON.stringify(dataInfo.incidentData.place.id))
  1307. }
  1308. console.log(111)
  1309. getIntroduceCount(dataInfo.category.id)
  1310. // 处理责任科室
  1311. // if(dataInfo.category.branchType == 1){
  1312. // // 分院区
  1313. // if(dataInfo.incidentData.branch){
  1314. // let dutyConfig = dataInfo.category.branchUserGroups.find(v=>v.branchId == dataInfo.incidentData.branch);
  1315. // if(dutyConfig && dutyConfig.dutyId && dutyConfig.dutyName){
  1316. // dataInfo.incidentData.duty = {id:dutyConfig.dutyId,dept:dutyConfig.dutyName};
  1317. // }else{
  1318. // dataInfo.incidentData.duty = undefined;
  1319. // }
  1320. // }else{
  1321. // dataInfo.incidentData.duty = undefined;
  1322. // }
  1323. // }else{
  1324. // // 不分院区
  1325. // // dataInfo.incidentData.hosId = loginUserStore.loginUser.user.currentHospital.id;
  1326. // }
  1327. getDuty()
  1328. }
  1329. }else if(incidentBuildStore.incidentBuild.data){
  1330. // 初始化
  1331. Object.assign(dataInfo.incidentData, incidentBuildStore.incidentBuild.data);
  1332. if(dataInfo.incidentData.category){
  1333. if(dataInfo.incidentData.synergetic){
  1334. synergeticArr.value = dataInfo.incidentData.synergetic.map(v => v.name).join(',')
  1335. }
  1336. dataInfo.category = dataInfo.incidentData.category;
  1337. getIntroduceCount(dataInfo.category.id)
  1338. // 处理责任科室
  1339. // if(dataInfo.category.branchType == 1){
  1340. // // 分院区
  1341. // if(dataInfo.incidentData.branch){
  1342. // let dutyConfig = dataInfo.category.branchUserGroups.find(v=>v.branchId == dataInfo.incidentData.branch);
  1343. // if(dutyConfig && dutyConfig.dutyId && dutyConfig.dutyName){
  1344. // dataInfo.incidentData.duty = {id:dutyConfig.dutyId,dept:dutyConfig.dutyName};
  1345. // }else{
  1346. // dataInfo.incidentData.duty = undefined;
  1347. // }
  1348. // }else{
  1349. // dataInfo.incidentData.duty = undefined;
  1350. // }
  1351. // }else{
  1352. // // 不分院区
  1353. // dataInfo.incidentData.hosId = loginUserStore.loginUser.user.currentHospital.id;
  1354. // }
  1355. }
  1356. console.log(222, dataInfo.incidentData)
  1357. if(shijianliebiao_supplement.value && !dataInfo.incidentData.entranceType){
  1358. let index = dataInfo.tabs.findIndex(v => v.value === 'assign');
  1359. let item = dataInfo.tabs.find(i=> i.value == 'supplement')
  1360. if(!item){
  1361. dataInfo.tabs.splice(index, 0, {id: 7, name: '补单', value: 'supplement', num: ''});
  1362. }
  1363. }
  1364. if(dataInfo.incidentData.place){
  1365. if(dataInfo.incidentData.place.floor){
  1366. floorId.value = JSON.parse(JSON.stringify(dataInfo.incidentData.place.floor.id))
  1367. }else{
  1368. floorId.value = JSON.parse(JSON.stringify(dataInfo.incidentData.place.id))
  1369. }
  1370. }
  1371. getDuty()
  1372. if(dataInfo.incidentData.source){
  1373. dataInfo.incidentData.source = { id: dataInfo.incidentData.source };
  1374. }
  1375. if(dataInfo.incidentData.requester){
  1376. dataInfo.incidentData.requester = dataInfo.incidentData.requester
  1377. }
  1378. }
  1379. })
  1380. }
  1381. // 获取故障现象绑定的科室
  1382. function getDuty(){
  1383. let postData = {
  1384. idx: 0,
  1385. sum: 9999,
  1386. incidentCategoryConfig: {
  1387. categoryId: dataInfo.incidentData.category.id,
  1388. dutyId: loginUserStore.loginUser.user.currentHospital.id,
  1389. },
  1390. };
  1391. getFetchDataList("simple/data", "incidentCategoryConfig", postData).then(res => {
  1392. let item = res.list.find(i=>i.categoryId == dataInfo.incidentData.category.id)
  1393. if(item){
  1394. dutyList.value = item.dutyDTO;
  1395. dataInfo.incidentData.duty = dutyList.value.id;
  1396. }
  1397. initForm()
  1398. // console.log(1111,dutyList.value)
  1399. })
  1400. }
  1401. // 获取是否开启汇总单
  1402. function getHosConfig(){
  1403. let postData = {
  1404. idx: 0,
  1405. sum: 9999,
  1406. hospitalConfig:{
  1407. hosId: loginUserStore.loginUser.user.currentHospital.id,
  1408. model: "itsm"
  1409. }
  1410. };
  1411. getFetchDataList("simple/data", "hospitalConfig", postData)
  1412. .then((res) => {
  1413. // SummaryData.value = res.list.find(i=>i.key=='itsmSummarySheet')
  1414. HandleData.simpleness = res.list.find(i=>i.key=='itsmSimpleHandle').value
  1415. });
  1416. }
  1417. onLoad((option) => {
  1418. getHosConfig()
  1419. menuAuthHandle()
  1420. getDic()
  1421. if(!dataInfo.tabActiveValue){
  1422. dataInfo.tabActiveValue = dataInfo.tabs[0].value;
  1423. }
  1424. })
  1425. </script>
  1426. <style lang="scss" scoped>
  1427. .handler{
  1428. height: 100%;
  1429. display: flex;
  1430. flex-direction: column;
  1431. justify-content: space-between;
  1432. .head{
  1433. height: 88rpx;
  1434. display: flex;
  1435. position: fixed;
  1436. z-index: 99;
  1437. width: 100%;
  1438. background-color: #fff;
  1439. font-size: 30rpx;
  1440. .tab{
  1441. flex: 1;
  1442. display: flex;
  1443. justify-content: center;
  1444. align-items: center;
  1445. border-bottom: 4rpx solid transparent;
  1446. &.active{
  1447. color: $uni-primary;
  1448. border-color: $uni-primary;
  1449. }
  1450. }
  1451. }
  1452. .body{
  1453. margin-top: 88rpx;
  1454. box-sizing: border-box;
  1455. flex: 1;
  1456. min-height: 0;
  1457. &.bg{
  1458. background-color: #F7F7F7;
  1459. }
  1460. .summaryItem{
  1461. &:first-of-type{
  1462. .summaryItem_head{
  1463. border-bottom: 1rpx solid #DDDDDD;
  1464. }
  1465. }
  1466. .summary_total{
  1467. padding: 20rpx 0;
  1468. display: flex;
  1469. justify-content: center;
  1470. align-items: center;
  1471. }
  1472. .summaryItem_head{
  1473. padding: 24rpx;
  1474. font-size: 26rpx;
  1475. color: #3A3A3A;
  1476. }
  1477. .summaryItem_body{
  1478. font-size: 30rpx;
  1479. background-color: #fff;
  1480. .summaryItem_bodyItem{
  1481. padding: 24rpx;
  1482. border-bottom: 1rpx solid #DDDDDD;
  1483. .summaryItem_bodyItem_top{
  1484. display: flex;
  1485. justify-content: space-between;
  1486. align-items: center;
  1487. .value{
  1488. padding-left: 48rpx;
  1489. flex-shrink: 0;
  1490. }
  1491. }
  1492. .summaryItem_bodyItem_bottom{
  1493. margin-top: 24rpx;
  1494. display: flex;
  1495. justify-content: space-between;
  1496. align-items: center;
  1497. .name{
  1498. text-align: right;
  1499. flex: 1;
  1500. }
  1501. .value{
  1502. width: 240rpx;
  1503. text-align: right;
  1504. padding-left: 48rpx;
  1505. flex-shrink: 0;
  1506. }
  1507. }
  1508. }
  1509. }
  1510. .summaryItem_foot{
  1511. font-size: 30rpx;
  1512. background-color: #fff;
  1513. &.total{
  1514. margin-top: 24rpx;
  1515. }
  1516. .summaryItem_foot_total{
  1517. padding: 24rpx 0;
  1518. display: flex;
  1519. justify-content: center;
  1520. align-items: center;
  1521. }
  1522. .summaryItem_foot_add{
  1523. border-top: 1rpx solid #DDDDDD;
  1524. padding: 24rpx 0;
  1525. display: flex;
  1526. justify-content: center;
  1527. align-items: center;
  1528. .newicon-icon-test{
  1529. font-size: 30rpx;
  1530. font-weight: bold;
  1531. }
  1532. }
  1533. }
  1534. }
  1535. .form_item_column{
  1536. padding-top: 24rpx;
  1537. min-height: 86rpx;
  1538. .form_item{
  1539. padding-top: 0;
  1540. min-height: auto;
  1541. }
  1542. }
  1543. .form_item{
  1544. display: flex;
  1545. align-items: center;
  1546. padding-top: 24rpx;
  1547. min-height: 86rpx;
  1548. &.column{
  1549. height: auto;
  1550. flex-direction: column;
  1551. align-items: flex-start;
  1552. .import-rep{
  1553. padding: 5rpx 10rpx;
  1554. border-radius: 50rpx;
  1555. background: #d1fcd5;
  1556. color: #49b856;
  1557. font-size: 24rpx;
  1558. }
  1559. .title{
  1560. margin-right: 0;
  1561. }
  1562. .title-width{
  1563. width: 100%;
  1564. }
  1565. .title-fl-sb{
  1566. display: flex;
  1567. justify-content: space-between;
  1568. width: 100%;
  1569. }
  1570. .value{
  1571. margin-top: 10rpx;
  1572. padding-left: 20rpx;
  1573. box-sizing: border-box;
  1574. }
  1575. .tips{
  1576. padding: 24rpx;
  1577. text-align: center;
  1578. font-size: 22rpx;
  1579. color: #909399;
  1580. width: 100%;
  1581. box-sizing: border-box;
  1582. }
  1583. }
  1584. .title{
  1585. font-size: 26rpx;
  1586. display: flex;
  1587. align-items: center;
  1588. margin-right: 12rpx;
  1589. flex-shrink: 0;
  1590. &.select{
  1591. width: calc(5em + 20rpx);
  1592. }
  1593. }
  1594. .value{
  1595. width: 100%;
  1596. &.category{
  1597. width: 100%;
  1598. display: flex;
  1599. justify-content: space-between;
  1600. align-items: center;
  1601. .categoryName{
  1602. font-size: 26rpx;
  1603. color: #555;
  1604. flex: 1;
  1605. }
  1606. .newicon-weibiaoti2010104{
  1607. color: $uni-primary;
  1608. margin-left: 24rpx;
  1609. }
  1610. }
  1611. .imgTips{
  1612. color: #909399;
  1613. font-size: 22rpx;
  1614. }
  1615. }
  1616. .synergeticNames{
  1617. font-size: 26rpx;
  1618. margin-right: 24rpx;
  1619. }
  1620. .synergeticAdd{
  1621. flex-shrink: 0;
  1622. }
  1623. }
  1624. }
  1625. }
  1626. </style>