rapidRepNext.vue 27 KB

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