|
@@ -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>
|