DetailRepair.vue 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341
  1. <template>
  2. <div>
  3. <div v-show="visible">
  4. <a-row :gutter="40">
  5. <a-col :span="6">
  6. <div class="gutter-box gutter-color center">
  7. <div style=" overflow: auto;height: 300px;">
  8. <a-steps :current="repairStatus.length-1" direction="vertical" >
  9. <a-step v-for="item in repairStatus" :key="item.id" :title="DictCache.COLOR.REPAIR_STATUS[item.status]" :description="item.createdTime" />
  10. </a-steps>
  11. </div>
  12. </div>
  13. </a-col>
  14. <a-col :span="18" class="gutter-box">
  15. <a-row :gutter="[20,20]">
  16. <a-col :span="6">
  17. <div class="gutter-btn gutter-color" :class="{'act':current===0}" @click="current=0">
  18. <my-icon type="icon-weixiu1" />
  19. <div style="font-size:25px">报修数据</div>
  20. </div>
  21. </a-col>
  22. <a-col :span="6" >
  23. <div class="gutter-btn gutter-color" :class="{'act':current===1}" @click="current=1">
  24. <my-icon type="icon-weixiubaoxiu" />
  25. <div style="font-size:25px; ">维修数据</div>
  26. </div>
  27. </a-col>
  28. <a-col :span="6">
  29. <div class="gutter-btn gutter-color" :class="{'act':current===7}" @click="current=7">
  30. <my-icon type="icon-weixiu" />
  31. <div style="font-size:25px; ">维修方案</div>
  32. </div>
  33. </a-col>
  34. <a-col :span="6">
  35. <div class="gutter-btn gutter-color" @click="current=3" :class="{'act':current===3}">
  36. <img v-if="current==3" src="@/assets/icons/jilu.png" width="50px"/>
  37. <my-icon v-else class="act" type="icon-xinzengyugengxinhuopindangan" />
  38. <div style="font-size:25px;">维修记录</div>
  39. </div>
  40. </a-col>
  41. <a-col :span="6">
  42. <div class="gutter-btn gutter-color" @click="current=4" :class="{'act':current===4}">
  43. <img v-if="current==4" src="@/assets/icons/beijian.png" width="50px"/>
  44. <my-icon v-else class="act" type="icon-shouhoubeijianjijingpinjianjiageshenqingbiao-06" />
  45. <div style="font-size:25px; ">备件清单</div>
  46. </div>
  47. </a-col>
  48. <a-col :span="6" >
  49. <div class="gutter-btn gutter-color" :class="{'act':current===5}" @click="current=5">
  50. <my-icon type="icon-qitafeiyong" />
  51. <div style="font-size:25px;">费用清单</div>
  52. </div>
  53. </a-col>
  54. <a-col :span="6">
  55. <div class="gutter-btn gutter-color" :class="{'act':current===6}" @click="current=6">
  56. <my-icon type="icon-zhengzaiweixiudegongdan" />
  57. <div style="font-size:25px; ">维修报告</div>
  58. </div>
  59. </a-col>
  60. <a-col :span="6">
  61. <div class="gutter-btn gutter-color" @click="current=2" :class="{'act':current===2}">
  62. <img v-if="current==2" src="@/assets/icons/shenhe.png" width="50px"/>
  63. <my-icon v-else class="act" type="icon-fapiaoshenhe" />
  64. <div style="font-size:25px; ">审核详情</div>
  65. </div>
  66. </a-col>
  67. </a-row>
  68. </a-col>
  69. </a-row>
  70. <div>
  71. <div class="main gutter-color" v-show="current == 0">
  72. <div class="title">报修数据</div>
  73. <div>
  74. <a-descriptions :column="3" bordered>
  75. <a-descriptions-item label="报修单号">{{ model.no }}</a-descriptions-item>
  76. <a-descriptions-item label="设备编号">{{ model.sbNo }}</a-descriptions-item>
  77. <a-descriptions-item label="设备名称">{{ model.sbName }}</a-descriptions-item>
  78. <a-descriptions-item label="机电仪位号">{{ model.parentSbNo }}</a-descriptions-item>
  79. <a-descriptions-item label="父位号">{{ model.selfParentNo }}</a-descriptions-item>
  80. <a-descriptions-item label="报修车间">{{ model.sbPositionName }}</a-descriptions-item>
  81. <a-descriptions-item label="车间具体位置">{{ model.sbCph }}</a-descriptions-item>
  82. <a-descriptions-item label="工单类别">{{ BaseTool.Object.getField(planFlagMap,model.category) }}</a-descriptions-item>
  83. <a-descriptions-item label="报修状态"><badge :text="BaseTool.Object.getField(statusMap,model.status)" :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_STATUS[model.status]"/></a-descriptions-item>
  84. <a-descriptions-item label="报修时间">{{ model.applyTime }}</a-descriptions-item>
  85. <a-descriptions-item label="报修人">{{ model.actualUser }}</a-descriptions-item>
  86. <a-descriptions-item label="要求时间">{{ model.limitHours }}小时</a-descriptions-item>
  87. <a-descriptions-item label="送修部门">{{ model.name }}</a-descriptions-item>
  88. <a-descriptions-item label="维修工程师" >{{ model.checkUserName }}</a-descriptions-item>
  89. <a-descriptions-item label="故障描述" :span="3"> <span v-html="model.content "></span> </a-descriptions-item>
  90. <a-descriptions-item label="报修图片" :span="3">
  91. <div v-if="model.applicationFileList != null && model.applicationFileList.length > 0">
  92. <viewer :images="model.applicationFileList" @inited="inited" ref="viewer" :index="1" >
  93. <img
  94. v-for="item in model.applicationFileList"
  95. :src="item.url"
  96. :key="item.id"
  97. class="image"
  98. width="200px"
  99. style="margin:10px;">
  100. </viewer></div>
  101. <div v-if="model.applicationFileList == null || model.applicationFileList.length === 0"> 暂无</div>
  102. </a-descriptions-item>
  103. </a-descriptions>
  104. </div>
  105. </div>
  106. <div class="main gutter-color" v-show="current == 1">
  107. <div class="title">维修数据</div>
  108. <div>
  109. <a-descriptions :column="2" bordered>
  110. <a-descriptions-item label="维修开始时间">{{ model.repairStartTime }}</a-descriptions-item>
  111. <a-descriptions-item label="维修结束时间">{{ model.repairEndTime }}</a-descriptions-item>
  112. <a-descriptions-item label="维修耗时">{{ model.repairMinutes }}小时</a-descriptions-item>
  113. <a-descriptions-item label="当前维修人">{{ model.repairUserName }}</a-descriptions-item>
  114. </a-descriptions>
  115. </div>
  116. </div>
  117. <div class="main gutter-color" v-show="current == 2">
  118. <div class="title">审核记录</div>
  119. <a-table
  120. :data-source="dataVerifyRecord"
  121. :columns="columnsVerifyRecord"
  122. tableLayout="auto"
  123. rowKey="id">
  124. <span slot="action" slot-scope="record">
  125. <template>
  126. <a @click="handleVerifyRecord(record)">审核详情</a>
  127. </template>
  128. </span>
  129. </a-table>
  130. </div>
  131. <div class="main gutter-color" v-show="current == 3">
  132. <div class="title">维修记录</div>
  133. <a-table
  134. :data-source="dataRecord"
  135. :columns="columnsRecord"
  136. tableLayout="auto"
  137. rowKey="id">
  138. <span slot="action" slot-scope="record">
  139. <template>
  140. <a @click="handleViewRecord(record)">维修详情</a>
  141. <operation-button @click="handleEditRecord(record)" >编辑</operation-button>
  142. </template>
  143. </span>
  144. </a-table>
  145. </div>
  146. <div class="main gutter-color" v-show="current == 4">
  147. <div class="title">备件清单</div>
  148. <div style="margin:20px;margin-left: 33%;" class="table-operator" v-if="$auth('repair-application-forms-finish')">
  149. <a-button type="primary" @click="updateLongYanSpare(1)">
  150. <a-icon type="plus"/>
  151. 更换关联备件
  152. </a-button>
  153. <a-divider type="vertical" />
  154. <a-button type="primary" @click="updateLongYanSpare(0)">
  155. <a-icon type="plus"/>
  156. 更换常用备件
  157. </a-button>
  158. <!-- <a-divider type="vertical" />
  159. <a-button type="primary" @click="handleAddSpare()">
  160. <a-icon type="plus"/>
  161. 添加专用备件
  162. </a-button>-->
  163. </div>
  164. <a-table
  165. :data-source="dataSpare"
  166. :columns="columnsSpare"
  167. :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  168. tableLayout="auto"
  169. rowKey="id">
  170. <span slot="actionSpare" slot-scope="record">
  171. <template>
  172. <a v-if="$auth('repair-application-forms-finish') && record.isSpecial === 0" @click="handleEditSpare(record)">修改</a>
  173. <a-divider type="vertical" />
  174. <a-popconfirm v-if="$auth('repair-application-forms-finish')" title="是否要删除该条数据?" @confirm="batchDeleteSpare(record.id)">
  175. <a>删除</a>
  176. </a-popconfirm>
  177. </template>
  178. </span>
  179. </a-table>
  180. </div>
  181. <div class="main gutter-color" v-show="current == 5">
  182. <div class="title">费用清单</div>
  183. <div style="margin:20px;margin-left:45%;" class="table-operator" v-if="$auth('repair-application-forms-finish')">
  184. <a-button type="primary" @click="handleAddFee">
  185. <a-icon type="plus"/>
  186. 费用单
  187. </a-button>
  188. </div>
  189. <a-table
  190. :data-source="dataFee"
  191. :columns="columnsFee"
  192. tableLayout="auto"
  193. rowKey="id">
  194. <span slot="action" slot-scope="record">
  195. <template>
  196. <a @click="handleViewFee(record)">查看</a>
  197. <operation-button
  198. @click="handleEditFee(record)" >修改</operation-button>
  199. <operation-button
  200. title="确认删除该笔费用?"
  201. @confirm="batchDeleteFee(record.id)" >删除</operation-button>
  202. </template>
  203. </span>
  204. </a-table>
  205. </div>
  206. <div class="main gutter-color" v-show="current == 6">
  207. <div class="title">维修报告</div>
  208. <div style="margin:20px;margin-left:45%;" class="table-operator" v-if="$auth('repair-application-forms-finish') && ((dataReason === null) || (dataReason.length===0))">
  209. <a-button type="primary" @click="handleAddReason">
  210. <a-icon type="plus"/>
  211. 维修报告
  212. </a-button>
  213. </div>
  214. <a-table
  215. :data-source="dataReason"
  216. :columns="columnsReason"
  217. :scroll="{x: 1, y: BaseTool.Constant.scrollY }"
  218. rowKey="id">
  219. <span slot="action" slot-scope="record">
  220. <template>
  221. <a @click="handleViewReason(record)">查看</a>
  222. <operation-button
  223. @click="handleEditReason(record)" >修改</operation-button>
  224. <!-- <operation-button
  225. v-if="$auth('repair-application-forms-finish') && ( DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)"
  226. @click="handleCopyReason(record)" >复制</operation-button>-->
  227. <operation-button
  228. :type="2"
  229. title="确认删除该记录?"
  230. @confirm="batchDeleteReason(record.id)" >删除</operation-button>
  231. </template>
  232. </span>
  233. </a-table>
  234. </div>
  235. <div class="main gutter-color" v-show="current == 7">
  236. <div class="title">维修方案</div>
  237. <div style="margin:20px;margin-left:45%;" class="table-operator" >
  238. <a-button v-if="$auth('repair-repairs-add')" type="primary" @click="handleAddRepairResolve">
  239. <a-icon type="plus"/>
  240. 添加方案
  241. </a-button>
  242. <a-button style="margin-left:30px;" v-if="$auth('repair-repairs-add')" type="primary" @click="handleAddRepairResolves">
  243. <a-icon type="read" />
  244. 方案库
  245. </a-button>
  246. </div>
  247. <a-table
  248. :data-source="dataRepairResolve"
  249. :columns="columnsRepairResolve"
  250. tableLayout="auto"
  251. rowKey="id">
  252. <span slot="action" slot-scope="record">
  253. <template>
  254. <a @click="handleViewRepairResolve(record)">方案详情</a>
  255. <operation-button
  256. @click="handleEditRepairResolve(record)" >修改</operation-button>
  257. </template>
  258. </span>
  259. </a-table>
  260. </div>
  261. </div>
  262. <div class="btn">
  263. <a-popconfirm v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === model.status " title="是否要接单?" @confirm="receiveRepair">
  264. <a-button style="margin-left: 8px" type="default">接单</a-button>
  265. </a-popconfirm>
  266. <a-button v-if="$auth('repair-application-forms-dispatch') && (DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.RECEIVED === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.MM_DISPATCH === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.DISPATCH_REPAIR === model.status)" style="margin-left: 16px" type="default" @click="handleAssign">派单</a-button>
  267. <a-button v-if="(DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REPAIR_FAIL === model.status)" style="margin-left: 16px" type="default" @click="reportRepair">维修上报</a-button>
  268. <a-button v-if="(DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REPAIR_FAIL === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.MM_REPAIR_FAIL === model.status)" style="margin-left: 16px" type="default" @click="handleReportRepair">处理维修上报</a-button>
  269. <a-button v-if="$auth('repair-application-forms-finish') && (DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.WAIT_SUBMIT === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REPAIR_FAIL === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.MM_REPAIR_FAIL === model.status)" style="margin-left: 8px" type="default" @click="handleTransfer()">转派</a-button>
  270. <a-button v-if="$auth('repair-application-forms-examine') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status" style="margin-left: 8px" type="default" @click="handleFinish()">完成维修</a-button>
  271. <a-button v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status" style="margin-left: 8px" type="default" @click="handleViewTicket()">维修票证</a-button>
  272. <a-popconfirm v-if="$auth('repair-application-forms-finish') && (DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.WAIT_SUBMIT === model.status)" title="是否要结单?" @confirm="handleExamine">
  273. <a-button style="margin-left: 8px" type="default">结单</a-button>
  274. </a-popconfirm>
  275. <a-popconfirm v-if="$auth('repair-application-forms-approve') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ACCEPTANCE === model.status" title="是否要接受?" @confirm="handleApprove">
  276. <a-button :loading="confirmLoading" style="margin-left: 8px" type="default">接受</a-button>
  277. </a-popconfirm>
  278. <a-popconfirm v-if="$auth('repair-application-forms-reback') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ACCEPTANCE === model.status" title="是否要拒绝?" @confirm="handleReturn">
  279. <a-button style="margin-left: 8px" type="error">拒绝</a-button>
  280. </a-popconfirm>
  281. <a-button style="margin-left: 8px" type="primary" @click="handleCancel">返回</a-button>
  282. </div>
  283. </div>
  284. <check-form ref="checkForm" @ok="handleOk" />
  285. <base-out-form ref="outForm" @ok="handleCancel" />
  286. <finish-form ref="finishForm" @ok="handleRepairRecordOk" />
  287. <dispatch-form ref="dispatchForm" @ok="handleCancel" />
  288. <assign-form ref="assignForm" @ok="handleCancel" />
  289. <spare-pick-base-form ref="baseModal" @ok="handleOk"/>
  290. <base-form-for-repair ref="baseFormForRepair" @ok="handleOk" />
  291. <spare-store-select-modal ref="spareStoreSelectModal" @selected="handleSpareStoreSelected"/>
  292. <fee-base-form ref="feeForm" @ok="handleOk" />
  293. <fee-detail ref="feeDetail" @ok="handleOk" />
  294. <reason-base-form ref="reasonForm" @ok="handleOk" />
  295. <reason-detail ref="reasonDetail" @ok="handleOk" />
  296. <detail-sb-bom ref="detailSbBomModal" @ok="handleOk"/>
  297. <detail-sb-check ref="detailSbCheckModal" @ok="handleOk"/>
  298. <base-form ref="baseRepairProjectModal" @ok="handleOk"/>
  299. <detail ref="detailRepairProjectModal"/>
  300. <edit-form ref="editForm" @ok="handleOk" />
  301. <resolve-base-form ref="resolveBaseForm" @ok="handleResolveOk"/>
  302. <resolve-detail ref="resolveDetail" @ok="handleResolveOk"/>
  303. <detail-repair-record ref="detailRepairRecord" @ok="handleRepairRecordOk"/>
  304. <transfer-form ref="transferForm" @ok="handleOk"/>
  305. <detail-check-new ref="detailCheckNew" @ok="handleVerifyRecordOk"/>
  306. <repair-record-form ref="repairRecordForm" @ok="handleRepairRecordOk" />
  307. <report-up-form ref="reportUpForm" @ok="handleOk" @okk="handleCancel" />
  308. <ticket-form ref="ticketForm" @ok="handleOk" />
  309. <longYanSelectSpareForm ref="longYanSelectSpareForm" @ok="handleOk"/>
  310. <scheme-library ref="schemeLibrary" @ok="handleOk"/>
  311. </div>
  312. </template>
  313. <script>
  314. // import { stringify } from 'qs'
  315. import DetailList from '@/components/tools/DetailList'
  316. import { fetchRepairApplicationForm, approve, receive, receiveRepair } from '@/api/repair/application-form'
  317. import CheckForm from './CheckForm'
  318. import BaseOutForm from './BaseOutForm'
  319. import FinishForm from './FinishForm'
  320. import EditForm from './EditForm'
  321. import DispatchForm from './DispatchForm'
  322. import AssignForm from './AssignForm'
  323. import SchemeLibrary from './SchemeLibrary'
  324. import SparePickBaseForm from '../../../store/sparepickform/modules/BaseForm'
  325. import SparePartUsedSelectTable from '@/views/sqarepartmanage/sparepartused/modules/SparePartUsedSelectTable'
  326. import SparePickFormSelectTable from '@/views/store/sparepickform/modules/SparePickFormSelectTable'
  327. import RepairProjectSelectModal from '@/views/repair/repairproject/modules/RepairProjectSelectModal'
  328. import { queryRepairProject, fetchRepairProject, deleteRepairProjects } from '@/api/repair/repairproject'
  329. import SparePartInfoSelectModal from '@/views/sqarepartmanage/sparepartinfo/modules/SparePartInfoSelectModal'
  330. import BaseFormForRepair from '@/views/sqarepartmanage/sparepartused/modules/BaseFormForRepair'
  331. import { selectSparePartUsedListBySbId, addSparePartUsedBatch, deleteSparePartUseds, updateSpare, selectLongYanListByRepairId } from '@/api/sqarepartmanage/sparepartused'
  332. import SpareStoreSelectModal from '@/views/store/sparestore/modules/SpareStoreSelectModal'
  333. import BaseTool from '@/utils/tool'
  334. import FeeBaseForm from '@/views/repair/fee/modules/BaseForm'
  335. import FeeDetail from '@/views/repair/fee/modules/Detail'
  336. import { deleteRepairFees, fetchRepairFee, queryRepairFee } from '@/api/repair/fee'
  337. import { getSelfRole } from '@/api/upms/role'
  338. import ReasonBaseForm from '@/views/repair/repair-reason/modules/BaseForm'
  339. import ReasonDetail from '@/views/repair/repair-reason/modules/Detail'
  340. import { deleteRepairReasons, fetchRepairReason, queryRepairReason } from '@/api/repair/repair-reason'
  341. import { queryRepairRecord, fetchCustomDataForRepairRecord, fetchRepairTicketRecord } from '@/api/customize/fieldTemplateData'
  342. import DetailSbBom from '@/views/sb/modelbom/modules/DetailSbBom'
  343. import DetailSbCheck from '@/views/check/checkstandard/modules/DetailSbCheck'
  344. import { fetchSbInfo } from '@/api/sb/info'
  345. import { getRepairSchemePage, fetchRepairScheme } from '@/api/repair/repair'
  346. import BaseForm from '@/views/repair/repairproject/modules/BaseForm'
  347. import Detail from '@/views/repair/repairproject/modules/Detail'
  348. import ResolveBaseForm from '@/views/repair/repair/modules/BaseForm'
  349. import ResolveDetail from '@/views/repair/repair/modules/Detail'
  350. import DetailRepairRecord from './DetailRepairRecord'
  351. import TransferForm from './TransferForm'
  352. import DetailCheckNew from './DetailCheckNew'
  353. import RepairRecordForm from './RepairRecordForm'
  354. import ReportUpForm from './ReportUpForm'
  355. import TicketForm from './TicketForm'
  356. import LongYanSelectSpareForm from './LongYanSelectSpareForm'
  357. const DetailListItem = DetailList.Item
  358. export default {
  359. name: 'RepairApplicationFormDetail',
  360. components: {
  361. CheckForm,
  362. SchemeLibrary,
  363. EditForm,
  364. DetailList,
  365. DetailSbCheck,
  366. DetailSbBom,
  367. ReasonBaseForm,
  368. ReasonDetail,
  369. DetailListItem,
  370. FinishForm,
  371. BaseOutForm,
  372. DispatchForm,
  373. FeeDetail,
  374. AssignForm,
  375. FeeBaseForm,
  376. SparePickBaseForm,
  377. SparePartUsedSelectTable,
  378. SparePickFormSelectTable,
  379. RepairProjectSelectModal,
  380. SparePartInfoSelectModal,
  381. BaseFormForRepair,
  382. SpareStoreSelectModal,
  383. BaseForm,
  384. Detail,
  385. ResolveBaseForm,
  386. ResolveDetail,
  387. DetailRepairRecord,
  388. TransferForm,
  389. DetailCheckNew,
  390. RepairRecordForm,
  391. ReportUpForm,
  392. TicketForm,
  393. LongYanSelectSpareForm
  394. },
  395. data () {
  396. return {
  397. confirmLoading: false,
  398. mdl: {},
  399. current: 0,
  400. modalTitle: null,
  401. needStopMap: {},
  402. planFlagMap: {},
  403. dispatchList: [],
  404. visible: false,
  405. showSbFlag: false,
  406. sbInfo: {},
  407. // 下拉框map
  408. sourceMap: {},
  409. typeMap: {},
  410. repairStatus: [],
  411. levelMap: {},
  412. descripitionMap: {},
  413. selectedRowKeys: [],
  414. statusMap: {},
  415. repairProjectMap: {},
  416. repairTechnologyMap: {},
  417. activeKey: 'a',
  418. data: [],
  419. dataSpare: [],
  420. dataFee: [],
  421. dataReason: [],
  422. dataRepairResolve: [],
  423. dataRecord: [],
  424. dataVerifyRecord: [],
  425. // 表头
  426. columns: [
  427. {
  428. title: '序号',
  429. dataIndex: 'index',
  430. customRender: (text, record, index) => {
  431. return `${index + 1}`
  432. }
  433. },
  434. {
  435. title: '维修内容',
  436. dataIndex: 'name'
  437. },
  438. {
  439. title: '操作',
  440. key: 'action',
  441. width: '200px',
  442. align: 'center',
  443. scopedSlots: { customRender: 'action' }
  444. }
  445. ],
  446. columnsSpare: [
  447. {
  448. title: '序号',
  449. dataIndex: 'index',
  450. customRender: (text, record, index) => {
  451. return `${index + 1}`
  452. }
  453. },
  454. {
  455. title: '备件名称',
  456. dataIndex: 'spareName'
  457. },
  458. {
  459. title: '备件编码',
  460. dataIndex: 'spareId'
  461. },
  462. {
  463. title: '规格型号',
  464. dataIndex: 'ggxh'
  465. },
  466. {
  467. title: '更换数量',
  468. dataIndex: 'num'
  469. },
  470. {
  471. title: '更换日期',
  472. dataIndex: 'startDate'
  473. },
  474. /* {
  475. title: '下次更换日期',
  476. dataIndex: 'startDate'
  477. }, */
  478. {
  479. title: '更换备注',
  480. dataIndex: 'remark'
  481. },
  482. {
  483. title: '是否关联设备',
  484. dataIndex: 'isSpecial',
  485. checked: true,
  486. customRender: (text, record, index) => {
  487. if (text === 1) {
  488. return '是'
  489. } else {
  490. return '否'
  491. }
  492. }
  493. }
  494. /*
  495. {
  496. title: '操作',
  497. key: 'action',
  498. width: '200px',
  499. align: 'center',
  500. scopedSlots: { customRender: 'actionSpare' }
  501. } */
  502. ],
  503. columnsFee: [
  504. {
  505. title: '序号',
  506. dataIndex: 'index',
  507. customRender: (text, record, index) => {
  508. return `${index + 1}`
  509. }
  510. },
  511. {
  512. title: '费用金额',
  513. dataIndex: 'fee',
  514. customRender: (text, record, index) => {
  515. return this.BaseTool.Amount.formatter(text)
  516. }
  517. },
  518. {
  519. title: '费用类别',
  520. dataIndex: 'type',
  521. customRender: (text, record, index) => {
  522. return this.BaseTool.Object.getField(this.typeMap, text)
  523. }
  524. },
  525. {
  526. title: '费用原因',
  527. dataIndex: 'reason'
  528. },
  529. {
  530. title: '费用描述',
  531. dataIndex: 'descripition'
  532. },
  533. {
  534. title: '备注',
  535. dataIndex: 'remark'
  536. },
  537. {
  538. title: '操作',
  539. key: 'action',
  540. width: '200px',
  541. align: 'center',
  542. scopedSlots: { customRender: 'action' }
  543. }
  544. ],
  545. columnsVerifyRecord: [
  546. {
  547. title: '序号',
  548. dataIndex: 'index',
  549. width: '70px',
  550. customRender: (text, record, index) => {
  551. return `${index + 1}`
  552. }
  553. },
  554. {
  555. title: '审核人',
  556. dataIndex: 'createdUserName',
  557. width: '100px'
  558. },
  559. {
  560. title: '审核时间',
  561. dataIndex: 'createdTime',
  562. width: '150px'
  563. },
  564. {
  565. title: '审核类别',
  566. dataIndex: 'type',
  567. ellipsis: true,
  568. width: '100px',
  569. customRender: (text, record, index) => {
  570. if (text === 1) {
  571. return '维修审核'
  572. } else if (text === 2) {
  573. return '报修审核'
  574. }
  575. }
  576. },
  577. {
  578. title: '审核状态',
  579. dataIndex: 'status',
  580. ellipsis: true,
  581. width: '100px',
  582. customRender: (text, record, index) => {
  583. if (text === 1) {
  584. return '审核通过'
  585. } else if (text === 2) {
  586. return '审核拒绝'
  587. }
  588. }
  589. },
  590. {
  591. title: '审核意见',
  592. dataIndex: 'dataRemark',
  593. ellipsis: true,
  594. width: '150px'
  595. },
  596. {
  597. title: '操作',
  598. key: 'action',
  599. width: '200px',
  600. align: 'center',
  601. scopedSlots: { customRender: 'action' }
  602. }
  603. ],
  604. columnsRecord: [
  605. {
  606. title: '序号',
  607. dataIndex: 'index',
  608. width: '70px',
  609. customRender: (text, record, index) => {
  610. return `${index + 1}`
  611. }
  612. },
  613. {
  614. title: '维修人',
  615. dataIndex: 'createdUserName',
  616. ellipsis: true,
  617. width: '150px'
  618. },
  619. {
  620. title: '维修时间',
  621. dataIndex: 'createdTime',
  622. width: '150px'
  623. },
  624. {
  625. title: '结束时间',
  626. dataIndex: 'updateTime',
  627. width: '150px'
  628. },
  629. {
  630. title: '维修时长',
  631. dataIndex: 'repairHours',
  632. ellipsis: true,
  633. width: '100px'
  634. },
  635. /* {
  636. title: '维修建议',
  637. dataIndex: 'opinion',
  638. ellipsis: true,
  639. width: '150px'
  640. },
  641. {
  642. title: '维修描述',
  643. dataIndex: 'dataRemark',
  644. ellipsis: true,
  645. width: '150px'
  646. }, */
  647. {
  648. title: '操作',
  649. key: 'action',
  650. width: '200px',
  651. align: 'center',
  652. scopedSlots: { customRender: 'action' }
  653. }
  654. ],
  655. columnsRepairResolve: [
  656. {
  657. title: '序号',
  658. dataIndex: 'index',
  659. width: '70px',
  660. customRender: (text, record, index) => {
  661. return `${index + 1}`
  662. }
  663. },
  664. {
  665. title: '维修建议',
  666. dataIndex: 'opinion',
  667. width: '200px'
  668. },
  669. {
  670. title: '方案提供者',
  671. dataIndex: 'createdUserName',
  672. width: '120px'
  673. },
  674. {
  675. title: '方案提供时间',
  676. dataIndex: 'createdTime',
  677. ellipsis: true,
  678. width: '150px'
  679. },
  680. {
  681. title: '操作',
  682. key: 'action',
  683. width: '200px',
  684. align: 'center',
  685. scopedSlots: { customRender: 'action' }
  686. }
  687. ],
  688. columnsReason: [
  689. {
  690. title: '序号',
  691. dataIndex: 'index',
  692. width: '70px',
  693. customRender: (text, record, index) => {
  694. return `${index + 1}`
  695. }
  696. },
  697. {
  698. title: '分析时间',
  699. dataIndex: 'analyzeTime',
  700. width: '150px'
  701. },
  702. {
  703. title: '故障现象',
  704. dataIndex: 'problemDesc',
  705. ellipsis: true,
  706. width: '150px'
  707. },
  708. {
  709. title: '检查处理过程',
  710. dataIndex: 'checkProcess',
  711. ellipsis: true,
  712. width: '150px'
  713. },
  714. {
  715. title: '改进措施类别',
  716. dataIndex: 'type',
  717. ellipsis: true,
  718. width: '150px',
  719. customRender: (text, record, index) => {
  720. return this.BaseTool.Object.getField(this.typeReasonMap, text)
  721. }
  722. },
  723. {
  724. title: '改进内容',
  725. dataIndex: 'changeRepairPlanContent',
  726. ellipsis: true,
  727. width: '250px'
  728. },
  729. {
  730. title: '操作',
  731. key: 'action',
  732. width: '200px',
  733. align: 'center',
  734. scopedSlots: { customRender: 'action' }
  735. }
  736. ],
  737. typeReasonMap: {},
  738. model: {
  739. 'id': null,
  740. 'sbId': null,
  741. 'partId': null,
  742. 'repairUserId': null,
  743. 'needStop': null,
  744. 'category': null,
  745. 'no': null,
  746. 'source': null,
  747. 'applyTime': null,
  748. 'level': null,
  749. 'content': null,
  750. 'status': null,
  751. 'remark': null,
  752. 'updateTime': null,
  753. 'createdUserId': null,
  754. 'updateUserId': null,
  755. 'createdUserName': null,
  756. 'sbName': null,
  757. 'partName': null,
  758. 'limitHours': null,
  759. 'limitDate': null,
  760. 'updateUserName': null,
  761. 'repairFormVO': null,
  762. 'repairCheckVO': null,
  763. 'checkUserName': null,
  764. 'remarkTwo': null,
  765. 'repairMinutes': null,
  766. 'repairDeptId': null,
  767. 'userId': null,
  768. 'sbCph': null,
  769. 'actualUser': null,
  770. 'dispatchUserId': null,
  771. 'parentSbNo': null,
  772. 'sbPositionName': null,
  773. 'selfParentNo': null
  774. }
  775. }
  776. },
  777. created () {
  778. // 下拉框map
  779. this.sourceMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_SOURCE)
  780. this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_LEVEL)
  781. this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS)
  782. this.statusRepairMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_FORM_STATUS)
  783. this.statusCheckMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_CHECK_STATUS)
  784. this.needStopMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
  785. this.repairProjectMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_PROJECT_TYPE)
  786. this.repairTechnologyMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_TECHNOLOGY_TYPE)
  787. this.descripitionMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIRE_ACTION)
  788. this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_FEE_TYPE)
  789. this.typeReasonMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_REASON_TYPE)
  790. this.planFlagMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_CATEGORY)
  791. },
  792. methods: {
  793. base (record) {
  794. this.visible = true
  795. this.showSbFlag = false
  796. this.modalTitle = '详情'
  797. this.model = record
  798. this.activeKey = 'a'
  799. const sbId = record.sbId
  800. if (sbId) {
  801. fetchSbInfo({ id: sbId }).then(res => {
  802. this.sbInfo = res.data
  803. this.showSbFlag = true
  804. })
  805. }
  806. if (record.repairMinutes === null) {
  807. this.model.repairMinutes = '?'
  808. }
  809. this.init()
  810. },
  811. init () {
  812. queryRepairProject({ repairId: this.model.id }).then(res => {
  813. this.data = res.data
  814. })
  815. selectLongYanListByRepairId({ id: this.model.id }).then(res => {
  816. this.dataSpare = res.data
  817. })
  818. queryRepairFee({ repairId: this.model.id }).then(res => {
  819. this.dataFee = res.data
  820. })
  821. queryRepairReason({ repairId: this.model.id }).then(res => {
  822. this.dataReason = res.data
  823. })
  824. queryRepairRecord({ objId: this.model.id, remark: 'repair_record' }).then(res => {
  825. this.dataRecord = res.data.rows
  826. })
  827. queryRepairRecord({ objId: this.model.id, pageSize: 20, remark: 'repair_status_record' }).then(res => {
  828. this.repairStatus = res.data.rows
  829. })
  830. queryRepairRecord({ objId: this.model.id, remark: 'repair_verify_record' }).then(res => {
  831. this.dataVerifyRecord = res.data.rows
  832. })
  833. getRepairSchemePage({ repairId: this.model.id }).then(res => {
  834. this.dataRepairResolve = res.data.rows
  835. })
  836. },
  837. handleViewBom (record) {
  838. this.visible = false
  839. const modal = this.$refs.detailSbBomModal
  840. modal.base(this.sbInfo)
  841. },
  842. handleViewCheck (record) {
  843. this.visible = false
  844. const modal = this.$refs.detailSbCheckModal
  845. modal.base(this.sbInfo)
  846. },
  847. handleCancel () {
  848. this.visible = false
  849. this.current = 0
  850. this.confirmLoading = false
  851. this.$emit('ok')
  852. },
  853. handleOkUp (num) {
  854. if (num === 1) {
  855. this.handleOk()
  856. } else {
  857. this.handleCancel()
  858. }
  859. },
  860. handleAddSpare () {
  861. const id = this.model.sbId
  862. const routeUrl = this.$router.resolve({ path: '/spare/used/record', query: { id: id } })
  863. window.open(routeUrl.href, '_blank')
  864. },
  865. receive () {
  866. this.model.status = this.DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING
  867. receive(this.model).then(() => {
  868. })
  869. },
  870. batchDeleteFee (id) {
  871. let ids = []
  872. if (this.BaseTool.String.isBlank(id)) {
  873. const length = this.selectedRows.length
  874. if (length === 0) {
  875. this.$message.info('请选择要删除的记录')
  876. return
  877. }
  878. ids = this.selectedRows.map(item => item.id)
  879. } else {
  880. ids = [id]
  881. }
  882. deleteRepairFees(ids).then(res => {
  883. this.$message.info('删除成功')
  884. this.handleOk()
  885. })
  886. },
  887. handleOut () {
  888. const modal = this.$refs.outForm
  889. modal.base(null, this.model)
  890. },
  891. handleTransfer () {
  892. getSelfRole().then(res => {
  893. const modal = this.$refs.transferForm
  894. modal.base(this.model, res.data)
  895. })
  896. },
  897. handleAddFee () {
  898. const modal = this.$refs.feeForm
  899. modal.base(null, this.model)
  900. },
  901. handleEditFee (record) {
  902. fetchRepairFee({ id: record.id }).then(res => {
  903. const modal = this.$refs.feeForm
  904. const data = res.data
  905. data.repairNo = this.model.no
  906. modal.base(data, this.model)
  907. })
  908. },
  909. handleViewFee (record) {
  910. fetchRepairFee({ id: record.id }).then(res => {
  911. const modal = this.$refs.feeDetail
  912. modal.base(res.data)
  913. })
  914. },
  915. handleAddRepairResolve () {
  916. const modal = this.$refs.resolveBaseForm
  917. modal.base({ repairId: this.model.id, repairNo: this.model.no, errorContent: this.model.content, sbId: this.model.sbId })
  918. },
  919. handleAddRepairResolves () {
  920. const modal = this.$refs.schemeLibrary
  921. modal.base(this.model)
  922. },
  923. handleViewRepairResolve (record) {
  924. this.visible = false
  925. fetchRepairScheme({ id: record.id }).then(res => {
  926. const modal = this.$refs.resolveDetail
  927. modal.base(res.data)
  928. })
  929. },
  930. handleEditRepairResolve (record) {
  931. fetchRepairScheme({ id: record.id }).then(res => {
  932. const modal = this.$refs.resolveBaseForm
  933. const data = res.data
  934. modal.base(data)
  935. })
  936. },
  937. handleViewRecord (record) {
  938. this.visible = false
  939. fetchCustomDataForRepairRecord({ id: record.id }).then(res => {
  940. const modal = this.$refs.detailRepairRecord
  941. modal.base(res.data)
  942. })
  943. },
  944. handleViewTicket () {
  945. this.visible = false
  946. fetchRepairTicketRecord({ id: this.model.id }).then(res => {
  947. const modal = this.$refs.ticketForm
  948. modal.base(res.data)
  949. })
  950. },
  951. handleVerifyRecord (record) {
  952. this.visible = false
  953. fetchCustomDataForRepairRecord({ id: record.id }).then(res => {
  954. const modal = this.$refs.detailCheckNew
  955. modal.base(res.data)
  956. })
  957. },
  958. batchDeleteReason (id) {
  959. let ids = []
  960. if (this.BaseTool.String.isBlank(id)) {
  961. const length = this.selectedRows.length
  962. if (length === 0) {
  963. this.$message.info('请选择要删除的记录')
  964. return
  965. }
  966. ids = this.selectedRows.map(item => item.id)
  967. } else {
  968. ids = [id]
  969. }
  970. deleteRepairReasons(ids).then(res => {
  971. this.$message.info('删除成功')
  972. this.handleOk()
  973. this.$refs.table.clearSelected()
  974. })
  975. },
  976. handleAddReason () {
  977. const modal = this.$refs.reasonForm
  978. this.visible = false
  979. modal.base(null, this.model)
  980. },
  981. handleEditReason (record) {
  982. fetchRepairReason({ id: record.id }).then(res => {
  983. const modal = this.$refs.reasonForm
  984. this.visible = false
  985. modal.base(res.data, this.model)
  986. })
  987. },
  988. handleCopyReason (record) {
  989. fetchRepairReason({ id: record.id }).then(res => {
  990. const modal = this.$refs.reasonForm
  991. this.visible = false
  992. res.data.id = null
  993. modal.base(res.data, this.model)
  994. })
  995. },
  996. handleViewReason (record) {
  997. fetchRepairReason({ id: record.id }).then(res => {
  998. const modal = this.$refs.reasonDetail
  999. modal.base(res.data)
  1000. })
  1001. },
  1002. handleApprove () {
  1003. approve(this.model).then(() => {
  1004. this.$message.info('操作成功')
  1005. this.handleOk()
  1006. })
  1007. },
  1008. receiveRepair () {
  1009. const params = {}
  1010. params.id = this.model.id
  1011. params.repairDeptId = this.model.repairDeptId
  1012. params.applyTime = this.model.applyTime
  1013. params.userId = this.model.userId
  1014. params.no = this.model.no
  1015. receiveRepair(params).then(() => {
  1016. this.$message.info('接单成功')
  1017. this.handleOk()
  1018. })
  1019. },
  1020. reportRepair () {
  1021. const params = {}
  1022. params.id = this.model.id
  1023. params.repairDeptId = this.model.repairDeptId
  1024. params.applyTime = this.model.applyTime
  1025. params.userId = this.model.userId
  1026. params.no = this.model.no
  1027. params.sbId = this.model.sbId
  1028. params.sbCph = this.model.sbCph
  1029. params.actualUser = this.model.actualUser
  1030. params.content = this.model.content
  1031. params.repairUserId = this.model.repairUserId
  1032. params.remark = this.model.remark
  1033. params.reportHandleType = 2 // 维修上报
  1034. getSelfRole().then(res => {
  1035. const modal = this.$refs.reportUpForm
  1036. params.roleType = res.data
  1037. modal.base(params)
  1038. })
  1039. },
  1040. handleReportRepair () {
  1041. const params = {}
  1042. params.id = this.model.id
  1043. params.repairDeptId = this.model.repairDeptId
  1044. params.applyTime = this.model.applyTime
  1045. params.userId = this.model.userId
  1046. params.no = this.model.no
  1047. params.sbId = this.model.sbId
  1048. params.sbCph = this.model.sbCph
  1049. params.actualUser = this.model.actualUser
  1050. params.content = this.model.content
  1051. params.repairUserId = this.model.repairUserId
  1052. params.remark = this.model.remarkTwo
  1053. params.reportHandleType = 1 // 处理维修上报
  1054. getSelfRole().then(res => {
  1055. const modal = this.$refs.reportUpForm
  1056. params.roleType = res.data
  1057. modal.base(params)
  1058. })
  1059. },
  1060. handleEditRecord (record) {
  1061. this.visible = false
  1062. fetchCustomDataForRepairRecord({ id: record.id }).then(res => {
  1063. const modal = this.$refs.repairRecordForm
  1064. modal.base(res.data)
  1065. })
  1066. },
  1067. handleReturn () {
  1068. const modal = this.$refs.checkForm
  1069. modal.base(this.model, 1)
  1070. },
  1071. handleOk () {
  1072. this.loading = true
  1073. fetchRepairApplicationForm({ id: this.model.id }).then(res => {
  1074. this.loading = false
  1075. this.model = res.data
  1076. this.visible = true
  1077. })
  1078. this.init()
  1079. },
  1080. handleResolveOk () {
  1081. this.loading = true
  1082. this.visible = true
  1083. getRepairSchemePage({ repairId: this.model.id }).then(res => {
  1084. this.loading = false
  1085. this.dataRepairResolve = res.data.rows
  1086. })
  1087. },
  1088. handleRepairRecordOk () {
  1089. this.loading = true
  1090. this.visible = true
  1091. queryRepairRecord({ objId: this.model.id, remark: 'repair_record' }).then(res => {
  1092. this.loading = false
  1093. this.dataRecord = res.data.rows
  1094. })
  1095. fetchRepairApplicationForm({ id: this.model.id }).then(res => {
  1096. this.model = res.data
  1097. })
  1098. },
  1099. handleVerifyRecordOk () {
  1100. this.loading = true
  1101. this.visible = true
  1102. queryRepairRecord({ objId: this.model.id, remark: 'repair_verify_record' }).then(res => {
  1103. this.loading = false
  1104. this.dataVerifyRecord = res.data.rows
  1105. })
  1106. },
  1107. handleFinish () {
  1108. const modal = this.$refs.finishForm
  1109. modal.base(this.model)
  1110. },
  1111. handleExamine () {
  1112. const modal = this.$refs.checkForm
  1113. modal.base(this.model, 2)
  1114. },
  1115. handleDispatch () {
  1116. const modal = this.$refs.dispatchForm
  1117. modal.base(this.model)
  1118. },
  1119. handleAssign () {
  1120. getSelfRole().then(res => {
  1121. const roleType = res.data // 获取当前用户的角色
  1122. if (roleType === 4) {
  1123. const modal = this.$refs.reportUpForm
  1124. const params = {}
  1125. params.id = this.model.id
  1126. params.repairDeptId = this.model.repairDeptId
  1127. params.applyTime = this.model.applyTime
  1128. params.userId = this.model.userId
  1129. params.no = this.model.no
  1130. params.sbId = this.model.sbId
  1131. params.sbCph = this.model.sbCph
  1132. params.actualUser = this.model.actualUser
  1133. params.content = this.model.content
  1134. params.repairUserId = this.model.repairUserId
  1135. params.remark = this.model.remarkTwo
  1136. params.reportHandleType = 1 // 处理维修上报
  1137. params.roleType = 4
  1138. modal.base(params)
  1139. } else {
  1140. const modal = this.$refs.assignForm
  1141. modal.base(this.model)
  1142. }
  1143. })
  1144. },
  1145. handleSparePick () {
  1146. const modal = this.$refs.baseModal
  1147. modal.base(null, { repairId: this.model.id, repairNo: this.model.no, reason: '维修领用' })
  1148. },
  1149. changeTab (activeKey) {
  1150. this.activeKey = activeKey
  1151. if (this.activeKey === 'a' && this.BaseTool.Object.isNotBlank(this.$refs.sparePartUsedSelectTable)) {
  1152. const modal = this.$refs.sparePartUsedSelectTable
  1153. modal.handleOk()
  1154. return
  1155. }
  1156. if (this.activeKey === 'b' && this.BaseTool.Object.isNotBlank(this.$refs.sparePickFormSelectTable)) {
  1157. const modal = this.$refs.sparePickFormSelectTable
  1158. modal.handleOk()
  1159. }
  1160. },
  1161. handleView (record) {
  1162. fetchRepairProject({ id: record.id }).then(res => {
  1163. const modal = this.$refs.detailRepairProjectModal
  1164. modal.base(res.data)
  1165. })
  1166. },
  1167. handleEdit (record) {
  1168. const modal = this.$refs.editForm
  1169. modal.base(this.model)
  1170. },
  1171. handleRepairProjectAdd () {
  1172. this.$refs.baseRepairProjectModal.base({ repairId: this.model.id })
  1173. },
  1174. batchDelete (id) {
  1175. let ids = []
  1176. if (this.BaseTool.String.isBlank(id)) {
  1177. if (length === 0) {
  1178. this.$message.info('请选择要删除的记录')
  1179. return
  1180. }
  1181. ids = this.selectedRows.map(item => item.id)
  1182. } else {
  1183. ids = [id]
  1184. }
  1185. deleteRepairProjects(ids).then(res => {
  1186. this.$message.info('删除成功')
  1187. this.handleOk()
  1188. })
  1189. },
  1190. handleSpareSelect () {
  1191. this.$refs.spareSelectModal.base({}, { yt: 1 })
  1192. },
  1193. updateLongYanSpare (num) {
  1194. this.$refs.longYanSelectSpareForm.base({ isSpecial: num }, this.model)
  1195. },
  1196. /* handleSpareLongYanSelect (num) {
  1197. this.$refs.spareLongYanSelectModal.base({ isSpecial: num }, { isSpecial: num })
  1198. },
  1199. handleSpareLongYanSelected (record, keys, rows) {
  1200. const data = []
  1201. for (let i = 0; i < rows.length; i++) {
  1202. data.push({ sparePeriod: rows[i].sparePeriod, isSpecial: record.isSpecial, sbId: this.model.sbId, spareId: rows[i].id, repairId: this.model.id, num: 1, spareName: rows[i].spareName, ggxh: rows[i].ggxh })
  1203. }
  1204. addLongYanSparePartUsedBatch(data)
  1205. .then((response) => {
  1206. this.$message.info('更换成功')
  1207. this.handleOk()
  1208. }).catch(() => {
  1209. this.confirmLoading = false
  1210. })
  1211. }, */
  1212. handleSpareSelected (record, keys, rows) {
  1213. const data = []
  1214. for (let i = 0; i < rows.length; i++) {
  1215. data.push({ sbId: this.model.sbId, spareId: rows[i].id, repairId: this.model.id, num: 1, price: rows[i].initialValue, totalPrice: rows[i].initialValue })
  1216. }
  1217. addSparePartUsedBatch(data)
  1218. .then((response) => {
  1219. this.$message.info('添加成功')
  1220. this.handleOk()
  1221. }).catch(() => {
  1222. this.confirmLoading = false
  1223. })
  1224. },
  1225. batchDeleteSpare (id) {
  1226. let ids = []
  1227. if (this.BaseTool.String.isBlank(id)) {
  1228. if (length === 0) {
  1229. this.$message.info('请选择要删除的记录')
  1230. return
  1231. }
  1232. ids = this.selectedRows.map(item => item.id)
  1233. } else {
  1234. ids = [id]
  1235. }
  1236. deleteSparePartUseds(ids).then(res => {
  1237. this.$message.info('删除成功')
  1238. this.handleOk()
  1239. })
  1240. },
  1241. handleEditSpare (record) {
  1242. const modal = this.$refs.baseFormForRepair
  1243. modal.base(record)
  1244. },
  1245. updateSpare (record) {
  1246. updateSpare(record).then(res => {
  1247. this.$message.info('更换成功')
  1248. selectSparePartUsedListBySbId({ id: this.model.sbId }).then(res => {
  1249. this.dataSpare = res.data
  1250. })
  1251. })
  1252. },
  1253. handleSpareStoreSelect (isSpecial) {
  1254. this.$refs.spareStoreSelectModal.base({}, { repairFlag: 1, storeId: this.storeId, isSpecial: isSpecial, sbId: this.model.sbId })
  1255. },
  1256. handleSpareStoreSelected (record, keys, rows) {
  1257. const data = []
  1258. for (let i = 0; i < rows.length; i++) {
  1259. data.push({ isSpecial: record.isSpecial, sbId: this.model.sbId, spareId: rows[i].spareId, repairNo: this.model.no, repairId: this.model.id, num: 1, price: rows[i].price, totalPrice: rows[i].price, startDate: BaseTool.Date.formatter(new Date(), BaseTool.Date.PICKER_NORM_DATE_PATTERN) })
  1260. }
  1261. if (record.isSpecial === 1) {
  1262. updateSpare(data)
  1263. .then((response) => {
  1264. this.$message.info('更换成功')
  1265. this.handleOk()
  1266. }).catch(() => {
  1267. this.confirmLoading = false
  1268. })
  1269. } else {
  1270. addSparePartUsedBatch(data)
  1271. .then((response) => {
  1272. this.$message.info('更换成功')
  1273. this.handleOk()
  1274. }).catch(() => {
  1275. this.confirmLoading = false
  1276. })
  1277. }
  1278. },
  1279. onSelectChange (selectedRowKeys) {
  1280. console.log('selectedRowKeys changed: ', selectedRowKeys)
  1281. this.selectedRowKeys = selectedRowKeys
  1282. },
  1283. inited (viewer) {
  1284. this.$viewer = viewer
  1285. }
  1286. }
  1287. }
  1288. </script>
  1289. <style lang="less" scoped>
  1290. .gutter-box{
  1291. height: 350px;
  1292. }
  1293. .gutter-color{
  1294. background: #fff;
  1295. border: 1px solid #DDDDDD;
  1296. }
  1297. .gutter-btn{
  1298. height: 165px;
  1299. display: flex;
  1300. flex-direction: column;
  1301. justify-content: center;
  1302. align-items: center;
  1303. font-size: 50px;
  1304. color:#333;
  1305. &:hover{
  1306. cursor: pointer;
  1307. }
  1308. }
  1309. .act{
  1310. color:#3462FD;
  1311. }
  1312. .main{
  1313. margin-top:30px;
  1314. }
  1315. .title{
  1316. font-size: 28px;
  1317. font-family: PingFang SC;
  1318. font-weight: 500;
  1319. color: #3462FD;
  1320. padding:10px 42px;
  1321. border-bottom: 1px solid #DDDDDD;
  1322. }
  1323. .btn{
  1324. position: fixed;
  1325. bottom: 50px;
  1326. width: 100%;
  1327. display: flex;
  1328. justify-content: center;
  1329. }
  1330. .center{
  1331. display: flex;
  1332. justify-content: center;
  1333. align-items: center;
  1334. }
  1335. ::-webkit-scrollbar { width: 0; height: 0; color: transparent; }
  1336. </style>