baseInfo.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <template>
  2. <div class="baseinfo-container">
  3. <div class="basic-details-title border-none">
  4. <span class="border-span">基本信息</span>
  5. </div>
  6. <el-descriptions title="" :column="4" size="medium" border>
  7. <el-descriptions-item>
  8. <template slot="label"> 设备编码 </template>
  9. {{ basicInfo.code }}
  10. </el-descriptions-item>
  11. <el-descriptions-item>
  12. <template slot="label"> 设备名称 </template>
  13. {{ basicInfo.name }}
  14. </el-descriptions-item>
  15. <el-descriptions-item>
  16. <template slot="label"> 型号</template>
  17. {{ basicInfo.modelType }}
  18. </el-descriptions-item>
  19. <el-descriptions-item>
  20. <template slot="label"> 规格 </template>
  21. {{ basicInfo.specification }}
  22. </el-descriptions-item>
  23. <el-descriptions-item :span="2">
  24. <template slot="label"> 分类 </template>
  25. {{ basicInfo.categoryLevelPath }}
  26. </el-descriptions-item>
  27. <el-descriptions-item>
  28. <template slot="label"> 采购日期 </template>
  29. {{
  30. basicInfo.warehouseDetail && basicInfo.warehouseDetail.procurementTime
  31. }}
  32. </el-descriptions-item>
  33. <!-- <el-descriptions-item>
  34. <template slot="label"> 生产日期 </template>
  35. {{ basicInfo.productTime }}
  36. </el-descriptions-item> -->
  37. <el-descriptions-item>
  38. <template slot="label"> 过保日期 </template>
  39. {{ basicInfo.expirationTime }}
  40. </el-descriptions-item>
  41. <el-descriptions-item>
  42. <template slot="label"> 计量单位 </template>
  43. {{ basicInfo.measuringUnit }}
  44. </el-descriptions-item>
  45. <el-descriptions-item>
  46. <template slot="label"> 标准产能 </template>
  47. {{ setbzcn(basicInfo.extendField) }}
  48. </el-descriptions-item>
  49. <el-descriptions-item>
  50. <template slot="label"> 生命周期</template>
  51. <div v-if="info.source == 1" style="color: #70b603">在用</div>
  52. <div v-if="info.source == 2" style="color: #f59a23">在库</div>
  53. <div v-if="info.source == 3" style="color: #aaaaaa">消耗</div>
  54. <!-- {{ basicInfo.sourceDICT }} -->
  55. </el-descriptions-item>
  56. <el-descriptions-item>
  57. <template slot="label"> 网络状态</template>
  58. {{ basicInfo.networkStatus == 1 ? '在线' : '离线' }}
  59. </el-descriptions-item>
  60. </el-descriptions>
  61. <div class="basic-details-title border-none">
  62. <span class="border-span">投产信息</span>
  63. </div>
  64. <el-descriptions title="" :column="4" size="medium" border>
  65. <el-descriptions-item
  66. v-for="(item, index) in prodOpt"
  67. :key="index"
  68. :span="item.span || 1"
  69. >
  70. <template slot="label" v-if="item.key == 'bizNum'">{{
  71. info.source == 2 ? '入库单号' : '出库单号'
  72. }}</template>
  73. <template slot="label" v-else> {{ item.label }} </template>
  74. <div v-if="item.key == 'bizNum'">
  75. <el-link style="color: #70b603" @click="jumpDetails">{{
  76. info.warehouseDetail && info.warehouseDetail.bizNum
  77. }}</el-link>
  78. </div>
  79. <div v-else-if="item.key == 'detailLocation'">
  80. {{ initDetailLocation(item.value) }}
  81. </div>
  82. <div v-else>{{ item.value }}</div>
  83. </el-descriptions-item>
  84. </el-descriptions>
  85. <div class="basic-details-title border-none">
  86. <span class="border-span">文档信息</span>
  87. </div>
  88. <!-- <div class="upload-container">
  89. <div class="img-box">
  90. <img
  91. src="~@/assets/img/upload-placeholder.svg"
  92. alt=""
  93. v-if="!imageUrl"
  94. />
  95. <img v-else :src="imageUrl" alt="设备图片" />
  96. </div>
  97. <div class="file-list">
  98. <div
  99. :class="{ disabled: !item.accessUrl }"
  100. @click="openfile(item)"
  101. v-for="(item, index) in fileList"
  102. :key="index"
  103. class="file-box"
  104. >
  105. {{ item.t_name }}
  106. </div>
  107. </div>
  108. </div> -->
  109. <div class="basic-details-title border-none">
  110. <span class="border-span">物联参数</span>
  111. </div>
  112. <el-row>
  113. <el-col style="padding-left: 30px">
  114. <span style="color: #3e3e3e; padding-right: 20px; font-size: 14px"
  115. >是否启用物联</span
  116. >
  117. <el-switch
  118. v-model="info.isIotEnable"
  119. disabled
  120. active-text="开"
  121. inactive-text="关"
  122. :active-value="1"
  123. :inactive-value="0"
  124. >
  125. </el-switch>
  126. </el-col>
  127. <el-col style="margin-top: 20px; padding-left: 30px; font-size: 14px">
  128. <span style="color: #3e3e3e">物联ID</span>
  129. <span style="color: #3e3e3e; padding-left: 10px">{{ info.iotId }}</span>
  130. </el-col>
  131. </el-row>
  132. <div class="basic-details-title border-none">
  133. <span class="border-span">扩展信息</span>
  134. </div>
  135. <div class="kzzd">
  136. <el-row>
  137. <el-col
  138. :span="24"
  139. v-for="(item, index) in info.extInfoSelf"
  140. :key="index"
  141. style="margin-bottom: 20px"
  142. >
  143. <div class="add-col">
  144. <el-input
  145. disabled
  146. class="col-input"
  147. v-model="item.key"
  148. placeholder="参数名称"
  149. ></el-input>
  150. <el-input
  151. disabled
  152. class="col-input"
  153. v-model="item.value"
  154. placeholder="参数值"
  155. ></el-input>
  156. </div>
  157. </el-col>
  158. </el-row>
  159. </div>
  160. <!-- <DetailsDialog ref="detailsDialogRef" /> -->
  161. </div>
  162. </template>
  163. <script>
  164. import { getAssetInfo } from '@/api/ledgerAssets';
  165. // import { imageView, fileSystemDownload } from '@/utils'
  166. // import DetailsDialog from '@/views/ledgerAssets/components/outstoreDetailsDialog.vue'
  167. export default {
  168. props: ['id'],
  169. components: {
  170. // DetailsDialog
  171. },
  172. data () {
  173. return {
  174. prodOpt: [
  175. { label: '固资编码', key: 'fixCode', value: '' },
  176. { label: '投产日期', key: 'startUpTime', value: '' },
  177. { label: '所属工厂', key: 'factoryName', value: '' },
  178. { label: '所属工序', key: 'roteName', value: '' },
  179. { label: '维护部门', key: 'repairGroupName', value: '' },
  180. { label: '维护人', key: 'repairUserName', value: '' },
  181. { label: '维护人电话', key: 'repairUserMobile', value: '' },
  182. { label: '出库单号', key: 'bizNum', value: '' },
  183. { label: '权属部门', key: 'ownershipGroupName', value: '' },
  184. { label: '权属人', key: 'ownershipUserName', value: '' },
  185. { label: '权属人电话', key: 'ownershipUserMobile', value: '' },
  186. { label: '品牌', key: 'brand', value: '' },
  187. { label: '供应商', key: 'supplierName', span: 2, value: '' },
  188. { label: '供应商电话', key: 'supplierMobile', value: '' },
  189. { label: '设备用途', key: 'purpose', value: '' },
  190. { label: '设备位置', key: 'detailLocation', span: 2, value: '' },
  191. { label: '颜色', key: 'color', value: '' },
  192. { label: '重量', key: 'weight', value: '' }
  193. ],
  194. fileList: [
  195. { t_name: '使用说明书' },
  196. { t_name: '生产许可证书' },
  197. { t_name: '防爆合格证书' },
  198. { t_name: '检验报告' },
  199. { t_name: '检验周期说明' },
  200. { t_name: '图纸资料' },
  201. { t_name: '产品合格证' }
  202. ],
  203. // 基本信息
  204. basicInfo: {
  205. assetCode: '',
  206. assetName: '',
  207. // 资产管理物品信息
  208. information: '',
  209. productTime: '',
  210. expirationTime: '',
  211. networkStatus: '',
  212. sourceDICT: ''
  213. },
  214. // 设备图片
  215. imageUrl: '',
  216. // 扩展字段
  217. extInfoSelf: [],
  218. // 所有信息
  219. info: {}
  220. };
  221. },
  222. created () {
  223. this.getInfo();
  224. },
  225. methods: {
  226. // 获取设备详情
  227. getInfo () {
  228. getAssetInfo(this.id).then((data) => {
  229. this.info = data;
  230. this.basicInfo = data.category;
  231. if (data.attUrl && data.attUrl.length > 0) {
  232. // 文档信息
  233. // Object.keys(this.attUrl).forEach((n, index) => {
  234. // if (data.attUrl[index].accessUrl) {
  235. // this.attUrl[n] = data.attUrl[index];
  236. // }
  237. // });
  238. }
  239. // 资产信息
  240. for (const item of this.prodOpt) {
  241. // 地址
  242. if (item.key == 'detailLocation') {
  243. item.value = data.positionList[0]?.path
  244. ?.map((i) => i.name)
  245. .join(',');
  246. } else {
  247. item.value = data[item.key] || this.basicInfo[item.key];
  248. }
  249. }
  250. console.log('this.prodOpt', this.prodOpt);
  251. // 设备图片
  252. this.imageUrl = data.imageUrl;
  253. if (this.imageUrl) {
  254. // imageView(this.imageUrl).then((res) => {
  255. // this.$refs.UploadImg.setImg(res);
  256. // });
  257. }
  258. });
  259. },
  260. // 设置标准产能
  261. setbzcn (val) {
  262. if (!val) {
  263. return '';
  264. }
  265. let item = JSON.parse(val);
  266. return item.standardCapacity || '';
  267. },
  268. openfile (row) {
  269. if (row.accessUrl) {
  270. fileSystemDownload(row);
  271. }
  272. },
  273. // 打开详情弹窗
  274. jumpDetails () {
  275. if (!this.info.warehouseDetail) {
  276. return;
  277. }
  278. this.$refs.detailsDialogRef.init(
  279. this.info.warehouseDetail,
  280. this.info.source
  281. );
  282. },
  283. // 设备位置
  284. initDetailLocation (val) {
  285. console.log(val);
  286. let list = String(val)
  287. .split('/')
  288. .filter((n) => {
  289. return n !== 'null';
  290. });
  291. return list.join('/');
  292. }
  293. }
  294. };
  295. </script>
  296. <style lang="scss" scoped>
  297. .baseinfo-container .basic-details-title {
  298. font-size: 16px;
  299. margin: 15px 0;
  300. }
  301. .baseinfo-container {
  302. background-color: #fff;
  303. padding: 20px;
  304. .content {
  305. padding: 0 20px;
  306. }
  307. .upload-container {
  308. display: flex;
  309. .img-box {
  310. width: 280px;
  311. height: 342px;
  312. border: 1px solid rgba(215, 215, 215, 1);
  313. display: flex;
  314. justify-content: center;
  315. align-items: center;
  316. img {
  317. max-width: 100%;
  318. }
  319. }
  320. .file-list {
  321. margin-left: 50px;
  322. flex: 1;
  323. display: flex;
  324. justify-content: space-between;
  325. flex-wrap: wrap;
  326. justify-items: baseline;
  327. align-content: flex-start;
  328. .file-box {
  329. width: 30%;
  330. margin-bottom: 20px;
  331. height: 57px;
  332. text-align: center;
  333. line-height: 55px;
  334. border: 1px solid var(--mainColor);
  335. color: var(--mainColor);
  336. cursor: pointer;
  337. &.disabled {
  338. cursor: not-allowed;
  339. border-color: rgba(215, 215, 215, 1);
  340. color: rgba(215, 215, 215, 1);
  341. }
  342. }
  343. }
  344. }
  345. }
  346. .kzxx-wrap {
  347. .item {
  348. display: flex;
  349. .key {
  350. margin-right: 10px;
  351. }
  352. }
  353. }
  354. .kzzd {
  355. width: 500px;
  356. .add-col {
  357. display: flex;
  358. .col-input {
  359. & + .col-input {
  360. margin-left: 10px;
  361. }
  362. }
  363. .del {
  364. margin-left: 10px;
  365. }
  366. }
  367. }
  368. </style>