<template>
|
<tr class="m-color b-font required" style="text-align: center">主要危险源或有害因素</tr>
|
<tr>
|
<td class="w-16 m-color">序号</td>
|
<td class="w-16 m-color">危险源或有害因素</td>
|
<td class="w-16 m-color">危险特性</td>
|
<td class="w-16 m-color">数量</td>
|
<td class="w-16 m-color">其他说明</td>
|
<td class="w-16 m-color">操作</td>
|
</tr>
|
<tr v-for="(item,index) in dangerSourceState.dangerList" :key="index">
|
<td class="w-16">
|
{{ index + 1 }}
|
</td>
|
<td class="w-16">
|
<el-input :disabled="dangerSourceState.disabled" v-model="item.riskSource"></el-input>
|
</td>
|
<td class="w-16">
|
<el-input :disabled="dangerSourceState.disabled" v-model="item.riskCharacteristic"></el-input>
|
</td>
|
<td class="w-16">
|
<el-input :disabled="dangerSourceState.disabled" type="number" v-model="item.number"></el-input>
|
</td>
|
<td class="w-16">
|
<el-input :disabled="dangerSourceState.disabled" v-model="item.description"></el-input>
|
</td>
|
<td class="w-16">
|
<el-button :disabled="dangerSourceState.disabled" type="danger" @click="deleteDangerItem(index)">删除</el-button>
|
</td>
|
</tr>
|
<tr style="text-align: center">
|
<el-button :disabled="dangerSourceState.disabled" type="primary" shape="round" @click="addDangerItem()">
|
添加行
|
</el-button>
|
</tr>
|
</template>
|
|
<script setup lang="ts">
|
import {reactive, watchEffect} from "vue";
|
|
let props = defineProps({
|
disabled: Boolean,
|
data: Array<DangerListType>
|
});
|
|
const dangerSourceState = reactive<DangerSourceType>({
|
disabled: false,
|
dangerList: []
|
})
|
|
watchEffect(() => {
|
dangerSourceState.dangerList = props.data as Array<DangerListType>
|
dangerSourceState.disabled = props.disabled
|
});
|
|
const addDangerItem = () => {
|
console.log(dangerSourceState.dangerList,'list')
|
dangerSourceState.dangerList.push({riskSource: '', riskCharacteristic: '', number: null, description: ''});
|
};
|
|
const deleteDangerItem = (index: number) => {
|
dangerSourceState.dangerList.splice(index,1);
|
};
|
|
const formatList = (formatList: Array<DangerListType>) => {
|
dangerSourceState.dangerList = formatList
|
}
|
|
defineExpose({
|
dangerSourceState
|
});
|
|
</script>
|
|
<style scoped lang="scss">
|
.site-layout-background {
|
background: #fff;
|
}
|
|
.report-table {
|
width: 100%;
|
border-collapse: collapse;
|
border: 1px solid #337ecc;
|
margin: 20px 0;
|
|
th {
|
padding: 10px 0;
|
border: 1px solid #337ecc;
|
border-left: none;
|
}
|
|
tr {
|
width: 100%;
|
height: 44px;
|
line-height: 42px;
|
border-bottom: 1px solid #ccc;
|
|
&:last-of-type {
|
border-bottom: none;
|
}
|
&.required {
|
&::before {
|
content: "*";
|
display: inline-block;
|
color: red;
|
}
|
}
|
td {
|
border-right: 1px solid #ccc;
|
display: inline-block;
|
height: 44px;
|
vertical-align: middle;
|
text-align: center;
|
line-height: 42px;
|
|
&:last-of-type {
|
border-right: none;
|
}
|
|
&.required {
|
&::before {
|
content: "*";
|
display: inline-block;
|
color: red;
|
}
|
}
|
|
&.w-14 {
|
width: calc((100/7)/100 * 100%);
|
}
|
|
&.w-16 {
|
width: calc((100/6)/100 * 100%);
|
}
|
|
&.w-18 {
|
width: 16.59%;
|
}
|
|
&.w-20 {
|
width: 20%;
|
}
|
|
&.w-25 {
|
width: 25%;
|
}
|
|
&.w-50 {
|
width: 50%;
|
}
|
|
&.w-75 {
|
width: 75%;
|
}
|
|
.ant-input {
|
height: 100%;
|
border: none;
|
background: #f5f7fa;
|
}
|
|
.ant-picker {
|
width: 100%;
|
height: 100%;
|
}
|
}
|
}
|
|
.b-font {
|
font-size: 16px;
|
font-weight: bolder;
|
}
|
}
|
|
.m-color {
|
color: #0c4995;
|
}
|
:deep(.el-input__wrapper ){
|
box-shadow: none;
|
}
|
</style>
|