rapidRepNext.vue 26 KB

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