From 7619d415522ab3dc3299d6a2a9f5c9964a692d3f Mon Sep 17 00:00:00 2001
From: 张诺 <zhang_12370@163.com>
Date: 星期三, 18 六月 2025 17:58:53 +0800
Subject: [PATCH] 添加生产管理接口及优化表格字段
---
src/views/basicInformation/mould/coalMeiZhiZiDuanWeiHu.vue | 69 ++++++++++++++++++++++++++--------
1 files changed, 52 insertions(+), 17 deletions(-)
diff --git a/src/views/basicInformation/mould/coalMeiZhiZiDuanWeiHu.vue b/src/views/basicInformation/mould/coalMeiZhiZiDuanWeiHu.vue
index 22d4448..c7de9c3 100644
--- a/src/views/basicInformation/mould/coalMeiZhiZiDuanWeiHu.vue
+++ b/src/views/basicInformation/mould/coalMeiZhiZiDuanWeiHu.vue
@@ -19,18 +19,17 @@
v-model="formData.fieldName"
placeholder="璇疯緭鍏ュ瓧娈靛悕绉�"
/>
+ </el-form-item> <el-form-item label="瀛楁鎻忚堪" prop="fieldDescription">
+ <el-input v-model="formData.fieldDescription" type="textarea" placeholder="璇疯緭鍏ュ瓧娈垫弿杩�" />
</el-form-item>
- <el-form-item label="Activity form" props="dielDescription">
- <el-input v-model="formData.fieldDescription" type="textarea" placeholder="璇疯緭鍏ュ瓧娈垫弿杩�" />
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="submitForm"> 纭畾 </el-button>
+ <el-form-item class="dialog-footer">
<el-button v-if="addOrEdit === 'edit'" @click="resetForm"
>閲嶇疆</el-button
>
<el-button v-if="addOrEdit === 'add'" @click="cancelForm"
>鍙栨秷</el-button
>
+ <el-button type="primary" @click="submitForm"> 纭畾 </el-button>
</el-form-item>
</el-form>
</el-dialog>
@@ -38,13 +37,9 @@
</template>
<script setup>
-import { ref, watch, defineProps, onMounted } from "vue";
-import addressList from "@/api/jsonApi/areaList.json";
+import { ref, reactive, watch, defineProps } from "vue";
+import { addOrEditCoalField } from "@/api/basicInformation/coalFieldMaintenance.js";
const props = defineProps({
- beforeClose: {
- type: Function,
- default: () => {},
- },
form: {
type: Object,
default: () => ({}),
@@ -58,10 +53,20 @@
default: "",
},
});
-
+const copyForm = defineModel("copyForm", {
+ required: true,
+ type: Object,
+});
+// 琛ㄥ崟寮曠敤
+const formRef = ref();
const emit = defineEmits(["submit", "handleBeforeClose"]);
// 琛ㄥ崟鏁版嵁
const formData = ref({ ...props.form });
+
+// 鐩戝惉props.form鐨勫彉鍖栵紝鏇存柊formData
+watch(() => props.form, (newForm) => {
+ formData.value = { ...newForm };
+}, { deep: true, immediate: true });
// 寮圭獥鍙鎬�
const dialogVisible = defineModel("coalMaintenanceFieldDialogVisible", {
required: true,
@@ -72,6 +77,30 @@
if (!formRef.value) return;
await formRef.value.validate(async (valid, fields) => {
if (valid) {
+ const obj = ref({});
+
+ console.log("鎻愪氦琛ㄥ崟", formData.value);
+ if (props.title.includes('鏂板')) {
+ let result = await addOrEditCoalField(
+ {...formData.value}
+ ,)
+ console.log(result);
+ obj.value = {
+ title: "鏂板",
+ ...formData.value,
+ result
+ };
+ } else {
+ let result = await addOrEditCoalField({
+ ...formData.value,
+ })
+ obj.value = {
+ title: "缂栬緫",
+ ...formData.value,
+ result
+ };
+ }
+ emit("submit", obj.value);
}
});
};
@@ -82,9 +111,9 @@
};
// 閲嶇疆琛ㄥ崟
const resetForm = () => {
-
-
-};
+ if (!formRef.value) return
+ formData.value = JSON.parse(JSON.stringify(copyForm.value));
+}
// 鍏抽棴寮圭獥
const handleClose = () => {
// 瑙﹀彂鐖剁粍浠剁殑鍏抽棴鍑芥暟
@@ -92,10 +121,16 @@
emit("update:coalMaintenanceFieldDialogVisible", false);
};
const rules = reactive({
- coal: [
+ fieldName: [
{ required: true, message: "璇疯緭鍏ョ叅绉嶅悕绉�", trigger: "blur" },
],
});
</script>
-<style lang="sass" scoped>
+<style lang="scss" scoped>
+.dialog-footer {
+ display: flex;
+ justify-content: flex-end;
+ margin-top: 20px;
+ flex-direction: column;
+}
</style>
\ No newline at end of file
--
Gitblit v1.9.3