handler.vue 29 KB

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