DetailRepair.vue 30 KB

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