123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <template>
- <HcTable ui="no-border" is-new :column="tableColumn" :datas="tableData" :loading="tableLoading" :is-index="false">
- <template #integrality="{ row }">
- <div v-if="row.isEdit" class="table-score-input-box">
- <el-input-number v-model="row.integrality" placeholder="" :controls="false" style="width: 100%;" :precision="0" />
- </div>
- <span v-else>{{ row.integrality || '-' }}</span>
- </template>
- <template #integralityDeduction="{ row }">
- <div v-if="row.isEdit" class="table-score-input-box">
- <el-input-number v-model="row.integralityDeduction" placeholder="" :controls="false" style="width: 100%;" :precision="0" />
- </div>
- <span v-else>{{ row.integralityDeduction || '-' }}</span>
- </template>
- <template #normativeDeduction="{ row }">
- <div v-if="row.isEdit" class="table-score-input-box">
- <el-input-number v-model="row.normativeDeduction" placeholder="" :controls="false" style="width: 100%;" :precision="0" />
- </div>
- <span v-else>{{ row.normativeDeduction || '-' }}</span>
- </template>
- <template #normative="{ row }">
- <div v-if="row.isEdit" class="table-score-input-box">
- <el-input-number v-model="row.normative" placeholder="" :controls="false" style="width: 100%;" :precision="0" />
- </div>
- <span v-else>{{ row.normative || '-' }}</span>
- </template>
- <template #action="{ row }">
- <el-button v-if="row.isEdit" type="success" size="small" @click="saveClick(row)">
- 保存
- </el-button>
- <el-button v-else type="primary" size="small" @click="editClick(row)">
- 编辑
- </el-button>
- </template>
- </HcTable>
- </template>
- <script setup>
- import { onActivated, ref, watch } from 'vue'
- import { getArrValue } from 'js-fast-way'
- import writeApi from '~api/transfer/write-conclusion'
- //参数
- const props = defineProps({
- projectId: {
- type: [String, Number],
- default: '',
- },
- contractId: {
- type: [String, Number],
- default: '',
- },
- type: {
- type: [String, Number],
- default: '',
- },
- })
- //变量
- const projectId = ref(props.projectId)
- const contractId = ref(props.contractId)
- const typeId = ref(props.type)
- //监听
- watch(() => [
- props.type,
- ], ([type]) => {
- typeId.value = type
- getTotalData()
- })
- //渲染完成
- onActivated(() => {
- getTotalData()
- })
- //表格数据
- const tableColumn = ref([
- { key:'scoreItem', name: '项目' },
- { key:'integrality', name: '完整性', width: 80, align: 'center' },
- { key:'integralityDeduction', name: '扣分', width: 80, align: 'center' },
- { key:'normative', name: '规范性', width: 80, align: 'center' },
- { key:'normativeDeduction', name: '扣分', width: 80, align: 'center' },
- { key:'action', name: '操作', width: 80, align: 'center' },
- ])
- const tableData = ref([
-
- ])
- const tableLoading = ref(false)
- const getTotalData = async ()=>{
- tableLoading.value = true
- const { error, code, data } = await writeApi.getItemByUnit({
- projectId: projectId.value,
- unitType:typeId.value,
- })
- tableLoading.value = false
- if (!error && code === 200) {
- tableData.value = getArrValue(data)
-
- } else {
- tableData.value = []
-
- }
- }
- //编辑
- const editClick = (row) => {
- row.isEdit = true
- }
- //保存
- const saveClick = async (row) => {
- const { error, code, msg } = await writeApi.updateExpertScore({
- ...row,
- })
- if (!error && code === 200) {
- window.$message.success(msg)
- row.isEdit = false
-
- }
- }
- </script>
- <style lang="scss" scoped>
- .table-score-input-box {
- position: relative;
- text-align: left;
- }
- </style>
|