DetailRepair.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. <template>
  2. <div>
  3. <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
  4. <a-row :gutter="48" slot="extra">
  5. <a-col :md="48" :sm="48">
  6. <span class="table-page-search-submitButtons" style="float: right">
  7. <a-button v-if="showSbFlag" style="margin-left: 16px" type="default" @ok="handleOk" @click="handleViewBom()">备件BOM</a-button>
  8. <a-button v-if="showSbFlag" style="margin-left: 16px" type="default" @ok="handleOk" @click="handleViewCheck()">保养项目</a-button>
  9. <a-button v-if="$auth('repair-application-forms-assign') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === model.status" type="primary" @click="handleAssign">派工</a-button>
  10. <a-popconfirm v-if="$auth('repair-application-forms-deal') && (DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.ALLOCATED === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)" title="是否要接收?" @confirm="receive">
  11. <a-button style="margin-left: 8px" style="margin-left: 16px">接收</a-button>
  12. </a-popconfirm>
  13. <a-button v-if="$auth('repair-application-forms-out') && (DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING >= model.status) && model.type != 2" style="margin-left: 8px" type="primary" @click="handleOut">委外</a-button>
  14. <a-button v-if="$auth('repair-application-forms-dispatch') && (DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.ALLOCATED === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)" style="margin-left: 8px" type="primary" @click="handleDispatch">转派</a-button>
  15. <a-button v-if="$auth('repair-application-forms-finish') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status" style="margin-left: 8px" type="primary" @click="handleFinish()">维修完成</a-button>
  16. <a-popconfirm v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.WAIT_SUBMIT === model.status" title="是否要提交审核该条数据?" @confirm="handleExamine">
  17. <a-button style="margin-left: 8px" type="primary">提交审核</a-button>
  18. </a-popconfirm>
  19. <a-button style="margin-left: 8px" @click="handleCancel">返回</a-button>
  20. </span>
  21. </a-col>
  22. </a-row>
  23. <a-layout>
  24. <a-layout-content style="background-color: rgb(255, 255, 255)">
  25. <a-divider orientation="left">报修详情</a-divider>
  26. <detail-list title="" :col="3">
  27. <detail-list-item term="报修单号">{{ model.no }}</detail-list-item>
  28. <detail-list-item term="设备编号">{{ model.sbNo }}</detail-list-item>
  29. <detail-list-item term="设备名称">{{ model.sbName }}</detail-list-item>
  30. <detail-list-item term="预留维修时间">{{ model.limitHours }}</detail-list-item>
  31. <detail-list-item term="使用位置">{{ model.sbCph }}</detail-list-item>
  32. <detail-list-item term="是否停机">{{ BaseTool.Object.getField(needStopMap,model.needStop) }}</detail-list-item>
  33. <detail-list-item term="报修人">{{ model.actualUser }}</detail-list-item>
  34. <detail-list-item term="报修来源">{{ BaseTool.Object.getField(this.sourceMap, model.source) }}</detail-list-item>
  35. <detail-list-item term="紧急等级"><badge :text="BaseTool.Object.getField(levelMap,model.level)" :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_LEVEL[model.applicationLevel]"/></detail-list-item>
  36. <detail-list-item term="报修时间">{{ model.applyTime }}</detail-list-item>
  37. <detail-list-item term="报修状态"><badge :text="BaseTool.Object.getField(statusMap,model.status)" :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_STATUS[model.status]"/></detail-list-item>
  38. </detail-list>
  39. <detail-list title="" :col="1">
  40. <!--<detail-list-item term="故障描述">{{ BaseTool.Object.getField(this.descripitionMap, model.content) }}</detail-list-item>-->
  41. <detail-list-item term="故障描述">{{ model.content }}</detail-list-item>
  42. </detail-list>
  43. <detail-list title="报修图片:" :col="6">
  44. <upload-image-detail :images-list="model.applicationFileList"/>
  45. </detail-list>
  46. <a-divider orientation="left">维修详情</a-divider>
  47. <detail-list title="" :col="3">
  48. <detail-list-item term="故障类别">{{ model.repairErrorTypeName }}</detail-list-item>
  49. <detail-list-item term="维修开始时间">{{ model.repairStartTime }}</detail-list-item>
  50. <detail-list-item term="维修结束时间">{{ model.repairEndTime }}</detail-list-item>
  51. <detail-list-item term="维修耗时">{{ model.repairMinutes }}</detail-list-item>
  52. <detail-list-item term="维修人员">{{ model.repairUserName }}</detail-list-item>
  53. <!--<detail-list-item term="维修次数">{{ model.repairTimes }}</detail-list-item>-->
  54. </detail-list>
  55. <detail-list title="" :col="1">
  56. <detail-list-item term="维修描述">{{ model.repairContent }}</detail-list-item>
  57. </detail-list>
  58. <detail-list title="维修图片:" :col="6">
  59. <upload-image-detail :images-list="model.repairFileList"/>
  60. </detail-list>
  61. <a-divider v-if="dispatchList != null" orientation="left">转派详情</a-divider>
  62. <detail-list v-for="item in dispatchList" title="" :col="3">
  63. <detail-list-item term="转派人">{{ item.username }}</detail-list-item>
  64. <detail-list-item term="转派时间">{{ item.time }}</detail-list-item>
  65. <detail-list-item term="转派备注">{{ item.remark }}</detail-list-item>
  66. </detail-list>
  67. <a-divider orientation="left">验收详情</a-divider>
  68. <detail-list title="" :col="3">
  69. <detail-list-item term="验收开始时间">{{ model.checkStartTime }}</detail-list-item>
  70. <detail-list-item term="验收结束时间">{{ model.checkEndTime }}</detail-list-item>
  71. <detail-list-item term="验收人员">{{ model.checkUserName }}</detail-list-item>
  72. <detail-list-item term="验收描述">{{ model.checkContent }}</detail-list-item>
  73. </detail-list>
  74. <detail-list title="验收图片:" :col="6">
  75. <upload-image-detail :images-list="model.checkFileList"/>
  76. </detail-list>
  77. </a-layout-content>
  78. <a-layout-sider style="background-color: rgb(255, 255, 255)">
  79. <div style="margin-top: 30px;margin-left: 30px;">
  80. <a-steps progress-dot :current="6" direction="vertical" >
  81. <a-step title="报修时间:" :description="''+model.applyTime?model.applyTime:''" />
  82. <a-step title="维修开始时间:" :description="''+model.repairStartTime?model.repairStartTime:''" />
  83. <a-step title="维修结束时间:" :description="''+model.repairEndTime?model.repairEndTime:''" />
  84. <a-step title="验收开始时间:" :description="''+model.checkStartTime?model.checkStartTime:''" />
  85. <a-step title="验收结束时间:" :description="''+model.checkEndTime?model.checkEndTime:''" />
  86. </a-steps>
  87. </div>
  88. </a-layout-sider>
  89. </a-layout>
  90. <title-divider title="备件清单" width="90px"></title-divider>
  91. <div class="table-operator" v-if="$auth('repair-application-forms-finish')">
  92. <a-button type="primary" @click="handleSpareStoreSelect">
  93. <a-icon type="plus"/>
  94. 添加
  95. </a-button>
  96. </div>
  97. <a-table
  98. :data-source="dataSpare"
  99. :columns="columnsSpare"
  100. :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  101. tableLayout="auto"
  102. rowKey="id">
  103. <span slot="actionSpare" slot-scope="record">
  104. <template>
  105. <a v-if="$auth('repair-application-forms-finish')" @click="handleEditSpare(record)">修改</a>
  106. <a-divider type="vertical" />
  107. <a-popconfirm v-if="$auth('repair-application-forms-finish')" title="是否要删除该条数据?" @confirm="batchDeleteSpare(record.id)">
  108. <a>删除</a>
  109. </a-popconfirm>
  110. </template>
  111. </span>
  112. </a-table>
  113. <!-- <title-divider title="费用清单" width="90px" v-if="model.type == 2"></title-divider>-->
  114. <!-- <div class="table-operator" 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) && model.type === 2">-->
  115. <!-- <a-button type="primary" @click="handleAddFee">-->
  116. <!-- <a-icon type="plus"/>-->
  117. <!-- 添加-->
  118. <!-- </a-button>-->
  119. <!-- </div>-->
  120. <!-- <a-table-->
  121. <!-- v-if="model.type == 2"-->
  122. <!-- :data-source="dataFee"-->
  123. <!-- :columns="columnsFee"-->
  124. <!-- tableLayout="auto"-->
  125. <!-- rowKey="id">-->
  126. <!-- <span slot="action" slot-scope="record">-->
  127. <!-- <template>-->
  128. <!-- <a @click="handleViewFee(record)">查看</a>-->
  129. <!-- <operation-button-->
  130. <!-- 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)"-->
  131. <!-- @click="handleEditFee(record)" >修改</operation-button>-->
  132. <!-- <operation-button-->
  133. <!-- 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)"-->
  134. <!-- :type="2"-->
  135. <!-- title="确认删除该笔费用?"-->
  136. <!-- @confirm="batchDeleteFee(record.id)" >删除</operation-button>-->
  137. <!-- </template>-->
  138. <!-- </span>-->
  139. <!-- </a-table>-->
  140. <title-divider title="原因分析" width="90px"></title-divider>
  141. <div class="table-operator" 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)">
  142. <a-button type="primary" @click="handleAddReason">
  143. <a-icon type="plus"/>
  144. 添加
  145. </a-button>
  146. </div>
  147. <a-table
  148. :data-source="dataReason"
  149. :columns="columnsReason"
  150. :scroll="{x: 1, y: BaseTool.Constant.scrollY }"
  151. rowKey="id">
  152. <span slot="action" slot-scope="record">
  153. <template>
  154. <a @click="handleViewReason(record)">查看</a>
  155. <operation-button
  156. 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)"
  157. @click="handleEditReason(record)" >修改</operation-button>
  158. <operation-button
  159. 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)"
  160. :type="2"
  161. title="确认删除该记录?"
  162. @confirm="batchDeleteReason(record.id)" >删除</operation-button>
  163. </template>
  164. </span>
  165. </a-table>
  166. <!-- <q-tabs :activeKey="activeKey" @change="changeTab">
  167. <q-tab-pane key="a" tab="配件更换">
  168. <spare-part-used-select-table :type="2" :table-params="{sbId: model.sbId, modelId: model.modelId, repairId: model.id}" ref="sparePartUsedSelectTable"/>
  169. </q-tab-pane>
  170. <q-tab-pane key="b" tab="备件领用">
  171. <spare-pick-form-select-table :type="2" :table-params="{repairId: model.id, repairNo: model.no}" ref="sparePickFormSelectTable"/>
  172. </q-tab-pane>
  173. </q-tabs>-->
  174. </a-card>
  175. <check-form ref="checkForm" @ok="handleOk" />
  176. <base-out-form ref="outForm" @ok="handleCancel" />
  177. <finish-form ref="finishForm" @ok="handleOk" />
  178. <dispatch-form ref="dispatchForm" @ok="handleCancel" />
  179. <assign-form ref="assignForm" @ok="handleCancel" />
  180. <spare-pick-base-form ref="baseModal" @ok="handleOk"/>
  181. <base-form-for-repair ref="baseFormForRepair" @ok="handleOk" />
  182. <spare-store-select-modal ref="spareStoreSelectModal" @selected="handleSpareStoreSelected"/>
  183. <fee-base-form ref="feeForm" @ok="handleOk" />
  184. <fee-detail ref="feeDetail" @ok="handleOk" />
  185. <reason-base-form ref="reasonForm" @ok="handleOk" />
  186. <reason-detail ref="reasonDetail" @ok="handleOk" />
  187. <detail-sb-bom ref="detailSbBomModal" @ok="handleOk"/>
  188. <detail-sb-check ref="detailSbCheckModal" @ok="handleOk"/>
  189. <base-form ref="baseRepairProjectModal" @ok="handleOk"/>
  190. <detail ref="detailRepairProjectModal"/>
  191. </div>
  192. </template>
  193. <script>
  194. import DetailList from '@/components/tools/DetailList'
  195. import { fetchRepairApplicationForm, examine, approve, receive } from '@/api/repair/application-form'
  196. import CheckForm from './CheckForm'
  197. import BaseOutForm from './BaseOutForm'
  198. import FinishForm from './FinishForm'
  199. import DispatchForm from './DispatchForm'
  200. import AssignForm from './AssignForm'
  201. import SparePickBaseForm from '../../../store/sparepickform/modules/BaseForm'
  202. import SparePartUsedSelectTable from '@/views/sqarepartmanage/sparepartused/modules/SparePartUsedSelectTable'
  203. import SparePickFormSelectTable from '@/views/store/sparepickform/modules/SparePickFormSelectTable'
  204. import RepairProjectSelectModal from '@/views/repair/repairproject/modules/RepairProjectSelectModal'
  205. import { queryRepairProject, fetchRepairProject, deleteRepairProjects } from '@/api/repair/repairproject'
  206. import SparePartInfoSelectModal from '@/views/sqarepartmanage/sparepartinfo/modules/SparePartInfoSelectModal'
  207. import BaseFormForRepair from '@/views/sqarepartmanage/sparepartused/modules/BaseFormForRepair'
  208. import { selectSparePartUsedListByRepairId, addSparePartUsedBatch, deleteSparePartUseds } from '@/api/sqarepartmanage/sparepartused'
  209. import SpareStoreSelectModal from '@/views/store/sparestore/modules/SpareStoreSelectModal'
  210. import BaseTool from '@/utils/tool'
  211. import FeeBaseForm from '@/views/repair/fee/modules/BaseForm'
  212. import FeeDetail from '@/views/repair/fee/modules/Detail'
  213. import { deleteRepairFees, fetchRepairFee, queryRepairFee } from '@/api/repair/fee'
  214. import ReasonBaseForm from '@/views/repair/repair-reason/modules/BaseForm'
  215. import ReasonDetail from '@/views/repair/repair-reason/modules/Detail'
  216. import { deleteRepairReasons, fetchRepairReason, queryRepairReason } from '@/api/repair/repair-reason'
  217. import DetailSbBom from '@/views/sb/modelbom/modules/DetailSbBom'
  218. import DetailSbCheck from '@/views/check/checkstandard/modules/DetailSbCheck'
  219. import { fetchSbInfo } from '@/api/sb/info'
  220. import BaseForm from '@/views/repair/repairproject/modules/BaseForm'
  221. import Detail from '@/views/repair/repairproject/modules/Detail'
  222. const DetailListItem = DetailList.Item
  223. export default {
  224. name: 'RepairApplicationFormDetail',
  225. components: {
  226. CheckForm,
  227. DetailList,
  228. DetailSbCheck,
  229. DetailSbBom,
  230. ReasonBaseForm,
  231. ReasonDetail,
  232. DetailListItem,
  233. FinishForm,
  234. BaseOutForm,
  235. DispatchForm,
  236. FeeDetail,
  237. AssignForm,
  238. FeeBaseForm,
  239. SparePickBaseForm,
  240. SparePartUsedSelectTable,
  241. SparePickFormSelectTable,
  242. RepairProjectSelectModal,
  243. SparePartInfoSelectModal,
  244. BaseFormForRepair,
  245. SpareStoreSelectModal,
  246. BaseForm,
  247. Detail
  248. },
  249. data () {
  250. return {
  251. confirmLoading: false,
  252. mdl: {},
  253. modalTitle: null,
  254. needStopMap: {},
  255. dispatchList: [],
  256. visible: false,
  257. showSbFlag: false,
  258. sbInfo: {},
  259. // 下拉框map
  260. sourceMap: {},
  261. typeMap: {},
  262. levelMap: {},
  263. descripitionMap: {},
  264. selectedRowKeys: [],
  265. statusMap: {},
  266. repairProjectMap: {},
  267. repairTechnologyMap: {},
  268. activeKey: 'a',
  269. data: [],
  270. dataSpare: [],
  271. dataFee: [],
  272. dataReason: [],
  273. // 表头
  274. columns: [
  275. {
  276. title: '序号',
  277. dataIndex: 'index',
  278. customRender: (text, record, index) => {
  279. return `${index + 1}`
  280. }
  281. },
  282. {
  283. title: '维修内容',
  284. dataIndex: 'name'
  285. },
  286. {
  287. title: '操作',
  288. key: 'action',
  289. width: '200px',
  290. align: 'center',
  291. scopedSlots: { customRender: 'action' }
  292. }
  293. ],
  294. columnsSpare: [
  295. {
  296. title: '序号',
  297. dataIndex: 'index',
  298. customRender: (text, record, index) => {
  299. return `${index + 1}`
  300. }
  301. },
  302. {
  303. title: '备件名称',
  304. dataIndex: 'spareId',
  305. customRender: (text, record, index) => {
  306. return record.spareName
  307. }
  308. },
  309. {
  310. title: '数量',
  311. dataIndex: 'num'
  312. },
  313. {
  314. title: '价格',
  315. dataIndex: 'price'
  316. },
  317. {
  318. title: '总价',
  319. dataIndex: 'totalPrice'
  320. },
  321. {
  322. title: '更换日期',
  323. dataIndex: 'startDate'
  324. },
  325. {
  326. title: '操作',
  327. key: 'action',
  328. width: '200px',
  329. align: 'center',
  330. scopedSlots: { customRender: 'actionSpare' }
  331. }
  332. ],
  333. columnsFee: [
  334. {
  335. title: '序号',
  336. dataIndex: 'index',
  337. customRender: (text, record, index) => {
  338. return `${index + 1}`
  339. }
  340. },
  341. {
  342. title: '费用金额',
  343. dataIndex: 'fee',
  344. customRender: (text, record, index) => {
  345. return this.BaseTool.Amount.formatter(text)
  346. }
  347. },
  348. {
  349. title: '费用类别',
  350. dataIndex: 'type',
  351. customRender: (text, record, index) => {
  352. return this.BaseTool.Object.getField(this.typeMap, text)
  353. }
  354. },
  355. {
  356. title: '费用原因',
  357. dataIndex: 'reason'
  358. },
  359. {
  360. title: '费用描述',
  361. dataIndex: 'descripition'
  362. },
  363. {
  364. title: '备注',
  365. dataIndex: 'remark'
  366. },
  367. {
  368. title: '操作',
  369. key: 'action',
  370. width: '200px',
  371. align: 'center',
  372. scopedSlots: { customRender: 'action' }
  373. }
  374. ],
  375. columnsReason: [
  376. {
  377. title: '序号',
  378. dataIndex: 'index',
  379. width: '70px',
  380. customRender: (text, record, index) => {
  381. return `${index + 1}`
  382. }
  383. },
  384. {
  385. title: '分析时间',
  386. dataIndex: 'analyzeTime',
  387. width: '150px'
  388. },
  389. {
  390. title: '故障现象',
  391. dataIndex: 'problemDesc',
  392. ellipsis: true,
  393. width: '150px'
  394. },
  395. {
  396. title: '检查处理过程',
  397. dataIndex: 'checkProcess',
  398. ellipsis: true,
  399. width: '150px'
  400. },
  401. {
  402. title: '原因分析',
  403. dataIndex: 'reasonAnalysis',
  404. ellipsis: true,
  405. width: '150px'
  406. },
  407. {
  408. title: '操作',
  409. key: 'action',
  410. width: '200px',
  411. align: 'center',
  412. scopedSlots: { customRender: 'action' }
  413. }
  414. ],
  415. model: {
  416. 'id': null,
  417. 'sbId': null,
  418. 'partId': null,
  419. 'repairUserId': null,
  420. 'needStop': null,
  421. 'no': null,
  422. 'source': null,
  423. 'applyTime': null,
  424. 'level': null,
  425. 'content': null,
  426. 'status': null,
  427. 'remark': null,
  428. 'updateTime': null,
  429. 'createdUserId': null,
  430. 'updateUserId': null,
  431. 'createdUserName': null,
  432. 'sbName': null,
  433. 'partName': null,
  434. 'updateUserName': null,
  435. 'repairFormVO': null,
  436. 'repairCheckVO': null
  437. }
  438. }
  439. },
  440. created () {
  441. // 下拉框map
  442. this.sourceMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_SOURCE)
  443. this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_LEVEL)
  444. this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS)
  445. this.statusRepairMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_FORM_STATUS)
  446. this.statusCheckMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_CHECK_STATUS)
  447. this.needStopMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
  448. this.repairProjectMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_PROJECT_TYPE)
  449. this.repairTechnologyMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_TECHNOLOGY_TYPE)
  450. this.descripitionMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIRE_ACTION)
  451. this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_FEE_TYPE)
  452. },
  453. methods: {
  454. base (record) {
  455. this.visible = true
  456. this.showSbFlag = false
  457. this.modalTitle = '详情'
  458. this.model = record
  459. this.activeKey = 'a'
  460. this.dispatchList = JSON.parse(record.repairDispatchList)
  461. const sbId = record.sbId
  462. if (sbId) {
  463. fetchSbInfo({ id: sbId }).then(res => {
  464. this.sbInfo = res.data
  465. this.showSbFlag = true
  466. })
  467. }
  468. this.init()
  469. },
  470. init () {
  471. queryRepairProject({ repairId: this.model.id }).then(res => {
  472. this.data = res.data
  473. })
  474. selectSparePartUsedListByRepairId({ id: this.model.id }).then(res => {
  475. this.dataSpare = res.data
  476. })
  477. queryRepairFee({ repairId: this.model.id }).then(res => {
  478. this.dataFee = res.data
  479. })
  480. queryRepairReason({ repairId: this.model.id }).then(res => {
  481. this.dataReason = res.data
  482. })
  483. },
  484. handleViewBom (record) {
  485. this.visible = false
  486. const modal = this.$refs.detailSbBomModal
  487. modal.base(this.sbInfo)
  488. },
  489. handleViewCheck (record) {
  490. this.visible = false
  491. const modal = this.$refs.detailSbCheckModal
  492. modal.base(this.sbInfo)
  493. },
  494. handleCancel () {
  495. this.visible = false
  496. this.confirmLoading = false
  497. this.$emit('ok')
  498. },
  499. receive () {
  500. this.model.status = 3
  501. receive(this.model).then(() => {
  502. // const modal = this.$refs.finishForm
  503. // modal.base(that.model)
  504. })
  505. },
  506. batchDeleteFee (id) {
  507. let ids = []
  508. if (this.BaseTool.String.isBlank(id)) {
  509. const length = this.selectedRows.length
  510. if (length === 0) {
  511. this.$message.info('请选择要删除的记录')
  512. return
  513. }
  514. ids = this.selectedRows.map(item => item.id)
  515. } else {
  516. ids = [id]
  517. }
  518. deleteRepairFees(ids).then(res => {
  519. this.$message.info('删除成功')
  520. this.handleOk()
  521. })
  522. },
  523. handleOut () {
  524. const modal = this.$refs.outForm
  525. modal.base(null, this.model)
  526. },
  527. handleAddFee () {
  528. const modal = this.$refs.feeForm
  529. modal.base(null, this.model)
  530. },
  531. handleEditFee (record) {
  532. fetchRepairFee({ id: record.id }).then(res => {
  533. const modal = this.$refs.feeForm
  534. const data = res.data
  535. data.repairNo = this.model.no
  536. modal.base(data, this.model)
  537. })
  538. },
  539. handleViewFee (record) {
  540. fetchRepairFee({ id: record.id }).then(res => {
  541. const modal = this.$refs.feeDetail
  542. modal.base(res.data)
  543. })
  544. },
  545. batchDeleteReason (id) {
  546. let ids = []
  547. if (this.BaseTool.String.isBlank(id)) {
  548. const length = this.selectedRows.length
  549. if (length === 0) {
  550. this.$message.info('请选择要删除的记录')
  551. return
  552. }
  553. ids = this.selectedRows.map(item => item.id)
  554. } else {
  555. ids = [id]
  556. }
  557. deleteRepairReasons(ids).then(res => {
  558. this.$message.info('删除成功')
  559. this.handleOk()
  560. this.$refs.table.clearSelected()
  561. })
  562. },
  563. handleAddReason () {
  564. const modal = this.$refs.reasonForm
  565. this.visible = false
  566. modal.base(null, this.model)
  567. },
  568. handleEditReason (record) {
  569. fetchRepairReason({ id: record.id }).then(res => {
  570. const modal = this.$refs.reasonForm
  571. this.visible = false
  572. modal.base(res.data, this.model)
  573. })
  574. },
  575. handleViewReason (record) {
  576. fetchRepairReason({ id: record.id }).then(res => {
  577. const modal = this.$refs.reasonDetail
  578. modal.base(res.data)
  579. })
  580. },
  581. handleApprove () {
  582. approve(this.model).then(() => {
  583. this.$message.info('操作成功')
  584. this.handleOk()
  585. })
  586. },
  587. handleReturn () {
  588. const modal = this.$refs.checkForm
  589. modal.base(this.model)
  590. },
  591. handleOk () {
  592. this.loading = true
  593. fetchRepairApplicationForm({ id: this.model.id }).then(res => {
  594. this.loading = false
  595. this.model = res.data
  596. this.visible = true
  597. this.dispatchList = JSON.parse(this.model.repairDispatchList)
  598. })
  599. this.init()
  600. },
  601. handleFinish () {
  602. const modal = this.$refs.finishForm
  603. modal.base(this.model)
  604. },
  605. handleExamine () {
  606. examine({ id: this.model.id }).then(res => {
  607. this.loading = false
  608. this.visible = true
  609. this.model.status = this.DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.EXAMINING
  610. this.$message.info('已提交,请等待审核')
  611. })
  612. this.init()
  613. },
  614. handleDispatch () {
  615. const modal = this.$refs.dispatchForm
  616. modal.base(this.model)
  617. },
  618. handleAssign () {
  619. const modal = this.$refs.assignForm
  620. modal.base(this.model)
  621. },
  622. handleSparePick () {
  623. const modal = this.$refs.baseModal
  624. modal.base(null, { repairId: this.model.id, repairNo: this.model.no, reason: '维修领用' })
  625. },
  626. changeTab (activeKey) {
  627. this.activeKey = activeKey
  628. if (this.activeKey === 'a' && this.BaseTool.Object.isNotBlank(this.$refs.sparePartUsedSelectTable)) {
  629. const modal = this.$refs.sparePartUsedSelectTable
  630. modal.handleOk()
  631. return
  632. }
  633. if (this.activeKey === 'b' && this.BaseTool.Object.isNotBlank(this.$refs.sparePickFormSelectTable)) {
  634. const modal = this.$refs.sparePickFormSelectTable
  635. modal.handleOk()
  636. }
  637. },
  638. handleView (record) {
  639. fetchRepairProject({ id: record.id }).then(res => {
  640. const modal = this.$refs.detailRepairProjectModal
  641. modal.base(res.data)
  642. })
  643. },
  644. handleEdit (record) {
  645. fetchRepairProject({ id: record.id }).then(res => {
  646. const modal = this.$refs.baseRepairProjectModal
  647. modal.base(res.data)
  648. })
  649. },
  650. handleRepairProjectAdd () {
  651. this.$refs.baseRepairProjectModal.base({ repairId: this.model.id })
  652. },
  653. batchDelete (id) {
  654. let ids = []
  655. if (this.BaseTool.String.isBlank(id)) {
  656. if (length === 0) {
  657. this.$message.info('请选择要删除的记录')
  658. return
  659. }
  660. ids = this.selectedRows.map(item => item.id)
  661. } else {
  662. ids = [id]
  663. }
  664. deleteRepairProjects(ids).then(res => {
  665. this.$message.info('删除成功')
  666. this.handleOk()
  667. })
  668. },
  669. handleSpareSelect () {
  670. this.$refs.spareSelectModal.base({}, { yt: 1 })
  671. },
  672. handleSpareSelected (record, keys, rows) {
  673. const data = []
  674. for (let i = 0; i < rows.length; i++) {
  675. data.push({ sbId: this.model.sbId, spareId: rows[i].id, repairId: this.model.id, num: 1, price: rows[i].initialValue, totalPrice: rows[i].initialValue })
  676. }
  677. addSparePartUsedBatch(data)
  678. .then((response) => {
  679. this.$message.info('添加成功')
  680. this.handleOk()
  681. }).catch(() => {
  682. this.confirmLoading = false
  683. })
  684. },
  685. batchDeleteSpare (id) {
  686. let ids = []
  687. if (this.BaseTool.String.isBlank(id)) {
  688. if (length === 0) {
  689. this.$message.info('请选择要删除的记录')
  690. return
  691. }
  692. ids = this.selectedRows.map(item => item.id)
  693. } else {
  694. ids = [id]
  695. }
  696. deleteSparePartUseds(ids).then(res => {
  697. this.$message.info('删除成功')
  698. this.handleOk()
  699. })
  700. },
  701. handleEditSpare (record) {
  702. const modal = this.$refs.baseFormForRepair
  703. modal.base(record)
  704. },
  705. handleSpareStoreSelect () {
  706. this.$refs.spareStoreSelectModal.base({}, { storeId: this.storeId })
  707. },
  708. handleSpareStoreSelected (record, keys, rows) {
  709. const data = []
  710. for (let i = 0; i < rows.length; i++) {
  711. data.push({ sbId: this.model.sbId, spareId: rows[i].spareId, 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) })
  712. }
  713. addSparePartUsedBatch(data)
  714. .then((response) => {
  715. this.$message.info('添加成功')
  716. this.handleOk()
  717. }).catch(() => {
  718. this.confirmLoading = false
  719. })
  720. },
  721. onSelectChange (selectedRowKeys) {
  722. console.log('selectedRowKeys changed: ', selectedRowKeys)
  723. this.selectedRowKeys = selectedRowKeys
  724. }
  725. }
  726. }
  727. </script>