Browse Source

Merge branch 'master' of http://36.137.93.232:3000/hf/byte-sailing-new

cz 2 years ago
parent
commit
d0116c8bea

+ 1 - 1
src/assets/styles/element-ui.scss

@@ -121,7 +121,7 @@
 }
 
 .el-form-item{
-  padding: 0!important;
+  // padding: 0!important;
 }
 
 .el-form-item__label{

+ 30 - 0
src/components/byForm/index.vue

@@ -36,6 +36,36 @@
           :min="i.min"
           :maxlength="i.maxlength"
         />
+        <el-input
+          v-if="i.type == 'selectInput'"
+          v-model="formData[i.prop]"
+          :placeholder="i.placeholder || '请输入'"
+          @input="(e) => commonsEmit(e, i)"
+          :type="i.itemType ? i.itemType : 'text'"
+          :disabled="i.disabled ? i.disabled : false"
+          :max="i.max"
+          :min="i.min"
+          :maxlength="i.maxlength"
+        >
+          <template #prepend>
+            <el-select
+              v-model="formData[i.selectProp]"
+              :placeholder="i.selectPlaceholder || '请选择'"
+              @change="(e) => commonsEmit(e, i)"
+              :disabled="i.disabled ? i.disabled : false"
+              style="width:80px"
+              
+            >
+              <el-option
+                :label="j.title || j.name || j.label"
+                :value="j.id || j.value"
+                v-for="j in i.data"
+                :key="j.id"
+              >
+              </el-option>
+            </el-select>
+          </template>
+        </el-input>
         <el-select
           v-model="formData[i.prop]"
           :multiple="i.multiple || false"

+ 20 - 1
src/components/byTable/demo.vue

@@ -307,7 +307,26 @@ const formConfig = computed(() => {
       slotName: "slot",
       label: "插槽",
     },
-
+    {
+      type: "selectInput",
+      label: "交易金额",
+      itemWidth: 60,
+      data:[],
+      placeholder: "请输入",
+      selectPlaceholder: "币种",
+      selectProp: "currency",
+      isLoad: {
+        url: "/supplierInfo/page",
+        req: {
+          pageNum: 1,
+          pageSize: 9999,
+        },
+        labelKey: "name",
+        labelVal: "id",
+        method: "post",
+        resUrl: "rows",
+      },
+    },
     {
       //使用此功能需要初始化prop数据至少是对象
       type: "json",

+ 3 - 6
src/views/finance/fundManage/accountPayment/index.vue

@@ -217,7 +217,7 @@ const config = computed(() => {
 				return [
 					{
 						attrs: {
-							label: '修改',
+							label: '查看',
 							type: 'primary',
 							text: true,
 						},
@@ -453,11 +453,8 @@ const getTreeList = () => {
 
 const getDtl = (row) => {
 	modalType.value = 'edit'
-	proxy.post('/productInfo/detail', { id: row.id }).then((res) => {
-		fileList.value = row.fileList.map((x) => ({ ...x, url: x.fileUrl }))
-		fileListCopy.value = [...fileList.value]
-		res.type = res.type + ''
-		res.definition = '2'
+	proxy.post('/accountPayment/detail', { id: row.id }).then((res) => {
+		
 		formData.data = res
 		dialogVisible.value = true
 	})

+ 426 - 0
src/views/finance/fundManage/depExpenses/index.vue

@@ -0,0 +1,426 @@
+<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="[]"
+        @get-list="getList"
+      >
+        <template #phoneNumber="{ item }">
+          <div>
+            <span v-for="(x, index) in getTypeData(item, 0)">
+              {{ x.contactNumber }}
+              <span v-if="index < getTypeData(item, 0).length - 1">,</span>
+            </span>
+          </div>
+        </template>
+        <template #email="{ item }">
+          <div>
+            <span v-for="(x, index) in getTypeData(item, 1)">
+              {{ x.contactNumber }}
+              <span v-if="index < getTypeData(item, 1).length - 1">,</span>
+            </span>
+          </div>
+        </template>
+      </byTable>
+    </div>
+    <el-dialog
+      :title="modalType == 'add' ? '添加IoT平台' : '编辑'"
+      v-model="dialogVisible"
+      width="600"
+      v-loading="loading"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.data"
+        :rules="rules"
+        ref="byform"
+      >
+        <template #slot>
+          <div style="width: 100%">
+            <el-button type="primary" @click="addRow"> 添加 </el-button>
+            <el-form
+              ref="tableForm"
+              :model="formData.data"
+              :rules="rules"
+              label-width="0px"
+              style="margin-top: 15px"
+            >
+              <el-table :data="formData.data.internalAddressBookList">
+                <el-table-column prop="type" label="部门">
+                  <template #default="{ row, $index }">
+                    <el-form-item
+                      :prop="'internalAddressBookList.' + $index + '.type123'"
+                      :rules="rules.type"
+                      :inline-message="true"
+                    >
+                      <el-select v-model="row.type" placeholder="请选择">
+                        <el-option
+                          v-for="item in contactInformationType"
+                          :label="item.dictValue"
+                          :value="item.dictKey"
+                        >
+                        </el-option>
+                      </el-select>
+                    </el-form-item>
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  prop="contactNumber"
+                  label="分拆金额"
+                  
+                >
+                  <template #default="{ row, $index }">
+                    <el-form-item
+                      :prop="
+                        'internalAddressBookList.' + $index + '.type456'
+                      "
+                      :rules="rules.contactNumber"
+                      :inline-message="true"
+                    >
+                      <el-input
+                        v-model="row.contactNumber"
+                        placeholder="请输入"
+                      />
+                    </el-form-item>
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  prop="contactNumber"
+                  label="备注"
+                  
+                >
+                  <template #default="{ row, $index }">
+                    <el-form-item
+                      :prop="
+                        'internalAddressBookList.' + $index + '.type789'
+                      "
+                      :rules="rules.contactNumber"
+                      :inline-message="true"
+                    >
+                      <el-input
+                        v-model="row.contactNumber"
+                        placeholder="请输入"
+                      />
+                    </el-form-item>
+                  </template>
+                </el-table-column>
+                <el-table-column prop="zip" label="操作" width="100">
+                  <template #default="{ $index }">
+                    <el-button type="primary" link @click="handleRemove($index)"
+                      >删除</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";
+import useUserStore from "@/store/modules/user";
+
+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({
+  type: [{ required: true, message: "请选择类型", trigger: "change" }],
+  contactNumber: [
+    { required: true, message: "请输入联系号码", trigger: "blur" },
+  ],
+});
+const { proxy } = getCurrentInstance();
+const selectConfig = [];
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "归属部门",
+      },
+      render(row) {
+        return row.dept.deptName;
+      },
+    },
+    {
+      attrs: {
+        label: "资金账户",
+        prop: "deptId",
+      },
+    },
+    {
+      attrs: {
+        label: "交易时间",
+        prop: "nickName",
+      },
+    },
+    {
+      attrs: {
+        type: "slot",
+        slot: "phoneNumber",
+        label: "交易金额",
+      },
+    },
+    {
+      attrs: {
+        slot: "email",
+        label: "对方账户",
+      },
+    },
+    {
+      attrs: {
+        slot: "email",
+        label: "对方银行",
+      },
+    },
+    {
+      attrs: {
+        slot: "email",
+        label: "对方账号",
+      },
+    },
+    {
+      attrs: {
+        slot: "email",
+        label: "摘要",
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "100",
+        align: "right",
+      },
+      // 渲染 el-button,一般用在最后一列。
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "分析",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDtl(row);
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+
+let formData = reactive({
+  data: {
+    type: "1",
+  },
+  treeData: [],
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const byform = ref(null);
+const treeData = ref([]);
+const formConfig = computed(() => {
+  return [
+    {
+      type: "input",
+      prop: "deptName",
+      label: "选择账户",
+      disabled: true,
+    },
+    {
+      type: "date",
+      prop: "nickName",
+      label: "交易时间",
+      disabled: true,
+    },
+    {
+      type: "select",
+      label: "交易金额",
+      itemWidth: 20,
+      data:[]
+    },
+    {
+      type: "selectInput",
+      label: "交易金额",
+      itemWidth: 60,
+      data:[],
+      placeholder: "请输入",
+      selectPlaceholder: "币种",
+      selectProp: "currency",
+      isLoad: {
+        url: "/supplierInfo/page",
+        req: {
+          pageNum: 1,
+          pageSize: 9999,
+        },
+        labelKey: "name",
+        labelVal: "id",
+        method: "post",
+        resUrl: "rows",
+      },
+    },
+    {
+      type: "input",
+      prop: "deptName",
+      label: "摘要",
+      disabled: true,
+      itemType: "textarea",
+    },
+    {
+      type:'slot',
+      label:'拆分明细',
+      slotName: "slot",
+    }
+  ];
+});
+
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy
+    .post("/accountDeptRunningWater/page", sourceList.value.pagination)
+    .then((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 = {};
+};
+openModal()
+
+const submitForm = () => {
+  byform.value.handleSubmit((valid) => {
+    submitLoading.value = true;
+    proxy.post("/internalAddressBook/" + 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("/internalAddressBook/detail", { userId: row.userId })
+    .then((res) => {
+      res.forEach((x) => {
+        x.type = x.type + "";
+      });
+      formData.data = {
+        deptName: row.dept.deptName,
+        nickName: row.nickName,
+        internalAddressBookList: res,
+        userId: row.userId,
+      };
+      dialogVisible.value = true;
+    });
+};
+
+const addRow = () => {
+  console.log(formData.data)
+  formData.data.internalAddressBookList = []
+  formData.data.internalAddressBookList.push({
+    type789: "",
+    type456: "",
+    type123: "",
+  });
+};
+
+const handleRemove = (index) => {
+  formData.data.internalAddressBookList.splice(index, 1);
+  return ElMessage({
+    message: "删除成功!",
+    type: "success",
+  });
+};
+
+const contactInformationType = ref([]);
+const getDict = () => {
+  const tenantId = useUserStore().user.tenantId;
+  proxy
+    .post("/dictTenantData/page", {
+      pageNum: 1,
+      pageSize: 999,
+      tenantId: tenantId,
+      dictCode: "contact_information",
+    })
+    .then((res) => {
+      contactInformationType.value = res.rows;
+    });
+};
+
+const getTypeData = (item, type) => {
+  if (item.internalAddressBookList)
+    return item.internalAddressBookList.filter((x) => x.type === type) || [];
+};
+
+//getList();
+getDict();
+</script>
+  
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+</style>

+ 335 - 0
src/views/process/dealWith/index.vue

@@ -0,0 +1,335 @@
+<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="400"
+			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 } from 'vue'
+const loading = ref(false)
+const submitLoading = ref(false)
+const dictCommonModal = ref(false)
+const sourceList = ref({
+	data: [],
+	pagination: {
+		total: 3,
+		pageNum: 1,
+		pageSize: 10,
+        status:1,
+	},
+})
+let dialogVisible = ref(false)
+let roomDialogVisible = ref(false)
+let modalType = ref('add')
+let rules = ref({
+	classifyName: [
+		{ required: true, message: '请输入功能模块', trigger: 'blur' },
+	],
+	flowKey: [{ required: true, message: '请输入流程标识', trigger: 'blur' }],
+	flowName: [{ required: true, message: '请输入流程名称', trigger: 'blur' }],
+})
+const { proxy } = getCurrentInstance()
+const selectConfig = computed(() => {
+	return [
+        {
+			label: '流程类型',
+			prop: 'flowInfoId',
+			data: [],
+		},
+		{
+			label: '流程状态',
+			prop: 'status',
+			data: [
+				{
+					label: '待处理',
+					value: '1',
+				},
+				{
+					label: '已发起',
+					value: '2',
+				},
+                {
+                    label: '已处理',
+                    value: '3',
+                },
+			],
+		},
+	]
+})
+const config = computed(() => {
+	return [
+		{
+			attrs: {
+				label: '流程类型',
+				prop: 'flowName',
+			},
+		},
+		{
+			attrs: {
+				label: '流程标题',
+				prop: 'title',
+			},
+		},
+
+		{
+			attrs: {
+				label: '处理类型',
+				width: 100,
+				prop: 'status',
+			},
+			render(status) {
+				return status == 0 || status == 1 ? '待处理' : status == 2 ? '已通过' : '已驳回'
+			},
+		},
+		{
+			attrs: {
+				label: '发起人',
+				prop: 'createUserName',
+			},
+		},
+		{
+			attrs: {
+				label: '发起时间',
+				prop: 'createTime',
+			},
+		},
+		{
+			attrs: {
+				label: '操作',
+				width: '200',
+				align: 'right',
+			},
+			// 渲染 el-button,一般用在最后一列。
+			renderHTML(row) {
+				return [
+					{
+                        attrs: {
+                            label: row.status == 0 || row.status == 1 ? '办理' : '查看',
+                            type: 'primary',
+                            text: true,
+                            bg: true,
+                            disabled: false,
+                        },
+                        el: 'button',
+                        click() {
+                            proxy.$router.replace({
+                                path: "/platform_manage/process/processApproval",
+                                query: {
+                                    flowKey: row.flowKey,
+                                    ids: row.id,
+                                },
+                            });
+                            
+                        },
+                    } 
+						
+				]
+			},
+		},
+	]
+})
+let dtlData = reactive({
+	data: {},
+})
+let formData = reactive({
+	data: {},
+	treeData: [],
+})
+const formOption = reactive({
+	inline: true,
+	labelWidth: 100,
+	itemWidth: 100,
+	rules: [],
+})
+const byform = ref(null)
+const treeData = ref([])
+const formConfig = computed(() => {
+	return [
+		{
+			type: 'input',
+			prop: 'classifyName',
+			label: '功能模块',
+		},
+		{
+			type: 'input',
+			prop: 'flowKey',
+			label: '流程标识',
+			isHide: modalType.value == 'edit',
+		},
+		{
+			type: 'input',
+			prop: 'flowName',
+			label: '流程名称',
+		},
+	]
+})
+
+const flowJump = (row,type) => {
+    proxy.post('/flowProcess/jump', {flowId:row.id,handleType:type,version:row.version,data:{}}).then((message) => {
+        console.log(message)
+        if(message){
+            ElMessage.success('操作成功')
+            getList()
+        }
+    })
+}
+
+const getFlowType = () => {
+    proxy
+        .post('/flowExample/getFlowType')
+            .then((message) => {
+                console.log(message)
+                selectConfig.value[0].data = message.map((item) => {
+                    return {
+                        label: item.flowName,
+                        value: item.id,
+                    }
+                })
+            })
+        
+}
+getFlowType()
+const getUrlObj = {
+    1:'/flowExample/getToBeProcessedPage',
+    2:'/flowExample/getHaveInitiatedPage',
+    3:'/flowExample/getProcessedPage',
+}
+const getList = async (req) => {
+	sourceList.value.pagination = { ...sourceList.value.pagination, ...req }
+	loading.value = true
+	proxy
+		.post( getUrlObj[sourceList.value.pagination.status], 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 selection = ref({
+	data: [],
+})
+const select = (_selection, row) => {
+	selection.value.data = _selection
+	console.log(_selection.length)
+}
+
+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 = () => {
+	byform.value.handleSubmit((valid) => {
+		submitLoading.value = true
+		proxy
+			.post('/flowInfo/' + modalType.value, formData.data)
+			.then((res) => {
+				ElMessage({
+					message: modalType.value == 'add' ? '添加成功' : '编辑成功',
+					type: 'success',
+				})
+				dialogVisible.value = false
+				submitLoading.value = false
+				getList()
+			})
+	})
+}
+
+const getDtl = (row) => {
+	formData.data = { ...row }
+	modalType.value = 'edit'
+	dialogVisible.value = true
+}
+
+const changeStatus = (row) => {
+	modalType.value = 'edit'
+	proxy
+		.post('/flowInfo/edit', { ...row, status: row.status === 0 ? 1 : 0 })
+		.then((res) => {
+			ElMessage({
+				message: '操作成功',
+				type: 'success',
+			})
+			getList()
+		})
+}
+
+getList()
+</script>
+    
+  <style lang="scss" scoped>
+.tenant {
+	padding: 20px;
+}
+</style>

+ 1 - 1
src/views/process/flowExample/index.vue

@@ -161,7 +161,7 @@ const config = computed(() => {
 								},
 								el: 'button',
 								click() {
-									flowJump(row)
+									
 								},
 						  }: {},
                     row.status == 1?   

+ 14 - 10
src/views/product/product/index.vue

@@ -119,7 +119,7 @@ import { ElMessage, ElMessageBox } from "element-plus";
 import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
 import treeList from "@/components/product/treeList";
-
+import useUserStore from '@/store/modules/user'
 import { computed, defineComponent, ref } from "vue";
 const loading = ref(false);
 const submitLoading = ref(false);
@@ -328,16 +328,20 @@ const formConfig = computed(() => {
       prop: "unit",
       label: "单位",
       required: true,
-      data: [
-        {
-          label: "个",
-          id: "个",
-        },
-        {
-          label: "双",
-          id: "双",
+      data: [],
+      isLoad: {
+        url: "/dictTenantData/page",
+        labelKey: "dictValue",
+        labelVal: "dictKey",
+        method: "post",
+        req: {
+          pageNum: 1,
+          pageSize: 999,
+          dictCode: "unit",
+          tenantId: useUserStore().user.tenantId,
         },
-      ],
+        resUrl: "rows",
+      },
     },
     {
       type: "slot",

+ 539 - 0
src/views/product/product/index2.vue

@@ -0,0 +1,539 @@
+<template>
+  <div class="user">
+    <div class="tree">
+      <treeList
+        title="产品分类"
+        submitType="1"
+        :data="treeListData"
+        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 #pic="{ item }">
+          <div v-if="item.fileList.length > 0">
+            <img
+              :src="item.fileList[0].fileUrl"
+              class="pic"
+              @click="handleClickFile(item.fileList[0])"
+            />
+          </div>
+          <div v-else></div>
+        </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"
+      >
+        <template #productPic>
+          <div>
+            <el-upload
+              v-model:fileList="fileList"
+              action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
+              :data="uploadData"
+              list-type="picture-card"
+              :on-remove="handleRemove"
+              :on-success="handleSuccess"
+              :before-upload="handleBeforeUpload"
+            >
+              <el-icon><Plus /></el-icon>
+            </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>
+    <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 "@/components/product/treeList";
+import useUserStore from '@/store/modules/user'
+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",
+        slot: "pic",
+      },
+    },
+    {
+      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();
+                  });
+              });
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+
+const uploadData = ref({});
+const fileList = ref([]);
+const fileListCopy = ref([]);
+
+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: [],
+      isLoad: {
+        url: "/dictTenantData/page",
+        labelKey: "dictValue",
+        labelVal: "dictKey",
+        method: "post",
+        req: {
+          pageNum: 1,
+          pageSize: 999,
+          dictCode: "unit",
+          tenantId: useUserStore().user.tenantId,
+        },
+        resUrl: "rows",
+      },
+    },
+    {
+      type: "slot",
+      slotName: "productPic",
+      prop: "fileList",
+      label: "产品图片",
+    },
+    {
+      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.map((x) => ({ ...x, fileList: [] }));
+      sourceList.value.pagination.total = message.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+
+      const productIdList = message.rows.map((x) => x.id);
+      // 请求文件数据并回显
+      if (productIdList.length > 0) {
+        proxy
+          .post("/fileInfo/getList", { businessIdList: productIdList })
+          .then((fileObj) => {
+            for (let i = 0; i < sourceList.value.data.length; i++) {
+              const e = sourceList.value.data[i];
+              for (const key in fileObj) {
+                if (e.id === key) {
+                  e.fileList = fileObj[key];
+                }
+              }
+            }
+          });
+      }
+    });
+};
+
+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: [],
+    standardJson: {},
+  };
+
+  fileList.value = [];
+  fileListCopy.value = [];
+};
+
+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) => {
+    formData.data.fileList = fileListCopy.value.map((x) => ({
+      id: x.id,
+      fileName: x.fileName,
+    }));
+    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) => {
+      treeListData.value = message;
+      formConfig.value[0].data = message;
+    });
+};
+
+const getDtl = (row) => {
+  modalType.value = "edit";
+  proxy.post("/productInfo/detail", { id: row.id }).then((res) => {
+    fileList.value = row.fileList.map((x) => ({ ...x, url: x.fileUrl }));
+    fileListCopy.value = [...fileList.value];
+    res.type = res.type + ""; //type回显
+    res.definition = "1"; //产品
+    res.standardJson = JSON.parse(res.standardJson);
+    formData.data = res;
+    dialogVisible.value = true;
+  });
+};
+getTreeList();
+getList();
+const handleBeforeUpload = async (file) => {
+  const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
+  uploadData.value = res.uploadBody;
+  fileListCopy.value.push({
+    id: res.id,
+    fileName: res.fileName,
+    path: res.fileUrl,
+    url: res.fileUrl,
+    uid: file.uid,
+  });
+};
+
+const handleSuccess = (res, file, files) => {
+  // 查当前file的index值去赋值对应的copy变量的值
+  // let uid = file.uid;
+  // const index = fileList.value.findIndex((x) => x.uid === uid);
+  // fileListCopy.value[index].uid = uid;
+};
+
+const handleRemove = (file) => {
+  const index = fileListCopy.value.findIndex(
+    (x) => x.uid === file.uid || x.id === file.id
+  );
+  fileListCopy.value.splice(index, 1);
+};
+
+const handleClickFile = (file) => {
+  window.open(file.fileUrl, "_blank");
+};
+</script>
+  
+<style lang="scss" scoped>
+.user {
+  padding: 20px;
+  display: flex;
+  justify-content: space-between;
+  .tree {
+    width: 300px;
+  }
+  .content {
+    width: calc(100% - 320px);
+  }
+}
+.pic {
+  object-fit: contain;
+  width: 50px;
+  height: 50px;
+  cursor: pointer;
+  vertical-align: middle;
+}
+</style>