assetInformationView.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. <template>
  2. <div id="assetInformation" class="baseinfo-container">
  3. <el-form label-width="120px" :model="{ ...zcInfo }" ref="form">
  4. <div class="content">
  5. <div class="basic-details-title border-none">
  6. <span class="border-span">资产信息</span>
  7. </div>
  8. <el-descriptions
  9. title=""
  10. :column="4"
  11. size="medium"
  12. border
  13. style="edit"
  14. :label-style="labelStyle"
  15. class="descriptions"
  16. >
  17. <el-descriptions-item>
  18. <template slot="label"> 固资编码 </template>
  19. <el-form-item label-width="0">
  20. <el-input class="input" v-model="zcInfo.fixCode"></el-input>
  21. </el-form-item>
  22. </el-descriptions-item>
  23. <el-descriptions-item>
  24. <template slot="label"> 编号 </template>
  25. <el-form-item label-width="0">
  26. <el-input class="input" v-model="zcInfo.codeNumber"></el-input>
  27. </el-form-item>
  28. </el-descriptions-item>
  29. <el-descriptions-item>
  30. <template slot="label"> 颜色 </template>
  31. <el-form-item label-width="0">
  32. <el-input class="input" v-model="zcInfo.color"></el-input>
  33. </el-form-item>
  34. </el-descriptions-item>
  35. <el-descriptions-item>
  36. <template slot="label"> 级别 </template>
  37. <el-form-item label-width="0">
  38. <el-select
  39. style="width: 100%"
  40. v-model="zcInfo.level"
  41. placeholder="请选择"
  42. >
  43. <el-option
  44. v-for="item in options.assetLevel"
  45. :key="item.id"
  46. :label="item.name"
  47. :value="item.id"
  48. >
  49. </el-option>
  50. </el-select>
  51. </el-form-item>
  52. </el-descriptions-item>
  53. <el-descriptions-item>
  54. <template slot="label"> 有效期开始 </template>
  55. <el-form-item label-width="0">
  56. <el-date-picker
  57. style="width: 100%"
  58. v-model="zcInfo.startTime"
  59. type="month"
  60. value-format="yyyy-MM"
  61. placeholder="选择有效期开始"
  62. >
  63. </el-date-picker>
  64. </el-form-item>
  65. </el-descriptions-item>
  66. <el-descriptions-item>
  67. <template slot="label"> 有效期结束 </template>
  68. <el-form-item label-width="0">
  69. <el-date-picker
  70. style="width: 100%"
  71. v-model="zcInfo.endTime"
  72. @change="endTimeRules"
  73. value-format="yyyy-MM"
  74. type="month"
  75. placeholder="选择有效期结束"
  76. >
  77. </el-date-picker>
  78. </el-form-item>
  79. </el-descriptions-item>
  80. <!-- <el-descriptions-item>
  81. <template slot="label"> 状态 </template>
  82. <el-form-item label-width="0">
  83. <el-input
  84. v-model="zcInfo.status"
  85. placeholder="请输入状态"
  86. ></el-input>
  87. </el-form-item>
  88. </el-descriptions-item> -->
  89. <el-descriptions-item>
  90. <template slot="label"> 入账日期 </template>
  91. <el-form-item label-width="0">
  92. <el-date-picker
  93. style="width: 100%"
  94. v-model="zcInfo.entryDate"
  95. type="date"
  96. placeholder="选择入账日期"
  97. value-format="yyyy-MM-dd"
  98. >
  99. </el-date-picker>
  100. </el-form-item>
  101. </el-descriptions-item>
  102. <el-descriptions-item>
  103. <template slot="label"> 周期 </template>
  104. <el-form-item label-width="0">
  105. <el-select
  106. style="width: 100%"
  107. v-model="zcInfo.cycle"
  108. placeholder="请选择"
  109. >
  110. <el-option
  111. v-for="item in options.deliveryCycle"
  112. :key="item.id"
  113. :label="item.name"
  114. :value="item.id"
  115. >
  116. </el-option>
  117. </el-select>
  118. </el-form-item>
  119. </el-descriptions-item>
  120. </el-descriptions>
  121. <el-descriptions
  122. title=""
  123. :column="3"
  124. size="medium"
  125. border
  126. style="edit"
  127. :label-style="labelStyle"
  128. class="descriptions"
  129. >
  130. <el-descriptions-item>
  131. <template slot="label"> 权属部门 </template>
  132. <el-form-item label-width="0">
  133. <div class="input">
  134. <!-- <el-input
  135. v-model="zcInfo.workstation.groupName"
  136. disabled
  137. placeholder="请输入内容"
  138. ></el-input> -->
  139. <DeptSelect
  140. v-model="zcInfo.ownershipGroupId"
  141. @input="getqsbm"
  142. />
  143. </div>
  144. </el-form-item>
  145. </el-descriptions-item>
  146. <el-descriptions-item>
  147. <template slot="label"> 权属人 </template>
  148. <el-form-item label-width="0">
  149. <!-- <el-input
  150. v-model="zcInfo.workstation.leaderName"
  151. disabled
  152. placeholder="请输入内容"
  153. ></el-input> -->
  154. <el-select
  155. style="width: 100%"
  156. v-model="zcInfo.ownershipUserId"
  157. placeholder="请选择"
  158. >
  159. <el-option
  160. v-for="item in options.ownershipUserId"
  161. :key="item.id"
  162. :label="item.name"
  163. :value="item.id"
  164. >
  165. </el-option>
  166. </el-select>
  167. </el-form-item>
  168. </el-descriptions-item>
  169. <el-descriptions-item :span="3">
  170. <template slot="label"> 所属厂房 </template>
  171. <el-form-item label-width="0">
  172. <el-input
  173. style="margin-right: 10px; width: 20%"
  174. v-model="zcInfo.workstation.workshopPlanName"
  175. disabled
  176. placeholder="请输入内容"
  177. ></el-input>
  178. <el-input
  179. style="margin-right: 10px; width: 20%"
  180. v-model="zcInfo.workstation.workshopName"
  181. disabled
  182. placeholder="请输入内容"
  183. ></el-input>
  184. <el-input
  185. style="margin-right: 10px; width: 20%"
  186. v-model="zcInfo.workstation.productionLineName"
  187. disabled
  188. placeholder="请输入内容"
  189. ></el-input>
  190. <el-input
  191. style="margin-right: 10px; width: 20%"
  192. v-model="zcInfo.workstation.name"
  193. disabled
  194. placeholder="请输入内容"
  195. ></el-input>
  196. </el-form-item>
  197. </el-descriptions-item>
  198. <el-descriptions-item>
  199. <template slot="label"> 所属工序 </template>
  200. <el-form-item label-width="0">
  201. <el-input
  202. v-model="zcInfo.workstation.taskNames"
  203. disabled
  204. placeholder="请输入内容"
  205. ></el-input>
  206. </el-form-item>
  207. </el-descriptions-item>
  208. <el-descriptions-item>
  209. <template slot="label"> 设备位置 </template>
  210. <el-form-item label-width="0" prop="location">
  211. <div style="display: flex">
  212. <el-cascader
  213. clearable
  214. v-model="zcInfo.location"
  215. :options="options.cityDataLabel"
  216. ></el-cascader>
  217. <el-input
  218. style="width: 60%; margin-left: 10px"
  219. placeholder="详细地址"
  220. v-model="zcInfo.detailPosition"
  221. ></el-input>
  222. </div>
  223. </el-form-item>
  224. </el-descriptions-item>
  225. </el-descriptions>
  226. <el-descriptions
  227. title=""
  228. :column="5"
  229. size="medium"
  230. border
  231. style="edit"
  232. :label-style="labelStyle"
  233. class="descriptions"
  234. >
  235. <el-descriptions-item>
  236. <template slot="label"> 维护部门 </template>
  237. <el-form-item label-width="0">
  238. <div class="input">
  239. <DeptSelect v-model="zcInfo.repairGroupId" @input="getwhbm" />
  240. </div>
  241. </el-form-item>
  242. </el-descriptions-item>
  243. <el-descriptions-item>
  244. <template slot="label"> 维护人 </template>
  245. <el-form-item label-width="0">
  246. <el-select
  247. style="width: 100%"
  248. v-model="zcInfo.repairUserId"
  249. placeholder="请选择"
  250. >
  251. <el-option
  252. v-for="item in options.repairUserId"
  253. :key="item.id"
  254. :label="item.name"
  255. :value="item.id"
  256. >
  257. </el-option>
  258. </el-select>
  259. </el-form-item>
  260. </el-descriptions-item>
  261. </el-descriptions>
  262. <el-descriptions
  263. title=""
  264. :column="5"
  265. size="medium"
  266. border
  267. style="edit"
  268. :label-style="labelStyle"
  269. class="descriptions"
  270. >
  271. <el-descriptions-item>
  272. <template slot="label"> 类型 </template>
  273. <el-form-item label-width="0">
  274. <el-select
  275. style="width: 100%"
  276. v-model="zcInfo.isPublic"
  277. filterable
  278. placeholder="请选择类型"
  279. >
  280. <el-option
  281. v-for="item in typeOptions"
  282. :key="item.id"
  283. :label="item.name"
  284. :value="item.id"
  285. >
  286. </el-option>
  287. </el-select>
  288. </el-form-item>
  289. </el-descriptions-item>
  290. <el-descriptions-item>
  291. <template slot="label"> 使用岗位 </template>
  292. <el-form-item label-width="0">
  293. <DeptSelect v-model="zcInfo.postId" @input="auditorDeptClick" />
  294. </el-form-item>
  295. </el-descriptions-item>
  296. <el-descriptions-item>
  297. <template slot="label"> 使用人 </template>
  298. <el-form-item label-width="0">
  299. <el-select
  300. style="width: 100%"
  301. v-model="zcInfo.usePersonId"
  302. filterable
  303. placeholder="请选择使用人"
  304. >
  305. <el-option
  306. v-for="item in userList"
  307. :key="item.id"
  308. :label="item.name"
  309. :value="item.id"
  310. >
  311. </el-option>
  312. </el-select>
  313. </el-form-item>
  314. </el-descriptions-item>
  315. <el-descriptions-item>
  316. <template slot="label"> 负责人 </template>
  317. <el-form-item label-width="0">
  318. <el-select
  319. style="width: 100%"
  320. v-model="zcInfo.chargePersonId"
  321. filterable
  322. placeholder="请选择负责人"
  323. >
  324. <el-option
  325. v-for="item in userList"
  326. :key="item.id"
  327. :label="item.name"
  328. :value="item.id"
  329. >
  330. </el-option>
  331. </el-select>
  332. </el-form-item>
  333. </el-descriptions-item>
  334. </el-descriptions>
  335. <el-descriptions
  336. title=""
  337. :column="3"
  338. size="medium"
  339. border
  340. style="edit"
  341. :label-style="labelStyle"
  342. >
  343. <el-descriptions-item>
  344. <template slot="label"> 供应商 </template>
  345. <el-form-item label-width="0">
  346. <el-select
  347. v-model="zcInfo.supplierId"
  348. style="width: 100%"
  349. placeholder="请选择"
  350. >
  351. <el-option
  352. v-for="item in options.suppList"
  353. :key="item.id"
  354. :label="item.name"
  355. :value="item.id"
  356. >
  357. </el-option>
  358. </el-select>
  359. </el-form-item>
  360. </el-descriptions-item>
  361. <el-descriptions-item>
  362. <template slot="label"> 品牌 </template>
  363. <el-form-item label-width="0">
  364. <el-input v-model="zcInfo.brand" class="input"></el-input>
  365. </el-form-item>
  366. </el-descriptions-item>
  367. <el-descriptions-item>
  368. <template slot="label"> 设备用途 </template>
  369. <el-form-item label-width="0">
  370. <el-input v-model="zcInfo.purpose" class="input"></el-input>
  371. </el-form-item>
  372. </el-descriptions-item>
  373. <el-descriptions-item>
  374. <template slot="label"> 备注 </template>
  375. <el-form-item label-width="0">
  376. <el-input
  377. type="textarea"
  378. :rows="2"
  379. placeholder="请输入内容"
  380. v-model="zcInfo.remark"
  381. ></el-input>
  382. </el-form-item>
  383. </el-descriptions-item>
  384. </el-descriptions>
  385. </div>
  386. </el-form>
  387. </div>
  388. </template>
  389. <script>
  390. import DeptSelect from '@/components/CommomSelect/dept-select.vue';
  391. import WorkshopSelect from '@/components/CommomSelect/workshop-select.vue';
  392. import FactoryAreaSelect from '@/components/CommomSelect/factory-area-select.vue';
  393. import WorkingProcedureSelect from '@/components/CommomSelect/working-procedure-select.vue';
  394. import factorySelect from '@/components/CommomSelect/factory-select.vue';
  395. import fileUpload from '@/components/upload/fileUpload';
  396. import WithView from '@/components/upload/WithView';
  397. import imgUpload from '@/components/upload/imgUpload';
  398. import { cityDataLabel } from 'ele-admin/packages/utils/regions';
  399. import personSelect from '@/components/CommomSelect/person-select.vue';
  400. import { saveOrEdit, getAssetInfo } from '@/api/ledgerAssets';
  401. import { getUserPage } from '@/api/system/organization';
  402. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  403. import { getByCode } from '@/api/system/dictionary-data';
  404. export default {
  405. components: {
  406. WithView,
  407. WorkshopSelect,
  408. FactoryAreaSelect,
  409. WorkingProcedureSelect,
  410. fileUpload,
  411. imgUpload,
  412. factorySelect,
  413. DeptSelect,
  414. personSelect
  415. },
  416. props: {
  417. isEdit: {
  418. type: Boolean,
  419. default: true
  420. }
  421. },
  422. data() {
  423. return {
  424. userList: [], // 人员列表
  425. labelStyle: {
  426. 'min-width': '100px'
  427. },
  428. pageType: 'add',
  429. id: '', // 设备主键id
  430. rules: {
  431. name: [
  432. { required: true, message: '请输入设备名称', trigger: 'blur' }
  433. ],
  434. code: [{ required: true, message: '请输入设备编码', trigger: 'blur' }]
  435. },
  436. typeOptions: [
  437. {
  438. id: 0,
  439. name: '专用'
  440. },
  441. {
  442. id: 1,
  443. name: '公用'
  444. }
  445. ],
  446. // 资产信息
  447. // zcInfo: {
  448. // // 固定资产编码
  449. // fixCode: '',
  450. // // 颜色
  451. // color: '',
  452. // // 重量
  453. // weight: '',
  454. // // 维护部门
  455. // repairGroupId: '',
  456. // repairUserId: '',
  457. // // 设备用途
  458. // purpose: '',
  459. // // 设备位置
  460. // location: '',
  461. // //品牌
  462. // brand: '',
  463. // // 供应商code
  464. // supplierId: '',
  465. // // 编号
  466. // codeNumber: '',
  467. // // 使用人
  468. // usePersonId: '',
  469. // // 有效期开始
  470. // startTime: '',
  471. // // 有效结束
  472. // endTime: '',
  473. // // 级别
  474. // level: '',
  475. // // 状态
  476. // status: '',
  477. // // 负责人
  478. // chargePersonId: '',
  479. // // 入账日期
  480. // entryDate: '',
  481. // // 周期
  482. // cycle: '',
  483. // // 备注
  484. // remark: '',
  485. // // 使用岗位
  486. // postId: ''
  487. // },
  488. options: {
  489. ownershipUserId: [], // 权属人
  490. repairUserId: [], // 维护人
  491. supplierId: [], // 供应商
  492. cityDataLabel, // 设备位置
  493. assetLevel: [], // 资产级别
  494. deliveryCycle: [], // 送检周期
  495. suppList: [] // 供应商
  496. },
  497. zcInfo: {
  498. workstation: {}
  499. }
  500. };
  501. },
  502. props: {
  503. form: {
  504. type: Object,
  505. default: {
  506. workstation: {}
  507. }
  508. }
  509. },
  510. watch: {
  511. form: {
  512. //监听的对象
  513. deep: true, //深度监听设置为 true
  514. handler: function (newValue) {
  515. console.log(newValue.isPublic);
  516. this.zcInfo = newValue;
  517. }
  518. }
  519. },
  520. async mounted() {
  521. // 获取资产级别下拉框
  522. await this.getAssetLevelOptions();
  523. // 获取送检周期下拉
  524. await this.getDeliveryCycleOptions();
  525. // 获取供应商下拉列表
  526. await this.getSuppliersList();
  527. // 初始化数据
  528. setTimeout(() => {
  529. this.initData();
  530. }, 500);
  531. },
  532. methods: {
  533. // 限制结束时间
  534. endTimeRules() {
  535. if (this.zcInfo.startTime) {
  536. console.log(this.zcInfo.startTime);
  537. console.log(new Date(this.zcInfo.startTime).getTime());
  538. let differenceTime =
  539. new Date(this.zcInfo.endTime).getTime() -
  540. new Date(this.zcInfo.startTime).getTime();
  541. if (differenceTime <= 0) {
  542. this.$message.error('请选择正确的有效结束时间');
  543. this.zcInfo.endTime = '';
  544. }
  545. } else {
  546. this.$message.error('请选择有效开始时间');
  547. this.zcInfo.endTime = '';
  548. }
  549. },
  550. // 获取资产级别下拉
  551. async getAssetLevelOptions() {
  552. let { data } = await getByCode('asset_level');
  553. this.options.assetLevel =
  554. data.length > 0
  555. ? data.map((item) => {
  556. return {
  557. name: Object.keys(item)[0],
  558. id: item[Object.keys(item)[0]]
  559. };
  560. })
  561. : [];
  562. },
  563. // 获取送检周期下拉
  564. async getDeliveryCycleOptions() {
  565. let { data } = await getByCode('delivery_cycle');
  566. console.log(data);
  567. this.options.deliveryCycle =
  568. data.length > 0
  569. ? data.map((item) => {
  570. return {
  571. name: item[Object.keys(item)[0]],
  572. id: +Object.keys(item)[0]
  573. };
  574. })
  575. : [];
  576. },
  577. // 获取维护人下拉列表
  578. async geMaintainersList() {
  579. if (!this.zcInfo.repairGroupId) return;
  580. let data = await getUserPage({
  581. pageNum: 1,
  582. size: 9999,
  583. groupId: this.zcInfo.repairGroupId
  584. });
  585. this.options.repairUserId = data.list;
  586. },
  587. // 使用岗位点击事件
  588. async auditorDeptClick(data) {
  589. this.zcInfo.chargePersonId = '';
  590. this.zcInfo.usePersonId = '';
  591. this.userList = [];
  592. if (data) {
  593. this.getStaffList(data);
  594. }
  595. },
  596. // 获取供应商下拉列表
  597. async getSuppliersList() {
  598. const rep = await warehouseDefinition.eomContact({
  599. type: 2,
  600. status: 1,
  601. size: -1,
  602. pageNum: 1
  603. });
  604. this.options.suppList = rep.list;
  605. },
  606. // 通过部门岗位获取人员列表
  607. async getStaffList(id) {
  608. let res = await warehouseDefinition.getUserPage({
  609. groupId: id,
  610. size: 9999,
  611. page: 1
  612. });
  613. this.userList = res.list;
  614. },
  615. // 权属部门
  616. async getqsbm() {
  617. if (!this.zcInfo.ownershipGroupId) return;
  618. let data = await getUserPage({
  619. pageNum: 1,
  620. size: 9999,
  621. groupId: this.zcInfo.ownershipGroupId
  622. });
  623. this.options.ownershipUserId = data.list;
  624. },
  625. // 维护部门
  626. async getwhbm() {
  627. if (!this.zcInfo.repairGroupId) return;
  628. let data = await getUserPage({
  629. pageNum: 1,
  630. size: 9999,
  631. groupId: this.zcInfo.repairGroupId
  632. });
  633. this.options.repairUserId = data.list;
  634. },
  635. // 初始化
  636. async initData() {
  637. console.log('this.zcInfo---------------------', this.zcInfo);
  638. // 填充使用岗位
  639. this.zcInfo.postId && this.auditorDeptClick(this.zcInfo.postId);
  640. this.geMaintainersList();
  641. }
  642. }
  643. };
  644. </script>
  645. <style lang="scss" scoped>
  646. ::v-deep .descriptions {
  647. margin-bottom: 10px;
  648. }
  649. .baseinfo-container .basic-details-title {
  650. font-size: 16px;
  651. margin: 15px 0;
  652. }
  653. .upload-container {
  654. display: flex;
  655. justify-content: flex-start;
  656. .file-list {
  657. margin-left: 50px;
  658. flex: 1;
  659. }
  660. }
  661. .equipment-container {
  662. // .content {
  663. // padding: 0 20px;
  664. // }
  665. .label-none {
  666. .el-form-item__content {
  667. margin-left: 0 !important;
  668. }
  669. }
  670. }
  671. .sbwz {
  672. .item {
  673. width: 120px !important;
  674. }
  675. .item + .item {
  676. margin-left: 10px;
  677. }
  678. .item-input {
  679. width: 350px !important;
  680. }
  681. }
  682. .input {
  683. width: 100%;
  684. }
  685. .kzzd {
  686. width: 500px;
  687. .add-col {
  688. display: flex;
  689. .col-input {
  690. & + .col-input {
  691. margin-left: 10px;
  692. }
  693. }
  694. .del {
  695. margin-left: 10px;
  696. }
  697. }
  698. }
  699. ::v-deep .el-descriptions {
  700. .el-form-item {
  701. margin-bottom: 0px;
  702. }
  703. }
  704. </style>