| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119 |
- <template>
- <div>
- <div class="borderless">
- <div class="customer-head">
- <div class="customer-back">
- <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
- @click="backToList">返回列表
- </el-button>
- </div>
- <div class="add-customer-btn">
- <!--<el-button type="info" icon="el-icon-printer" size="small" @click.stop="openReport()">报表打印-->
- <!--</el-button>-->
- <el-button type="primary" size="small"
- class="el-button--small-yh" :disabled="!option.disabled" @click.stop="openEdit">编辑
- </el-button>
- <el-button type="primary" size="small" :disabled="option.disabled" @click="editCustomer">
- 保存数据
- </el-button>
- </div>
- </div>
- <trade-card title="基础资料" style="margin-top: 60px" v-loading="loadingBtn">
- <avue-form ref="form" class="trading-form" v-model="form" :option="option">
- <template slot="corpId">
- <crop-select v-model="form.corpId" corpType="KH" :disabled="option.disabled"
- @getCorpData="getCorpData"></crop-select>
- </template>
- </avue-form>
- </trade-card>
- <trade-card title="设备信息" v-loading="loadingBtn">
- <avue-crud ref="crud" :option="optionList" :data="data" :table-loading="loading" @saveColumn="saveColumn"
- @resetColumn="resetColumn" :cell-style="cellStyle">
- <template slot="headerSerial">
- <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"
- :disabled="option.disabled" circle></el-button>
- </template>
- <template slot="code" slot-scope="{ row, index }">
- <el-input v-if="row.$cellEdit" v-model="row.code"
- placeholder="请输入" size="small" :controls="false" style="width:100%;"></el-input>
- <span v-else>{{ row.code }}</span>
- </template>
- <template slot-scope="{ row, index }" slot="maintenanceSecond">
- <el-link type="primary" @click="maintenanceSecondC(row)">{{ row.maintenanceSecond }}</el-link>
- </template>
- <template slot="remarks" slot-scope="{ row, index }">
- <el-input v-if="row.$cellEdit" v-model="row.remarks"
- placeholder="请输入" size="small" :controls="false" style="width:100%;"></el-input>
- <span v-else>{{ row.remarks }}</span>
- </template>
- <template slot="exitDate" slot-scope="{ row, index }">
- <el-date-picker
- v-if="row.$cellEdit"
- v-model="row.exitDate"
- type="date"
- value-format="yyyy-MM-dd"
- size="small"
- placeholder="选择日期">
- </el-date-picker>
- <span v-else>{{ row.exitDate }}</span>
- </template>
- <template slot="maintenanceDate" slot-scope="{ row, index }">
- <el-date-picker
- v-if="row.$cellEdit"
- v-model="row.maintenanceDate"
- type="date"
- value-format="yyyy-MM-dd"
- size="small"
- placeholder="选择日期">
- </el-date-picker>
- <span v-else>{{ row.maintenanceDate }}</span>
- </template>
- <template slot="installDate" slot-scope="{ row, index }">
- <el-date-picker
- v-if="row.$cellEdit"
- v-model="row.installDate"
- type="date"
- value-format="yyyy-MM-dd"
- size="small"
- placeholder="选择日期">
- </el-date-picker>
- <span v-else>{{ row.installDate }}</span>
- </template>
- <template slot="menu" slot-scope="{ row, index }">
- <el-button size="small" type="text" v-if="row.url" @click="imgurlfun(row)">信息码
- </el-button>
- <el-button
- :disabled="option.disabled"
- size="small"
- type="text"
- @click="annexOpen(row, index)"
- >附 件
- </el-button>
- <el-button size="small" type="text" :disabled="option.disabled" @click="rowCell(row, index)">{{
- row.$cellEdit ? "保存" : "修改"
- }}</el-button>
- <el-button size="small" type="text" :disabled="option.disabled" @click="rowDel(row, index)">删除
- </el-button>
- </template>
- </avue-crud>
- </trade-card>
- <containerTitle title="上传附件 (图片文件像素推荐700X700,有且只允许有一张主图,其余均为副图)"></containerTitle>
- <c-upload v-loading="loadingBtn" typeUpload="SBDAFJ"
- deleteUrl="/blade-client/corpequipmentarchivesfiles/remove" :data="maintenanceFiles" display
- :enumerationValue="35.1"></c-upload>
- <!--<containerTitle title="上传附件"></containerTitle>-->
- <!--<c-upload v-loading="loadingBtn" typeUpload="CD"-->
- <!-- deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId" :data="orderFilesList" display-->
- <!-- :enumerationValue="35.1" :disabled="detailData.status == 1"></c-upload>-->
- <dictbiz-dialog ref="dictbiz" title="添加单位" code="unit" parentId="1585962784498225154" @closed="getAllWorkDicts">
- </dictbiz-dialog>
- <!--打印组件-->
- <report-dialog :switchDialog="switchDialog" :reportId="archivesId" reportName="汽保--信息码" @onClose="onClose()">
- </report-dialog>
- <!--图片查看-->
- <el-dialog
- title="信息码"
- :visible.sync="imgfalse"
- width="50%"
- append-to-body
- :before-close="imgfalseClose">
- <div>
- <div>
- <el-button type="info" icon="el-icon-printer" size="small" @click.stop="openReport()">打印
- </el-button>
- </div>
- <img :src="imgtext" alt="">
- </div>
- </el-dialog>
- <el-dialog title="导入项目" append-to-body class="el-dialogDeep" :visible.sync="productVisible" width="80%"
- :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" @close="closeGoods">
- <el-row>
- <el-col :span="5" style="height: 100%;overflow-y: auto">
- <div>
- <el-scrollbar>
- <basic-container>
- <avue-tree :option="productOption" :data="productDataGoods" @node-click="productnodeClick" />
- </basic-container>
- </el-scrollbar>
- </div>
- </el-col>
- <el-col :span="19">
- <basic-container>
- <avue-crud ref="productCrud" :option="optionTwo" :data="productListShow" :page.sync="productPage"
- :search.sync="productSearch" @selection-change="productSelection" @search-change="goodsSearch"
- @current-change="productCurrent" @size-change="productSize"
- @refresh-change="productRefresh" :table-loading="loading"
- @saveColumn="productSave" @resetColumn="productReset" :cell-style="cellStyle">
- <template slot="menuLeft" slot-scope="{size}">
- <el-tabs v-model="activeName" @tab-click="tabHandle">
- <el-tab-pane label="查询结果" name="searchList"></el-tab-pane>
- <el-tab-pane label="已选定数据" name="importStaging"></el-tab-pane>
- </el-tabs>
- </template>
- <template slot-scope="scope" slot="menu">
- <el-button type="text" icon="el-icon-edit" size="small"
- @click.stop="importStagList(scope.row, scope.index)" v-if="activeName == 'searchList'"
- :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1">选择
- </el-button>
- <el-button type="text" icon="el-icon-delete" size="small"
- @click.stop="removeStagList(scope.row, scope.index)" v-else>移除
- </el-button>
- </template>
- </avue-crud>
- </basic-container>
- </el-col>
- </el-row>
- <span slot="footer" class="dialog-footer">
- <el-button @click="productVisible = false">取 消</el-button>
- <el-button type="primary" @click="importGoods">导入</el-button>
- </span>
- </el-dialog>
- </div>
- <el-dialog
- title="附件 (图片文件像素推荐700X750,有且只允许有一张主图,其余均为副图)"
- :visible.sync="enclosure"
- append-to-body
- width="70%">
- <c-upload-Two
- typeUpload="GZ"
- :basic="true"
- deleteUrl="/api/blade-client/corpequipmentarchivesfiles/remove"
- :data="orderList"
- :enumerationValue="111"
- ></c-upload-Two>
- <span slot="footer" class="dialog-footer">
- <el-button @click="enclosure = false" size="small">取 消</el-button>
- <el-button type="primary" @click="saveAnnex" size="small">保 存</el-button>
- </span>
- </el-dialog>
- <el-dialog
- title="维修信息"
- :visible.sync="maintenanceSecondList"
- width="80%"
- append-to-body>
- <el-table :data="maintenanceData" style="width: 100%">
- <el-table-column prop="repairReportDate" label="报修日期"></el-table-column>
- <el-table-column prop="completeDate" label="完成日期"> </el-table-column>
- <el-table-column prop="sysNo" label="单号">
- <template slot-scope="{ row }">
- <!--<span style="">{{row.sysNo}}</span>-->
- <el-link type="primary" @click="maintenanceWorkerNameClick(row.id)">{{ row.sysNo }}123</el-link>
- </template>
- </el-table-column>
- <el-table-column prop="maintenanceWorkerName" label="维修工">
- <template v-slot:default="scope">
- <el-link type="primary" @click="maintenanceWorkerNameClick(scope.row.id)">{{scope.row.maintenanceWorkerName}}</el-link>
- </template>
- </el-table-column>
- <el-table-column prop="maintenanceWorkerTel" label="维修电话"> </el-table-column>
- <el-table-column prop="maintenanceAmount" label="维修金额" width="180"> </el-table-column>
- </el-table>
- <el-pagination
- @size-change="getMaintenanceList"
- @current-change="getMaintenanceList"
- :current-page.sync="mPcurrent"
- :page-sizes="[10, 20, 30, 40]"
- :page-size="mPageSize"
- layout="sizes, prev, pager, next"
- :total="mDtotal"
- style="display: flex;
- justify-content: flex-end;">
- </el-pagination>
- <span slot="footer" class="dialog-footer">
- <el-button type="primary" @click="maintenanceSecondList = false">关 闭</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import { optionList } from "./js/optionList";
- import { optionTwo } from "./js/optionListTwo";
- import reportDialog from "@/components/report-dialog/main";
- import { multiply, sum, subtract } from "@/util/calculate";
- import { getListNew } from "@/api/basicData/product";
- import {getList as GYSgetList} from "@/api/basicData/client";
- import {getList as getListpp } from "@/api/tirePartsMall/basicData/brandPage";
- import {
- projectGoodsSubmit
- } from "@/api/basicData/ServiceLtems";
- import {
- corpequipmentarchivesDetail,
- corpequipmentarchivesitemRemove,
- corpequipmentarchivesSubmit,
- deleteImg
- } from "@/api/basicData/EquipmentArchives";
- import { getGoodstype } from "@/api/basicData/product";
- import {getFee, saveFile} from "../../api/landTransportation";
- import {getDictionary} from "../../api/system/dictbiz";
- import {maintenanceList} from "../../api/basicData/maintenanceQ";
- import router from "../../router/router";
- import {listAllP} from "../../api/tirePartsMall/basicData/listingManagement";
- export default {
- name: "index",
- data() {
- return {
- // 维修次数弹窗
- maintenanceSecondList: false,
- // 维修信息list
- maintenanceData: [],
- // 总共数量
- mDtotal: 0,
- // 每页数量
- mPageSize: 10,
- // 当前页
- mPcurrent: 1,
- // 图片的弹窗的开启
- imgfalse:false,
- imgtext:'',
- switchDialog: false,
- loadingBtn: false,
- addressTitle: null,
- form: {},
- form2: {
- },
- form3: {
- },
- data: [],
- enclosure: false,
- orderList: [],
- option: {
- menuBtn: false,
- labelWidth: 90,
- disabled: false,
- column: [
- {
- label: "客户",
- prop: "corpId",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 16,
- },
- {
- label: "电话",
- prop: "contactsTel",
- search: true,
- overHidden: true,
- span: 8,
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- },
- {
- label: "地址",
- prop: "address",
- overHidden: true,
- span: 8,
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- },
- {
- label: "联系人",
- prop: "contacts",
- search: true,
- overHidden: true,
- span: 8,
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- },
- {
- label: "编号",
- prop: "sysNo",
- search: true,
- overHidden: true,
- disabled:true,
- span: 8,
- },
- {
- label: "设备数量",
- prop: "equipmentNumber",
- disabled:true,
- overHidden: true,
- span: 4,
- },
- {
- label: "维修次数",
- prop: "maintenanceSecond",
- disabled:true,
- span: 4,
- },
- {
- label: "合同起",
- prop: "signingDateStart",
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd 00:00:00",
- span: 8,
- },
- {
- label: "合同止",
- prop: "signingDateEnd",
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd 00:00:00",
- span: 8,
- },
- {
- label: "备注",
- prop: "remarks",
- type: "textarea",
- minRows: 3,
- span: 16,
- }
- ]
- },
- // 附件
- maintenanceFiles: [],
- optiontabs1: {
- menuBtn: false,
- labelWidth: 90,
- column: [
- {
- label: "简称",
- prop: "a",
- type: "select",
- span: 24,
- },
- {
- label: "地址",
- prop: "b",
- type: "select",
- span: 24,
- },
- {
- label: "详细地址",
- prop: "c",
- span: 24,
- },
- {
- label: "邮编",
- prop: "d",
- span: 24,
- },
- {
- label: "备注",
- prop: "e",
- type: 'textarea',
- minRows: 3,
- span: 24,
- },
- {
- label: "地址智能识别",
- prop: "ad",
- placeholder: "例:上海市徐汇区枫林街道斜土路100号",
- type: "textarea",
- minRows: 3,
- span: 24,
- }
- ]
- },
- optiontabs2: {
- menuBtn: false,
- labelWidth: 80,
- column: [
- {
- label: "目的地",
- prop: "a",
- type: "select",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 24,
- },
- {
- label: "物流公司",
- prop: "b",
- span: 24,
- },
- {
- label: "电话",
- prop: "c",
- span: 24,
- },
- {
- label: "地址",
- prop: "d",
- span: 24,
- },
- {
- label: "详细地址",
- prop: "e",
- span: 24,
- },
- {
- label: "邮编",
- prop: "f",
- span: 24,
- },
- {
- label: "备注",
- prop: "remarks",
- type: "textarea",
- minRows: 3,
- span: 24,
- },
- {
- label: "地址智能识别",
- prop: "g",
- type: "textarea",
- minRows: 3,
- span: 24,
- }
- ]
- },
- // 商品信息列表配置
- optionList: {},
- // 商品产品下拉数据
- goodsoptions: [],
- // 附件
- orderFilesList: [],
- // 导入项目的弹窗
- productVisible:false,
- // 产品左侧类别
- productOption: {
- addBtn: false,
- menu: false,
- size: "small",
- props: {
- labelText: "标题",
- label: "title",
- value: "value",
- }
- },
- // 产品左侧是数据
- productDataGoods:[],
- // 产品弹窗列表
- optionTwo:optionTwo,
- productPage:{
- pageSize: 20,
- currentPage: 1,
- total: 0,
- pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
- },
- productListShow:[],
- // 暂存的数据
- goodsListSave:[],
- // 产品弹窗tabs切换
- activeName:'searchList',
- // 弹窗选中的数据
- tableData:[],
- productSearch:{},
- loading:false,
- dataId: '',
- // 设备id
- archivesId: '',
- };
- },
- props: {
- detailData: {
- type: Object
- }
- },
- components: {
- reportDialog
- },
- async created() {
- this.optionList = optionList
- // 获取字典数据
- this.getAllWorkDicts()
- // 查看是否要id调用详情
- if (this.detailData.id) {
- this.option.disabled = true
- this.getDetail(this.detailData.id);
- }
- if (this.detailData.status == 1) {
- this.option.disabled = true;
- }
- // 获取产品数据
- // getAllgoods().then(res => {
- // this.goodsoptions = res.data.data
- // });
- },
- methods: {
- getMaintenanceList(pageSize) {
- this.mPageSize = pageSize
- this.maintenanceSecondC()
- },
- // 维修次数点击事件
- maintenanceSecondC(row) {
- this.archivesId = row.id
- var params = {
- archivesId: this.form.id,
- deviceId: row.srcId,
- status:4
- }
- maintenanceList(this.mPcurrent, this.mPageSize, params).then(res => {
- this.mDtotal = res.data.data.total
- this.mPcurrent = res.data.data.current;
- this.maintenanceData = res.data.data.records
- })
- this.maintenanceSecondList = true
- },
- // 打印报表按钮事件
- openReport() {
- this.switchDialog = !this.switchDialog;
- },
- onClose(val) {
- this.switchDialog = val;
- },
- // 跳转路由
- maintenanceWorkerNameClick(id) {
- router.push({path: '/maintenanceQ/index/', query: {id: id}})
- },
- // 获取下拉字典
- getAllWorkDicts() {
- // 获取地址信息
- // this.findObject(this.option.column, "address").dicData = JSON.parse(localStorage.getItem('areaTypeTree'))
- getGoodstype().then(res => {
- this.findObject(this.optionList.column, "goodsTypeId").dicData = res.data.data;
- });
- // 获取品牌数据
- // getListpp().then(res=>{
- // this.findObject(this.optionList.column, "brand").dicData = res.data.data.records
- // this.findObject(this.optionTwo.column, "brand").dicData = res.data.data.records
- // })
- // 品牌
- var type = {
- type: 'PP'
- }
- listAllP(type).then(res => {
- this.findObject(this.optionTwo.column, "brandId").dicData = res.data.data
- // 设备详情的品牌编辑
- this.findObject(this.optionList.column, "brand").dicData = res.data.data
- })
- // 获取供应商厂家数据
- GYSgetList(1,20, {corpType:'GYS'}).then(res=>{
- this.findObject(this.optionTwo.column, "corpId").dicData = res.data.data.records
- })
- },
- cellStyle() {
- return "padding:0;height:40px;";
- },
- //打开附件
- annexOpen(row, index) {
- this.dataId = index
- this.orderList = row.filesList?row.filesList:[];
- for (let order of this.orderList) {
- order.paymentType = order.typeFiles
- }
- this.enclosure = true
- },
- //保存
- saveAnnex() {
- let i = 0
- for (const key in this.orderList) {
- this.orderList[key].sort = Number(key) + 1
- this.orderList[key].typeFiles = this.orderList[key].paymentType
- if (this.orderList[key].typeFiles == '主图') {
- i++
- }
- if (i == 2) {
- this.$message({
- type: "warning",
- message: "只允许有一张主图,其余均为副图!"
- });
- return
- }
- }
- this.data[this.dataId].filesList = this.orderList;
- this.enclosure = false
- // saveFile({
- // id: this.formAnnex.id,
- // fileList: this.orderList
- // }).then(res => {
- // console.log(res)
- // this.$message.success("保存成功");
- // this.annexOpen(this.formAnnex)
- // })
- },
- amountChange() {
- let val = 0
- this.data.forEach(e => {
- val = sum(val, e.amount)
- this.form.purchaseAmount = val
- this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
- })
- },
- // countChange(row) {
- // row.amount = multiply(row.price, row.storageInQuantity)
- // row.storageAmount = multiply(row.purchaseAmount, row.storageInQuantity)
- // let val = 0
- // this.data.forEach(e => {
- // val = sum(val, e.amount)
- // this.form.purchaseAmount = val
- // this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
- // })
- // },
- // 获取详情数据
- getDetail(id) {
- this.loadingBtn = true
- corpequipmentarchivesDetail({ id: id })
- .then(res => {
- this.form = res.data.data;
- this.data = res.data.data.corpEquipmentArchivesItemList;
- this.maintenanceFiles = res.data.data.filesList;
- // this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
- })
- .finally(() => {
- this.loadingBtn = false;
- });
- },
- // 客户下拉框
- getCorpData(row) {
- if (row) {
- this.form.corpName = row.cname
- this.form.contactsTel = row.tel
- // 地址和联系人
- this.form.address = row.details
- this.form.contacts = row.attn
- } else {
- this.form.corpName = null
- this.form.contactsTel = null
- }
- },
- addRow() {
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- // this.data.push({ $cellEdit: true, storageId: this.form.storageId })
- this.tableData = []
- this.goodsListSave = []
- // 获取产品弹窗的左侧类型
- this.getGoodstypefun()
- var dict = {
- code : 'unit'
- }
- getDictionary(dict).then(res => {
- this.findObject(this.optionTwo.column, "unit").dicData = res.data.data;
- })
- this.productonLoad(this.productPage, this.productSearch);
- this.productVisible = true
- } else {
- return false;
- }
- });
- },
- rowCell(row, index) {
- if (row.$cellEdit == true) {
- this.$set(row, "$cellEdit", false);
- } else {
- this.$set(row, "$cellEdit", true);
- }
- },
- // 删除
- rowDel(row, index) {
- this.$confirm("确定删除数据?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if (row.id) {
- corpequipmentarchivesitemRemove({ids:row.id}).then(res => {
- this.$message({
- type: "success",
- message: "删除成功!"
- });
- this.data.splice(index, 1);
- });
- } else {
- this.$message({
- type: "success",
- message: "删除成功!"
- });
- this.data.splice(index, 1);
- }
- this.form.equipmentNumber = this.data.length
- });
- },
- //修改提交触发
- editCustomer() {
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- // if (this.data.length == 0) {
- // return this.$message.error('请添加一条商品信息');
- // }
- let arr = this.data.map(item=>{
- if (!item.code) return this.$message({type: "warning", message: "请填写设备编号!"});
- return {
- id:item.id?item.id:null,
- cname:item.cname,
- code:item.code,
- brand:item.brand,
- brandId:item.brandId,
- specs:item.specs,
- remarks:item.remarks,
- goodsTypeId:item.goodsTypeId,
- srcId:item.srcId,
- // goodsTypeName:item.goodsTypeName,
- maintenanceSecond:item.maintenanceSecond?item.maintenanceSecond:0,
- exitDate:item.exitDate?item.exitDate + ' 00:00:00':item.exitDate,
- maintenanceDate:item.maintenanceDate?item.maintenanceDate + ' 00:00:00':item.maintenanceDate,
- installDate:item.installDate?item.installDate + ' 00:00:00':item.installDate, // 安装日期
- repairReportDate:item.repairReportDate,
- url:item.url?item.url:null,
- factoryId:item.factoryId?item.factoryId:null,
- factoryName:item.factoryName?item.factoryName:null,
- categoryitem:item.categoryitem?item.categoryitem:null,
- equipmentDescribe:item.equipmentDescribe?item.equipmentDescribe:null,
- filesList:item.filesList
- }
- })
- for (const key in this.maintenanceFiles) {
- this.maintenanceFiles[key].sort = Number(key) + 1
- this.maintenanceFiles[key].typeFiles = this.maintenanceFiles[key].paymentType
- }
- const obj = {
- id:this.form.id?this.form.id:null,
- corpId:this.form.corpId,
- corpName:this.form.corpName,
- sysNo:null,
- equipmentNumber:this.data.length,
- maintenanceSecond:this.form.maintenanceSecond?this.form.maintenanceSecond:0,
- signingDateStart:this.form.signingDateStart,
- signingDateEnd:this.form.signingDateEnd,
- contacts:this.form.contacts,
- contactsTel:this.form.contactsTel,
- address:this.form.address,
- remarks:this.form.remarks,
- corpEquipmentArchivesItemList:arr,
- filesList:this.maintenanceFiles
- }
- this.loadingBtn = true;
- // 附件
- // console.log(this.orderFilesList,522)
- corpequipmentarchivesSubmit({
- ...obj,
- })
- .then(res => {
- this.$message.success("保存成功");
- this.form = res.data.data;
- this.data = res.data.data.corpEquipmentArchivesItemList;
- // this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
- this.detailData.status = 1
- this.option.disabled = true;
- this.$refs.crud.refreshTable();
- })
- .finally(() => {
- this.loadingBtn = false;
- });
- } else {
- return false;
- }
- });
- },
- // 查看图片
- imgurlfun(row){
- this.imgfalse = true
- this.archivesId = row.id
- this.imgtext = row.url
- },
- imgfalseClose(){
- this.imgtext = ''
- this.imgfalse = false
- },
- async saveColumn() {
- const inSave = optionList
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.crud.doLayout();
- });
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- },
- async resetColumn() {
- this.optionList = optionList;
- const inSave = optionList
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.crud.doLayout();
- });
- this.getAllWorkDicts()
- this.$message.success("重置成功");
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- },
- openEdit() {
- // this.detailData.status = 2
- this.option.disabled = false
- this.option = this.$options.data().option;
- this.$refs.crud.refreshTable();
- },
- //返回列表
- backToList() {
- this.$emit("goBack");
- },
- // ---------------------------------产品弹窗----------------------------------------
- // 产品弹窗导入
- importGoods(){
- if (this.goodsListSave.length > 0) {
- for (let item of this.goodsListSave) {
- const srcId = item.id
- delete item.id
- this.data.push({
- $cellEdit: true,
- storageId: this.form.storageId,
- factoryId:item.corpId,
- srcId:srcId,
- factoryName:item.corpName,
- ...item,
- code:'',
- installDate:'',
- equipmentDescribe:item.cname,
- })
- }
- }else {
- for (let item of this.tableData) {
- const srcId = item.id
- delete item.id
- this.data.push({
- $cellEdit: true,
- storageId: this.form.storageId,
- srcId:srcId,
- factoryId:item.corpId,
- factoryName:item.corpName,
- ...item,
- code:'',
- installDate:'',
- equipmentDescribe:item.cname,
- })
- }
- }
- this.form.equipmentNumber = this.data.length
- this.productVisible = false
- },
- // 产品选择左侧数据
- productnodeClick(data){
- this.productSearch.goodsTypeId = data.value
- this.productPage.currentPage = 1;
- this.productonLoad(this.productPage, this.productSearch);
- },
- // 产品弹窗的列表数据获取
- productonLoad(page, params = {}){
- let data = this.deepClone(Object.assign(params, this.productSearch));
- this.loading = true;
- getListNew(
- page.currentPage,
- page.pageSize,
- data
- ).then(res=>{
- // this.productListShow = res.data.data.records ? res.data.data.records : [];
- this.productListShow = res.data.data.records
- this.productPage.total = res.data.data.total;
- this.$nextTick(() => {
- this.$refs.productCrud.doLayout();
- });
- }).finally(() => {
- this.loading = false;
- });
- },
- // 标签页切换
- tabHandle(data) {
- if (data.name == 'searchList') {
- this.productListShow = this.data;
- // this.productSearch.total = this.pageList.total
- this.productonLoad(this.productPage,this.productSearch);
- } else if (data.name == 'importStaging') {
- this.productListShow = this.goodsListSave;
- this.productSearch.total = 0
- }
- },
- // 获取产品左侧数据
- getGoodstypefun(){
- getGoodstype().then(res => {
- this.productDataGoods = res.data.data;
- });
- },
- // 弹窗选中的数据
- importStagList(row, index) {
- this.goodsListSave.push(row);
- },
- // 产品弹窗移除
- removeStagList(row, index) {
- this.goodsListSave.splice(row.$index, 1)
- },
- // 产品弹窗刷新触发
- productRefresh(){
- // this.treeDeptId = '';
- this.productPage.currentPage = 1;
- this.productonLoad(this.productPage,this.productSearch);
- },
- // 产品弹窗选择触发
- productSelection(list) {
- this.tableData = list
- },
- // 产品弹窗搜索按钮触发
- goodsSearch(params, done) {
- // this.treeDeptId = '';
- this.productonLoad(this.productPage,params);
- done()
- },
- // 产品弹窗分页
- productCurrent(val){
- this.productPage.currentPage = val;
- },
- productSize(val){
- this.productPage.currentPage = 1;
- this.productPage.pageSize = val;
- },
- // 产品弹窗的重置和保存
- productSave(){
- const inSave = optionTwo
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.productCrud.doLayout();
- });
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs.productCrud.$refs.dialogColumn.columnBox = false;
- }
- },
- productReset(){
- this.optionTwo = optionTwo;
- const inSave = option
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.productCrud.doLayout();
- });
- this.getAllWorkDicts()
- this.$message.success("重置成功");
- this.$refs.productCrud.$refs.dialogColumn.columnBox = false;
- }
- },
- // 关闭弹窗的回调
- closeGoods() {
- this.productDataGoods = [];
- // this.treeDeptId = "";
- this.activeName = "searchList";
- },
- },
- watch: {
- // data: function (rows) {
- // let val = 0
- // rows.forEach(e => {
- // val = sum(val, e.amount)
- // this.form.purchaseAmount = val
- // this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
- // })
- // }
- }
- };
- </script>
- <style lang="scss" scoped>
- .trading-form ::v-deep .el-form-item {
- margin-bottom: 8px !important;
- }
- ::v-deep .el-dialog__body {
- padding: 0px 20px 15px 20px;
- }
- ::v-deep .el-form-item__error {
- display: none !important;
- }
- .img-form ::v-deep .el-form-item {
- height: 150px;
- line-height: 150px;
- margin-bottom: 8px !important;
- }
- .img-form ::v-deep .avue-upload__icon {
- font-size: 20px;
- width: 150px;
- height: 150px;
- line-height: 150px;
- }
- ::v-deep .el-table .cell {
- padding: 0 2px !important;
- }
- ::v-deep .avue-crud .el-table .el-form-item__label {
- left: -1px;
- }
- .addressTabs {
- display: flex;
- justify-content: center;
- span {
- width: 100px;
- font-size: 18px;
- font-weight: 600;
- text-align: center;
- }
- }
- </style>
|