DetailRepair.vue 37 KB

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