|
@@ -7,17 +7,26 @@ import { useRouter } from "vue-router";
|
|
|
import { Edit } from "@element-plus/icons-vue";
|
|
|
import { ElMessageBox, ElMessage } from "element-plus";
|
|
|
import editMould from "./editMould.vue";
|
|
|
+import settingIndexDrawer from "./settingIndexDrawer.vue";
|
|
|
+import importIndex from "./importIndex.vue";
|
|
|
const router = useRouter();
|
|
|
+const formRef = ref();
|
|
|
const active = ref(0);
|
|
|
const editDrawer = ref();
|
|
|
const editDrawerShow = ref(false);
|
|
|
+// 指标设置
|
|
|
+const settingIndexDrawerRef = ref();
|
|
|
+const settingIndexDrawerShow = ref(false);
|
|
|
+// 导入指标
|
|
|
+const importIndexRef = ref();
|
|
|
+const importIndexShow = ref(false);
|
|
|
const handleSelect = index => {
|
|
|
// console.log(index);
|
|
|
active.value = index;
|
|
|
};
|
|
|
const tepName = ref();
|
|
|
const tepNameForm = reactive({
|
|
|
- name: "张三"
|
|
|
+ name: ""
|
|
|
});
|
|
|
const backChange = () => {
|
|
|
router.back();
|
|
@@ -80,11 +89,43 @@ const tableData = ref([
|
|
|
zip: "CA 90036"
|
|
|
}
|
|
|
]);
|
|
|
-const save = () => {
|
|
|
- if (active.value++ > 2) active.value = 0;
|
|
|
+const save = formEl => {
|
|
|
+ console.log(formEl);
|
|
|
+ formEl.validate(valid => {
|
|
|
+ console.log(valid);
|
|
|
+ if (valid) {
|
|
|
+ console.log("submit!");
|
|
|
+ } else {
|
|
|
+ console.log("error submit!");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (active.value++ > 2) {
|
|
|
+ active.value = 0;
|
|
|
+ }
|
|
|
};
|
|
|
const deleteRow = row => {
|
|
|
console.log(row);
|
|
|
+ ElMessageBox.confirm(
|
|
|
+ "指标删除后不可恢复,请谨慎操作!",
|
|
|
+ "确定删除该指标吗?",
|
|
|
+ {
|
|
|
+ confirmButtonText: "确认",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(() => {
|
|
|
+ ElMessage({
|
|
|
+ type: "success",
|
|
|
+ message: "删除成功"
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ ElMessage({
|
|
|
+ type: "info",
|
|
|
+ message: "用户取消"
|
|
|
+ });
|
|
|
+ });
|
|
|
};
|
|
|
// 编辑
|
|
|
const editPen = row => {
|
|
@@ -114,10 +155,26 @@ const deletePen = row => {
|
|
|
});
|
|
|
});
|
|
|
};
|
|
|
+const settingIndex = row => {
|
|
|
+ console.log(row);
|
|
|
+ settingIndexDrawerRef.value.open();
|
|
|
+};
|
|
|
+const importIndexDialog = row => {
|
|
|
+ console.log(row);
|
|
|
+ importIndexRef.value.open();
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div class="w-[100%]">
|
|
|
+ <!-- 导入指标 -->
|
|
|
+ <importIndex ref="importIndexRef" v-model="importIndexShow" />
|
|
|
+ <!-- 指标设置 -->
|
|
|
+ <settingIndexDrawer
|
|
|
+ ref="settingIndexDrawerRef"
|
|
|
+ v-model:drawerValue="settingIndexDrawerShow"
|
|
|
+ />
|
|
|
+ <!-- 编辑模块 -->
|
|
|
<editMould ref="editDrawer" v-model:drawerValue="editDrawerShow" />
|
|
|
<div class="w-[100%] flex justify-evenly">
|
|
|
<div class="left-box">
|
|
@@ -149,19 +206,22 @@ const deletePen = row => {
|
|
|
</el-steps>
|
|
|
</div>
|
|
|
<div class="right-box">
|
|
|
- <el-button type="primary" class="mr-2" @click="save">保存</el-button>
|
|
|
+ <el-button type="primary" class="mr-2" @click="save(formRef)"
|
|
|
+ >保存</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="mt-2">
|
|
|
<div v-if="active == 0" class="w-[40%] m-auto mt-10">
|
|
|
<el-form
|
|
|
+ ref="formRef"
|
|
|
:model="tepNameForm"
|
|
|
label-width="auto"
|
|
|
style="max-width: 600px"
|
|
|
>
|
|
|
<el-form-item
|
|
|
- label="模板名称"
|
|
|
prop="name"
|
|
|
+ label="模板名称"
|
|
|
:rules="[
|
|
|
{
|
|
|
required: true,
|
|
@@ -202,16 +262,20 @@ const deletePen = row => {
|
|
|
<el-table-column prop="zip" label="目标值" width="120" />
|
|
|
<el-table-column fixed="right" label="操作">
|
|
|
<template #default="{ row }">
|
|
|
- <el-icon class="mr-3"><Setting /></el-icon>
|
|
|
- <el-icon @click="deleteRow(row)"
|
|
|
- ><Delete class="text-red-500"
|
|
|
+ <el-icon class="mr-3" @click="settingIndex(row)"
|
|
|
+ ><Setting
|
|
|
/></el-icon>
|
|
|
+ <el-icon @click="deleteRow(row)">
|
|
|
+ <Delete class="text-red-500" />
|
|
|
+ </el-icon>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<template #footer>
|
|
|
<el-button type="primary" link class="mr-4"> 添加指标 </el-button>
|
|
|
- <el-button type="primary" link> 导入指标 </el-button>
|
|
|
+ <el-button type="primary" link @click="importIndexDialog">
|
|
|
+ 导入指标
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</el-card>
|
|
|
</div>
|