DetailRepair.vue 32 KB

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