detailsPage.vue 36 KB

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