DetailRepair.vue 29 KB

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