123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089 |
- <template>
- <view>
- <view class="filedetails">
- <view class="cardBox" @click="selectCustomer"
- style="margin-bottom: 0; border-bottom: 4rpx solid #f5f5f5; border-radius: 12rpx 12rpx 0 0;">
- <!-- @click="pickerShowfun('KH')" -->
- <view class="filedetails_left" style="width: 100%; margin-right: 20rpx;">
- <view style="display: flex;align-items: center;">
- <view class="shebetext" style="display: flex;align-items: center; color: #FD4B09;">
- <u-icon name="account" color="#FD4B09" size="18"></u-icon>
- <text style="font-size: 30rpx; margin-left: 10rpx;">客户</text>
- </view>
- <u--input inputAlign="right" disabled disabledColor="#fff" placeholder="客户" border="none"
- v-model="form.corpName">
- </u--input>
- </view>
- </view>
- <view class="filedetails_right">
- <u-icon name="arrow-right" color="#101010" size="22"></u-icon>
- </view>
- </view>
- <view class="cardBox" style="margin-bottom: 0; border-bottom: 4rpx solid #f5f5f5; border-radius: 0;">
- <!-- <view class="filedetails_left">
- <view>
- <u--input prefixIcon="account"
- prefixIconStyle="fontSize:50rpx;" placeholderStyle="fontSize:34rpx;"
- placeholder="联系人" border="none"
- v-model="form.contacts">
- </u--input>
- </view>
- </view>
- -->
- <view class="filedetails_left" style="width: 100%; margin-right: 20rpx;">
- <view style="display: flex;align-items: center;">
- <view class="shebetext" style="display: flex;align-items: center; color: #FD4B09;">
- <u-icon name="account" color="#FD4B09" size="18"></u-icon>
- <text style="font-size: 30rpx; margin-left: 10rpx;">联系人</text>
- </view>
- <u--input inputAlign="right" prefixIconStyle="fontSize:50rpx;"
- placeholderStyle="fontSize:34rpx;" placeholder="联系人" border="none" v-model="form.contacts">
- </u--input>
- </view>
- </view>
- </view>
- <view class="cardBox" style="margin-bottom: 0; border-bottom: 4rpx solid #f5f5f5; border-radius: 0;">
- <!-- <view class="filedetails_left">
- <view>
- <u--input prefixIcon="phone"
- prefixIconStyle="fontSize:50rpx;" placeholderStyle="fontSize:34rpx;"
- placeholder="电话" border="none"
- v-model="form.contactsTel">
- </u--input>
- </view>
- </view> -->
- <view class="filedetails_left" style="width: 100%; margin-right: 20rpx;">
- <view style="display: flex;align-items: center;">
- <view class="shebetext" style="display: flex;align-items: center; color: #FD4B09;">
- <u-icon name="account" color="#FD4B09" size="18"></u-icon>
- <text style="font-size: 30rpx; margin-left: 10rpx;">电话</text>
- </view>
- <u--input inputAlign="right" prefixIconStyle="fontSize:50rpx;"
- placeholderStyle="fontSize:34rpx;" placeholder="电话" border="none"
- v-model="form.contactsTel">
- </u--input>
- </view>
- </view>
- </view>
- <view class="cardBox" style="margin-bottom: 0; border-bottom: 4rpx solid #f5f5f5; border-radius: 0;">
- <!-- <view class="filedetails_left">
- <view>
- <u--input prefixIcon="home"
- prefixIconStyle="fontSize:50rpx;" placeholderStyle="fontSize:34rpx;"
- placeholder="地址" border="none"
- v-model="form.address">
- </u--input>
- </view>
- </view> -->
- <view class="filedetails_left" style="width: 100%; margin-right: 20rpx;">
- <view style="display: flex;align-items: center;">
- <view class="shebetext" style="display: flex;align-items: center; color: #FD4B09;">
- <u-icon name="account" color="#FD4B09" size="18"></u-icon>
- <text style="font-size: 30rpx; margin-left: 10rpx;">地址</text>
- </view>
- <u--input inputAlign="right" prefixIconStyle="fontSize:50rpx;"
- placeholderStyle="fontSize:34rpx;" placeholder="地址" border="none" v-model="form.address">
- </u--input>
- </view>
- </view>
- </view>
- <view class="cardBox" @click="calendarShowfun(1,1)"
- style="margin-bottom: 0; border-bottom: 4rpx solid #f5f5f5; border-radius: 0;">
- <!-- <view class="filedetails_left">
- <view>
- <u--input prefixIcon="calendar"
- prefixIconStyle="fontSize:50rpx;" placeholderStyle="fontSize:34rpx;"
- disabled disabledColor="#fff" placeholder="请选择合同起" border="none"
- v-model="form.signingDateStart">
- </u--input>
- </view>
- </view>
- <view class="filedetails_right" @click="calendarShowfun(1,1)">
- <u-icon name="arrow-right" color="#101010" size="22"></u-icon>
- </view> -->
- <view class="filedetails_left" style="width: 100%; margin-right: 20rpx;">
- <view style="display: flex;align-items: center;">
- <view class="shebetext" style="display: flex;align-items: center; color: #FD4B09;">
- <u-icon name="calendar" color="#FD4B09" size="18"></u-icon>
- <text style="font-size: 30rpx; margin-left: 10rpx;">合同日期起</text>
- </view>
- <u--input inputAlign="right" disabled disabledColor="#fff" placeholder="合同日期起" border="none"
- v-model="form.signingDateStart">
- </u--input>
- </view>
- </view>
- <view class="filedetails_right">
- <u-icon name="arrow-right" color="#101010" size="22"></u-icon>
- </view>
- </view>
- <view class="cardBox" style="border-bottom: 4rpx solid #f5f5f5; border-radius: 0 0 12rpx 12rpx;">
- <!-- <view class="filedetails_left">
- <view>
- <u--input prefixIcon="calendar"
- prefixIconStyle="fontSize:50rpx;" placeholderStyle="fontSize:34rpx;"
- disabled disabledColor="#fff" placeholder="请选择合同止" border="none"
- v-model="form.signingDateEnd">
- </u--input>
- </view>
- </view>
- <view class="filedetails_right" @click="calendarShowfun(1,2)">
- <u-icon name="arrow-right" color="#101010" size="22"></u-icon>
- </view> -->
- <view class="filedetails_left" style="width: 100%; margin-right: 20rpx;"
- @click="calendarShowfun(1,2)">
- <view style="display: flex;align-items: center;">
- <view class="shebetext" style="display: flex;align-items: center; color: #FD4B09;">
- <u-icon name="calendar" color="#FD4B09" size="18"></u-icon>
- <text style="font-size: 30rpx; margin-left: 10rpx;">合同日期止</text>
- </view>
- <u--input inputAlign="right" disabled disabledColor="#fff" placeholder="合同日期止" border="none"
- v-model="form.signingDateEnd">
- </u--input>
- </view>
- </view>
- <view class="filedetails_right">
- <u-icon name="arrow-right" color="#101010" size="22"></u-icon>
- </view>
- </view>
- <view class="cardBox">
- <u-upload :fileList="form.filesList" @afterRead="afterRead($event,1)" @delete="deletePic($event,1)"
- name="1" multiple :maxCount="10"></u-upload>
- </view>
- <view class="cardBox" style="display: flex;align-items: center;">
- <!-- <view class="filedetails_left">
- <view>
- <u--input prefixIcon="file-text"
- prefixIconStyle="fontSize:50rpx;" placeholderStyle="fontSize:34rpx;"
- disabled disabledColor="#fff" :placeholder="`设备列表(${form.corpEquipmentArchivesItemList.length})`" border="none">
- </u--input>
- </view>
- </view>
- <view class="filedetails_right" @click="EquipmentAddition">
- <u-icon name="list-dot" color="#101010" size="22"></u-icon>
- </view> -->
- <view class="filedetails_left" style="width: 100%; margin-right: 20rpx;">
- <view style="display: flex;align-items: center;">
- <view class="shebetext" style="display: flex;align-items: center; color: #FD4B09;">
- <u-icon name="list-dot" color="#FD4B09" size="18"></u-icon>
- <text
- style="font-size: 30rpx; margin-left: 10rpx;">设备列表({{form.corpEquipmentArchivesItemList.length}})</text>
- </view>
- <!-- <u--input
- inputAlign="right"
- disabled disabledColor="#fff" :placeholder="`设备列表(${form.corpEquipmentArchivesItemList.length})`" border="none">
- </u--input> -->
- </view>
- </view>
- <!-- <view class="filedetails_right" @click="EquipmentAddConfirm = true"> -->
- <!-- <u-icon name="file-text" color="#101010" size="22"></u-icon> -->
- <!-- <view style="font-size: 30rpx;
- width: 150rpx;
- height: 44rpx;
- background-color: #FD4B09;
- border-radius:44rpx;
- color: #fff;
- padding: 10rpx" @click="pickerShowfun('CP',null)">+添加设备</view> -->
- <!-- EquipmentAddConfirm = true -->
- <!-- </view> -->
- </view>
- <view class="cardBox" v-for="(item,index) in form.corpEquipmentArchivesItemList" :key="item.id"
- v-if="form.corpEquipmentArchivesItemList.length">
- <view class="listbox">
- <view class="listbox_title">
- <view class="listbox_titleXh">
- 设备{{index+1}}
- </view>
- <view class="listbox_titleDe" @click="DeleteWindow(item,index)">删除</view>
- </view>
- <view class="inputbox" @click="pickerShowfun('CP',index)">
- <!-- <view class="shebetext">设备名称:</view> -->
- <u--input prefixIconStyle="fontSize:60rpx;" placeholderStyle="fontSize:30rpx;" disabled
- disabledColor="#fff" placeholder="请选择设备名称" border="bottom" v-model="item.cname">
- <!-- <template slot="suffix">
- <u-icon @click="pickerShowfun('CP',index)" name="arrow-right" color="#101010" size="20"></u-icon>
- </template> -->
- </u--input>
- </view>
- <view class="inputbox">
- <!-- <view class="shebetext">设备编号:</view> -->
- <u--input prefixIconStyle="fontSize:60rpx;" placeholderStyle="fontSize:30rpx;"
- disabledColor="#fff" placeholder="请输入设备编号" border="bottom" v-model="item.code">
- </u--input>
- </view>
- <view class="inputbox">
- <!-- <view class="shebetext">设备描述:</view> -->
- <u--textarea v-model="item.equipmentDescribe" placeholderStyle="fontSize:30rpx;"
- placeholder="请输入设备描述">
- </u--textarea>
- </view>
- <view class="inputbox" @click="calendarShowfun(2,1,index)">
- <!-- <view class="shebetext">出厂日期:</view> -->
- <u--input prefixIconStyle="fontSize:60rpx;" placeholderStyle="fontSize:30rpx;" disabled
- disabledColor="#fff" placeholder="请选择出厂日期" border="bottom" v-model="item.exitDate">
- <!-- <template slot="suffix">
- <u-icon @click="calendarShowfun(2,1,index)" name="arrow-right" color="#101010" size="20"></u-icon>
- </template> -->
- </u--input>
- </view>
- <view class="inputbox" @click="calendarShowfun(2,2,index)">
- <!-- <view class="shebetext">保养日期:</view> -->
- <u--input prefixIconStyle="fontSize:60rpx;" placeholderStyle="fontSize:30rpx;" disabled
- disabledColor="#fff" placeholder="请选择保养日期" border="bottom" v-model="item.maintenanceDate">
- <!-- <template slot="suffix">
- <u-icon @click="calendarShowfun(2,2,index)" name="arrow-right" color="#101010" size="20"></u-icon>
- </template> -->
- </u--input>
- </view>
- <!-- <view class="inputbox">
- <view class="shebetext">维修次数:</view>
- <u--input
- prefixIconStyle="fontSize:60rpx;color:#215476"
- placeholderStyle="fontSize:30rpx;"
- disabled disabledColor="#fff" placeholder="请选择维修次数" border="bottom"
- v-model="item.maintenanceSecond">
- </u--input>
- </view>
- <view class="inputbox">
- <view class="shebetext">工厂:</view>
- <u--input
- prefixIconStyle="fontSize:60rpx;color:#215476"
- placeholderStyle="fontSize:30rpx;"
- disabled disabledColor="#fff" placeholder="请选择工厂" border="bottom"
- v-model="item.factoryName">
- </u--input>
- </view>
- <view class="inputbox">
- <view class="shebetext">功能分类:</view>
- <u--input
- prefixIconStyle="fontSize:60rpx;color:#215476"
- placeholderStyle="fontSize:30rpx;"
- disabled disabledColor="#fff" placeholder="请选择功能分类" border="bottom"
- v-model="item.categoryitem">
- </u--input>
- </view>
- <view class="inputbox">
- <view class="shebetext">设备分类:</view>
- <u--input
- prefixIconStyle="fontSize:60rpx;color:#215476"
- placeholderStyle="fontSize:30rpx;"
- disabled disabledColor="#fff" placeholder="请输入设备分类" border="bottom"
- v-model="item.category">
- </u--input>
- </view>
- <view class="inputbox">
- <view class="shebetext">规格:</view>
- <u--input
- prefixIconStyle="fontSize:60rpx;color:#215476"
- placeholderStyle="fontSize:30rpx;"
- disabled disabledColor="#fff" placeholder="请输入规格" border="bottom"
- v-model="item.specs">
- </u--input>
- </view> -->
- <view class="inputbox" style="margin-top: 20rpx;">
- <!-- <view class="shebetext">图片:</view> -->
- <u-upload :fileList="item.filesList" @afterRead="afterRead($event,2,index)"
- @delete="deletePic($event,2,index)" name="1" multiple :maxCount="10"></u-upload>
- </view>
- <!-- <view class="binahao">设备编号:{{item.code}}</view>
- <view class="bottombox">
- <view class="bottombox_img">
- <image :src="item.url" mode="widthFix"></image>
- </view>
- <view class="bottombox_text">
- <view class="bottombox_textleft">
- <view class="bottombox_textTitle">{{item.cname}}</view>
- <view>出厂日期:{{item.exitDate?item.exitDate.slice(0,10):''}}</view>
- <view>报修日期:{{item.repairReportDate?item.repairReportDate.slice(0,10):''}}</view>
- </view>
- <view class="bottombox_textRight">
- <u-icon name="arrow-right" color="#101010" size="20"></u-icon>
- </view>
- </view>
- </view> -->
- </view>
- </view>
-
- <view class="cardBox" style="display: flex;align-items: center;">
- <!-- <view class="filedetails_left">
- <view>
- <u--input prefixIcon="file-text"
- prefixIconStyle="fontSize:50rpx;" placeholderStyle="fontSize:34rpx;"
- disabled disabledColor="#fff" :placeholder="`设备列表(${form.corpEquipmentArchivesItemList.length})`" border="none">
- </u--input>
- </view>
- </view>
- <view class="filedetails_right" @click="EquipmentAddition">
- <u-icon name="list-dot" color="#101010" size="22"></u-icon>
- </view> -->
-
-
- <view class="filedetails_left" style="width: 100%; margin-right: 20rpx;">
- <view style="display: flex;align-items: center;">
- <view class="shebetext" style="display: flex;align-items: center; color: #FD4B09;">
- <u-icon name="list-dot" color="#FD4B09" size="18"></u-icon>
- <text
- style="font-size: 30rpx; margin-left: 10rpx;">设备</text>
- </view>
- <!-- <u--input
- inputAlign="right"
- disabled disabledColor="#fff" :placeholder="`设备列表(${form.corpEquipmentArchivesItemList.length})`" border="none">
- </u--input> -->
- </view>
- </view>
- <view class="filedetails_right" @click="EquipmentAddConfirm = true">
- <!-- <u-icon name="file-text" color="#101010" size="22"></u-icon> -->
- <view style="font-size: 30rpx;
- width: 150rpx;
- background-color: #FD4B09;
- border-radius:44rpx;
- color: #fff;
- padding: 10rpx" @click="pickerShowfun('CP',null)">+添加设备</view>
- <!-- EquipmentAddConfirm = true -->
- </view>
-
-
- </view>
-
- </view>
- <view style="height: 100rpx;"></view>
- <view class="bottomButton">
- <view class="savebutton" @click="savefun">保存档案</view>
- </view>
- <u-picker :show="pickerShow" :columns="pickerColumns" keyName="cname" @confirm="pickerConfirm"
- @cancel="pickerCancel"></u-picker>
- <!-- 日期 -->
- <u-calendar :show="calendarShow" @confirm="calendarConfirm" @close="calendarClose"></u-calendar>
- <!-- 提示 -->
- <u-toast ref="uToast"></u-toast>
- <!-- 添加设备弹框 -->
- <!-- <u-modal :show="EquipmentAddConfirm" title="提示" showCancelButton @confirm="EquipmentAddition"
- @cancel="EquipmentAddConfirm = false">
- <view class="slot-content">
- <view class="inputbox" @click="pickerShowfun('CP',index)">
- <u--input
- prefixIconStyle="fontSize:60rpx;"
- placeholderStyle="fontSize:30rpx;"
- disabled disabledColor="#fff" placeholder="请选择设备名称" border="bottom"
- v-model="machine.cname" >
- </u--input>
- </view>
- <view class="inputbox">
- <u--input
- prefixIconStyle="fontSize:60rpx;"
- placeholderStyle="fontSize:30rpx;"
- disabledColor="#fff" placeholder="请输入设备编号" border="bottom"
- v-model="machine.code">
- </u--input>
- </view>
- <view class="inputbox">
- <u--textarea v-model="machine.equipmentDescribe"
- placeholderStyle="fontSize:30rpx;" placeholder="请输入设备描述" >
- </u--textarea>
- </view>
- <view class="inputbox" @click="calendarShowfun(machine.exitDate,2,1,index)">
- <u--input
- prefixIconStyle="fontSize:60rpx;"
- placeholderStyle="fontSize:30rpx;"
- disabled disabledColor="#fff" placeholder="请选择出厂日期" border="bottom"
- v-model="machine.exitDate">
- </u--input>
- </view>
- <view class="inputbox" @click="calendarShowfun(machine.maintenanceDate,2,2,index)">
- <u--input
- prefixIconStyle="fontSize:60rpx;"
- placeholderStyle="fontSize:30rpx;"
- disabled disabledColor="#fff" placeholder="请选择保养日期" border="bottom"
- v-model="machine.maintenanceDate">
- </u--input>
- </view>
- <view class="inputbox" style="margin-top: 20rpx;">
- <view class="shebetext">图片:</view>
- <u-upload
- :fileList="machine.filesList"
- @afterRead="afterRead($event,2,index)"
- @delete="deletePic($event,2,index)"
- name="1"
- multiple
- :maxCount="10"
- ></u-upload>
- </view>
- </view>
- </u-modal> -->
- <!-- 删除弹框 -->
- <u-modal :show="EquipmentDeleteConfirm" title="提示" showCancelButton @confirm="DeleteDevicefun"
- @cancel="EquipmentDeleteConfirm = false">
- <view class="slot-content">
- <rich-text nodes="确定要删除该设备吗?"></rich-text>
- </view>
- </u-modal>
- <!-- <u-datetime-picker :show="calendarShow" @confirm="calendarConfirm" @close="calendarShow = false" v-model="optionDate"
- mode="date"></u-datetime-picker> -->
-
- <!-- <u-calendar :show="calendarShow" @confirm="calendarConfirm" @close="calendarClose"></u-calendar> -->
- <u-loading-page style="z-index: 999;" bgColor="rgba(0,0,0,.5)" :loading="loading"></u-loading-page>
- </view>
- </template>
- <script>
- import {
- corpequipmentarchivesDetail,
- corpequipmentarchivesSubmit,
- goodsdescDescList,
- corpequipmentarchivesitemRemove
- } from '@/api/device/index.js'
- import {
- corpsDescList
- } from '@/api/views/sale/index.js'
- import {
- queryDetail
- } from '@/api/views/customer/index.js'
- import http from '@/http/api.js'
- import {
- clientId,
- clientSecret
- } from '@/common/setting'
- export default {
- data() {
- return {
- loading:false,
- // 弹框
- // 设备添加
- EquipmentAddConfirm: false,
- // 设备删除
- EquipmentDeleteConfirm: false,
- EquipmentDeleteRow: {},
- EquipmentDeleteIndex: -1,
- // 传递过来的id
- id: null,
- // 绑定的数据
- form: {
- corpEquipmentArchivesItemList: [],
- filesList: []
- },
- // 弹窗的开启和管理
- pickerShow: false,
- // 弹窗的数据配置 数组嵌套
- pickerColumns: [],
- // 日期弹窗
- calendarShow: false,
- // 当前打开弹窗的状态
- calendarType: {
- type: null,
- sort: null,
- index: null
- },
- // 当前打开的弹窗的状态
- pickerType: {},
- // 设备弹窗
- machine: {},
- optionDate: 0
- }
- },
- onLoad(e) {
- this.id = e.id
- if (e.id) {
- this.corpequipmentarchivesDetailfun()
- }
- },
- onShow() {
- },
- methods: {
- disabledDate(time) {
- return time.getTime() > Date.now() - 8.64e7
- },
- // 保存新增
- savefun() {
- if (!this.form.corpName) {
- return this.$refs.uToast.show({
- type: 'warning',
- message: '客户名称不能为空',
- })
- }
- if (!this.form.contacts) {
- return this.$refs.uToast.show({
- type: 'warning',
- message: '联系人不能为空',
- })
- }
- if (!this.form.contactsTel) {
- return this.$refs.uToast.show({
- type: 'warning',
- message: '电话不能为空',
- })
- }
- if (!this.form.address) {
- return this.$refs.uToast.show({
- type: 'warning',
- message: '地址不能为空',
- })
- }
- // if (!this.form.corpEquipmentArchivesItemList.length > 0){
- // return this.$refs.uToast.show({
- // type: 'warning',
- // message: '请添加一条设备',
- // })
- // }
- this.form.corpEquipmentArchivesItemList.map(item => {
- if (!item.cname) {
- if (!item.equipmentDescribe) {
- return this.$refs.uToast.show({
- type: 'warning',
- message: '请维护设备描述',
- })
- }
- return
- }
- item.id = item.id ? item.id : null
- item.exitDate = item.exitDate ? item.exitDate + ' 00:00:00' : null
- item.repairReportDate = item.repairReportDate ? item.repairReportDate + ' 00:00:00' : null
- item.maintenanceDate = item.maintenanceDate ? item.maintenanceDate + ' 00:00:00' : null
- })
- const obj = {
- ...this.form,
- id: this.form.id ? this.form.id : null,
- sysNo: this.form.sysNo ? this.form.sysNo : null,
- equipmentNumber: this.form.corpEquipmentArchivesItemList.length,
- maintenanceSecond: this.form.maintenanceSecond ? this.form.maintenanceSecond : null,
- signingDateStart: this.form.signingDateStart ? this.form.signingDateStart + ' 00:00:00' : null,
- signingDateEnd: this.form.signingDateEnd ? this.form.signingDateEnd + ' 00:00:00' : null,
- remarks: this.form.remarks ? this.form.remarks : null
- }
- this.loading = true
- this.corpequipmentarchivesSubmitfun(obj)
- },
- // 保存数据接口
- corpequipmentarchivesSubmitfun(obj) {
- corpequipmentarchivesSubmit(obj).then(res => {
- if (res.code == 200) {
- this.$refs.uToast.show({
- type: 'success',
- message: '操作成功',
- })
- this.loading = false
- this.form = res.data
- this.form.corpEquipmentArchivesItemList.map(item=>{
- item.exitDate = item.exitDate ? item.exitDate.slice(0,10) : null
- item.repairReportDate = item.repairReportDate ? item.repairReportDate.slice(0,10) : null
- item.maintenanceDate = item.maintenanceDate ? item.maintenanceDate.slice(0,10) : null
- })
- } else {
- this.$refs.uToast.show({
- type: 'error',
- message: res.msg,
- })
- }
- })
- },
- // 跳转选择用户
- selectCustomer() {
- this.$u.route('/pages/views/salesSlip/selectCustomer', {
- corpType: 'KH'
- });
- },
- // 选中用户赋值
- otherFun(user) {
- console.log(user);
- queryDetail({
- id: user.id
- }).then(res => {
- this.$set(this.form, 'address', res.data.corpsAddrList[0].detailedAddress)
- this.form.corpId = user.id
- this.form.corpName = res.data.cname
- this.form.contacts = res.data.attn
- this.form.contactsTel = res.data.tel
- })
- },
- // 设备新增
- EquipmentAddition() {
- this.form.corpEquipmentArchivesItemList.push({
- cname: '',
- cname: '',
- code: '',
- brand: '',
- specs: '',
- category: '',
- categoryitem: '',
- url: '',
- goodsTypeId: '',
- exitDate: '',
- repairReportDate: '',
- brandId: '',
- maintenanceDate: '',
- factoryId: '',
- factoryName: '',
- equipmentDescribe: '',
- maintenanceSecond: '',
- filesList: [],
- })
- this.EquipmentAddConfirm = false
- },
- // 弹窗的开启
- pickerShowfun(type, index) {
- this.pickerColumns = []
- if (type == 'KH') {
- this.pickerType.type = type
- this.pickerType.index = null
- corpsDescList({
- corpType: 'KH'
- }).then(res => {
- this.pickerColumns = [res.data]
- })
- this.pickerShow = true
- } else if (type == 'CP') {
- if (index == null) {
- this.pickerType.type = type
- this.pickerType.index = this.form.corpEquipmentArchivesItemList.length
- this.form.corpEquipmentArchivesItemList.push({
- cname: '',
- cname: '',
- code: '',
- brand: '',
- specs: '',
- category: '',
- categoryitem: '',
- url: '',
- goodsTypeId: '',
- exitDate: '',
- repairReportDate: '',
- brandId: '',
- maintenanceDate: '',
- factoryId: '',
- factoryName: '',
- equipmentDescribe: '',
- maintenanceSecond: '',
- filesList: [],
- })
- this.$u.route('/pages/device/FileDetails/selectMachine', {
- corpType: 'KH'
- });
- } else {
- this.pickerType.type = type
- this.pickerType.index = index
- this.$u.route('/pages/device/FileDetails/selectMachine', {
- corpType: 'KH'
- });
- }
- }
- },
- machineOtherFun(form) {
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].cname = form.cname
- // this.form.corpEquipmentArchivesItemList[this.pickerType.index].code = form.code
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].brand = form.brand
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].brandId = form.brandId
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].specs = form.specs
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].remarks = form.remarks
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].goodsTypeId = form.goodsTypeId
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].goodsTypeName = form.goodsTypeName
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].maintenanceSecond = form.maintenanceSecond ?
- form.maintenanceSecond : null
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].repairReportDate = form.repairReportDate
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].factoryId = form.factoryId ? form
- .factoryId : null
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].factoryName = form.factoryName ? form
- .factoryName : null
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].categoryitem = form.categoryitem
- // this.form.corpEquipmentArchivesItemList[this.pickerType.index].equipmentDescribe = form.cname
- this.pickerType.index = null
- },
- // 弹窗点击确认按钮
- pickerConfirm(val) {
- if (this.pickerType.type == 'KH') {
- this.form.corpId = val.value[0].id
- this.form.corpName = val.value[0].cname
- queryDetail({
- id: val.value[0].id
- }).then(res => {
- this.$set(this.form, 'address', res.data.corpsAddrList[0].detailedAddress)
- this.form.contacts = res.data.attn
- this.form.contactsTel = res.data.tel
- })
- } else if (this.pickerType.type == 'CP') {
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].cname = val.value[0].cname
- // this.form.corpEquipmentArchivesItemList[this.pickerType.index].code = val.value[0].code
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].brand = val.value[0].brand
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].brandId = val.value[0].brandId
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].specs = val.value[0].specs
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].remarks = val.value[0].remarks
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].goodsTypeId = val.value[0].goodsTypeId
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].goodsTypeName = val.value[0]
- .goodsTypeName
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].maintenanceSecond = val.value[0]
- .maintenanceSecond ? val.value[0].maintenanceSecond : null
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].repairReportDate = val.value[0]
- .repairReportDate
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].factoryId = val.value[0].factoryId ? val
- .value[0].factoryId : null
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].factoryName = val.value[0].factoryName ?
- val.value[0].factoryName : null
- this.form.corpEquipmentArchivesItemList[this.pickerType.index].categoryitem = val.value[0].categoryitem
- // this.form.corpEquipmentArchivesItemList[this.pickerType.index].equipmentDescribe = val.value[0].cname
- } else {}
- this.pickerShow = false
- },
- // 弹窗点击取消按钮
- pickerCancel() {
- this.pickerShow = false
- },
- // 日历弹窗的开启
- calendarShowfun(type, sort, index) {
-
- // if (date != null && date != "") {
- // console.log("赋值");
- // console.log(date);
- // this.optionDate = Date.parse(date);
- // console.log(this.optionDate);
- // }
- this.calendarType.type = type
- this.calendarType.sort = sort
- this.calendarType.index = index
- this.calendarShow = true
- },
- // 日历关闭触发
- calendarClose() {
- this.calendarShow = false
- },
- // 日历选择完成触发
- calendarConfirm(val) {
- // var timer = new Date(val.value)
- //
- // const year = timer.getFullYear()
- // const month = timer.getMonth() + 1 // 由于月份从0开始,因此需加1
- // const day = timer.getDate()
- // const hour = timer.getHours()
- // const minute = timer.getMinutes()
- // const second = timer.getSeconds()
- // var data = `${this.pad(year, 4)}-${this.pad(month)}-${this.pad(day)}`
- if (this.calendarType.type == 1) {
- if (this.calendarType.sort == 1) {
- this.form.signingDateStart = val[0]
- } else {
- this.form.signingDateEnd = val[0]
- }
- } else {
- if (this.calendarType.sort == 1) {
- this.form.corpEquipmentArchivesItemList[this.calendarType.index].exitDate = val[0]
- } else {
- this.form.corpEquipmentArchivesItemList[this.calendarType.index].maintenanceDate = val[0]
- }
- }
- this.calendarShow = false
- },
- pad(timeEl, total = 2, str = '0') {
- return timeEl.toString().padStart(total, str)
- },
- // 详情接口
- corpequipmentarchivesDetailfun() {
- corpequipmentarchivesDetail({
- id: this.id
- }).then(res => {
- this.form = res.data
- this.form.corpEquipmentArchivesItemList.map(item=>{
- item.maintenanceDate = item.maintenanceDate.slice(0,10)
- item.exitDate = item.exitDate.slice(0,10)
- })
- })
- },
- // 删除弹窗
- DeleteWindow(row, index) {
- this.EquipmentDeleteRow = row;
- this.EquipmentDeleteIndex = index;
- this.EquipmentDeleteConfirm = true;
- },
- // 删除设备
- DeleteDevicefun() {
- var row = this.EquipmentDeleteRow
- var index = this.EquipmentDeleteIndex
- if (row.id) {
- this.form.corpEquipmentArchivesItemList.splice(index, 1)
- this.corpequipmentarchivesitemRemovefun(row.id)
- } else {
- this.form.corpEquipmentArchivesItemList.splice(index, 1)
- }
- this.EquipmentDeleteRow = null;
- this.EquipmentDeleteIndex = -1;
- this.EquipmentDeleteConfirm = false;
- },
- // 删除接口
- corpequipmentarchivesitemRemovefun(id) {
- corpequipmentarchivesitemRemove({
- ids: id
- }).then(res => {
- this.$refs.uToast.show({
- type: 'success',
- message: '操作成功',
- })
- })
- },
- // 新增图片
- async afterRead(event, type, index) {
- // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
- let lists = [].concat(event.file)
- console.log(event);
- console.log(lists, 394);
- if (type == 1) {
- let fileListLen = this.form.filesList.length
- lists.map((item) => {
- this.form.filesList.push({
- ...item,
- })
- })
- let sort = this.form.filesList.length
- for (let i = 0; i < lists.length; i++) {
- const result = await this.uploadFilePromise(lists[i].url)
- let item = this.form.filesList[fileListLen]
- this.form.filesList.splice(fileListLen, 1, Object.assign(item, {
- sort: sort,
- fileName: JSON.parse(result).data.originalName,
- url: JSON.parse(result).data.link
- }))
- fileListLen++
- }
- } else if (type == 2) {
- let fileListLen = this.form.corpEquipmentArchivesItemList[index].filesList.length
- lists.map((item) => {
- this.form.corpEquipmentArchivesItemList[index].filesList.push({
- ...item,
- })
- })
- let sort = this.form.corpEquipmentArchivesItemList[index].filesList.length
- for (let i = 0; i < lists.length; i++) {
- const result = await this.uploadFilePromise(lists[i].url)
- let item = this.form.corpEquipmentArchivesItemList[index].filesList[fileListLen]
- this.form.corpEquipmentArchivesItemList[index].filesList.splice(fileListLen, 1, Object.assign(
- item, {
- sort: sort,
- fileName: JSON.parse(result).data.originalName,
- url: JSON.parse(result).data.link
- }))
- fileListLen++
- }
- } else {}
- },
- // 上传附件接口
- uploadFilePromise(url) {
- return new Promise((resolve, reject) => {
- let a = uni.uploadFile({
- url: http.config.baseURL +
- '/blade-resource/oss/endpoint/put-file', // 仅为示例,非真实的接口地址
- filePath: url,
- name: 'file',
- formData: {
- user: 'test'
- },
- header: {
- // 客户端认证参数
- 'Authorization': 'Basic ' + Base64.encode(clientId + ':' + clientSecret),
- 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken')
- },
- success: (res) => {
- setTimeout(() => {
- resolve(res.data)
- }, 1000)
- }
- });
- })
- },
- // 删除图片
- deletePic(e, type, index) {
- if (type == 1) {
- this.form.filesList.splice(e.index, 1)
- } else if (type == 2) {
- this.form.corpEquipmentArchivesItemList[index].filesList.splice(e.index, 1)
- } else {}
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .filedetails {
- padding: 20rpx;
- box-sizing: border-box;
- .listbox {
- width: 100%;
- .inputbox {
- display: flex;
- align-items: center;
- .shebetext {
- width: 140rpx;
- font-size: 32rpx;
- color: #215476;
- text-align: right;
- margin-right: 10rpx;
- }
- }
- .listbox_title {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 20rpx;
- .listbox_titleXh {
- font-size: 28rpx;
- background: #dd451b;
- width: 90rpx;
- height: 90rpx;
- color: #fff;
- text-align: center;
- line-height: 90rpx;
- border-radius: 50%;
- }
- .listbox_titleDe {
- font-size: 30rpx;
- border: 2rpx solid #dd451b;
- border-radius: 12rpx;
- padding: 5rpx 20rpx;
- color: #dd451b;
- }
- }
- .binahao {
- font-size: 30rpx;
- color: #101010;
- margin-bottom: 10rpx;
- }
- .bottombox {
- width: 100%;
- display: flex;
- align-content: center;
- .bottombox_img {
- // width: 35%;
- width: 220rpx;
- height: 220rpx;
- }
- .bottombox_text {
- margin-left: 20rpx;
- width: 65%;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .bottombox_textleft {
- font-size: 30rpx;
- .bottombox_textTitle {
- font-size: 34rpx;
- color: #2d4a6a;
- font-weight: 500;
- margin-bottom: 20rpx;
- width: 400rpx;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- }
- .bottombox_textRight {}
- }
- }
- }
- }
- .cardBox {
- background: #fff;
- border-radius: 12rpx;
- width: 100%;
- padding: 20rpx 30rpx;
- box-sizing: border-box;
- display: flex;
- align-content: center;
- justify-content: space-between;
- margin-bottom: 20rpx;
- }
- .bottomButton {
- position: fixed;
- bottom: 0;
- width: 100%;
- padding: 20rpx 30rpx;
- background: #fff;
- display: flex;
- justify-content: center;
- align-items: center;
- box-sizing: border-box;
- z-index: 99;
- .savebutton {
- border-radius: 30rpx;
- // color: #3f7cef;
- color: #fff;
- font-size: 34rpx;
- // border: 2rpx solid #3f7cef;
- border: 2rpx solid #FD4B09;
- background: #FD4B09;
- padding: 10rpx 40rpx;
- font-weight: 500;
- }
- }
- image {
- width: 100%;
- }
- </style>
|