project-product-detail.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <div>
  3. <div class="my-title">查看</div>
  4. <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
  5. <el-row class="my-row">
  6. <el-col :span="6">
  7. <el-form-item label="项目名称:" prop="projectName">
  8. <span>{{ dataForm.projectName }}</span>
  9. </el-form-item>
  10. </el-col>
  11. <el-col :span="6">
  12. <el-form-item label="任务号:" prop="orderCode">
  13. <span>{{ dataForm.orderCode }}</span>
  14. </el-form-item>
  15. </el-col>
  16. <el-col :span="6">
  17. <el-form-item label="技术协议:" prop="attachList1">
  18. <span class="attch-file" @click="attachDetail(dataForm.attachList1)">
  19. {{
  20. dataForm.attachList1 && Array.isArray(dataForm.attachList1) && dataForm.attachList1.length > 0 &&
  21. dataForm.attachList1[0] && dataForm.attachList1[0].fileName
  22. ? dataForm.attachList1[0].fileName
  23. : ''
  24. }}
  25. </span>
  26. </el-form-item>
  27. </el-col>
  28. <el-col :span="6">
  29. <el-form-item label="资料:" prop="attachList2">
  30. <span class="attch-file" @click="attachDetail(dataForm.attachList2)">
  31. {{
  32. dataForm.attachList2 && Array.isArray(dataForm.attachList2) && dataForm.attachList2.length > 0 &&
  33. dataForm.attachList2[0] && dataForm.attachList2[0].fileName
  34. ? dataForm.attachList2[0].fileName
  35. : ''
  36. }}
  37. </span>
  38. </el-form-item>
  39. </el-col>
  40. </el-row>
  41. <el-table :data="dataForm.proProductList" border v-loading="dataListLoading" style="width: 100%;"
  42. row-key="productId" :tree-props="{ children: 'proProductList', hasChildren: 'hasChildren' }">
  43. <el-table-column label="序号" type="index" width="100" align="center">
  44. </el-table-column>
  45. <el-table-column prop="productName" header-align="center" align="center" min-width="140"
  46. :show-tooltip-when-overflow="true" label="名称">
  47. </el-table-column>
  48. <el-table-column prop="mapNumber" header-align="center" align="center" min-width="140"
  49. :show-tooltip-when-overflow="true" label="图号">
  50. </el-table-column>
  51. <el-table-column prop="versionNumber" header-align="center" align="center" min-width="140"
  52. :show-tooltip-when-overflow="true" label="版本号">
  53. </el-table-column>
  54. <el-table-column header-align="center" align="center" label="图纸">
  55. <template slot-scope="scope">
  56. <el-button :disabled="!scope.row.proDrawings || scope.row.proDrawings.length === 0" type="text" size="small"
  57. @click="drawDetails(scope.row)">查看</el-button>
  58. </template>
  59. </el-table-column>
  60. <el-table-column prop="attachList2" header-align="center" align="center" min-width="100"
  61. :show-tooltip-when-overflow="true" label="简图">
  62. <template slot-scope="scope">
  63. <div class="thumb-list" v-if="getImageList(scope.row.attachList2).length">
  64. <img v-for="(img, idx) in getImageList(scope.row.attachList2)" :key="(img.url || '') + idx" class="thumb"
  65. :src="downloadUrl + img.url" :alt="img.fileName" @click="previewFile(img.fileName, img.url)" />
  66. </div>
  67. </template>
  68. </el-table-column>
  69. <el-table-column prop="productSpec" header-align="center" align="center" min-width="140"
  70. :show-tooltip-when-overflow="true" label="规格">
  71. </el-table-column>
  72. <el-table-column prop="cnt" header-align="center" align="center" min-width="140"
  73. :show-tooltip-when-overflow="true" label="数量">
  74. </el-table-column>
  75. <el-table-column prop="unit" header-align="center" align="center" min-width="140"
  76. :show-tooltip-when-overflow="true" label="单位">
  77. </el-table-column>
  78. <el-table-column prop="materials" header-align="center" align="center" min-width="140"
  79. :show-tooltip-when-overflow="true" label="材料">
  80. </el-table-column>
  81. <el-table-column prop="size" header-align="center" align="center" min-width="140"
  82. :show-tooltip-when-overflow="true" label="净尺寸">
  83. </el-table-column>
  84. <el-table-column prop="surfaceTreatment" header-align="center" align="center" min-width="140"
  85. :show-tooltip-when-overflow="true" label="表处理">
  86. </el-table-column>
  87. <el-table-column prop="heatTreatment" header-align="center" align="center" min-width="140"
  88. :show-tooltip-when-overflow="true" label="热处理">
  89. </el-table-column>
  90. <el-table-column prop="importance" header-align="center" align="center" min-width="140"
  91. :show-tooltip-when-overflow="true" label="关重性">
  92. </el-table-column>
  93. <el-table-column prop="appraisal" header-align="center" align="center" min-width="140"
  94. :show-tooltip-when-overflow="true" label="是否首件鉴定">
  95. <template slot-scope="scope">
  96. {{ scope.row.appraisal === 2 ? '是' : '否' }}
  97. </template>
  98. </el-table-column>
  99. <el-table-column prop="notes" header-align="center" align="center" min-width="140"
  100. :show-tooltip-when-overflow="true" label="备注">
  101. </el-table-column>
  102. </el-table>
  103. </el-form>
  104. <span slot="footer" class="dialog-footer">
  105. <el-button @click="onChose">返回</el-button>
  106. <!-- <el-button
  107. type="primary"
  108. @click="dataFormSubmit()"
  109. v-reClick
  110. >确定</el-button
  111. > -->
  112. </span>
  113. <attach-detail-dialog ref="attachDetail" />
  114. <preview-component v-if="previewVisible" ref="preview" />
  115. <project-draw-preview ref="drawPreview" />
  116. </div>
  117. </template>
  118. <script>
  119. import UserComponent from '../common/user-component'
  120. import AttachDetailDialog from '../common/attach-detail-dialog'
  121. import PreviewComponent from '../common/preview-component'
  122. import ProjectDrawPreview from './product-draw-detail-dialog.vue'
  123. import { downloadUrl } from '@/api/file'
  124. export default {
  125. name: 'project-product-detail',
  126. components: { UserComponent, AttachDetailDialog, PreviewComponent, ProjectDrawPreview },
  127. computed: {},
  128. data() {
  129. return {
  130. visible: false,
  131. id: 0,
  132. dataForm: {
  133. proProductList: []
  134. },
  135. dataRule: {},
  136. dataList: [],
  137. dataListLoading: false,
  138. previewVisible: false,
  139. downloadUrl: downloadUrl
  140. }
  141. },
  142. created() { },
  143. beforeDestroy() { },
  144. methods: {
  145. onChose() {
  146. this.$emit('onChose')
  147. },
  148. async init(item) {
  149. let id = item.productTechnologyId
  150. this.$http({
  151. url: this.$http.adornUrl(`/biz-service/projProduct/info/${id}`),
  152. method: 'get'
  153. }).then(({ data }) => {
  154. if (data && data.code === '200') {
  155. this.dataForm = data.data
  156. } else {
  157. this.$message.error(data.msg)
  158. }
  159. })
  160. this.dataForm = item
  161. this.dataList = [{ disposal: '', isTechnology: '' }]
  162. this.visible = true
  163. },
  164. validateField(type) {
  165. this.$refs.dataForm.validateField(type)
  166. },
  167. attachDetail(attachList) {
  168. this.$nextTick(() => {
  169. this.$refs.attachDetail.init(attachList)
  170. })
  171. },
  172. // 过滤图片附件
  173. getImageList(attachList) {
  174. if (!attachList || !Array.isArray(attachList)) return []
  175. return attachList.filter(item => this.isImage(item && item.fileName))
  176. },
  177. isImage(fileName) {
  178. if (!fileName || typeof fileName !== 'string') return false
  179. const ext = fileName.split('.').pop().toLowerCase()
  180. return ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'].includes(ext)
  181. },
  182. // 预览大图
  183. previewFile(fileName, url) {
  184. this.previewVisible = true
  185. this.$nextTick(() => {
  186. this.$refs.preview && this.$refs.preview.init(fileName, url)
  187. })
  188. },
  189. // 表单提交
  190. dataFormSubmit() {
  191. this.$refs['dataForm'].validate((valid) => {
  192. if (valid) {
  193. this.$http({
  194. url: this.$http.adornUrl(`/biz-service/projProduction/assign`),
  195. method: 'post',
  196. data: this.$http.adornData({
  197. productionManagementId: this.dataForm.productionManagementId,
  198. responsibilityPerson: this.dataForm.responsibilityPerson
  199. })
  200. }).then(({ data }) => {
  201. if (data && data.code === '200') {
  202. this.$message({
  203. message: '操作成功',
  204. type: 'success',
  205. duration: 1500,
  206. onClose: () => {
  207. this.onChose()
  208. this.$emit('refreshDataList')
  209. }
  210. })
  211. } else {
  212. this.$message.error(data.msg)
  213. }
  214. })
  215. }
  216. })
  217. },
  218. selectChange(val) {
  219. this.dataForm.responsibilityPerson = val
  220. },
  221. drawDetails(row) {
  222. this.$refs.drawPreview && this.$refs.drawPreview.init(row.proDrawings || [])
  223. }
  224. }
  225. }
  226. </script>
  227. <style scoped>
  228. .my-row {
  229. margin-bottom: 20px;
  230. }
  231. .radio-group-wrap {
  232. display: flex;
  233. align-items: flex-start;
  234. flex-direction: column;
  235. gap: 10px 15px;
  236. /* 行列间距控制 */
  237. }
  238. .radio-group-wrap :deep(.el-radio) {
  239. margin-left: 0;
  240. /* 清除横向间距 */
  241. }
  242. .attch-file {
  243. cursor: pointer;
  244. color: #3e8ef7;
  245. }
  246. /* 缩略图样式 */
  247. .thumb-list {
  248. display: flex;
  249. flex-wrap: wrap;
  250. gap: 6px;
  251. justify-content: center;
  252. }
  253. .thumb {
  254. width: 48px;
  255. height: 48px;
  256. object-fit: cover;
  257. border: 1px solid #ebeef5;
  258. border-radius: 4px;
  259. cursor: pointer;
  260. }
  261. </style>