rapidRepNext.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953
  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. <view class="body view-body page_padding">
  9. <!-- 科内报修 -->
  10. <template v-if="dataInfo.tabActiveValue === 'doing'">
  11. <view class="form_item" v-if="hospitalModel.valueconfig!=1">
  12. <view class="title select"><text class="required newicon newicon-bitian"></text>院区:</view>
  13. <uni-data-picker class="value" placeholder="请选择院区"
  14. v-model="dataInfo.branch" :localdata="branchData" @change="doingDeptChange"
  15. :clear-icon="false" :class="{formRed: isSubmit && !dataInfo.branch}">
  16. </uni-data-picker>
  17. </view>
  18. <!-- <view class="form_item">
  19. <view class="title select"><text class="required newicon newicon-bitian"></text>报修科室:</view>
  20. <uni-data-picker class="value" placeholder="请选择报修科室"
  21. v-model="dataInfo.department" :localdata="dataInfo.repairTypeList"
  22. :clear-icon="false" :class="{formRed: isSubmit && !dataInfo.department}">
  23. </uni-data-picker>
  24. </view> -->
  25. <view class="form_item">
  26. <view class="title select"><text class="required newicon newicon-bitian"></text>报修科室:</view>
  27. <view class="value category" @click="selectDepartment">
  28. <text class="categoryName ellipsis-multiline">{{dataInfo.departmentName}}</text>
  29. <text class="newicon newicon-weibiaoti2010104"></text>
  30. </view>
  31. </view>
  32. <view class="candidate" v-if="itemUser">
  33. <view class="candidate-item" v-for="(item, index) in itemUser.commonDeptDTO" :key="item" @click="itemCandidate(item)">{{item.dept}}</view>
  34. </view>
  35. <view class="form_item column">
  36. <view class="title"><text class="required newicon newicon-bitian"></text>详细地址:</view>
  37. <uni-easyinput class="value" type="textarea" v-model="dataInfo.address" placeholder="请输入详细地址" :class="{formRed: isSubmit && !dataInfo.address }" />
  38. </view>
  39. <view class="candidate">
  40. <view class="candidate-item" v-for="item in dataInfo.addressList" :key="item.id" @click="itemAddres(item)">{{item.name}}</view>
  41. </view>
  42. <view class="form_item" :class="{formRed: isSubmit && !dataInfo.contacts}">
  43. <view class="title select"><text class="required newicon newicon-bitian"></text>联系人:</view>
  44. <input class="item-input" placeholder="请输入联系人" v-model="dataInfo.contacts" />
  45. </view>
  46. <view class="form_item" :class="{formRed: isSubmit && !dataInfo.contactsInformation}">
  47. <view class="title select"><text class="required newicon newicon-bitian"></text>联系电话:</view>
  48. <input class="item-input" placeholder="请输入联系电话" v-model="dataInfo.contactsInformation"/>
  49. </view>
  50. </template>
  51. <!-- 公共报修 -->
  52. <template v-if="dataInfo.tabActiveValue === 'overtime'">
  53. <view class="form_item" v-if="hospitalModel.valueconfig!=1">
  54. <view class="title select"><text class="required newicon newicon-bitian"></text>院区:</view>
  55. <uni-data-picker class="value" placeholder="请选择院区" @change="overDeptChange"
  56. v-model="dataInfo.branch" :localdata="branchData"
  57. :clear-icon="false" :class="{formRed: isSubmit && !dataInfo.branch}">
  58. </uni-data-picker>
  59. </view>
  60. <view class="form_item">
  61. <view class="title select"><text class="required newicon newicon-bitian"></text>楼栋:</view>
  62. <uni-data-picker class="value" placeholder="请选择楼栋" @change="areaChange"
  63. v-model="dataInfo.areaId" :localdata="dataInfo.buildingTypeList"
  64. :clear-icon="false" :class="{formRed: isSubmit && !dataInfo.areaId}">
  65. </uni-data-picker>
  66. </view>
  67. <view class="form_item">
  68. <view class="title select"><text class="required newicon newicon-bitian"></text>楼层:</view>
  69. <uni-data-picker class="value" placeholder="请选择楼层"
  70. v-model="dataInfo.placeId" :localdata="dataInfo.placeTypeList"
  71. :clear-icon="false" :class="{formRed: isSubmit && !dataInfo.placeId}">
  72. </uni-data-picker>
  73. </view>
  74. <view class="form_item column">
  75. <view class="title"><text class="required newicon newicon-bitian"></text>详细地址:</view>
  76. <uni-easyinput class="value" type="textarea" v-model="dataInfo.address" placeholder="请输入详细地址" :class="{formRed: isSubmit && !dataInfo.address}" />
  77. </view>
  78. <view class="form_item" :class="{formRed: isSubmit && !dataInfo.contacts}">
  79. <view class="title select"><text class="required newicon newicon-bitian"></text>联系人:</view>
  80. <input class="item-input value" placeholder="请输入联系人" v-model="dataInfo.contacts"/>
  81. </view>
  82. <view class="form_item" :class="{formRed: isSubmit && !dataInfo.contactsInformation}">
  83. <view class="title select"><text class="required newicon newicon-bitian"></text>联系电话:</view>
  84. <input class="item-input value" placeholder="请输入联系电话" v-model="dataInfo.contactsInformation"/>
  85. </view>
  86. </template>
  87. </view>
  88. <view class="foot_common_btns">
  89. <button @click="goBackOrToList" type="default" class="primaryButton btn">上一步</button>
  90. <button @click="submit" type="default" class="primaryButton btn">提交</button>
  91. </view>
  92. <NumberModal v-if="dataInfo.isNumber" @cancelEmit="cancelNumber" @confirmEmit="conformNumber" @removeEmit="removeNumber" :selectData="dataInfo.selectData" :selectType="dataInfo.selectType" :evtNumber="dataInfo.evtNumber" showRemove></NumberModal>
  93. </view>
  94. </template>
  95. <script setup>
  96. import { ref, reactive, computed } from 'vue'
  97. import NumberModal from '@/components/NumberModal.vue';
  98. import { onLoad } from '@dcloudio/uni-app'
  99. import { generateNumberArray } from '@/utils/index.js'
  100. import { api_getDictionary, api_sj,api_request, getFetchDataList, api_place, api_getSolution, api_area, api_user, api_incidentTask, api_branch, api_dutyDepartment, api_department, api_querySummaryDoc, api_addSummaryDoc, api_departmentDetail } from "@/http/api.js"
  101. import { defaultColor } from '@/static/js/theme.js'
  102. import { useSetTitle } from '@/share/useSetTitle.js'
  103. import { useMakePhoneCall } from '@/share/useMakePhoneCall.js'
  104. import { useUploadFile } from '@/share/useUploadFile.js'
  105. import { useGoBack } from '@/share/useGoBack.js'
  106. import { useLoginUserStore } from '@/stores/loginUser'
  107. import { useHandlerStore } from '@/stores/handler'
  108. import { rapidRepNextStore } from '@/stores/rapidRepNext'
  109. useSetTitle();
  110. const loginUserStore = useLoginUserStore();
  111. const rapidNextStore = rapidRepNextStore();
  112. const { makePhoneCall } = useMakePhoneCall();
  113. const { uploadFile } = useUploadFile();
  114. const { goBack } = useGoBack();
  115. // 主题颜色
  116. const primaryColor = ref(defaultColor)
  117. // 备用机选项
  118. const machineData = ref([
  119. {
  120. text:'是',
  121. value:1
  122. },
  123. {
  124. text:'否',
  125. value:0
  126. },
  127. ])
  128. const isDept = ref({})
  129. const isRepair = ref({})
  130. const hospitalModel = ref({})
  131. const branchData = ref([])
  132. const candidateData = ref(loginUserStore.loginUser.user)
  133. const repairIncident = ref(null)
  134. // 数据
  135. const dataInfo = reactive({
  136. tabs: [
  137. {id: 5, name: '科内报修', value: 'doing', num: ''},
  138. {id: 6, name: '公共报修', value: 'overtime', num: ''},
  139. ],
  140. tabActiveValue: 'doing',//当前选择的tab
  141. incidentId: undefined,//事件ID
  142. incidentData: {
  143. repairIncidentType:{
  144. id:''
  145. },
  146. department:{
  147. id:''
  148. }
  149. },//事件对象
  150. repairTypeList:[],//科室数据
  151. buildingTypeList:[],//楼栋数据
  152. placeTypeList:[],//楼层数据
  153. department:'',//报修科室id
  154. departmentName:'',//报修科室
  155. address:'',//详细地址
  156. contacts:'',//联系人
  157. contactsInformation:'',//手机
  158. areaId:'',//楼栋
  159. placeId:'',//楼层
  160. branch:'', //院区
  161. addressList: [], //科室地点
  162. })
  163. // 故障处理用是否提供备用机
  164. const newProvideBackupMachine = ref(0)
  165. // 知识库id
  166. const solutionId = ref(null)
  167. // 是否提交
  168. const isSubmit = ref(false)
  169. // 处理图片
  170. const handlerImgRef = ref(null)
  171. // 用户信息
  172. const itemUser = ref(null)
  173. // 是否进入汇总单
  174. const isInSummaryOrder = computed(() => {
  175. return dataInfo.tabActiveValue === 'doing' && dataInfo.incidentData.duty && dataInfo.incidentData.duty.addSummary == 1 && (dataInfo.incidentData.handlingPersonnelUser.id == loginUserStore.loginUser.user.id);
  176. })
  177. // 上一步或者返回列表
  178. function goBackOrToList(){
  179. rapidNextStore.setRapidRepNext(dataInfo);
  180. // uni.setStorageSync('rapidRepNext',JSON.stringify(dataInfo))
  181. uni.navigateTo({
  182. url: `/pages/repair/rapidRep`
  183. })
  184. }
  185. // 重置
  186. function reset(){
  187. // dataInfo.department = '',//报修科室
  188. dataInfo.address = '',//详细地址
  189. // dataInfo.contacts = '',//联系人
  190. // dataInfo.contactsInformation = ''//手机
  191. dataInfo.areaId = ''//楼栋
  192. dataInfo.placeId = '' //院区
  193. dataInfo.placeTypeList = []
  194. }
  195. // 初始化表单
  196. function initForm(){
  197. if(dataInfo.tabActiveValue === 'doing'){
  198. // getRepairTypes()
  199. getUserInfo()
  200. }else if(dataInfo.tabActiveValue === 'overtime'){
  201. getbuildingList()
  202. }
  203. }
  204. function itemCandidate(item){
  205. // console.log(55,index)
  206. // let arr = loginUserStore.loginUser.user.commonDept.split(',')
  207. // console.log(66,arr)
  208. dataInfo.department = item.id
  209. dataInfo.departmentName = item.dept
  210. }
  211. function itemAddres(item){
  212. dataInfo.address = item.name
  213. }
  214. function getUserInfo(){
  215. let user = loginUserStore.loginUser.user
  216. let postData = {
  217. idx: 0,
  218. sum: 999,
  219. user: {
  220. hospital:{
  221. id:user.currentHospital.id
  222. },
  223. name: user.name,
  224. }
  225. }
  226. api_user(postData).then(res => {
  227. if(res.status == 200){
  228. let user = loginUserStore.loginUser.user
  229. let rapidRepNext = rapidNextStore.rapidRepNext.data;
  230. if(rapidRepNext.branch && rapidRepNext.department){
  231. let data = rapidRepNext
  232. if(data){
  233. dataInfo.departmentName = data.departmentName
  234. dataInfo.department = data.department
  235. }
  236. }else{
  237. dataInfo.departmentName = res.list[0].dept.dept
  238. dataInfo.department = res.list[0].dept.id
  239. }
  240. itemUser.value = res.list.find(i=>i.id==user.id)
  241. }else{
  242. uni.showToast({
  243. icon: 'none',
  244. title: res.msg || '请求数据失败!'
  245. });
  246. }
  247. })
  248. }
  249. // 点击tab
  250. function clickTab(tabValue){
  251. if(dataInfo.tabActiveValue == tabValue){
  252. return;
  253. }
  254. dataInfo.tabActiveValue = tabValue;
  255. isSubmit.value = false;
  256. reset();
  257. if(tabValue=='doing'){
  258. let user = loginUserStore.loginUser.user
  259. if(user){
  260. dataInfo.department = user.dept.id
  261. }
  262. }else{
  263. dataInfo.department = ''
  264. }
  265. dataInfo.category = dataInfo.incidentData.category || {};
  266. dataInfo.synergetic = dataInfo.incidentData.synergetic || [];
  267. newProvideBackupMachine.value = dataInfo.incidentData.provideBackupMachine
  268. initForm();
  269. }
  270. // 获取事件详情
  271. function getIncidentDetail(){
  272. let user = loginUserStore.loginUser.user
  273. let rapidRepNext = rapidNextStore.rapidRepNext.data;
  274. if(rapidRepNext.branch && rapidRepNext.department){
  275. console.log(456, rapidRepNext.branch)
  276. let data = rapidRepNext
  277. if(data){
  278. dataInfo.department = data.department//报修科室
  279. dataInfo.departmentName = data.departmentName//报修科室
  280. dataInfo.address = data.address//详细地址
  281. dataInfo.contacts = data.contacts//联系人
  282. dataInfo.contactsInformation = data.contactsInformation//手机
  283. dataInfo.branch = Number(data.branch)//院区
  284. dataInfo.areaId = data.areaId//楼栋
  285. // getRepairTypes()
  286. }
  287. }else if(user){
  288. console.log(8799, user)
  289. if(user.currentHospital.parent){
  290. dataInfo.branch = user.currentHospital.parent.id
  291. }else{
  292. dataInfo.branch = user.currentHospital.id
  293. }
  294. dataInfo.contacts = user.name
  295. dataInfo.contactsInformation = user.phone
  296. dataInfo.department = user.dept.id
  297. dataInfo.departmentName = user.dept.dept
  298. // getRepairTypes()
  299. }
  300. if(uni.getStorageSync('repairData')){
  301. let data = JSON.parse(uni.getStorageSync('repairData'))
  302. if(data){
  303. dataInfo.description = data.description
  304. dataInfo.handlerImgList = data.handlerImgList
  305. dataInfo.serverId = data.serverId
  306. dataInfo.assetId = data.assetId
  307. }
  308. }
  309. if(uni.getStorageSync('sysData')){
  310. let data = JSON.parse(uni.getStorageSync('sysData'))
  311. isDept.value = data.find(i=>i.keyconfig=='deptRepair')
  312. isRepair.value = data.find(i=>i.keyconfig=='publicRepair')
  313. hospitalModel.value = data.find(i=>i.keyconfig=='hospitalModel')
  314. console.log('isDept', isDept.value, isDept.value.valueconfig == 1)
  315. console.log('isRepair', isRepair.value, isRepair.value.valueconfig == 1)
  316. if((isDept.value.valueconfig==1 && isRepair.value.valueconfig==1) || (isDept.value.valueconfig==0 && isRepair.value.valueconfig==0) || (!isDept.value.valueconfig && !isRepair.value.valueconfig)){
  317. dataInfo.tabs = [
  318. {id: 5, name: '科内报修', value: 'doing', num: ''},
  319. {id: 6, name: '公共报修', value: 'overtime', num: ''},
  320. ]
  321. dataInfo.tabActiveValue = 'doing'
  322. }else if(isDept.value.valueconfig==1){
  323. dataInfo.tabs = [
  324. {id: 5, name: '科内报修', value: 'doing', num: ''},
  325. ]
  326. dataInfo.tabActiveValue = 'doing'
  327. }else if(isRepair.value.valueconfig==1){
  328. dataInfo.tabs = [
  329. {id: 6, name: '公共报修', value: 'overtime', num: ''},
  330. ]
  331. dataInfo.tabActiveValue = 'overtime'
  332. getbuildingList()
  333. }
  334. }
  335. let postData = {
  336. "key": 'repair_incident_type',
  337. "type": "list",
  338. };
  339. api_getDictionary(postData).then(res => {
  340. res = res || [];
  341. repairIncident.value = res
  342. })
  343. getBranch()
  344. }
  345. // 获取院区列表
  346. function getBranch(){
  347. let arr = loginUserStore.loginUser.hospital.filter(i=>i.parent==undefined)
  348. branchData.value = arr.map(v => ({
  349. text: v.hosName,
  350. value: v.id,
  351. }));
  352. }
  353. // 科内报修选择院区
  354. function doingDeptChange(){
  355. dataInfo.department = ''
  356. dataInfo.departmentName = ''
  357. // getRepairTypes()
  358. }
  359. // 公区报修选择院区
  360. function overDeptChange(){
  361. getbuildingList()
  362. }
  363. // 跳转到搜索报修科室
  364. function selectDepartment(){
  365. // uni.setStorageSync('rapidRepNext',JSON.stringify(dataInfo))
  366. rapidNextStore.setRapidRepNext(dataInfo);
  367. uni.navigateTo({
  368. url: `/pages/searchDept/searchDept?type=repair&branchId=${dataInfo.branch}`
  369. })
  370. }
  371. // 获取报修科室列表
  372. function getRepairTypes(){
  373. uni.showLoading({
  374. title: "加载中",
  375. mask: true,
  376. });
  377. let postData = {
  378. department: {
  379. hospital: dataInfo.branch,
  380. },
  381. idx:0,
  382. sum:9999
  383. }
  384. api_department(postData).then(res => {
  385. uni.hideLoading();
  386. res = res.list || [];
  387. dataInfo.repairTypeList = res.map(v => ({
  388. text: v.dept,
  389. value: v.id,
  390. floor: v.floor
  391. }));
  392. let isDeptId = dataInfo.repairTypeList.filter(i=>i.value==dataInfo.department)
  393. if(isDeptId.length==0){
  394. dataInfo.department = ''
  395. }
  396. })
  397. }
  398. // 获取楼栋
  399. function getbuildingList(){
  400. uni.showLoading({
  401. title: "加载中",
  402. mask: true,
  403. });
  404. let postData = {
  405. idx: 0,
  406. sum: 9999,
  407. building:{
  408. hosId: dataInfo.branch,
  409. }
  410. };
  411. getFetchDataList("simple/data", "building", postData)
  412. .then((res) => {
  413. uni.hideLoading();
  414. res = res.list || [];
  415. dataInfo.buildingTypeList = res.map(v => ({
  416. text: v.buildingName,
  417. value: v.id
  418. }));
  419. });
  420. }
  421. // 获取科室地点
  422. function getAddressList(){
  423. uni.showLoading({
  424. title: "加载中",
  425. mask: true,
  426. });
  427. let postData = {
  428. idx: 0,
  429. sum: 10,
  430. qrCode:{
  431. deptId: dataInfo.department,
  432. }
  433. };
  434. getFetchDataList("simple/data", "qrCode", postData)
  435. .then((res) => {
  436. uni.hideLoading();
  437. dataInfo.addressList = res.list || [];
  438. });
  439. }
  440. function areaChange(e){
  441. getPlaceList(dataInfo.areaId)
  442. }
  443. // 获取楼层
  444. function getPlaceList(e){
  445. let postData = {
  446. idx: 0,
  447. sum: 9999,
  448. floor: {
  449. buildId:e,
  450. hosId:dataInfo.branch
  451. }
  452. };
  453. getFetchDataList("simple/data", "floor", postData)
  454. .then((res) => {
  455. uni.hideLoading();
  456. res = res.list || [];
  457. dataInfo.placeTypeList = res.map(v => ({
  458. text: v.floorName,
  459. value: v.id
  460. }));
  461. });
  462. }
  463. // 提交
  464. function submit(){
  465. isSubmit.value = true;
  466. submitHandler()
  467. }
  468. // 处理提交事件
  469. async function handlerOrder(){
  470. let postData = {
  471. incident: dataInfo.incidentData,
  472. serverId: ''
  473. }
  474. postData.incident.place = {}
  475. if(dataInfo.tabActiveValue === 'doing'){
  476. let data = repairIncident.value.find(i=>i.value=='dept')
  477. dataInfo.incidentData.repairIncidentType.id = data.id
  478. let result = await api_departmentDetail(dataInfo.department);
  479. let deptDTO = result.data || {};
  480. postData.incident.place.id = deptDTO.floor ? deptDTO.floor.id : undefined;
  481. }else if(dataInfo.tabActiveValue === 'overtime'){
  482. let data = repairIncident.value.find(i=>i.value=='public')
  483. dataInfo.incidentData.repairIncidentType.id = data.id
  484. postData.incident.place.id = dataInfo.placeId;
  485. }
  486. dataInfo.incidentData.department.id = dataInfo.department
  487. postData.incident.description = dataInfo.description;
  488. if(dataInfo.serverId){
  489. postData.serverId = dataInfo.serverId;
  490. }else{
  491. delete postData.serverId
  492. }
  493. postData.incident.assetId = dataInfo.assetId;
  494. postData.incident.houseNumber = dataInfo.address;
  495. postData.incident.contacts = dataInfo.contacts;
  496. postData.incident.contactsInformation = dataInfo.contactsInformation;
  497. postData.incident.hosId = dataInfo.branch;
  498. let repairsType = uni.getStorageSync('repairsType')
  499. // postData.incident.buildId = dataInfo.areaId; //areaId:楼栋
  500. // postData.incident.floorId = dataInfo.placeId;//placeId:楼层
  501. // buildId
  502. // floorId
  503. api_getDictionary({
  504. key: "incident_source",
  505. type: "list"
  506. }).then(res1=>{
  507. let incidentSourceList = res1 || [];
  508. let im = incidentSourceList.find(v => v.value === 'im');
  509. // api_sj().then(res2=>{
  510. // postData.incident.incidentsign = res2.data;
  511. postData.incident.source = im;
  512. postData.incident.fromWx = true;
  513. postData.incident.requester = loginUserStore.loginUser.user;
  514. postData.incident.acceptUser = loginUserStore.loginUser.user;
  515. postData.incident.deleteFlag = 0
  516. api_request(postData).then(res=>{
  517. if(res.state == 200){
  518. dataInfo.incidentId = res.data.id
  519. let handlerOrder$ = res.data;
  520. let requestList = [handlerOrder$];
  521. if(dataInfo.handlerImgList.length){ // 有图片
  522. dataInfo.handlerImgList.forEach(v => {
  523. let handlerOrderImg$ = handlerOrderImg(v);
  524. requestList.push(handlerOrderImg$);
  525. })
  526. console.log(9999,requestList);
  527. Promise.all(requestList).then(resList => {
  528. uni.hideLoading();
  529. console.log(9999,resList);
  530. // if(resList[0].state == 200){
  531. uni.showToast({
  532. icon: 'none',
  533. title: '报修成功',
  534. mask: true,
  535. });
  536. setTimeout(() => {
  537. rapidNextStore.setRapidRepNext('');
  538. // uni.setStorageSync('rapidRepNext','')
  539. uni.setStorageSync('repairData','')
  540. if(repairsType=='home'){
  541. uni.reLaunch({
  542. url: '/pages/repair/home',
  543. })
  544. }else{
  545. uni.navigateTo({
  546. url: `/pages/myRepair/myRepair?type=1`
  547. })
  548. }
  549. }, 1500)
  550. // }else{
  551. // uni.showToast({
  552. // icon: 'none',
  553. // title: resList[0].msg || '请求数据失败!'
  554. // });
  555. // }
  556. })
  557. }else{
  558. uni.showToast({
  559. icon: 'none',
  560. title: '报修成功',
  561. mask: true,
  562. });
  563. setTimeout(() => {
  564. rapidNextStore.setRapidRepNext('');
  565. // uni.setStorageSync('rapidRepNext','')
  566. uni.setStorageSync('repairData','')
  567. if(repairsType=='home'){
  568. uni.reLaunch({
  569. url: '/pages/repair/home',
  570. })
  571. }else{
  572. uni.navigateTo({
  573. url: `/pages/myRepair/myRepair?type=1`
  574. })
  575. }
  576. }, 1500)
  577. }
  578. }else{
  579. uni.showToast({
  580. icon: 'none',
  581. title: res.msg || '请求数据失败!'
  582. });
  583. }
  584. })
  585. // })
  586. })
  587. }
  588. // 处理图片
  589. function handlerOrderImg(imgObj){
  590. let allData = null
  591. if(imgObj.extname=='mp4' ||
  592. imgObj.extname=='avi' ||
  593. imgObj.extname=='mpeg' ||
  594. imgObj.extname=='wmv'){
  595. allData = uploadFile(imgObj, 'wechatIncidentVideo', dataInfo.incidentId)
  596. }else{
  597. allData = uploadFile(imgObj, 'wechatRequesterIncident', dataInfo.incidentId)
  598. }
  599. return allData
  600. }
  601. // 处理提交
  602. function submitHandler(){
  603. console.log(dataInfo);
  604. if(dataInfo.tabActiveValue=='doing'){
  605. if(dataInfo.department==''){
  606. uni.showToast({
  607. icon: 'none',
  608. title: '请选择报修科室'
  609. });
  610. return;
  611. }
  612. }else{
  613. if(dataInfo.branch==''){
  614. uni.showToast({
  615. icon: 'none',
  616. title: '请选择院区'
  617. });
  618. return;
  619. }
  620. if(dataInfo.areaId==''){
  621. uni.showToast({
  622. icon: 'none',
  623. title: '请选择楼栋'
  624. });
  625. return;
  626. }
  627. if(dataInfo.placeId==''){
  628. uni.showToast({
  629. icon: 'none',
  630. title: '请选择楼层'
  631. });
  632. return;
  633. }
  634. }
  635. if(dataInfo.address==''){
  636. uni.showToast({
  637. icon: 'none',
  638. title: '请输入详细地址'
  639. });
  640. return;
  641. }
  642. if(dataInfo.contacts==''){
  643. uni.showToast({
  644. icon: 'none',
  645. title: '请输入联系人'
  646. });
  647. return;
  648. }
  649. if(dataInfo.contactsInformation=='' || dataInfo.contactsInformation==undefined){
  650. uni.showToast({
  651. icon: 'none',
  652. title: '请输入联系电话'
  653. });
  654. return;
  655. }
  656. uni.showLoading({
  657. title: "加载中",
  658. mask: true,
  659. });
  660. handlerOrder()
  661. }
  662. // 获取文本内容
  663. function getHtml(html) {
  664. const tempDiv = document.createElement('div');
  665. tempDiv.innerHTML = html;
  666. return tempDiv.textContent || tempDiv.innerText || '';
  667. }
  668. onLoad((option) => {
  669. initForm()
  670. getIncidentDetail();
  671. getAddressList();
  672. })
  673. </script>
  674. <style lang="scss" scoped>
  675. .handler{
  676. height: 100%;
  677. display: flex;
  678. flex-direction: column;
  679. justify-content: space-between;
  680. .head{
  681. height: 88rpx;
  682. display: flex;
  683. position: fixed;
  684. z-index: 99;
  685. width: 100%;
  686. background-color: #fff;
  687. font-size: 30rpx;
  688. .tab{
  689. flex: 1;
  690. display: flex;
  691. justify-content: center;
  692. align-items: center;
  693. border-bottom: 4rpx solid transparent;
  694. &.active{
  695. color: $uni-primary;
  696. border-color: $uni-primary;
  697. }
  698. }
  699. }
  700. .body{
  701. margin-top: 88rpx;
  702. box-sizing: border-box;
  703. flex: 1;
  704. min-height: 0;
  705. &.bg{
  706. background-color: #F7F7F7;
  707. }
  708. .summaryItem{
  709. &:first-of-type{
  710. .summaryItem_head{
  711. border-bottom: 1rpx solid #DDDDDD;
  712. }
  713. }
  714. .summary_total{
  715. padding: 20rpx 0;
  716. display: flex;
  717. justify-content: center;
  718. align-items: center;
  719. }
  720. .summaryItem_head{
  721. padding: 24rpx;
  722. font-size: 26rpx;
  723. color: #3A3A3A;
  724. }
  725. .summaryItem_body{
  726. font-size: 30rpx;
  727. background-color: #fff;
  728. .summaryItem_bodyItem{
  729. padding: 24rpx;
  730. border-bottom: 1rpx solid #DDDDDD;
  731. .summaryItem_bodyItem_top{
  732. display: flex;
  733. justify-content: space-between;
  734. align-items: center;
  735. .value{
  736. padding-left: 48rpx;
  737. flex-shrink: 0;
  738. }
  739. }
  740. .summaryItem_bodyItem_bottom{
  741. margin-top: 24rpx;
  742. display: flex;
  743. justify-content: space-between;
  744. align-items: center;
  745. .name{
  746. text-align: right;
  747. flex: 1;
  748. }
  749. .value{
  750. width: 240rpx;
  751. text-align: right;
  752. padding-left: 48rpx;
  753. flex-shrink: 0;
  754. }
  755. }
  756. }
  757. }
  758. .summaryItem_foot{
  759. font-size: 30rpx;
  760. background-color: #fff;
  761. &.total{
  762. margin-top: 24rpx;
  763. }
  764. .summaryItem_foot_total{
  765. padding: 24rpx 0;
  766. display: flex;
  767. justify-content: center;
  768. align-items: center;
  769. }
  770. .summaryItem_foot_add{
  771. border-top: 1rpx solid #DDDDDD;
  772. padding: 24rpx 0;
  773. display: flex;
  774. justify-content: center;
  775. align-items: center;
  776. .newicon-icon-test{
  777. font-size: 30rpx;
  778. font-weight: bold;
  779. }
  780. }
  781. }
  782. }
  783. .form_item_column{
  784. padding-top: 24rpx;
  785. min-height: 86rpx;
  786. .form_item{
  787. padding-top: 0;
  788. min-height: auto;
  789. }
  790. }
  791. .candidate{
  792. display: flex;
  793. flex-wrap: wrap;
  794. .candidate-item{
  795. padding: 6rpx 15rpx;
  796. font-size: 26rpx;
  797. color: #949494;
  798. background: #E9E9E9;
  799. border-radius: 50rpx;
  800. margin-right: 20rpx;
  801. margin-top: 15rpx;
  802. }
  803. }
  804. .form_item{
  805. display: flex;
  806. align-items: center;
  807. padding-top: 24rpx;
  808. min-height: 86rpx;
  809. &.column{
  810. height: auto;
  811. flex-direction: column;
  812. align-items: flex-start;
  813. .import-rep{
  814. padding: 5rpx 10rpx;
  815. border-radius: 50rpx;
  816. background: #d1fcd5;
  817. color: #49b856;
  818. font-size: 24rpx;
  819. }
  820. .title{
  821. margin-right: 0;
  822. }
  823. .title-width{
  824. width: 100%;
  825. }
  826. .title-fl-sb{
  827. display: flex;
  828. justify-content: space-between;
  829. width: 100%;
  830. }
  831. .value{
  832. margin-top: 10rpx;
  833. padding-left: 20rpx;
  834. box-sizing: border-box;
  835. }
  836. .tips{
  837. padding: 24rpx;
  838. text-align: center;
  839. font-size: 22rpx;
  840. color: #909399;
  841. width: 100%;
  842. box-sizing: border-box;
  843. }
  844. }
  845. .title{
  846. font-size: 26rpx;
  847. display: flex;
  848. align-items: center;
  849. margin-right: 12rpx;
  850. flex-shrink: 0;
  851. &.select{
  852. width: calc(5em + 20rpx);
  853. }
  854. }
  855. .value{
  856. width: 100%;
  857. &.category{
  858. width: 100%;
  859. display: flex;
  860. justify-content: space-between;
  861. align-items: center;
  862. .categoryName{
  863. font-size: 26rpx;
  864. color: #555;
  865. flex: 1;
  866. }
  867. .newicon-weibiaoti2010104{
  868. color: $uni-primary;
  869. margin-left: 24rpx;
  870. }
  871. }
  872. .imgTips{
  873. color: #909399;
  874. font-size: 22rpx;
  875. }
  876. }
  877. .item-input{
  878. border: 1px solid #DBDBDB;
  879. height: 70rpx;
  880. line-height: 70rpx;
  881. padding: 0 10rpx;
  882. border-radius: 4rpx;
  883. width: 100%;
  884. font-size: 14px;
  885. }
  886. .synergeticNames{
  887. font-size: 26rpx;
  888. margin-right: 24rpx;
  889. }
  890. .synergeticAdd{
  891. flex-shrink: 0;
  892. }
  893. }
  894. }
  895. }
  896. </style>