<style scoped>
|
.plan {
|
width: 100%;
|
}
|
|
.title {
|
height: 60px;
|
width: calc(100% - 20px);
|
background-color: white;
|
margin: 5px 10px;
|
display: flex;
|
align-items: center;
|
padding: 0 30px;
|
}
|
|
.thing {
|
margin: 10px;
|
padding: 15px;
|
background-color: white;
|
height: calc(100vh - 15vh);
|
overflow-y: auto;
|
}
|
|
.order_num{
|
border-radius: 1rem;
|
width: 35px;
|
height: 25px;
|
text-align: center;
|
margin-right: 8px;
|
}
|
</style>
|
<style>
|
.plan .has-gutter tr th {
|
background-color: #f5f7fa !important;
|
color: #333;
|
}
|
|
.plan .cell {
|
color: #333;
|
display: flex;
|
}
|
</style>
|
|
<template>
|
<div class="plan">
|
<div class="title">
|
<span>项目名称:</span>
|
<el-input v-model="search.name" size="medium" style="width: 200px;margin-right: 20px;"></el-input>
|
<span>检验时间:</span>
|
<el-date-picker v-model="search.date" type="daterange" range-separator="至" start-placeholder="开始日期"
|
end-placeholder="结束日期" size="medium" style="margin-right: 20px;">
|
</el-date-picker>
|
<span>检验人:</span>
|
<el-input v-model="search.userName" size="medium" style="width: 200px;margin-right: 20px;"></el-input>
|
<el-button size="small" type="primary">查询</el-button>
|
<el-button size="small">重置</el-button>
|
</div>
|
<div class="thing">
|
<el-table :data="tableData" style="width: 100%;" row-key="id" default-expand-all
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}" :key="upIndex">
|
<el-table-column type="index" width="50" label="序号">
|
</el-table-column>
|
<el-table-column prop="date" label="申请单号">
|
<template slot-scope="scope">
|
<div style="display: flex;">
|
<div v-if="scope.row.code=='01'" style="color: #3caaff;background-color: #eff5ff;" class="order_num">01</div>
|
<div v-else-if="scope.row.code=='02'" style="color: #57c981;background-color: #f1fbf4;" class="order_num">02</div>
|
<div v-else-if="scope.row.code=='03'" style="color: #dfa8fb;background-color: #faf2ff;" class="order_num">03</div>
|
<div>{{scope.row.date}}</div>
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column prop="name" label="检验结果">
|
</el-table-column>
|
<el-table-column prop="address" label="地址">
|
</el-table-column>
|
<el-table-column label="操作" width="80">
|
<template slot-scope="scope">
|
<el-button size="mini" type="primary" v-if="isIfReport(scope.row)">上报</el-button>
|
<el-button size="mini" type="warning" @click="openUpDia(scope.row)"
|
v-else-if="scope.row.code=='03'&&scope.row.insId==undefined&&scope.row.address==null">分配</el-button>
|
<el-button size="mini" type="success" @click="openUpInsDia(scope.row)"
|
v-else-if="scope.row.code=='03'&&scope.row.insId==undefined&&scope.row.name==null">检验</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
<el-dialog title="分配设备和人员" :visible.sync="upDia" width="500px" top="30vh">
|
<div class="body">
|
<el-row style="line-height: 46px;">
|
<el-col :span="4" style="font-size: 14px;text-align: right;">人员:</el-col>
|
<el-col :span="16" :offset="1">
|
<el-input v-model="upData.address" size="small" clearable></el-input>
|
</el-col>
|
</el-row>
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<el-button type="primary" @click="submitUpData">确 定</el-button>
|
<el-button @click="upDia = false">取 消</el-button>
|
</span>
|
</el-dialog>
|
<el-dialog title="检验" :visible.sync="upInsDia" width="500px">
|
<div class="body" style="max-height: 50vh;overflow-y: auto;">
|
<el-row style="line-height: 46px;">
|
<el-col :span="4" style="font-size: 14px;text-align: right;">样品编码:</el-col>
|
<el-col :span="8">{{upData.date}}</el-col>
|
<el-col :span="4" style="font-size: 14px;text-align: right;">样品名称:</el-col>
|
<el-col :span="8">{{upData.date}}</el-col>
|
</el-row>
|
<el-row style="line-height: 46px;">
|
<el-col :span="4" style="font-size: 14px;text-align: right;">检验项目:</el-col>
|
<el-col :span="8">{{upData.date}}</el-col>
|
<el-col :span="4" style="font-size: 14px;text-align: right;">单位:</el-col>
|
<el-col :span="8">{{upData.date}}</el-col>
|
</el-row>
|
<el-row style="line-height: 46px;">
|
<el-col :span="4" style="font-size: 14px;text-align: right;">标准值:</el-col>
|
<el-col :span="8">{{upData.date}}</el-col>
|
<el-col :span="4" style="font-size: 14px;text-align: right;">内控值:</el-col>
|
<el-col :span="8">{{upData.date}}</el-col>
|
</el-row>
|
<el-row style="line-height: 46px;">
|
<el-col style="text-align: right;"><el-button size="mini" @click="addRes">添加检验值</el-button></el-col>
|
</el-row>
|
<el-row>
|
<el-col>
|
<el-table :data="upData.res" border style="width: 99.9%;" :key="upIndex2">
|
<el-table-column type="index" width="100" label="序号">
|
</el-table-column>
|
<el-table-column label="检验值">
|
<template slot-scope="scope">
|
<el-input v-model.number="scope.row.number" size="small" clearable placeholder="请输入"
|
@change="(val)=>scope.row.number = isNaN(val)?null:val">
|
</el-input>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" width="60">
|
<template slot-scope="scope">
|
<el-button size="mini" type="text"
|
@click.native.prevent="deleteRow(scope.$index, upData.res)">删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-col>
|
</el-row>
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<el-button type="primary" @click="submitUpData">提 交</el-button>
|
<el-button @click="upInsDia = false">取 消</el-button>
|
</span>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
search: {
|
name: null,
|
date: [],
|
userName: null,
|
},
|
tableData: [{
|
id: 1,
|
insId: 123,
|
date: '2016-05-02',
|
name: null,
|
address: '上海市普陀区金沙江路 1518 弄',
|
children: [{
|
id: 33,
|
date: '2016-05-01',
|
name: null,
|
res: '[{"number": 1},{"number": 2}]',
|
address: '上海市普陀区金沙江路 1519 弄'
|
}, {
|
id: 34,
|
date: '2016-05-01',
|
name: null,
|
res: '[{"number": 1,"res": "不合格"},{"number": 3,"res": "不合格"}]',
|
address: '上海市普陀区金沙江路 1519 弄',
|
children: [{
|
id: 35,
|
date: 'hhh',
|
name: null,
|
res: '[{"number": 1},{"number": 2}]',
|
address: '上海市普陀区金沙江路 1519 弄'
|
}]
|
}]
|
}, {
|
id: 2,
|
insId: 123,
|
date: '2016-05-04',
|
name: null,
|
address: '上海市普陀区金沙江路 1517 弄',
|
children: []
|
}, {
|
id: 3,
|
insId: 123,
|
date: '2016-05-01',
|
children: [{
|
id: 31,
|
date: '2016-05-01',
|
name: null,
|
res: '[{"number": 1},{"number": 2}]',
|
address: '上海市普陀区金沙江路 1519 弄'
|
}, {
|
id: 32,
|
date: '2016-05-01',
|
name: null,
|
res: '[]',
|
address: null
|
}]
|
}],
|
upDia: false,
|
upData: {},
|
upIndex: 0,
|
upInsDia: false,
|
upIndex2: 0
|
}
|
},
|
mounted() {
|
this.selectDataList()
|
},
|
methods: {
|
selectDataList() {
|
this.tableData.forEach(a => {
|
a.code = '01'
|
if (a.children != undefined) {
|
a.children.forEach(b => {
|
b.code = '02'
|
if (b.children != undefined) {
|
b.children.forEach(c => {
|
c.code = '03'
|
c.res = JSON.parse(c.res)
|
})
|
}
|
})
|
}
|
})
|
this.upIndex++
|
},
|
isIfReport(row) {
|
var count = 0
|
if (row.children == undefined) return false
|
row.children.forEach(a => {
|
if (a.name != null && a.name != undefined) count++
|
})
|
return row.insId != undefined && count == row.children.length
|
},
|
openUpDia(row) {
|
this.upDia = true
|
this.upData = {
|
id: row.id,
|
address: row.address
|
}
|
},
|
submitUpData() {
|
this.tableData.forEach(a => {
|
a.children.forEach(b => {
|
if (b.id == this.upData.id) {
|
b.address = this.upData.address
|
}
|
})
|
})
|
this.$message.success('修改成功')
|
this.upIndex++
|
this.upDia = false
|
},
|
openUpInsDia(row) {
|
this.upInsDia = true
|
this.upData = this.HaveJson(row)
|
},
|
deleteRow(index, rows) {
|
rows.splice(index, 1);
|
},
|
addRes() {
|
this.upData.res.push({
|
"number": null
|
})
|
this.upIndex2++
|
}
|
}
|
}
|
</script>
|