|
@@ -93,7 +93,7 @@
|
|
|
<template #default="scope">
|
|
|
{{
|
|
|
detection_status.filter(
|
|
|
- (i) => i.value === scope.row.status + ""
|
|
|
+ (i) => i.value.toString() === scope.row.status.toString()
|
|
|
)[0]?.label ?? "-"
|
|
|
}}
|
|
|
</template>
|
|
@@ -102,11 +102,23 @@
|
|
|
<template #default="scope">
|
|
|
{{
|
|
|
detection_type.filter(
|
|
|
- (i) => i.value === scope.row.status + ""
|
|
|
+ (i) => i.value.toString() === scope.row.detectionType.toString()
|
|
|
)[0]?.label ?? "-"
|
|
|
}}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column prop="address" label="操作">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button text size="small" @click.stop="edittask(scope.row)"
|
|
|
+ >修改
|
|
|
+ </el-button>
|
|
|
+ <el-popconfirm title="确定删除?" @confirm="deltask(scope.row)">
|
|
|
+ <template #reference>
|
|
|
+ <el-button text size="small" @click.stop="">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-popconfirm>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
|
|
|
<!-- <el-table-column prop="ext1" label="责任人" width="180">
|
|
|
<template #default="scope">
|
|
@@ -172,7 +184,7 @@
|
|
|
<el-option
|
|
|
v-for="item in detection_type"
|
|
|
:label="item.label"
|
|
|
- :value="item.value"
|
|
|
+ :value="parseInt(item.value)"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -273,6 +285,7 @@ import { treeselect as deptTreeselect } from "@/api/system/dept";
|
|
|
import { cloneDeep } from "lodash";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
import { useRoute } from "vue-router";
|
|
|
+import { delDetection, updateDetection } from "../../../api/system/detection";
|
|
|
|
|
|
const { detection_status, detection_type } = useDict(
|
|
|
"detection_status",
|
|
@@ -314,6 +327,7 @@ const initadd = () => {
|
|
|
detectionYear: "",
|
|
|
ext1: "",
|
|
|
ext2: "",
|
|
|
+ id:null,
|
|
|
facilitiesId: 1,
|
|
|
remark: null,
|
|
|
status: 1,
|
|
@@ -332,16 +346,31 @@ const tblrowclick = (row) => {
|
|
|
};
|
|
|
|
|
|
const onadd = () => {
|
|
|
+ loading.value = true;
|
|
|
+ if (detectioninfo.value.id == null) {
|
|
|
+
|
|
|
+ var detectioninfoobj = cloneDeep(detectioninfo.value);
|
|
|
+ // delete detectioninfoobj.detectionDept;
|
|
|
+ detectioninfoobj.detectionDept = (detectioninfo.value.detectionDept instanceof Array) ? detectioninfo.value.detectionDept.join(",") : '';
|
|
|
+ addDetection(detectioninfoobj).then(res => {
|
|
|
+ loading.value = false;
|
|
|
+ showadd.value = false;
|
|
|
+ getList();
|
|
|
+ })
|
|
|
+
|
|
|
+ } else {
|
|
|
+ var detectioninfoobj = cloneDeep(detectioninfo.value);
|
|
|
+ // delete detectioninfoobj.detectionDept;
|
|
|
+ detectioninfoobj.detectionDept = (detectioninfo.value.detectionDept instanceof Array) ? detectioninfo.value.detectionDept.join(",") : '';
|
|
|
+ updateDetection(detectioninfoobj).then(res => {
|
|
|
+ loading.value = false;
|
|
|
+ showadd.value = false;
|
|
|
+ getList();
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- loading.value = true;
|
|
|
- var detectioninfoobj = cloneDeep(detectioninfo.value);
|
|
|
- // delete detectioninfoobj.detectionDept;
|
|
|
- detectioninfoobj.detectionDept = (detectioninfo.value.detectionDept instanceof Array) ? detectioninfo.value.detectionDept.join(","):'';
|
|
|
- addDetection(detectioninfoobj).then(res => {
|
|
|
- loading.value = false;
|
|
|
- showadd.value = false;
|
|
|
- getList();
|
|
|
- })
|
|
|
|
|
|
};
|
|
|
|
|
@@ -381,6 +410,23 @@ const getmonth = () => {
|
|
|
return months;
|
|
|
};
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+const edittask = (row) => {
|
|
|
+ detectioninfo.value = cloneDeep(row);
|
|
|
+ if (detectioninfo.value.detectionDept!=null && detectioninfo.value.detectionDept!="" && detectioninfo.value.detectionDept!=undefined && !Array.isArray(detectioninfo.value.detectionDept)) {
|
|
|
+ detectioninfo.value.detectionDept = detectioninfo.value.detectionDept.split(",").map(i => parseInt(i));
|
|
|
+ }
|
|
|
+ showadd.value = true;
|
|
|
+};
|
|
|
+const deltask = (row) => {
|
|
|
+ delDetection(row.id).then((res) => {
|
|
|
+ ElMessage.success("删除成功");
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
onMounted(() => {});
|
|
|
function setdatakey(dept) {
|
|
|
if (dept.children) {
|