detailsPage.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108
  1. <template>
  2. <div>
  3. <div class="borderless">
  4. <div class="customer-head">
  5. <div class="customer-back">
  6. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  7. @click="backToList">返回列表
  8. </el-button>
  9. </div>
  10. <div class="add-customer-btn">
  11. <!--<el-button type="info" icon="el-icon-printer" size="small" @click.stop="openReport()">报表打印-->
  12. <!--</el-button>-->
  13. <el-button type="primary" size="small"
  14. class="el-button--small-yh" :disabled="!option.disabled" @click.stop="openEdit">编辑
  15. </el-button>
  16. <el-button type="primary" size="small" :disabled="option.disabled" @click="editCustomer">
  17. 保存数据
  18. </el-button>
  19. </div>
  20. </div>
  21. <trade-card title="基础资料" style="margin-top: 60px" v-loading="loadingBtn">
  22. <avue-form ref="form" class="trading-form" v-model="form" :option="option">
  23. <template slot="corpId">
  24. <crop-select v-model="form.corpId" corpType="KH" :disabled="option.disabled"
  25. @getCorpData="getCorpData"></crop-select>
  26. </template>
  27. </avue-form>
  28. </trade-card>
  29. <trade-card title="设备信息" v-loading="loadingBtn">
  30. <avue-crud ref="crud" :option="optionList" :data="data" :table-loading="loading" @saveColumn="saveColumn"
  31. @resetColumn="resetColumn" :cell-style="cellStyle">
  32. <template slot="headerSerial">
  33. <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"
  34. :disabled="option.disabled" circle></el-button>
  35. </template>
  36. <template slot="code" slot-scope="{ row, index }">
  37. <el-input v-if="row.$cellEdit" v-model="row.code"
  38. placeholder="请输入" size="small" :controls="false" style="width:100%;"></el-input>
  39. <span v-else>{{ row.code }}</span>
  40. </template>
  41. <template slot-scope="{ row, index }" slot="maintenanceSecond">
  42. <el-link type="primary" @click="maintenanceSecondC(row)">{{ row.maintenanceSecond }}</el-link>
  43. </template>
  44. <template slot="remarks" slot-scope="{ row, index }">
  45. <el-input v-if="row.$cellEdit" v-model="row.remarks"
  46. placeholder="请输入" size="small" :controls="false" style="width:100%;"></el-input>
  47. <span v-else>{{ row.remarks }}</span>
  48. </template>
  49. <template slot="exitDate" slot-scope="{ row, index }">
  50. <el-date-picker
  51. v-if="row.$cellEdit"
  52. v-model="row.exitDate"
  53. type="date"
  54. value-format="yyyy-MM-dd"
  55. size="small"
  56. placeholder="选择日期">
  57. </el-date-picker>
  58. <span v-else>{{ row.exitDate }}</span>
  59. </template>
  60. <template slot="maintenanceDate" slot-scope="{ row, index }">
  61. <el-date-picker
  62. v-if="row.$cellEdit"
  63. v-model="row.maintenanceDate"
  64. type="date"
  65. value-format="yyyy-MM-dd"
  66. size="small"
  67. placeholder="选择日期">
  68. </el-date-picker>
  69. <span v-else>{{ row.maintenanceDate }}</span>
  70. </template>
  71. <template slot="menu" slot-scope="{ row, index }">
  72. <el-button size="small" type="text" v-if="row.url" @click="imgurlfun(row)">信息码
  73. </el-button>
  74. <el-button
  75. :disabled="option.disabled"
  76. size="small"
  77. type="text"
  78. @click="annexOpen(row, index)"
  79. >附 件
  80. </el-button>
  81. <el-button size="small" type="text" :disabled="option.disabled" @click="rowCell(row, index)">{{
  82. row.$cellEdit ? "保存" : "修改"
  83. }}</el-button>
  84. <el-button size="small" type="text" :disabled="option.disabled" @click="rowDel(row, index)">删除
  85. </el-button>
  86. </template>
  87. </avue-crud>
  88. </trade-card>
  89. <containerTitle title="上传附件"></containerTitle>
  90. <c-upload v-loading="loadingBtn" typeUpload="SBDAFJ"
  91. deleteUrl="/api/blade-client/corpequipmentarchivesfiles/remove" :data="maintenanceFiles" display
  92. :enumerationValue="35.1"></c-upload>
  93. <!--<containerTitle title="上传附件"></containerTitle>-->
  94. <!--<c-upload v-loading="loadingBtn" typeUpload="CD"-->
  95. <!-- deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId" :data="orderFilesList" display-->
  96. <!-- :enumerationValue="35.1" :disabled="detailData.status == 1"></c-upload>-->
  97. <dictbiz-dialog ref="dictbiz" title="添加单位" code="unit" parentId="1585962784498225154" @closed="getAllWorkDicts">
  98. </dictbiz-dialog>
  99. <!--打印组件-->
  100. <report-dialog :switchDialog="switchDialog" :reportId="archivesId" reportName="汽保--信息码" @onClose="onClose()">
  101. </report-dialog>
  102. <!--图片查看-->
  103. <el-dialog
  104. title="信息码"
  105. :visible.sync="imgfalse"
  106. width="50%"
  107. append-to-body
  108. :before-close="imgfalseClose">
  109. <div>
  110. <div>
  111. <el-button type="info" icon="el-icon-printer" size="small" @click.stop="openReport()">打印
  112. </el-button>
  113. </div>
  114. <img :src="imgtext" alt="">
  115. </div>
  116. </el-dialog>
  117. <el-dialog title="导入项目" append-to-body class="el-dialogDeep" :visible.sync="productVisible" width="80%"
  118. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" @close="closeGoods">
  119. <el-row>
  120. <el-col :span="5" style="height: 100%;overflow-y: auto">
  121. <div>
  122. <el-scrollbar>
  123. <basic-container>
  124. <avue-tree :option="productOption" :data="productDataGoods" @node-click="productnodeClick" />
  125. </basic-container>
  126. </el-scrollbar>
  127. </div>
  128. </el-col>
  129. <el-col :span="19">
  130. <basic-container>
  131. <avue-crud ref="productCrud" :option="optionTwo" :data="productListShow" :page.sync="productPage"
  132. :search.sync="productSearch" @selection-change="productSelection" @search-change="goodsSearch"
  133. @current-change="productCurrent" @size-change="productSize"
  134. @refresh-change="productRefresh" :table-loading="loading"
  135. @saveColumn="productSave" @resetColumn="productReset" :cell-style="cellStyle">
  136. <template slot="menuLeft" slot-scope="{size}">
  137. <el-tabs v-model="activeName" @tab-click="tabHandle">
  138. <el-tab-pane label="查询结果" name="searchList"></el-tab-pane>
  139. <el-tab-pane label="已选定数据" name="importStaging"></el-tab-pane>
  140. </el-tabs>
  141. </template>
  142. <template slot-scope="scope" slot="menu">
  143. <el-button type="text" icon="el-icon-edit" size="small"
  144. @click.stop="importStagList(scope.row, scope.index)" v-if="activeName == 'searchList'"
  145. :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1">选择
  146. </el-button>
  147. <el-button type="text" icon="el-icon-delete" size="small"
  148. @click.stop="removeStagList(scope.row, scope.index)" v-else>移除
  149. </el-button>
  150. </template>
  151. </avue-crud>
  152. </basic-container>
  153. </el-col>
  154. </el-row>
  155. <span slot="footer" class="dialog-footer">
  156. <el-button @click="productVisible = false">取 消</el-button>
  157. <el-button type="primary" @click="importGoods">导入</el-button>
  158. </span>
  159. </el-dialog>
  160. </div>
  161. <el-dialog
  162. title="附件"
  163. :visible.sync="enclosure"
  164. append-to-body
  165. width="70%">
  166. <c-upload-Two
  167. typeUpload="GZ"
  168. :basic="true"
  169. deleteUrl="/api/blade-client/corpequipmentarchivesfiles/remove"
  170. :data="orderList"
  171. :enumerationValue="111"
  172. ></c-upload-Two>
  173. <span slot="footer" class="dialog-footer">
  174. <el-button @click="enclosure = false" size="small">取 消</el-button>
  175. <el-button type="primary" @click="saveAnnex" size="small">保 存</el-button>
  176. </span>
  177. </el-dialog>
  178. <el-dialog
  179. title="维修信息"
  180. :visible.sync="maintenanceSecondList"
  181. width="80%"
  182. append-to-body>
  183. <el-table :data="maintenanceData" style="width: 100%">
  184. <el-table-column prop="repairReportDate" label="报修日期"></el-table-column>
  185. <el-table-column prop="completeDate" label="完成日期"> </el-table-column>
  186. <el-table-column prop="maintenanceWorkerName" label="维修工">
  187. <template v-slot:default="scope">
  188. <el-link type="primary" @click="maintenanceWorkerNameClick(scope.row.id)">{{scope.row.maintenanceWorkerName}}</el-link>
  189. </template>
  190. </el-table-column>
  191. <el-table-column prop="maintenanceWorkerTel" label="维修电话"> </el-table-column>
  192. <el-table-column prop="maintenanceAmount" label="维修金额" width="180"> </el-table-column>
  193. </el-table>
  194. <el-pagination
  195. @size-change="getMaintenanceList"
  196. @current-change="getMaintenanceList"
  197. :current-page.sync="mPcurrent"
  198. :page-sizes="[10, 20, 30, 40]"
  199. :page-size="mPageSize"
  200. layout="sizes, prev, pager, next"
  201. :total="mDtotal"
  202. style="display: flex;
  203. justify-content: flex-end;">
  204. </el-pagination>
  205. <span slot="footer" class="dialog-footer">
  206. <el-button type="primary" @click="maintenanceSecondList = false">关 闭</el-button>
  207. </span>
  208. </el-dialog>
  209. </div>
  210. </template>
  211. <script>
  212. import { optionList } from "./js/optionList";
  213. import { optionTwo } from "./js/optionListTwo";
  214. import reportDialog from "@/components/report-dialog/main";
  215. import { multiply, sum, subtract } from "@/util/calculate";
  216. import { getListNew } from "@/api/basicData/product";
  217. import {getList as GYSgetList} from "@/api/basicData/client";
  218. import {getList as getListpp } from "@/api/tirePartsMall/basicData/brandPage";
  219. import {
  220. projectGoodsSubmit
  221. } from "@/api/basicData/ServiceLtems";
  222. import {
  223. corpequipmentarchivesDetail,
  224. corpequipmentarchivesitemRemove,
  225. corpequipmentarchivesSubmit,
  226. deleteImg
  227. } from "@/api/basicData/EquipmentArchives";
  228. import { getGoodstype } from "@/api/basicData/product";
  229. import {getFee, saveFile} from "../../api/landTransportation";
  230. import {getDictionary} from "../../api/system/dictbiz";
  231. import {maintenanceList} from "../../api/basicData/maintenanceQ";
  232. import router from "../../router/router";
  233. import {listAllP} from "../../api/tirePartsMall/basicData/listingManagement";
  234. export default {
  235. name: "index",
  236. data() {
  237. return {
  238. // 维修次数弹窗
  239. maintenanceSecondList: false,
  240. // 维修信息list
  241. maintenanceData: [],
  242. // 总共数量
  243. mDtotal: 0,
  244. // 每页数量
  245. mPageSize: 10,
  246. // 当前页
  247. mPcurrent: 1,
  248. // 图片的弹窗的开启
  249. imgfalse:false,
  250. imgtext:'',
  251. switchDialog: false,
  252. loadingBtn: false,
  253. addressTitle: null,
  254. form: {},
  255. form2: {
  256. },
  257. form3: {
  258. },
  259. data: [],
  260. enclosure: false,
  261. orderList: [],
  262. option: {
  263. menuBtn: false,
  264. labelWidth: 90,
  265. disabled: false,
  266. column: [
  267. {
  268. label: "客户",
  269. prop: "corpId",
  270. rules: [
  271. {
  272. required: true,
  273. message: "",
  274. trigger: "blur"
  275. }
  276. ],
  277. span: 16,
  278. },
  279. {
  280. label: "电话",
  281. prop: "contactsTel",
  282. search: true,
  283. overHidden: true,
  284. span: 8,
  285. rules: [
  286. {
  287. required: true,
  288. message: "",
  289. trigger: "blur"
  290. }
  291. ],
  292. },
  293. {
  294. label: "地址",
  295. prop: "address",
  296. overHidden: true,
  297. span: 8,
  298. rules: [
  299. {
  300. required: true,
  301. message: "",
  302. trigger: "blur"
  303. }
  304. ],
  305. },
  306. {
  307. label: "联系人",
  308. prop: "contacts",
  309. search: true,
  310. overHidden: true,
  311. span: 8,
  312. rules: [
  313. {
  314. required: true,
  315. message: "",
  316. trigger: "blur"
  317. }
  318. ],
  319. },
  320. {
  321. label: "编号",
  322. prop: "sysNo",
  323. search: true,
  324. overHidden: true,
  325. disabled:true,
  326. span: 8,
  327. },
  328. {
  329. label: "设备数量",
  330. prop: "equipmentNumber",
  331. disabled:true,
  332. overHidden: true,
  333. span: 4,
  334. },
  335. {
  336. label: "维修次数",
  337. prop: "maintenanceSecond",
  338. disabled:true,
  339. span: 4,
  340. },
  341. {
  342. label: "合同起",
  343. prop: "signingDateStart",
  344. type: "date",
  345. format: "yyyy-MM-dd",
  346. valueFormat: "yyyy-MM-dd 00:00:00",
  347. span: 8,
  348. },
  349. {
  350. label: "合同止",
  351. prop: "signingDateEnd",
  352. type: "date",
  353. format: "yyyy-MM-dd",
  354. valueFormat: "yyyy-MM-dd 00:00:00",
  355. span: 8,
  356. },
  357. {
  358. label: "备注",
  359. prop: "remarks",
  360. type: "textarea",
  361. minRows: 3,
  362. span: 16,
  363. }
  364. ]
  365. },
  366. // 附件
  367. maintenanceFiles: [],
  368. optiontabs1: {
  369. menuBtn: false,
  370. labelWidth: 90,
  371. column: [
  372. {
  373. label: "简称",
  374. prop: "a",
  375. type: "select",
  376. span: 24,
  377. },
  378. {
  379. label: "地址",
  380. prop: "b",
  381. type: "select",
  382. span: 24,
  383. },
  384. {
  385. label: "详细地址",
  386. prop: "c",
  387. span: 24,
  388. },
  389. {
  390. label: "邮编",
  391. prop: "d",
  392. span: 24,
  393. },
  394. {
  395. label: "备注",
  396. prop: "e",
  397. type: 'textarea',
  398. minRows: 3,
  399. span: 24,
  400. },
  401. {
  402. label: "地址智能识别",
  403. prop: "ad",
  404. placeholder: "例:上海市徐汇区枫林街道斜土路100号",
  405. type: "textarea",
  406. minRows: 3,
  407. span: 24,
  408. }
  409. ]
  410. },
  411. optiontabs2: {
  412. menuBtn: false,
  413. labelWidth: 80,
  414. column: [
  415. {
  416. label: "目的地",
  417. prop: "a",
  418. type: "select",
  419. rules: [
  420. {
  421. required: true,
  422. message: "",
  423. trigger: "blur"
  424. }
  425. ],
  426. span: 24,
  427. },
  428. {
  429. label: "物流公司",
  430. prop: "b",
  431. span: 24,
  432. },
  433. {
  434. label: "电话",
  435. prop: "c",
  436. span: 24,
  437. },
  438. {
  439. label: "地址",
  440. prop: "d",
  441. span: 24,
  442. },
  443. {
  444. label: "详细地址",
  445. prop: "e",
  446. span: 24,
  447. },
  448. {
  449. label: "邮编",
  450. prop: "f",
  451. span: 24,
  452. },
  453. {
  454. label: "备注",
  455. prop: "remarks",
  456. type: "textarea",
  457. minRows: 3,
  458. span: 24,
  459. },
  460. {
  461. label: "地址智能识别",
  462. prop: "g",
  463. type: "textarea",
  464. minRows: 3,
  465. span: 24,
  466. }
  467. ]
  468. },
  469. // 商品信息列表配置
  470. optionList: {},
  471. // 商品产品下拉数据
  472. goodsoptions: [],
  473. // 附件
  474. orderFilesList: [],
  475. // 导入项目的弹窗
  476. productVisible:false,
  477. // 产品左侧类别
  478. productOption: {
  479. addBtn: false,
  480. menu: false,
  481. size: "small",
  482. props: {
  483. labelText: "标题",
  484. label: "title",
  485. value: "value",
  486. }
  487. },
  488. // 产品左侧是数据
  489. productDataGoods:[],
  490. // 产品弹窗列表
  491. optionTwo:optionTwo,
  492. productPage:{
  493. pageSize: 20,
  494. currentPage: 1,
  495. total: 0,
  496. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  497. },
  498. productListShow:[],
  499. // 暂存的数据
  500. goodsListSave:[],
  501. // 产品弹窗tabs切换
  502. activeName:'searchList',
  503. // 弹窗选中的数据
  504. tableData:[],
  505. productSearch:{},
  506. loading:false,
  507. dataId: '',
  508. // 设备id
  509. archivesId: '',
  510. };
  511. },
  512. props: {
  513. detailData: {
  514. type: Object
  515. }
  516. },
  517. components: {
  518. reportDialog
  519. },
  520. async created() {
  521. this.optionList = optionList
  522. // 获取字典数据
  523. this.getAllWorkDicts()
  524. // 查看是否要id调用详情
  525. if (this.detailData.id) {
  526. this.option.disabled = true
  527. this.getDetail(this.detailData.id);
  528. }
  529. if (this.detailData.status == 1) {
  530. this.option.disabled = true;
  531. }
  532. // 获取产品数据
  533. // getAllgoods().then(res => {
  534. // this.goodsoptions = res.data.data
  535. // });
  536. },
  537. methods: {
  538. getMaintenanceList(pageSize) {
  539. this.mPageSize = pageSize
  540. this.maintenanceSecondC()
  541. },
  542. // 维修次数点击事件
  543. maintenanceSecondC(row) {
  544. this.archivesId = row.id
  545. var params = {
  546. archivesId: this.form.id,
  547. deviceId: row.srcId
  548. }
  549. maintenanceList(this.mPcurrent, this.mPageSize, params).then(res => {
  550. this.mDtotal = res.data.data.total
  551. this.mPcurrent = res.data.data.current;
  552. this.maintenanceData = res.data.data.records
  553. })
  554. this.maintenanceSecondList = true
  555. },
  556. // 打印报表按钮事件
  557. openReport() {
  558. this.switchDialog = !this.switchDialog;
  559. },
  560. onClose(val) {
  561. this.switchDialog = val;
  562. },
  563. // 跳转路由
  564. maintenanceWorkerNameClick(id) {
  565. router.push({path: '/maintenanceQ/index/', query: {id: id}})
  566. },
  567. // 获取下拉字典
  568. getAllWorkDicts() {
  569. // 获取地址信息
  570. // this.findObject(this.option.column, "address").dicData = JSON.parse(localStorage.getItem('areaTypeTree'))
  571. getGoodstype().then(res => {
  572. this.findObject(this.optionList.column, "goodsTypeId").dicData = res.data.data;
  573. });
  574. // 获取品牌数据
  575. // getListpp().then(res=>{
  576. // this.findObject(this.optionList.column, "brand").dicData = res.data.data.records
  577. // this.findObject(this.optionTwo.column, "brand").dicData = res.data.data.records
  578. // })
  579. // 品牌
  580. var type = {
  581. type: 'PP'
  582. }
  583. listAllP(type).then(res => {
  584. this.findObject(this.optionTwo.column, "brandId").dicData = res.data.data.records
  585. })
  586. // 获取供应商厂家数据
  587. GYSgetList(1,20, {corpType:'GYS'}).then(res=>{
  588. this.findObject(this.optionTwo.column, "corpId").dicData = res.data.data.records
  589. })
  590. },
  591. cellStyle() {
  592. return "padding:0;height:40px;";
  593. },
  594. //打开附件
  595. annexOpen(row, index) {
  596. this.dataId = index
  597. this.orderList = row.filesList?row.filesList:[];
  598. for (let order of this.orderList) {
  599. order.paymentType = order.typeFiles
  600. }
  601. this.enclosure = true
  602. },
  603. //保存
  604. saveAnnex() {
  605. for (const key in this.orderList) {
  606. this.orderList[key].sort = Number(key) + 1
  607. this.orderList[key].typeFiles = this.orderList[key].paymentType
  608. }
  609. this.data[this.dataId].filesList = this.orderList;
  610. this.enclosure = false
  611. // saveFile({
  612. // id: this.formAnnex.id,
  613. // fileList: this.orderList
  614. // }).then(res => {
  615. // console.log(res)
  616. // this.$message.success("保存成功");
  617. // this.annexOpen(this.formAnnex)
  618. // })
  619. },
  620. amountChange() {
  621. let val = 0
  622. this.data.forEach(e => {
  623. val = sum(val, e.amount)
  624. this.form.purchaseAmount = val
  625. this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
  626. })
  627. },
  628. // countChange(row) {
  629. // row.amount = multiply(row.price, row.storageInQuantity)
  630. // row.storageAmount = multiply(row.purchaseAmount, row.storageInQuantity)
  631. // let val = 0
  632. // this.data.forEach(e => {
  633. // val = sum(val, e.amount)
  634. // this.form.purchaseAmount = val
  635. // this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
  636. // })
  637. // },
  638. // 获取详情数据
  639. getDetail(id) {
  640. this.loadingBtn = true
  641. corpequipmentarchivesDetail({ id: id })
  642. .then(res => {
  643. this.form = res.data.data;
  644. this.data = res.data.data.corpEquipmentArchivesItemList;
  645. this.maintenanceFiles = res.data.data.filesList;
  646. // this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
  647. })
  648. .finally(() => {
  649. this.loadingBtn = false;
  650. });
  651. },
  652. // 客户下拉框
  653. getCorpData(row) {
  654. if (row) {
  655. this.form.corpName = row.cname
  656. this.form.contactsTel = row.tel
  657. // 地址和联系人
  658. this.form.address = row.details
  659. this.form.contacts = row.attn
  660. } else {
  661. this.form.corpName = null
  662. this.form.contactsTel = null
  663. }
  664. },
  665. addRow() {
  666. this.$refs["form"].validate((valid, done) => {
  667. done();
  668. if (valid) {
  669. // this.data.push({ $cellEdit: true, storageId: this.form.storageId })
  670. this.tableData = []
  671. this.goodsListSave = []
  672. // 获取产品弹窗的左侧类型
  673. this.getGoodstypefun()
  674. var dict = {
  675. code : 'unit'
  676. }
  677. getDictionary(dict).then(res => {
  678. this.findObject(this.optionTwo.column, "unit").dicData = res.data.data;
  679. })
  680. this.productonLoad(this.productPage, this.productSearch);
  681. this.productVisible = true
  682. } else {
  683. return false;
  684. }
  685. });
  686. },
  687. rowCell(row, index) {
  688. if (row.$cellEdit == true) {
  689. this.$set(row, "$cellEdit", false);
  690. } else {
  691. this.$set(row, "$cellEdit", true);
  692. }
  693. },
  694. // 删除
  695. rowDel(row, index) {
  696. this.$confirm("确定删除数据?", {
  697. confirmButtonText: "确定",
  698. cancelButtonText: "取消",
  699. type: "warning"
  700. }).then(() => {
  701. if (row.id) {
  702. corpequipmentarchivesitemRemove({ids:row.id}).then(res => {
  703. this.$message({
  704. type: "success",
  705. message: "删除成功!"
  706. });
  707. this.data.splice(index, 1);
  708. });
  709. } else {
  710. this.$message({
  711. type: "success",
  712. message: "删除成功!"
  713. });
  714. this.data.splice(index, 1);
  715. }
  716. this.form.equipmentNumber = this.data.length
  717. });
  718. },
  719. //修改提交触发
  720. editCustomer() {
  721. this.$refs["form"].validate((valid, done) => {
  722. done();
  723. if (valid) {
  724. if (this.data.length == 0) {
  725. return this.$message.error('请添加一条商品信息');
  726. }
  727. // corpId 客户id
  728. // corpName 客户名称
  729. // sysNo 编号
  730. // equipmentNumber 设备数量
  731. // maintenance_second 维修次数
  732. // signingDate_start 签约开始时间
  733. // signingDate_end 签约结束时间
  734. // remarks 备注(收费指示)
  735. // updateUser 修改人
  736. // createUser 创建人
  737. // createTime 创建时间
  738. // updateTime 修改时间
  739. // status 状态(0 正常 1停用)
  740. // corpEquipmentArchivesItemList 设备明细
  741. // cname 设备名称
  742. // code 设备编码
  743. // brand 品牌
  744. // specs 规格尺寸
  745. // category 产品类别
  746. // categoryitem 产品分类
  747. // url 图片
  748. // goodsTypeId 商品类型id
  749. // exitDate 出场日期
  750. // repairReportDate 报修日期
  751. // brandId 品牌id
  752. let arr = this.data.map(item=>{
  753. return {
  754. id:item.id?item.id:null,
  755. cname:item.cname,
  756. code:item.code,
  757. brand:item.brand,
  758. brandId:item.brandId,
  759. specs:item.specs,
  760. remarks:item.remarks,
  761. goodsTypeId:item.goodsTypeId,
  762. srcId:item.srcId,
  763. // goodsTypeName:item.goodsTypeName,
  764. maintenanceSecond:item.maintenanceSecond?item.maintenanceSecond:0,
  765. exitDate:item.exitDate?item.exitDate + ' 00:00:00':item.exitDate,
  766. maintenanceDate:item.maintenanceDate?item.maintenanceDate + ' 00:00:00':item.maintenanceDate,
  767. repairReportDate:item.repairReportDate,
  768. url:item.url?item.url:null,
  769. factoryId:item.factoryId?item.factoryId:null,
  770. factoryName:item.factoryName?item.factoryName:null,
  771. categoryitem:item.categoryitem?item.categoryitem:null,
  772. equipmentDescribe:item.equipmentDescribe?item.equipmentDescribe:null,
  773. filesList:item.filesList
  774. }
  775. })
  776. for (const key in this.maintenanceFiles) {
  777. this.maintenanceFiles[key].sort = Number(key) + 1
  778. this.maintenanceFiles[key].typeFiles = this.maintenanceFiles[key].paymentType
  779. }
  780. const obj = {
  781. id:this.form.id?this.form.id:null,
  782. corpId:this.form.corpId,
  783. corpName:this.form.corpName,
  784. sysNo:null,
  785. equipmentNumber:this.data.length,
  786. maintenanceSecond:this.form.maintenanceSecond?this.form.maintenanceSecond:0,
  787. signingDateStart:this.form.signingDateStart,
  788. signingDateEnd:this.form.signingDateEnd,
  789. contacts:this.form.contacts,
  790. contactsTel:this.form.contactsTel,
  791. address:this.form.address,
  792. remarks:this.form.remarks,
  793. corpEquipmentArchivesItemList:arr,
  794. filesList:this.maintenanceFiles
  795. }
  796. this.loadingBtn = true;
  797. // 附件
  798. // console.log(this.orderFilesList,522)
  799. corpequipmentarchivesSubmit({
  800. ...obj,
  801. })
  802. .then(res => {
  803. this.$message.success("保存成功");
  804. this.form = res.data.data;
  805. this.data = res.data.data.corpEquipmentArchivesItemList;
  806. // this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
  807. this.detailData.status = 1
  808. this.option.disabled = true;
  809. this.$refs.crud.refreshTable();
  810. })
  811. .finally(() => {
  812. this.loadingBtn = false;
  813. });
  814. } else {
  815. return false;
  816. }
  817. });
  818. },
  819. // 查看图片
  820. imgurlfun(row){
  821. this.imgfalse = true
  822. this.archivesId = row.id
  823. this.imgtext = row.url
  824. },
  825. imgfalseClose(){
  826. this.imgtext = ''
  827. this.imgfalse = false
  828. },
  829. async saveColumn() {
  830. const inSave = optionList
  831. if (inSave) {
  832. this.$nextTick(() => {
  833. this.$refs.crud.doLayout();
  834. });
  835. this.$message.success("保存成功");
  836. //关闭窗口
  837. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  838. }
  839. },
  840. async resetColumn() {
  841. this.optionList = optionList;
  842. const inSave = optionList
  843. if (inSave) {
  844. this.$nextTick(() => {
  845. this.$refs.crud.doLayout();
  846. });
  847. this.getAllWorkDicts()
  848. this.$message.success("重置成功");
  849. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  850. }
  851. },
  852. openEdit() {
  853. // this.detailData.status = 2
  854. this.option.disabled = false
  855. this.option = this.$options.data().option;
  856. this.$refs.crud.refreshTable();
  857. },
  858. //返回列表
  859. backToList() {
  860. this.$emit("goBack");
  861. },
  862. // ---------------------------------产品弹窗----------------------------------------
  863. // 产品弹窗导入
  864. importGoods(){
  865. if (this.goodsListSave.length > 0) {
  866. for (let item of this.goodsListSave) {
  867. const srcId = item.id
  868. delete item.id
  869. this.data.push({
  870. $cellEdit: true,
  871. storageId: this.form.storageId,
  872. factoryId:item.corpId,
  873. srcId:srcId,
  874. factoryName:item.corpName,
  875. ...item,
  876. equipmentDescribe:item.cname,
  877. })
  878. }
  879. }else {
  880. for (let item of this.tableData) {
  881. const srcId = item.id
  882. delete item.id
  883. this.data.push({
  884. $cellEdit: true,
  885. storageId: this.form.storageId,
  886. srcId:srcId,
  887. factoryId:item.corpId,
  888. factoryName:item.corpName,
  889. ...item,
  890. equipmentDescribe:item.cname,
  891. })
  892. }
  893. }
  894. this.form.equipmentNumber = this.data.length
  895. this.productVisible = false
  896. },
  897. // 产品选择左侧数据
  898. productnodeClick(data){
  899. this.productSearch.goodsTypeId = data.value
  900. this.productPage.currentPage = 1;
  901. this.productonLoad(this.productPage, this.productSearch);
  902. },
  903. // 产品弹窗的列表数据获取
  904. productonLoad(page, params = {}){
  905. let data = this.deepClone(Object.assign(params, this.productSearch));
  906. this.loading = true;
  907. getListNew(
  908. page.currentPage,
  909. page.pageSize,
  910. data
  911. ).then(res=>{
  912. // this.productListShow = res.data.data.records ? res.data.data.records : [];
  913. this.productListShow = res.data.data.records
  914. this.productPage.total = res.data.data.total;
  915. this.$nextTick(() => {
  916. this.$refs.productCrud.doLayout();
  917. });
  918. }).finally(() => {
  919. this.loading = false;
  920. });
  921. },
  922. // 标签页切换
  923. tabHandle(data) {
  924. if (data.name == 'searchList') {
  925. this.productListShow = this.data;
  926. // this.productSearch.total = this.pageList.total
  927. this.productonLoad(this.productPage,this.productSearch);
  928. } else if (data.name == 'importStaging') {
  929. this.productListShow = this.goodsListSave;
  930. this.productSearch.total = 0
  931. }
  932. },
  933. // 获取产品左侧数据
  934. getGoodstypefun(){
  935. getGoodstype().then(res => {
  936. this.productDataGoods = res.data.data;
  937. });
  938. },
  939. // 弹窗选中的数据
  940. importStagList(row, index) {
  941. this.goodsListSave.push(row);
  942. },
  943. // 产品弹窗移除
  944. removeStagList(row, index) {
  945. this.goodsListSave.splice(row.$index, 1)
  946. },
  947. // 产品弹窗刷新触发
  948. productRefresh(){
  949. // this.treeDeptId = '';
  950. this.productPage.currentPage = 1;
  951. this.productonLoad(this.productPage,this.productSearch);
  952. },
  953. // 产品弹窗选择触发
  954. productSelection(list) {
  955. this.tableData = list
  956. },
  957. // 产品弹窗搜索按钮触发
  958. goodsSearch(params, done) {
  959. // this.treeDeptId = '';
  960. this.productonLoad(this.productPage,params);
  961. done()
  962. },
  963. // 产品弹窗分页
  964. productCurrent(val){
  965. this.productPage.currentPage = val;
  966. },
  967. productSize(val){
  968. this.productPage.currentPage = 1;
  969. this.productPage.pageSize = val;
  970. },
  971. // 产品弹窗的重置和保存
  972. productSave(){
  973. const inSave = optionTwo
  974. if (inSave) {
  975. this.$nextTick(() => {
  976. this.$refs.productCrud.doLayout();
  977. });
  978. this.$message.success("保存成功");
  979. //关闭窗口
  980. this.$refs.productCrud.$refs.dialogColumn.columnBox = false;
  981. }
  982. },
  983. productReset(){
  984. this.optionTwo = optionTwo;
  985. const inSave = option
  986. if (inSave) {
  987. this.$nextTick(() => {
  988. this.$refs.productCrud.doLayout();
  989. });
  990. this.getAllWorkDicts()
  991. this.$message.success("重置成功");
  992. this.$refs.productCrud.$refs.dialogColumn.columnBox = false;
  993. }
  994. },
  995. // 关闭弹窗的回调
  996. closeGoods() {
  997. this.productDataGoods = [];
  998. // this.treeDeptId = "";
  999. this.activeName = "searchList";
  1000. },
  1001. },
  1002. watch: {
  1003. // data: function (rows) {
  1004. // let val = 0
  1005. // rows.forEach(e => {
  1006. // val = sum(val, e.amount)
  1007. // this.form.purchaseAmount = val
  1008. // this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
  1009. // })
  1010. // }
  1011. }
  1012. };
  1013. </script>
  1014. <style lang="scss" scoped>
  1015. .trading-form ::v-deep .el-form-item {
  1016. margin-bottom: 8px !important;
  1017. }
  1018. ::v-deep .el-dialog__body {
  1019. padding: 0px 20px 15px 20px;
  1020. }
  1021. ::v-deep .el-form-item__error {
  1022. display: none !important;
  1023. }
  1024. .img-form ::v-deep .el-form-item {
  1025. height: 150px;
  1026. line-height: 150px;
  1027. margin-bottom: 8px !important;
  1028. }
  1029. .img-form ::v-deep .avue-upload__icon {
  1030. font-size: 20px;
  1031. width: 150px;
  1032. height: 150px;
  1033. line-height: 150px;
  1034. }
  1035. ::v-deep .el-table .cell {
  1036. padding: 0 2px !important;
  1037. }
  1038. ::v-deep .avue-crud .el-table .el-form-item__label {
  1039. left: -1px;
  1040. }
  1041. .addressTabs {
  1042. display: flex;
  1043. justify-content: center;
  1044. span {
  1045. width: 100px;
  1046. font-size: 18px;
  1047. font-weight: 600;
  1048. text-align: center;
  1049. }
  1050. }
  1051. </style>