DetailRepair.vue 36 KB

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