goodInfo.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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 v-for="(item, index) in goods.basicInformation.basicInfo" :key="index" class="item">
  11. <el-popover
  12. placement="top-start"
  13. :title="item.goodsTitle"
  14. :width="200"
  15. trigger="hover"
  16. :content="item.goodsValue"
  17. >
  18. <template #reference>
  19. <span class="m-2">{{item.goodsTitle}} : {{item.goodsValue}}</span>
  20. </template>
  21. </el-popover>
  22. </div>
  23. </div>
  24. <div class="basicInformation-right" v-if="goods.basicInformation.goodsImg">
  25. <div @click="showBigPic(goods.basicInformation.goodsImg.imgUrl)">
  26. <el-image loading="lazy"
  27. alt="fgg"
  28. class="img"
  29. fit="fill"
  30. :src="goods.basicInformation.goodsImg.imgUrl" />
  31. </div>
  32. <div class="text">{{goods.basicInformation.goodsImg.title}}</div>
  33. </div>
  34. </div>
  35. </el-card>
  36. </el-col>
  37. <!-- 生产日志 -->
  38. <el-col :xs="24" >
  39. <el-card style="height: 70vh" class="my-fill mt8" shadow="hover" header="生产日志">
  40. <el-table v-loading="goods.loadingProduct" :data="goods.productionLog.tableData" row-key="id" style="width: 100%">
  41. <el-table-column v-for="column in goods.productionLog.dynamicColumns" :key="column.prop" :prop="column.prop" :label="column.label" />
  42. </el-table>
  43. <div class="my-flex my-flex-end" v-if="goods.productionLog.pageInput" style="margin-top: 20px">
  44. <el-pagination
  45. v-model:currentPage="goods.productionLog.pageInput.CurrentPage"
  46. v-model:page-size="goods.productionLog.pageInput.PageSize"
  47. :total="goods.productionLog.total"
  48. :page-sizes="[10, 20, 50, 100]"
  49. small
  50. background
  51. @size-change="onProductionLogSizeChange"
  52. @current-change="onProductionLogCurrentChange"
  53. layout="total, sizes, prev, pager, next, jumper"
  54. />
  55. </div>
  56. </el-card>
  57. </el-col>
  58. <!-- 报警日志 -->
  59. <el-col :span="24" >
  60. <el-card style="height: 70vh" class="my-fill mt8" shadow="hover" header="报警日志">
  61. <el-table v-loading="goods.loadingAlarm" :data="goods.alarmLog.tableData" row-key="id" style="width: 100%">
  62. <el-table-column v-for="column in goods.alarmLog.dynamicColumns" :key="column.prop" :prop="column.prop" :label="column.label" />
  63. </el-table>
  64. <div class="my-flex my-flex-end" v-if="goods.alarmLog.pageInput" style="margin-top: 20px">
  65. <el-pagination
  66. v-model:currentPage="goods.alarmLog.pageInput.CurrentPage"
  67. v-model:page-size="goods.alarmLog.pageInput.PageSize"
  68. :total="goods.alarmLog.total"
  69. :page-sizes="[10, 20, 50, 100]"
  70. small
  71. background
  72. @size-change="onAlarmLogSizeChange"
  73. @current-change="onAlarmLogCurrentChange"
  74. layout="total, sizes, prev, pager, next, jumper"
  75. />
  76. </div>
  77. </el-card>
  78. </el-col>
  79. </el-row>
  80. <!--大图显示-->
  81. <el-dialog
  82. v-model="goods.showBig"
  83. :close-on-click-modal="true"
  84. :show-close="false"
  85. width="80%"
  86. >
  87. <img :src="goods.imageUrl" class="fullscreen-image" alt="放大的图片"/>
  88. </el-dialog>
  89. </div>
  90. </template>
  91. <script setup lang="ts" name="goodInfo">
  92. import {onMounted, reactive} from "vue";
  93. import {ComponentDetails} from "/@/api/admin/productionManagement/ComponentDetails";
  94. import router from "/@/router";
  95. import type {
  96. alarmLog,
  97. goodsInformationBasic,
  98. productionLog
  99. } from "/@/api/admin/productionManagement/ComponentDetailsDto";
  100. import {adminProductGoodsInfoDto} from "/@/api/admin/productionManagement/ComponentDetailsDto";
  101. import type {columnsProps, pageInput} from "/@/api/admin/shareDto/shareDto";
  102. //组件的页面对象
  103. const goods = reactive({
  104. /**部件id */
  105. id:"",
  106. /**显示加载效果 */
  107. loadingBasic: false,
  108. loadingProduct: false,
  109. loadingAlarm: false,
  110. /**图片是否方法显示 */
  111. showBig: false,
  112. /**放大图片的url */
  113. imageUrl: "",
  114. /**基础信息 */
  115. basicInformation: {} as goodsInformationBasic,
  116. /**生产日志 */
  117. productionLog: {
  118. /**表格数据 */
  119. tableData: [] as Array<productionLog>,
  120. /**动态表头 */
  121. dynamicColumns: [] as Array<columnsProps>,
  122. /**页面分页 */
  123. pageInput: {
  124. currentPage: 1,
  125. pageSize: 20
  126. } as pageInput,
  127. /**总数 */
  128. total: 0
  129. } as productionLog,
  130. /**报警日志 */
  131. alarmLog: {
  132. /**表格数据 */
  133. tableData: [] as Array<alarmLog>,
  134. /**动态表头 */
  135. dynamicColumns: [] as Array<columnsProps>,
  136. /**页面分页 */
  137. pageInput: {
  138. CurrentPage: 1,
  139. PageSize: 20
  140. } as pageInput,
  141. /**总数 */
  142. total: 0
  143. } as alarmLog,
  144. } as adminProductGoodsInfoDto)
  145. //查看大图
  146. const showBigPic = (val) => {
  147. // eslint-disable-next-line no-console
  148. console.log(val)
  149. goods.imageUrl = val
  150. goods.showBig = true
  151. }
  152. /**生产日志分页size变化 */
  153. const onProductionLogSizeChange = (val) => {
  154. goods.productionLog.pageInput.PageSize = val
  155. initProductionLog()
  156. }
  157. /**生产日志分页Current变化 */
  158. const onProductionLogCurrentChange = (val) => {
  159. goods.productionLog.pageInput.CurrentPage = val
  160. initProductionLog()
  161. }
  162. /**报警日志分页size变化 */
  163. const onAlarmLogSizeChange = (val) => {
  164. goods.alarmLog.pageInput.CurrentPage = val
  165. initAlarmLog()
  166. }
  167. /**报警日志分页Current变化 */
  168. const onAlarmLogCurrentChange = (val) => {
  169. goods.alarmLog.pageInput.CurrentPage = val
  170. initAlarmLog()
  171. }
  172. /**
  173. * 初始化数据
  174. */
  175. const initBasicInformation = async () => {
  176. goods.loadingBasic = true
  177. goods.basicInformation = await new ComponentDetails().getBasicInfo(goods.id)
  178. goods.loadingBasic = false
  179. // console.log(goods.basicInformation)
  180. }
  181. const initProductionLog = async () => {
  182. goods.loadingProduct = true
  183. goods.productionLog = await new ComponentDetails().getProductionLog(goods.productionLog.pageInput, goods.id)
  184. goods.loadingProduct = false
  185. // console.log(goods.productionLog)
  186. }
  187. const initAlarmLog = async () => {
  188. goods.loadingAlarm = true
  189. goods.alarmLog = await new ComponentDetails().getAlarmLog(goods.productionLog.pageInput, goods.id)
  190. goods.loadingAlarm = false
  191. // console.log(goods.alarmLog)
  192. }
  193. onMounted(() => {
  194. goods.id = <string>router.currentRoute.value.params.id
  195. /**初始化 */
  196. initBasicInformation()
  197. initProductionLog()
  198. initAlarmLog()
  199. })
  200. </script>
  201. <style scoped lang="scss">
  202. .goodInfo{
  203. font-weight: 600;
  204. .el-card{
  205. margin-bottom: 20px;
  206. }
  207. .basicInformation{
  208. display: flex;
  209. display: -webkit-flex; /* Safari */
  210. justify-content: space-around;
  211. align-items:center;
  212. align-content:space-around;
  213. flex-wrap: wrap-reverse;
  214. .basicInformation-left{
  215. display: flex;
  216. display: -webkit-flex; /* Safari */
  217. justify-content: space-around;
  218. flex-wrap: wrap;
  219. padding: 12px;
  220. height: 100%;
  221. max-width: 65%;
  222. min-width: 300px;
  223. .item{
  224. cursor: pointer;
  225. width: 240px;/*设置显示的最大宽度*/
  226. height: 50px;
  227. overflow:hidden;/*超出部分隐藏*/
  228. white-space:nowrap;/*强制单行显示*/
  229. text-overflow: ellipsis;
  230. }
  231. }
  232. .basicInformation-right{
  233. width: 50%;
  234. height: 100%;
  235. max-width: 400px;
  236. min-width: 300px;
  237. margin: 20px 10px;
  238. .img {
  239. cursor: pointer;
  240. box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 8px;
  241. }
  242. .img:hover {
  243. box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
  244. }
  245. .text {
  246. height: 50px;
  247. display: flex;
  248. display: -webkit-flex; /* Safari */
  249. justify-content: center;
  250. align-items: center;
  251. font-size: 1.4rem;
  252. }
  253. }
  254. }
  255. .fullscreen-image {
  256. width: 100%;
  257. max-height: 80vh;
  258. object-fit: contain;
  259. }
  260. }
  261. </style>