assign.vue 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722
  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 = loginUserStore.loginUser.menu || []; //菜单
  1207. menu.forEach((e) => {
  1208. if(e.link=='incidentManagement'){
  1209. e.childrens.forEach(item =>{
  1210. if (item.link == "replenishment") {
  1211. shijianliebiao_supplement.value = true
  1212. }
  1213. })
  1214. }
  1215. });
  1216. console.log(dataInfo.incidentData)
  1217. }
  1218. // 获取知识库数量
  1219. function getIntroduceCount(categoryId){
  1220. uni.showLoading({
  1221. title: "加载中",
  1222. mask: true,
  1223. });
  1224. let postData = {
  1225. idx: 0,
  1226. sum: 9999,
  1227. solution: {
  1228. deleteFlag:0,
  1229. hosId: loginUserStore.loginUser.user.currentHospital.id,
  1230. categoryId: categoryId,
  1231. status:{id:dicData.value?.id},
  1232. }
  1233. }
  1234. api_getSolution(postData).then(res => {
  1235. uni.hideLoading();
  1236. if(res.status == 200){
  1237. dataInfo.introduceCount = res.totalNum
  1238. }else{
  1239. uni.showToast({
  1240. icon: 'none',
  1241. title: res.msg || '请求数据失败!'
  1242. });
  1243. }
  1244. })
  1245. }
  1246. // 获取文本内容
  1247. function getHtml(html) {
  1248. const tempDiv = document.createElement('div');
  1249. tempDiv.innerHTML = html;
  1250. return tempDiv.textContent || tempDiv.innerText || '';
  1251. }
  1252. // 获取字典
  1253. function getDic(){
  1254. let postData = {
  1255. "key": 'solution_status',
  1256. "type": "list",
  1257. };
  1258. api_getDictionary(postData).then(res => {
  1259. dicData.value = res.find(v => v.value == '3');
  1260. // 跳转页面选择了选项
  1261. if(handlerStore.handler.data){
  1262. Object.assign(dataInfo, handlerStore.handler.data);
  1263. if(dataInfo.synergetic){
  1264. synergeticArr.value = dataInfo.synergetic.map(v => v.name).join(',')
  1265. }
  1266. if(handlerStore.handler.sign === 'assign'){
  1267. dataInfo.tabActiveValue = 'direct';
  1268. }else if(handlerStore.handler.sign === 'assign_supplement'){
  1269. dataInfo.tabActiveValue = 'supplement';
  1270. next();
  1271. }
  1272. let storeData = handlerStore.handler.data
  1273. console.log(8888,dataInfo.incidentData )
  1274. if(storeData.type == 'rep'){
  1275. dataInfo.handleDescription = null;
  1276. if(storeData.handleDescription){
  1277. dataInfo.handleDescription = storeData.handleDescription;
  1278. solutionId.value = storeData.solutionId
  1279. }
  1280. if(storeData.tabType == 'direct'){
  1281. dataInfo.tabActiveValue = 'direct'
  1282. }else{
  1283. dataInfo.tabActiveValue = 'supplement'
  1284. dataInfo.supplementFlag = false
  1285. }
  1286. }
  1287. // console.log(12233, dataInfo)
  1288. // 补单
  1289. if(shijianliebiao_supplement.value && !dataInfo.incidentData.entranceType){
  1290. let index = dataInfo.tabs.findIndex(v => v.value === 'assign');
  1291. let item = dataInfo.tabs.find(i=> i.value == 'supplement')
  1292. if(!item){
  1293. dataInfo.tabs.splice(index, 0, {id: 7, name: '补单', value: 'supplement', num: ''});
  1294. }
  1295. }
  1296. handlerStore.clearHandlerData();
  1297. if(dataInfo.category){
  1298. dataInfo.incidentData.category = dataInfo.category;
  1299. if(dataInfo.incidentData.place.floor){
  1300. floorId.value = JSON.parse(JSON.stringify(dataInfo.incidentData.place.floor.id))
  1301. }else{
  1302. floorId.value = JSON.parse(JSON.stringify(dataInfo.incidentData.place.id))
  1303. }
  1304. console.log(111)
  1305. getIntroduceCount(dataInfo.category.id)
  1306. // 处理责任科室
  1307. // if(dataInfo.category.branchType == 1){
  1308. // // 分院区
  1309. // if(dataInfo.incidentData.branch){
  1310. // let dutyConfig = dataInfo.category.branchUserGroups.find(v=>v.branchId == dataInfo.incidentData.branch);
  1311. // if(dutyConfig && dutyConfig.dutyId && dutyConfig.dutyName){
  1312. // dataInfo.incidentData.duty = {id:dutyConfig.dutyId,dept:dutyConfig.dutyName};
  1313. // }else{
  1314. // dataInfo.incidentData.duty = undefined;
  1315. // }
  1316. // }else{
  1317. // dataInfo.incidentData.duty = undefined;
  1318. // }
  1319. // }else{
  1320. // // 不分院区
  1321. // // dataInfo.incidentData.hosId = loginUserStore.loginUser.user.currentHospital.id;
  1322. // }
  1323. getDuty()
  1324. }
  1325. }else if(incidentBuildStore.incidentBuild.data){
  1326. // 初始化
  1327. Object.assign(dataInfo.incidentData, incidentBuildStore.incidentBuild.data);
  1328. if(dataInfo.incidentData.category){
  1329. if(dataInfo.incidentData.synergetic){
  1330. synergeticArr.value = dataInfo.incidentData.synergetic.map(v => v.name).join(',')
  1331. }
  1332. dataInfo.category = dataInfo.incidentData.category;
  1333. getIntroduceCount(dataInfo.category.id)
  1334. // 处理责任科室
  1335. // if(dataInfo.category.branchType == 1){
  1336. // // 分院区
  1337. // if(dataInfo.incidentData.branch){
  1338. // let dutyConfig = dataInfo.category.branchUserGroups.find(v=>v.branchId == dataInfo.incidentData.branch);
  1339. // if(dutyConfig && dutyConfig.dutyId && dutyConfig.dutyName){
  1340. // dataInfo.incidentData.duty = {id:dutyConfig.dutyId,dept:dutyConfig.dutyName};
  1341. // }else{
  1342. // dataInfo.incidentData.duty = undefined;
  1343. // }
  1344. // }else{
  1345. // dataInfo.incidentData.duty = undefined;
  1346. // }
  1347. // }else{
  1348. // // 不分院区
  1349. // dataInfo.incidentData.hosId = loginUserStore.loginUser.user.currentHospital.id;
  1350. // }
  1351. }
  1352. console.log(222, dataInfo.incidentData)
  1353. if(shijianliebiao_supplement.value && !dataInfo.incidentData.entranceType){
  1354. let index = dataInfo.tabs.findIndex(v => v.value === 'assign');
  1355. let item = dataInfo.tabs.find(i=> i.value == 'supplement')
  1356. if(!item){
  1357. dataInfo.tabs.splice(index, 0, {id: 7, name: '补单', value: 'supplement', num: ''});
  1358. }
  1359. }
  1360. if(dataInfo.incidentData.place){
  1361. if(dataInfo.incidentData.place.floor){
  1362. floorId.value = JSON.parse(JSON.stringify(dataInfo.incidentData.place.floor.id))
  1363. }else{
  1364. floorId.value = JSON.parse(JSON.stringify(dataInfo.incidentData.place.id))
  1365. }
  1366. }
  1367. getDuty()
  1368. if(dataInfo.incidentData.source){
  1369. dataInfo.incidentData.source = { id: dataInfo.incidentData.source };
  1370. }
  1371. if(dataInfo.incidentData.requester){
  1372. dataInfo.incidentData.requester = dataInfo.incidentData.requester
  1373. }
  1374. }
  1375. })
  1376. }
  1377. // 获取故障现象绑定的科室
  1378. function getDuty(){
  1379. let postData = {
  1380. idx: 0,
  1381. sum: 9999,
  1382. incidentCategoryConfig: {
  1383. categoryId: dataInfo.incidentData.category.id,
  1384. dutyId: loginUserStore.loginUser.user.currentHospital.id,
  1385. },
  1386. };
  1387. getFetchDataList("simple/data", "incidentCategoryConfig", postData).then(res => {
  1388. let item = res.list.find(i=>i.categoryId == dataInfo.incidentData.category.id)
  1389. if(item){
  1390. dutyList.value = item.dutyDTO;
  1391. dataInfo.incidentData.duty = dutyList.value.id;
  1392. }
  1393. initForm()
  1394. // console.log(1111,dutyList.value)
  1395. })
  1396. }
  1397. // 获取是否开启汇总单
  1398. function getHosConfig(){
  1399. let postData = {
  1400. idx: 0,
  1401. sum: 9999,
  1402. hospitalConfig:{
  1403. hosId: loginUserStore.loginUser.user.currentHospital.id,
  1404. model: "itsm"
  1405. }
  1406. };
  1407. getFetchDataList("simple/data", "hospitalConfig", postData)
  1408. .then((res) => {
  1409. // SummaryData.value = res.list.find(i=>i.key=='itsmSummarySheet')
  1410. HandleData.simpleness = res.list.find(i=>i.key=='itsmSimpleHandle').value
  1411. });
  1412. }
  1413. onLoad((option) => {
  1414. getHosConfig()
  1415. menuAuthHandle()
  1416. getDic()
  1417. if(!dataInfo.tabActiveValue){
  1418. dataInfo.tabActiveValue = dataInfo.tabs[0].value;
  1419. }
  1420. })
  1421. </script>
  1422. <style lang="scss" scoped>
  1423. .handler{
  1424. height: 100%;
  1425. display: flex;
  1426. flex-direction: column;
  1427. justify-content: space-between;
  1428. .head{
  1429. height: 88rpx;
  1430. display: flex;
  1431. position: fixed;
  1432. z-index: 99;
  1433. width: 100%;
  1434. background-color: #fff;
  1435. font-size: 30rpx;
  1436. .tab{
  1437. flex: 1;
  1438. display: flex;
  1439. justify-content: center;
  1440. align-items: center;
  1441. border-bottom: 4rpx solid transparent;
  1442. &.active{
  1443. color: $uni-primary;
  1444. border-color: $uni-primary;
  1445. }
  1446. }
  1447. }
  1448. .body{
  1449. margin-top: 88rpx;
  1450. box-sizing: border-box;
  1451. flex: 1;
  1452. min-height: 0;
  1453. &.bg{
  1454. background-color: #F7F7F7;
  1455. }
  1456. .summaryItem{
  1457. &:first-of-type{
  1458. .summaryItem_head{
  1459. border-bottom: 1rpx solid #DDDDDD;
  1460. }
  1461. }
  1462. .summary_total{
  1463. padding: 20rpx 0;
  1464. display: flex;
  1465. justify-content: center;
  1466. align-items: center;
  1467. }
  1468. .summaryItem_head{
  1469. padding: 24rpx;
  1470. font-size: 26rpx;
  1471. color: #3A3A3A;
  1472. }
  1473. .summaryItem_body{
  1474. font-size: 30rpx;
  1475. background-color: #fff;
  1476. .summaryItem_bodyItem{
  1477. padding: 24rpx;
  1478. border-bottom: 1rpx solid #DDDDDD;
  1479. .summaryItem_bodyItem_top{
  1480. display: flex;
  1481. justify-content: space-between;
  1482. align-items: center;
  1483. .value{
  1484. padding-left: 48rpx;
  1485. flex-shrink: 0;
  1486. }
  1487. }
  1488. .summaryItem_bodyItem_bottom{
  1489. margin-top: 24rpx;
  1490. display: flex;
  1491. justify-content: space-between;
  1492. align-items: center;
  1493. .name{
  1494. text-align: right;
  1495. flex: 1;
  1496. }
  1497. .value{
  1498. width: 240rpx;
  1499. text-align: right;
  1500. padding-left: 48rpx;
  1501. flex-shrink: 0;
  1502. }
  1503. }
  1504. }
  1505. }
  1506. .summaryItem_foot{
  1507. font-size: 30rpx;
  1508. background-color: #fff;
  1509. &.total{
  1510. margin-top: 24rpx;
  1511. }
  1512. .summaryItem_foot_total{
  1513. padding: 24rpx 0;
  1514. display: flex;
  1515. justify-content: center;
  1516. align-items: center;
  1517. }
  1518. .summaryItem_foot_add{
  1519. border-top: 1rpx solid #DDDDDD;
  1520. padding: 24rpx 0;
  1521. display: flex;
  1522. justify-content: center;
  1523. align-items: center;
  1524. .newicon-icon-test{
  1525. font-size: 30rpx;
  1526. font-weight: bold;
  1527. }
  1528. }
  1529. }
  1530. }
  1531. .form_item_column{
  1532. padding-top: 24rpx;
  1533. min-height: 86rpx;
  1534. .form_item{
  1535. padding-top: 0;
  1536. min-height: auto;
  1537. }
  1538. }
  1539. .form_item{
  1540. display: flex;
  1541. align-items: center;
  1542. padding-top: 24rpx;
  1543. min-height: 86rpx;
  1544. &.column{
  1545. height: auto;
  1546. flex-direction: column;
  1547. align-items: flex-start;
  1548. .import-rep{
  1549. padding: 5rpx 10rpx;
  1550. border-radius: 50rpx;
  1551. background: #d1fcd5;
  1552. color: #49b856;
  1553. font-size: 24rpx;
  1554. }
  1555. .title{
  1556. margin-right: 0;
  1557. }
  1558. .title-width{
  1559. width: 100%;
  1560. }
  1561. .title-fl-sb{
  1562. display: flex;
  1563. justify-content: space-between;
  1564. width: 100%;
  1565. }
  1566. .value{
  1567. margin-top: 10rpx;
  1568. padding-left: 20rpx;
  1569. box-sizing: border-box;
  1570. }
  1571. .tips{
  1572. padding: 24rpx;
  1573. text-align: center;
  1574. font-size: 22rpx;
  1575. color: #909399;
  1576. width: 100%;
  1577. box-sizing: border-box;
  1578. }
  1579. }
  1580. .title{
  1581. font-size: 26rpx;
  1582. display: flex;
  1583. align-items: center;
  1584. margin-right: 12rpx;
  1585. flex-shrink: 0;
  1586. &.select{
  1587. width: calc(5em + 20rpx);
  1588. }
  1589. }
  1590. .value{
  1591. width: 100%;
  1592. &.category{
  1593. width: 100%;
  1594. display: flex;
  1595. justify-content: space-between;
  1596. align-items: center;
  1597. .categoryName{
  1598. font-size: 26rpx;
  1599. color: #555;
  1600. flex: 1;
  1601. }
  1602. .newicon-weibiaoti2010104{
  1603. color: $uni-primary;
  1604. margin-left: 24rpx;
  1605. }
  1606. }
  1607. .imgTips{
  1608. color: #909399;
  1609. font-size: 22rpx;
  1610. }
  1611. }
  1612. .synergeticNames{
  1613. font-size: 26rpx;
  1614. margin-right: 24rpx;
  1615. }
  1616. .synergeticAdd{
  1617. flex-shrink: 0;
  1618. }
  1619. }
  1620. }
  1621. }
  1622. </style>