cz 2 سال پیش
والد
کامیت
326fad4697

+ 342 - 0
src/components/iot/SelectProduct.vue

@@ -0,0 +1,342 @@
+<template>
+  <div class="tenant">
+    <!-- <Banner /> -->
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        :selectConfig="selectConfig"
+        :table-events="{
+          //element talbe事件都能传
+          select: select,
+        }"
+        @get-list="getList"
+      >
+        <template #slotName="{ item }">
+          {{ item.createTime }}
+        </template>
+      </byTable>
+    </div>
+    <el-dialog
+      :title="modalType == 'add' ? '添加产品' : '编辑'"
+      v-model="dialogVisible"
+      width="800"
+      v-loading="loading"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.data"
+        :rules="rules"
+        ref="byform"
+      >
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="submitForm('byform')"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+  
+<script setup>
+/* eslint-disable vue/no-unused-components */
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import { computed, defineComponent, ref, toRaw } from "vue";
+const loading = ref(false);
+const submitLoading = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+  },
+});
+let dialogVisible = ref(false);
+let roomDialogVisible = ref(false);
+let modalType = ref("add");
+let rules = ref({
+  tdaApplicationId: [
+    { required: true, message: "请选择行业名称", trigger: ["blur", "change"] },
+  ],
+  name: [
+    { required: true, message: "请输入产品名称", trigger: ["blur", "change"] },
+  ],
+  manufacturerName: [
+    { required: true, message: "请选择厂商名称", trigger: ["blur", "change"] },
+  ],
+  deviceType: [
+    { required: true, message: "请选择设备类型", trigger: ["blur", "change"] },
+  ],
+});
+const { proxy } = getCurrentInstance();
+const selectConfig = reactive([
+  {
+    label: "行业名称",
+    prop: "id",
+    data: [],
+  },
+  {
+    label: "厂商名称",
+    prop: "id",
+    data: [],
+  },
+]);
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "行业名称",
+        prop: "appName",
+      },
+    },
+    {
+      attrs: {
+        label: "产品名称",
+        prop: "name",
+        align: "center",
+      },
+    },
+    {
+      attrs: {
+        label: "协议类型",
+        prop: "protocolType",
+        align: "center",
+      },
+    },
+    {
+      attrs: {
+        label: "数据格式",
+        prop: "dataFormat",
+        align: "center",
+      },
+    },
+    {
+      attrs: {
+        label: "厂商名称",
+        prop: "manufacturerName",
+        align: "center",
+      },
+    },
+    {
+      attrs: {
+        label: "设备类型",
+        prop: "deviceType",
+      },
+    },
+
+    {
+      attrs: {
+        label: "操作",
+        width: "100",
+        align: "right",
+      },
+      // 渲染 el-button,一般用在最后一列。
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "选择",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              handleSelect(row);
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+
+let formData = reactive({
+  data: {},
+  treeData: [],
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const byform = ref(null);
+const treeData = ref([]);
+const formConfig = reactive([
+  {
+    type: "select",
+    prop: "tdaApplicationId",
+    label: "行业名称",
+    required: true,
+    data: [
+      {
+        name: "aaa", //title || name 是显示的字段名称
+        value: "11", //value || id 是选择的字段值
+      },
+    ],
+  },
+  {
+    type: "input",
+    prop: "name",
+    label: "产品名称",
+    required: true,
+    itemWidth: 100,
+    itemType: "text",
+  },
+  {
+    type: "select",
+    prop: "protocolType",
+    label: "协议类型",
+    disabled: true,
+    required: true,
+  },
+  {
+    type: "select",
+    prop: "dataFormat",
+    label: "数据格式",
+    disabled: true,
+    required: true,
+  },
+  {
+    type: "input",
+    prop: "manufacturerName",
+    label: "厂商名称",
+    required: true,
+  },
+  {
+    type: "input",
+    prop: "deviceType",
+    label: "设备类型",
+    required: true,
+  },
+]);
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy
+    .post("/tdaProduct/page", sourceList.value.pagination)
+    .then((message) => {
+      console.log(message);
+      sourceList.value.data = message.rows;
+      sourceList.value.pagination.total = message.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
+};
+const openModal = () => {
+  dialogVisible.value = true;
+  modalType.value = "add";
+  formData.data = {
+    protocolType: "HTTP",
+    dataFormat: "JSON",
+  };
+};
+const selection = ref({
+  data: [],
+});
+const select = (_selection, row) => {
+  selection.value.data = _selection;
+  console.log(_selection.length);
+};
+const openRoomModal = () => {
+  roomDialogVisible.value = true;
+  proxy
+    .get("/tenantInfo/roleMenuTreeSelect/" + selection.value.data[0].tenantId)
+    .then((res) => {
+      if (res.code == 200) {
+        treeData.value = res.menus;
+        formData.treeData = res.checkedKeys;
+        tree.value.setCheckedKeys(res.checkedKeys);
+      }
+    });
+};
+const tree = ref(null);
+const submitTree = () => {
+  proxy
+    .post("/tenantInfo/bindingMenu", {
+      tenantId: selection.value.data[0].tenantId,
+      menuIdList: tree.value.getCheckedKeys(),
+    })
+    .then((res) => {
+      ElMessage({
+        message: "保存成功",
+        type: "success",
+      });
+      roomDialogVisible.value = false;
+    });
+};
+
+const submitForm = () => {
+  console.log(byform.value);
+  byform.value.handleSubmit((valid) => {
+    submitLoading.value = true;
+
+    proxy.post("/tdaProduct/" + modalType.value, formData.data).then(
+      (res) => {
+        ElMessage({
+          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        getList();
+      },
+      (err) => (submitLoading.value = false)
+    );
+  });
+};
+
+const getDtl = (row) => {
+  modalType.value = "edit";
+  proxy.post("/tdaProduct/detail", { id: row.id }).then((res) => {
+    formData.data = res;
+    console.log(formData);
+    dialogVisible.value = true;
+  });
+};
+const selectData = reactive({
+  tradeList: [],
+});
+const getSelect = () => {
+  proxy
+    .post("/tdaApplication/page", { pageNum: 1, pageSize: 9999 })
+    .then((message) => {
+      selectData.tradeList = message.rows;
+      selectConfig[0].data = selectData.tradeList.map((x) => ({
+        label: x.appName,
+        value: x.id,
+      }));
+      formConfig[0].data = selectData.tradeList.map((x) => ({
+        title: x.appName,
+        value: x.id,
+      }));
+    });
+};
+
+getList();
+getSelect();
+const handleSelect = (row) => {
+  proxy.$emit("handleSelect", toRaw(row));
+};
+</script>
+  
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+</style>

+ 460 - 0
src/views/product/material/index.vue

@@ -0,0 +1,460 @@
+<template>
+  <div class="user">
+    <div class="tree">
+      <treeList
+        title="物料分类"
+        submitType="2"
+        v-model="sourceList.pagination.productClassifyId"
+        @change="treeChange"
+        @changeTreeList="getTreeList"
+      >
+      </treeList>
+    </div>
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        :selectConfig="selectConfig"
+        :table-events="{
+          //element talbe事件都能传
+          select: select,
+        }"
+        :action-list="[
+          {
+            text: 'Excel导入',
+            action: () => openExcel(),
+            disabled: false,
+          },
+          {
+            text: '添加物料',
+            action: () => openModal('add'),
+            disabled: false,
+          },
+        ]"
+        @get-list="getList"
+      >
+        <template #slotName="{ item }">
+          {{ item.createTime }}
+        </template>
+      </byTable>
+    </div>
+    <el-dialog
+      :title="modalType == 'add' ? '添加' : '编辑'"
+      v-model="dialogVisible"
+      width="500"
+      v-loading="loading"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.data"
+        :rules="rules"
+        ref="byform"
+      >
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="submitForm('byform')"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+    <el-dialog
+      title="Excel导入"
+      v-model="openExcelDialog"
+      width="400"
+      v-loading="loading"
+    >
+      <template #footer>
+        <el-button @click="openExcelDialog = false" size="large"
+          >取 消</el-button
+        >
+        <el-button
+          type="primary"
+          @click="submitExcel()"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+  
+<script setup>
+/* eslint-disable vue/no-unused-components */
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import treeList from "../treeList";
+import { computed, defineComponent, ref } from "vue";
+const loading = ref(false);
+const submitLoading = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+    type: "",
+    productClassifyId: "",
+    keyword: "",
+    definition: "2",
+  },
+});
+let dialogVisible = ref(false);
+let openExcelDialog = ref(false);
+
+let modalType = ref("add");
+let rules = ref({
+  productClassifyId: [
+    { required: true, message: "请选择物料分类", trigger: "change" },
+  ],
+  type: [{ required: true, message: "请选择物料类型", trigger: "change" }],
+  name: [{ required: true, message: "请输入物料名称", trigger: "blur" }],
+  unit: [{ required: true, message: "请选择单位", trigger: "change" }],
+});
+const { proxy } = getCurrentInstance();
+const selectConfig = computed(() => {
+  return [
+    {
+      label: "物料类型",
+      prop: "type",
+      data: [
+        {
+          label: "原料",
+          value: "1",
+        },
+        {
+          label: "辅料",
+          value: "2",
+        },
+        {
+          label: "配件",
+          value: "3",
+        },
+        {
+          label: "包材",
+          value: "4",
+        },
+        {
+          label: "其他",
+          value: "5",
+        },
+      ],
+    },
+  ];
+});
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "物料类型",
+        prop: "type",
+      },
+      render(type) {
+        return formConfig.value[1].data.find((x) => x.id == type).label;
+      },
+    },
+    {
+      attrs: {
+        label: "物料编码",
+        prop: "code",
+      },
+    },
+    {
+      attrs: {
+        label: "物料名称",
+        prop: "name",
+      },
+    },
+    {
+      attrs: {
+        label: "图片",
+        prop: "unit",
+      },
+    },
+    {
+      attrs: {
+        label: "单位",
+        prop: "unit",
+      },
+    },
+    {
+      attrs: {
+        label: "规格型号",
+        prop: "spec",
+      },
+    },
+    {
+      attrs: {
+        label: "物料备注",
+        prop: "remark",
+      },
+    },
+
+    {
+      attrs: {
+        label: "操作",
+        width: "200",
+        align: "right",
+      },
+      // 渲染 el-button,一般用在最后一列。
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "修改",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDtl(row);
+            },
+          },
+          {
+            attrs: {
+              label: "删除",
+              type: "danger",
+              text: true,
+            },
+            el: "button",
+            click() {
+              // 弹窗提示是否删除
+              ElMessageBox.confirm(
+                "此操作将永久删除该数据, 是否继续?",
+                "提示",
+                {
+                  confirmButtonText: "确定",
+                  cancelButtonText: "取消",
+                  type: "warning",
+                }
+              ).then(() => {
+                // 删除
+                proxy
+                  .post("/productInfo/delete", {
+                    id: row.id,
+                  })
+                  .then((res) => {
+                    ElMessage({
+                      message: "删除成功",
+                      type: "success",
+                    });
+                    getList();
+                  });
+              });
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+
+let formData = reactive({
+  data: {},
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const byform = ref(null);
+const treeListData = ref([]);
+const formConfig = computed(() => {
+  return [
+    {
+      type: "treeSelect",
+      prop: "productClassifyId",
+      label: "物料分类",
+      data: [],
+    },
+    {
+      type: "select",
+      prop: "type",
+      label: "物料类型",
+      required: true,
+      data: [
+        {
+          label: "原料",
+          id: "1",
+        },
+        {
+          label: "辅料",
+          id: "2",
+        },
+        {
+          label: "配件",
+          id: "3",
+        },
+        {
+          label: "包材",
+          id: "4",
+        },
+        {
+          label: "其他",
+          id: "5",
+        },
+      ],
+    },
+    {
+      type: "input",
+      prop: "name",
+      label: "物料名称",
+    },
+    {
+      type: "input",
+      prop: "spec",
+      label: "规格型号",
+    },
+    {
+      type: "select",
+      prop: "unit",
+      label: "单位",
+      required: true,
+      data: [
+        {
+          label: "个",
+          id: "个",
+        },
+        {
+          label: "双",
+          id: "双",
+        },
+      ],
+    },
+
+    {
+      type: "input",
+      prop: "remark",
+      label: "备注",
+      itemType: "textarea",
+    },
+  ];
+});
+const newPassword = () => {
+  formData.data.password = generatePassword();
+};
+const generatePassword = () => {
+  var length = 12,
+    charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
+    password = "";
+  for (var i = 0, n = charset.length; i < length; ++i) {
+    password += charset.charAt(Math.floor(Math.random() * n));
+  }
+  return password;
+};
+
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy
+    .post("/productInfo/page", sourceList.value.pagination)
+    .then((message) => {
+      console.log(message);
+      sourceList.value.data = message.rows;
+      sourceList.value.pagination.total = message.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
+};
+
+const treeChange = (e) => {
+  console.log(e);
+  sourceList.value.pagination.productClassifyId = e.id;
+  getList({ productClassifyId: e.id });
+};
+
+const openModal = () => {
+  dialogVisible.value = true;
+  modalType.value = "add";
+  formData.data = {
+    definition: "2",
+    fileList: [],
+  };
+};
+
+const openExcel = () => {
+  openExcelDialog.value = true;
+};
+const submitExcel = () => {
+  openExcelDialog.value = false;
+};
+const TreetenantId = ref("");
+const selection = ref({
+  data: [],
+});
+const select = (_selection, row) => {
+  selection.value.data = _selection;
+  console.log(_selection.length);
+};
+
+const tree = ref(null);
+const submitForm = () => {
+  console.log(byform.value);
+  byform.value.handleSubmit((valid) => {
+    submitLoading.value = true;
+    proxy.post("/productInfo/" + modalType.value, formData.data).then(
+      (res) => {
+        ElMessage({
+          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        getList();
+      },
+      (err) => {
+        submitLoading.value = false;
+      }
+    );
+  });
+};
+
+const getTreeList = () => {
+  proxy
+    .post("/productClassify/tree", { parentId: "", name: "", definition: "2" })
+    .then((message) => {
+      formConfig.value[0].data = message;
+    });
+};
+
+const getDtl = (row) => {
+  modalType.value = "edit";
+  proxy.post("/productInfo/detail", { id: row.id }).then((res) => {
+    res.type = res.type + "";
+    res.definition = "2";
+    res.fileList = [];
+    formData.data = res;
+    dialogVisible.value = true;
+  });
+};
+getTreeList();
+getList();
+</script>
+  
+<style lang="scss" scoped>
+.user {
+  padding: 20px;
+  display: flex;
+  justify-content: space-between;
+  .tree {
+    width: 300px;
+  }
+  .content {
+    width: calc(100% - 320px);
+  }
+}
+</style>

+ 437 - 0
src/views/product/product/index.vue

@@ -0,0 +1,437 @@
+<template>
+  <div class="user">
+    <div class="tree">
+      <treeList
+        title="产品分类"
+        submitType="1"
+        v-model="sourceList.pagination.productClassifyId"
+        @change="treeChange"
+        @changeTreeList="getTreeList"
+      >
+      </treeList>
+    </div>
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        :selectConfig="selectConfig"
+        :table-events="{
+          //element talbe事件都能传
+          select: select,
+        }"
+        :action-list="[
+          {
+            text: 'Excel导入',
+            action: () => openExcel(),
+            disabled: false,
+          },
+          {
+            text: '添加产品',
+            action: () => openModal('add'),
+            disabled: false,
+          },
+        ]"
+        @get-list="getList"
+      >
+        <template #slotName="{ item }">
+          {{ item.createTime }}
+        </template>
+      </byTable>
+    </div>
+    <el-dialog
+      :title="modalType == 'add' ? '添加' : '编辑'"
+      v-model="dialogVisible"
+      width="500"
+      v-loading="loading"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.data"
+        :rules="rules"
+        ref="byform"
+      >
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="submitForm('byform')"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+    <el-dialog
+      title="Excel导入"
+      v-model="openExcelDialog"
+      width="400"
+      v-loading="loading"
+    >
+      <template #footer>
+        <el-button @click="openExcelDialog = false" size="large"
+          >取 消</el-button
+        >
+        <el-button
+          type="primary"
+          @click="submitExcel()"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+  
+<script setup>
+/* eslint-disable vue/no-unused-components */
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import treeList from "../treeList";
+import { computed, defineComponent, ref } from "vue";
+const loading = ref(false);
+const submitLoading = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+    type: "",
+    productClassifyId: "",
+    keyword: "",
+    definition: "1",
+  },
+});
+let dialogVisible = ref(false);
+let openExcelDialog = ref(false);
+
+let modalType = ref("add");
+let rules = ref({
+  productClassifyId: [
+    { required: true, message: "请选择产品分类", trigger: "change" },
+  ],
+  type: [{ required: true, message: "请选择产品类型", trigger: "change" }],
+  name: [{ required: true, message: "请输入产品名称", trigger: "blur" }],
+  unit: [{ required: true, message: "请选择单位", trigger: "change" }],
+});
+const { proxy } = getCurrentInstance();
+const selectConfig = computed(() => {
+  return [
+    {
+      label: "产品类型",
+      prop: "type",
+      data: [
+        {
+          label: "成品",
+          value: "1",
+        },
+        {
+          label: "半成品",
+          value: "2",
+        },
+      ],
+    },
+  ];
+});
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "产品类型",
+        prop: "type",
+      },
+      render(type) {
+        return type == 1 ? "成品" : type == 2 ? "半成品" : "";
+      },
+    },
+    {
+      attrs: {
+        label: "产品编码",
+        prop: "code",
+      },
+    },
+    {
+      attrs: {
+        label: "产品名称",
+        prop: "name",
+      },
+    },
+    {
+      attrs: {
+        label: "图片",
+        prop: "unit",
+      },
+    },
+    {
+      attrs: {
+        label: "单位",
+        prop: "unit",
+      },
+    },
+    {
+      attrs: {
+        label: "规格型号",
+        prop: "spec",
+      },
+    },
+    {
+      attrs: {
+        label: "产品备注",
+        prop: "remark",
+      },
+    },
+
+    {
+      attrs: {
+        label: "操作",
+        width: "200",
+        align: "right",
+      },
+      // 渲染 el-button,一般用在最后一列。
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "修改",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDtl(row);
+            },
+          },
+          {
+            attrs: {
+              label: "删除",
+              type: "danger",
+              text: true,
+            },
+            el: "button",
+            click() {
+              // 弹窗提示是否删除
+              ElMessageBox.confirm(
+                "此操作将永久删除该数据, 是否继续?",
+                "提示",
+                {
+                  confirmButtonText: "确定",
+                  cancelButtonText: "取消",
+                  type: "warning",
+                }
+              ).then(() => {
+                // 删除
+                proxy
+                  .post("/productInfo/delete", {
+                    id: row.id,
+                  })
+                  .then((res) => {
+                    ElMessage({
+                      message: "删除成功",
+                      type: "success",
+                    });
+                    getList();
+                  });
+              });
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+
+let formData = reactive({
+  data: {},
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const byform = ref(null);
+const treeListData = ref([]);
+const formConfig = computed(() => {
+  return [
+    {
+      type: "treeSelect",
+      prop: "productClassifyId",
+      label: "产品分类",
+      data: [],
+    },
+    {
+      type: "select",
+      prop: "type",
+      label: "产品类型",
+      required: true,
+      data: [
+        {
+          label: "成品",
+          id: "1",
+        },
+        {
+          label: "半成品",
+          id: "2",
+        },
+      ],
+    },
+    {
+      type: "input",
+      prop: "name",
+      label: "产品名称",
+    },
+    {
+      type: "input",
+      prop: "spec",
+      label: "规格型号",
+    },
+    {
+      type: "select",
+      prop: "unit",
+      label: "单位",
+      required: true,
+      data: [
+        {
+          label: "个",
+          id: "个",
+        },
+        {
+          label: "双",
+          id: "双",
+        },
+      ],
+    },
+
+    {
+      type: "input",
+      prop: "remark",
+      label: "备注",
+      itemType: "textarea",
+    },
+  ];
+});
+const newPassword = () => {
+  formData.data.password = generatePassword();
+};
+const generatePassword = () => {
+  var length = 12,
+    charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
+    password = "";
+  for (var i = 0, n = charset.length; i < length; ++i) {
+    password += charset.charAt(Math.floor(Math.random() * n));
+  }
+  return password;
+};
+
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy
+    .post("/productInfo/page", sourceList.value.pagination)
+    .then((message) => {
+      console.log(message);
+      sourceList.value.data = message.rows;
+      sourceList.value.pagination.total = message.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
+};
+
+const treeChange = (e) => {
+  console.log(e);
+  sourceList.value.pagination.productClassifyId = e.id;
+  getList({ productClassifyId: e.id });
+};
+
+const openModal = () => {
+  dialogVisible.value = true;
+  modalType.value = "add";
+  formData.data = {
+    definition: "1",
+    type: "1",
+    fileList: [],
+  };
+};
+
+const openExcel = () => {
+  openExcelDialog.value = true;
+};
+const submitExcel = () => {
+  openExcelDialog.value = false;
+};
+const TreetenantId = ref("");
+const selection = ref({
+  data: [],
+});
+const select = (_selection, row) => {
+  selection.value.data = _selection;
+  console.log(_selection.length);
+};
+
+const tree = ref(null);
+const submitForm = () => {
+  console.log(byform.value);
+  byform.value.handleSubmit((valid) => {
+    submitLoading.value = true;
+    proxy.post("/productInfo/" + modalType.value, formData.data).then(
+      (res) => {
+        ElMessage({
+          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        getList();
+      },
+      (err) => {
+        submitLoading.value = false;
+      }
+    );
+  });
+};
+
+const getTreeList = () => {
+  proxy
+    .post("/productClassify/tree", { parentId: "", name: "", definition: "1" })
+    .then((message) => {
+      formConfig.value[0].data = message;
+    });
+};
+
+const getDtl = (row) => {
+  modalType.value = "edit";
+  proxy.post("/productInfo/detail", { id: row.id }).then((res) => {
+    res.type = res.type + "";
+    res.definition = "1";
+    res.fileList = [];
+    formData.data = res;
+    dialogVisible.value = true;
+  });
+};
+getTreeList();
+getList();
+</script>
+  
+<style lang="scss" scoped>
+.user {
+  padding: 20px;
+  display: flex;
+  justify-content: space-between;
+  .tree {
+    width: 300px;
+  }
+  .content {
+    width: calc(100% - 320px);
+  }
+}
+</style>

+ 255 - 0
src/views/product/treeList.vue

@@ -0,0 +1,255 @@
+<template>
+  <div class="treeList">
+    <div class="title commons-title">
+      {{ title }}
+    </div>
+    <div class="search">
+      <el-input
+        v-model="search"
+        placeholder="请输入搜索内容"
+        clearable
+        @clear="search = ''"
+        @keyup.enter="searchChange"
+      ></el-input>
+      <!-- <el-button type="primary" @click="searchChange">搜索</el-button> -->
+      <el-button type="primary" plain @click="add({ id: 0 })">
+        <el-icon :size="20">
+          <Plus />
+        </el-icon>
+      </el-button>
+    </div>
+    <el-tree
+      :data="treeListData"
+      ref="tree"
+      node-key="id"
+      @node-click="treeChange"
+      default-expand-all
+      :filter-node-method="filterNode"
+    >
+      <template #default="{ node, data }">
+        <div class="custom-tree-node">
+          <div style="flex: 1">{{ node.label }}</div>
+          <div style="float: right">
+            <el-icon :size="17" @click.stop="() => edit(node, data)">
+              <Edit />
+            </el-icon>
+            <el-icon
+              :size="17"
+              style="margin-left: 10px"
+              @click.stop="() => add(data)"
+            >
+              <Plus />
+            </el-icon>
+            <el-icon
+              :size="17"
+              style="margin-left: 10px"
+              @click.stop="() => del(data)"
+            >
+              <Delete />
+            </el-icon>
+          </div>
+        </div>
+      </template>
+    </el-tree>
+  </div>
+  <el-dialog
+    :title="treeModalType == 'add' ? '添加分类' : '编辑分类'"
+    v-model="treeModal"
+    width="400"
+    v-loading="loading"
+  >
+    <byForm
+      :formConfig="formConfig"
+      :formOption="formOption"
+      v-model="formData.data"
+      :rules="rules"
+      ref="byform"
+    >
+    </byForm>
+    <template #footer>
+      <el-button @click="treeModal = false" size="large">取 消</el-button>
+      <el-button
+        type="primary"
+        @click="submitForm('byform')"
+        size="large"
+        :loading="submitLoading"
+      >
+        确 定
+      </el-button>
+    </template>
+  </el-dialog>
+</template>
+<script setup>
+import { toRaw } from "vue";
+import { ElMessage, ElMessageBox } from "element-plus";
+import byForm from "@/components/byForm/index";
+
+const props = defineProps({
+  title: {
+    type: String,
+    default: "分类",
+  },
+  submitType: {
+    type: String,
+    default: "1", //默认产品
+  },
+});
+onMounted(() => {});
+const search = ref("");
+const emit = defineEmits(["update:modelValue"]);
+const { proxy } = getCurrentInstance();
+const treeChange = (e, data) => {
+  if (proxy.type == "radio") {
+    emit("update:modelValue", e.id);
+    emit("change", e);
+  } else {
+    emit("change", e);
+  }
+};
+
+const filterNode = (value, data, node) => {
+  if (!value) return true;
+  return data.label.indexOf(value) !== -1;
+};
+
+const searchChange = () => {
+  proxy.$refs.tree.filter(search.value);
+};
+const byform = ref(null);
+const treeListData = ref([]);
+let treeModal = ref(false);
+let submitLoading = ref(false);
+let treeModalType = ref("add");
+let currentNode = reactive({
+  id: "",
+});
+let formData = reactive({
+  data: {
+    name: "",
+    parentId: "",
+    definition: props.submitType,
+  },
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+let rules = ref({
+  name: [{ required: true, message: "请输入分类名称", trigger: "blur" }],
+});
+const formConfig = computed(() => {
+  return [
+    {
+      type: "input",
+      prop: "name",
+      label: "分类名称",
+      required: true,
+    },
+  ];
+});
+const add = (data) => {
+  treeModal.value = true;
+  treeModalType.value = "add";
+  formData.data = {
+    name: "",
+    parentId: "",
+    definition: props.submitType,
+  };
+  formData.data.parentId = data.id;
+};
+
+const edit = (node, data) => {
+  treeModal.value = true;
+  treeModalType.value = "edit";
+  formData.data = {
+    name: data.label,
+    id: data.id,
+    definition: props.submitType,
+  };
+};
+
+const del = (data) => {
+  ElMessageBox.confirm("此操作将永久删除该数据, 是否继续?", "提示", {
+    confirmButtonText: "确定",
+    cancelButtonText: "取消",
+    type: "warning",
+  }).then(() => {
+    // 删除
+    proxy
+      .post("/productClassify/delete", {
+        id: data.id,
+      })
+      .then((res) => {
+        ElMessage({
+          message: "删除成功",
+          type: "success",
+        });
+        getTreeList();
+      });
+  });
+};
+const submitForm = () => {
+  byform.value.handleSubmit((valid) => {
+    submitLoading.value = true;
+    proxy.post("/productClassify/" + treeModalType.value, formData.data).then(
+      (res) => {
+        ElMessage({
+          message: treeModalType.value == "add" ? "添加成功" : "编辑成功",
+          type: "success",
+        });
+        getTreeList();
+        treeModal.value = false;
+        submitLoading.value = false;
+      },
+      (err) => {
+        submitLoading.value = false;
+      }
+    );
+  });
+};
+
+const getTreeList = () => {
+  emit("changeTreeList");
+  proxy
+    .post("/productClassify/tree", {
+      parentId: "",
+      name: "",
+      definition: props.submitType,
+    })
+    .then((message) => {
+      treeListData.value = message;
+    });
+};
+getTreeList();
+const handleMouseOver = (data) => {
+  console.log(data, "sss");
+  // currentNode.id = toRaw(data).id;
+};
+</script>
+
+<style lang="scss">
+.custom-tree-node {
+  flex: 1;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  font-size: 14px;
+  padding-right: 8px;
+}
+.treeList {
+  display: block;
+  height: 100%;
+  background: #fff;
+  padding: 20px;
+  .search {
+    margin-bottom: 20px;
+    .el-input {
+      width: calc(100% - 70px);
+      margin-right: 10px;
+      text-align: center;
+    }
+  }
+}
+</style>

+ 1 - 1
src/views/production/factory/farm/index.vue

@@ -255,7 +255,7 @@ const formConfig = computed(() => {
       prop: "personLiableId",
       label: "负责人",
       isLoad: {
-        url: "/tenantUser/list?pageNum=1&pageSize=10000",
+        url: "/system/user/list?pageNum=1&pageSize=10000",
         labelKey: "userName",
         labelVal: "userId",
         method: "get",

+ 1 - 1
src/views/production/factory/line/index.vue

@@ -273,7 +273,7 @@ const formConfig = computed(() => {
       prop: "personLiableId",
       label: "负责人",
       isLoad: {
-        url: "/tenantUser/list?pageNum=1&pageSize=10000",
+        url: "/system/user/list?pageNum=1&pageSize=10000",
         labelKey: "userName",
         labelVal: "userId",
         method: "get",

+ 396 - 0
src/views/production/project/bom/index.vue

@@ -0,0 +1,396 @@
+<template>
+  <div class="tenant">
+    <!-- <Banner /> -->
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        :selectConfig="selectConfig"
+        :table-events="{
+          //element talbe事件都能传
+          select: select,
+        }"
+        :action-list="[
+          {
+            text: '添加BOM',
+            action: () => openModal('add'),
+          },
+        ]"
+        @get-list="getList"
+      >
+        <template #slotName="{ item }">
+          {{ item.createTime }}
+        </template>
+      </byTable>
+    </div>
+    <el-dialog
+      :title="modalType == 'add' ? '添加BOM' : '编辑BOM'"
+      v-model="dialogVisible"
+      width="800"
+      v-loading="loading"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.data"
+        :rules="rules"
+        ref="byform"
+      >
+        <template #slot>
+          <div>
+            <el-button type="primary" plain>添加物料/半成品</el-button>
+            <el-button type="primary" plain> Excel导入</el-button>
+            <el-form
+              ref="tableForm"
+              :model="formData.data"
+              :rules="rules"
+              label-width="0px"
+              style="margin-top: 15px"
+            >
+              <el-table :data="formData.data.productList">
+                <el-table-column prop="name" label="物料编码" />
+                <el-table-column prop="state" label="物料名称" />
+                <el-table-column prop="city" label="单位" />
+                <el-table-column prop="num" label="数量" width="150">
+                  <template #default="{ row, $index }">
+                    <el-form-item
+                      :prop="'productList.' + $index + '.num'"
+                      :rules="rules.num"
+                      :inline-message="true"
+                    >
+                      <el-input-number
+                        v-model="row.num"
+                        :precision="2"
+                        :controls="false"
+                        :min="1"
+                      />
+                    </el-form-item>
+                  </template>
+                </el-table-column>
+                <el-table-column prop="zip" label="成本" width="150">
+                  <template #default="{ row, $index }">
+                    <el-form-item
+                      :prop="'productList.' + $index + '.num'"
+                      :rules="rules.num"
+                      :inline-message="true"
+                    >
+                      <el-input-number
+                        v-model="row.aa"
+                        :precision="2"
+                        :controls="false"
+                        :min="1"
+                      />
+                    </el-form-item>
+                  </template>
+                </el-table-column>
+                <el-table-column prop="zip" label="操作" width="100">
+                  <template #default>
+                    <el-button type="primary" link>删除</el-button>
+                  </template>
+                </el-table-column>
+              </el-table>
+            </el-form>
+          </div>
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="submitForm('byform')"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+  
+<script setup>
+/* eslint-disable vue/no-unused-components */
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import { computed, defineComponent, ref } from "vue";
+const loading = ref(false);
+const submitLoading = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+  },
+});
+let dialogVisible = ref(false);
+let modalType = ref("add");
+let rules = ref({
+  type: [{ required: true, message: "请选择车间类型", trigger: "change" }],
+  name: [{ required: true, message: "请输入车间名称", trigger: "blur" }],
+  num: [{ required: true, message: "请输入数量", trigger: "blur" }],
+  personLiableId: [
+    { required: true, message: "请选择负责人", trigger: "change" },
+  ],
+});
+const { proxy } = getCurrentInstance();
+const selectConfig = reactive([
+  // {
+  //   label: "车间类型",
+  //   prop: "type",
+  //   data: [
+  //     {
+  //       label: "普通车间",
+  //       value: "1",
+  //     },
+  //     {
+  //       label: "半自动化车间",
+  //       value: "2",
+  //     },
+  //     {
+  //       label: "自动化车间",
+  //       value: "3",
+  //     },
+  //   ],
+  // },
+]);
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "产品类型",
+        prop: "name",
+        width: 150,
+      },
+    },
+    {
+      attrs: {
+        label: "产品编码",
+        prop: "name",
+        width: 150,
+      },
+    },
+    {
+      attrs: {
+        label: "产品名称",
+        prop: "remarks",
+      },
+    },
+    {
+      attrs: {
+        label: "状态",
+        prop: "remarks",
+      },
+    },
+    {
+      attrs: {
+        label: "当前版本",
+        prop: "remarks",
+      },
+    },
+    {
+      attrs: {
+        label: "最近维护人",
+        prop: "remarks",
+      },
+    },
+    {
+      attrs: {
+        label: "最近维护时间",
+        prop: "remarks",
+      },
+    },
+    // {
+    //   attrs: {
+    //     label: "BOM文件",
+    //     prop: "type",
+    //     width: 120,
+    //   },
+    //   render(type) {
+    //     return type == 1
+    //       ? "普通车间"
+    //       : type == 2
+    //       ? "半自动化车间"
+    //       : type == "3"
+    //       ? "自动化车间"
+    //       : "";
+    //   },
+    // },
+
+    {
+      attrs: {
+        label: "操作",
+        width: "200",
+        align: "right",
+      },
+      // 渲染 el-button,一般用在最后一列。
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "新建版本",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDtl(row);
+            },
+          },
+          {
+            attrs: {
+              label: "修改",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDtl(row);
+            },
+          },
+          {
+            attrs: {
+              label: "禁用",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDtl(row);
+            },
+          },
+          // {
+          //   attrs: {
+          //     label: "删除",
+          //     type: "danger",
+          //     text: true,
+          //   },
+          //   el: "button",
+          //   click() {
+          //     // 弹窗提示是否删除
+          //     ElMessageBox.confirm(
+          //       "此操作将永久删除该数据, 是否继续?",
+          //       "提示",
+          //       {
+          //         confirmButtonText: "确定",
+          //         cancelButtonText: "取消",
+          //         type: "warning",
+          //       }
+          //     ).then(() => {
+          //       // 删除
+          //       proxy
+          //         .post("/workshop/delete", {
+          //           id: row.id,
+          //         })
+          //         .then((res) => {
+          //           ElMessage({
+          //             message: "删除成功",
+          //             type: "success",
+          //           });
+          //           getList();
+          //         });
+          //     });
+          //   },
+          // },
+        ];
+      },
+    },
+  ];
+});
+
+let formData = reactive({
+  data: {
+    type: "1",
+  },
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const byform = ref(null);
+const formConfig = computed(() => {
+  return [
+    {
+      type: "select",
+      prop: "name",
+      label: "产品名称",
+      required: true,
+    },
+    {
+      type: "slot",
+      slotName: "slot",
+      label: "物料信息",
+    },
+  ];
+});
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy.post("/workshop/page", sourceList.value.pagination).then((message) => {
+    console.log(message);
+    sourceList.value.data = message.rows;
+    sourceList.value.pagination.total = message.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
+const openModal = () => {
+  dialogVisible.value = true;
+  modalType.value = "add";
+  formData.data = {};
+  formData.data.productList = [
+    {
+      num: "",
+    },
+  ];
+};
+const submitForm = () => {
+  proxy.$refs.tableForm.validate((vaild) => {
+    if (vaild) {
+      byform.value.handleSubmit((valid) => {
+        submitLoading.value = true;
+        proxy.post("/workshop/" + modalType.value, formData.data).then(
+          (res) => {
+            ElMessage({
+              message: modalType.value == "add" ? "添加成功" : "编辑成功",
+              type: "success",
+            });
+            dialogVisible.value = false;
+            submitLoading.value = false;
+            getList();
+          },
+          (err) => {
+            console.log(err, "aswwwww");
+            submitLoading.value = false;
+          }
+        );
+      });
+    }
+  });
+};
+
+const getDtl = (row) => {
+  modalType.value = "edit";
+  proxy.post("/workshop/detail", { id: row.id }).then((res) => {
+    res.type = res.type + "";
+    formData.data = res;
+    console.log(formData);
+    dialogVisible.value = true;
+  });
+};
+
+// getList();
+</script>
+  
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+</style>

+ 318 - 0
src/views/production/project/processes/index.vue

@@ -0,0 +1,318 @@
+<template>
+  <div class="tenant">
+    <!-- <Banner /> -->
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        :selectConfig="selectConfig"
+        :table-events="{
+          //element talbe事件都能传
+          select: select,
+        }"
+        :action-list="[
+          {
+            text: '添加工序',
+            action: () => openModal('add'),
+          },
+        ]"
+        @get-list="getList"
+      >
+        <template #slotName="{ item }">
+          {{ item.createTime }}
+        </template>
+      </byTable>
+    </div>
+    <el-dialog
+      :title="modalType == 'add' ? '添加工序' : '编辑工序'"
+      v-model="dialogVisible"
+      width="800"
+      v-loading="loading"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.data"
+        :rules="rules"
+        ref="byform"
+      >
+        <template #slot>
+          <div>
+            <el-upload
+              v-model:file-list="fileList"
+              class="upload-demo"
+              action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
+              :limit="1"
+              :data="uploadData"
+              :on-preview="handlePreview"
+              :on-remove="handleRemove"
+              :on-success="handleSuccess"
+              :before-upload="handleBeforeUpload"
+            >
+              <el-button type="primary">点击上传</el-button>
+            </el-upload>
+          </div>
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="submitForm('byform')"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+  
+<script setup>
+/* eslint-disable vue/no-unused-components */
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import FileUpload from "@/components/FileUpload/index";
+import { computed, defineComponent, ref } from "vue";
+import { getToken } from "@/utils/auth";
+
+const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传文件服务器地址
+const headers = ref({ Authorization: "Bearer " + getToken() });
+const uploadData = ref({});
+const loading = ref(false);
+const submitLoading = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+  },
+});
+let dialogVisible = ref(false);
+let modalType = ref("add");
+let fileList = ref([]);
+let rules = ref({
+  name: [{ required: true, message: "请输入工序名称", trigger: "blur" }],
+});
+const { proxy } = getCurrentInstance();
+const selectConfig = reactive([
+  // {
+  //   label: "车间类型",
+  //   prop: "type",
+  //   data: [
+  //     {
+  //       label: "普通车间",
+  //       value: "1",
+  //     },
+  //     {
+  //       label: "半自动化车间",
+  //       value: "2",
+  //     },
+  //     {
+  //       label: "自动化车间",
+  //       value: "3",
+  //     },
+  //   ],
+  // },
+]);
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "工序名称",
+        prop: "name",
+        width: 150,
+      },
+    },
+    {
+      attrs: {
+        label: "工序说明",
+        prop: "remarks",
+      },
+    },
+    {
+      attrs: {
+        label: "工序文件",
+        prop: "type",
+        width: 120,
+      },
+      render(type) {
+        return type == 1
+          ? "普通车间"
+          : type == 2
+          ? "半自动化车间"
+          : type == "3"
+          ? "自动化车间"
+          : "";
+      },
+    },
+
+    {
+      attrs: {
+        label: "操作",
+        width: "200",
+        align: "right",
+      },
+      // 渲染 el-button,一般用在最后一列。
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "修改",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDtl(row);
+            },
+          },
+          {
+            attrs: {
+              label: "删除",
+              type: "danger",
+              text: true,
+            },
+            el: "button",
+            click() {
+              // 弹窗提示是否删除
+              ElMessageBox.confirm(
+                "此操作将永久删除该数据, 是否继续?",
+                "提示",
+                {
+                  confirmButtonText: "确定",
+                  cancelButtonText: "取消",
+                  type: "warning",
+                }
+              ).then(() => {
+                // 删除
+                proxy
+                  .post("/productionProcesses/delete", {
+                    id: row.id,
+                  })
+                  .then((res) => {
+                    ElMessage({
+                      message: "删除成功",
+                      type: "success",
+                    });
+                    getList();
+                  });
+              });
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+
+let formData = reactive({
+  data: {
+    type: "1",
+  },
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const byform = ref(null);
+const formConfig = computed(() => {
+  return [
+    {
+      type: "input",
+      prop: "name",
+      label: "工序名称",
+      required: true,
+    },
+    {
+      type: "input",
+      prop: "remarks",
+      label: "工序说明",
+      itemType: "textarea",
+    },
+    {
+      type: "slot",
+      slotName: "slot",
+      label: "上传附件",
+    },
+  ];
+});
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy
+    .post("/productionProcesses/page", sourceList.value.pagination)
+    .then((message) => {
+      console.log(message);
+      sourceList.value.data = message.rows;
+      sourceList.value.pagination.total = message.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
+};
+const openModal = () => {
+  dialogVisible.value = true;
+  modalType.value = "add";
+  formData.data = {};
+};
+
+const submitForm = () => {
+  console.log(fileList.value, "ass");
+  // byform.value.handleSubmit((valid) => {
+  //   submitLoading.value = true;
+  //   proxy.post("/productionProcesses/" + modalType.value, formData.data).then(
+  //     (res) => {
+  //       ElMessage({
+  //         message: modalType.value == "add" ? "添加成功" : "编辑成功",
+  //         type: "success",
+  //       });
+  //       dialogVisible.value = false;
+  //       submitLoading.value = false;
+  //       getList();
+  //     },
+  //     (err) => {
+  //       console.log(err, "aswwwww");
+  //       submitLoading.value = false;
+  //     }
+  //   );
+  // });
+};
+
+const getDtl = (row) => {
+  modalType.value = "edit";
+  proxy.post("/productionProcesses/detail", { id: row.id }).then((res) => {
+    res.type = res.type + "";
+    formData.data = res;
+    console.log(formData);
+    dialogVisible.value = true;
+  });
+};
+const handleBeforeUpload = async (file) => {
+  const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
+  uploadData.value = res.uploadBody;
+};
+
+const handlePreview = () => {};
+const handleSuccess = (res) => {
+  console.log(res);
+};
+const handleRemove = (res) => {
+  console.log(res);
+};
+// getList();
+</script>
+  
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+</style>

+ 427 - 0
src/views/production/project/technology/index.vue

@@ -0,0 +1,427 @@
+<template>
+  <div class="tenant">
+    <!-- <Banner /> -->
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        :selectConfig="selectConfig"
+        :table-events="{
+          //element talbe事件都能传
+          select: select,
+        }"
+        :action-list="[
+          {
+            text: '添加工艺',
+            action: () => openModal('add'),
+          },
+        ]"
+        @get-list="getList"
+      >
+        <template #slotName="{ item }">
+          {{ item.createTime }}
+        </template>
+      </byTable>
+    </div>
+    <el-dialog
+      :title="modalType == 'add' ? '添加工艺' : '编辑工艺'"
+      v-model="dialogVisible"
+      width="800"
+      v-loading="loading"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.data"
+        :rules="rules"
+        ref="byform"
+      >
+        <template #lineSlot>
+          <el-transfer
+            v-model="selectLine"
+            filterable
+            filter-placeholder="搜索"
+            :data="lineData"
+            :titles="['可选', '已选']"
+          >
+            <template #default="{ option }">
+              <div
+                draggable="true"
+                @dragstart="dragStar($event, option)"
+                @dragover="dragOver($event, option)"
+                style="cursor: default"
+              >
+                {{ option.label }}
+              </div>
+            </template>
+          </el-transfer>
+        </template>
+        <template #productSlot>
+          <div>
+            <el-button type="primary" @click="openProduct = true">
+              添加产品
+            </el-button>
+            <div style="margin-top: 15px">
+              <el-tag
+                class="ml-2"
+                type="info"
+                closable
+                v-for="(product, index) in productList"
+                :key="product.id"
+                @close="handleRemove(index)"
+                >{{ product.name }}</el-tag
+              >
+            </div>
+          </div>
+        </template>
+        <!-- :filter-method="filterMethod" -->
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="submitForm('byform')"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+    <el-dialog
+      v-model="openProduct"
+      title="选择产品"
+      width="70%"
+      :before-close="handleClose"
+    >
+      <SelectProduct @handleSelect="handleSelect"></SelectProduct>
+      <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="openProduct = false">取消</el-button>
+        </span>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+  
+<script setup>
+/* eslint-disable vue/no-unused-components */
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import SelectProduct from "@/components/iot/SelectProduct";
+
+import { computed, defineComponent, ref, toRaw } from "vue";
+const loading = ref(false);
+const submitLoading = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+  },
+});
+let lineData = reactive([
+  {
+    key: "1",
+    label: "测试1",
+    disabled: false,
+  },
+  {
+    key: "2",
+    label: "测试2",
+    disabled: false,
+  },
+  {
+    key: "3",
+    label: "测试3",
+    disabled: false,
+  },
+  {
+    key: "4",
+    label: "测试4",
+    disabled: false,
+  },
+]);
+let selectLine = ref([]);
+let dialogVisible = ref(false);
+let openProduct = ref(false);
+let modalType = ref("add");
+let rules = ref({
+  type: [{ required: true, message: "请选择车间类型", trigger: "change" }],
+  name: [{ required: true, message: "请输入车间名称", trigger: "blur" }],
+  personLiableId: [
+    { required: true, message: "请选择负责人", trigger: "change" },
+  ],
+});
+const { proxy } = getCurrentInstance();
+const selectConfig = reactive([
+  // {
+  //   label: "车间类型",
+  //   prop: "type",
+  //   data: [
+  //     {
+  //       label: "普通车间",
+  //       value: "1",
+  //     },
+  //     {
+  //       label: "半自动化车间",
+  //       value: "2",
+  //     },
+  //     {
+  //       label: "自动化车间",
+  //       value: "3",
+  //     },
+  //   ],
+  // },
+]);
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "工艺名称",
+        prop: "name",
+        width: 150,
+      },
+    },
+    {
+      attrs: {
+        label: "工艺路线",
+        prop: "remarks",
+      },
+    },
+    {
+      attrs: {
+        label: "适用产品",
+        prop: "type",
+        width: 120,
+      },
+      render(type) {
+        return type == 1
+          ? "普通车间"
+          : type == 2
+          ? "半自动化车间"
+          : type == "3"
+          ? "自动化车间"
+          : "";
+      },
+    },
+    {
+      attrs: {
+        label: "工艺说明",
+        prop: "remarks",
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "200",
+        align: "right",
+      },
+      // 渲染 el-button,一般用在最后一列。
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "修改",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDtl(row);
+            },
+          },
+          {
+            attrs: {
+              label: "删除",
+              type: "danger",
+              text: true,
+            },
+            el: "button",
+            click() {
+              // 弹窗提示是否删除
+              ElMessageBox.confirm(
+                "此操作将永久删除该数据, 是否继续?",
+                "提示",
+                {
+                  confirmButtonText: "确定",
+                  cancelButtonText: "取消",
+                  type: "warning",
+                }
+              ).then(() => {
+                // 删除
+                proxy
+                  .post("/workshop/delete", {
+                    id: row.id,
+                  })
+                  .then((res) => {
+                    ElMessage({
+                      message: "删除成功",
+                      type: "success",
+                    });
+                    getList();
+                  });
+              });
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+
+let formData = reactive({
+  data: {
+    type: "1",
+  },
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const byform = ref(null);
+const formConfig = computed(() => {
+  return [
+    {
+      type: "input",
+      prop: "name",
+      label: "工艺名称",
+      required: true,
+    },
+    {
+      type: "slot",
+      slotName: "lineSlot",
+      label: "工艺路线",
+    },
+    {
+      type: "slot",
+      slotName: "productSlot",
+      label: "适用产品",
+    },
+
+    {
+      type: "input",
+      prop: "remarks",
+      label: "车间说明",
+      itemType: "textarea",
+    },
+  ];
+});
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy.post("/workshop/page", sourceList.value.pagination).then((message) => {
+    console.log(message);
+    sourceList.value.data = message.rows;
+    sourceList.value.pagination.total = message.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
+const openModal = () => {
+  dialogVisible.value = true;
+  modalType.value = "add";
+  formData.data = {};
+};
+
+const submitForm = () => {
+  console.log(byform.value);
+  byform.value.handleSubmit((valid) => {
+    submitLoading.value = true;
+    proxy.post("/workshop/" + modalType.value, formData.data).then(
+      (res) => {
+        ElMessage({
+          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        getList();
+      },
+      (err) => {
+        console.log(err, "aswwwww");
+        submitLoading.value = false;
+      }
+    );
+  });
+};
+
+const getDtl = (row) => {
+  modalType.value = "edit";
+  proxy.post("/workshop/detail", { id: row.id }).then((res) => {
+    res.type = res.type + "";
+    formData.data = res;
+    console.log(formData);
+    dialogVisible.value = true;
+  });
+};
+
+const filterMethod = (query, item) => {
+  return item.initial.toLowerCase().includes(query.toLowerCase());
+};
+const productList = ref([]);
+
+const handleSelect = (row) => {
+  const flag = productList.value.some((x) => x.id === row.id);
+  if (flag)
+    return ElMessage({
+      message: "该产品已选择",
+      type: "info",
+    });
+  productList.value.push(row);
+  return ElMessage({
+    message: "选择成功",
+    type: "success",
+  });
+};
+
+const handleRemove = (index) => {
+  productList.value.splice(index, 1);
+  return ElMessage({
+    message: "删除成功",
+    type: "success",
+  });
+};
+
+// const renderDom = (h, option) => {
+//   console.log(option, "ass");
+//    h(lineData.map(x=> {
+//     return `<div>${x.x.label}}</div>`
+//   })
+// };
+// getList();
+let dom = ref(null);
+let selectItem = ref({});
+const dragStar = (e, option) => {
+  dom.value = e.target;
+  const target = e.target;
+  selectItem.value = option;
+  e.dataTransfer.setData("text/plain", target.id);
+  e.dataTransfer.effectAllowed = "move";
+};
+const dragOver = (e, option) => {
+  e.preventDefault();
+  const index = selectLine.value.findIndex(
+    (x) => x.key === selectItem.value.key
+  );
+  const index1 = selectLine.value.findIndex((x) => x.key === toRaw(option).key);
+  const item = selectLine.value[index];
+  selectLine.value[index] = selectLine.value[index1];
+  selectLine.value[index1] = item;
+  console.log(selectLine.value);
+};
+</script>
+  
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+</style>

+ 427 - 421
src/views/system/dept2/index.vue

@@ -1,170 +1,171 @@
 <template>
-	<div class="dept">
-		<div class="tree">
-			<treeList
-				:data="treeListData"
-				v-model="sourceList.pagination.tenantId"
-				node-key="id"
-				@change="treeChange"
-			>
-			</treeList>
-		</div>
-		<div class="content">
-			<byTable
-				:hideTable="true"
-				:hidePagination="true"
-				:config="config"
-				:loading="loading"
-				highlight-current-row
-				:selectConfig="selectConfig"
-				:table-events="{
-					//element talbe事件都能传
-					select: select,
-				}"
-				:action-list="[
-					{
-						text: '添加机构',
-						action: () => openModal('add'),
-						disabled: !sourceList.pagination.tenantId,
-					},
-				]"
-				@get-list="getList"
-			>
-				<template #slotName="{ item }">
-					{{ item.createTime }}
-				</template>
-			</byTable>
-			<el-table
-				v-loading="loading"
-				:data="sourceList.data"
-				row-key="deptId"
-				style="padding: 0 20px; box-sizing: border-box"
-				:tree-props="{
-					children: 'children',
-					hasChildren: 'hasChildren',
-				}"
-			>
-				<el-table-column
-					prop="deptName"
-					label="机构名称"
-					width="260"
-				></el-table-column>
-				<el-table-column
-					prop="orderNum"
-					label="排序"
-					width="100"
-				></el-table-column>
-				<el-table-column prop="type" label="机构类型" width="100">
-				</el-table-column>
-				<el-table-column
-					label="创建时间"
-					align="center"
-					prop="createTime"
-					width="200"
-				>
-					<template #default="scope">
-						<span>{{ parseTime(scope.row.createTime) }}</span>
-					</template>
-				</el-table-column>
-				<el-table-column
-					label="操作"
-					align="center"
-					class-name="small-padding fixed-width"
-				>
-					<template #default="scope">
-						<el-button
-							link
-							type="primary"
-							@click="getDtl(scope.row)"
-							v-hasPermi="['system:dept:edit']"
-							>修改</el-button
-						>
-						<el-button
-							link
-							type="primary"
-							@click="handleAdd(scope.row)"
-							v-hasPermi="['system:dept:add']"
-							>新增</el-button
-						>
-						<el-button
-							v-if="scope.row.parentId != 0"
-							link
-							type="primary"
-							@click="listDelete(scope.row)"
-							v-hasPermi="['system:dept:remove']"
-							>删除</el-button
-						>
-					</template>
-				</el-table-column>
-			</el-table>
-		</div>
-		<el-dialog
-			:title="modalType == 'add' ? '新增' : '编辑'"
-			v-model="dialogVisible"
-			width="500"
-			v-loading="loading"
-		>
-			<byForm
-				:formConfig="formConfig"
-				:formOption="formOption"
-				v-model="formData.data"
-				:rules="rules"
-				ref="byform"
-			>
-				<template #account>
-					<el-input
-						style="width: 150px; margin-right: 10px"
-						v-model="formData.data.userName"
-						placeholder="请输入用户名"
-					></el-input>
-					<el-input
-						style="width: 150px; margin-right: 10px"
-						v-model="formData.data.password"
-						placeholder="密码"
-					></el-input>
-					<span
-						style="color: #409eff; cursor: pointer"
-						@click="newPassword"
-						>随机生成</span
-					>
-				</template>
-			</byForm>
-			<template #footer>
-				<el-button @click="dialogVisible = false" size="large"
-					>取 消</el-button
-				>
-				<el-button
-					type="primary"
-					@click="submitForm('byform')"
-					size="large"
-					:loading="submitLoading"
-				>
-					确 定
-				</el-button>
-			</template>
-		</el-dialog>
-		<el-dialog
-			title="修改密码"
-			v-model="roomDialogVisible"
-			width="500"
-			:before-close="handleClose"
-			v-loading="loading"
-		>
-			<template #footer>
-				<el-button @click="roomDialogVisible = false" size="large"
-					>取 消</el-button
-				>
-				<el-button
-					type="primary"
-					@click="submitTree('byform')"
-					size="large"
-					:loading="submitLoading"
-				>
-					确 定
-				</el-button>
-			</template>
-		</el-dialog>
-	</div>
+  <div class="dept">
+    <div class="tree">
+      <treeList
+        :data="treeListData"
+        v-model="sourceList.pagination.tenantId"
+        node-key="id"
+        @change="treeChange"
+      >
+      </treeList>
+    </div>
+    <div class="content">
+      <byTable
+        :hideTable="true"
+        :hidePagination="true"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        :selectConfig="selectConfig"
+        :table-events="{
+          //element talbe事件都能传
+          select: select,
+        }"
+        :action-list="[
+          {
+            text: '添加机构',
+            action: () => openModal('add'),
+            disabled: !sourceList.pagination.tenantId,
+          },
+        ]"
+        @get-list="getList"
+      >
+        <template #slotName="{ item }">
+          {{ item.createTime }}
+        </template>
+      </byTable>
+      <el-table
+        v-loading="loading"
+        :data="sourceList.data"
+        row-key="deptId"
+        style="padding: 0 20px; box-sizing: border-box"
+        :tree-props="{
+          children: 'children',
+          hasChildren: 'hasChildren',
+        }"
+      >
+        <el-table-column
+          prop="deptName"
+          label="机构名称"
+          width="260"
+        ></el-table-column>
+        <el-table-column
+          prop="orderNum"
+          label="排序"
+          width="100"
+        ></el-table-column>
+        <el-table-column
+          prop="type"
+          label="机构类型"
+          width="100"
+          :formatter="(row) => showType(row.type)"
+        >
+        </el-table-column>
+        <el-table-column
+          label="创建时间"
+          align="center"
+          prop="createTime"
+          width="200"
+        >
+          <template #default="scope">
+            <span>{{ parseTime(scope.row.createTime) }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column
+          label="操作"
+          align="center"
+          class-name="small-padding fixed-width"
+        >
+          <template #default="scope">
+            <el-button
+              link
+              type="primary"
+              @click="getDtl(scope.row)"
+              v-hasPermi="['system:dept:edit']"
+              >修改</el-button
+            >
+            <el-button
+              link
+              type="primary"
+              @click="handleAdd(scope.row)"
+              v-hasPermi="['system:dept:add']"
+              >新增</el-button
+            >
+            <el-button
+              v-if="scope.row.parentId != 0"
+              link
+              type="primary"
+              @click="listDelete(scope.row)"
+              v-hasPermi="['system:dept:remove']"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+    <el-dialog
+      :title="modalType == 'add' ? '新增' : '编辑'"
+      v-model="dialogVisible"
+      width="500"
+      v-loading="loading"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.data"
+        :rules="rules"
+        ref="byform"
+      >
+        <template #account>
+          <el-input
+            style="width: 150px; margin-right: 10px"
+            v-model="formData.data.userName"
+            placeholder="请输入用户名"
+          ></el-input>
+          <el-input
+            style="width: 150px; margin-right: 10px"
+            v-model="formData.data.password"
+            placeholder="密码"
+          ></el-input>
+          <span style="color: #409eff; cursor: pointer" @click="newPassword"
+            >随机生成</span
+          >
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="submitForm('byform')"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+    <el-dialog
+      title="修改密码"
+      v-model="roomDialogVisible"
+      width="500"
+      :before-close="handleClose"
+      v-loading="loading"
+    >
+      <template #footer>
+        <el-button @click="roomDialogVisible = false" size="large"
+          >取 消</el-button
+        >
+        <el-button
+          type="primary"
+          @click="submitTree('byform')"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+  </div>
 </template>
   
 <script setup>
@@ -187,85 +188,85 @@ const sourceList = ref({
 let dialogVisible = ref(false);
 let modalType = ref("add");
 let rules = ref({
-	parentId: [{ required: true, message: '请选择上级机构', trigger: 'blur' }],
-	orderNum: [{ required: true, message: '排序不能为空', trigger: 'blur' }],
-	deptName: [{ required: true, message: '机构名称不能为空', trigger: 'blur' }],
-})
-const { proxy } = getCurrentInstance()
+  parentId: [{ required: true, message: "请选择上级机构", trigger: "blur" }],
+  orderNum: [{ required: true, message: "排序不能为空", trigger: "blur" }],
+  deptName: [{ required: true, message: "机构名称不能为空", trigger: "blur" }],
+});
+const { proxy } = getCurrentInstance();
 const selectConfig = computed(() => {
   return [];
 });
 const config = computed(() => {
-	return [
-		{
-			attrs: {
-				label: '机构名称',
-				prop: 'deptName',
-			},
-		},
-		{
-			attrs: {
-				label: '机构类型',
-				prop: 'userName',
-				align: 'left',
-			},
+  return [
+    {
+      attrs: {
+        label: "机构名称",
+        prop: "deptName",
+      },
+    },
+    {
+      attrs: {
+        label: "机构类型",
+        prop: "type",
+        align: "left",
+      },
 
-			render(type) {
-				return type == '0'
-					? '公司'
-					: type == '1'
-					? '业务中心'
-					: type == '2'
-					? '部门'
-					: '组'
-			},
-		},
-		{
-			attrs: {
-				label: '排序',
-				prop: 'nickName',
-			},
-		},
-		{
-			attrs: {
-				label: '创建时间',
-				prop: 'createTime',
-			},
-		},
-		{
-			attrs: {
-				label: '操作',
-				width: '200',
-				align: 'right',
-			},
-			// 渲染 el-button,一般用在最后一列。
-			renderHTML(row) {
-				return [
-					{
-						attrs: {
-							label: '修改',
-							type: 'primary',
-							text: true,
-						},
-						el: 'button',
-						click() {
-							getDtl(row)
-						},
-					},
-					{
-						attrs: {
-							label: '删除',
-							type: 'danger',
-							text: true,
-						},
-						el: 'button',
-						click() {},
-					},
-				]
-			},
-		},
-	]
-})
+      render(type) {
+        return type == "0"
+          ? "公司"
+          : type == "1"
+          ? "业务中心"
+          : type == "2"
+          ? "部门"
+          : "组";
+      },
+    },
+    {
+      attrs: {
+        label: "排序",
+        prop: "nickName",
+      },
+    },
+    {
+      attrs: {
+        label: "创建时间",
+        prop: "createTime",
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "200",
+        align: "right",
+      },
+      // 渲染 el-button,一般用在最后一列。
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "修改",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDtl(row);
+            },
+          },
+          {
+            attrs: {
+              label: "删除",
+              type: "danger",
+              text: true,
+            },
+            el: "button",
+            click() {},
+          },
+        ];
+      },
+    },
+  ];
+});
 
 let formData = reactive({
   data: {},
@@ -279,127 +280,126 @@ const formOption = reactive({
 const byform = ref(null);
 const treeListData = ref([]);
 const formConfig = computed(() => {
-	return [
-		{
-			type: 'treeSelect',
-			prop: 'parentId',
-			label: '上级机构',
-			data: [],
-		},
-		{
-			type: 'input',
-			prop: 'deptName',
-			label: '机构名称',
-			required: true,
-			itemWidth: 50,
-			//disabled:true,
-			itemType: 'text',
-		},
+  return [
+    {
+      type: "treeSelect",
+      prop: "parentId",
+      label: "上级机构",
+      data: [],
+    },
+    {
+      type: "input",
+      prop: "deptName",
+      label: "机构名称",
+      required: true,
+      itemWidth: 50,
+      //disabled:true,
+      itemType: "text",
+    },
 
-		{
-			type: 'select',
-			prop: 'type',
-			label: '机构类型',
-			required: true,
+    {
+      type: "select",
+      prop: "type",
+      label: "机构类型",
+      required: true,
 
-			data: [
-				{
-					label: '公司',
-					id: 0,
-				},
-				{
-					label: '业务中心',
-					id: 1,
-				},
-				{
-					label: '部门',
-					id: 2,
-				},
-				{
-					label: '组',
-					id: 3,
-				},
-			],
-		},
-		{
-			type: 'select',
-			label: '负责人',
-			prop: 'leaderId',
-			itemWidth: 50,
-			isLoad: {
-				url: '/tenantUser/list?pageNum=1&pageSize=10000',
-				labelKey: 'userName',
-				labelVal: 'userId',
-				method: 'get',
-				resUrl: 'rows',
-			},
-		},
-		{
-			type: 'select',
-			label: '总监',
-			prop: 'directorId',
-			itemWidth: 50,
-			isLoad: {
-				url: '/tenantUser/list?pageNum=1&pageSize=10000',
-				labelKey: 'userName',
-				labelVal: 'userId',
-				method: 'get',
-				resUrl: 'rows',
-			},
-		},
-		{
-			type: 'input',
-			prop: 'orderNum',
-			label: '排序',
-			required: true,
-			itemWidth: 50,
-			//disabled:true,
-			itemType: 'number',
-		},
-	]
-})
+      data: [
+        {
+          label: "公司",
+          id: 0,
+        },
+        {
+          label: "业务中心",
+          id: 1,
+        },
+        {
+          label: "部门",
+          id: 2,
+        },
+        {
+          label: "组",
+          id: 3,
+        },
+      ],
+    },
+    {
+      type: "select",
+      label: "负责人",
+      prop: "leaderId",
+      itemWidth: 50,
+      isLoad: {
+        url: "/tenantUser/list?pageNum=1&pageSize=10000",
+        labelKey: "userName",
+        labelVal: "userId",
+        method: "get",
+        resUrl: "rows",
+      },
+    },
+    {
+      type: "select",
+      label: "总监",
+      prop: "directorId",
+      itemWidth: 50,
+      isLoad: {
+        url: "/tenantUser/list?pageNum=1&pageSize=10000",
+        labelKey: "userName",
+        labelVal: "userId",
+        method: "get",
+        resUrl: "rows",
+      },
+    },
+    {
+      type: "input",
+      prop: "orderNum",
+      label: "排序",
+      required: true,
+      itemWidth: 50,
+      //disabled:true,
+      itemType: "number",
+    },
+  ];
+});
 const newPassword = () => {
-	formData.data.password = generatePassword()
-}
+  formData.data.password = generatePassword();
+};
 const generatePassword = () => {
-	var length = 12,
-		charset =
-			'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',
-		password = ''
-	for (var i = 0, n = charset.length; i < length; ++i) {
-		password += charset.charAt(Math.floor(Math.random() * n))
-	}
-	return password
-}
+  var length = 12,
+    charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
+    password = "";
+  for (var i = 0, n = charset.length; i < length; ++i) {
+    password += charset.charAt(Math.floor(Math.random() * n));
+  }
+  return password;
+};
 
 const getTreeList = () => {
-	proxy.post('/tenantInfo/list').then((message) => {
-		message.map((item) => {
-			item.label = item.enterpriseName
-			item.id = item.tenantId
-			item.children = []
-		})
+  proxy.post("/tenantInfo/list").then((message) => {
+    message.map((item) => {
+      item.label = item.enterpriseName;
+      item.id = item.tenantId;
+      item.children = [];
+    });
 
-		treeListData.value = message
-		console.log(treeListData.value)
-	})
-}
+    treeListData.value = message;
+    console.log(treeListData.value);
+  });
+};
 const getList = async (req) => {
-	sourceList.value.pagination = { ...sourceList.value.pagination, ...req }
-	loading.value = true
-	proxy
-		.get('/tenantDept/list', sourceList.value.pagination)
-		.then((message) => {
-			recursive(message.data)
-
-			sourceList.value.data = proxy.handleTree(message.data, 'deptId')
-			console.log(sourceList.value)
-			formConfig.value[0].data = proxy.handleTree(message.data, 'deptId')
-			setTimeout(() => {
-				loading.value = false
-			}, 200)
-		})
-}
+  if (req) {
+    req.deptName = req.keyword;
+  }
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy.get("/tenantDept/list", sourceList.value.pagination).then((message) => {
+    recursive(message.data);
+    sourceList.value.data = proxy.handleTree(message.data, "deptId");
+    console.log(sourceList.value);
+    formConfig.value[0].data = proxy.handleTree(message.data, "deptId");
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
 
 const treeChange = (e) => {
   sourceList.value.pagination.tenantId = e.id;
@@ -407,13 +407,13 @@ const treeChange = (e) => {
 };
 
 const handleAdd = (row) => {
-	dialogVisible.value = true;
-	modalType.value = "add";
-	console.log(row)
-	formData.data = {
-		parentId: row.deptId,
-		tenantId: row.tenantId,
-	};
+  dialogVisible.value = true;
+  modalType.value = "add";
+  console.log(row);
+  formData.data = {
+    parentId: row.deptId,
+    tenantId: row.tenantId,
+  };
 };
 
 const openModal = () => {
@@ -433,72 +433,78 @@ const select = (_selection, row) => {
 
 const tree = ref(null);
 const submitForm = () => {
-	byform.value.handleSubmit((valid) => {
-		const method = modalType.value == 'add' ? 'POST' : 'PUT'
-		console.log(method)
-		if(!formData.data.parentId) formData.data.parentId = 0
-		proxy
-			.post(
-				'/tenantDept',
-				{
-					...formData.data,
-					tenantId: formData.data.tenantId ? formData.data.tenantId : sourceList.value.pagination.tenantId,
-				},
-				method
-			)
-			.then((res) => {
-				ElMessage({
-					message: modalType.value == 'add' ? '添加成功' : '编辑成功',
-					type: 'success',
-				})
-				dialogVisible.value = false
-				getList()
-			})
-	})
-}
+  byform.value.handleSubmit((valid) => {
+    const method = modalType.value == "add" ? "POST" : "PUT";
+    console.log(method);
+    if (!formData.data.parentId) formData.data.parentId = 0;
+    proxy
+      .post(
+        "/tenantDept",
+        {
+          ...formData.data,
+          tenantId: formData.data.tenantId
+            ? formData.data.tenantId
+            : sourceList.value.pagination.tenantId,
+        },
+        method
+      )
+      .then((res) => {
+        ElMessage({
+          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        getList();
+      });
+  });
+};
 
 const recursive = (data) => {
-	data.map((item) => {
-		item.label = item.deptName
-		item.id = item.deptId
-		if (item.children) {
-			recursive(item.children)
-		} else {
-			item.children = []
-		}
-	})
-}
+  data.map((item) => {
+    item.label = item.deptName;
+    item.id = item.deptId;
+    if (item.children) {
+      recursive(item.children);
+    } else {
+      item.children = [];
+    }
+  });
+};
 
 const listDelete = (row) => {
-	// 弹窗提示是否删除
-	ElMessageBox.confirm('此操作将永久删除该数据, 是否继续?', '提示', {
-		confirmButtonText: '确定',
-		cancelButtonText: '取消',
-		type: 'warning',
-	}).then(() => {
-		// 删除
-		proxy
-			.post(
-				'/tenantDept/' + row.deptId,{},'delete'
-			)
-			.then((res) => {
-				ElMessage({
-					message: '删除成功',
-					type: 'success',
-				})
-				getList()
-			})
-	})
-}
-
+  // 弹窗提示是否删除
+  ElMessageBox.confirm("此操作将永久删除该数据, 是否继续?", "提示", {
+    confirmButtonText: "确定",
+    cancelButtonText: "取消",
+    type: "warning",
+  }).then(() => {
+    // 删除
+    proxy.post("/tenantDept/" + row.deptId, {}, "delete").then((res) => {
+      ElMessage({
+        message: "删除成功",
+        type: "success",
+      });
+      getList();
+    });
+  });
+};
+const showType = (type) => {
+  return type == "0"
+    ? "公司"
+    : type == "1"
+    ? "业务中心"
+    : type == "2"
+    ? "部门"
+    : "组";
+};
 const getDtl = (row) => {
-	formData.data = { ...row }
-	modalType.value = 'edit'
-	console.log(modalType.value)
-	dialogVisible.value = true
-}
-getTreeList()
-getList()
+  formData.data = { ...row };
+  modalType.value = "edit";
+  console.log(modalType.value);
+  dialogVisible.value = true;
+};
+getTreeList();
+getList();
 </script>
   
 <style lang="scss" scoped>