DetailRepair.vue 30 KB

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