assign.vue 48 KB

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