diff --git a/src/views/enm_base/material_form.vue b/src/views/enm_base/material_form.vue
index 0f056c2f..54a19a5b 100644
--- a/src/views/enm_base/material_form.vue
+++ b/src/views/enm_base/material_form.vue
@@ -1,174 +1,231 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 保存
- 取消
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+ //表单数据
+ form: defaultForm,
+ //验证规则
+ rules: {
+ name: [
+ { required: true, message: "请输入名称", trigger: "blur" },
+ ],
+ },
+ visible: false,
+ isSaveing: false,
+ options: [],
+ typeOptions: [
+ { label: "电/水/气", value: 0 },
+ { label: "成品", value: 10 },
+ { label: "半成品", value: 20 },
+ { label: "主要原料", value: 30 },
+ { label: "辅助材料", value: 40 },
+ { label: "加工工具", value: 50 },
+ { label: "辅助工装", value: 60 },
+ ],
+ processOptions: [],
+ setFiltersVisible: false,
+ };
+ },
+ mounted() {
+ this.getTestItem(); //获取部门
+ this.getProcessOptions();
+ },
+ methods: {
+ getTestItem() {
+ this.$API.qm.getTestItem.get({ page: 0 }).then((res) => {
+ this.options = res;
+ });
+ },
+ getProcessOptions() {
+ this.$API.mtm.process.list.req({ page: 0 }).then((res) => {
+ this.processOptions = res;
+ });
+ },
+ //显示
+ open(mode = "add") {
+ this.mode = mode;
+ this.visible = true;
+ return this;
+ },
+ //表单注入数据
+ setData(data) {
+ Object.assign(this.form, data);
+ },
+ //表单提交方法
+ submit() {
+ let that = this;
+ that.$refs.dialogForm.validate(async (valid) => {
+ if (valid) {
+ that.isSaveing = true;
+ if (that.mode === "add") {
+ that.$API.mtm.material.create
+ .req(that.form)
+ .then((res) => {
+ that.isSaveing = false;
+ that.$emit("success", that.form, that.mode);
+ that.visible = false;
+ that.$message.success("操作成功");
+ })
+ .catch((res) => {
+ that.isSaveing = false;
+ });
+ } else {
+ res = that.$API.mtm.material.update
+ .req(that.form.id, that.form)
+ .then((res) => {
+ that.isSaveing = false;
+ that.$emit("success", that.form, that.mode);
+ that.visible = false;
+ that.$message.success("操作成功");
+ })
+ .catch((res) => {
+ that.isSaveing = false;
+ });
+ }
+ }
+ });
+ },
+
+ //设置过滤项
+ setFilters(filters) {
+ this.selectionFilters = filters;
+ this.setFiltersVisible = true;
+ },
+ },
+};
+
+
+