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.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.ordinaryConfirm && row.status == 201" @click="reciveOrder(row)">确认</el-button>
@ -309,7 +309,7 @@
</div>
</template>
</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">
<el-select @change="((val) => { changeProduct(val, scope.$index) })"
@blur="((val) => { changeProduct(val, scope.$index) })" v-loadmore="loadmoreProduct"

@ -208,7 +208,7 @@
</el-table-column>
<el-table-column label="巡检周期" prop="period">
<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"
:value="item.dictKey"></el-option>
</el-select>

@ -160,480 +160,468 @@ export default {
headers: {},
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 = []
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)
},
watch: {
detailForm(newVal, oldVal) {
if (JSON.stringify(newVal) != '{}') {
console.log('JSON.stringify(newVal)---------------------->',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 = []
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 = []
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 {
},
created() {
this.deviceList = []
this.imgList = []
this.filesList = []
this.drawList = []
this.drawfiles = []
// this.getDeviceData()
getChildList(1, 100, '1858710780677984257').then(res => {
this.periodArr = res.data.data
this.periodArr = res.data.data
})
this.headers = {
"Authorization": `Basic ${Base64.encode(`${website.clientId}:${website.clientSecret}`)}`,
'Blade-Auth': 'bearer ' + getToken(),
'Blade-Requested-With': 'BladeHttpRequest'
"Authorization": `Basic ${Base64.encode(`${website.clientId}:${website.clientSecret}`)}`,
'Blade-Auth': 'bearer ' + getToken(),
'Blade-Requested-With': 'BladeHttpRequest'
}
}
}
},
created() {
this.deviceList = []
// 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 = []
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.imgList = []
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.detailForm.deptId && this.changeUnit(this.detailForm.deptId)
},
handleSuccess(response, file, fileList) {
if (response.code == 200) {
this.filesList.push({
url: response.data.link, //url
name: response.data.originalName, //
})
}
},
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.attaches && this.detailForm.attaches.length != 0 && this.detailForm.attaches.map(item => {
this.imgList.push({
name: item.name,
url: item.link
})
this.filesList.push({
name: item.name,
url: item.link
})
})
})
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
}
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 {
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)
this.drawList = []
this.drawfiles = []
this.imgList = []
this.filesList = []
this.addForm = {}
}
})
},
//
changeUnit(val) {
console.log('val===========>', val)
console.log('unitData===============>', this.unitData)
this.labId = val
if (this.title == '新建') {
this.addForm.unitName = this.unitData.length > 0 ? this.unitData.find(item => item.id == val).title : ''
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
methods: {
getDeepCode(data, arr) {
data && data.length != 0 && data.map(item => {
if (item.details.length != 0) {
this.getDeepCode(item.details, arr)
} else {
arr.push(item)
}
})
})
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.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
return arr
},
handleSuccess(response, file, fileList) {
if (response.code == 200) {
this.filesList.push({
url: response.data.link, //url
name: response.data.originalName, //
})
}
})
})
this.spanArr = []
this.pos = 0
this.getSpanArr(this.addForm.tableData)
})
},
clickFloor(val) {
this.activeFloor = val.id
this.dealFloor(val.id)
},
clickRoom(val) {
console.log('val1------------->', val)
console.log('title------------->', this.title)
if (val) {
this.activeRoom = val.id
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)
},
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.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.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.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
}
})
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
// }
// })
this.spanArr = []
this.pos = 0
this.getSpanArr(this.addForm.tableData)
})
console.log('this.addForm.tableData', this.addForm.tableData)
this.$forceUpdate();
this.spanArr = []
this.pos = 0
this.getSpanArr(this.addForm.tableData)
})
}
}
},
}
},
clickFloor(val) {
this.activeFloor = val.id
this.dealFloor(val.id)
},
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>

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

Loading…
Cancel
Save