|
@@ -7,7 +7,19 @@
|
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
|
<a-form-item label="设备名称">
|
|
<a-form-item label="设备名称">
|
|
<!-- <a-input placeholder="请输入设备名称" v-model="queryParam.equipmentname"></a-input> -->
|
|
<!-- <a-input placeholder="请输入设备名称" v-model="queryParam.equipmentname"></a-input> -->
|
|
- <j-search-select-tag v-model="queryParam.tcontequiptid" placeholder="请选择设备" dict="tpm_equipment,equipmentname,id" />
|
|
|
|
|
|
+ <!-- <j-search-select-tag v-model="queryParam.tcontequiptid" placeholder="请选择设备" dict="tpm_equipment,equipmentname,id" /> -->
|
|
|
|
+ <a-select
|
|
|
|
+ v-model="queryParam.tcontequiptid"
|
|
|
|
+ placeholder="请输入设备名称或设备编号"
|
|
|
|
+ show-search
|
|
|
|
+ :filterOption="filterOptions"
|
|
|
|
+ @search="searchDevice"
|
|
|
|
+ allowClear>
|
|
|
|
+ <a-select-option v-for="(item, index) in deviceOptions" :key="index" :value="item.id" :label="item.equipmentname">
|
|
|
|
+ <span>{{item.equipmentname}}</span>
|
|
|
|
+ <span style="position: absolute;right: 2%;">{{ item.equipmentcode }}</span>
|
|
|
|
+ </a-select-option>
|
|
|
|
+ </a-select>
|
|
</a-form-item>
|
|
</a-form-item>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
|
@@ -138,7 +150,7 @@
|
|
import '@/assets/less/TableExpand.less'
|
|
import '@/assets/less/TableExpand.less'
|
|
import { mixinDevice } from '@/utils/mixin'
|
|
import { mixinDevice } from '@/utils/mixin'
|
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
|
- import { postAction } from '@/api/manage'
|
|
|
|
|
|
+ import { postAction, getAction } from '@/api/manage'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: 'InspectList',
|
|
name: 'InspectList',
|
|
@@ -222,10 +234,13 @@
|
|
},
|
|
},
|
|
dictOptions:{},
|
|
dictOptions:{},
|
|
superFieldList:[],
|
|
superFieldList:[],
|
|
|
|
+ deviceOptions: [],
|
|
|
|
+ deviceOptionsAll: [],
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
- this.getSuperFieldList();
|
|
|
|
|
|
+ this.getSuperFieldList();
|
|
|
|
+ this.getDeviceOption();
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
importExcelUrl: function(){
|
|
importExcelUrl: function(){
|
|
@@ -233,6 +248,47 @@
|
|
},
|
|
},
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ // 获取设备下拉列表
|
|
|
|
+ getDeviceOption(){
|
|
|
|
+ getAction(`/tpmEquipment/tpmEquipment/selectEquipmentList`).then(res=>{
|
|
|
|
+ console.log(111,res.result)
|
|
|
|
+ this.deviceOptions = res.result.map((res) => {
|
|
|
|
+ return {
|
|
|
|
+ id: res.id,
|
|
|
|
+ equipmentname: res.equipmentname,
|
|
|
|
+ equipmentcode: res.equipmentcode,
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ // 存一个完整的设备表
|
|
|
|
+ this.deviceOptionsAll = this.deviceOptions
|
|
|
|
+ console.log(7878,this.deviceOptionsAll)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 筛选设备
|
|
|
|
+ searchDevice(value) {
|
|
|
|
+ console.log(1212,value,value.trim().length)
|
|
|
|
+ // 若输入的值删除,则重新赋完整的设备列表
|
|
|
|
+ if (value.trim().length === 0) {
|
|
|
|
+ this.deviceOptions = this.deviceOptionsAll
|
|
|
|
+ }
|
|
|
|
+ // 通过判断字符串中是数字还是文字进而判断是通过设备名筛选还是设备编号筛选
|
|
|
|
+ let panDuan = isNaN(parseFloat(value))
|
|
|
|
+ if (!panDuan) {
|
|
|
|
+ // 数字
|
|
|
|
+ console.log(777)
|
|
|
|
+ let filteredArray = this.deviceOptionsAll.filter(item => item.equipmentcode.includes(value));
|
|
|
|
+ this.deviceOptions = filteredArray
|
|
|
|
+ } else {
|
|
|
|
+ console.log(888)
|
|
|
|
+ let filteredArray = this.deviceOptionsAll.filter(item => item.equipmentname.includes(value));
|
|
|
|
+ this.deviceOptions = filteredArray
|
|
|
|
+ }
|
|
|
|
+ console.log(999,this.deviceOptions)
|
|
|
|
+ },
|
|
|
|
+ // 解决筛选后option不回显问题
|
|
|
|
+ filterOptions(input, option) {
|
|
|
|
+ return this.deviceOptions
|
|
|
|
+ },
|
|
// 确认
|
|
// 确认
|
|
handleConfirm(record){
|
|
handleConfirm(record){
|
|
postAction(this.url.confirm, record).then((res) => {
|
|
postAction(this.url.confirm, record).then((res) => {
|