Forráskód Böngészése

多公司配置页面

cz 2 éve
szülő
commit
be3bb36470

+ 355 - 0
src/components/process/SendFunds.vue

@@ -0,0 +1,355 @@
+<template>
+  <div>
+    <el-form
+      :model="formData.data"
+      :rules="rules"
+      ref="formDom"
+      label-position="top"
+    >
+      <div class="_t">基础信息</div>
+      <el-row>
+        <el-col :span="6">
+          <el-form-item label="归属公司" prop="supplyId">
+            <el-select
+              v-model="formData.data.supplyId"
+              placeholder="请选择"
+              @change="handleChangeSupplier"
+              filterable
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in companyData"
+                :label="item.name"
+                :value="item.id"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="归属部门" prop="purchaseName">
+            <el-input v-model="formData.data.purchaseName" placeholder="请输入">
+            </el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row>
+        <el-col :span="6">
+          <el-form-item label="请款类型" prop="supplyId">
+            <el-select
+              v-model="formData.data.supplyId"
+              placeholder="请选择"
+              @change="handleChangeSupplier"
+              filterable
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in companyData"
+                :label="item.name"
+                :value="item.id"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="币种" prop="supplyId">
+            <el-select
+              v-model="formData.data.supplyId"
+              placeholder="请选择"
+              @change="handleChangeSupplier"
+              filterable
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in companyData"
+                :label="item.name"
+                :value="item.id"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row>
+        <el-col :span="6">
+          <el-form-item label="用款时间" prop="purchaseTime">
+            <el-date-picker
+              v-model="formData.data.purchaseTime"
+              type="datetime"
+              placeholder="请选择"
+              value-format="YYYY-MM-DD HH:mm:ss"
+            />
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-form-item label="用款说明" prop="purchaseContent">
+        <el-input
+          v-model="formData.data.purchaseContent"
+          placeholder="请输入"
+          type="textarea"
+        >
+        </el-input>
+      </el-form-item>
+      <div class="_t">请款明细</div>
+      <el-form-item>
+        <el-button
+          type="primary"
+          @click="openProduct = true"
+          style="margin: 10px 0"
+        >
+          添加货品
+        </el-button>
+        <el-table :data="formData.data.purchaseDetailList">
+          <el-table-column prop="count" label="费用类型" min-width="150">
+            <template #default="{ row, $index }">
+              <el-form-item
+                :prop="'purchaseDetailList.' + $index + '.count'"
+                :rules="rules.count"
+                :inline-message="true"
+              >
+                <el-select
+                  v-model="formData.data.supplyId"
+                  placeholder="请选择"
+                  filterable
+                  style="width: 100%"
+                >
+                  <el-option
+                    v-for="item in companyData"
+                    :label="item.name"
+                    :value="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </template>
+          </el-table-column>
+          <el-table-column prop="count" label="款项说明" min-width="150">
+            <template #default="{ row, $index }">
+              <el-form-item
+                :prop="'purchaseDetailList.' + $index + '.count'"
+                :rules="rules.count"
+                :inline-message="true"
+              >
+                <el-input
+                  v-model="row.count"
+                  placeholder="请输入"
+                  type="textarea"
+                />
+              </el-form-item>
+            </template>
+          </el-table-column>
+          <el-table-column prop="count" label="请款金额" min-width="150">
+            <template #default="{ row, $index }">
+              <el-form-item
+                :prop="'purchaseDetailList.' + $index + '.count'"
+                :rules="rules.count"
+                :inline-message="true"
+              >
+                <el-input-number
+                  v-model="row.count"
+                  :precision="4"
+                  :controls="false"
+                  :min="0"
+                  @change="handleChangeAmount"
+                />
+              </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-item>
+      <el-row>
+        <el-col :span="6">
+          <el-form-item label="请款总额" prop="amount">
+            <el-input
+              v-model="formData.data.amount"
+              placeholder="请输入"
+              disabled
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="单据数量" prop="amount">
+            <el-input v-model="formData.data.amount" placeholder="请输入" />
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <div class="_t">收付款信息</div>
+    </el-form>
+  </div>
+</template>
+
+<script setup>
+import { ElMessage, ElMessageBox } from "element-plus";
+import useUserStore from "@/store/modules/user";
+
+const { proxy } = getCurrentInstance();
+
+let formData = reactive({
+  data: {
+    purchaseTime: "",
+    purchaseDetailList: [],
+  },
+});
+let rules = ref({
+  deptName: [{ required: true, message: "请输入采购部门", trigger: "blur" }],
+  purchaseName: [
+    { required: true, message: "请输入采购人名称", trigger: "blur" },
+  ],
+  purchaseTime: [
+    { required: true, message: "请选择采购时间", trigger: "change" },
+  ],
+  supplyId: [{ required: true, message: "请选择供应商", trigger: "change" }],
+  count: [{ required: true, message: "请输入本次采购数量", trigger: "blur" }],
+  price: [{ required: true, message: "请输入单价", trigger: "blur" }],
+  remark: [{ required: true, message: "请输入备注", trigger: "blur" }],
+});
+
+let openProduct = ref(false);
+// 物品相应逻辑
+const handleRemove = (index) => {
+  formData.data.purchaseDetailList.splice(index, 1);
+  return ElMessage({
+    message: "删除成功!",
+    type: "success",
+  });
+};
+
+const pushGoods = (goods) => {
+  const arr = goods.map((x) => ({
+    goodType: x.goodType,
+    productCode: x.code,
+    productName: x.name,
+    productSpec: x.spec,
+    productUnit: x.unit,
+    count: 0,
+    price: 0,
+    bussinessId: x.id,
+    amount: 0,
+  }));
+  formData.data.purchaseDetailList =
+    formData.data.purchaseDetailList.concat(arr);
+  return ElMessage({
+    message: "添加成功!",
+    type: "success",
+  });
+};
+// 提交方法
+const formDom = ref(null);
+const handleSubmit = async () => {
+  const vaild = await formDom.value.validate();
+  if (vaild) {
+    if (formData.data.purchaseDetailList.length > 0) {
+      const list = formData.data.purchaseDetailList;
+      for (let i = 0; i < list.length; i++) {
+        const e = list[i];
+        if (ids.value.length > 0) {
+          if (Number(e.subscribeCount) - Number(e.purchaseCount) > 0) {
+            if (e.count == 0) {
+              ElMessage({
+                message: "本次采购数量不能为0!",
+                type: "info",
+              });
+              return false;
+            }
+          }
+          if (e.count + Number(e.purchaseCount) > Number(e.subscribeCount)) {
+            ElMessage({
+              message: "本次采购数量和已采购数量和不可大于申购数量!",
+              type: "info",
+            });
+            return false;
+          }
+        } else {
+          if (e.count == 0) {
+            ElMessage({
+              message: "本次采购数量不能为0!",
+              type: "info",
+            });
+            return false;
+          }
+        }
+      }
+      return true;
+    }
+    ElMessage({
+      message: "请添加采购明细!",
+      type: "info",
+    });
+    return false;
+  }
+
+  return false;
+};
+// 获取用户信息并赋默认值
+const userInfo = useUserStore().user;
+onMounted(() => {
+  formData.data.purchaseTime = proxy.parseTime(new Date());
+  formData.data.deptName = userInfo.dept.deptName;
+  formData.data.purchaseName = userInfo.nickName;
+  getSupplierList();
+  if (props.queryData.ids) {
+    ids.value = props.queryData.ids.split(",") || [];
+    getDetails();
+  }
+});
+
+// 接收父组件的传值
+const props = defineProps({
+  queryData: String,
+});
+
+const ids = ref([]);
+const getDetails = () => {
+  proxy.post("/subscribeDetail/detail", { ids: ids.value }).then((res) => {
+    formData.data.purchaseDetailList = res.map((x) => ({
+      ...x,
+      subscribeCount: x.count,
+      count: 0,
+      price: null,
+      amount: null,
+    }));
+  });
+};
+// 获取供应商数据
+const companyData = ref([]);
+const getSupplierList = async (req) => {
+  proxy
+    .post("/corporation/page", { pageNum: 1, pageSize: 9999 })
+    .then((res) => {
+      companyData.value = res.rows;
+    });
+};
+
+// 计算采购总金额
+const handleChangeAmount = () => {
+  let sum = 0;
+  for (let i = 0; i < formData.data.purchaseDetailList.length; i++) {
+    const e = formData.data.purchaseDetailList[i];
+    e.amount = e.count * e.price;
+    sum += e.amount;
+  }
+  formData.data.amount = sum;
+};
+// 向父组件暴露
+defineExpose({
+  submitData: formData.data,
+  handleSubmit,
+});
+</script>
+
+
+<style lang="scss" scoped>
+._t {
+  margin-bottom: 5px;
+  font-size: 14px;
+}
+</style>

+ 1 - 0
src/components/process/SendPurchase.vue

@@ -37,6 +37,7 @@
               v-model="formData.data.supplyId"
               placeholder="请选择"
               @change="handleChangeSupplier"
+              filterable
               style="width: 100%"
             >
               <el-option

+ 8 - 0
src/main.js

@@ -44,6 +44,11 @@ import {
   selectDictLabels
 } from '@/utils/ruoyi'
 
+import {
+  dictDataEcho
+}
+from '@/utils/util'
+
 // 分页组件
 import Pagination from '@/components/Pagination'
 // 自定义表格工具组件
@@ -72,6 +77,9 @@ app.config.globalProperties.handleTree = handleTree
 app.config.globalProperties.addDateRange = addDateRange
 app.config.globalProperties.selectDictLabel = selectDictLabel
 app.config.globalProperties.selectDictLabels = selectDictLabels
+//字典回显
+app.config.globalProperties.dictDataEcho = dictDataEcho
+
 
 
 

+ 12 - 0
src/utils/util.js

@@ -0,0 +1,12 @@
+//根据value值回显字典label值
+export function dictDataEcho(value, arr) {
+  if (value && arr) {
+    value = value + ''
+    const current = arr.find(x => x.dictKey === value)
+    if (current != undefined && current.dictValue) {
+      return current.dictValue
+    }
+    return ''
+  }
+  return ''
+}

+ 493 - 0
src/views/finance/fundManage/funds/index.vue

@@ -0,0 +1,493 @@
+<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(),
+          },
+        ]"
+        @get-list="getList"
+      >
+        <template #fileSlot="{ item }">
+          <div
+            style="cursor: pointer; color: #409eff"
+            @click="handleClickFile(item)"
+          >
+            {{ item.fileName }}
+          </div>
+        </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 #address>
+          <el-row :gutter="10" style="width: 100%">
+            <el-col :span="8">
+              <el-select v-model="formData.data.aa" placeholder="国家">
+                <el-option v-for="item in 3" label="ceshi" value="1">
+                </el-option>
+              </el-select>
+            </el-col>
+            <el-col :span="8">
+              <el-select v-model="formData.data.aa" placeholder="省/洲">
+                <el-option v-for="item in 3" label="ceshi" value="1">
+                </el-option>
+              </el-select>
+            </el-col>
+            <el-col :span="8">
+              <el-select v-model="formData.data.aa" placeholder="城市">
+                <el-option v-for="item in 3" label="ceshi" value="1">
+                </el-option>
+              </el-select>
+            </el-col>
+          </el-row>
+          <el-row style="margin-top: 20px; width: 100%">
+            <el-col :span="24">
+              <el-input v-model="formData.data.bb" type="textarea"> </el-input>
+            </el-col>
+          </el-row>
+        </template>
+
+        <template #contact>
+          <el-row :gutter="10" style="width: 100%">
+            <el-col :span="8">
+              <el-input v-model="formData.data.aa" placeholder="联系人">
+              </el-input>
+            </el-col>
+            <el-col :span="16">
+              <el-input v-model="formData.data.aa" placeholder="联系电话">
+              </el-input>
+            </el-col>
+          </el-row>
+        </template>
+
+        <template #fileSlot>
+          <div>
+            <el-upload
+              v-model:fileList="fileList"
+              class="upload-demo"
+              action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
+              :limit="3"
+              :data="uploadData"
+              :on-preview="handlePreview"
+              :on-remove="handleRemove"
+              :on-success="handleSuccess"
+              :before-upload="handleBeforeUpload"
+              accept=".pdf"
+            >
+              <el-button type="primary">选择</el-button>
+              <template #file>
+                <div>
+                  <div style="margin-top: 15px">
+                    <el-tag
+                      class="ml-2"
+                      type="info"
+                      v-for="(item, index) in fileList"
+                      :key="index"
+                      closable
+                      @close="handleClose(index)"
+                      >{{ item.fileName }}</el-tag
+                    >
+                  </div>
+                </div>
+              </template>
+            </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,
+    status: "",
+  },
+});
+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: "productType",
+    data: [
+      {
+        label: "产品",
+        value: "1",
+      },
+      {
+        label: "物料",
+        value: "2",
+      },
+    ],
+  },
+  {
+    label: "状态",
+    prop: "status",
+    data: [
+      {
+        label: "审批中",
+        value: "10",
+      },
+      {
+        label: "待采购",
+        value: "15",
+      },
+      {
+        label: "部分采购",
+        value: "30",
+      },
+      {
+        label: "已采购",
+        value: "20",
+      },
+      {
+        label: "已作废",
+        value: "99",
+      },
+    ],
+  },
+]);
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "申购单号",
+        prop: "subscribeCode",
+      },
+    },
+    {
+      attrs: {
+        label: "货品类型",
+        prop: "productType",
+      },
+      render(productType) {
+        return productType == 1 ? "产品" : "物料";
+      },
+    },
+    {
+      attrs: {
+        label: "所属分类",
+        prop: "productCategory",
+      },
+    },
+    {
+      attrs: {
+        label: "货品编码",
+        prop: "productCode",
+      },
+    },
+    {
+      attrs: {
+        label: "货品名称",
+        prop: "productName",
+      },
+    },
+    {
+      attrs: {
+        label: "单位",
+        prop: "productUnit",
+      },
+    },
+    {
+      attrs: {
+        label: "申购数量",
+        prop: "count",
+      },
+    },
+    {
+      attrs: {
+        label: "状态",
+        prop: "status",
+      },
+    },
+    {
+      attrs: {
+        label: "申购原因",
+        prop: "subscribeContent",
+      },
+    },
+    {
+      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: "radio",
+      prop: "name",
+      label: "供应商类型",
+      required: true,
+      border: true,
+      data: [
+        { label: "贸易商", value: "1" },
+        { label: "工厂", value: "2" },
+      ],
+    },
+    {
+      type: "input",
+      prop: "name",
+      label: "供应商名称",
+      required: true,
+    },
+    {
+      type: "slot",
+      slotName: "address",
+      label: "地址",
+      required: true,
+    },
+    {
+      type: "slot",
+      slotName: "contact",
+      label: "联系信息",
+      required: true,
+    },
+    {
+      type: "slot",
+      slotName: "fileSlot",
+      label: "上传附件",
+    },
+    {
+      type: "input",
+      label: "备注",
+      prop: "remakes",
+      itemType: "textarea",
+    },
+  ];
+});
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy
+    .post("/subscribeDetail/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 = () => {
+  proxy.$router.replace({
+    path: "/platform_manage/process/processApproval",
+    query: {
+      isSubscribe: "10",
+    },
+  });
+};
+
+const submitForm = () => {
+  if (fileList.value.length > 0) {
+    byform.value.handleSubmit((valid) => {
+      formData.data.fileList = fileList.value;
+      submitLoading.value = true;
+      proxy.post("/productionProcesses/" + modalType.value, formData.data).then(
+        (res) => {
+          ElMessage({
+            message: modalType.value == "add" ? "添加成功" : "编辑成功",
+            type: "success",
+          });
+          fileList.value = [];
+          dialogVisible.value = false;
+          submitLoading.value = false;
+          getList();
+        },
+        (err) => {
+          console.log(err, "aswwwww");
+          submitLoading.value = false;
+        }
+      );
+    });
+  } else {
+    return ElMessage({
+      message: "请上传附件!",
+      type: "info",
+    });
+  }
+};
+
+const getDtl = (row) => {
+  modalType.value = "edit";
+  proxy.post("/productionProcesses/detail", { id: row.id }).then((res) => {
+    fileList.value = [
+      {
+        id: "",
+        fileName: res.fileName,
+        path: "",
+      },
+    ];
+    formData.data = res;
+    dialogVisible.value = true;
+  });
+};
+const handleBeforeUpload = async (file) => {
+  const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
+  uploadData.value = res.uploadBody;
+  fileList.value = [
+    {
+      id: res.id,
+      fileName: res.fileName,
+      path: res.fileUrl,
+    },
+  ];
+};
+const handleClickFile = (row) => {
+  ElMessage({
+    message: "数据请求中,请稍后!",
+    type: "success",
+  });
+  let id = row.id;
+  proxy.post("/fileInfo/getList", { businessIdList: [id] }).then((res) => {
+    const file = res[id][0];
+    window.open(file.fileUrl, "_blank");
+  });
+};
+
+const handlePreview = (file) => {
+  console.log(file);
+};
+const handleSuccess = (file) => {
+  console.log(file);
+};
+const handleRemove = (file) => {
+  fileList.value = [];
+};
+const handleClose = (index) => {
+  fileList.value.splice(index, 1);
+};
+getList();
+</script>
+  
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+</style>

+ 7 - 0
src/views/process/processApproval/index.vue

@@ -12,6 +12,11 @@
           v-else-if="queryData.data.isSubscribe == '20'"
           :queryData="queryData.data"
         ></SendPurchase>
+        <SendFunds
+          ref="makeDom"
+          v-else-if="queryData.data.isSubscribe == '30'"
+          :queryData="queryData.data"
+        ></SendFunds>
       </div>
       <div class="bottom">
         <div class="commons-title title">处理意见</div>
@@ -154,6 +159,8 @@ const route = useRoute();
 import SendSubscribe from "@/components/process/SendSubscribe";
 //采购发起
 import SendPurchase from "@/components/process/SendPurchase";
+//请款发起
+import SendFunds from "@/components/process/SendFunds";
 // 消息提示
 import { ElMessage, ElMessageBox } from "element-plus";
 // tab切换逻辑

+ 401 - 0
src/views/publicModule/companyConfig/index.vue

@@ -0,0 +1,401 @@
+<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 #timeSlot="{ item }">
+          {{ item.startDate }} - {{ item.stopDate }}
+        </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 #timeGange>
+          <el-date-picker
+            v-model="formData.data.timeArr"
+            type="daterange"
+            unlink-panels
+            range-separator="To"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            value-format="YYYY-MM-DD"
+          />
+        </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 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,
+  },
+});
+let dialogVisible = ref(false);
+let roomDialogVisible = ref(false);
+let modalType = ref("add");
+let rules = ref({
+  name: [{ required: true, message: "请输入公司名称", trigger: "blur" }],
+});
+const { proxy } = getCurrentInstance();
+const selectConfig = [];
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "公司名称",
+        prop: "name",
+      },
+    },
+    {
+      attrs: {
+        label: "英文名",
+        prop: "nameEn",
+      },
+    },
+    {
+      attrs: {
+        label: "企业类型",
+        prop: "type",
+      },
+      render(type) {
+        return proxy.dictDataEcho(type, enterpriseType.value);
+      },
+    },
+    {
+      attrs: {
+        label: "统一社会信用代码",
+        prop: "uscCode",
+      },
+    },
+    {
+      attrs: {
+        label: "法定代表人",
+        prop: "legalPersonName",
+      },
+    },
+    {
+      attrs: {
+        label: "注册资本",
+        prop: "registeredCapital",
+      },
+    },
+    {
+      attrs: {
+        type: "slot",
+        slot: "timeSlot",
+        label: "营业期限",
+      },
+    },
+    {
+      attrs: {
+        label: "纳税人资质",
+        prop: "taxpayerQualification",
+      },
+      render(type) {
+        return proxy.dictDataEcho(type, contactInformationType.value);
+      },
+    },
+    {
+      attrs: {
+        label: "进出口企业代码",
+        prop: "iaeeCode",
+      },
+    },
+    {
+      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("/corporation/delete", {
+                    id: row.id,
+                  })
+                  .then((res) => {
+                    ElMessage({
+                      message: "删除成功",
+                      type: "success",
+                    });
+                    getList();
+                  });
+              });
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+
+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 = reactive([
+  {
+    type: "input",
+    prop: "name",
+    label: "公司名称",
+    required: true,
+  },
+  {
+    type: "input",
+    prop: "nameEn",
+    label: "英文名",
+  },
+  {
+    type: "select",
+    prop: "type",
+    label: "企业类型",
+  },
+  {
+    type: "input",
+    prop: "uscCode",
+    label: "统一社会信用代码",
+  },
+  {
+    type: "input",
+    prop: "legalPersonName",
+    label: "法定代表人",
+  },
+  {
+    type: "input",
+    prop: "registeredCapital",
+    label: "注册资本",
+  },
+  {
+    type: "slot",
+    slotName: "timeGange",
+    prop: "startDate",
+    label: "营业期限",
+  },
+  {
+    type: "select",
+    prop: "taxpayerQualification",
+    label: "纳税人资质",
+    data: [],
+    //   isLoad: {
+    //   url: "/dictTenantData/page",
+    //   labelKey: "dictValue",
+    //   labelVal: "dictKey",
+    //   method: "post",
+    //   req: {
+    //     pageNum: 1,
+    //     pageSize: 999,
+    //     dictCode: "customer_source",
+    //     tenantId: useUserStore().user.tenantId,
+    //   },
+    //   resUrl: "rows",
+    // },
+  },
+  {
+    type: "input",
+    prop: "iaeeCode",
+    label: "进出口企业代码",
+    required: true,
+  },
+]);
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy
+    .post("/corporation/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 = {
+    timeArr: [],
+  };
+};
+const selection = ref({
+  data: [],
+});
+const select = (_selection, row) => {
+  selection.value.data = _selection;
+  console.log(_selection.length);
+};
+const submitForm = () => {
+  console.log(byform.value);
+  byform.value.handleSubmit((valid) => {
+    if (formData.data.timeArr.length > 0) {
+      formData.data.startDate = formData.data.timeArr[0];
+      formData.data.stopDate = formData.data.timeArr[1];
+    }
+    submitLoading.value = true;
+    proxy.post("/corporation/" + 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) => {
+  dialogVisible.value = true;
+  modalType.value = "edit";
+  proxy.post("/corporation/detail", { id: row.id }).then((res) => {
+    res.timeArr = [res.startDate, res.stopDate];
+    res.type = res.type + "";
+    res.taxpayerQualification = res.taxpayerQualification + "";
+    formData.data = res;
+    console.log(formData.data.timeArr, "ws");
+  });
+};
+
+const enterpriseType = ref([]);
+const contactInformationType = ref([]);
+
+const getDict = () => {
+  const tenantId = useUserStore().user.tenantId;
+  proxy
+    .post("/dictTenantData/page", {
+      pageNum: 1,
+      pageSize: 999,
+      tenantId: tenantId,
+      dictCode: "enterprise_type",
+    })
+    .then((res) => {
+      formConfig[2].data = res.rows.map((x) => ({
+        label: x.dictValue,
+        value: x.dictKey,
+      }));
+      enterpriseType.value = res.rows;
+    });
+
+  proxy
+    .post("/dictTenantData/page", {
+      pageNum: 1,
+      pageSize: 999,
+      tenantId: tenantId,
+      dictCode: "taxpayer_qualification",
+    })
+    .then((res) => {
+      formConfig[7].data = res.rows.map((x) => ({
+        label: x.dictValue,
+        value: x.dictKey,
+      }));
+      contactInformationType.value = res.rows;
+    });
+};
+
+getList();
+getDict();
+</script>
+  
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+</style>

+ 56 - 15
src/views/purchaseManage/purchaseManage/alreadyPurchase/index.vue

@@ -31,7 +31,7 @@
       </byTable>
     </div>
     <el-dialog
-      :title="modalType == 'add' ? '添加供应商' : '编辑供应商'"
+      title="到货通知"
       v-model="dialogVisible"
       width="800"
       v-loading="loading"
@@ -49,8 +49,8 @@
               <el-select
                 v-model="formData.data.supplyId"
                 placeholder="请选择"
-                @change="handleChangeSupplier"
                 style="width: 100%"
+                disabled
               >
                 <el-option
                   v-for="item in supplierData"
@@ -64,8 +64,12 @@
         </el-row>
         <el-row>
           <el-col :span="6">
-            <el-form-item label="采购单号" prop="deptName">
-              <el-input v-model="formData.data.deptName" placeholder="请输入">
+            <el-form-item label="采购单号" prop="code">
+              <el-input
+                v-model="formData.data.code"
+                placeholder="请输入"
+                disabled
+              >
               </el-input>
             </el-form-item>
           </el-col>
@@ -139,7 +143,7 @@ const sourceList = ref({
 let dialogVisible = ref(false);
 let modalType = ref("add");
 let rules = ref({
-  name: [{ required: true, message: "请输入供应商名称", trigger: "blur" }],
+  count: [{ required: true, message: "请输入本次到货", trigger: "blur" }],
 });
 const { proxy } = getCurrentInstance();
 const selectConfig = reactive([
@@ -148,12 +152,16 @@ const selectConfig = reactive([
     prop: "purchaseStatus",
     data: [
       {
-        label: "产品",
-        value: "1",
+        label: "审批中",
+        value: "10",
       },
       {
-        label: "物料",
-        value: "2",
+        label: "已驳回",
+        value: "20",
+      },
+      {
+        label: "已采购",
+        value: "30",
       },
     ],
   },
@@ -262,7 +270,7 @@ const config = computed(() => {
             },
             el: "button",
             click() {
-              dialogVisible.value = true;
+              handleArrival(row);
             },
           },
           {
@@ -365,10 +373,22 @@ const getList = async (req) => {
 const submitForm = async () => {
   formDom.value.validate((vaild) => {
     if (vaild) {
-      ElMessage({
-        message: "请添加申购明细!",
-        type: "info",
-      });
+      const list = formData.data.purchaseDetailList;
+      const total = list.reduce((total, x) => (total += Number(x.e)));
+      if (total < 1) {
+        return ElMessage({
+          message: `本次到货不能为0!`,
+          type: "info",
+        });
+      }
+      let sum = 0;
+      for (let i = 0; i < list.length; i++) {
+        const e = list[i];
+        if (Number(e.x) + Number(e.y) >= Number(e.v)) {
+          sum += 1;
+        }
+      }
+      formData.data.status = sum === list.length ? "10" : "20";
     }
   });
 };
@@ -409,8 +429,29 @@ const handleEdit = (row, status) => {
   });
 };
 
-getList();
+// 获取供应商数据
+const supplierData = ref([]);
+const getSupplierList = async (req) => {
+  proxy
+    .post("/supplierInfo/page", { pageNum: 1, pageSize: 9999 })
+    .then((res) => {
+      supplierData.value = res.rows;
+    });
+};
+const handleArrival = (row) => {
+  proxy.post("/purchase/detail", { id: row.id }).then((res) => {
+    formData.data = {
+      id: row.id,
+      code: res.code,
+      supplyId: res.supplyId,
+      purchaseDetailList: res.purchaseDetailList,
+    };
+    dialogVisible.value = true;
+  });
+};
 
+getList();
+getSupplierList();
 const start = () => {
   proxy.$router.replace({
     path: "/platform_manage/process/processApproval",

+ 0 - 194
src/views/purchaseManage/purchaseManage/arrival/add.vue

@@ -1,194 +0,0 @@
-<template>
-  <div>
-    <el-form
-      :model="formData.data"
-      :rules="rules"
-      ref="formDom"
-      label-position="top"
-    >
-      <div class="_t">申购信息</div>
-      <el-row>
-        <el-col :span="6">
-          <el-form-item label="申购部门" prop="deptName">
-            <el-input v-model="formData.data.deptName" placeholder="请输入">
-            </el-input>
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="申购人" prop="subcribeName">
-            <el-input v-model="formData.data.subcribeName" placeholder="请输入">
-            </el-input>
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="申购时间" prop="subcribeTime">
-            <el-date-picker
-              v-model="formData.data.subcribeTime"
-              type="datetime"
-              placeholder="请选择"
-            />
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <el-form-item label="申购说明" prop="subcribeContent">
-        <el-input
-          v-model="formData.data.subcribeContent"
-          placeholder="请输入"
-          type="textarea"
-        >
-        </el-input>
-      </el-form-item>
-      <div class="_t">申购明细</div>
-      <el-form-item>
-        <el-button
-          type="primary"
-          @click="openProduct = true"
-          style="margin: 10px 0"
-        >
-          添加货品
-        </el-button>
-        <el-table :data="formData.data.subscribeDetailList">
-          <el-table-column
-            prop="goodType"
-            label="货品类型"
-            :formatter="(row) => (row.goodType == 1 ? '产品' : '物料')"
-          />
-          <el-table-column prop="code" label="货品编码" />
-          <el-table-column prop="name" label="货品名称" min-width="150" />
-          <el-table-column prop="spec" label="规格型号" />
-          <el-table-column prop="unit" label="单位" />
-          <el-table-column prop="count" label="申购数量" min-width="150">
-            <template #default="{ row, $index }">
-              <el-form-item
-                :prop="'subscribeDetailList.' + $index + '.count'"
-                :rules="rules.count"
-                :inline-message="true"
-              >
-                <el-input-number
-                  v-model="row.count"
-                  :precision="4"
-                  :controls="false"
-                  :min="1"
-                />
-              </el-form-item>
-            </template>
-          </el-table-column>
-          <el-table-column prop="remark" label="备注" min-width="150">
-            <template #default="{ row, $index }">
-              <el-form-item
-                :prop="'subscribeDetailList.' + $index + '.remark'"
-                :rules="rules.remark"
-                :inline-message="true"
-              >
-                <el-input v-model="row.remark" 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-item>
-    </el-form>
-  </div>
-  <el-dialog v-model="openProduct" title="选择货品" width="70%" append-to-body>
-    <SelectGoods
-      @cancel="openProduct = false"
-      @pushGoods="pushGoods"
-    ></SelectGoods>
-  </el-dialog>
-</template>
-
-<script setup>
-import SelectGoods from "@/components/product/SelectGoods";
-import { ElMessage, ElMessageBox } from "element-plus";
-import useUserStore from "@/store/modules/user";
-
-const { proxy } = getCurrentInstance();
-
-let formData = reactive({
-  data: {
-    subcribeTime: "",
-    subscribeDetailList: [],
-  },
-});
-let rules = ref({
-  deptName: [{ required: true, message: "请输入申购部门", trigger: "blur" }],
-  subcribeName: [
-    { required: true, message: "请输入申购人名称", trigger: "blur" },
-  ],
-  subcribeTime: [
-    { required: true, message: "请选择申购时间", trigger: "change" },
-  ],
-  // subcribeContent: [
-  //   { required: true, message: "请输入申购事由", trigger: "blur" },
-  // ],
-  count: [{ required: true, message: "请输入申购数量", trigger: "blur" }],
-  remark: [{ required: true, message: "请输入备注", trigger: "blur" }],
-});
-
-let openProduct = ref(false);
-
-const handleRemove = (index) => {
-  formData.data.subscribeDetailList.splice(index, 1);
-  return ElMessage({
-    message: "删除成功!",
-    type: "success",
-  });
-};
-
-const pushGoods = (goods) => {
-  const arr = goods.map((x) => ({
-    ...x,
-    bussinessId: x.id,
-    count: "",
-    remark: "",
-  }));
-  formData.data.subscribeDetailList =
-    formData.data.subscribeDetailList.concat(arr);
-  return ElMessage({
-    message: "添加成功!",
-    type: "success",
-  });
-};
-
-const formDom = ref(null);
-const handleSubmit = async () => {
-  const vaild = await formDom.value.validate();
-  if (vaild) {
-    if (formData.data.subscribeDetailList.length > 0) {
-      return true;
-    }
-    ElMessage({
-      message: "请添加申购明细!",
-      type: "info",
-    });
-    return false;
-  }
-
-  return false;
-};
-
-const userInfo = useUserStore().user;
-onMounted(() => {
-  formData.data.subcribeTime = proxy.parseTime(new Date());
-  formData.data.deptName = userInfo.dept.deptName;
-  formData.data.subcribeName = userInfo.nickName;
-});
-
-defineExpose({
-  submitData: formData.data,
-  handleSubmit,
-});
-</script>
-
-<style lang="scss" scoped>
-._t {
-  margin-bottom: 5px;
-  font-size: 14px;
-}
-</style>

+ 124 - 105
src/views/purchaseManage/purchaseManage/arrival/index.vue

@@ -39,7 +39,96 @@
       width="800"
       v-loading="loading"
     >
-      <arrivalAdd></arrivalAdd>
+      <el-form
+        :model="formData.data"
+        :rules="rules"
+        ref="formDom"
+        label-position="top"
+      >
+        <div style="margin-bottom: 10px; font-size: 14px">基础信息</div>
+        <el-row>
+          <el-col :span="8">
+            <el-form-item label="供应商" prop="supplyId">
+              <el-select
+                v-model="formData.data.supplyId"
+                placeholder="请选择"
+                style="width: 100%"
+                disabled
+              >
+                <el-option
+                  v-for="item in supplierData"
+                  :label="item.name"
+                  :value="item.id"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="6">
+            <el-form-item label="采购单号" prop="code">
+              <el-input
+                v-model="formData.data.code"
+                placeholder="请输入"
+                disabled
+              >
+              </el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <div style="margin-bottom: 10px; font-size: 14px">到货明细</div>
+        <el-form-item>
+          <el-table :data="formData.data.purchaseDetailList">
+            <el-table-column
+              prop="goodType"
+              label="货品类型"
+              :formatter="(row) => (row.goodType == 1 ? '产品' : '物料')"
+            />
+            <el-table-column prop="productCode" label="货品编码" />
+            <el-table-column prop="productName" label="货品名称" />
+            <el-table-column prop="productSpec" label="规格型号" />
+            <el-table-column prop="productUnit" label="单位" />
+            <el-table-column prop="productUnit" label="到货数量" />
+            <el-table-column prop="productUnit" label="已质检" />
+            <el-table-column prop="count" label="质检合格" min-width="150">
+              <template #default="{ row, $index }">
+                <el-form-item
+                  :prop="'purchaseDetailList.' + $index + '.count'"
+                  :rules="rules.count"
+                  :inline-message="true"
+                >
+                  <el-input-number
+                    v-model="row.count"
+                    :precision="4"
+                    :controls="false"
+                    :min="0"
+                    @change="handleChangeAmount"
+                  />
+                </el-form-item>
+              </template>
+            </el-table-column>
+            <el-table-column prop="count" label="质检不合格" min-width="150">
+              <template #default="{ row, $index }">
+                <el-form-item
+                  :prop="'purchaseDetailList.' + $index + '.count'"
+                  :rules="rules.count"
+                  :inline-message="true"
+                >
+                  <el-input-number
+                    v-model="row.count"
+                    :precision="4"
+                    :controls="false"
+                    :min="0"
+                    @change="handleChangeAmount"
+                  />
+                </el-form-item>
+              </template>
+            </el-table-column>
+          </el-table>
+        </el-form-item>
+      </el-form>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
         <el-button
@@ -60,7 +149,6 @@
 import { ElMessage, ElMessageBox } from "element-plus";
 import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
-import arrivalAdd from "./add.vue";
 import FileUpload from "@/components/FileUpload/index";
 import { computed, defineComponent, ref } from "vue";
 import { getToken } from "@/utils/auth";
@@ -178,7 +266,6 @@ const config = computed(() => {
         prop: "remarks",
       },
     },
-
     {
       attrs: {
         label: "操作",
@@ -196,7 +283,8 @@ const config = computed(() => {
             },
             el: "button",
             click() {
-              getDtl(row);
+              selectData.value = [row];
+              start();
             },
           },
         ];
@@ -206,9 +294,7 @@ const config = computed(() => {
 });
 
 let formData = reactive({
-  data: {
-    type: "1",
-  },
+  data: {},
 });
 const formOption = reactive({
   inline: true,
@@ -216,51 +302,9 @@ const formOption = reactive({
   itemWidth: 100,
   rules: [],
 });
-const byform = ref(null);
-const formConfig = computed(() => {
-  return [
-    {
-      type: "radio",
-      prop: "name",
-      label: "供应商类型",
-      required: true,
-      border: true,
-      data: [
-        { label: "贸易商", value: "1" },
-        { label: "工厂", value: "2" },
-      ],
-    },
-    {
-      type: "input",
-      prop: "name",
-      label: "供应商名称",
-      required: true,
-    },
-    {
-      type: "slot",
-      slotName: "address",
-      label: "地址",
-      required: true,
-    },
-    {
-      type: "slot",
-      slotName: "contact",
-      label: "联系信息",
-      required: true,
-    },
-    {
-      type: "slot",
-      slotName: "fileSlot",
-      label: "上传附件",
-    },
-    {
-      type: "input",
-      label: "备注",
-      prop: "remakes",
-      itemType: "textarea",
-    },
-  ];
-});
+const formConfig = computed(() => {});
+const formDom = ref(null);
+
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
@@ -275,15 +319,9 @@ const getList = async (req) => {
       }, 200);
     });
 };
-// const openModal = () => {
-//  proxy.$router.push({
-
-//  })
-// };
 
 const submitForm = () => {
-  byform.value.handleSubmit((valid) => {
-    formData.data.fileList = fileList.value;
+  formDom.value.validate((valid) => {
     submitLoading.value = true;
     proxy.post("/productionProcesses/" + modalType.value, formData.data).then(
       (res) => {
@@ -306,53 +344,21 @@ const submitForm = () => {
 
 const getDtl = (row) => {
   modalType.value = "edit";
-  proxy.post("/productionProcesses/detail", { id: row.id }).then((res) => {
-    fileList.value = [
-      {
-        id: "",
-        fileName: res.fileName,
-        path: "",
-      },
-    ];
-    formData.data = res;
-    dialogVisible.value = true;
-  });
-};
-const handleBeforeUpload = async (file) => {
-  const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
-  uploadData.value = res.uploadBody;
-  fileList.value = [
-    {
-      id: res.id,
-      fileName: res.fileName,
-      path: res.fileUrl,
-    },
-  ];
-};
-const handleClickFile = (row) => {
-  ElMessage({
-    message: "数据请求中,请稍后!",
-    type: "success",
-  });
-  let id = row.id;
-  proxy.post("/fileInfo/getList", { businessIdList: [id] }).then((res) => {
-    const file = res[id][0];
-    window.open(file.fileUrl, "_blank");
-  });
-};
+  dialogVisible.value = true;
 
-const handlePreview = (file) => {
-  console.log(file);
-};
-const handleSuccess = (file) => {
-  console.log(file);
-};
-const handleRemove = (file) => {
-  fileList.value = [];
-};
-const handleClose = (index) => {
-  fileList.value.splice(index, 1);
+  // proxy.post("/productionProcesses/detail", { id: row.id }).then((res) => {
+  //   fileList.value = [
+  //     {
+  //       id: "",
+  //       fileName: res.fileName,
+  //       path: "",
+  //     },
+  //   ];
+  //   formData.data = res;
+  //   dialogVisible.value = true;
+  // });
 };
+
 getList();
 const selectData = ref([]);
 const selectRow = (data) => {
@@ -360,7 +366,9 @@ const selectRow = (data) => {
 };
 
 const start = () => {
-  console.log(selectData.value.length, "22");
+  modalType.value = "edit";
+  dialogVisible.value = true;
+  // console.log(selectData.value.length, "22");
   // if (selectData.value.length > 0) {
   // } else {
   //   return ElMessage({
@@ -369,6 +377,17 @@ const start = () => {
   //   });
   // }
 };
+
+// 获取供应商数据
+const supplierData = ref([]);
+const getSupplierList = async (req) => {
+  proxy
+    .post("/supplierInfo/page", { pageNum: 1, pageSize: 9999 })
+    .then((res) => {
+      supplierData.value = res.rows;
+    });
+};
+getSupplierList();
 </script>
   
 <style lang="scss" scoped>

+ 53 - 44
src/views/purchaseManage/supplier/supplier/index.vue

@@ -128,24 +128,23 @@
           <div>
             <el-upload
               v-model:fileList="fileList"
+              :show-file-list="false"
               class="upload-demo"
               action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
-              :limit="3"
               :data="uploadData"
               :on-preview="handlePreview"
               :on-remove="handleRemove"
               :on-success="handleSuccess"
               :before-upload="handleBeforeUpload"
-              accept=".pdf"
             >
               <el-button type="primary">选择</el-button>
-              <template #file>
+              <!-- <template #file>
                 <div>
                   <div style="margin-top: 15px">
                     <el-tag
                       class="ml-2"
                       type="info"
-                      v-for="(item, index) in fileList"
+                      v-for="(item, index) in fileListCopy"
                       :key="index"
                       closable
                       @close="handleClose(index)"
@@ -153,8 +152,22 @@
                     >
                   </div>
                 </div>
-              </template>
+              </template> -->
             </el-upload>
+            <div>
+              <div style="margin-top: 15px">
+                <el-tag
+                  style="margin-right: 10px"
+                  class="ml-2"
+                  type="info"
+                  v-for="(item, index) in fileListCopy"
+                  :key="index"
+                  closable
+                  @close="handleClose(index)"
+                  >{{ item.fileName }}</el-tag
+                >
+              </div>
+            </div>
           </div>
         </template>
       </byForm>
@@ -200,6 +213,8 @@ const sourceList = ref({
 let dialogVisible = ref(false);
 let modalType = ref("add");
 let fileList = ref([]);
+let fileListCopy = ref([]);
+
 const checkContactNumber = (rule, val, callback) => {
   if (val === "") {
     callback(new Error("请输入联系电话"));
@@ -431,16 +446,11 @@ const openModal = () => {
 
 const submitForm = () => {
   byform.value.handleSubmit((valid) => {
-    // if (fileList.value.length > 0) {
-    //   formData.data.fileList = fileList.value;
-
-    // } else {
-    //   return ElMessage({
-    //     message: "请上传附件!",
-    //     type: "info",
-    //   });
-    // }
-
+    formData.data.fileList =
+      fileListCopy.value.map((x) => ({
+        id: x.id,
+        fileName: x.fileName,
+      })) || [];
     submitLoading.value = true;
     proxy.post("/supplierInfo/" + modalType.value, formData.data).then(
       (res) => {
@@ -454,7 +464,6 @@ const submitForm = () => {
         getList();
       },
       (err) => {
-        console.log(err, "aswwwww");
         submitLoading.value = false;
       }
     );
@@ -464,31 +473,32 @@ const submitForm = () => {
 const getDtl = (row) => {
   modalType.value = "edit";
   proxy.post("/supplierInfo/detail", { id: row.id }).then((res) => {
-    getCityData(res.countryId, "20");
-    getCityData(res.provinceId, "30");
-    // fileList.value = [
-    //   {
-    //     id: "",
-    //     fileName: res.fileName,
-    //     path: "",
-    //   },
-    // ];
-    res.type = res.type + "";
-    formData.data = res;
-    dialogVisible.value = true;
+    proxy
+      .post("/fileInfo/getList", { businessIdList: [row.id] })
+      .then((fileObj) => {
+        fileList.value = fileObj[row.id];
+        fileListCopy.value = [...fileList.value];
+        getCityData(res.countryId, "20");
+        getCityData(res.provinceId, "30");
+        res.type = res.type + "";
+        formData.data = res;
+        dialogVisible.value = true;
+      });
   });
 };
+
 const handleBeforeUpload = async (file) => {
   const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
   uploadData.value = res.uploadBody;
-  fileList.value = [
-    {
-      id: res.id,
-      fileName: res.fileName,
-      path: res.fileUrl,
-    },
-  ];
+  fileListCopy.value.push({
+    id: res.id,
+    fileName: res.fileName,
+    path: res.fileUrl,
+    url: res.fileUrl,
+    uid: file.uid,
+  });
 };
+
 const handleClickFile = (row) => {
   ElMessage({
     message: "数据请求中,请稍后!",
@@ -501,18 +511,17 @@ const handleClickFile = (row) => {
   });
 };
 
-const handlePreview = (file) => {
-  console.log(file);
-};
-const handleSuccess = (file) => {
-  console.log(file);
-};
-const handleRemove = (file) => {
-  fileList.value = [];
-};
 const handleClose = (index) => {
+  if (fileListCopy.value.length === 1) {
+    return ElMessage({
+      message: "最后一个附件啦!",
+      type: "info",
+    });
+  }
   fileList.value.splice(index, 1);
+  fileListCopy.value.splice(index, 1);
 };
+
 const countryData = ref([]);
 const provinceData = ref([]);
 const cityData = ref([]);

+ 18 - 4
src/views/purchaseManage/supplier/supplyPrice/index.vue

@@ -155,15 +155,29 @@ let rules = ref({
 const { proxy } = getCurrentInstance();
 const selectConfig = reactive([
   {
-    label: "供应价格类型",
-    prop: "type",
+    label: "供应类型",
+    prop: "supplierType",
     data: [
       {
-        label: "普通车间",
+        label: "贸易商",
         value: "1",
       },
       {
-        label: "半自动化车间",
+        label: "工厂",
+        value: "2",
+      },
+    ],
+  },
+  {
+    label: "货品类型",
+    prop: "definition",
+    data: [
+      {
+        label: "产品",
+        value: "1",
+      },
+      {
+        label: "物料",
         value: "2",
       },
     ],