diff --git a/src/views/device/item/index.vue b/src/views/device/item/index.vue
index 0de342ac..a7ce3363 100644
--- a/src/views/device/item/index.vue
+++ b/src/views/device/item/index.vue
@@ -178,17 +178,17 @@
>删除
-
- 导出
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -196,30 +196,30 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
+
{{ parseTime(scope.row.createdTime, '{y}-{m}-{d}') }}
-
-
+
+
{{ parseTime(scope.row.updatedTime, '{y}-{m}-{d}') }}
-
-
+
+
-
+
@@ -261,7 +261,7 @@
-
+
-
+
@@ -294,12 +294,12 @@
-
+
-
+
删除
添加
@@ -308,27 +308,27 @@
-
+
-
+
-
+
-
+
-
+
删除
添加
@@ -442,14 +442,7 @@ export default {
formStandard: [],
},
// 表单校验
- rules: {
- itemName: [
- {required: true, message: "检查项名称不能为空", trigger: "blur"}
- ],
- itemMethod: [
- {required: true, message: "检查项方法/工具不能为空", trigger: "blur"}
- ],
- }
+ rules: {}
};
},
created() {
@@ -458,7 +451,13 @@ export default {
methods: {
// 动态增加表单
addStandard() {
- this.formStandard.push({standardType: 'qualitative', standardName: null, detailUpLimit: null, detailDownLimit: null, detailUnit: null,})
+ this.formStandard.push({
+ standardType: 'qualitative',
+ standardName: null,
+ detailUpLimit: null,
+ detailDownLimit: null,
+ detailUnit: null,
+ })
},
// 动态删除表单
removeStandard(index) {
@@ -535,30 +534,94 @@ export default {
},
/** 修改按钮操作 */
handleUpdate(row) {
- console.log("这里这里")
this.reset();
const itemId = row.itemId || this.ids
getItem(itemId).then(response => {
this.form = response.data;
- console.log(response.data)
+ this.formStandard = response.data.formStandard;
this.open = true;
this.title = "修改检查项";
});
},
/** 提交按钮 */
submitForm() {
+ // 数据校验
+ if (this.form.itemName == null) {
+ this.$message({
+ message: "请输入检查项!",
+ type: "warning"
+ })
+ return
+ }
+ if (this.form.itemType == null) {
+ this.$message({
+ message: "请选择维护类型!",
+ type: "warning"
+ })
+ return
+ }
+ if (this.form.itemMethod == null) {
+ this.$message({
+ message: "请输入检查方法/工具!",
+ type: "warning"
+ })
+ return
+ }
+ for (let i = 0; i < this.formStandard.length; i++) {
+ // 如果为定性
+ if (this.formStandard[i].standardType == 'qualitative') {
+ if (this.formStandard[i].standardName == null) {
+ this.$message({
+ message: "请输入标准名称!",
+ type: "warning"
+ })
+ return
+ }
+ }
+ // 如果为定量
+ if (this.formStandard[i].standardType == 'quantify') {
+ if (this.formStandard[i].standardName == null) {
+ this.$message({
+ message: "请输入标准名称!",
+ type: "warning"
+ })
+ return
+ }
+ if (this.formStandard[i].detailUpLimit == null) {
+ this.$message({
+ message: "请输入上限!",
+ type: "warning"
+ })
+ return
+ }
+ if (this.formStandard[i].detailDownLimit == null) {
+ this.$message({
+ message: "请输入下限!",
+ type: "warning"
+ })
+ return
+ }
+ if (this.formStandard[i].detailUnit == null) {
+ this.$message({
+ message: "请输入单位!",
+ type: "warning"
+ })
+ return
+ }
+ }
+ }
+
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.itemId != null) {
+ this.form.formStandard = this.formStandard;
updateItem(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
- console.log("这里是新增数据")
this.form.formStandard = this.formStandard;
- console.log(this.form)
addItem(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
@@ -592,4 +655,7 @@ export default {
.my-select-input {
width: 130px;
}
+.my-dynamic-btn{
+ margin-left: 10px;
+}