zhangdi 11 months ago
commit ebde89d922
  1. 4
      src/views/businessManagement/ordinary.vue
  2. 2
      src/views/device/deviceSystem.vue
  3. 886
      src/views/labManagement/components/addDialog.vue
  4. 252
      src/views/labManagement/inspectionManagement.vue

@ -35,7 +35,7 @@
<el-button v-show="permission.ordinaryView" @click="handleView(row)">查看</el-button> <el-button v-show="permission.ordinaryView" @click="handleView(row)">查看</el-button>
<el-button v-show="permission.ordinaryOrder && (row.status == 101 || row.status == 400 || row.status == 205)" <el-button v-show="permission.ordinaryOrder && (row.status == 101 || row.status == 400 || row.status == 205)"
@click="takeOrders(row)">接单</el-button> @click="takeOrders(row)">{{row.status == 400 ? '派单' : '接单'}}</el-button>
<el-button v-show="permission.ordinaryClose && row.status == 101" @click="handleClone(row)">关闭</el-button> <el-button v-show="permission.ordinaryClose && row.status == 101" @click="handleClone(row)">关闭</el-button>
<el-button v-show="permission.ordinaryConfirm && row.status == 201" @click="reciveOrder(row)">确认</el-button> <el-button v-show="permission.ordinaryConfirm && row.status == 201" @click="reciveOrder(row)">确认</el-button>
@ -309,7 +309,7 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="productId" align="center" label="物料名称" width="140"> <el-table-column prop="productId" align="center" label="物料名称" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-select @change="((val) => { changeProduct(val, scope.$index) })" <el-select @change="((val) => { changeProduct(val, scope.$index) })"
@blur="((val) => { changeProduct(val, scope.$index) })" v-loadmore="loadmoreProduct" @blur="((val) => { changeProduct(val, scope.$index) })" v-loadmore="loadmoreProduct"

@ -208,7 +208,7 @@
</el-table-column> </el-table-column>
<el-table-column label="巡检周期" prop="period"> <el-table-column label="巡检周期" prop="period">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.period" placeholder="巡检周期" :disabled="viewType == 'view'"> <el-select v-model="scope.row.period + ''" placeholder="巡检周期" :disabled="viewType == 'view'">
<el-option v-for="item in periodArr" :key="item.dictKey" :label="item.dictValue" <el-option v-for="item in periodArr" :key="item.dictKey" :label="item.dictValue"
:value="item.dictKey"></el-option> :value="item.dictKey"></el-option>
</el-select> </el-select>

@ -160,480 +160,468 @@ export default {
headers: {}, headers: {},
labId: '' labId: ''
}
},
watch: {
detailForm(newVal, oldVal) {
if (JSON.stringify(newVal) != '{}') {
this.deviceList = []
this.detailForm = newVal
this.addForm = {
...this.detailForm,
unitId: newVal.deptId,
unitName: newVal.deptName,
content: newVal.planContent,
} }
this.floorArr = [] },
this.roomArr = [] watch: {
if (newVal.details && newVal.details.length != 0) { detailForm(newVal, oldVal) {
this.tableData = this.getDeepCode(newVal.details, []) if (JSON.stringify(newVal) != '{}') {
this.tableData.map(item => { console.log('JSON.stringify(newVal)---------------------->',JSON.stringify(newVal))
item.period = item.period this.deviceList = []
}) this.detailForm = newVal
this.changeUnit(newVal.deptId) this.addForm = {
...this.detailForm,
unitId: newVal.deptId,
unitName: newVal.deptName,
content: newVal.planContent,
}
this.floorArr = []
this.roomArr = []
if (newVal.details && newVal.details.length != 0) {
this.tableData = this.getDeepCode(newVal.details, [])
this.tableData.map(item => {
item.period = item.period
})
this.changeUnit(newVal.deptId)
}
this.imgList = []
this.filesList = []
this.drawList = []
this.drawfiles = []
this.filesList = this.detailForm.attaches
this.imgList = this.detailForm.attaches
this.detailForm.draws && this.detailForm.draws.length != 0 && this.detailForm.draws.map(item => {
this.drawList.push({
name: item.name,
url: item.link
})
this.drawfiles.push({
name: item.name,
url: item.link
})
})
} else {
this.deviceList = []
this.imgList = []
this.filesList = []
this.drawList = []
this.drawfiles = []
// this.getDeviceData()
getChildList(1, 100, '1858710780677984257').then(res => {
this.periodArr = res.data.data
})
this.headers = {
"Authorization": `Basic ${Base64.encode(`${website.clientId}:${website.clientSecret}`)}`,
'Blade-Auth': 'bearer ' + getToken(),
'Blade-Requested-With': 'BladeHttpRequest'
}
}
} }
this.imgList = [] },
this.filesList = [] created() {
this.drawList = []
this.drawfiles = []
this.filesList = this.detailForm.attaches
this.imgList = this.detailForm.attaches
this.detailForm.draws.map(item => {
this.drawList.push({
name: item.name,
url: item.link
})
this.drawfiles.push({
name: item.name,
url: item.link
})
})
} else {
this.deviceList = [] this.deviceList = []
this.imgList = []
this.filesList = []
this.drawList = []
this.drawfiles = []
// this.getDeviceData() // this.getDeviceData()
getChildList(1, 100, '1858710780677984257').then(res => { getChildList(1, 100, '1858710780677984257').then(res => {
this.periodArr = res.data.data this.periodArr = res.data.data
}) })
this.headers = { this.headers = {
"Authorization": `Basic ${Base64.encode(`${website.clientId}:${website.clientSecret}`)}`, "Authorization": `Basic ${Base64.encode(`${website.clientId}:${website.clientSecret}`)}`,
'Blade-Auth': 'bearer ' + getToken(), 'Blade-Auth': 'bearer ' + getToken(),
'Blade-Requested-With': 'BladeHttpRequest' 'Blade-Requested-With': 'BladeHttpRequest'
} }
} this.imgList = []
} this.filesList = []
}, this.drawList = []
created() { this.drawfiles = []
this.deviceList = [] if (JSON.stringify(this.detailForm) != '{}') {
// this.getDeviceData() this.addForm = {
getChildList(1, 100, '1858710780677984257').then(res => { ...this.detailForm,
this.periodArr = res.data.data unitId: this.detailForm.deptId,
}) unitName: this.detailForm.deptName,
this.headers = { content: this.detailForm.planContent,
"Authorization": `Basic ${Base64.encode(`${website.clientId}:${website.clientSecret}`)}`, }
'Blade-Auth': 'bearer ' + getToken(), this.floorArr = []
'Blade-Requested-With': 'BladeHttpRequest' this.roomArr = []
} this.tableData = this.getDeepCode(this.detailForm.details, [])
this.imgList = [] this.detailForm.deptId && this.changeUnit(this.detailForm.deptId)
this.filesList = []
this.drawList = []
this.drawfiles = []
if (JSON.stringify(this.detailForm) != '{}') {
this.addForm = {
...this.detailForm,
unitId: this.detailForm.deptId,
unitName: this.detailForm.deptName,
content: this.detailForm.planContent,
}
this.floorArr = []
this.roomArr = []
this.tableData = this.getDeepCode(this.detailForm.details, [])
this.changeUnit(this.detailForm.deptId)
this.detailForm.attaches.map(item => {
this.imgList.push({
name: item.name,
url: item.link
})
this.filesList.push({
name: item.name,
url: item.link
})
})
this.detailForm.draws.map(item => {
this.drawList.push({
name: item.name,
url: item.link
})
this.drawfiles.push({
name: item.name,
url: item.link
})
})
} else {
this.drawList = []
this.drawfiles = []
this.imgList = []
this.filesList = []
this.addForm = {}
}
},
methods: {
getDeepCode(data, arr) {
console.log('data', data)
if (data && data.length > 0) {
data.map(item => {
if (item.details.length != 0) {
this.getDeepCode(item.details, arr)
} else {
arr.push(item)
}
})
return arr
}
}, this.detailForm.attaches && this.detailForm.attaches.length != 0 && this.detailForm.attaches.map(item => {
handleSuccess(response, file, fileList) { this.imgList.push({
if (response.code == 200) { name: item.name,
this.filesList.push({ url: item.link
url: response.data.link, //url })
name: response.data.originalName, // this.filesList.push({
}) name: item.name,
} url: item.link
}, })
handleRemove(res, file) {
this.filesList = this.filesList.filter(item => item.link == res.url && item.name == res.name)
},
handledrawSuccess(response, file, fileList) {
if (response.code == 200) {
this.drawfiles.push({
url: response.data.link, //url
name: response.data.originalName, //
})
}
},
handledrawRemove(res, file) {
this.drawfiles = this.drawfiles.filter(item => item.link == res.url && item.name == res.name)
},
getDeviceData() {
getDeviceList({ current: this.deviceCurrent, size: this.deviceSize }).then(res => {
this.deviceList = res.data.data.records
this.deviceList.forEach(item => {
item.disabled = false
})
})
},
async justify() {
//truefalse
try {
return await this.$refs['form'].validate()
} catch (error) {
return false
}
},
getSpanArr(data) {
for (var i = 0; i < data.length; i++) {
if (i === 0) {
this.spanArr.push(1);
this.pos = 0
} else {
//
if (data[i].deviceId === data[i - 1].deviceId) {
this.spanArr[this.pos] += 1;
this.spanArr.push(0);
} else {
this.spanArr.push(1);
this.pos = i;
}
}
}
},
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 1 && row.deviceId != '') {
if (this.spanArr.length != 0) {
const _row = this.spanArr[rowIndex];
const _col = _row > 0 ? 1 : 0;
return {
rowspan: _row,
colspan: _col
}
}
}
},
//
changeStartTime(val, index) {
this.addForm.tableData[index].nextStartTime = val
},
//
changeDevice(val, index) {
console.log('val------------->', val, index)
getDetail({ id: val }).then(res => {
if (this.title == '新建') {
console.log('tmp------------------->', this.tableData.find(item => item.deviceId == val))
let arr = []
res.data.data.maintenances.map(item => {
arr.push({
floorId: this.activeFloor, // id
floorName: this.floorArr.find(item => item.id == this.activeFloor).deptName, //
deviceId: item.deviceId,
deviceName: res.data.data.name,
deptId: this.activeRoom, // id
deptName: this.roomArr.find(item => item.id == this.activeRoom).deptName, //
checkContent: item.checkContent,
majorName: '',
nextStartTime: item.startTime,
startTime: item.startTime,
craft: item.craft,
period: item.period,
}) })
}) this.detailForm.draws && this.detailForm.draws.length != 0 && this.detailForm.draws.map(item => {
this.tableData = [...this.tableData, ...arr] this.drawList.push({
this.addForm.tableData = this.tableData.filter(item => item.floorId == this.activeFloor && item.deptId == this.activeRoom) name: item.name,
this.spanArr = [] url: item.link
this.pos = 0 })
this.getSpanArr(this.addForm.tableData) this.drawfiles.push({
let arr1 = this.deviceList.filter(item1 => name: item.name,
this.addForm.tableData.some(item2 => url: item.link
item1.id == item2.deviceId })
)
);
this.deviceList.map(item1 => {
item1.disabled = false
arr1.map(item2 => {
if (item2.id == item1.id) {
item1.disabled = true
}
}) })
})
} else { } else {
let arr = [] this.drawList = []
res.data.data.maintenances.map(item => { this.drawfiles = []
arr.push({ this.imgList = []
floorId: this.activeFloor, // id this.filesList = []
floorName: this.floorArr.find(item => item.id == this.activeFloor).deptName, // this.addForm = {}
deviceId: item.deviceId,
deviceName: res.data.data.name,
deptId: this.activeRoom, // id
deptName: this.roomArr.find(item => item.id == this.activeRoom).deptName, //
checkContent: item.checkContent,
majorName: '',
nextStartTime: item.startTime,
startTime: item.startTime,
craft: item.craft,
period: item.period,
})
})
if (index == this.addForm.tableData.length - 1) {
this.addForm.tableData.splice(index, 1, ...arr)
// this.tableData.splice(index,1,...arr)
this.spanArr = []
this.pos = 0
this.getSpanArr(this.addForm.tableData)
} else {
this.addForm.tableData.splice(index, this.spanArr[index], ...arr)
// this.tableData.splice(index,this.spanArr[index],...arr)
this.spanArr = []
this.pos = 0
this.getSpanArr(this.addForm.tableData)
}
this.addForm.tableData = func.process(this.addForm.tableData)
this.$forceUpdate()
this.spanArr = []
this.pos = 0
this.getSpanArr(this.addForm.tableData)
this.tableData = [...this.tableData, ...this.addForm.tableData]
this.tableData = func.process(this.tableData)
let arr1 = this.deviceList.filter(item1 =>
this.addForm.tableData.some(item2 =>
item1.id == item2.deviceId
)
);
console.log('arr1==============>', arr1)
this.deviceList.map(item1 => {
item1.disabled = false
arr1.map(item2 => {
if (item2.id == item1.id) {
item1.disabled = true
}
})
})
console.log('this.deviceList', this.deviceList)
} }
})
}, },
// methods: {
changeUnit(val) { getDeepCode(data, arr) {
console.log('val===========>', val) data && data.length != 0 && data.map(item => {
console.log('unitData===============>', this.unitData) if (item.details.length != 0) {
this.labId = val this.getDeepCode(item.details, arr)
if (this.title == '新建') { } else {
this.addForm.unitName = this.unitData.length > 0 ? this.unitData.find(item => item.id == val).title : '' arr.push(item)
this.deviceList.map(item => {
item.disabled = false
})
}
getDeepData({ parentId: val }).then(res => {
console.log('res ------------------->', res)
this.floorArr = res.data.data
this.activeFloor = res.data.data.length > 0 ? res.data.data[0].id : ''
getDeepData({ parentId: this.activeFloor }).then(res => {
this.roomArr = res.data.data
this.activeRoom = res.data.data.length > 0 ? res.data.data[0].id : ''
this.clickRoom(res.data.data[0])
if (JSON.stringify(this.detailForm) != '{}') {
console.log(this.activeFloor, this.activeRoom)
this.addForm.tableData = this.tableData.filter(item => item.floorId == this.activeFloor && item.deptId == this.activeRoom)
console.log('addForm==========>', this.addForm.tableData)
let arr1 = this.deviceList.filter(item1 =>
this.addForm.tableData.some(item2 =>
item1.id == item2.deviceId
)
);
console.log('arr1==============>', arr1)
this.deviceList.map(item1 => {
item1.disabled = false
arr1.map(item2 => {
if (item2.id == item1.id) {
item1.disabled = true
} }
})
}) })
console.log('deviceList', this.deviceList) return arr
this.spanArr = [] },
this.pos = 0 handleSuccess(response, file, fileList) {
this.getSpanArr(this.addForm.tableData) if (response.code == 200) {
} this.filesList.push({
}) url: response.data.link, //url
}) name: response.data.originalName, //
}, })
openForm() {
this.addForm.tableData = [
{ floorId: this.activeFloor, roomId: this.activeRoom, majorName: '', checkContent: '', craft: '' },
]
this.tableData = this.tableData.concat(this.addForm.tableData)
this.activeFloor = '001'
this.activeRoom = '001'
},
clearForm() {
this.$refs['form'].resetFields()
this.tableData = []
this.addForm = {
tableData: []
}
},
addColumn() {
if (this.title == '查看') {
return
} else {
this.addForm.tableData.push({ floorId: this.activeFloor, roomId: this.activeRoom, majorName: '', checkContent: '', craft: '', deviceId: '' })
this.tableData = this.tableData.filter(item => (item.floorId != this.activeFloor || item.roomId != this.activeRoom))
}
},
deleteColumn(row, index) {
if (this.title == '查看') {
return
} else {
this.tableData.splice(index, 1);
this.spanArr = []
this.pos = 0
this.addForm.tableData.splice(index, 1);
this.getSpanArr(this.addForm.tableData)
console.log('tableData', this.tableData)
}
},
dealFloor(val) {
getDeepData({ parentId: val }).then(res => {
this.roomArr = res.data.data
this.activeRoom = this.roomArr[0].id
this.clickRoom(this.roomArr[0])
this.addForm.tableData = this.tableData.filter(item => item.floorId == this.activeFloor && item.deptId == this.activeRoom)
if (this.addForm.tableData.length == 0) {
this.addForm.tableData = [{ floorId: this.activeFloor, roomId: this.activeRoom, majorName: '', checkContent: '', craft: '' }]
}
const uniqueArr = this.addForm.tableData.filter((item, index, self) => {
return index === self.findIndex(obj => obj.craft === item.craft && obj.deviceId === item.deviceId);
});
this.addForm.tableData = uniqueArr
let arr1 = this.deviceList.filter(item1 =>
this.addForm.tableData.some(item2 =>
item1.id == item2.deviceId
)
);
this.deviceList.map(item1 => {
item1.disabled = false
arr1.map(item2 => {
if (item2.id == item1.id) {
item1.disabled = true
} }
}) },
}) handleRemove(res, file) {
this.spanArr = [] this.filesList = this.filesList.filter(item => item.link == res.url && item.name == res.name)
this.pos = 0 },
this.getSpanArr(this.addForm.tableData) handledrawSuccess(response, file, fileList) {
}) if (response.code == 200) {
}, this.drawfiles.push({
clickFloor(val) { url: response.data.link, //url
this.activeFloor = val.id name: response.data.originalName, //
this.dealFloor(val.id) })
}, }
clickRoom(val) { },
console.log('val1------------->', val) handledrawRemove(res, file) {
console.log('title------------->', this.title) this.drawfiles = this.drawfiles.filter(item => item.link == res.url && item.name == res.name)
if (val) { },
this.activeRoom = val.id getDeviceData() {
getDeviceList({ current: this.deviceCurrent, size: this.deviceSize }).then(res => {
if (this.title == '新建') { this.deviceList = res.data.data.records
getDeviceLists({ limsId: this.labId, floorId: this.activeFloor, roomId: this.activeRoom }).then(res => { this.deviceList.forEach(item => {
this.deviceList = res.data.data item.disabled = false
console.log('res==============>', res) })
console.log('table-------------->', this.tableData) })
res.data.data.map((item, index) => { },
if (!this.tableData.find(item => item.deptId == this.activeRoom)) { async justify() {
this.changeDevice(item.id, index) //truefalse
} else { try {
this.addForm.tableData = this.tableData.filter(item => item.floorId == this.activeFloor && item.deptId == this.activeRoom) return await this.$refs['form'].validate()
} catch (error) {
return false
}
},
getSpanArr(data) {
for (var i = 0; i < data.length; i++) {
if (i === 0) {
this.spanArr.push(1);
this.pos = 0
} else {
//
if (data[i].deviceId === data[i - 1].deviceId) {
this.spanArr[this.pos] += 1;
this.spanArr.push(0);
} else {
this.spanArr.push(1);
this.pos = i;
}
}
}
},
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 1 && row.deviceId != '') {
if (this.spanArr.length != 0) {
const _row = this.spanArr[rowIndex];
const _col = _row > 0 ? 1 : 0;
return {
rowspan: _row,
colspan: _col
}
}
}
},
//
changeStartTime(val, index) {
this.addForm.tableData[index].nextStartTime = val
},
//
changeDevice(val, index) {
console.log('val------------->', val, index)
getDetail({ id: val }).then(res => {
if (this.title == '新建') {
console.log('tmp------------------->', this.tableData.find(item => item.deviceId == val))
let arr = []
res.data.data.maintenances.map(item => {
arr.push({
floorId: this.activeFloor, // id
floorName: this.floorArr.find(item => item.id == this.activeFloor).deptName, //
deviceId: item.deviceId,
deviceName: res.data.data.name,
deptId: this.activeRoom, // id
deptName: this.roomArr.find(item => item.id == this.activeRoom).deptName, //
checkContent: item.checkContent,
majorName: '',
nextStartTime: item.startTime,
startTime: item.startTime,
craft: item.craft,
period: item.period,
})
})
this.tableData = [...this.tableData, ...arr]
this.addForm.tableData = this.tableData.filter(item => item.floorId == this.activeFloor && item.deptId == this.activeRoom)
this.spanArr = []
this.pos = 0
this.getSpanArr(this.addForm.tableData)
let arr1 = this.deviceList.filter(item1 =>
this.addForm.tableData.some(item2 =>
item1.id == item2.deviceId
)
);
this.deviceList.map(item1 => {
item1.disabled = false
arr1.map(item2 => {
if (item2.id == item1.id) {
item1.disabled = true
}
})
})
} else {
let arr = []
res.data.data.maintenances.map(item => {
arr.push({
floorId: this.activeFloor, // id
floorName: this.floorArr.find(item => item.id == this.activeFloor).deptName, //
deviceId: item.deviceId,
deviceName: res.data.data.name,
deptId: this.activeRoom, // id
deptName: this.roomArr.find(item => item.id == this.activeRoom).deptName, //
checkContent: item.checkContent,
majorName: '',
nextStartTime: item.startTime,
startTime: item.startTime,
craft: item.craft,
period: item.period,
})
})
if (index == this.addForm.tableData.length - 1) {
this.addForm.tableData.splice(index, 1, ...arr)
// this.tableData.splice(index,1,...arr)
this.spanArr = []
this.pos = 0
this.getSpanArr(this.addForm.tableData)
} else {
this.addForm.tableData.splice(index, this.spanArr[index], ...arr)
// this.tableData.splice(index,this.spanArr[index],...arr)
this.spanArr = []
this.pos = 0
this.getSpanArr(this.addForm.tableData)
}
this.addForm.tableData = func.process(this.addForm.tableData)
this.$forceUpdate()
this.spanArr = []
this.pos = 0
this.getSpanArr(this.addForm.tableData)
this.tableData = [...this.tableData, ...this.addForm.tableData]
this.tableData = func.process(this.tableData)
let arr1 = this.deviceList.filter(item1 =>
this.addForm.tableData.some(item2 =>
item1.id == item2.deviceId
)
);
console.log('arr1==============>', arr1)
this.deviceList.map(item1 => {
item1.disabled = false
arr1.map(item2 => {
if (item2.id == item1.id) {
item1.disabled = true
}
})
})
console.log('this.deviceList', this.deviceList)
}
})
},
//
changeUnit(val) {
this.labId = val
if (this.title == '新建') {
this.addForm.unitName = this.unitData.find(item => item.id == val) ? this.unitData.find(item => item.id == val).title : ''
this.deviceList.map(item => {
item.disabled = false
})
}
getDeepData({ parentId: val }).then(res => {
this.floorArr = res.data.data
this.activeFloor = res.data.data.length > 0 ? res.data.data[0].id : ''
getDeepData({ parentId: this.activeFloor }).then(res => {
this.roomArr = res.data.data
this.activeRoom = res.data.data.length > 0 ? res.data.data[0].id : ''
this.clickRoom(res.data.data[0])
if (JSON.stringify(this.detailForm) != '{}') {
console.log(this.activeFloor, this.activeRoom)
this.addForm.tableData = this.tableData.filter(item => item.floorId == this.activeFloor && item.deptId == this.activeRoom)
let arr1 = this.deviceList.filter(item1 =>
this.addForm.tableData.some(item2 =>
item1.id == item2.deviceId
)
);
this.deviceList.map(item1 => {
item1.disabled = false
arr1.map(item2 => {
if (item2.id == item1.id) {
item1.disabled = true
}
})
})
console.log('deviceList', this.deviceList)
this.spanArr = []
this.pos = 0
this.getSpanArr(this.addForm.tableData)
}
})
})
},
openForm() {
this.addForm.tableData = [
{ floorId: this.activeFloor, roomId: this.activeRoom, majorName: '', checkContent: '', craft: '' },
]
this.tableData = this.tableData.concat(this.addForm.tableData)
this.activeFloor = '001'
this.activeRoom = '001'
},
clearForm() {
this.$refs['form'].resetFields()
this.tableData = []
this.addForm = {
tableData: []
}
},
addColumn() {
if (this.title == '查看') {
return
} else {
this.addForm.tableData.push({ floorId: this.activeFloor, roomId: this.activeRoom, majorName: '', checkContent: '', craft: '', deviceId: '' })
this.tableData = this.tableData.filter(item => (item.floorId != this.activeFloor || item.roomId != this.activeRoom))
}
},
deleteColumn(row, index) {
if (this.title == '查看') {
return
} else {
this.tableData.splice(index, 1);
this.spanArr = [] this.spanArr = []
this.pos = 0 this.pos = 0
this.addForm.tableData.splice(index, 1);
this.getSpanArr(this.addForm.tableData) this.getSpanArr(this.addForm.tableData)
console.log('tableData',this.tableData)
}
},
dealFloor(val) {
getDeepData({ parentId: val }).then(res => {
this.roomArr = res.data.data
this.activeRoom = this.roomArr[0].id
this.clickRoom(this.roomArr[0])
this.addForm.tableData = this.tableData.filter(item => item.floorId == this.activeFloor && item.deptId == this.activeRoom)
if (this.addForm.tableData.length == 0) {
this.addForm.tableData = [{ floorId: this.activeFloor, roomId: this.activeRoom, majorName: '', checkContent: '', craft: '' }]
}
const uniqueArr = this.addForm.tableData.filter((item, index, self) => {
return index === self.findIndex(obj => obj.craft === item.craft && obj.deviceId === item.deviceId);
});
this.addForm.tableData = uniqueArr
let arr1 = this.deviceList.filter(item1 => let arr1 = this.deviceList.filter(item1 =>
this.addForm.tableData.some(item2 => this.addForm.tableData.some(item2 =>
item1.id == item2.deviceId item1.id == item2.deviceId
) )
); );
this.deviceList.map(item1 => { this.deviceList.map(item1 => {
item1.disabled = false item1.disabled = false
arr1.map(item2 => { arr1.map(item2 => {
if (item2.id == item1.id) { if (item2.id == item1.id) {
item1.disabled = true item1.disabled = true
} }
}) })
}) })
} this.spanArr = []
}) this.pos = 0
}) this.getSpanArr(this.addForm.tableData)
} else {
this.isLoad = true
getDeviceLists({ limsId: this.labId, floorId: this.activeFloor, roomId: this.activeRoom }).then(res => {
this.deviceList = res.data.data
this.addForm.tableData = this.tableData.filter(item => item.floorId == this.activeFloor && item.deptId == this.activeRoom)
setTimeout(() => {
this.isLoad = false
}, 200)
this.deviceList.map(item1 => {
item1.disabled = false
if (this.addForm.tableData.filter(item2 => item2.deviceId == item1.id).length == item1.maintenances.length) {
item1.disabled = true
}
// arr1.map(item2 => {
// if (item2.id == item1.id) {
// item1.disabled = true
// }
// })
}) })
console.log('this.addForm.tableData', this.addForm.tableData) },
this.$forceUpdate(); clickFloor(val) {
this.spanArr = [] this.activeFloor = val.id
this.pos = 0 this.dealFloor(val.id)
this.getSpanArr(this.addForm.tableData) },
}) clickRoom(val) {
} this.activeRoom = val.id
} console.log('val1------------->', val)
console.log('title------------->', this.title)
}, if (this.title == '新建') {
} getDeviceLists({ limsId: this.labId, floorId: this.activeFloor, roomId: this.activeRoom }).then(res => {
this.deviceList = res.data.data
console.log('res==============>', res)
console.log('table-------------->', this.tableData)
res.data.data.map((item, index) => {
if (!this.tableData.find(item => item.deptId == this.activeRoom)) {
this.changeDevice(item.id, index)
} else {
this.addForm.tableData = this.tableData.filter(item => item.floorId == this.activeFloor && item.deptId == this.activeRoom)
this.spanArr = []
this.pos = 0
this.getSpanArr(this.addForm.tableData)
let arr1 = this.deviceList.filter(item1 =>
this.addForm.tableData.some(item2 =>
item1.id == item2.deviceId
)
);
this.deviceList.map(item1 => {
item1.disabled = false
arr1.map(item2 => {
if (item2.id == item1.id) {
item1.disabled = true
}
})
})
}
})
})
} else {
this.isLoad = true
getDeviceLists({ limsId: this.labId, floorId: this.activeFloor, roomId: this.activeRoom }).then(res => {
this.deviceList = res.data.data
this.addForm.tableData = this.tableData.filter(item => item.floorId == this.activeFloor && item.deptId == this.activeRoom)
setTimeout(() => {
this.isLoad = false
}, 200)
this.deviceList.map(item1 => {
item1.disabled = false
if(this.addForm.tableData.filter(item2 => item2.deviceId == item1.id).length == item1.maintenances.length){
item1.disabled = true
}
// arr1.map(item2 => {
// if (item2.id == item1.id) {
// item1.disabled = true
// }
// })
})
console.log('this.addForm.tableData',this.addForm.tableData)
this.$forceUpdate();
this.spanArr = []
this.pos = 0
this.getSpanArr(this.addForm.tableData)
})
}
},
}
} }
</script> </script>

@ -435,134 +435,132 @@ export default {
return data return data
}, },
handleAdd() { handleAdd() {
this.dialogTitle = '新建' this.dialogTitle = '新建'
this.dialogVisible = true this.dialogVisible = true
this.detailForm = {} this.detailForm = {}
this.detailForm.tableData = [] this.detailForm.tableData = []
this.getLeftLab() this.getLeftLab()
}, },
handleView(row) { handleView(row) {
getPlanDetail({ id: row.id }).then(res => { getPlanDetail({ id: row.id }).then(res => {
console.log('res==============>', res) this.dialogTitle = '查看'
this.dialogTitle = '查看' if (res.data.code == 200) {
if (res.data.code == 200) { this.detailForm = res.data.data
this.detailForm = res.data.data this.dialogVisible = true
this.dialogVisible = true }
} })
}) },
}, handleEdit(row) {
handleEdit(row) { getPlanDetail({ id: row.id }).then(res => {
getPlanDetail({ id: row.id }).then(res => { console.log('res==============>', res)
console.log('res==============>', res) this.dialogTitle = '编辑'
this.dialogTitle = '编辑' if (res.data.code == 200) {
if (res.data.code == 200) { this.detailForm = res.data.data
this.detailForm = res.data.data this.dialogVisible = true
this.dialogVisible = true }
} })
}) },
}, handleCancel() {
handleCancel() { this.dialogTitle = ''
this.dialogTitle = '' this.$refs.addDialog.addForm = {
this.$refs.addDialog.addForm = { tableData: []
tableData: [] }
} this.$refs.addDialog.tableData = []
this.$refs.addDialog.tableData = [] this.$refs.addDialog.floorArr = []
this.$refs.addDialog.floorArr = [] this.$refs.addDialog.activeFloor = ''
this.$refs.addDialog.activeFloor = '' this.$refs.addDialog.activeRoom = ''
this.$refs.addDialog.activeRoom = '' this.$refs.addDialog.roomArr = []
this.$refs.addDialog.roomArr = [] this.dialogVisible = false
this.dialogVisible = false },
},
getLeftLab() { getLeftLab() {
getLimsTree().then(res => { getLimsTree().then(res => {
console.log('res==============>', res) this.treeData = res.data.data
this.treeData = res.data.data // this.unitData = res.data.data.filter(item => item.parentId == 0)
this.unitData = res.data.data.filter(item => item.parentId == 0) this.unitData = res.data.data
console.log('unitData============>', this.unitData) })
}) },
}, nodeClick(data) {
nodeClick(data) { this.treeDeptId = data.id;
this.treeDeptId = data.id; this.page.currentPage = 1;
this.page.currentPage = 1; this.onLoad(this.page);
this.onLoad(this.page); },
}, currentChange(currentPage) {
currentChange(currentPage) { this.page.currentPage = currentPage;
this.page.currentPage = currentPage; },
}, sizeChange(pageSize) {
sizeChange(pageSize) { this.page.pageSize = pageSize;
this.page.pageSize = pageSize; },
}, searchChange(params, done) {
searchChange(params, done) { this.onLoad()
this.onLoad() done()
done() },
}, searchReset(params, done) {
searchReset(params, done) { this.onLoad()
this.onLoad() done()
done() },
}, refreshChange() {
refreshChange() { this.onLoad(this.page, this.query);
this.onLoad(this.page, this.query); },
}, handleConfirm() {
handleConfirm() { console.log('addDialog==========>', this.$refs.addDialog)
console.log('addDialog==========>', this.$refs.addDialog) let addForm = this.$refs.addDialog.addForm
let addForm = this.$refs.addDialog.addForm // this.$refs.addDialog.tableData.map(item => {
// this.$refs.addDialog.tableData.map(item => { // item.nextStartTime = item.startTime
// item.nextStartTime = item.startTime // })
// }) let arr = []
let arr = [] let arr1 = []
let arr1 = [] this.$refs.addDialog.filesList.map(item => {
this.$refs.addDialog.filesList.map(item => { arr.push({
arr.push({ name: item.name,
name: item.name, link: item.url
link: item.url })
}) })
}) this.$refs.addDialog.drawfiles.map(item => {
this.$refs.addDialog.drawfiles.map(item => { arr1.push({
arr1.push({ name: item.name,
name: item.name, link: item.url
link: item.url })
}) })
}) let query = {
let query = { id: addForm.id ? addForm.id : null, //
id: addForm.id ? addForm.id : null, // deptId: addForm.unitId, // id
deptId: addForm.unitId, // id deptName: addForm.unitName, //
deptName: addForm.unitName, // planContent: addForm.content, //
planContent: addForm.content, // details: this.$refs.addDialog.tableData,
details: this.$refs.addDialog.tableData, attaches: arr,
attaches: arr, draws: arr1
draws:arr1 }
} console.log('query===========>', query)
console.log('query===========>', query) if (query.id) {
if (query.id) { editPlan(query).then(res => {
editPlan(query).then(res => { if (res.data.code == 200) {
if (res.data.code == 200) { this.$message.success('编辑成功')
this.$message.success('编辑成功') this.onLoad()
this.onLoad() this.$refs.addDialog.addForm = {}
this.$refs.addDialog.addForm = {} this.$refs.addDialog.floorArr = []
this.$refs.addDialog.floorArr = [] this.$refs.addDialog.roomArr = []
this.$refs.addDialog.roomArr = [] this.$refs.addDialog.activeFloor = ''
this.$refs.addDialog.activeFloor = '' this.$refs.addDialog.activeRoom = ''
this.$refs.addDialog.activeRoom = '' this.dialogVisible = false
this.dialogVisible = false }
} })
}) } else {
} else { planCreate(query).then(res => {
planCreate(query).then(res => { console.log('res=======>', res)
console.log('res=======>', res) if (res.data.code == 200) {
if (res.data.code == 200) { this.$message.success('新增成功')
this.$message.success('新增成功') this.onLoad()
this.onLoad() this.$refs.addDialog.addForm = {}
this.$refs.addDialog.addForm = {} this.$refs.addDialog.floorArr = []
this.$refs.addDialog.floorArr = [] this.$refs.addDialog.roomArr = []
this.$refs.addDialog.roomArr = [] this.$refs.addDialog.activeFloor = ''
this.$refs.addDialog.activeFloor = '' this.$refs.addDialog.activeRoom = ''
this.$refs.addDialog.activeRoom = '' this.dialogVisible = false
this.dialogVisible = false }
} })
}) }
}
}, },
onLoad(page, params = {}) { onLoad(page, params = {}) {

Loading…
Cancel
Save