assign.vue 50 KB

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