新增大屏车间管理页面并基本实现基础功能(除车间删除与批量删除与查询)
| | |
| | | export default { |
| | | // -------------------------------------驱å¨åæ°ç®¡ç页é¢---------------------------------------- |
| | | // è·åæ§å¶ç³»ç»ç±»å |
| | | getDriveTypeApi:()=>getAction('/mdc/mdcDriveTypeParamConfig/getDriveParamOptions') |
| | | getDriveTypeApi: () => getAction('/mdc/mdcDriveTypeParamConfig/getDriveParamOptions'), |
| | | // -------------------------------------车é´çæ¿é¡µé¢---------------------------------------- |
| | | // æ ¹æ®è½¦é´idæ¥è¯¢è®¾å¤å表 |
| | | getDeviceListByWorkshopIdApi: params => getAction('/mdc/mdcWorkshopInfo/workshopEquipmentList', params), |
| | | // æ ¹æ®è½¦é´idæ¥è¯¢è½¦é´è¯¦ç»ä¿¡æ¯ |
| | | getWorkshopDetailByWorkshopIdApi: id => getAction('/mdc/mdcWorkshopInfo/queryById', { id }), |
| | | // æ¥è¯¢è½¦é´å表 |
| | | getWorkshopListApi: params => getAction('/mdc/mdcWorkshopInfo/list', params), |
| | | // æ°å¢è½¦é´ä¿¡æ¯ |
| | | addWorkshopApi: params => postAction('/mdc/mdcWorkshopInfo/add', params), |
| | | // ç¼è¾è½¦é´ä¿¡æ¯ |
| | | editWorkshopApi: params => putAction('/mdc/mdcWorkshopInfo/edit', params), |
| | | // å é¤å个车é´ä¿¡æ¯ |
| | | deleteSingleWorkshopApi: id => deleteAction('/mdc/mdcWorkshopInfo/delete', { id }), |
| | | // æ¹éå é¤è½¦é´ä¿¡æ¯ |
| | | deleteBatchWorkshopApi: ids => deleteAction('/mdc/mdcWorkshopInfo/deleteBatch', { ids }), |
| | | // æ°å¢å¤§å±è½¦é´å设å¤å
³ç³» |
| | | addDeviceInWorkshopApi: params => postAction('/mdc/mdcWorkshopInfo/addWorkshopEquipment', params), |
| | | // å é¤å个大å±è½¦é´å设å¤å
³ç³» |
| | | deleteSingleDeviceInWorkshopApi: params => deleteAction('/mdc/mdcWorkshopInfo/deleteWorkshopEquipment', params), |
| | | // æ¹éå é¤å¤§å±è½¦é´å设å¤å
³ç³» |
| | | deleteBatchDeviceInWorkshopApi: params => deleteAction('/mdc/mdcWorkshopInfo/deleteWorkshopEquipmentBatch', params) |
| | | } |
| | |
| | | <header class="page-header"> |
| | | {{getWorkshopName}} |
| | | <div class="header-right"> |
| | | <a-button type="primary" icon="save" size="large" @click="saveDevicePositionByApi">ä¿åä½ç½®</a-button> |
| | | <a-button type="primary" icon="save" size="large" @click="saveDevicePositionAndSizeByApi" |
| | | v-has="'home:saveDevicePositionAndSize'">ä¿åä½ç½® |
| | | </a-button> |
| | | </div> |
| | | </header> |
| | | |
| | | <dv-border-box-8 class="content-container"> |
| | | <!--<div v-for="item in deviceList" :key="item.equipmentId" class="single-device"--> |
| | | <!--:style="{top:item.top+'px',left:item.left+'px',height:'135px',width:'175px'}" @mousedown="handleMouseDown"--> |
| | | <!--:id="item.equipmentId">--> |
| | | <!--<div class="device-status">--> |
| | | <!--<img v-if="item.status==0" src="@/assets/yellow.png" draggable="false">--> |
| | | <!--<img v-if="item.status==1" src="@/assets/red.png" draggable="false">--> |
| | | <!--<img v-if="item.status==2" src="@/assets/gray.png" draggable="false">--> |
| | | <!--<img v-if="item.status==3" src="@/assets/green.png" draggable="false">--> |
| | | <!--<img :src="item.equipmentImageUrl" draggable="false">--> |
| | | <!--</div>--> |
| | | <!--<div class="device-id">{{item.equipmentId}}</div>--> |
| | | <!--<!–<div draggable="false" class="device-info">–>--> |
| | | <!--<!–<div v-if="item.status==0" class="status-square" style="background-color: gray"></div>–>--> |
| | | <!--<!–<div v-if="item.status==1" class="status-square" style="background-color: red"></div>–>--> |
| | | <!--<!–<div v-if="item.status==2" class="status-square" style="background-color: green"></div>–>--> |
| | | <!--<!–<div v-if="item.status==3" class="status-square" style="background-color: yellow"></div>–>--> |
| | | <!--<!–<div class="device-id">{{item.equipmentId}}</div>–>--> |
| | | <!--<!–</div>–>--> |
| | | <!--<!–</div>–>--> |
| | | <!--</div>--> |
| | | <VueDragResize v-for="(item,index) in deviceList" :key="item.equipmentId" :w="item.vw" |
| | | :h="item.vh" :x="item.left" :y="item.top" |
| | | v-on:resizing="resize($event,index)" |
| | | v-on:dragging="resize($event,index)" |
| | | :parentLimitation="true" |
| | | :minw="175" |
| | | :minh="135" |
| | | :minw="100" |
| | | :minh="100" |
| | | :id="item.equipmentId" |
| | | |
| | | :stickSize="6" |
| | | > |
| | | <div class="single-device" |
| | | :style="{width: + item.vw+ 'px',height:+item.vh+'px'}"> |
| | | :style="{width: item.vw+ 'px',height:item.vh+'px'}"> |
| | | <div class="device-status"> |
| | | <div v-if="item.status==0" |
| | | :style="{backgroundImage:`url(${require('@/assets/yellow.png')})`}" class="status-image"></div> |
| | |
| | | <div v-if="item.status==3" :style="{backgroundImage:`url(${require('@/assets/green.png')})`}" |
| | | class="status-image"></div> |
| | | <div |
| | | :style="{backgroundImage:`url(${item.equipmentImageUrl})`}" |
| | | class="device-image"></div> |
| | | :style="{backgroundImage:`url(${item.equipmentImageUrl})`}" class="device-image"></div> |
| | | </div> |
| | | <div class="device-id" :style="{fontSize: item.fontSize+'px'}"> |
| | | {{item.equipmentId}} |
| | | </div> |
| | | <!--<div draggable="false" class="device-info">--> |
| | | <!--<div v-if="item.status==0" class="status-square" style="background-color: gray"></div>--> |
| | | <!--<div v-if="item.status==1" class="status-square" style="background-color: red"></div>--> |
| | | <!--<div v-if="item.status==2" class="status-square" style="background-color: green"></div>--> |
| | | <!--<div v-if="item.status==3" class="status-square" style="background-color: yellow"></div>--> |
| | | <!--<div class="device-id">{{item.equipmentId}}</div>--> |
| | | <!--</div>--> |
| | | </div> |
| | | </VueDragResize> |
| | | <div class="device-status-info"> |
| | | <div v-for="item in deviceStatusList" :key="item.value" class="single-status-info"> |
| | | <div>{{item.label}}</div> |
| | | <div class="status-square" :style="{backgroundColor:item.color}"></div> |
| | | <div>{{getDeviceNumberByStatus(item.value)}}</div> |
| | | </div> |
| | | </div> |
| | | </dv-border-box-8> |
| | | </dv-full-screen-container> |
| | | </template> |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | mouseX: 0, // é¼ æ å¨å
ç´ å
çXåæ |
| | | mouseY: 0, // é¼ æ å¨å
ç´ å
çYåæ , |
| | | dragging: false, //æ¯å¦å¨ææ½ä¸ |
| | | elementId: '',// è¢«ææ½å
ç´ çid屿§å¼ |
| | | elementWidth: '', |
| | | elementHeight: '', |
| | | // 设å¤ä¿¡æ¯å表 |
| | | deviceList: [ |
| | | { |
| | | equipmentId: '123213213123232', |
| | | equipmentImageUrl: require('@/assets/8.png'), |
| | | top: 200, |
| | | left: 100, |
| | | vw: 175, |
| | | vh: 135, |
| | | fontSize: 20, |
| | | status: 1 |
| | | equipmentId: '123213213123232',// 设å¤ID |
| | | equipmentImageUrl: require('@/assets/8.png'), // 设å¤å¾ç |
| | | top: 200, // ææ½å
ç´ è·çåé¡¶è·ç¦» |
| | | left: 100, // ææ½å
ç´ è·çå左侧è·ç¦» |
| | | vw: 100, // 缩æ¾å
ç´ å®½åº¦ |
| | | vh: 100, // 缩æ¾å
ç´ é«åº¦ |
| | | fontSize: 12, // 缩æ¾å
ç´ åä½å¤§å° |
| | | status: 1 // 设å¤ç¶æ 0:å¾
æº 1:æ¥è¦ 2:å
³æº 3:è¿è¡ |
| | | }, |
| | | { |
| | | equipmentId: '512346789561232', |
| | | equipmentImageUrl: require('@/assets/8.png'), |
| | | top: 500, |
| | | left: 753, |
| | | vw: 175, |
| | | vh: 135, |
| | | fontSize: 20, |
| | | vw: 100, |
| | | vh: 100, |
| | | fontSize: 12, |
| | | status: 0 |
| | | }, |
| | | { |
| | |
| | | equipmentImageUrl: require('@/assets/8.png'), |
| | | top: 300, |
| | | left: 860, |
| | | vw: 175, |
| | | vh: 135, |
| | | fontSize: 20, |
| | | vw: 100, |
| | | vh: 100, |
| | | fontSize: 12, |
| | | status: 2 |
| | | }, |
| | | { |
| | |
| | | equipmentImageUrl: require('@/assets/8.png'), |
| | | top: 100, |
| | | left: 380, |
| | | vw: 175, |
| | | vh: 135, |
| | | fontSize: 20, |
| | | vw: 100, |
| | | vh: 100, |
| | | fontSize: 12, |
| | | status: 3 |
| | | }, |
| | | { |
| | |
| | | equipmentImageUrl: require('@/assets/8.png'), |
| | | top: 200, |
| | | left: 1500, |
| | | vw: 175, |
| | | vh: 135, |
| | | fontSize: 20, |
| | | vw: 100, |
| | | vh: 100, |
| | | fontSize: 12, |
| | | status: 2 |
| | | } |
| | | ], |
| | | // 设å¤ç¶ææç¤ºç¯å表 |
| | | deviceStatusList: [ |
| | | { |
| | | label: 'å
³æº', |
| | | value: 2, |
| | | color: '#A8A8A8' |
| | | }, |
| | | { |
| | | label: 'å¾
æº', |
| | | value: 0, |
| | | color: '#FFFF00' |
| | | }, |
| | | { |
| | | label: 'è¿è¡', |
| | | value: 3, |
| | | color: '#00EE00' |
| | | }, |
| | | { |
| | | label: 'æ¥è¦', |
| | | value: 1, |
| | | color: '#FF0000' |
| | | } |
| | | ] |
| | | } |
| | |
| | | }, |
| | | methods: { |
| | | /** |
| | | * éè¿è½¦é´Idè°ç¨æ¥å£è·å设å¤å表 |
| | | * éè¿è½¦é´Idè°ç¨æ¥å£è·å设å¤ä¿¡æ¯å表 |
| | | * @param workshopId 车é´Id |
| | | */ |
| | | getDeviceListByApi(workshopId) { |
| | | console.log('车é´Id', workshopId) |
| | | }, |
| | | /** |
| | | * ææ½å¯¹è±¡é¼ æ æé®æä¸äºä»¶ |
| | | * @param event |
| | | * ç¹å»ä¿åæé®è°ç¨æ¥å£ä¿åææ½åçä½ç½®ä¸è®¾å¤å¾æ 尺寸 |
| | | */ |
| | | handleMouseDown(event) { |
| | | this.dragging = true |
| | | this.mouseX = event.clientX |
| | | this.mouseY = event.clientY |
| | | this.elementId = event.currentTarget.id |
| | | this.top = event.currentTarget.offsetTop |
| | | this.left = event.currentTarget.offsetLeft |
| | | document.addEventListener('mousemove', this.handleMouseMove) |
| | | document.addEventListener('mouseup', this.handleMouseUp) |
| | | this.elementWidth = +event.currentTarget.style.width.replace('px', '') |
| | | this.elementHeight = +event.currentTarget.style.height.replace('px', '') |
| | | }, |
| | | /** |
| | | * ææ¡£å¯¹è±¡é¼ æ ç§»å¨äºä»¶ |
| | | * @param event |
| | | */ |
| | | handleMouseMove(event) { |
| | | if (this.dragging) { |
| | | // xæ¹åé¼ æ åç§»é |
| | | const deltaX = event.clientX - this.mouseX |
| | | // yæ¹åé¼ æ åç§»é |
| | | const deltaY = event.clientY - this.mouseY |
| | | this.left += deltaX |
| | | this.top += deltaY |
| | | this.deviceList.forEach(item => { |
| | | if (item.equipmentId === this.elementId) { |
| | | item.top = this.top |
| | | item.left = this.left |
| | | // éå¶ææ½è¶
åºåºå(ç¼©æ¾æµè§å¨çªå£åè·åå¨è·ç¦»åºç°é®é¢) |
| | | if (item.top < 0) { |
| | | item.top = 0 |
| | | } else if (item.top + this.elementHeight + 80 > window.innerHeight) { |
| | | item.top = window.innerHeight - this.elementHeight |
| | | } |
| | | if (item.left < 0) { |
| | | item.left = 0 |
| | | } else if (item.left + this.elementWidth > window.innerWidth) { |
| | | item.left = window.innerWidth - this.elementWidth |
| | | } |
| | | } |
| | | }) |
| | | this.mouseX = event.clientX |
| | | this.mouseY = event.clientY |
| | | } |
| | | }, |
| | | /** |
| | | * ææ¡£å¯¹è±¡é¼ æ æé®å¼¹èµ·äºä»¶ |
| | | * @param event |
| | | */ |
| | | handleMouseUp(event) { |
| | | this.dragging = false |
| | | document.removeEventListener('mousemove', this.handleMouseMove) |
| | | document.removeEventListener('mouseup', this.handleMouseUp) |
| | | }, |
| | | /** |
| | | * ç¹å»ä¿åæé®è°ç¨æ¥å£ä¿åææ½åçä½ç½® |
| | | */ |
| | | saveDevicePositionByApi() { |
| | | saveDevicePositionAndSizeByApi() { |
| | | console.log('ä¿åä½ç½®') |
| | | }, |
| | | /** |
| | |
| | | */ |
| | | resize(newRect, index) { |
| | | console.log('newRect', newRect) |
| | | if (newRect.width > 200) { |
| | | if (newRect.width > 100) { |
| | | if (newRect.width / newRect.height < 2) { |
| | | this.deviceList[index].fontSize = newRect.width / 10 |
| | | } else { |
| | | this.deviceList[index].fontSize = 20 |
| | | this.deviceList[index].fontSize = newRect.height / 5 |
| | | } |
| | | this.deviceList[index].top = newRect.top |
| | | this.deviceList[index].left = newRect.left |
| | | } else { |
| | | this.deviceList[index].fontSize = 12 |
| | | } |
| | | this.deviceList[index].vw = newRect.width |
| | | this.deviceList[index].vh = newRect.height |
| | | this.deviceList[index].top = newRect.top |
| | | this.deviceList[index].left = newRect.left |
| | | }, |
| | | /** |
| | | * æ ¹æ®è®¾å¤ç¶æå¼è·å对åºè®¾å¤æ°é |
| | | * @param value 设å¤ç¶æå¼ |
| | | * @returns {number} è®¾å¤æ°é |
| | | */ |
| | | getDeviceNumberByStatus(value) { |
| | | return this.deviceList.filter(item => item.status === value).length |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | font-size: 50px; |
| | | text-align: center; |
| | | position: relative; |
| | | |
| | | .header-right { |
| | | position: absolute; |
| | | right: 200px; |
| | |
| | | |
| | | .content-container { |
| | | position: relative; |
| | | |
| | | .device-status-info { |
| | | width: 400px; |
| | | position: absolute; |
| | | top: 5px; |
| | | right: 5px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | |
| | | .single-status-info { |
| | | width: 60px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | |
| | | .status-square { |
| | | width: 14px; |
| | | height: 14px; |
| | | border: 1px solid #fff; |
| | | border-radius: 2px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .single-device { |
| | | position: absolute; |
| | | border: 1px solid transparent; |
| | |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | cursor: default; |
| | | |
| | | &:active { |
| | | border: 1px solid #1890ff; |
| | | } |
| | | |
| | | .device-status { |
| | | width: 100%; |
| | | height: 100%; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | |
| | | .status-image { |
| | | background-size: 100% 100%; |
| | | background-repeat: no-repeat; |
| | | width: 45px; |
| | | margin-right: 10px; |
| | | } |
| | | |
| | | .device-image { |
| | | background-size: 100% 100%; |
| | | background-repeat: no-repeat; |
| | |
| | | height: 100%; |
| | | } |
| | | } |
| | | .device-id { |
| | | /*font-size: 20px;*/ |
| | | } |
| | | /*.device-info {*/ |
| | | /*width: 100%;*/ |
| | | /*display: flex;*/ |
| | | /*align-items: center;*/ |
| | | /*justify-content: space-between;*/ |
| | | /*.status-square {*/ |
| | | /*width: 14px;*/ |
| | | /*height: 14px;*/ |
| | | /*border: 1px solid #fff;*/ |
| | | /*border-radius: 2px;*/ |
| | | /*}*/ |
| | | /*}*/ |
| | | } |
| | | |
| | | } |
| | | } |
| | | </style> |
| | |
| | | name: 'è¿è¡æç', |
| | | type: 'pie', |
| | | radius: '70%', |
| | | center: ['55%', '55%'], |
| | | itemStyle: { |
| | | normal: { |
| | | color: function (params) { |
| | |
| | | series: [{ |
| | | type: 'pie', |
| | | radius: '60%', |
| | | center: ['55%', '55%'], |
| | | itemStyle: { |
| | | normal: { |
| | | /*color: function (params) { |
| | |
| | | let openRateTrendAnalysisChart = this.$echarts.init(document.getElementById('openRateTrendChart'), 'macarons') |
| | | let openRateTrendChartOptions = { |
| | | title: { |
| | | text: 'å©ç¨çèµ°å¿åæ', |
| | | text: 'å©ç¨çåæ®µåæ', |
| | | x: 'center', |
| | | textStyle: { |
| | | fontSize: 18, |
| | |
| | | .dataContent .mathData td { |
| | | padding: 10px; |
| | | /*display: none;*/ |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .dataContent .mathData:hover td { |
| | |
| | | .dataContent .mathData td { |
| | | padding: 10px; |
| | | /*display: none;*/ |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .dataContent .mathData:hover td { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-row :gutter="10"> |
| | | <a-col :md="leftColMd" :sm="24" style="margin-bottom: 20px"> |
| | | <a-card :bordered="false"> |
| | | <!-- æ¥è¯¢åºå --> |
| | | <div class="table-page-search-wrapper"> |
| | | <!-- æç´¢åºå --> |
| | | <a-form layout="inline" @keyup.enter.native="searchQuery"> |
| | | <a-row :gutter="24"> |
| | | <a-col :md="12" :sm="8"> |
| | | <a-form-item label="车é´åç§°" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}"> |
| | | <a-input placeholder="" v-model="queryParam.roleName"></a-input> |
| | | </a-form-item> |
| | | </a-col> |
| | | <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> |
| | | <a-col :md="12" :sm="24"> |
| | | <a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 21px">æ¥è¯¢</a-button> |
| | | <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">éç½®</a-button> |
| | | </a-col> |
| | | </span> |
| | | </a-row> |
| | | </a-form> |
| | | </div> |
| | | <!-- æä½æé®åºå --> |
| | | <div class="table-operator" style="margin: 5px 0 10px 2px"> |
| | | <a-button @click="handleAdd" type="primary" icon="plus">æ°å»ºè½¦é´</a-button> |
| | | </div> |
| | | |
| | | <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> |
| | | <i class="anticon anticon-info-circle ant-alert-icon"> |
| | | </i> 已鿩 <a><b>{{ selectedRowKeys1.length }}</b></a>项 |
| | | <a style="margin-left: 24px" @click="onClearSelected1">æ¸
空</a> |
| | | </div> |
| | | |
| | | <div style="margin-top: 15px"> |
| | | <a-table |
| | | style="height:500px" |
| | | ref="table" |
| | | size="middle" |
| | | bordered |
| | | rowKey="id" |
| | | :columns="columns" |
| | | :dataSource="dataSource" |
| | | :pagination="ipagination" |
| | | :loading="loading" |
| | | :rowSelection="{selectedRowKeys: selectedRowKeys1, onChange: onSelectChange1, type:'radio'}" |
| | | @change="handleTableChange"> |
| | | <template slot="backgroundImage" slot-scope="text,record"> |
| | | <img :src="getImgView(record.backgroundImage)" width="50" height="50"> |
| | | </template> |
| | | <span slot="action" slot-scope="text, record"> |
| | | <a @click="handleOpen(record)">车é´</a> |
| | | <a-divider type="vertical"/> |
| | | <a-dropdown> |
| | | <a class="ant-dropdown-link"> |
| | | æ´å¤ <a-icon type="down"/> |
| | | </a> |
| | | <a-menu slot="overlay"> |
| | | <a-menu-item> |
| | | <a @click="handleEdit(record)">ç¼è¾</a> |
| | | </a-menu-item> |
| | | <a-menu-item> |
| | | <a-popconfirm title="ç¡®å®å é¤å?" @confirm="() => handleDelete1(record.id)"> |
| | | <a>å é¤</a> |
| | | </a-popconfirm> |
| | | </a-menu-item> |
| | | </a-menu> |
| | | </a-dropdown> |
| | | </span> |
| | | </a-table> |
| | | </div> |
| | | </a-card> |
| | | </a-col> |
| | | <a-col :md="rightColMd" :sm="24" v-if="this.rightcolval == 1"> |
| | | <a-card :bordered="false"> |
| | | <div style="text-align: right;"> |
| | | <a-icon type="close-circle" @click="hideUserList"/> |
| | | </div> |
| | | <!-- æ¥è¯¢åºå --> |
| | | <div class="table-page-search-wrapper"> |
| | | <a-form layout="inline"> |
| | | <a-row :gutter="24"> |
| | | |
| | | <a-col :md="12" :sm="12"> |
| | | <a-form-item label="设å¤ç¼ç "> |
| | | <a-input placeholder="" v-model="queryParam2.equipmentId"></a-input> |
| | | </a-form-item> |
| | | </a-col> |
| | | <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> |
| | | <a-col :md="9" :sm="24"> |
| | | <a-button type="primary" @click="searchQuery2" icon="search" style="margin-left: 21px">æ¥è¯¢</a-button> |
| | | <a-button type="primary" @click="searchReset2" icon="reload" style="margin-left: 8px">éç½®</a-button> |
| | | |
| | | </a-col> |
| | | </span> |
| | | </a-row> |
| | | </a-form> |
| | | </div> |
| | | <!-- æä½æé®åºå --> |
| | | <div class="table-operator" :md="24" :sm="24"> |
| | | <a-button @click="handleAddDeviceInWorkshop" type="primary" icon="plus" style="margin-top: 16px">å·²æè®¾å¤ |
| | | </a-button> |
| | | |
| | | <a-dropdown v-if="selectedRowKeys2.length > 0"> |
| | | <a-menu slot="overlay"> |
| | | <a-menu-item key="1" @click="batchDel2"> |
| | | <a-icon type="delete"/> |
| | | å é¤ |
| | | </a-menu-item> |
| | | </a-menu> |
| | | <a-button style="margin-left: 8px"> æ¹éæä½ |
| | | <a-icon type="down"/> |
| | | </a-button> |
| | | </a-dropdown> |
| | | </div> |
| | | <!-- tableåºå-begin --> |
| | | <div> |
| | | <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> |
| | | <i class="anticon anticon-info-circle ant-alert-icon"></i> 已鿩 <a style="font-weight: 600">{{ |
| | | selectedRowKeys2.length }}</a>项 |
| | | <a style="margin-left: 24px" @click="onClearSelected2">æ¸
空</a> |
| | | </div> |
| | | <a-table |
| | | style="height:500px" |
| | | ref="table2" |
| | | bordered |
| | | size="middle" |
| | | rowKey="equipmentId" |
| | | :columns="columns2" |
| | | :dataSource="dataSource2" |
| | | :pagination="ipagination2" |
| | | :loading="loading2" |
| | | :rowSelection="{selectedRowKeys: selectedRowKeys2, onChange: onSelectChange2}" |
| | | @change="handleTableChange2"> |
| | | <span slot="action" slot-scope="text, record"> |
| | | <a-popconfirm title="ç¡®å®å é¤å?" @confirm="() => handleDelete2(record.equipmentId)"> |
| | | <a>å é¤</a> |
| | | </a-popconfirm> |
| | | </span> |
| | | </a-table> |
| | | </div> |
| | | </a-card> |
| | | </a-col> |
| | | <!-- 表ååºå --> |
| | | <workshop-modal ref="modalForm" @ok="modalFormOk"></workshop-modal> <!--æ°å¢è½¦é´--> |
| | | <select-device-modal ref="selectUserModal" @selectFinished="selectOK"></select-device-modal> <!--å·²æè®¾å¤--> |
| | | </a-row> |
| | | </template> |
| | | <script> |
| | | import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
| | | import { deleteAction, postAction, getAction } from '@/api/manage' |
| | | import SelectDeviceModal from './modules/SelectDeviceModal' |
| | | import WorkshopModal from './modules/WorkshopModal' |
| | | import { filterObj } from '@/utils/util' |
| | | import moment from 'moment' |
| | | |
| | | export default { |
| | | name: 'WorkshopSignageManagement', |
| | | mixins: [JeecgListMixin], |
| | | components: { |
| | | SelectDeviceModal, |
| | | WorkshopModal, |
| | | moment |
| | | }, |
| | | data() { |
| | | return { |
| | | model1: {}, |
| | | model2: {}, |
| | | currentRoleId: '', |
| | | currentWorkshopId: '', |
| | | queryParam1: {}, |
| | | queryParam2: {}, |
| | | dataSource1: [], |
| | | dataSource2: [], |
| | | ipagination1: { |
| | | current: 1, |
| | | pageSize: 10, |
| | | pageSizeOptions: ['10', '20', '30'], |
| | | showTotal: (total, range) => { |
| | | return range[0] + '-' + range[1] + ' å
±' + total + 'æ¡' |
| | | }, |
| | | showQuickJumper: true, |
| | | showSizeChanger: true, |
| | | total: 0 |
| | | }, |
| | | ipagination2: { |
| | | current: 1, |
| | | pageSize: 10, |
| | | pageSizeOptions: ['10', '20', '30'], |
| | | showTotal: (total, range) => { |
| | | return range[0] + '-' + range[1] + ' å
±' + total + 'æ¡' |
| | | }, |
| | | showQuickJumper: true, |
| | | showSizeChanger: true, |
| | | total: 0 |
| | | }, |
| | | isorter1: { |
| | | column: 'createTime', |
| | | order: 'desc' |
| | | }, |
| | | isorter2: { |
| | | column: 'createTime', |
| | | order: 'desc' |
| | | }, |
| | | filters1: {}, |
| | | filters2: {}, |
| | | loading1: false, |
| | | loading2: false, |
| | | selectedRowKeys1: [], |
| | | selectedRowKeys2: [], |
| | | selectionRows1: [], |
| | | selectionRows2: [], |
| | | test: {}, |
| | | rightcolval: 0, |
| | | columns: [ |
| | | { |
| | | title: '车é´åç§°', |
| | | align: 'center', |
| | | dataIndex: 'workshopName' |
| | | }, |
| | | { |
| | | title: '车é´èæ¯å¾', |
| | | dataIndex: 'backgroundImage', |
| | | align: 'center', |
| | | scopedSlots: { customRender: 'backgroundImage' } |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | dataIndex: 'action', |
| | | align: 'center', |
| | | scopedSlots: { customRender: 'action' } |
| | | } |
| | | ], |
| | | columns2: [ |
| | | { |
| | | title: '设å¤ç¼ç ', |
| | | align: 'center', |
| | | dataIndex: 'equipmentId', |
| | | width: 120 |
| | | }, |
| | | { |
| | | title: '设å¤åç§°', |
| | | align: 'center', |
| | | width: 100, |
| | | dataIndex: 'equipmentName' |
| | | }, |
| | | { |
| | | title: '设å¤ç±»å', |
| | | align: 'center', |
| | | width: 80, |
| | | dataIndex: 'equipmentType' |
| | | }, |
| | | |
| | | { |
| | | title: 'æä½', |
| | | dataIndex: 'action', |
| | | scopedSlots: { customRender: 'action' }, |
| | | align: 'center', |
| | | width: 120 |
| | | }], |
| | | // é«çº§æ¥è¯¢åæ° |
| | | superQueryParams2: '', |
| | | // é«çº§æ¥è¯¢æ¼æ¥æ¡ä»¶ |
| | | superQueryMatchType2: 'and', |
| | | url: { |
| | | list: '/mdc/mdcWorkshopInfo/list', |
| | | delete: '/sys/role/delete', |
| | | list2: '/mdc/mdcWorkshopInfo/workshopEquipmentList', |
| | | addDeviceInWorkshop: '/mdc/mdcWorkshopInfo/addWorkshopEquipment', |
| | | delete2: '/mdc/mdcWorkshopInfo/deleteWorkshopEquipment', |
| | | deleteBatch2: '/mdc/mdcWorkshopInfo/deleteWorkshopEquipmentBatch' |
| | | } |
| | | } |
| | | }, |
| | | computed: { |
| | | leftColMd() { |
| | | return this.selectedRowKeys1.length === 0 ? 24 : 12 |
| | | }, |
| | | rightColMd() { |
| | | return this.selectedRowKeys1.length === 0 ? 0 : 12 |
| | | } |
| | | }, |
| | | methods: { |
| | | onSelectChange2(selectedRowKeys, selectionRows) { |
| | | this.selectedRowKeys2 = selectedRowKeys |
| | | this.selectionRows2 = selectionRows |
| | | }, |
| | | onClearSelected2() { |
| | | this.selectedRowKeys2 = [] |
| | | this.selectionRows2 = [] |
| | | }, |
| | | onClearSelected1() { |
| | | this.selectedRowKeys1 = [] |
| | | this.selectionRows1 = [] |
| | | }, |
| | | onSelectChange1(selectedRowKeys, selectionRows) { |
| | | this.rightcolval = 1 |
| | | this.selectedRowKeys1 = selectedRowKeys |
| | | this.selectionRows1 = selectionRows |
| | | this.model1 = Object.assign({}, selectionRows[0]) |
| | | this.currentWorkshopId = selectedRowKeys[0] |
| | | this.loadData2() |
| | | }, |
| | | getQueryParams2() { |
| | | //è·åæ¥è¯¢æ¡ä»¶ |
| | | let sqp = {} |
| | | if (this.superQueryParams2) { |
| | | sqp['superQueryParams'] = encodeURI(this.superQueryParams2) |
| | | sqp['superQueryMatchType'] = this.superQueryMatchType2 |
| | | } |
| | | var param = Object.assign(sqp, this.queryParam2, this.isorter2, this.filters2) |
| | | param.field = this.getQueryField2() |
| | | param.pageNo = this.ipagination2.current |
| | | param.pageSize = this.ipagination2.pageSize |
| | | return filterObj(param) |
| | | }, |
| | | getQueryField2() { |
| | | //TODO åæ®µæéæ§å¶ |
| | | var str = 'id,' |
| | | this.columns2.forEach(function(value) { |
| | | str += ',' + value.dataIndex |
| | | }) |
| | | return str |
| | | }, |
| | | modalFormOk2() { |
| | | // æ°å¢/ä¿®æ¹ æåæ¶ï¼éè½½å表 |
| | | this.loadData2() |
| | | }, |
| | | loadData2(arg) { |
| | | if (!this.url.list2) { |
| | | this.$message.error('请设置url.list2屿§!') |
| | | return |
| | | } |
| | | //å è½½æ°æ® è¥ä¼ å
¥åæ°1åå 载第ä¸é¡µçå
容 |
| | | if (arg === 1) { |
| | | this.ipagination2.current = 1 |
| | | } |
| | | if (this.currentWorkshopId === '') return |
| | | let params = this.getQueryParams2()//æ¥è¯¢æ¡ä»¶ |
| | | params.workshopId = this.currentWorkshopId |
| | | this.loading2 = true |
| | | getAction(this.url.list2, params).then((res) => { |
| | | if (res.success) { |
| | | this.dataSource2 = res.result.records |
| | | this.ipagination2.total = res.result.total |
| | | } |
| | | this.loading2 = false |
| | | }) |
| | | }, |
| | | handleDelete1: function(id) { |
| | | this.handleDelete(id) |
| | | this.dataSource2 = [] |
| | | this.currentRoleId = '' |
| | | }, |
| | | |
| | | /** |
| | | * ç¹å»è®¾å¤è¡¨æ ¼ä¸çå 餿é®å触åå é¤å个车é´ä¸è®¾å¤çå
³ç³» |
| | | * @param equipmentId å½åè¡ç设å¤ç¼å· |
| | | */ |
| | | handleDelete2: function(equipmentId) { |
| | | if (!this.url.delete2) { |
| | | this.$message.error('请设置url.delete2屿§!') |
| | | return |
| | | } |
| | | var that = this |
| | | deleteAction(that.url.delete2, { workshopId: this.currentWorkshopId, equipmentId }).then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | that.loadData2() |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * æ¹éå é¤è½¦é´ä¸è®¾å¤çå
³ç³» |
| | | */ |
| | | batchDel2: function() { |
| | | if (!this.url.deleteBatch2) { |
| | | this.$message.error('请设置url.deleteBatch2屿§!') |
| | | return |
| | | } |
| | | if (this.selectedRowKeys2.length <= 0) { |
| | | // this.$message.warning('è¯·éæ©ä¸æ¡è®°å½ï¼') |
| | | this.$notification.warning({ |
| | | message: 'æ¶æ¯', |
| | | description: 'è¯·éæ©ä¸æ¡è®°å½' |
| | | }) |
| | | return |
| | | } else { |
| | | var ids = '' |
| | | for (var a = 0; a < this.selectedRowKeys2.length; a++) { |
| | | ids += this.selectedRowKeys2[a] + ',' |
| | | } |
| | | var that = this |
| | | this.$confirm({ |
| | | title: '确认å é¤', |
| | | content: 'æ¯å¦å é¤é䏿°æ®?', |
| | | onOk: function() { |
| | | deleteAction(that.url.deleteBatch2, { |
| | | workshopId: that.currentWorkshopId, |
| | | equipmentIds: ids |
| | | }).then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | that.loadData2() |
| | | that.onClearSelected() |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * 鿩已æè®¾å¤åç¹å»ç¡®å®æ¶è§¦å |
| | | * @param data 已鿩çè®¾å¤ |
| | | */ |
| | | selectOK(data) { |
| | | let params = {} |
| | | params.workshopId = this.currentWorkshopId |
| | | params.equipmentIdList = [] |
| | | for (var a = 0; a < data.length; a++) { |
| | | params.equipmentIdList.push(data[a]) |
| | | } |
| | | console.log(params) |
| | | postAction(this.url.addDeviceInWorkshop, params).then((res) => { |
| | | if (res.success) { |
| | | this.loadData2() |
| | | this.$message.success(res.message) |
| | | } else { |
| | | this.$message.warning(res.message) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * ç¹å»å·²æè®¾å¤æé®è§¦å |
| | | */ |
| | | handleAddDeviceInWorkshop() { |
| | | if (this.currentWorkshopId == '') { |
| | | this.$message.error('è¯·éæ©ä¸ä¸ªè½¦é´!') |
| | | } else { |
| | | this.$refs.selectUserModal.visible = true |
| | | this.$refs.selectUserModal.selectedRowKeys = [] |
| | | this.$refs.selectUserModal.selectedRows = [] |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * ç¹å»å½åè¡è½¦é´é项å触åäºä»¶ |
| | | * @param record å½åè¡æ°æ® |
| | | */ |
| | | handleOpen(record) { |
| | | this.rightcolval = 1 |
| | | this.selectedRowKeys1 = [record.id] |
| | | this.model1 = Object.assign({}, record) |
| | | this.currentWorkshopId = record.id |
| | | this.onClearSelected2() |
| | | this.loadData2() |
| | | }, |
| | | |
| | | searchQuery2() { |
| | | this.loadData2(1) |
| | | }, |
| | | searchReset2() { |
| | | this.queryParam2 = {} |
| | | this.loadData2(1) |
| | | }, |
| | | handleTableChange2(pagination, filters, sorter) { |
| | | //å页ãæåºãçéååæ¶è§¦å |
| | | //TODO çé |
| | | if (Object.keys(sorter).length > 0) { |
| | | this.isorter2.column = sorter.field |
| | | this.isorter2.order = 'ascend' == sorter.order ? 'asc' : 'desc' |
| | | } |
| | | this.ipagination2 = pagination |
| | | this.loadData2() |
| | | }, |
| | | hideUserList() { |
| | | //this.rightcolval = 0 |
| | | this.selectedRowKeys1 = [] |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style scoped> |
| | | /** Buttonæé®é´è· */ |
| | | .ant-btn { |
| | | margin-left: 8px |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <a-modal |
| | | centered |
| | | :title="title" |
| | | :width="1000" |
| | | :visible="visible" |
| | | @ok="handleOk" |
| | | @cancel="handleCancel" |
| | | cancelText="å
³é"> |
| | | |
| | | <!-- æ¥è¯¢åºå --> |
| | | <div class="table-page-search-wrapper"> |
| | | <a-form layout="inline" @keyup.enter.native="searchQuery"> |
| | | <a-row :gutter="24"> |
| | | |
| | | <a-col :span="10"> |
| | | <a-form-item label="设å¤åç§°"> |
| | | <a-input placeholder="请è¾å
¥è®¾å¤åç§°" v-model="queryParam.equipmentName"></a-input> |
| | | </a-form-item> |
| | | </a-col> |
| | | <a-col :span="8"> |
| | | <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> |
| | | <a-button type="primary" @click="searchQuery" icon="search">æ¥è¯¢</a-button> |
| | | <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">éç½®</a-button> |
| | | </span> |
| | | </a-col> |
| | | |
| | | </a-row> |
| | | </a-form> |
| | | </div> |
| | | <!-- tableåºå-begin --> |
| | | <div> |
| | | <a-table |
| | | size="small" |
| | | bordered |
| | | rowKey="equipmentId" |
| | | :columns="columns1" |
| | | :dataSource="dataSource1" |
| | | :pagination="ipagination" |
| | | :loading="loading" |
| | | :scroll="{ y: 240 }" |
| | | :rowSelection="{selectedRowKeys: selectedRowKeys,onSelectAll:onSelectAll,onSelect:onSelect,onChange: onSelectChange}" |
| | | @change="handleTableChange"> |
| | | </a-table> |
| | | </div> |
| | | <!-- tableåºå-end --> |
| | | </a-modal> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { filterObj } from '@/utils/util' |
| | | import { getAction } from '@/api/manage' |
| | | |
| | | export default { |
| | | name: 'SelectDeviceModal', |
| | | data() { |
| | | return { |
| | | title: 'æ·»å å·²æè®¾å¤', |
| | | names: [], |
| | | visible: false, |
| | | placement: 'right', |
| | | description: '', |
| | | // æ¥è¯¢æ¡ä»¶ |
| | | queryParam: {}, |
| | | // 表头 |
| | | columns1: [ |
| | | { |
| | | title: '#', |
| | | dataIndex: '', |
| | | key: 'rowIndex', |
| | | width: 50, |
| | | align: 'center', |
| | | customRender: function(t, r, index) { |
| | | return parseInt(index) + 1 |
| | | } |
| | | }, |
| | | { |
| | | title: '设å¤ç¼å·', |
| | | align: 'center', |
| | | width: 100, |
| | | dataIndex: 'equipmentId' |
| | | }, |
| | | { |
| | | title: '设å¤åç§°', |
| | | align: 'center', |
| | | width: 100, |
| | | dataIndex: 'equipmentName' |
| | | }, |
| | | { |
| | | title: '设å¤ç±»å', |
| | | align: 'center', |
| | | width: 100, |
| | | dataIndex: 'equipmentType' |
| | | }, |
| | | { |
| | | title: '驱å¨ç±»å', |
| | | align: 'center', |
| | | width: 100, |
| | | dataIndex: 'driveType' |
| | | } |
| | | ], |
| | | //æ°æ®é |
| | | dataSource1: [], |
| | | dataSource2: [], |
| | | // å页忰 |
| | | ipagination: { |
| | | current: 1, |
| | | pageSize: 10, |
| | | pageSizeOptions: ['10', '20', '30'], |
| | | showTotal: (total, range) => { |
| | | return range[0] + '-' + range[1] + ' å
±' + total + 'æ¡' |
| | | }, |
| | | showQuickJumper: true, |
| | | showSizeChanger: true, |
| | | total: 0 |
| | | }, |
| | | loading: false, |
| | | selectedRowKeys: [], |
| | | selectedRows: [], |
| | | url: { |
| | | list: '/mdc/mdcEquipment/list' |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | this.loadData() |
| | | }, |
| | | methods: { |
| | | searchQuery() { |
| | | this.loadData(1) |
| | | }, |
| | | searchReset() { |
| | | this.queryParam = {} |
| | | this.loadData(1) |
| | | }, |
| | | handleCancel() { |
| | | this.visible = false |
| | | }, |
| | | handleOk() { |
| | | this.dataSource2 = this.selectedRowKeys |
| | | console.log('data---------' + this.dataSource2) |
| | | if (this.dataSource2.length > 0) { |
| | | this.$emit('selectFinished', this.dataSource2) |
| | | } |
| | | this.visible = false |
| | | }, |
| | | add() { |
| | | this.visible = true |
| | | }, |
| | | loadData(arg) { |
| | | //å è½½æ°æ® è¥ä¼ å
¥åæ°1åå 载第ä¸é¡µçå
容 |
| | | if (arg === 1) { |
| | | this.ipagination.current = 1 |
| | | } |
| | | var params = this.getQueryParams()//æ¥è¯¢æ¡ä»¶ |
| | | getAction(this.url.list, params).then((res) => { |
| | | if (res.success) { |
| | | this.dataSource1 = res.result.records |
| | | this.ipagination.total = res.result.total |
| | | } |
| | | }) |
| | | }, |
| | | getQueryParams() { |
| | | var param = Object.assign({}, this.queryParam, this.isorter) |
| | | param.field = this.getQueryField() |
| | | param.pageNo = this.ipagination.current |
| | | param.pageSize = this.ipagination.pageSize |
| | | return filterObj(param) |
| | | }, |
| | | getQueryField() { |
| | | //TODO åæ®µæéæ§å¶ |
| | | }, |
| | | onSelectAll(selected, selectedRows, changeRows) { |
| | | if (selected === true) { |
| | | for (var a = 0; a < changeRows.length; a++) { |
| | | this.dataSource2.push(changeRows[a]) |
| | | } |
| | | } else { |
| | | for (var b = 0; b < changeRows.length; b++) { |
| | | this.dataSource2.splice(this.dataSource2.indexOf(changeRows[b]), 1) |
| | | } |
| | | } |
| | | // console.log(selected, selectedRows, changeRows); |
| | | }, |
| | | onSelect(record, selected) { |
| | | console.log(this.selectedRowKeys) |
| | | if (selected === true) { |
| | | this.dataSource2.push(record) |
| | | } else { |
| | | var index = this.dataSource2.indexOf(record) |
| | | //console.log(); |
| | | if (index >= 0) { |
| | | this.dataSource2.splice(this.dataSource2.indexOf(record), 1) |
| | | } |
| | | } |
| | | }, |
| | | onSelectChange(selectedRowKeys, selectedRows) { |
| | | console.log('selectedRowKeys', selectedRowKeys) |
| | | this.selectedRowKeys = selectedRowKeys |
| | | this.selectionRows = selectedRows |
| | | }, |
| | | onClearSelected() { |
| | | this.selectedRowKeys = [] |
| | | this.selectionRows = [] |
| | | }, |
| | | handleDelete: function(record) { |
| | | this.dataSource2.splice(this.dataSource2.indexOf(record), 1) |
| | | }, |
| | | handleTableChange(pagination, filters, sorter) { |
| | | //å页ãæåºãçéååæ¶è§¦å |
| | | console.log(sorter) |
| | | //TODO çé |
| | | if (Object.keys(sorter).length > 0) { |
| | | this.isorter.column = sorter.field |
| | | this.isorter.order = 'ascend' == sorter.order ? 'asc' : 'desc' |
| | | } |
| | | this.ipagination = pagination |
| | | this.loadData() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="less" scoped> |
| | | .ant-card-body .table-operator { |
| | | margin-bottom: 18px; |
| | | } |
| | | |
| | | .ant-table-tbody .ant-table-row td { |
| | | padding-top: 15px; |
| | | padding-bottom: 15px; |
| | | } |
| | | |
| | | .anty-row-operator button { |
| | | margin: 0 5px |
| | | } |
| | | |
| | | .ant-btn-danger { |
| | | background-color: #ffffff |
| | | } |
| | | |
| | | .ant-modal-cust-warp { |
| | | height: 100% |
| | | } |
| | | |
| | | .ant-modal-cust-warp .ant-modal-body { |
| | | height: calc(100% - 110px) !important; |
| | | overflow-y: auto |
| | | } |
| | | |
| | | .ant-modal-cust-warp .ant-modal-content { |
| | | height: 90% !important; |
| | | overflow-y: hidden |
| | | } |
| | | </style> |
| | |
| | | //æ ¹æ®å±å¹å®½åº¦èªéåºæ½å±å®½åº¦ |
| | | this.resetScreenSize(); |
| | | that.userId = record.id; |
| | | |
| | | that.model = Object.assign({},{selectedroles:'',selecteddeparts:''}, record); |
| | | that.model = Object.assign({},{selectedroles:'',selectedProduction:''}, record); |
| | | |
| | | //身份为ä¸çº§æ¾ç¤ºè´è´£é¨é¨ï¼å¦å䏿¾ç¤º |
| | | if(this.model.userIdentity==2){ |
| | | this.departIdShow=true; |
| | |
| | | that.getUserRoles(record.id); |
| | | that.getUserDeparts(record.id); |
| | | } |
| | | console.log('that.model=',that.model) |
| | | console.log('that.model',that.model) |
| | | }, |
| | | isDisabledAuth(code){ |
| | | return disabledAuthFilter(code); |
| | |
| | | return c; |
| | | }) |
| | | }, |
| | | |
| | | |
| | | |
| | | refresh () { |
| | | this.userId="" |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-modal |
| | | :title="title" |
| | | :width="800" |
| | | :visible="visible" |
| | | :confirmLoading="confirmLoading" |
| | | @ok="handleOk" |
| | | @cancel="handleCancel" |
| | | cancelText="å
³é" |
| | | wrapClassName="ant-modal-cust-warp" |
| | | style="top:5%;height: 85%;overflow-y: hidden"> |
| | | |
| | | <a-spin :spinning="confirmLoading"> |
| | | <a-form-model ref="form" v-bind="layout" :model="model" :rules="validatorRules"> |
| | | <a-form-model-item label="车é´ç¼å·" required prop="id"> |
| | | <a-input v-model="model.id" :disabled="isEdit" placeholder="请è¾å
¥è½¦é´ç¼å·"/> |
| | | </a-form-model-item> |
| | | <a-form-model-item label="车é´åç§°" required prop="workshopName"> |
| | | <a-input v-model="model.workshopName" placeholder="请è¾å
¥è½¦é´åç§°"/> |
| | | </a-form-model-item> |
| | | <a-form-model-item label="车é´èæ¯å¾" required prop="backgroundImage"> |
| | | <j-image-upload class="avatar-uploader" text="ä¸ä¼ " v-model="model.backgroundImage"></j-image-upload> |
| | | </a-form-model-item> |
| | | </a-form-model> |
| | | </a-spin> |
| | | </a-modal> |
| | | </template> |
| | | |
| | | <script> |
| | | import api from '@/api/mdc' |
| | | |
| | | export default { |
| | | name: 'WorkshopModal', |
| | | data() { |
| | | return { |
| | | title: 'æä½', |
| | | visible: false, |
| | | isEdit: false, |
| | | model: {}, |
| | | layout: { |
| | | labelCol: { span: 3 }, |
| | | wrapperCol: { span: 14 } |
| | | }, |
| | | confirmLoading: false, |
| | | validatorRules: { |
| | | workshopName: [ |
| | | { required: true, message: '请è¾å
¥è½¦é´åç§°!' }, |
| | | { min: 2, max: 30, message: 'é¿åº¦å¨ 2 å° 30 个å符', trigger: 'blur' } |
| | | ], |
| | | id: [ |
| | | { required: true, message: '请è¾å
¥è½¦é´ç¼å·!' }, |
| | | { min: 0, max: 64, message: 'é¿åº¦ä¸è¶
è¿ 64 个å符', trigger: 'blur' }, |
| | | { validator: this.validateRoleCode } |
| | | ], |
| | | backgroundImage:[ |
| | | { required: true, message: '请ä¸ä¼ 车é´èæ¯å¾!' } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | //å¤ä»½modelåå§å¼ |
| | | this.modelDefault = JSON.parse(JSON.stringify(this.model)) |
| | | }, |
| | | methods: { |
| | | add() { |
| | | this.edit(this.modelDefault) |
| | | }, |
| | | edit(record) { |
| | | this.model = Object.assign({}, record) |
| | | this.visible = true |
| | | //ç¼è¾é¡µé¢ç¦æ¢ä¿®æ¹è§è²ç¼ç |
| | | if (this.model.id) { |
| | | this.isEdit = true |
| | | } else { |
| | | this.isEdit = false |
| | | } |
| | | }, |
| | | close() { |
| | | this.$refs.form.clearValidate() |
| | | this.$emit('close') |
| | | this.visible = false |
| | | }, |
| | | handleOk() { |
| | | const that = this |
| | | // 触å表åéªè¯ |
| | | this.$refs.form.validate(valid => { |
| | | if (valid) { |
| | | console.log('触å') |
| | | that.confirmLoading = true |
| | | let obj |
| | | if (!this.isEdit) { |
| | | console.log('è§¦åæ°å¢') |
| | | obj = api.addWorkshopApi(this.model) |
| | | } else { |
| | | console.log('触åä¿®æ¹') |
| | | obj = api.editWorkshopApi(this.model) |
| | | } |
| | | obj.then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | that.$emit('ok') |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }).finally(() => { |
| | | that.confirmLoading = false |
| | | that.close() |
| | | }) |
| | | } else { |
| | | return false |
| | | } |
| | | }) |
| | | }, |
| | | handleCancel() { |
| | | this.close() |
| | | }, |
| | | validateRoleCode(rule, value, callback) { |
| | | if (/[\u4E00-\u9FA5]/g.test(value)) { |
| | | callback('车é´ç¼å·ä¸å¯è¾å
¥æ±å!') |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .avatar-uploader > .ant-upload { |
| | | width: 104px; |
| | | height: 104px; |
| | | } |
| | | </style> |