|
@@ -0,0 +1,535 @@
|
|
|
+<template>
|
|
|
+ <div class="tenant">
|
|
|
+ <!-- <Banner /> -->
|
|
|
+ <div class="content">
|
|
|
+ <byTable
|
|
|
+ :source="sourceList.data"
|
|
|
+ :pagination="sourceList.pagination"
|
|
|
+ :config="config"
|
|
|
+ :loading="loading"
|
|
|
+ highlight-current-row
|
|
|
+ :selectConfig="selectConfig"
|
|
|
+ :table-events="{
|
|
|
+ //element talbe事件都能传
|
|
|
+ select: select,
|
|
|
+ }"
|
|
|
+ :action-list="[]"
|
|
|
+ @get-list="getList"
|
|
|
+ >
|
|
|
+ <template #slotName="{ item }">
|
|
|
+ {{ item.createTime }}
|
|
|
+ </template>
|
|
|
+ </byTable>
|
|
|
+ </div>
|
|
|
+ <el-dialog
|
|
|
+ :title="'调整BOM'"
|
|
|
+ v-model="dialogVisible"
|
|
|
+ width="800"
|
|
|
+ v-loading="submitLoading"
|
|
|
+ destroy-on-close
|
|
|
+ >
|
|
|
+ <byForm
|
|
|
+ :formConfig="formConfig"
|
|
|
+ :formOption="formOption"
|
|
|
+ v-model="formData.data"
|
|
|
+ :rules="rules"
|
|
|
+ ref="byform"
|
|
|
+ >
|
|
|
+ <template #slot>
|
|
|
+ <div>
|
|
|
+ <el-button type="primary" plain @click="openMaterial = true"
|
|
|
+ >添加物料/半成品</el-button
|
|
|
+ >
|
|
|
+ <el-button type="primary" plain> Excel导入</el-button>
|
|
|
+ <el-form
|
|
|
+ ref="tableForm"
|
|
|
+ :model="formData.data"
|
|
|
+ :rules="rules"
|
|
|
+ label-width="0px"
|
|
|
+ style="margin-top: 15px"
|
|
|
+ >
|
|
|
+ <el-table :data="formData.data.bomDetailList">
|
|
|
+ <el-table-column prop="productCode" label="物料编码" />
|
|
|
+ <el-table-column prop="productName" label="物料名称" />
|
|
|
+ <el-table-column prop="productUnit" label="单位" />
|
|
|
+ <el-table-column prop="quantity" label="数量" width="150">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'bomDetailList.' + $index + '.quantity'"
|
|
|
+ :rules="rules.quantity"
|
|
|
+ :inline-message="true"
|
|
|
+ >
|
|
|
+ <el-input-number
|
|
|
+ v-model="row.quantity"
|
|
|
+ :precision="2"
|
|
|
+ :controls="false"
|
|
|
+ :min="1"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="zip" label="成本" width="150">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'bomDetailList.' + $index + '.cost'"
|
|
|
+ :rules="rules.cost"
|
|
|
+ :inline-message="true"
|
|
|
+ >
|
|
|
+ <el-input-number
|
|
|
+ v-model="row.cost"
|
|
|
+ :precision="2"
|
|
|
+ :controls="false"
|
|
|
+ :min="1"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="zip" label="操作" width="100">
|
|
|
+ <template #default="{ $index }">
|
|
|
+ <el-button type="primary" link @click="handleRemove($index)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </byForm>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="dialogVisible = false" size="large">取 消</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="submitForm('byform')"
|
|
|
+ size="large"
|
|
|
+ :loading="submitLoading"
|
|
|
+ >
|
|
|
+ 确 定
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ title="调整工艺"
|
|
|
+ v-model="dialogVisibleOne"
|
|
|
+ width="800"
|
|
|
+ v-loading="loadingOne"
|
|
|
+ destroy-on-close
|
|
|
+ >
|
|
|
+ <byForm
|
|
|
+ :formConfig="formConfigOne"
|
|
|
+ :formOption="formOption"
|
|
|
+ v-model="formData.dataOne"
|
|
|
+ :rules="rulesOne"
|
|
|
+ ref="byformOne"
|
|
|
+ >
|
|
|
+ <template #slot>
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-button type="primary" plain @click="clickAdd"
|
|
|
+ >添加工序</el-button
|
|
|
+ >
|
|
|
+ <el-table
|
|
|
+ :data="formData.dataOne.list"
|
|
|
+ style="width: 100%; margin-top: 16px"
|
|
|
+ >
|
|
|
+ <el-table-column label="工序名称" width="150">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'list.' + $index + '.contactNo'"
|
|
|
+ :rules="rulesOne.contactNo"
|
|
|
+ :inline-message="true"
|
|
|
+ >
|
|
|
+ <el-input v-model="row.contactNo" placeholder="请输入" />
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="工艺说明">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'list.' + $index + '.contactNo'"
|
|
|
+ :rules="rulesOne.contactNo"
|
|
|
+ :inline-message="true"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="row.contactNo"
|
|
|
+ type="textarea"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="图纸" width="150">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'list.' + $index + '.contactNo'"
|
|
|
+ :rules="rulesOne.contactNo"
|
|
|
+ :inline-message="true"
|
|
|
+ >
|
|
|
+ <el-upload
|
|
|
+ v-model:fileList="fileList"
|
|
|
+ :show-file-list="false"
|
|
|
+ class="upload-demo"
|
|
|
+ action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
|
|
|
+ :data="uploadData"
|
|
|
+ :before-upload="handleBeforeUpload"
|
|
|
+ accept=".pdf"
|
|
|
+ >
|
|
|
+ <el-icon :size="17" style="margin-top: 12px">
|
|
|
+ <Edit />
|
|
|
+ </el-icon>
|
|
|
+ </el-upload>
|
|
|
+ <div>
|
|
|
+ <div>
|
|
|
+ <el-tag
|
|
|
+ style="margin-left: 10px"
|
|
|
+ class="ml-2"
|
|
|
+ type="info"
|
|
|
+ v-for="(item, index) in fileListCopy"
|
|
|
+ :key="index"
|
|
|
+ >{{ item.fileName }}</el-tag
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column
|
|
|
+ align="center"
|
|
|
+ label="操作"
|
|
|
+ width="80"
|
|
|
+ fixed="right"
|
|
|
+ >
|
|
|
+ <template #default="{ $index }">
|
|
|
+ <el-button type="primary" link @click="clickDelete($index)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </byForm>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="dialogVisibleOne = false" size="large"
|
|
|
+ >取 消</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="submitFormOne('byform')"
|
|
|
+ size="large"
|
|
|
+ :loading="loadingOne"
|
|
|
+ >
|
|
|
+ 确 定
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ v-model="openMaterial"
|
|
|
+ title="选择产品"
|
|
|
+ width="70%"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
+ <SelectMaterial @handleSelect="handleSelect"></SelectMaterial>
|
|
|
+ <template #footer>
|
|
|
+ <span class="dialog-footer">
|
|
|
+ <el-button @click="openMaterial = false">取消</el-button>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+/* eslint-disable vue/no-unused-components */
|
|
|
+import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
+import byTable from "@/components/byTable/index";
|
|
|
+import byForm from "@/components/byForm/index";
|
|
|
+import { computed, defineComponent, ref } from "vue";
|
|
|
+import useUserStore from "@/store/modules/user";
|
|
|
+import SelectMaterial from "@/components/product/SelectMaterial";
|
|
|
+const uploadData = ref({});
|
|
|
+let fileList = ref([]);
|
|
|
+let fileListCopy = 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 dialogVisibleOne = ref(false);
|
|
|
+let openMaterial = ref(false);
|
|
|
+let roomDialogVisible = ref(false);
|
|
|
+let modalType = ref("add");
|
|
|
+let rules = ref({
|
|
|
+ type: [
|
|
|
+ { required: true, message: "请选择仓库类型", trigger: ["blur", "change"] },
|
|
|
+ ],
|
|
|
+ name: [{ required: true, message: "请输入仓库名称", trigger: "blur" }],
|
|
|
+});
|
|
|
+let rulesOne = ref({
|
|
|
+ type: [
|
|
|
+ { required: true, message: "请选择仓库类型", trigger: ["blur", "change"] },
|
|
|
+ ],
|
|
|
+ name: [{ required: true, message: "请输入仓库名称", trigger: "blur" }],
|
|
|
+});
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
+const selectConfig = reactive([
|
|
|
+ {
|
|
|
+ label: "工单来源",
|
|
|
+ prop: "type",
|
|
|
+ data: [],
|
|
|
+ },
|
|
|
+]);
|
|
|
+
|
|
|
+const config = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "工单来源",
|
|
|
+ prop: "name",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // attrs: {
|
|
|
+ // label: "仓库类型",
|
|
|
+ // prop: "type",
|
|
|
+ // },
|
|
|
+ // render(type) {
|
|
|
+ // return proxy.dictDataEcho(type, warehouseType.value);
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "产品名称",
|
|
|
+ prop: "keeperName",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "是否定制",
|
|
|
+ prop: "remark",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "工单数量",
|
|
|
+ prop: "remark",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "已计划数量",
|
|
|
+ prop: "remark",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "完成率",
|
|
|
+ prop: "remark",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "操作",
|
|
|
+ width: "200",
|
|
|
+ align: "right",
|
|
|
+ },
|
|
|
+ // 渲染 el-button,一般用在最后一列。
|
|
|
+ renderHTML(row) {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "调整BOM",
|
|
|
+ type: "primary",
|
|
|
+ text: true,
|
|
|
+ },
|
|
|
+ el: "button",
|
|
|
+ click() {
|
|
|
+ getDtl(row);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "调整工艺",
|
|
|
+ type: "primary",
|
|
|
+ text: true,
|
|
|
+ },
|
|
|
+ el: "button",
|
|
|
+ click() {
|
|
|
+ getDtlOne(row);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+
|
|
|
+let formData = reactive({
|
|
|
+ data: {},
|
|
|
+ dataOne: {},
|
|
|
+ treeData: [],
|
|
|
+});
|
|
|
+const formOption = reactive({
|
|
|
+ inline: true,
|
|
|
+ labelWidth: 100,
|
|
|
+ itemWidth: 100,
|
|
|
+ rules: [],
|
|
|
+});
|
|
|
+const byform = ref(null);
|
|
|
+const byformOne = ref(null);
|
|
|
+
|
|
|
+const treeData = ref([]);
|
|
|
+const formConfig = reactive([
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "slot",
|
|
|
+ },
|
|
|
+]);
|
|
|
+const formConfigOne = reactive([
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "slot",
|
|
|
+ label: "",
|
|
|
+ },
|
|
|
+]);
|
|
|
+const getList = async (req) => {
|
|
|
+ sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
+ loading.value = true;
|
|
|
+ proxy.post("/warehouse/page", sourceList.value.pagination).then((message) => {
|
|
|
+ console.log(message);
|
|
|
+ sourceList.value.data = message.rows;
|
|
|
+ sourceList.value.pagination.total = message.total;
|
|
|
+ setTimeout(() => {
|
|
|
+ loading.value = false;
|
|
|
+ }, 200);
|
|
|
+ });
|
|
|
+};
|
|
|
+const openModal = () => {
|
|
|
+ dialogVisible.value = true;
|
|
|
+ modalType.value = "add";
|
|
|
+ formData.data = {};
|
|
|
+};
|
|
|
+
|
|
|
+const submitForm = () => {
|
|
|
+ console.log(byform.value);
|
|
|
+ byform.value.handleSubmit((valid) => {
|
|
|
+ submitLoading.value = true;
|
|
|
+ proxy.post("/warehouse/" + 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 submitFormOne = () => {
|
|
|
+ console.log(byform.value);
|
|
|
+ byformOne.value.handleSubmit((valid) => {
|
|
|
+ submitLoading.value = true;
|
|
|
+ proxy.post("/warehouse/" + modalType.value, formData.data).then(
|
|
|
+ (res) => {
|
|
|
+ ElMessage({
|
|
|
+ message: modalType.value == "add" ? "添加成功" : "编辑成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ dialogVisible.value = false;
|
|
|
+ submitLoading.value = false;
|
|
|
+ getList();
|
|
|
+ },
|
|
|
+ (err) => (submitLoading.value = false)
|
|
|
+ );
|
|
|
+ });
|
|
|
+};
|
|
|
+const getDtl = (row) => {
|
|
|
+ modalType.value = "edit";
|
|
|
+ proxy.post("/warehouse/detail", { id: row.id }).then((res) => {
|
|
|
+ res.type = res.type + "";
|
|
|
+ dialogVisible.value = true;
|
|
|
+ formData.data = res;
|
|
|
+ });
|
|
|
+};
|
|
|
+const getDtlOne = (row) => {
|
|
|
+ modalType.value = "edit";
|
|
|
+ formData.dataOne = {
|
|
|
+ name: row.name,
|
|
|
+ keeperId: row.keeperId,
|
|
|
+ list: [],
|
|
|
+ };
|
|
|
+ dialogVisibleOne.value = true;
|
|
|
+};
|
|
|
+
|
|
|
+const warehouseType = ref([]);
|
|
|
+const getDict = () => {
|
|
|
+ // // 币种数据
|
|
|
+ proxy
|
|
|
+ .post("/dictTenantData/page", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 999,
|
|
|
+ tenantId: useUserStore().user.tenantId,
|
|
|
+ dictCode: "warehouse_type",
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ warehouseType.value = res.rows;
|
|
|
+ selectConfig[0].data = res.rows.map((x) => ({
|
|
|
+ label: x.dictValue,
|
|
|
+ value: x.dictKey,
|
|
|
+ }));
|
|
|
+ formConfig[0].data = res.rows.map((x) => ({
|
|
|
+ label: x.dictValue,
|
|
|
+ value: x.dictKey,
|
|
|
+ }));
|
|
|
+ });
|
|
|
+};
|
|
|
+getList();
|
|
|
+getDict();
|
|
|
+
|
|
|
+const clickAdd = () => {
|
|
|
+ formData.dataOne.list.push({
|
|
|
+ type: [],
|
|
|
+ });
|
|
|
+};
|
|
|
+const clickDelete = (index) => {
|
|
|
+ formData.dataOne.list.splice(index, 1);
|
|
|
+};
|
|
|
+
|
|
|
+const handleBeforeUpload = async (file) => {
|
|
|
+ const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
|
|
|
+ uploadData.value = res.uploadBody;
|
|
|
+ fileListCopy.value = [
|
|
|
+ {
|
|
|
+ id: res.id,
|
|
|
+ fileName: res.fileName,
|
|
|
+ path: res.fileUrl,
|
|
|
+ url: res.fileUrl,
|
|
|
+ uid: file.uid,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.tenant {
|
|
|
+ padding: 20px;
|
|
|
+}
|
|
|
+</style>
|