Selaa lähdekoodia

采购管理模块

cz 2 vuotta sitten
vanhempi
commit
450f3e1655

+ 105 - 14
src/components/process/SendPurchase.vue

@@ -63,6 +63,7 @@
           type="primary"
           @click="openProduct = true"
           style="margin: 10px 0"
+          v-if="ids.length == 0"
         >
           添加货品
         </el-button>
@@ -72,11 +73,20 @@
             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="申购数量" />
+          <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="subscribeCount"
+            label="申购数量"
+            v-if="ids.length > 0"
+          />
+          <el-table-column
+            prop="purchaseCount"
+            label="已采购数量"
+            v-if="ids.length > 0"
+          />
           <el-table-column prop="count" label="本次采购" min-width="150">
             <template #default="{ row, $index }">
               <el-form-item
@@ -88,28 +98,30 @@
                   v-model="row.count"
                   :precision="4"
                   :controls="false"
-                  :min="1"
+                  :min="0"
+                  @change="handleChangeAmount"
                 />
               </el-form-item>
             </template>
           </el-table-column>
-          <el-table-column prop="count" label="单价" min-width="150">
+          <el-table-column prop="price" label="单价" min-width="150">
             <template #default="{ row, $index }">
               <el-form-item
-                :prop="'purchaseDetailList.' + $index + '.count'"
-                :rules="rules.count"
+                :prop="'purchaseDetailList.' + $index + '.price'"
+                :rules="rules.price"
                 :inline-message="true"
               >
                 <el-input-number
-                  v-model="row.count"
+                  v-model="row.price"
                   :precision="4"
                   :controls="false"
                   :min="0"
+                  @change="handleChangeAmount"
                 />
               </el-form-item>
             </template>
           </el-table-column>
-          <el-table-column prop="count" label="金额" />
+          <el-table-column prop="amount" label="金额" />
           <el-table-column prop="zip" label="操作" width="100">
             <template #default="{ $index }">
               <el-button type="primary" link @click="handleRemove($index)"
@@ -119,6 +131,17 @@
           </el-table-column>
         </el-table>
       </el-form-item>
+      <el-row>
+        <el-col :span="4">
+          <el-form-item label="采购金额" prop="amount">
+            <el-input
+              v-model="formData.data.amount"
+              placeholder="请输入"
+              disabled
+            />
+          </el-form-item>
+        </el-col>
+      </el-row>
     </el-form>
   </div>
   <el-dialog v-model="openProduct" title="选择货品" width="70%" append-to-body>
@@ -152,6 +175,7 @@ let rules = ref({
   ],
   supplyId: [{ required: true, message: "请选择供应商", trigger: "change" }],
   count: [{ required: true, message: "请输入本次采购数量", trigger: "blur" }],
+  price: [{ required: true, message: "请输入单价", trigger: "blur" }],
   remark: [{ required: true, message: "请输入备注", trigger: "blur" }],
 });
 
@@ -167,10 +191,15 @@ const handleRemove = (index) => {
 
 const pushGoods = (goods) => {
   const arr = goods.map((x) => ({
-    ...x,
+    goodType: x.goodType,
+    productCode: x.code,
+    productName: x.name,
+    productSpec: x.spec,
+    productUnit: x.unit,
+    count: 0,
+    price: 0,
     bussinessId: x.id,
-    count: "",
-    remark: "",
+    amount: 0,
   }));
   formData.data.purchaseDetailList =
     formData.data.purchaseDetailList.concat(arr);
@@ -185,6 +214,36 @@ 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({
@@ -203,7 +262,29 @@ onMounted(() => {
   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 supplierData = ref([]);
 const getSupplierList = async (req) => {
@@ -217,6 +298,16 @@ const getSupplierList = async (req) => {
 const handleChangeSupplier = (val) => {
   console.log(val, "as");
 };
+// 计算采购总金额
+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,

+ 60 - 20
src/views/process/processApproval/index.vue

@@ -3,8 +3,15 @@
     <div class="left-card">
       <div class="top">
         <div class="commons-title title">流程标题</div>
-        <!-- <SendSubscribe ref="makeDom"></SendSubscribe> -->
-        <SendPurchase ref="makeDom"></SendPurchase>
+        <SendSubscribe
+          ref="makeDom"
+          v-if="queryData.data.isSubscribe == '10'"
+        ></SendSubscribe>
+        <SendPurchase
+          ref="makeDom"
+          v-else-if="queryData.data.isSubscribe == '20'"
+          :queryData="queryData.data"
+        ></SendPurchase>
       </div>
       <div class="bottom">
         <div class="commons-title title">处理意见</div>
@@ -140,17 +147,21 @@
 
 
 <script setup>
+import { useRouter, useRoute } from "vue-router";
+const router = useRouter();
+const route = useRoute();
 //申购发起
 import SendSubscribe from "@/components/process/SendSubscribe";
 //采购发起
 import SendPurchase from "@/components/process/SendPurchase";
-
+// 消息提示
 import { ElMessage, ElMessageBox } from "element-plus";
-
+// tab切换逻辑
 const activeName = ref("first");
 const handleClick = (tab, event) => {
-  console.log(tab, event);
+  // console.log(tab, event);
 };
+// 意见表单
 const flowForm = reactive({
   flowKey: "",
   handleUserId: "",
@@ -160,24 +171,41 @@ const flowForm = reactive({
 const flowRules = reactive({
   remark: [{ required: true, message: "请输入处理意见", trigger: "blur" }],
 });
+//组件实例
 const { proxy } = getCurrentInstance();
-const makeDom = ref(null); //组件实例
+const makeDom = ref(null);
 const flowFormDom = ref(null);
+// 提交逻辑
 const handleSubmit = async () => {
   try {
+    // 调用发起组件的提交事件
     const flag = await makeDom.value.handleSubmit();
     if (flag) {
-      const data = makeDom.value.submitData;
       flowFormDom.value.validate((vaild) => {
         if (vaild) {
-          data.subscribeDetailList = data.subscribeDetailList.map((x) => ({
-            bussinessId: x.bussinessId,
-            count: x.count,
-            remark: x.remark,
-          }));
-          proxy.post("/subscribe/add", data).then((res) => {
-            skipPage();
-          });
+          if (queryData.data.isSubscribe == "10") {
+            const data = makeDom.value.submitData;
+            data.subscribeDetailList = data.subscribeDetailList.map((x) => ({
+              bussinessId: x.bussinessId,
+              count: x.count,
+              remark: x.remark,
+            }));
+            proxy.post("/subscribe/add", data).then((res) => {
+              skipPage();
+            });
+          } else if (queryData.data.isSubscribe == "20") {
+            const data = makeDom.value.submitData;
+            data.purchaseDetailList = data.purchaseDetailList.map((x) => ({
+              bussinessId: x.bussinessId,
+              subscribeDetailId: x.id,
+              count: x.count,
+              price: x.price,
+              amount: x.amount,
+            }));
+            proxy.post("/purchase/add", data).then((res) => {
+              skipPage();
+            });
+          }
         }
       });
     }
@@ -185,18 +213,30 @@ const handleSubmit = async () => {
     console.log("数据未填完整!", err);
   }
 };
-
+// 页面跳转
 const skipPage = () => {
   ElMessage({
     message: "操作成功!",
     type: "success",
   });
-  proxy.$router.replace({
-    path: "/purchaseManage/purchaseManage/subscribe",
-  });
+  if (queryData.data.isSubscribe == "10") {
+    router.replace({
+      path: "/purchaseManage/purchaseManage/subscribe",
+    });
+  } else if (queryData.data.isSubscribe == "20") {
+    router.replace({
+      path: "/purchaseManage/purchaseManage/purchase",
+    });
+  }
 };
 
-onMounted(() => {});
+let queryData = reactive({
+  data: {},
+});
+
+onMounted(() => {
+  queryData.data = { ...route.query };
+});
 </script>
 
   <style lang="scss" scoped>

+ 429 - 0
src/views/purchaseManage/purchaseManage/alreadyPurchase/index.vue

@@ -0,0 +1,429 @@
+<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事件都能传
+        }"
+        :action-list="[
+          {
+            text: '新增采购',
+            action: () => start(),
+          },
+        ]"
+        @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"
+    >
+      <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="请选择"
+                @change="handleChangeSupplier"
+                style="width: 100%"
+              >
+                <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="deptName">
+              <el-input v-model="formData.data.deptName" placeholder="请输入">
+              </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>
+        </el-form-item>
+      </el-form>
+
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="submitForm()"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+  
+<script setup>
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+
+const loading = ref(false);
+const submitLoading = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+  },
+});
+let dialogVisible = ref(false);
+let modalType = ref("add");
+let rules = ref({
+  name: [{ required: true, message: "请输入供应商名称", trigger: "blur" }],
+});
+const { proxy } = getCurrentInstance();
+const selectConfig = reactive([
+  {
+    label: "采购状态",
+    prop: "purchaseStatus",
+    data: [
+      {
+        label: "产品",
+        value: "1",
+      },
+      {
+        label: "物料",
+        value: "2",
+      },
+    ],
+  },
+  {
+    label: "到货状态",
+    prop: "arrivalStatus",
+    data: [
+      {
+        label: "未到货",
+        value: "1",
+      },
+      {
+        label: "部分到货",
+        value: "2",
+      },
+      {
+        label: "已到货",
+        value: "3",
+      },
+    ],
+  },
+  {
+    label: "付款状态",
+    prop: "payStatus",
+    data: [
+      {
+        label: "未付款",
+        value: "1",
+      },
+      {
+        label: "部分付款",
+        value: "2",
+      },
+      {
+        label: "已付款",
+        value: "3",
+      },
+    ],
+  },
+]);
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "采购单号",
+        prop: "code",
+      },
+    },
+    {
+      attrs: {
+        label: "供应商",
+        prop: "supplyName",
+      },
+    },
+
+    {
+      attrs: {
+        label: "采购金额",
+        prop: "remarks",
+      },
+    },
+    {
+      attrs: {
+        label: "采购人",
+        prop: "purchaseName",
+      },
+    },
+    {
+      attrs: {
+        label: "采购时间",
+        prop: "createTime",
+      },
+    },
+    {
+      attrs: {
+        label: "采购状态",
+        prop: "purchaseStatus",
+      },
+    },
+    {
+      attrs: {
+        label: "到货状态",
+        prop: "arrivalStatus",
+      },
+    },
+    {
+      attrs: {
+        label: "付款状态",
+        prop: "payStatus",
+      },
+    },
+
+    {
+      attrs: {
+        label: "操作",
+        width: "200",
+        align: "right",
+      },
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "到货通知",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              dialogVisible.value = true;
+            },
+          },
+          {
+            attrs: {
+              label: "作废",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              handleEdit(row, 88);
+            },
+          },
+          {
+            attrs: {
+              label: "终止",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              handleEdit(row, 99);
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+
+let formData = reactive({
+  data: {
+    type: "1",
+  },
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const formDom = 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("/purchase/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 submitForm = async () => {
+  formDom.value.validate((vaild) => {
+    if (vaild) {
+      ElMessage({
+        message: "请添加申购明细!",
+        type: "info",
+      });
+    }
+  });
+};
+
+const getDtl = (row) => {
+  modalType.value = "edit";
+  proxy.post("/productionProcesses/detail", { id: row.id }).then((res) => {
+    formData.data = res;
+    dialogVisible.value = true;
+  });
+};
+
+const handleEdit = (row, status) => {
+  let purchaseStatusName = status == 88 ? "作废" : "终止";
+  const data = { ...row, purchaseStatus: status };
+  // 弹窗提示是否删除
+  ElMessageBox.confirm(
+    `此操作将${purchaseStatusName}该数据, 是否继续?`,
+    "提示",
+    {
+      confirmButtonText: "确定",
+      cancelButtonText: "取消",
+      type: "warning",
+    }
+  ).then(() => {
+    // 删除
+    proxy
+      .post("/purchase/edit", {
+        data,
+      })
+      .then((res) => {
+        ElMessage({
+          message: `${purchaseStatusName}成功`,
+          type: "success",
+        });
+        getList();
+      });
+  });
+};
+
+getList();
+
+const start = () => {
+  proxy.$router.replace({
+    path: "/platform_manage/process/processApproval",
+    query: {
+      isSubscribe: "20",
+      ids: "",
+    },
+  });
+};
+</script>
+  
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+</style>

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

@@ -0,0 +1,194 @@
+<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>

+ 378 - 0
src/views/purchaseManage/purchaseManage/arrival/index.vue

@@ -0,0 +1,378 @@
+<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: selectRow,
+          'select-all': selectRow,
+        }"
+        :action-list="[
+          {
+            text: '质检',
+            disabled: selectData.length === 0,
+            action: () => start(),
+          },
+        ]"
+        @get-list="getList"
+      >
+        <template #fileSlot="{ item }">
+          <div
+            style="cursor: pointer; color: #409eff"
+            @click="handleClickFile(item)"
+          >
+            {{ item.fileName }}
+          </div>
+        </template>
+      </byTable>
+    </div>
+    <el-dialog
+      title="到货质检"
+      v-model="dialogVisible"
+      width="800"
+      v-loading="loading"
+    >
+      <arrivalAdd></arrivalAdd>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="submitForm()"
+          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 arrivalAdd from "./add.vue";
+import FileUpload from "@/components/FileUpload/index";
+import { computed, defineComponent, ref } from "vue";
+import { getToken } from "@/utils/auth";
+
+const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传文件服务器地址
+const headers = ref({ Authorization: "Bearer " + getToken() });
+const uploadData = ref({});
+const loading = ref(false);
+const submitLoading = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+  },
+});
+let dialogVisible = ref(false);
+let modalType = ref("add");
+let fileList = ref([]);
+let rules = ref({
+  name: [{ required: true, message: "请输入供应商名称", trigger: "blur" }],
+});
+const { proxy } = getCurrentInstance();
+const selectConfig = reactive([
+  {
+    label: "申购状态",
+    prop: "type",
+    data: [
+      {
+        label: "产品",
+        value: "1",
+      },
+      {
+        label: "物料",
+        value: "2",
+      },
+    ],
+  },
+]);
+const config = computed(() => {
+  return [
+    {
+      type: "selection",
+      attrs: {
+        label: "角色名称",
+        prop: "remark",
+        width: 50,
+      },
+    },
+    {
+      attrs: {
+        label: "到货单号",
+        prop: "name",
+      },
+    },
+    {
+      attrs: {
+        label: "供应商",
+        prop: "remarks",
+      },
+    },
+    {
+      attrs: {
+        label: "物品类型",
+        prop: "remarks",
+      },
+    },
+
+    {
+      attrs: {
+        label: "物品编码",
+        prop: "remarks",
+      },
+    },
+    {
+      attrs: {
+        label: "物品名称",
+        prop: "remarks",
+      },
+    },
+    {
+      attrs: {
+        label: "规格型号",
+        prop: "remarks",
+      },
+    },
+    {
+      attrs: {
+        label: "单位",
+        prop: "remarks",
+      },
+    },
+    {
+      attrs: {
+        label: "到货数量",
+        prop: "remarks",
+      },
+    },
+    {
+      attrs: {
+        label: "质检合格",
+        prop: "remarks",
+      },
+    },
+    {
+      attrs: {
+        label: "质检不合格",
+        prop: "remarks",
+      },
+    },
+    {
+      attrs: {
+        label: "质检状态",
+        prop: "remarks",
+      },
+    },
+
+    {
+      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",
+  },
+});
+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.push({
+
+//  })
+// };
+
+const submitForm = () => {
+  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;
+      }
+    );
+  });
+};
+
+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();
+const selectData = ref([]);
+const selectRow = (data) => {
+  selectData.value = data;
+};
+
+const start = () => {
+  console.log(selectData.value.length, "22");
+  // if (selectData.value.length > 0) {
+  // } else {
+  //   return ElMessage({
+  //     message: "请勾选数据!",
+  //     type: "info",
+  //   });
+  // }
+};
+</script>
+  
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+</style>

+ 36 - 29
src/views/purchaseManage/purchaseManage/purchase/index.vue

@@ -156,6 +156,7 @@ const sourceList = ref({
     total: 3,
     pageNum: 1,
     pageSize: 10,
+    status: "15,30",
   },
 });
 let dialogVisible = ref(false);
@@ -167,16 +168,16 @@ let rules = ref({
 const { proxy } = getCurrentInstance();
 const selectConfig = reactive([
   {
-    label: "申购状态",
+    label: "状态",
     prop: "type",
     data: [
       {
-        label: "产品",
-        value: "1",
+        label: "待采购",
+        value: "15",
       },
       {
-        label: "物料",
-        value: "2",
+        label: "部分采购",
+        value: "30",
       },
     ],
   },
@@ -185,71 +186,69 @@ const config = computed(() => {
   return [
     {
       type: "selection",
-      attrs: {
-        label: "角色名称",
-        prop: "remark",
-        width: 50,
-      },
     },
     {
       attrs: {
         label: "申购单号",
-        prop: "name",
+        prop: "subscribeCode",
       },
     },
     {
       attrs: {
         label: "物品类型",
-        prop: "remarks",
+        prop: "productType",
+      },
+      render(productType) {
+        return productType == 1 ? "产品" : "物料";
       },
     },
 
     {
       attrs: {
         label: "物品编码",
-        prop: "remarks",
+        prop: "productCode",
       },
     },
     {
       attrs: {
         label: "物品名称",
-        prop: "remarks",
+        prop: "productName",
       },
     },
     {
       attrs: {
         label: "规格",
-        prop: "remarks",
+        prop: "productSpec",
       },
     },
     {
       attrs: {
         label: "单位",
-        prop: "remarks",
+        prop: "productUnit",
       },
     },
     {
       attrs: {
         label: "申购数量",
-        prop: "remarks",
+        prop: "count",
       },
     },
     {
       attrs: {
         label: "申购状态",
-        prop: "remarks",
+        prop: "status",
       },
     },
     {
       attrs: {
         label: "申购人",
-        prop: "remarks",
+        prop: "subcribeName",
       },
     },
     {
       attrs: {
         label: "申购时间",
-        prop: "remarks",
+        prop: "subcribeTime",
       },
     },
     {
@@ -269,7 +268,8 @@ const config = computed(() => {
             },
             el: "button",
             click() {
-              getDtl(row);
+              selectData.value = [row];
+              start();
             },
           },
         ];
@@ -440,14 +440,21 @@ const selectRow = (data) => {
 };
 
 const start = () => {
-  console.log(selectData.value.length, "22");
-  // if (selectData.value.length > 0) {
-  // } else {
-  //   return ElMessage({
-  //     message: "请勾选数据!",
-  //     type: "info",
-  //   });
-  // }
+  if (selectData.value.length > 0) {
+    let ids = selectData.value.map((x) => x.id).join();
+    proxy.$router.replace({
+      path: "/platform_manage/process/processApproval",
+      query: {
+        isSubscribe: "20",
+        ids,
+      },
+    });
+  } else {
+    return ElMessage({
+      message: "请勾选数据!",
+      type: "info",
+    });
+  }
 };
 </script>
   

+ 26 - 2
src/views/purchaseManage/purchaseManage/subscribe/index.vue

@@ -182,7 +182,28 @@ const selectConfig = reactive([
   {
     label: "状态",
     prop: "status",
-    data: [],
+    data: [
+      {
+        label: "审批中",
+        value: "10",
+      },
+      {
+        label: "待采购",
+        value: "15",
+      },
+      {
+        label: "部分采购",
+        value: "30",
+      },
+      {
+        label: "已采购",
+        value: "20",
+      },
+      {
+        label: "已作废",
+        value: "99",
+      },
+    ],
   },
 ]);
 const config = computed(() => {
@@ -376,7 +397,10 @@ const getList = async (req) => {
 
 const openModal = () => {
   proxy.$router.replace({
-    path: "/process/processApproval",
+    path: "/platform_manage/process/processApproval",
+    query: {
+      isSubscribe: "10",
+    },
   });
 };