diff --git a/favicon.ico b/favicon.ico deleted file mode 100644 index b7d257b..0000000 --- a/favicon.ico +++ /dev/null Binary files differ diff --git a/favicon.ico b/favicon.ico deleted file mode 100644 index b7d257b..0000000 --- a/favicon.ico +++ /dev/null Binary files differ diff --git a/favicon1.ico b/favicon1.ico new file mode 100644 index 0000000..b7d257b --- /dev/null +++ b/favicon1.ico Binary files differ diff --git a/favicon.ico b/favicon.ico deleted file mode 100644 index b7d257b..0000000 --- a/favicon.ico +++ /dev/null Binary files differ diff --git a/favicon1.ico b/favicon1.ico new file mode 100644 index 0000000..b7d257b --- /dev/null +++ b/favicon1.ico Binary files differ diff --git a/index.html b/index.html index c801c4c..c98e3ff 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - + <%= title %> diff --git a/favicon.ico b/favicon.ico deleted file mode 100644 index b7d257b..0000000 --- a/favicon.ico +++ /dev/null Binary files differ diff --git a/favicon1.ico b/favicon1.ico new file mode 100644 index 0000000..b7d257b --- /dev/null +++ b/favicon1.ico Binary files differ diff --git a/index.html b/index.html index c801c4c..c98e3ff 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - + <%= title %> diff --git a/src/views/rule/grade/components/ruleTable.vue b/src/views/rule/grade/components/ruleTable.vue index 332328f..21395eb 100644 --- a/src/views/rule/grade/components/ruleTable.vue +++ b/src/views/rule/grade/components/ruleTable.vue @@ -30,6 +30,9 @@ }, ]) const list = ref([]) +// 获取等级评定下拉框 +const selectList = ref<{ id: string; value: string; name: string }[]>([]) +const selectListCopy = ref([]) // 检查数据列表 function checkCertificateList() { return useCheckList(list.value, columns.value, '等级评定规则表格') @@ -40,23 +43,34 @@ item.editable = false } } +const select = ref({}) // 双击行显示输入框 -const dblclickRow = (row: any) => { +const dblclickRow = (row: any, column: any) => { if ($route.path.includes('detail')) { return } + const select1 = selectList.value.filter(item => item.name === row.levelCodeName)[0] + if (select1.value) { + select.value = select1 + } setAllRowReadable() row.editable = true } // 添加行 const addRow = () => { + if (list.value.length >= selectList.value.length) { + ElMessage.warning(`最多添加${selectList.value.length}个`) + return + } if (checkCertificateList()) { setAllRowReadable() list.value.push({ - levelCodeName: '', + // levelCodeName: '', remarks: '', editable: true, + levelCode: '', }) + select.value = {} } } // 删除行 @@ -68,6 +82,7 @@ const initDialog = () => { list.value = $props.data } + watch(() => $props.data, (newVal) => { if (newVal) { list.value = newVal.map((item: any) => ({ ...item, levelCode: String(item.levelCode) })) @@ -76,17 +91,39 @@ deep: true, // immediate: true, }) + initDialog() defineExpose({ list, checkCertificateList, }) -// 获取等级评定下拉框 -const selectList = ref<{ id: string; value: string; name: string }[]>([]) + const fetchSelectList = () => { getDictByCode('level_code').then((res) => { selectList.value = res.data + selectListCopy.value = res.data }) } +watch(() => list.value, (newVal) => { + if (newVal) { + const already = newVal.filter(item => item.levelCode).map(item => String(item.levelCode)) + selectListCopy.value = selectList.value.filter(item => already.every(child => String(child) !== String(item.value))) + if (select.value.value) { + selectListCopy.value.push(select.value) + } + } +}, { + deep: true, +}) +// const select = (index: number) => { +// list.value[index].levelCodeName = selectList.value.filter(item => item.name == list.value[index].levelCode)[0].value +// } +const selectFocus = (value: string) => { + console.log(value, 'value') + if (value) { + console.log(selectList.value.filter(item => value == String(item.value))) + selectListCopy.value.push(selectList.value.filter(item => value == String(item.value))[0]) + } +} fetchSelectList() @@ -113,9 +150,12 @@ {{ scope.row[item.value] }} - + + + + diff --git a/favicon.ico b/favicon.ico deleted file mode 100644 index b7d257b..0000000 --- a/favicon.ico +++ /dev/null Binary files differ diff --git a/favicon1.ico b/favicon1.ico new file mode 100644 index 0000000..b7d257b --- /dev/null +++ b/favicon1.ico Binary files differ diff --git a/index.html b/index.html index c801c4c..c98e3ff 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - + <%= title %> diff --git a/src/views/rule/grade/components/ruleTable.vue b/src/views/rule/grade/components/ruleTable.vue index 332328f..21395eb 100644 --- a/src/views/rule/grade/components/ruleTable.vue +++ b/src/views/rule/grade/components/ruleTable.vue @@ -30,6 +30,9 @@ }, ]) const list = ref([]) +// 获取等级评定下拉框 +const selectList = ref<{ id: string; value: string; name: string }[]>([]) +const selectListCopy = ref([]) // 检查数据列表 function checkCertificateList() { return useCheckList(list.value, columns.value, '等级评定规则表格') @@ -40,23 +43,34 @@ item.editable = false } } +const select = ref({}) // 双击行显示输入框 -const dblclickRow = (row: any) => { +const dblclickRow = (row: any, column: any) => { if ($route.path.includes('detail')) { return } + const select1 = selectList.value.filter(item => item.name === row.levelCodeName)[0] + if (select1.value) { + select.value = select1 + } setAllRowReadable() row.editable = true } // 添加行 const addRow = () => { + if (list.value.length >= selectList.value.length) { + ElMessage.warning(`最多添加${selectList.value.length}个`) + return + } if (checkCertificateList()) { setAllRowReadable() list.value.push({ - levelCodeName: '', + // levelCodeName: '', remarks: '', editable: true, + levelCode: '', }) + select.value = {} } } // 删除行 @@ -68,6 +82,7 @@ const initDialog = () => { list.value = $props.data } + watch(() => $props.data, (newVal) => { if (newVal) { list.value = newVal.map((item: any) => ({ ...item, levelCode: String(item.levelCode) })) @@ -76,17 +91,39 @@ deep: true, // immediate: true, }) + initDialog() defineExpose({ list, checkCertificateList, }) -// 获取等级评定下拉框 -const selectList = ref<{ id: string; value: string; name: string }[]>([]) + const fetchSelectList = () => { getDictByCode('level_code').then((res) => { selectList.value = res.data + selectListCopy.value = res.data }) } +watch(() => list.value, (newVal) => { + if (newVal) { + const already = newVal.filter(item => item.levelCode).map(item => String(item.levelCode)) + selectListCopy.value = selectList.value.filter(item => already.every(child => String(child) !== String(item.value))) + if (select.value.value) { + selectListCopy.value.push(select.value) + } + } +}, { + deep: true, +}) +// const select = (index: number) => { +// list.value[index].levelCodeName = selectList.value.filter(item => item.name == list.value[index].levelCode)[0].value +// } +const selectFocus = (value: string) => { + console.log(value, 'value') + if (value) { + console.log(selectList.value.filter(item => value == String(item.value))) + selectListCopy.value.push(selectList.value.filter(item => value == String(item.value))[0]) + } +} fetchSelectList() @@ -113,9 +150,12 @@ {{ scope.row[item.value] }} - + + + + diff --git a/src/views/rule/proxy/components/edit.vue b/src/views/rule/proxy/components/edit.vue index 6c83c6e..c4d553f 100644 --- a/src/views/rule/proxy/components/edit.vue +++ b/src/views/rule/proxy/components/edit.vue @@ -39,6 +39,7 @@ ruleDesc: '', fileName: '', }) +const historyScore = ref('') // 表单验证规则 const rules = ref({ quotaProject: [{ required: true, message: '考核指标项目必选', trigger: ['blur', 'change'] }], @@ -60,13 +61,33 @@ } }) watch(() => ruleForm.value.valType, (newVal) => { + console.log(ruleForm.value.valType, 'ruleForm.value.valType') if (newVal === '1' && !ruleForm.value.score.includes('-')) { - ruleForm.value.score = '' + if (historyScore.value.includes('-')) { + const score = historyScore.value.split('-') + score1.value = score[0] + score2.value = score[1] + ruleForm.value.score = historyScore.value + } + else { + ruleForm.value.score = '' + score1.value = '' + score2.value = '' + } } - else if ((newVal === '2' || newVal === '3') && ruleForm.value.score.includes('-')) { - score1.value = '' - score2.value = '' - ruleForm.value.score = '' + else if ((newVal === '2' || newVal === '3')) { + ruleForm.value.score = historyScore.value + if (historyScore.value.includes('-')) { + // // score1.value = '' + // // score2.value = '' + ruleForm.value.score = '' + } + else { + // // const score = historyScore.value.split('-') + // // score1.value = score[0] + // // score2.value = score[1] + ruleForm.value.score = historyScore.value + } } }) const fileRef = ref() // 文件上传input @@ -145,6 +166,7 @@ } onMounted(() => { dialogStatus.value = $route.params.type as string + console.log(JSON.parse($route.query.row as string), 'JSON.parse($route.query.row as string)') if (!$route.path.includes('create')) { const data = JSON.parse($route.query.row as string) for (const i in data) { @@ -157,7 +179,11 @@ score1.value = score[0] score2.value = score[1] } + historyScore.value = ruleForm.value.score } + // else { + // historyScore.value = '0-1' + // } }) // 指标项目下拉列表 const projectList = ref<{ id: string; value: string; name: string }[]>()