assign.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979
  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. uni.showToast({
  170. icon: 'none',
  171. title: '建单成功',
  172. mask: true,
  173. });
  174. setTimeout(() => {
  175. uni.reLaunch({
  176. url: '/pages/incidentList/incidentList',
  177. })
  178. }, 1500)
  179. })
  180. }
  181. // 上传处理图片失败
  182. function handlerImgFail(e){
  183. dataInfo.handlerImgList.forEach(v => {
  184. v.url = v.path;
  185. })
  186. console.log(dataInfo.handlerImgList);
  187. }
  188. // 选择上传图片
  189. function handlerImgSelect(e){
  190. dataInfo.handlerImgList = dataInfo.handlerImgList.concat(e.tempFiles);
  191. console.log(dataInfo.handlerImgList);
  192. }
  193. // 删除上传图片
  194. function handlerImgDelete(e){
  195. dataInfo.handlerImgList = dataInfo.handlerImgList.filter(v => e.tempFile.uuid != v.uuid);
  196. console.log(dataInfo.handlerImgList);
  197. }
  198. // 添加协同人员
  199. function synergeticAdd(){
  200. handlerStore.setHandlerData(dataInfo, 'assign');
  201. uni.navigateTo({
  202. url: `/pages/synergeticAdd/synergeticAdd?incidentId=${dataInfo.incidentId}`
  203. })
  204. }
  205. // 选择故障现象
  206. function selectCategory(){
  207. handlerStore.setHandlerData(dataInfo, 'assign');
  208. uni.navigateTo({
  209. url: `/pages/categoryOne/categoryOne?incidentId=${dataInfo.incidentId}`
  210. })
  211. }
  212. // 点击修改数量
  213. function numberClick(data, type){
  214. if(type === 'editConsumable'){
  215. dataInfo.evtNumber = data.consumablesNum;
  216. }else if(type === 'editWorkHourManagement'){
  217. dataInfo.evtNumber = data.workHourNum2;
  218. }
  219. dataInfo.isNumber = true;
  220. dataInfo.selectData = data;
  221. dataInfo.selectType = type;
  222. }
  223. // 确认修改数量
  224. function conformNumber(evtNumber){
  225. dataInfo.evtNumber = evtNumber;
  226. dataInfo.isNumber = false;
  227. addSummaryDoc();
  228. }
  229. // 移除数量
  230. function removeNumber(evtNumber){
  231. dataInfo.evtNumber = evtNumber;
  232. dataInfo.isNumber = false;
  233. removeSummaryDoc();
  234. }
  235. // 关闭修改数量
  236. function cancelNumber(){
  237. dataInfo.isNumber = false;
  238. }
  239. // 修改耗材/工时
  240. function addSummaryDoc(){
  241. uni.showLoading({
  242. title: "加载中",
  243. mask: true,
  244. });
  245. let postData = {
  246. "summaryId": dataInfo.summaryId,
  247. "modifyNum": 'edit',
  248. };
  249. if(dataInfo.selectType === 'editConsumable'){
  250. postData.consumableList = [
  251. {
  252. "consumablesId": dataInfo.selectData.consumableId,
  253. "consumablesNum": dataInfo.evtNumber,
  254. }
  255. ];
  256. }else if(dataInfo.selectType === 'editWorkHourManagement'){
  257. postData.workHourManagementList = [
  258. {
  259. "workHourId": dataInfo.selectData.id,
  260. "workHourNum": dataInfo.evtNumber,
  261. }
  262. ];
  263. }
  264. api_addSummaryDoc(postData).then(res => {
  265. uni.hideLoading();
  266. if(res.status == 200){
  267. uni.showToast({
  268. icon: 'none',
  269. title: '修改数量成功',
  270. mask: true,
  271. });
  272. getSummaryList();
  273. }else{
  274. uni.showToast({
  275. icon: 'none',
  276. title: res.msg || '请求数据失败!'
  277. });
  278. }
  279. })
  280. }
  281. // 移除耗材/工时
  282. function removeSummaryDoc(){
  283. uni.showLoading({
  284. title: "加载中",
  285. mask: true,
  286. });
  287. let postData = {
  288. "summaryId": dataInfo.summaryId,
  289. "remove": 'remove',
  290. };
  291. if(dataInfo.selectType === 'editConsumable'){
  292. postData.consumableList = [
  293. {
  294. "consumablesId": dataInfo.selectData.consumableId,
  295. "consumablesNum": dataInfo.evtNumber,
  296. }
  297. ];
  298. }else if(dataInfo.selectType === 'editWorkHourManagement'){
  299. postData.workHourManagementList = [
  300. {
  301. "workHourId": dataInfo.selectData.id,
  302. "workHourNum": dataInfo.evtNumber,
  303. }
  304. ];
  305. }
  306. api_addSummaryDoc(postData).then(res => {
  307. uni.hideLoading();
  308. if(res.status == 200){
  309. uni.showToast({
  310. icon: 'none',
  311. title: '移除成功',
  312. mask: true,
  313. });
  314. getSummaryList();
  315. }else{
  316. uni.showToast({
  317. icon: 'none',
  318. title: res.msg || '请求数据失败!'
  319. });
  320. }
  321. })
  322. }
  323. // 重置
  324. function reset(){
  325. dataInfo.repairTypeList = []; //延期原因列表
  326. dataInfo.groupId = undefined; //延期原因ID
  327. dataInfo.userIdList = []; //延期天数列表
  328. dataInfo.userIdId = undefined; //延期天数ID
  329. dataInfo.deferralRemark = '';//延期说明
  330. dataInfo.summaryObj = {
  331. consumableList: [],//耗材列表
  332. workHourManagementList: [],//工时列表
  333. };//汇总单信息
  334. dataInfo.summaryId = undefined;//汇总单Id
  335. dataInfo.isNumber = false;//修改数量弹窗
  336. dataInfo.evtNumber = 1;//弹窗返回的数量
  337. dataInfo.selectData = {};//选择的对象
  338. dataInfo.selectType = {};//选择的对象类型
  339. dataInfo.handleDescription = '';//解决方案
  340. dataInfo.handleCategory = undefined;//处理方式
  341. dataInfo.handleCategoryList = [];//处理方式列表
  342. dataInfo.closecode = undefined;//关闭代码
  343. dataInfo.closecodeList = [];//关闭代码列表
  344. dataInfo.handlerImgList = [];//处理图片列表
  345. dataInfo.category = {};//故障现象
  346. dataInfo.synergetic = [];//协同人员
  347. }
  348. // 初始化表单
  349. function initForm(){
  350. if(dataInfo.tabActiveValue === 'direct'){
  351. getHandleCategorys();
  352. getClosecodes();
  353. }else if(dataInfo.tabActiveValue === 'assign'){
  354. getGroups();
  355. }
  356. }
  357. // 点击tab
  358. function clickTab(tabValue){
  359. if(dataInfo.tabActiveValue == tabValue){
  360. return;
  361. }
  362. dataInfo.tabActiveValue = tabValue;
  363. isSubmit.value = false;
  364. reset();
  365. dataInfo.category = dataInfo.incidentData.category || {};
  366. dataInfo.synergetic = dataInfo.incidentData.synergetic || [];
  367. initForm();
  368. }
  369. // 选择工作组
  370. function changeGroup(){
  371. dataInfo.userId = undefined;
  372. dataInfo.userList = [];
  373. getUsers();
  374. }
  375. // 选择是否转派到人
  376. function changeIsAssignUser(){
  377. dataInfo.userId = undefined;
  378. }
  379. // 获取工作组列表
  380. function getGroups(){
  381. uni.showLoading({
  382. title: "加载中",
  383. mask: true,
  384. });
  385. let postData = {
  386. "idx": 0,
  387. "sum": 9999,
  388. "group": {
  389. "selectType": "nouser"
  390. }
  391. };
  392. api_group(postData).then(res => {
  393. uni.hideLoading();
  394. if(res.status == 200){
  395. res.list = res.list || [];
  396. dataInfo.groupList = res.list.map(v => ({
  397. text: v.groupName,
  398. value: v.id,
  399. }));
  400. }else{
  401. uni.showToast({
  402. icon: 'none',
  403. title: res.msg || '请求数据失败!'
  404. });
  405. }
  406. })
  407. }
  408. // 获取用户列表
  409. function getUsers(){
  410. uni.showLoading({
  411. title: "加载中",
  412. mask: true,
  413. });
  414. let postData = {
  415. "idx": 0,
  416. "sum": 9999,
  417. "user": {
  418. "groupdata":{
  419. "id": dataInfo.groupId,
  420. },
  421. "roledata": {
  422. "rolecode": "first-line support"
  423. },
  424. "selectType": "1",
  425. "selectDetails": 1,
  426. "simple": true,
  427. "engineer": 1
  428. }
  429. };
  430. api_user(postData).then(res => {
  431. uni.hideLoading();
  432. if(res.status == 200){
  433. res.list = res.list || [];
  434. dataInfo.userList = res.list.map(v => ({
  435. text: v.name,
  436. value: v.id,
  437. }));
  438. }else{
  439. uni.showToast({
  440. icon: 'none',
  441. title: res.msg || '请求数据失败!'
  442. });
  443. }
  444. })
  445. }
  446. // 获取处理方式列表
  447. function getHandleCategorys(){
  448. uni.showLoading({
  449. title: "加载中",
  450. mask: true,
  451. });
  452. let postData = {
  453. "key": 'incident_handleCategory',
  454. "type": "list",
  455. };
  456. api_getDictionary(postData).then(res => {
  457. uni.hideLoading();
  458. res = res || [];
  459. dataInfo.handleCategoryList = res.map(v => ({
  460. text: v.name,
  461. value: v.id,
  462. key: v.value,
  463. }));
  464. if(!dataInfo.handleCategory){
  465. let handleCategory = dataInfo.handleCategoryList.find(v => v.key == 'SUPPORT');
  466. dataInfo.handleCategory = handleCategory ? handleCategory.value : undefined;
  467. }
  468. })
  469. }
  470. // 获取关闭代码列表
  471. function getClosecodes(){
  472. uni.showLoading({
  473. title: "加载中",
  474. mask: true,
  475. });
  476. let postData = {
  477. "key": 'incident_closecode',
  478. "type": "list",
  479. };
  480. api_getDictionary(postData).then(res => {
  481. uni.hideLoading();
  482. res = res || [];
  483. dataInfo.closecodeList = res.map(v => ({
  484. text: v.name,
  485. value: v.id,
  486. key: v.value,
  487. }));
  488. if(!dataInfo.closecode){
  489. let closecode = dataInfo.closecodeList.find(v => v.key == '060');
  490. dataInfo.closecode = closecode ? closecode.value : undefined;
  491. }
  492. })
  493. }
  494. // 添加耗材
  495. function addConsumable(){
  496. uni.navigateTo({
  497. url: `/pages/consumableList/consumableList?incidentId=${dataInfo.incidentId}&summaryId=${dataInfo.summaryId}`
  498. })
  499. }
  500. // 添加工时
  501. function addWorkHourManagement(){
  502. uni.navigateTo({
  503. url: `/pages/workHourManagementOne/workHourManagementOne?incidentId=${dataInfo.incidentId}&summaryId=${dataInfo.summaryId}`
  504. })
  505. }
  506. // 提交
  507. function submit(){
  508. isSubmit.value = true;
  509. if(dataInfo.tabActiveValue === 'direct'){
  510. submitHandler();
  511. }else if(dataInfo.tabActiveValue === 'assign'){
  512. submitAssign();
  513. }
  514. }
  515. // 处理提交事件
  516. function handlerOrder(){
  517. let postData = {
  518. incident: dataInfo.incidentData,
  519. }
  520. postData.incident.handleDescription = dataInfo.handleDescription;
  521. postData.incident.handleCategory = {id: dataInfo.handleCategory};
  522. postData.incident.closecode = {id: dataInfo.closecode};
  523. postData.incident.category = dataInfo.category;
  524. postData.incident.synergetic = dataInfo.synergetic;
  525. return api_incidentTask('accept', postData);
  526. }
  527. // 派单提交事件
  528. function assignOrder(){
  529. let postData = {
  530. incident: dataInfo.incidentData,
  531. }
  532. if(dataInfo.userId){
  533. // 派人
  534. postData.incident.assignee = dataInfo.userId;
  535. } else {
  536. // 派组
  537. postData.incident.candidateGroups = dataInfo.groupId;
  538. }
  539. return api_incidentTask('accept', postData);
  540. }
  541. // 处理图片
  542. function handlerOrderImg(imgObj){
  543. return uploadFile(imgObj, 'incident', dataInfo.incidentId)
  544. }
  545. // 报修图片
  546. function repairOrderImg(imgObj){
  547. return uploadFile(imgObj, 'wechatRequesterIncident', dataInfo.incidentId)
  548. }
  549. // 处理提交
  550. function submitHandler(){
  551. console.log(dataInfo);
  552. if(!dataInfo.handleDescription.trim() && dataInfo.category.hasSimple != 1){
  553. uni.showToast({
  554. icon: 'none',
  555. title: '请填写解决方案'
  556. });
  557. return;
  558. }
  559. if(!dataInfo.category.id && dataInfo.category.hasSimple != 1){
  560. uni.showToast({
  561. icon: 'none',
  562. title: '请选择故障现象'
  563. });
  564. return;
  565. }
  566. if(!dataInfo.handleCategory){
  567. uni.showToast({
  568. icon: 'none',
  569. title: '请选择处理方式'
  570. });
  571. return;
  572. }
  573. if(!dataInfo.closecode && dataInfo.category.hasSimple != 1){
  574. uni.showToast({
  575. icon: 'none',
  576. title: '请选择关闭代码'
  577. });
  578. return;
  579. }
  580. if(!dataInfo.incidentData.duty){
  581. uni.showToast({
  582. icon: 'none',
  583. title: '您选择的故障现象没有设置责任科室'
  584. });
  585. return;
  586. }
  587. console.log(dataInfo.handlerImgList)
  588. uni.showLoading({
  589. title: "加载中",
  590. mask: true,
  591. });
  592. if(dataInfo.handlerImgList.length){
  593. // 有图片
  594. let handlerOrder$ = handlerOrder();
  595. let requestList = [handlerOrder$];
  596. Promise.all(requestList).then(resList => {
  597. uni.hideLoading();
  598. console.log(resList);
  599. if(resList[0].state == 200){
  600. dataInfo.incidentId = resList[0].data.id;
  601. handlerImgRef.value.upload();
  602. }else{
  603. uni.showToast({
  604. icon: 'none',
  605. title: resList[0].msg || '请求数据失败!'
  606. });
  607. }
  608. })
  609. }else{
  610. // 没有图片
  611. let handlerOrder$ = handlerOrder();
  612. let requestList = [handlerOrder$];
  613. Promise.all(requestList).then(resList => {
  614. uni.hideLoading();
  615. console.log(resList);
  616. if(resList[0].state == 200){
  617. uni.showToast({
  618. icon: 'none',
  619. title: '建单成功',
  620. mask: true,
  621. });
  622. setTimeout(() => {
  623. uni.reLaunch({
  624. url: '/pages/incidentList/incidentList',
  625. })
  626. }, 1500)
  627. }else{
  628. uni.showToast({
  629. icon: 'none',
  630. title: resList[0].msg || '请求数据失败!'
  631. });
  632. }
  633. })
  634. }
  635. }
  636. // 派单提交
  637. function submitAssign(){
  638. if(!dataInfo.groupId){
  639. uni.showToast({
  640. icon: 'none',
  641. title: '请选择工作组'
  642. });
  643. return;
  644. }
  645. if(dataInfo.isAssignUser == 1 && !dataInfo.userId){
  646. uni.showToast({
  647. icon: 'none',
  648. title: '请选择指派对象'
  649. });
  650. return;
  651. }
  652. if(!dataInfo.incidentData.duty){
  653. uni.showToast({
  654. icon: 'none',
  655. title: '您选择的故障现象没有设置责任科室'
  656. });
  657. return;
  658. }
  659. uni.showLoading({
  660. title: "加载中",
  661. mask: true,
  662. });
  663. if(dataInfo.handlerImgList.length){
  664. // 有图片
  665. let assignOrder$ = assignOrder();
  666. let requestList = [assignOrder$];
  667. Promise.all(requestList).then(resList => {
  668. uni.hideLoading();
  669. console.log(resList);
  670. if(resList[0].state == 200){
  671. dataInfo.incidentId = resList[0].data.id;
  672. handlerImgRef.value.upload();
  673. }else{
  674. uni.showToast({
  675. icon: 'none',
  676. title: resList[0].msg || '请求数据失败!'
  677. });
  678. }
  679. })
  680. }else{
  681. // 没有图片
  682. let assignOrder$ = assignOrder();
  683. let requestList = [assignOrder$];
  684. Promise.all(requestList).then(resList => {
  685. uni.hideLoading();
  686. console.log(resList);
  687. if(resList[0].state == 200){
  688. uni.showToast({
  689. icon: 'none',
  690. title: '建单成功',
  691. mask: true,
  692. });
  693. setTimeout(() => {
  694. uni.reLaunch({
  695. url: '/pages/incidentList/incidentList',
  696. })
  697. }, 1500)
  698. }else{
  699. uni.showToast({
  700. icon: 'none',
  701. title: resList[0].msg || '请求数据失败!'
  702. });
  703. }
  704. })
  705. }
  706. }
  707. onLoad((option) => {
  708. // 跳转页面选择了选项
  709. if(handlerStore.handler.data){
  710. Object.assign(dataInfo, handlerStore.handler.data);
  711. console.log(dataInfo)
  712. handlerStore.clearHandlerData();
  713. }else if(incidentBuildStore.incidentBuild.data){
  714. // 初始化
  715. dataInfo.incidentData = incidentBuildStore.incidentBuild.data || {};
  716. if(dataInfo.incidentData.category){
  717. dataInfo.category = dataInfo.incidentData.category;
  718. }
  719. if(dataInfo.incidentData.priority){
  720. dataInfo.incidentData.priority = { id: dataInfo.incidentData.priority };
  721. }
  722. if(dataInfo.incidentData.source){
  723. dataInfo.incidentData.source = { id: dataInfo.incidentData.source };
  724. }
  725. if(dataInfo.incidentData.requester){
  726. dataInfo.incidentData.requester = { id: dataInfo.incidentData.requester }
  727. }
  728. }
  729. dataInfo.tabActiveValue = dataInfo.tabs[0].value;
  730. initForm()
  731. })
  732. </script>
  733. <style lang="scss" scoped>
  734. .handler{
  735. height: 100%;
  736. display: flex;
  737. flex-direction: column;
  738. justify-content: space-between;
  739. .head{
  740. height: 88rpx;
  741. display: flex;
  742. position: fixed;
  743. z-index: 99;
  744. width: 100%;
  745. background-color: #fff;
  746. font-size: 30rpx;
  747. .tab{
  748. flex: 1;
  749. display: flex;
  750. justify-content: center;
  751. align-items: center;
  752. border-bottom: 4rpx solid transparent;
  753. &.active{
  754. color: $uni-primary;
  755. border-color: $uni-primary;
  756. }
  757. }
  758. }
  759. .body{
  760. margin-top: 88rpx;
  761. box-sizing: border-box;
  762. flex: 1;
  763. min-height: 0;
  764. &.bg{
  765. background-color: #F7F7F7;
  766. }
  767. .summaryItem{
  768. &:first-of-type{
  769. .summaryItem_head{
  770. border-bottom: 1rpx solid #DDDDDD;
  771. }
  772. }
  773. .summary_total{
  774. padding: 20rpx 0;
  775. display: flex;
  776. justify-content: center;
  777. align-items: center;
  778. }
  779. .summaryItem_head{
  780. padding: 24rpx;
  781. font-size: 26rpx;
  782. color: #3A3A3A;
  783. }
  784. .summaryItem_body{
  785. font-size: 30rpx;
  786. background-color: #fff;
  787. .summaryItem_bodyItem{
  788. padding: 24rpx;
  789. border-bottom: 1rpx solid #DDDDDD;
  790. .summaryItem_bodyItem_top{
  791. display: flex;
  792. justify-content: space-between;
  793. align-items: center;
  794. .value{
  795. padding-left: 48rpx;
  796. flex-shrink: 0;
  797. }
  798. }
  799. .summaryItem_bodyItem_bottom{
  800. margin-top: 24rpx;
  801. display: flex;
  802. justify-content: space-between;
  803. align-items: center;
  804. .name{
  805. text-align: right;
  806. flex: 1;
  807. }
  808. .value{
  809. width: 240rpx;
  810. text-align: right;
  811. padding-left: 48rpx;
  812. flex-shrink: 0;
  813. }
  814. }
  815. }
  816. }
  817. .summaryItem_foot{
  818. font-size: 30rpx;
  819. background-color: #fff;
  820. &.total{
  821. margin-top: 24rpx;
  822. }
  823. .summaryItem_foot_total{
  824. padding: 24rpx 0;
  825. display: flex;
  826. justify-content: center;
  827. align-items: center;
  828. }
  829. .summaryItem_foot_add{
  830. border-top: 1rpx solid #DDDDDD;
  831. padding: 24rpx 0;
  832. display: flex;
  833. justify-content: center;
  834. align-items: center;
  835. .newicon-icon-test{
  836. font-size: 30rpx;
  837. font-weight: bold;
  838. }
  839. }
  840. }
  841. }
  842. .form_item_column{
  843. padding-top: 24rpx;
  844. min-height: 86rpx;
  845. .form_item{
  846. padding-top: 0;
  847. min-height: auto;
  848. }
  849. }
  850. .form_item{
  851. display: flex;
  852. align-items: center;
  853. padding-top: 24rpx;
  854. min-height: 86rpx;
  855. &.column{
  856. height: auto;
  857. flex-direction: column;
  858. align-items: flex-start;
  859. .title{
  860. margin-right: 0;
  861. }
  862. .value{
  863. margin-top: 10rpx;
  864. padding-left: 20rpx;
  865. box-sizing: border-box;
  866. }
  867. .tips{
  868. padding: 24rpx;
  869. text-align: center;
  870. font-size: 22rpx;
  871. color: #909399;
  872. width: 100%;
  873. box-sizing: border-box;
  874. }
  875. }
  876. .title{
  877. font-size: 26rpx;
  878. display: flex;
  879. align-items: center;
  880. margin-right: 12rpx;
  881. flex-shrink: 0;
  882. &.select{
  883. width: calc(5em + 20rpx);
  884. }
  885. }
  886. .value{
  887. width: 100%;
  888. &.category{
  889. width: 100%;
  890. display: flex;
  891. justify-content: space-between;
  892. align-items: center;
  893. .categoryName{
  894. font-size: 26rpx;
  895. color: #555;
  896. flex: 1;
  897. }
  898. .newicon-weibiaoti2010104{
  899. color: $uni-primary;
  900. margin-left: 24rpx;
  901. }
  902. }
  903. .imgTips{
  904. color: #909399;
  905. font-size: 22rpx;
  906. }
  907. }
  908. .synergeticNames{
  909. font-size: 26rpx;
  910. margin-right: 24rpx;
  911. }
  912. .synergeticAdd{
  913. flex-shrink: 0;
  914. }
  915. }
  916. }
  917. }
  918. </style>