index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. <template>
  2. <div class="goodInfo layout-pd" >
  3. <!--部件详情-->
  4. <el-row>
  5. <!-- 基础信息 -->
  6. <el-col :xs="24" >
  7. <el-card shadow="hover" header="基础信息">
  8. <div class="basicInformation" v-loading="goods.loadingBasic">
  9. <div class="basicInformation-left">
  10. <div class="item ">
  11. <el-popover
  12. placement="top-start"
  13. :width="200"
  14. title="物料名称"
  15. trigger="hover"
  16. :content="goods.basicInformation.bomName"
  17. >
  18. <template #reference>
  19. <span class="m-2"> 物料名称: {{goods.basicInformation.bomName}}</span>
  20. </template>
  21. </el-popover>
  22. </div>
  23. <div class="item">
  24. <el-popover
  25. placement="top-start"
  26. :width="200"
  27. title="物料号"
  28. trigger="hover"
  29. :content="goods.basicInformation.bomNo"
  30. >
  31. <template #reference>
  32. <span class="m-2"> 物料号: {{goods.basicInformation.bomNo}}</span>
  33. </template>
  34. </el-popover>
  35. </div>
  36. <div class="item">
  37. <el-popover
  38. placement="top-start"
  39. :width="200"
  40. title="CPUID"
  41. trigger="hover"
  42. :content="goods.basicInformation.cpuId"
  43. >
  44. <template #reference>
  45. <span class="m-2"> CPUID: {{goods.basicInformation.cpuId}}</span>
  46. </template>
  47. </el-popover>
  48. </div>
  49. <div class="item">
  50. <el-popover
  51. placement="top-start"
  52. :width="200"
  53. title="软件版本"
  54. trigger="hover"
  55. :content="goods.basicInformation.software_v"
  56. >
  57. <template #reference>
  58. <span class="m-2"> 软件版本: {{goods.basicInformation.software_v}}</span>
  59. </template>
  60. </el-popover>
  61. </div>
  62. <div class="item">
  63. <el-popover
  64. placement="top-start"
  65. :width="200"
  66. title="状态"
  67. trigger="hover"
  68. :content="goods.basicInformation.status"
  69. >
  70. <template #reference>
  71. <span class="m-2"> 状态: {{goods.basicInformation.status}}</span>
  72. </template>
  73. </el-popover>
  74. </div>
  75. <div class="item">
  76. <el-popover
  77. placement="top-start"
  78. :width="200"
  79. title="密钥状态"
  80. trigger="hover"
  81. :content="goods.basicInformation.key_name"
  82. >
  83. <template #reference>
  84. <span class="m-2"> 密钥状态: {{goods.basicInformation.key_name}}</span>
  85. </template>
  86. </el-popover>
  87. </div>
  88. <div class="item">
  89. <el-popover
  90. placement="top-start"
  91. :width="200"
  92. title="团标状态"
  93. trigger="hover"
  94. :content="goods.basicInformation.stand_name"
  95. >
  96. <template #reference>
  97. <span class="m-2"> 团标状态: {{goods.basicInformation.stand_name}}</span>
  98. </template>
  99. </el-popover>
  100. </div>
  101. <div class="item">
  102. <el-popover
  103. placement="top-start"
  104. :width="200"
  105. title="创建时间"
  106. trigger="hover"
  107. :content="goods.basicInformation.createTime"
  108. >
  109. <template #reference>
  110. <span class="m-2"> 创建时间: {{goods.basicInformation.createTime}}</span>
  111. </template>
  112. </el-popover>
  113. </div>
  114. <div class="item">
  115. <el-popover
  116. placement="top-start"
  117. :width="200"
  118. trigger="hover"
  119. title="备注"
  120. :content="goods.basicInformation.remark"
  121. >
  122. <template #reference>
  123. <span class="m-2"> 备注: {{goods.basicInformation.remark}}</span>
  124. </template>
  125. </el-popover>
  126. </div>
  127. <div class="item">
  128. <el-popover
  129. placement="top-start"
  130. :width="200"
  131. title="检测时间"
  132. trigger="hover"
  133. :content="goods.basicInformation.detectionTime"
  134. >
  135. <template #reference>
  136. <span class="m-2"> 检测时间: {{goods.basicInformation.detectionTime}}</span>
  137. </template>
  138. </el-popover>
  139. </div>
  140. <div class="item">
  141. <el-popover
  142. placement="top-start"
  143. :width="200"
  144. title="检测员"
  145. trigger="hover"
  146. :content="goods.basicInformation.detectionEmployee"
  147. >
  148. <template #reference>
  149. <span class="m-2"> 检测员: {{goods.basicInformation.detectionEmployee}}</span>
  150. </template>
  151. </el-popover>
  152. </div>
  153. <div class="item">
  154. </div>
  155. </div>
  156. <div class="basicInformation-right" >
  157. <div @click="showBigPic(goods.basicInformation.img)">
  158. <el-image loading="lazy"
  159. alt="fgg"
  160. class="img"
  161. fit="contain"
  162. :src="baseUrl + '/' + goods.basicInformation.img" >
  163. <template #error>
  164. <div class="image-slot">
  165. <el-icon><icon-picture /></el-icon>
  166. </div>
  167. </template>
  168. </el-image>
  169. </div>
  170. </div>
  171. </div>
  172. </el-card>
  173. </el-col>
  174. <!-- 生产日志 -->
  175. <el-col :xs="24" >
  176. <el-card style="height: 40vh" class="my-fill mt8" shadow="hover" header="生产日志">
  177. <el-table v-loading="goods.loadingProduct" :data="goods.productionLog.tableData" row-key="id" style="width: 100%">
  178. <el-table-column v-for="column in goods.productionLog.dynamicColumns" :key="column.prop" :prop="column.prop" :label="column.label" />
  179. </el-table>
  180. <div class="my-flex my-flex-end" style="margin-top: 20px">
  181. <el-pagination
  182. v-model:currentPage="goods.productionLog.pageInput.CurrentPage"
  183. v-model:page-size="goods.productionLog.pageInput.PageSize"
  184. :default-page-size="5"
  185. :total="goods.productionLog.total"
  186. :page-sizes="[5, 10, 20, 50, 100]"
  187. small
  188. background
  189. @size-change="onProductionLogSizeChange"
  190. @current-change="onProductionLogCurrentChange"
  191. layout="total, sizes, prev, pager, next, jumper"
  192. />
  193. </div>
  194. </el-card>
  195. </el-col>
  196. <!-- 报警日志 -->
  197. <el-col :span="24" >
  198. <el-card style="height: 40vh" class="my-fill mt8" shadow="hover" header="报警日志">
  199. <el-table v-loading="goods.loadingAlarm" :data="goods.alarmLog.tableData" row-key="id" style="width: 100%">
  200. <el-table-column v-for="column in goods.alarmLog.dynamicColumns" :key="column.prop" :prop="column.prop" :label="column.label" />
  201. </el-table>
  202. <div class="my-flex my-flex-end" style="margin-top: 20px">
  203. <el-pagination
  204. v-model:currentPage="goods.alarmLog.pageInput.CurrentPage"
  205. v-model:page-size="goods.alarmLog.pageInput.PageSize"
  206. :total="goods.alarmLog.total"
  207. :page-sizes="[5, 10, 20, 50, 100]"
  208. :default-page-size="5"
  209. small
  210. background
  211. @size-change="onAlarmLogSizeChange"
  212. @current-change="onAlarmLogCurrentChange"
  213. layout="total, sizes, prev, pager, next, jumper"
  214. />
  215. </div>
  216. </el-card>
  217. </el-col>
  218. </el-row>
  219. <!--大图显示-->
  220. <el-dialog
  221. v-model="goods.showBig"
  222. :close-on-click-modal="true"
  223. :show-close="false"
  224. width="80%"
  225. >
  226. <img
  227. :src="goods.imageUrl"
  228. class="fullscreen-image"
  229. alt="放大的图片"/>
  230. </el-dialog>
  231. </div>
  232. </template>
  233. <script setup lang="ts" name="goodInfo">
  234. import {onMounted, reactive} from "vue";
  235. import {ComponentDetails} from "/src/api/admin/productionManagement/ComponentDetails";
  236. import router from "/src/router";
  237. import type {
  238. alarmLog,
  239. goodsInformationBasic,
  240. productionLog
  241. } from "/src/api/admin/productionManagement/ComponentDetailsDto";
  242. import {adminProductGoodsInfoDto, filterData} from "/src/api/admin/productionManagement/ComponentDetailsDto";
  243. import type {columnsProps, pageInput} from "/src/api/admin/shareDto/shareDto";
  244. import { Picture as IconPicture } from '@element-plus/icons-vue'
  245. //组件的页面对象
  246. const goods = reactive({
  247. /**部件id */
  248. id:"",
  249. /**页面请求参数*/
  250. data:{} as filterData,
  251. /**显示加载效果 */
  252. loadingBasic: false,
  253. loadingProduct: false,
  254. loadingAlarm: false,
  255. /**图片是否方法显示 */
  256. showBig: false,
  257. /**放大图片的url */
  258. imageUrl: "",
  259. /**基础信息 */
  260. basicInformation: {} as goodsInformationBasic,
  261. /**生产日志 */
  262. productionLog: {
  263. /**表格数据 */
  264. tableData: [] as Array<productionLog>,
  265. /**动态表头 */
  266. dynamicColumns: [] as Array<columnsProps>,
  267. /**页面分页 */
  268. pageInput: {
  269. CurrentPage: 1,
  270. PageSize: 5
  271. } as pageInput,
  272. /**总数 */
  273. total: 0
  274. } as productionLog,
  275. /**报警日志 */
  276. alarmLog: {
  277. /**表格数据 */
  278. tableData: [] as Array<alarmLog>,
  279. /**动态表头 */
  280. dynamicColumns: [] as Array<columnsProps>,
  281. /**页面分页 */
  282. pageInput: {
  283. CurrentPage: 1,
  284. PageSize: 5
  285. } as pageInput,
  286. /**总数 */
  287. total: 0
  288. } as alarmLog,
  289. } as adminProductGoodsInfoDto)
  290. //图片url前缀
  291. const baseUrl = import.meta.env.VITE_API_URL
  292. //查看大图
  293. const showBigPic = (val) => {
  294. // eslint-disable-next-line no-console
  295. console.log(val)
  296. goods.imageUrl = baseUrl + '/' + val
  297. goods.showBig = true
  298. }
  299. /**生产日志分页size变化 */
  300. const onProductionLogSizeChange = (val) => {
  301. goods.productionLog.pageInput.PageSize = val
  302. initProductionLog()
  303. }
  304. /**生产日志分页Current变化 */
  305. const onProductionLogCurrentChange = (val) => {
  306. goods.productionLog.pageInput.CurrentPage = val
  307. initProductionLog()
  308. }
  309. /**报警日志分页size变化 */
  310. const onAlarmLogSizeChange = (val) => {
  311. goods.alarmLog.pageInput.CurrentPage = val
  312. initAlarmLog()
  313. }
  314. /**报警日志分页Current变化 */
  315. const onAlarmLogCurrentChange = (val) => {
  316. goods.alarmLog.pageInput.CurrentPage = val
  317. initAlarmLog()
  318. }
  319. /**
  320. * 初始化数据
  321. */
  322. const initBasicInformation = async () => {
  323. goods.loadingBasic = true
  324. const res = await new ComponentDetails().getBasicInfo({GUID:goods.id} ).catch(() => {
  325. goods.loadingBasic = false
  326. })
  327. goods.basicInformation = res?.data
  328. goods.loadingBasic = false
  329. }
  330. const initProductionLog = async () => {
  331. goods.loadingProduct = true
  332. goods.productionLog = await new ComponentDetails().getProductionLog(goods.productionLog.pageInput, goods.id)
  333. goods.loadingProduct = false
  334. // console.log(goods.productionLog)
  335. }
  336. const initAlarmLog = async () => {
  337. goods.loadingAlarm = true
  338. goods.alarmLog = await new ComponentDetails().getAlarmLog(goods.productionLog.pageInput, goods.id)
  339. goods.loadingAlarm = false
  340. // console.log(goods.alarmLog)
  341. }
  342. onMounted(() => {
  343. goods.id = router.currentRoute.value.params.guid
  344. // console.log(goods.productionLog.pageInput.PageSize)
  345. /**初始化 */
  346. initBasicInformation()
  347. initProductionLog()
  348. initAlarmLog()
  349. })
  350. </script>
  351. <style scoped lang="scss">
  352. .goodInfo{
  353. font-weight: 500;
  354. .el-card{
  355. margin-bottom: 20px;
  356. }
  357. .basicInformation{
  358. display: flex;
  359. display: -webkit-flex; /* Safari */
  360. justify-content: space-around;
  361. align-items:center;
  362. align-content:space-around;
  363. flex-wrap: wrap-reverse;
  364. .basicInformation-left{
  365. display: flex;
  366. display: -webkit-flex; /* Safari */
  367. justify-content: space-around;
  368. flex-wrap: wrap;
  369. height: 100%;
  370. max-width: 65%;
  371. min-width: 300px;
  372. .item{
  373. cursor: pointer;
  374. width: 240px;/*设置显示的最大宽度*/
  375. height:40px;
  376. overflow:hidden;/*超出部分隐藏*/
  377. white-space:nowrap;/*强制单行显示*/
  378. text-overflow: ellipsis;
  379. display: flex;
  380. align-items: center;
  381. }
  382. }
  383. .basicInformation-right{
  384. width: 50%;
  385. height: 100%;
  386. max-width: 300px;
  387. min-width: 200px;
  388. padding: 0 10px;
  389. .img {
  390. width: 220px;
  391. height: 140px;
  392. cursor: pointer;
  393. }
  394. .image-slot {
  395. display: flex;
  396. justify-content: center;
  397. align-items: center;
  398. width: 100%;
  399. height: 100%;
  400. background: var(--el-fill-color-light);
  401. color: var(--el-text-color-secondary);
  402. font-size: 30px;
  403. }
  404. .image-slot .el-icon {
  405. font-size: 30px;
  406. }
  407. }
  408. }
  409. .fullscreen-image {
  410. width: 100%;
  411. max-height: 80vh;
  412. object-fit: contain;
  413. }
  414. }
  415. </style>