detailsPage.vue 35 KB

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