assign.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023
  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. <!-- 故障处理 -->
  10. <template v-if="dataInfo.tabActiveValue === 'direct'">
  11. <view class="form_item column" v-if="dataInfo.category.hasSimple != 1">
  12. <view class="title"><text class="required newicon newicon-bitian"></text>解决方案:</view>
  13. <uni-easyinput class="value" type="textarea" v-model="dataInfo.handleDescription" placeholder="请输入解决方案" :class="{formRed: isSubmit && !dataInfo.handleDescription.trim()}" />
  14. </view>
  15. <view class="form_item" v-if="dataInfo.category.hasSimple != 1">
  16. <view class="title"><text class="required newicon newicon-bitian"></text>故障现象:</view>
  17. <view class="value category" @click="selectCategory">
  18. <text class="categoryName ellipsis-multiline">{{dataInfo.category.mutiCategory}}</text>
  19. <text class="newicon newicon-weibiaoti2010104"></text>
  20. </view>
  21. </view>
  22. <view class="form_item">
  23. <view class="title select"><text class="required newicon newicon-bitian"></text>处理方式:</view>
  24. <uni-data-select class="value" v-model="dataInfo.handleCategory" :localdata="dataInfo.handleCategoryList" :clear="false" placeholder="请选择处理方式" :class="{formRed: isSubmit && !dataInfo.handleCategory}"></uni-data-select>
  25. </view>
  26. <view class="form_item" v-if="dataInfo.category.hasSimple != 1">
  27. <view class="title select"><text class="required newicon newicon-bitian"></text>关闭代码:</view>
  28. <uni-data-select class="value" v-model="dataInfo.closecode" :localdata="dataInfo.closecodeList" :clear="false" placeholder="请选择关闭代码" :class="{formRed: isSubmit && !dataInfo.closecode}"></uni-data-select>
  29. </view>
  30. <view class="form_item">
  31. <view class="title"><text class="required newicon newicon-bitian transparent"></text>协同人员:</view>
  32. <text class="synergeticNames ellipsis">{{dataInfo.synergetic.map(v => v.name).join(',')}}</text>
  33. <button type="primary" plain size="mini" class="primaryPlainButton synergeticAdd" @click="synergeticAdd">+立即添加</button>
  34. </view>
  35. <view class="form_item_column">
  36. <view class="form_item">
  37. <view class="title"><text class="required newicon newicon-bitian transparent"></text>处理图片:</view>
  38. <view class="value">
  39. <uni-file-picker ref="handlerImgRef" v-model="dataInfo.handlerImgList" limit="3" @success="handlerImgSuccess" @fail="handlerImgFail" @select="handlerImgSelect" @delete="handlerImgDelete"></uni-file-picker>
  40. </view>
  41. </view>
  42. <view class="form_item">
  43. <view class="title transparent"><text class="required newicon newicon-bitian transparent"></text>处理图片:</view>
  44. <view class="value">
  45. <text class="imgTips ellipsis">(支持JPG/PNG格式图片,单张大小10M以内)</text>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <!-- 派单 -->
  51. <template v-if="dataInfo.tabActiveValue === 'assign'">
  52. <view class="form_item">
  53. <view class="title select"><text class="required newicon newicon-bitian"></text>工作组:</view>
  54. <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>
  55. </view>
  56. <view class="form_item">
  57. <view class="title radio"><text class="required newicon newicon-bitian"></text>是否转派到人:</view>
  58. <uni-data-checkbox class="value" v-model="dataInfo.isAssignUser" :localdata="dataInfo.isAssignUserList" @change="changeIsAssignUser" />
  59. </view>
  60. <view class="form_item" v-if="dataInfo.isAssignUser === 1">
  61. <view class="title select"><text class="required newicon newicon-bitian"></text>转派对象:</view>
  62. <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>
  63. </view>
  64. <view class="form_item_column">
  65. <view class="form_item">
  66. <view class="title"><text class="required newicon newicon-bitian transparent"></text>处理图片:</view>
  67. <view class="value">
  68. <uni-file-picker ref="handlerImgRef" v-model="dataInfo.handlerImgList" limit="3" @success="handlerImgSuccess" @fail="handlerImgFail" @select="handlerImgSelect" @delete="handlerImgDelete"></uni-file-picker>
  69. </view>
  70. </view>
  71. <view class="form_item">
  72. <view class="title transparent"><text class="required newicon newicon-bitian transparent"></text>处理图片:</view>
  73. <view class="value">
  74. <text class="imgTips ellipsis">(支持JPG/PNG格式图片,单张大小10M以内)</text>
  75. </view>
  76. </view>
  77. </view>
  78. </template>
  79. </scroll-view>
  80. <view class="foot_common_btns">
  81. <button @click="goBack" type="default" class="cancelButton btn">返回</button>
  82. <button @click="submit" type="default" class="primaryButton btn">提交</button>
  83. </view>
  84. </view>
  85. </template>
  86. <script setup>
  87. import { ref, reactive, computed } from 'vue'
  88. import { onLoad } from '@dcloudio/uni-app'
  89. import { generateNumberArray } from '@/utils/index.js'
  90. import { api_group, api_incidentDetail, api_user, api_incidentTask, api_branch, api_dutyDepartment, api_getDictionary, api_querySummaryDoc, api_addSummaryDoc } from "@/http/api.js"
  91. import { defaultColor } from '@/static/js/theme.js'
  92. import { useSetTitle } from '@/share/useSetTitle.js'
  93. import { useMakePhoneCall } from '@/share/useMakePhoneCall.js'
  94. import { useUploadFile } from '@/share/useUploadFile.js'
  95. import { useGoBack } from '@/share/useGoBack.js'
  96. import { useLoginUserStore } from '@/stores/loginUser'
  97. import { useHandlerStore } from '@/stores/handler'
  98. import { useIncidentBuildStore } from '@/stores/incidentBuild'
  99. useSetTitle();
  100. const loginUserStore = useLoginUserStore();
  101. const handlerStore = useHandlerStore();
  102. const incidentBuildStore = useIncidentBuildStore();
  103. const { makePhoneCall } = useMakePhoneCall();
  104. const { uploadFile } = useUploadFile();
  105. const { goBack } = useGoBack();
  106. // 主题颜色
  107. const primaryColor = ref(defaultColor)
  108. // 数据
  109. const dataInfo = reactive({
  110. tabs: [
  111. {id: 5, name: '直接处理', value: 'direct', num: ''},
  112. {id: 6, name: '派单', value: 'assign', num: ''},
  113. ],
  114. tabActiveValue: 0,//当前选择的tab
  115. incidentId: undefined,//事件ID
  116. incidentData: {},//事件对象
  117. groupList: [], //工作组列表
  118. groupId: undefined, //工作组ID
  119. userIdList: [], //延期天数列表
  120. userIdId: undefined, //延期天数ID
  121. deferralRemark: '',//延期说明
  122. summaryObj: {
  123. consumableList: [],//耗材列表
  124. workHourManagementList: [],//工时列表
  125. },//汇总单信息
  126. summaryId: undefined,//汇总单Id
  127. isNumber: false,//修改数量弹窗
  128. evtNumber: 1,//弹窗返回的数量
  129. selectData: {},//选择的对象
  130. selectType: {},//选择的对象类型
  131. handleDescription: '',//解决方案
  132. handleCategory: undefined,//处理方式
  133. handleCategoryList: [],//处理方式列表
  134. closecode: undefined,//关闭代码
  135. closecodeList: [],//关闭代码列表
  136. handlerImgList: [],//处理图片列表
  137. category: {},//故障现象
  138. synergetic: [],//协同人员
  139. isAssignUser: 1, //工作组是否转派到人
  140. isAssignUserList: [
  141. { text: '是', value: 1 },
  142. { text: '否', value: 0 },
  143. ], //工作组是否转派到人选项
  144. })
  145. // 是否提交
  146. const isSubmit = ref(false)
  147. // 处理图片
  148. const handlerImgRef = ref(null)
  149. // 上传处理图片成功
  150. function handlerImgSuccess(e){
  151. dataInfo.handlerImgList.forEach(v => {
  152. v.url = v.path;
  153. })
  154. console.log(dataInfo.handlerImgList);
  155. let requestList = [];
  156. // 处理图片
  157. dataInfo.handlerImgList.forEach(v => {
  158. let handlerOrderImg$ = handlerOrderImg(v);
  159. requestList.push(handlerOrderImg$);
  160. })
  161. // 报修图片
  162. dataInfo.incidentData.repairImgList.forEach(v => {
  163. let repairOrderImg$ = repairOrderImg(v);
  164. requestList.push(repairOrderImg$);
  165. })
  166. Promise.all(requestList).then(resList => {
  167. uni.hideLoading();
  168. console.log(resList);
  169. incidentBuildStore.clearIncidentBuildData();
  170. uni.showToast({
  171. icon: 'none',
  172. title: '建单成功',
  173. mask: true,
  174. });
  175. setTimeout(() => {
  176. uni.reLaunch({
  177. url: '/pages/incidentList/incidentList',
  178. })
  179. }, 1500)
  180. })
  181. }
  182. // 上传处理图片失败
  183. function handlerImgFail(e){
  184. dataInfo.handlerImgList.forEach(v => {
  185. v.url = v.path;
  186. })
  187. console.log(dataInfo.handlerImgList);
  188. }
  189. // 选择上传图片
  190. function handlerImgSelect(e){
  191. dataInfo.handlerImgList = dataInfo.handlerImgList.concat(e.tempFiles);
  192. console.log(dataInfo.handlerImgList);
  193. }
  194. // 删除上传图片
  195. function handlerImgDelete(e){
  196. dataInfo.handlerImgList = dataInfo.handlerImgList.filter(v => e.tempFile.uuid != v.uuid);
  197. console.log(dataInfo.handlerImgList);
  198. }
  199. // 添加协同人员
  200. function synergeticAdd(){
  201. handlerStore.setHandlerData(dataInfo, 'assign');
  202. uni.navigateTo({
  203. url: `/pages/synergeticAdd/synergeticAdd?incidentId=${dataInfo.incidentId}`
  204. })
  205. }
  206. // 选择故障现象
  207. function selectCategory(){
  208. handlerStore.setHandlerData(dataInfo, 'assign');
  209. uni.navigateTo({
  210. url: `/pages/categoryOne/categoryOne?incidentId=${dataInfo.incidentId}`
  211. })
  212. }
  213. // 点击修改数量
  214. function numberClick(data, type){
  215. if(type === 'editConsumable'){
  216. dataInfo.evtNumber = data.consumablesNum;
  217. }else if(type === 'editWorkHourManagement'){
  218. dataInfo.evtNumber = data.workHourNum2;
  219. }
  220. dataInfo.isNumber = true;
  221. dataInfo.selectData = data;
  222. dataInfo.selectType = type;
  223. }
  224. // 确认修改数量
  225. function conformNumber(evtNumber){
  226. dataInfo.evtNumber = evtNumber;
  227. dataInfo.isNumber = false;
  228. addSummaryDoc();
  229. }
  230. // 移除数量
  231. function removeNumber(evtNumber){
  232. dataInfo.evtNumber = evtNumber;
  233. dataInfo.isNumber = false;
  234. removeSummaryDoc();
  235. }
  236. // 关闭修改数量
  237. function cancelNumber(){
  238. dataInfo.isNumber = false;
  239. }
  240. // 修改耗材/工时
  241. function addSummaryDoc(){
  242. uni.showLoading({
  243. title: "加载中",
  244. mask: true,
  245. });
  246. let postData = {
  247. "summaryId": dataInfo.summaryId,
  248. "modifyNum": 'edit',
  249. };
  250. if(dataInfo.selectType === 'editConsumable'){
  251. postData.consumableList = [
  252. {
  253. "consumablesId": dataInfo.selectData.consumableId,
  254. "consumablesNum": dataInfo.evtNumber,
  255. }
  256. ];
  257. }else if(dataInfo.selectType === 'editWorkHourManagement'){
  258. postData.workHourManagementList = [
  259. {
  260. "workHourId": dataInfo.selectData.id,
  261. "workHourNum": dataInfo.evtNumber,
  262. }
  263. ];
  264. }
  265. api_addSummaryDoc(postData).then(res => {
  266. uni.hideLoading();
  267. if(res.status == 200){
  268. uni.showToast({
  269. icon: 'none',
  270. title: '修改数量成功',
  271. mask: true,
  272. });
  273. getSummaryList();
  274. }else{
  275. uni.showToast({
  276. icon: 'none',
  277. title: res.msg || '请求数据失败!'
  278. });
  279. }
  280. })
  281. }
  282. // 移除耗材/工时
  283. function removeSummaryDoc(){
  284. uni.showLoading({
  285. title: "加载中",
  286. mask: true,
  287. });
  288. let postData = {
  289. "summaryId": dataInfo.summaryId,
  290. "remove": 'remove',
  291. };
  292. if(dataInfo.selectType === 'editConsumable'){
  293. postData.consumableList = [
  294. {
  295. "consumablesId": dataInfo.selectData.consumableId,
  296. "consumablesNum": dataInfo.evtNumber,
  297. }
  298. ];
  299. }else if(dataInfo.selectType === 'editWorkHourManagement'){
  300. postData.workHourManagementList = [
  301. {
  302. "workHourId": dataInfo.selectData.id,
  303. "workHourNum": dataInfo.evtNumber,
  304. }
  305. ];
  306. }
  307. api_addSummaryDoc(postData).then(res => {
  308. uni.hideLoading();
  309. if(res.status == 200){
  310. uni.showToast({
  311. icon: 'none',
  312. title: '移除成功',
  313. mask: true,
  314. });
  315. getSummaryList();
  316. }else{
  317. uni.showToast({
  318. icon: 'none',
  319. title: res.msg || '请求数据失败!'
  320. });
  321. }
  322. })
  323. }
  324. // 重置
  325. function reset(){
  326. dataInfo.repairTypeList = []; //延期原因列表
  327. dataInfo.groupId = undefined; //延期原因ID
  328. dataInfo.userIdList = []; //延期天数列表
  329. dataInfo.userIdId = undefined; //延期天数ID
  330. dataInfo.deferralRemark = '';//延期说明
  331. dataInfo.summaryObj = {
  332. consumableList: [],//耗材列表
  333. workHourManagementList: [],//工时列表
  334. };//汇总单信息
  335. dataInfo.summaryId = undefined;//汇总单Id
  336. dataInfo.isNumber = false;//修改数量弹窗
  337. dataInfo.evtNumber = 1;//弹窗返回的数量
  338. dataInfo.selectData = {};//选择的对象
  339. dataInfo.selectType = {};//选择的对象类型
  340. dataInfo.handleDescription = '';//解决方案
  341. dataInfo.handleCategory = undefined;//处理方式
  342. dataInfo.handleCategoryList = [];//处理方式列表
  343. dataInfo.closecode = undefined;//关闭代码
  344. dataInfo.closecodeList = [];//关闭代码列表
  345. dataInfo.handlerImgList = [];//处理图片列表
  346. dataInfo.category = {};//故障现象
  347. dataInfo.synergetic = [];//协同人员
  348. }
  349. // 初始化表单
  350. function initForm(){
  351. if(dataInfo.tabActiveValue === 'direct'){
  352. getHandleCategorys();
  353. getClosecodes();
  354. }else if(dataInfo.tabActiveValue === 'assign'){
  355. getGroups();
  356. }
  357. }
  358. // 点击tab
  359. function clickTab(tabValue){
  360. if(dataInfo.tabActiveValue == tabValue){
  361. return;
  362. }
  363. dataInfo.tabActiveValue = tabValue;
  364. isSubmit.value = false;
  365. reset();
  366. dataInfo.category = dataInfo.incidentData.category || {};
  367. dataInfo.synergetic = dataInfo.incidentData.synergetic || [];
  368. initForm();
  369. }
  370. // 选择工作组
  371. function changeGroup(){
  372. dataInfo.userId = undefined;
  373. dataInfo.userList = [];
  374. getUsers();
  375. }
  376. // 选择是否转派到人
  377. function changeIsAssignUser(){
  378. dataInfo.userId = undefined;
  379. }
  380. // 获取工作组列表
  381. function getGroups(){
  382. uni.showLoading({
  383. title: "加载中",
  384. mask: true,
  385. });
  386. let postData = {
  387. "idx": 0,
  388. "sum": 9999,
  389. "group": {
  390. "selectType": "nouser"
  391. }
  392. };
  393. api_group(postData).then(res => {
  394. uni.hideLoading();
  395. if(res.status == 200){
  396. res.list = res.list || [];
  397. dataInfo.groupList = res.list.map(v => ({
  398. text: v.groupName,
  399. value: v.id,
  400. }));
  401. }else{
  402. uni.showToast({
  403. icon: 'none',
  404. title: res.msg || '请求数据失败!'
  405. });
  406. }
  407. })
  408. }
  409. // 获取用户列表
  410. function getUsers(){
  411. uni.showLoading({
  412. title: "加载中",
  413. mask: true,
  414. });
  415. let postData = {
  416. "idx": 0,
  417. "sum": 9999,
  418. "user": {
  419. "groupdata":{
  420. "id": dataInfo.groupId,
  421. },
  422. "roledata": {
  423. "rolecode": "first-line support"
  424. },
  425. "selectType": "1",
  426. "selectDetails": 1,
  427. "simple": true,
  428. "engineer": 1
  429. }
  430. };
  431. api_user(postData).then(res => {
  432. uni.hideLoading();
  433. if(res.status == 200){
  434. res.list = res.list || [];
  435. dataInfo.userList = res.list.map(v => ({
  436. text: v.name,
  437. value: v.id,
  438. }));
  439. }else{
  440. uni.showToast({
  441. icon: 'none',
  442. title: res.msg || '请求数据失败!'
  443. });
  444. }
  445. })
  446. }
  447. // 获取处理方式列表
  448. function getHandleCategorys(){
  449. uni.showLoading({
  450. title: "加载中",
  451. mask: true,
  452. });
  453. let postData = {
  454. "key": 'incident_handleCategory',
  455. "type": "list",
  456. };
  457. api_getDictionary(postData).then(res => {
  458. uni.hideLoading();
  459. res = res || [];
  460. dataInfo.handleCategoryList = res.map(v => ({
  461. text: v.name,
  462. value: v.id,
  463. key: v.value,
  464. }));
  465. if(!dataInfo.handleCategory){
  466. let handleCategory = dataInfo.handleCategoryList.find(v => v.key == 'SUPPORT');
  467. dataInfo.handleCategory = handleCategory ? handleCategory.value : undefined;
  468. }
  469. })
  470. }
  471. // 获取关闭代码列表
  472. function getClosecodes(){
  473. uni.showLoading({
  474. title: "加载中",
  475. mask: true,
  476. });
  477. let postData = {
  478. "key": 'incident_closecode',
  479. "type": "list",
  480. };
  481. api_getDictionary(postData).then(res => {
  482. uni.hideLoading();
  483. res = res || [];
  484. dataInfo.closecodeList = res.map(v => ({
  485. text: v.name,
  486. value: v.id,
  487. key: v.value,
  488. }));
  489. if(!dataInfo.closecode){
  490. let closecode = dataInfo.closecodeList.find(v => v.key == '060');
  491. dataInfo.closecode = closecode ? closecode.value : undefined;
  492. }
  493. })
  494. }
  495. // 添加耗材
  496. function addConsumable(){
  497. uni.navigateTo({
  498. url: `/pages/consumableList/consumableList?incidentId=${dataInfo.incidentId}&summaryId=${dataInfo.summaryId}`
  499. })
  500. }
  501. // 添加工时
  502. function addWorkHourManagement(){
  503. uni.navigateTo({
  504. url: `/pages/workHourManagementOne/workHourManagementOne?incidentId=${dataInfo.incidentId}&summaryId=${dataInfo.summaryId}`
  505. })
  506. }
  507. // 提交
  508. function submit(){
  509. isSubmit.value = true;
  510. if(dataInfo.tabActiveValue === 'direct'){
  511. submitHandler();
  512. }else if(dataInfo.tabActiveValue === 'assign'){
  513. submitAssign();
  514. }
  515. }
  516. // 处理提交事件
  517. function handlerOrder(){
  518. let postData = {
  519. incident: dataInfo.incidentData,
  520. }
  521. postData.incident.handleDescription = dataInfo.handleDescription;
  522. postData.incident.handleCategory = {id: dataInfo.handleCategory};
  523. postData.incident.closecode = {id: dataInfo.closecode};
  524. postData.incident.category = dataInfo.category;
  525. postData.incident.synergetic = dataInfo.synergetic;
  526. postData.incident.directProcess = 1;//直接解决
  527. return api_incidentTask('accept', postData);
  528. }
  529. // 派单提交事件
  530. function assignOrder(){
  531. let postData = {
  532. incident: dataInfo.incidentData,
  533. }
  534. if(dataInfo.userId){
  535. // 派人
  536. postData.incident.assignee = dataInfo.userId;
  537. } else {
  538. // 派组
  539. postData.incident.candidateGroups = dataInfo.groupId;
  540. }
  541. return api_incidentTask('accept', postData);
  542. }
  543. // 处理图片
  544. function handlerOrderImg(imgObj){
  545. return uploadFile(imgObj, 'incident', dataInfo.incidentId)
  546. }
  547. // 报修图片
  548. function repairOrderImg(imgObj){
  549. return uploadFile(imgObj, 'wechatRequesterIncident', dataInfo.incidentId)
  550. }
  551. // 处理提交
  552. function submitHandler(){
  553. console.log(dataInfo);
  554. if(!dataInfo.handleDescription.trim() && dataInfo.category.hasSimple != 1){
  555. uni.showToast({
  556. icon: 'none',
  557. title: '请填写解决方案'
  558. });
  559. return;
  560. }
  561. if(!dataInfo.category.id && dataInfo.category.hasSimple != 1){
  562. uni.showToast({
  563. icon: 'none',
  564. title: '请选择故障现象'
  565. });
  566. return;
  567. }
  568. if(!dataInfo.handleCategory){
  569. uni.showToast({
  570. icon: 'none',
  571. title: '请选择处理方式'
  572. });
  573. return;
  574. }
  575. if(!dataInfo.closecode && dataInfo.category.hasSimple != 1){
  576. uni.showToast({
  577. icon: 'none',
  578. title: '请选择关闭代码'
  579. });
  580. return;
  581. }
  582. if(!dataInfo.incidentData.duty){
  583. uni.showToast({
  584. icon: 'none',
  585. title: '您选择的故障现象没有设置责任科室'
  586. });
  587. return;
  588. }
  589. console.log(dataInfo.handlerImgList)
  590. uni.showLoading({
  591. title: "加载中",
  592. mask: true,
  593. });
  594. if(dataInfo.handlerImgList.length){
  595. // 有图片
  596. let handlerOrder$ = handlerOrder();
  597. let requestList = [handlerOrder$];
  598. Promise.all(requestList).then(resList => {
  599. uni.hideLoading();
  600. console.log(resList);
  601. if(resList[0].state == 200){
  602. dataInfo.incidentId = resList[0].data.id;
  603. handlerImgRef.value.upload();
  604. }else{
  605. uni.showToast({
  606. icon: 'none',
  607. title: resList[0].msg || '请求数据失败!'
  608. });
  609. }
  610. })
  611. }else{
  612. // 没有图片
  613. let handlerOrder$ = handlerOrder();
  614. let requestList = [handlerOrder$];
  615. Promise.all(requestList).then(resList => {
  616. uni.hideLoading();
  617. console.log(resList);
  618. if(resList[0].state == 200){
  619. incidentBuildStore.clearIncidentBuildData();
  620. uni.showToast({
  621. icon: 'none',
  622. title: '建单成功',
  623. mask: true,
  624. });
  625. setTimeout(() => {
  626. uni.reLaunch({
  627. url: '/pages/incidentList/incidentList',
  628. })
  629. }, 1500)
  630. }else{
  631. uni.showToast({
  632. icon: 'none',
  633. title: resList[0].msg || '请求数据失败!'
  634. });
  635. }
  636. })
  637. }
  638. }
  639. // 派单提交
  640. function submitAssign(){
  641. if(!dataInfo.groupId){
  642. uni.showToast({
  643. icon: 'none',
  644. title: '请选择工作组'
  645. });
  646. return;
  647. }
  648. if(dataInfo.isAssignUser == 1 && !dataInfo.userId){
  649. uni.showToast({
  650. icon: 'none',
  651. title: '请选择指派对象'
  652. });
  653. return;
  654. }
  655. if(!dataInfo.incidentData.duty){
  656. uni.showToast({
  657. icon: 'none',
  658. title: '您选择的故障现象没有设置责任科室'
  659. });
  660. return;
  661. }
  662. uni.showLoading({
  663. title: "加载中",
  664. mask: true,
  665. });
  666. if(dataInfo.handlerImgList.length){
  667. // 有图片
  668. let assignOrder$ = assignOrder();
  669. let requestList = [assignOrder$];
  670. Promise.all(requestList).then(resList => {
  671. uni.hideLoading();
  672. console.log(resList);
  673. if(resList[0].state == 200){
  674. dataInfo.incidentId = resList[0].data.id;
  675. handlerImgRef.value.upload();
  676. }else{
  677. uni.showToast({
  678. icon: 'none',
  679. title: resList[0].msg || '请求数据失败!'
  680. });
  681. }
  682. })
  683. }else{
  684. // 没有图片
  685. let assignOrder$ = assignOrder();
  686. let requestList = [assignOrder$];
  687. Promise.all(requestList).then(resList => {
  688. uni.hideLoading();
  689. console.log(resList);
  690. if(resList[0].state == 200){
  691. incidentBuildStore.clearIncidentBuildData();
  692. uni.showToast({
  693. icon: 'none',
  694. title: '建单成功',
  695. mask: true,
  696. });
  697. setTimeout(() => {
  698. uni.reLaunch({
  699. url: '/pages/incidentList/incidentList',
  700. })
  701. }, 1500)
  702. }else{
  703. uni.showToast({
  704. icon: 'none',
  705. title: resList[0].msg || '请求数据失败!'
  706. });
  707. }
  708. })
  709. }
  710. }
  711. onLoad((option) => {
  712. // 跳转页面选择了选项
  713. if(handlerStore.handler.data){
  714. Object.assign(dataInfo, handlerStore.handler.data);
  715. console.log(dataInfo)
  716. handlerStore.clearHandlerData();
  717. if(dataInfo.category){
  718. dataInfo.incidentData.category = dataInfo.category;
  719. // 处理责任科室
  720. if(dataInfo.category.branchType == 1){
  721. // 分院区
  722. if(dataInfo.incidentData.branch){
  723. let dutyConfig = dataInfo.category.branchUserGroups.find(v=>v.branchId == dataInfo.incidentData.branch);
  724. if(dutyConfig && dutyConfig.dutyId && dutyConfig.dutyName){
  725. dataInfo.incidentData.duty = {id:dutyConfig.dutyId,dept:dutyConfig.dutyName};
  726. }else{
  727. dataInfo.incidentData.duty = undefined;
  728. }
  729. }else{
  730. dataInfo.incidentData.duty = undefined;
  731. }
  732. }else{
  733. // 不分院区
  734. dataInfo.incidentData.duty = dataInfo.category.dutyDepartment;
  735. }
  736. }
  737. }else if(incidentBuildStore.incidentBuild.data){
  738. // 初始化
  739. Object.assign(dataInfo.incidentData, incidentBuildStore.incidentBuild.data);
  740. if(dataInfo.incidentData.category){
  741. dataInfo.category = dataInfo.incidentData.category;
  742. // 处理责任科室
  743. if(dataInfo.category.branchType == 1){
  744. // 分院区
  745. if(dataInfo.incidentData.branch){
  746. let dutyConfig = dataInfo.category.branchUserGroups.find(v=>v.branchId == dataInfo.incidentData.branch);
  747. if(dutyConfig && dutyConfig.dutyId && dutyConfig.dutyName){
  748. dataInfo.incidentData.duty = {id:dutyConfig.dutyId,dept:dutyConfig.dutyName};
  749. }else{
  750. dataInfo.incidentData.duty = undefined;
  751. }
  752. }else{
  753. dataInfo.incidentData.duty = undefined;
  754. }
  755. }else{
  756. // 不分院区
  757. dataInfo.incidentData.duty = dataInfo.category.dutyDepartment;
  758. }
  759. }
  760. if(dataInfo.incidentData.priority){
  761. dataInfo.incidentData.priority = { id: dataInfo.incidentData.priority };
  762. }
  763. if(dataInfo.incidentData.source){
  764. dataInfo.incidentData.source = { id: dataInfo.incidentData.source };
  765. }
  766. if(dataInfo.incidentData.requester){
  767. dataInfo.incidentData.requester = { id: dataInfo.incidentData.requester }
  768. }
  769. }
  770. dataInfo.tabActiveValue = dataInfo.tabs[0].value;
  771. initForm()
  772. })
  773. </script>
  774. <style lang="scss" scoped>
  775. .handler{
  776. height: 100%;
  777. display: flex;
  778. flex-direction: column;
  779. justify-content: space-between;
  780. .head{
  781. height: 88rpx;
  782. display: flex;
  783. position: fixed;
  784. z-index: 99;
  785. width: 100%;
  786. background-color: #fff;
  787. font-size: 30rpx;
  788. .tab{
  789. flex: 1;
  790. display: flex;
  791. justify-content: center;
  792. align-items: center;
  793. border-bottom: 4rpx solid transparent;
  794. &.active{
  795. color: $uni-primary;
  796. border-color: $uni-primary;
  797. }
  798. }
  799. }
  800. .body{
  801. margin-top: 88rpx;
  802. box-sizing: border-box;
  803. flex: 1;
  804. min-height: 0;
  805. &.bg{
  806. background-color: #F7F7F7;
  807. }
  808. .summaryItem{
  809. &:first-of-type{
  810. .summaryItem_head{
  811. border-bottom: 1rpx solid #DDDDDD;
  812. }
  813. }
  814. .summary_total{
  815. padding: 20rpx 0;
  816. display: flex;
  817. justify-content: center;
  818. align-items: center;
  819. }
  820. .summaryItem_head{
  821. padding: 24rpx;
  822. font-size: 26rpx;
  823. color: #3A3A3A;
  824. }
  825. .summaryItem_body{
  826. font-size: 30rpx;
  827. background-color: #fff;
  828. .summaryItem_bodyItem{
  829. padding: 24rpx;
  830. border-bottom: 1rpx solid #DDDDDD;
  831. .summaryItem_bodyItem_top{
  832. display: flex;
  833. justify-content: space-between;
  834. align-items: center;
  835. .value{
  836. padding-left: 48rpx;
  837. flex-shrink: 0;
  838. }
  839. }
  840. .summaryItem_bodyItem_bottom{
  841. margin-top: 24rpx;
  842. display: flex;
  843. justify-content: space-between;
  844. align-items: center;
  845. .name{
  846. text-align: right;
  847. flex: 1;
  848. }
  849. .value{
  850. width: 240rpx;
  851. text-align: right;
  852. padding-left: 48rpx;
  853. flex-shrink: 0;
  854. }
  855. }
  856. }
  857. }
  858. .summaryItem_foot{
  859. font-size: 30rpx;
  860. background-color: #fff;
  861. &.total{
  862. margin-top: 24rpx;
  863. }
  864. .summaryItem_foot_total{
  865. padding: 24rpx 0;
  866. display: flex;
  867. justify-content: center;
  868. align-items: center;
  869. }
  870. .summaryItem_foot_add{
  871. border-top: 1rpx solid #DDDDDD;
  872. padding: 24rpx 0;
  873. display: flex;
  874. justify-content: center;
  875. align-items: center;
  876. .newicon-icon-test{
  877. font-size: 30rpx;
  878. font-weight: bold;
  879. }
  880. }
  881. }
  882. }
  883. .form_item_column{
  884. padding-top: 24rpx;
  885. min-height: 86rpx;
  886. .form_item{
  887. padding-top: 0;
  888. min-height: auto;
  889. }
  890. }
  891. .form_item{
  892. display: flex;
  893. align-items: center;
  894. padding-top: 24rpx;
  895. min-height: 86rpx;
  896. &.column{
  897. height: auto;
  898. flex-direction: column;
  899. align-items: flex-start;
  900. .title{
  901. margin-right: 0;
  902. }
  903. .value{
  904. margin-top: 10rpx;
  905. padding-left: 20rpx;
  906. box-sizing: border-box;
  907. }
  908. .tips{
  909. padding: 24rpx;
  910. text-align: center;
  911. font-size: 22rpx;
  912. color: #909399;
  913. width: 100%;
  914. box-sizing: border-box;
  915. }
  916. }
  917. .title{
  918. font-size: 26rpx;
  919. display: flex;
  920. align-items: center;
  921. margin-right: 12rpx;
  922. flex-shrink: 0;
  923. &.select{
  924. width: calc(5em + 20rpx);
  925. }
  926. }
  927. .value{
  928. width: 100%;
  929. &.category{
  930. width: 100%;
  931. display: flex;
  932. justify-content: space-between;
  933. align-items: center;
  934. .categoryName{
  935. font-size: 26rpx;
  936. color: #555;
  937. flex: 1;
  938. }
  939. .newicon-weibiaoti2010104{
  940. color: $uni-primary;
  941. margin-left: 24rpx;
  942. }
  943. }
  944. .imgTips{
  945. color: #909399;
  946. font-size: 22rpx;
  947. }
  948. }
  949. .synergeticNames{
  950. font-size: 26rpx;
  951. margin-right: 24rpx;
  952. }
  953. .synergeticAdd{
  954. flex-shrink: 0;
  955. }
  956. }
  957. }
  958. }
  959. </style>