12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061 |
- <template>
- <view class="handler">
- <view class="head">
- <view class="tab" :class="{active: tab.value === dataInfo.tabActiveValue}" v-for="tab in dataInfo.tabs" :key="tab.id" @click="clickTab(tab.value)">
- {{tab.name}}<text v-if="tab.num !== ''">({{tab.num}})</text>
- </view>
- </view>
- <scroll-view scroll-y class="body page_padding">
- <!-- 故障处理 -->
- <template v-if="dataInfo.tabActiveValue === 'direct'">
- <view class="form_item column" v-if="dataInfo.category.hasSimple != 1">
- <view class="title"><text class="required newicon newicon-bitian"></text>解决方案:</view>
- <uni-easyinput class="value" type="textarea" v-model="dataInfo.handleDescription" placeholder="请输入解决方案" :class="{formRed: isSubmit && !dataInfo.handleDescription.trim()}" />
- </view>
- <view class="form_item" v-if="dataInfo.category.hasSimple != 1">
- <view class="title"><text class="required newicon newicon-bitian"></text>故障现象:</view>
- <view class="value category" @click="selectCategory">
- <text class="categoryName ellipsis-multiline">{{dataInfo.category.mutiCategory}}</text>
- <text class="newicon newicon-weibiaoti2010104"></text>
- </view>
- </view>
- <view class="form_item">
- <view class="title select"><text class="required newicon newicon-bitian"></text>处理方式:</view>
- <uni-data-select class="value" v-model="dataInfo.handleCategory" :localdata="dataInfo.handleCategoryList" :clear="false" placeholder="请选择处理方式" :class="{formRed: isSubmit && !dataInfo.handleCategory}"></uni-data-select>
- </view>
- <view class="form_item" v-if="dataInfo.category.hasSimple != 1">
- <view class="title select"><text class="required newicon newicon-bitian"></text>关闭代码:</view>
- <uni-data-select class="value" v-model="dataInfo.closecode" :localdata="dataInfo.closecodeList" :clear="false" placeholder="请选择关闭代码" :class="{formRed: isSubmit && !dataInfo.closecode}"></uni-data-select>
- </view>
- <view class="form_item">
- <view class="title"><text class="required newicon newicon-bitian transparent"></text>协同人员:</view>
- <text class="synergeticNames ellipsis">{{dataInfo.synergetic.map(v => v.name).join(',')}}</text>
- <button type="primary" plain size="mini" class="primaryPlainButton synergeticAdd" @click="synergeticAdd">+立即添加</button>
- </view>
- <view class="form_item_column">
- <view class="form_item">
- <view class="title"><text class="required newicon newicon-bitian transparent"></text>处理图片:</view>
- <view class="value">
- <uni-file-picker ref="handlerImgRef" v-model="dataInfo.handlerImgList" limit="3" @success="handlerImgSuccess" @fail="handlerImgFail" @select="handlerImgSelect" @delete="handlerImgDelete"></uni-file-picker>
- </view>
- </view>
- <view class="form_item">
- <view class="title transparent"><text class="required newicon newicon-bitian transparent"></text>处理图片:</view>
- <view class="value">
- <text class="imgTips ellipsis">(支持JPG/PNG格式图片,单张大小10M以内)</text>
- </view>
- </view>
- </view>
- </template>
-
- <!-- 派单 -->
- <template v-if="dataInfo.tabActiveValue === 'assign'">
- <view class="form_item">
- <view class="title select"><text class="required newicon newicon-bitian"></text>工作组:</view>
- <uni-data-select class="value" v-model="dataInfo.groupId" :localdata="dataInfo.groupList" :clear="false" placeholder="请选择工作组" @change="changeGroup" :class="{formRed: isSubmit && !dataInfo.groupId}"></uni-data-select>
- </view>
- <view class="form_item">
- <view class="title radio"><text class="required newicon newicon-bitian"></text>是否转派到人:</view>
- <uni-data-checkbox class="value" v-model="dataInfo.isAssignUser" :localdata="dataInfo.isAssignUserList" @change="changeIsAssignUser" />
- </view>
- <view class="form_item" v-if="dataInfo.isAssignUser === 1">
- <view class="title select"><text class="required newicon newicon-bitian"></text>转派对象:</view>
- <uni-data-select class="value" v-model="dataInfo.userId" :localdata="dataInfo.userList" :clear="false" placeholder="请选择转派对象" :class="{formRed: isSubmit && dataInfo.groupId && dataInfo.isAssignUser == 1 && !dataInfo.userId}"></uni-data-select>
- </view>
- <view class="form_item_column">
- <view class="form_item">
- <view class="title"><text class="required newicon newicon-bitian transparent"></text>处理图片:</view>
- <view class="value">
- <uni-file-picker ref="handlerImgRef" v-model="dataInfo.handlerImgList" limit="3" @success="handlerImgSuccess" @fail="handlerImgFail" @select="handlerImgSelect" @delete="handlerImgDelete"></uni-file-picker>
- </view>
- </view>
- <view class="form_item">
- <view class="title transparent"><text class="required newicon newicon-bitian transparent"></text>处理图片:</view>
- <view class="value">
- <text class="imgTips ellipsis">(支持JPG/PNG格式图片,单张大小10M以内)</text>
- </view>
- </view>
- </view>
- </template>
- </scroll-view>
- <view class="foot_common_btns">
- <button @click="goBack" type="default" class="cancelButton btn">返回</button>
- <button @click="submit" type="default" class="primaryButton btn">提交</button>
- </view>
- </view>
- </template>
- <script setup>
- import { ref, reactive, computed } from 'vue'
- import { onLoad } from '@dcloudio/uni-app'
- import { generateNumberArray } from '@/utils/index.js'
- import { api_group, api_incidentDetail, api_user, api_incidentTask, api_branch, api_dutyDepartment, api_getDictionary, api_querySummaryDoc, api_addSummaryDoc, api_systemConfiguration, api_sj } from "@/http/api.js"
- import { defaultColor } from '@/static/js/theme.js'
- import { useSetTitle } from '@/share/useSetTitle.js'
- import { useMakePhoneCall } from '@/share/useMakePhoneCall.js'
- import { useUploadFile } from '@/share/useUploadFile.js'
- import { useGoBack } from '@/share/useGoBack.js'
- import { useLoginUserStore } from '@/stores/loginUser'
- import { useHandlerStore } from '@/stores/handler'
- import { useIncidentBuildStore } from '@/stores/incidentBuild'
-
- useSetTitle();
- const loginUserStore = useLoginUserStore();
- const handlerStore = useHandlerStore();
- const incidentBuildStore = useIncidentBuildStore();
- const { makePhoneCall } = useMakePhoneCall();
- const { uploadFile } = useUploadFile();
- const { goBack } = useGoBack();
-
- // 主题颜色
- const primaryColor = ref(defaultColor)
-
- // 数据
- const dataInfo = reactive({
- tabs: [
- {id: 5, name: '直接处理', value: 'direct', num: ''},
- {id: 6, name: '派单', value: 'assign', num: ''},
- ],
- tabActiveValue: 0,//当前选择的tab
- incidentId: undefined,//事件ID
- incidentData: {},//事件对象
- groupList: [], //工作组列表
- groupId: undefined, //工作组ID
- userIdList: [], //延期天数列表
- userIdId: undefined, //延期天数ID
- deferralRemark: '',//延期说明
- summaryObj: {
- consumableList: [],//耗材列表
- workHourManagementList: [],//工时列表
- },//汇总单信息
- summaryId: undefined,//汇总单Id
- isNumber: false,//修改数量弹窗
- evtNumber: 1,//弹窗返回的数量
- selectData: {},//选择的对象
- selectType: {},//选择的对象类型
- handleDescription: '',//解决方案
- handleCategory: undefined,//处理方式
- handleCategoryList: [],//处理方式列表
- closecode: undefined,//关闭代码
- closecodeList: [],//关闭代码列表
- handlerImgList: [],//处理图片列表
- category: {},//故障现象
- synergetic: [],//协同人员
- isAssignUser: 1, //工作组是否转派到人
- isAssignUserList: [
- { text: '是', value: 1 },
- { text: '否', value: 0 },
- ], //工作组是否转派到人选项
- })
-
- // 是否提交
- const isSubmit = ref(false)
-
- // 处理图片
- const handlerImgRef = ref(null)
-
- // 上传处理图片成功
- function handlerImgSuccess(e){
- dataInfo.handlerImgList.forEach(v => {
- v.url = v.path;
- })
- console.log(dataInfo.handlerImgList);
- let requestList = [];
-
- // 处理图片
- dataInfo.handlerImgList.forEach(v => {
- let handlerOrderImg$ = handlerOrderImg(v);
- requestList.push(handlerOrderImg$);
- })
-
- // 报修图片
- dataInfo.incidentData.repairImgList.forEach(v => {
- let repairOrderImg$ = repairOrderImg(v);
- requestList.push(repairOrderImg$);
- })
-
- Promise.all(requestList).then(resList => {
- uni.hideLoading();
- console.log(resList);
- incidentBuildStore.clearIncidentBuildData();
- uni.showToast({
- icon: 'none',
- title: '建单成功',
- mask: true,
- });
- setTimeout(() => {
- uni.reLaunch({
- url: '/pages/incidentList/incidentList',
- })
- }, 1500)
- })
- }
-
- // 上传处理图片失败
- function handlerImgFail(e){
- dataInfo.handlerImgList.forEach(v => {
- v.url = v.path;
- })
- console.log(dataInfo.handlerImgList);
- }
-
- // 选择上传图片
- function handlerImgSelect(e){
- dataInfo.handlerImgList = dataInfo.handlerImgList.concat(e.tempFiles);
- console.log(dataInfo.handlerImgList);
- }
-
- // 删除上传图片
- function handlerImgDelete(e){
- dataInfo.handlerImgList = dataInfo.handlerImgList.filter(v => e.tempFile.uuid != v.uuid);
- console.log(dataInfo.handlerImgList);
- }
-
- // 添加协同人员
- function synergeticAdd(){
- handlerStore.setHandlerData(dataInfo, 'assign');
- uni.navigateTo({
- url: `/pages/synergeticAdd/synergeticAdd?incidentId=${dataInfo.incidentId}`
- })
- }
-
- // 选择故障现象
- function selectCategory(){
- handlerStore.setHandlerData(dataInfo, 'assign');
- uni.navigateTo({
- url: `/pages/categoryOne/categoryOne?incidentId=${dataInfo.incidentId}`
- })
- }
-
- // 点击修改数量
- function numberClick(data, type){
- if(type === 'editConsumable'){
- dataInfo.evtNumber = data.consumablesNum;
- }else if(type === 'editWorkHourManagement'){
- dataInfo.evtNumber = data.workHourNum2;
- }
-
- dataInfo.isNumber = true;
- dataInfo.selectData = data;
- dataInfo.selectType = type;
- }
-
- // 确认修改数量
- function conformNumber(evtNumber){
- dataInfo.evtNumber = evtNumber;
- dataInfo.isNumber = false;
- addSummaryDoc();
- }
-
- // 移除数量
- function removeNumber(evtNumber){
- dataInfo.evtNumber = evtNumber;
- dataInfo.isNumber = false;
- removeSummaryDoc();
- }
-
- // 关闭修改数量
- function cancelNumber(){
- dataInfo.isNumber = false;
- }
-
- // 修改耗材/工时
- function addSummaryDoc(){
- uni.showLoading({
- title: "加载中",
- mask: true,
- });
- let postData = {
- "summaryId": dataInfo.summaryId,
- "modifyNum": 'edit',
- };
- if(dataInfo.selectType === 'editConsumable'){
- postData.consumableList = [
- {
- "consumablesId": dataInfo.selectData.consumableId,
- "consumablesNum": dataInfo.evtNumber,
- }
- ];
- }else if(dataInfo.selectType === 'editWorkHourManagement'){
- postData.workHourManagementList = [
- {
- "workHourId": dataInfo.selectData.id,
- "workHourNum": dataInfo.evtNumber,
- }
- ];
- }
- api_addSummaryDoc(postData).then(res => {
- uni.hideLoading();
- if(res.status == 200){
- uni.showToast({
- icon: 'none',
- title: '修改数量成功',
- mask: true,
- });
- getSummaryList();
- }else{
- uni.showToast({
- icon: 'none',
- title: res.msg || '请求数据失败!'
- });
- }
- })
- }
-
- // 移除耗材/工时
- function removeSummaryDoc(){
- uni.showLoading({
- title: "加载中",
- mask: true,
- });
- let postData = {
- "summaryId": dataInfo.summaryId,
- "remove": 'remove',
- };
- if(dataInfo.selectType === 'editConsumable'){
- postData.consumableList = [
- {
- "consumablesId": dataInfo.selectData.consumableId,
- "consumablesNum": dataInfo.evtNumber,
- }
- ];
- }else if(dataInfo.selectType === 'editWorkHourManagement'){
- postData.workHourManagementList = [
- {
- "workHourId": dataInfo.selectData.id,
- "workHourNum": dataInfo.evtNumber,
- }
- ];
- }
- api_addSummaryDoc(postData).then(res => {
- uni.hideLoading();
- if(res.status == 200){
- uni.showToast({
- icon: 'none',
- title: '移除成功',
- mask: true,
- });
- getSummaryList();
- }else{
- uni.showToast({
- icon: 'none',
- title: res.msg || '请求数据失败!'
- });
- }
- })
- }
-
- // 重置
- function reset(){
- dataInfo.repairTypeList = []; //延期原因列表
- dataInfo.groupId = undefined; //延期原因ID
- dataInfo.userIdList = []; //延期天数列表
- dataInfo.userIdId = undefined; //延期天数ID
- dataInfo.deferralRemark = '';//延期说明
- dataInfo.summaryObj = {
- consumableList: [],//耗材列表
- workHourManagementList: [],//工时列表
- };//汇总单信息
- dataInfo.summaryId = undefined;//汇总单Id
- dataInfo.isNumber = false;//修改数量弹窗
- dataInfo.evtNumber = 1;//弹窗返回的数量
- dataInfo.selectData = {};//选择的对象
- dataInfo.selectType = {};//选择的对象类型
- dataInfo.handleDescription = '';//解决方案
- dataInfo.handleCategory = undefined;//处理方式
- dataInfo.handleCategoryList = [];//处理方式列表
- dataInfo.closecode = undefined;//关闭代码
- dataInfo.closecodeList = [];//关闭代码列表
- dataInfo.handlerImgList = [];//处理图片列表
- dataInfo.category = {};//故障现象
- dataInfo.synergetic = [];//协同人员
- }
-
- // 初始化表单
- function initForm(){
- if(dataInfo.tabActiveValue === 'direct'){
- getHandleCategorys();
- getClosecodes();
- }else if(dataInfo.tabActiveValue === 'assign'){
- getGroups();
- }
- }
-
- // 点击tab
- function clickTab(tabValue){
- if(dataInfo.tabActiveValue == tabValue){
- return;
- }
- dataInfo.tabActiveValue = tabValue;
- isSubmit.value = false;
- reset();
- dataInfo.category = dataInfo.incidentData.category || {};
- dataInfo.synergetic = dataInfo.incidentData.synergetic || [];
- initForm();
- }
-
- // 选择工作组
- function changeGroup(){
- dataInfo.userId = undefined;
- dataInfo.userList = [];
- getUsers();
- }
-
- // 选择是否转派到人
- function changeIsAssignUser(){
- dataInfo.userId = undefined;
- }
-
- // 获取工作组列表
- function getGroups(){
- uni.showLoading({
- title: "加载中",
- mask: true,
- });
-
- let postData = {
- "idx": 0,
- "sum": 9999,
- "group": {
- "selectType": "nouser"
- }
- };
- api_group(postData).then(res => {
- uni.hideLoading();
- if(res.status == 200){
- res.list = res.list || [];
- dataInfo.groupList = res.list.map(v => ({
- text: v.groupName,
- value: v.id,
- }));
- }else{
- uni.showToast({
- icon: 'none',
- title: res.msg || '请求数据失败!'
- });
- }
- })
- }
-
- // 获取用户列表
- function getUsers(){
- uni.showLoading({
- title: "加载中",
- mask: true,
- });
- let postData = {
- "idx": 0,
- "sum": 9999,
- "user": {
- "groupdata":{
- "id": dataInfo.groupId,
- },
- "roledata": {
- "rolecode": "first-line support"
- },
- "selectType": "1",
- "selectDetails": 1,
- "simple": true,
- "engineer": 1
- }
- };
- api_user(postData).then(res => {
- uni.hideLoading();
- if(res.status == 200){
- res.list = res.list || [];
- dataInfo.userList = res.list.map(v => ({
- text: v.name,
- value: v.id,
- }));
- }else{
- uni.showToast({
- icon: 'none',
- title: res.msg || '请求数据失败!'
- });
- }
- })
- }
-
- // 获取处理方式列表
- function getHandleCategorys(){
- uni.showLoading({
- title: "加载中",
- mask: true,
- });
- let postData = {
- "key": 'incident_handleCategory',
- "type": "list",
- };
- api_getDictionary(postData).then(res => {
- uni.hideLoading();
- res = res || [];
- dataInfo.handleCategoryList = res.map(v => ({
- text: v.name,
- value: v.id,
- key: v.value,
- }));
- if(!dataInfo.handleCategory){
- let handleCategory = dataInfo.handleCategoryList.find(v => v.key == 'SUPPORT');
- dataInfo.handleCategory = handleCategory ? handleCategory.value : undefined;
- }
- })
- }
-
- // 获取关闭代码列表
- function getClosecodes(){
- uni.showLoading({
- title: "加载中",
- mask: true,
- });
- let postData = {
- "key": 'incident_closecode',
- "type": "list",
- };
- api_getDictionary(postData).then(res => {
- uni.hideLoading();
- res = res || [];
- dataInfo.closecodeList = res.map(v => ({
- text: v.name,
- value: v.id,
- key: v.value,
- }));
- if(!dataInfo.closecode){
- let closecode = dataInfo.closecodeList.find(v => v.key == '060');
- dataInfo.closecode = closecode ? closecode.value : undefined;
- }
- })
- }
-
- // 添加耗材
- function addConsumable(){
- uni.navigateTo({
- url: `/pages/consumableList/consumableList?incidentId=${dataInfo.incidentId}&summaryId=${dataInfo.summaryId}`
- })
- }
-
- // 添加工时
- function addWorkHourManagement(){
- uni.navigateTo({
- url: `/pages/workHourManagementOne/workHourManagementOne?incidentId=${dataInfo.incidentId}&summaryId=${dataInfo.summaryId}`
- })
- }
-
- // 提交
- function submit(){
- isSubmit.value = true;
- if(dataInfo.tabActiveValue === 'direct'){
- submitHandler();
- }else if(dataInfo.tabActiveValue === 'assign'){
- submitAssign();
- }
- }
-
- // 处理提交事件
- async function handlerOrder(){
- let postData = {
- incident: dataInfo.incidentData,
- }
-
- let result = await beforeBuild();
- if(result[0].status == 200 && result[1].status == 200){
- postData.incident.repairType = result[0].list.length ? result[0].list[0].valueconfig : undefined;
- postData.incident.incidentsign = result[1].data || undefined;
- }else{
- uni.showToast({
- icon: 'none',
- title: '请求数据失败!'
- });
- return;
- }
-
- postData.incident.handleDescription = dataInfo.handleDescription;
- postData.incident.handleCategory = {id: dataInfo.handleCategory};
- postData.incident.closecode = {id: dataInfo.closecode};
- postData.incident.category = dataInfo.category;
- postData.incident.synergetic = dataInfo.synergetic;
- postData.incident.directProcess = 1;//直接解决
-
- return api_incidentTask('accept', postData);
- }
-
- // 建单前的接口
- function beforeBuild(){
- let repairMain$ = api_systemConfiguration({
- "idx": 0,
- "sum": 1,
- "systemConfiguration": {
- "keyconfig": "repairMain"
- }
- })
-
- let sj$ = api_sj();
- return Promise.all([repairMain$, sj$])
- }
-
- // 派单提交事件
- async function assignOrder(){
- let postData = {
- incident: dataInfo.incidentData,
- }
-
- let result = await beforeBuild();
- if(result[0].status == 200 && result[1].status == 200){
- postData.incident.repairType = result[0].list.length ? result[0].list[0].valueconfig : undefined;
- postData.incident.incidentsign = result[1].data || undefined;
- }else{
- uni.showToast({
- icon: 'none',
- title: '请求数据失败!'
- });
- return;
- }
-
- if(dataInfo.userId){
- // 派人
- postData.incident.assignee = dataInfo.userId;
- } else {
- // 派组
- postData.incident.candidateGroups = dataInfo.groupId;
- }
-
- return api_incidentTask('accept', postData);
- }
-
- // 处理图片
- function handlerOrderImg(imgObj){
- return uploadFile(imgObj, 'incident', dataInfo.incidentId)
- }
-
- // 报修图片
- function repairOrderImg(imgObj){
- return uploadFile(imgObj, 'wechatRequesterIncident', dataInfo.incidentId)
- }
-
- // 处理提交
- function submitHandler(){
- console.log(dataInfo);
- if(!dataInfo.handleDescription.trim() && dataInfo.category.hasSimple != 1){
- uni.showToast({
- icon: 'none',
- title: '请填写解决方案'
- });
- return;
- }
-
- if(!dataInfo.category.id && dataInfo.category.hasSimple != 1){
- uni.showToast({
- icon: 'none',
- title: '请选择故障现象'
- });
- return;
- }
-
- if(!dataInfo.handleCategory){
- uni.showToast({
- icon: 'none',
- title: '请选择处理方式'
- });
- return;
- }
-
- if(!dataInfo.closecode && dataInfo.category.hasSimple != 1){
- uni.showToast({
- icon: 'none',
- title: '请选择关闭代码'
- });
- return;
- }
-
- if(!dataInfo.incidentData.duty){
- uni.showToast({
- icon: 'none',
- title: '您选择的故障现象没有设置责任科室'
- });
- return;
- }
- console.log(dataInfo.handlerImgList)
-
- uni.showLoading({
- title: "加载中",
- mask: true,
- });
-
- if(dataInfo.handlerImgList.length){
- // 有图片
- let handlerOrder$ = handlerOrder();
- let requestList = [handlerOrder$];
- Promise.all(requestList).then(resList => {
- uni.hideLoading();
- console.log(resList);
- if(resList[0].state == 200){
- dataInfo.incidentId = resList[0].data.id;
- handlerImgRef.value.upload();
- }else{
- uni.showToast({
- icon: 'none',
- title: resList[0].msg || '请求数据失败!'
- });
- }
- })
- }else{
- // 没有图片
- let handlerOrder$ = handlerOrder();
- let requestList = [handlerOrder$];
- Promise.all(requestList).then(resList => {
- uni.hideLoading();
- console.log(resList);
- if(resList[0].state == 200){
- incidentBuildStore.clearIncidentBuildData();
- uni.showToast({
- icon: 'none',
- title: '建单成功',
- mask: true,
- });
- setTimeout(() => {
- uni.reLaunch({
- url: '/pages/incidentList/incidentList',
- })
- }, 1500)
- }else{
- uni.showToast({
- icon: 'none',
- title: resList[0].msg || '请求数据失败!'
- });
- }
- })
- }
- }
-
- // 派单提交
- function submitAssign(){
- if(!dataInfo.groupId){
- uni.showToast({
- icon: 'none',
- title: '请选择工作组'
- });
- return;
- }
-
- if(dataInfo.isAssignUser == 1 && !dataInfo.userId){
- uni.showToast({
- icon: 'none',
- title: '请选择指派对象'
- });
- return;
- }
-
- if(!dataInfo.incidentData.duty){
- uni.showToast({
- icon: 'none',
- title: '您选择的故障现象没有设置责任科室'
- });
- return;
- }
-
- uni.showLoading({
- title: "加载中",
- mask: true,
- });
-
- if(dataInfo.handlerImgList.length){
- // 有图片
- let assignOrder$ = assignOrder();
- let requestList = [assignOrder$];
- Promise.all(requestList).then(resList => {
- uni.hideLoading();
- console.log(resList);
- if(resList[0].state == 200){
- dataInfo.incidentId = resList[0].data.id;
- handlerImgRef.value.upload();
- }else{
- uni.showToast({
- icon: 'none',
- title: resList[0].msg || '请求数据失败!'
- });
- }
- })
- }else{
- // 没有图片
- let assignOrder$ = assignOrder();
- let requestList = [assignOrder$];
- Promise.all(requestList).then(resList => {
- uni.hideLoading();
- console.log(resList);
- if(resList[0].state == 200){
- incidentBuildStore.clearIncidentBuildData();
- uni.showToast({
- icon: 'none',
- title: '建单成功',
- mask: true,
- });
- setTimeout(() => {
- uni.reLaunch({
- url: '/pages/incidentList/incidentList',
- })
- }, 1500)
- }else{
- uni.showToast({
- icon: 'none',
- title: resList[0].msg || '请求数据失败!'
- });
- }
- })
- }
-
- }
-
- onLoad((option) => {
- // 跳转页面选择了选项
- if(handlerStore.handler.data){
- Object.assign(dataInfo, handlerStore.handler.data);
- console.log(dataInfo)
- handlerStore.clearHandlerData();
-
- if(dataInfo.category){
- dataInfo.incidentData.category = dataInfo.category;
-
- // 处理责任科室
- if(dataInfo.category.branchType == 1){
- // 分院区
- if(dataInfo.incidentData.branch){
- let dutyConfig = dataInfo.category.branchUserGroups.find(v=>v.branchId == dataInfo.incidentData.branch);
- if(dutyConfig && dutyConfig.dutyId && dutyConfig.dutyName){
- dataInfo.incidentData.duty = {id:dutyConfig.dutyId,dept:dutyConfig.dutyName};
- }else{
- dataInfo.incidentData.duty = undefined;
- }
- }else{
- dataInfo.incidentData.duty = undefined;
- }
- }else{
- // 不分院区
- dataInfo.incidentData.duty = dataInfo.category.dutyDepartment;
- }
- }
- }else if(incidentBuildStore.incidentBuild.data){
- // 初始化
- Object.assign(dataInfo.incidentData, incidentBuildStore.incidentBuild.data);
- if(dataInfo.incidentData.category){
- dataInfo.category = dataInfo.incidentData.category;
-
- // 处理责任科室
- if(dataInfo.category.branchType == 1){
- // 分院区
- if(dataInfo.incidentData.branch){
- let dutyConfig = dataInfo.category.branchUserGroups.find(v=>v.branchId == dataInfo.incidentData.branch);
- if(dutyConfig && dutyConfig.dutyId && dutyConfig.dutyName){
- dataInfo.incidentData.duty = {id:dutyConfig.dutyId,dept:dutyConfig.dutyName};
- }else{
- dataInfo.incidentData.duty = undefined;
- }
- }else{
- dataInfo.incidentData.duty = undefined;
- }
- }else{
- // 不分院区
- dataInfo.incidentData.duty = dataInfo.category.dutyDepartment;
- }
- }
- if(dataInfo.incidentData.priority){
- dataInfo.incidentData.priority = { id: dataInfo.incidentData.priority };
- }
- if(dataInfo.incidentData.source){
- dataInfo.incidentData.source = { id: dataInfo.incidentData.source };
- }
- if(dataInfo.incidentData.requester){
- dataInfo.incidentData.requester = { id: dataInfo.incidentData.requester }
- }
- }
-
- dataInfo.tabActiveValue = dataInfo.tabs[0].value;
- initForm()
- })
- </script>
- <style lang="scss" scoped>
- .handler{
- height: 100%;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .head{
- height: 88rpx;
- display: flex;
- position: fixed;
- z-index: 99;
- width: 100%;
- background-color: #fff;
- font-size: 30rpx;
- .tab{
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- border-bottom: 4rpx solid transparent;
- &.active{
- color: $uni-primary;
- border-color: $uni-primary;
- }
- }
- }
- .body{
- margin-top: 88rpx;
- box-sizing: border-box;
- flex: 1;
- min-height: 0;
- &.bg{
- background-color: #F7F7F7;
- }
- .summaryItem{
- &:first-of-type{
- .summaryItem_head{
- border-bottom: 1rpx solid #DDDDDD;
- }
- }
- .summary_total{
- padding: 20rpx 0;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .summaryItem_head{
- padding: 24rpx;
- font-size: 26rpx;
- color: #3A3A3A;
- }
- .summaryItem_body{
- font-size: 30rpx;
- background-color: #fff;
- .summaryItem_bodyItem{
- padding: 24rpx;
- border-bottom: 1rpx solid #DDDDDD;
- .summaryItem_bodyItem_top{
- display: flex;
- justify-content: space-between;
- align-items: center;
- .value{
- padding-left: 48rpx;
- flex-shrink: 0;
- }
- }
- .summaryItem_bodyItem_bottom{
- margin-top: 24rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .name{
- text-align: right;
- flex: 1;
- }
- .value{
- width: 240rpx;
- text-align: right;
- padding-left: 48rpx;
- flex-shrink: 0;
- }
- }
- }
- }
- .summaryItem_foot{
- font-size: 30rpx;
- background-color: #fff;
- &.total{
- margin-top: 24rpx;
- }
- .summaryItem_foot_total{
- padding: 24rpx 0;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .summaryItem_foot_add{
- border-top: 1rpx solid #DDDDDD;
- padding: 24rpx 0;
- display: flex;
- justify-content: center;
- align-items: center;
- .newicon-icon-test{
- font-size: 30rpx;
- font-weight: bold;
- }
- }
- }
- }
- .form_item_column{
- padding-top: 24rpx;
- min-height: 86rpx;
- .form_item{
- padding-top: 0;
- min-height: auto;
- }
- }
- .form_item{
- display: flex;
- align-items: center;
- padding-top: 24rpx;
- min-height: 86rpx;
- &.column{
- height: auto;
- flex-direction: column;
- align-items: flex-start;
- .title{
- margin-right: 0;
- }
- .value{
- margin-top: 10rpx;
- padding-left: 20rpx;
- box-sizing: border-box;
- }
- .tips{
- padding: 24rpx;
- text-align: center;
- font-size: 22rpx;
- color: #909399;
- width: 100%;
- box-sizing: border-box;
- }
- }
- .title{
- font-size: 26rpx;
- display: flex;
- align-items: center;
- margin-right: 12rpx;
- flex-shrink: 0;
- &.select{
- width: calc(5em + 20rpx);
- }
- }
- .value{
- width: 100%;
- &.category{
- width: 100%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .categoryName{
- font-size: 26rpx;
- color: #555;
- flex: 1;
- }
- .newicon-weibiaoti2010104{
- color: $uni-primary;
- margin-left: 24rpx;
- }
- }
- .imgTips{
- color: #909399;
- font-size: 22rpx;
- }
- }
- .synergeticNames{
- font-size: 26rpx;
- margin-right: 24rpx;
- }
- .synergeticAdd{
- flex-shrink: 0;
- }
- }
- }
- }
- </style>
|