123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287 |
- <template>
- <div class="mainContentBox">
- <avue-crud
- ref="crudRef"
- v-model:search="search"
- v-model="form"
- :data="data"
- :option="option"
- v-model:page="page"
- @row-save="createRow"
- @row-update="updateRow"
- @row-del="deleteRow"
- @search-change="searchChange"
- @search-reset="resetChange"
- @size-change="dataList"
- @current-change="dataList"
- @selection-change="selectionChange"
- >
- <template #menu="{ size, row, index }">
- <el-button
- icon="el-icon-edit"
- text
- @click="openDialog(0, row.id, row.outsourceId)"
- type="primary"
- :size="size"
- >详情</el-button
- >
- </template>
- </avue-crud>
- <el-dialog
- v-model="dialog.visible"
- :title="dialog.title"
- width="1200px"
- @close="dialog.visible = false"
- >
- <el-form
- ref="queryFormRef"
- label-width="100"
- :inline="true"
- style="width: 100%"
- >
- <el-row :gutter="24">
- <el-col :lg="12" :xs="12">
- <el-form-item label="产品名称">
- <el-text>{{ form.materialName }}</el-text>
- </el-form-item>
- </el-col>
- <el-col :lg="12" :xs="12">
- <el-form-item label="产品编码">
- <el-text>{{ form.materialCode }}</el-text>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="24">
- <el-col :lg="12" :xs="12">
- <el-form-item label="委外工序">
- <el-text>{{ form.operationName }}</el-text>
- </el-form-item>
- </el-col>
- <el-col :lg="12" :xs="12">
- <el-form-item label="产品数量">
- <el-text>{{ form.outNum }}</el-text>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="24">
- <el-col :lg="24" :xs="24">
- <el-form-item label=" ">
- <el-table
- :border="true"
- class="gray-header-table"
- v-loading="loading"
- :data="form.details"
- highlight-current-row
- >
- <el-table-column
- label="WIN码"
- align="left"
- width="350"
- prop="seqNo"
- />
- <el-table-column
- label="状态"
- width="250"
- align="left"
- prop="state"
- >
- <template #default="scope">
- <el-tag v-if="scope.row.state === 0" type="success"
- >合格</el-tag
- >
- <el-tag v-if="scope.row.state === 1" type="error"
- >不合格</el-tag
- >
- </template>
- </el-table-column>
- </el-table>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="24" v-if="dialog.visible">
- <el-form-item label="Bom">
- <Boms :apply-id="bomId" />
- </el-form-item>
- </el-row>
- </el-form>
- <div
- class="dialog-footer"
- align="center"
- v-if="dialog.type === 1 && checkPerm('outsource:audit')"
- >
- <el-button @click="dialog.visible = false">取 消</el-button>
- <el-button type="primary" @click="audit">审 核</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script setup>
- import Boms from "./boms.vue";
- import { ref, getCurrentInstance } from "vue";
- import { useCrud } from "@/hooks/userCrud";
- import { checkPerm } from "@/directive/permission";
- import ButtonPermKeys from "@/common/configs/buttonPermission";
- import { queryOutSourceDetails, updateOutSourceApply } from "@/api/process";
- import { useCommonStoreHook } from "@/store";
- import dictDataUtil from "@/common/configs/dictDataUtil";
- const { isShowTable, tableType } = toRefs(useCommonStoreHook());
- const test = () => {
- isShowTable.value = true;
- tableType.value = tableType.value == 1 ? 2 : 1;
- };
- const radio = ref(0);
- // 传入一个url,后面不带/
- const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
- useCrud({
- src: "/api/v1/process/tdmOrder",
- });
- const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
- Methords; //增删改查
- const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
- const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
- const loading = ref(false);
- const crudRef = ref(null); //crudRef.value 获取avue-crud对象
- const dialog = reactive({
- title: "委外详情",
- visible: false,
- type: 0,
- });
- const bomId = ref(""); //打开详情需要传入applyid
- const openDialog = (type, id, outId) => {
- bomId.value = id;
- dialog.title = type === 0 ? "委外详情" : "委外审核";
- queryOutSourceDetails(outId).then((data) => {
- form.value = data.data;
- radio.value = 0;
- if (form.value) {
- if (form.value.state === "2") {
- radio.value = 1;
- }
- }
- dialog.visible = true;
- dialog.type = type;
- });
- };
- const audit = () => {
- form.value.state = radio.value === 0 ? 1 : 2;
- updateOutSourceApply(form.value).then((data) => {
- if (data.code === "200") {
- ElMessage.success("操作成功");
- dialog.visible = false;
- dataList();
- } else {
- ElMessage.error(data.msg);
- }
- });
- };
- // 设置表格列或者其他自定义的option
- option.value = Object.assign(option.value, {
- addBtn: false,
- editBtn: false,
- viewBtn: false,
- delBtn: false,
- selection: true,
- column: [
- {
- label: "计划编号",
- prop: "orderCode",
- width: 150,
- overHidden: true,
- search: true,
- },
- {
- label: "物料编码",
- prop: "materialCode",
- search: true,
- width: 150,
- overHidden: true,
- },
- {
- label: "物料名称",
- width: 150,
- overHidden: true,
- prop: "materialName",
- },
- // {
- // label: "工单数量",
- // width: 120,
- // overHidden: true,
- // prop: "workOrderNum",
- // },
- {
- label: "委外工序",
- width: 150,
- overHidden: true,
- prop: "operationName",
- },
- {
- label: "状态",
- prop: "state",
- type: "select",
- search: true,
- width: 90,
- dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.outsource_state,
- props: {
- label: "dictLabel",
- value: "dictValue",
- },
- },
- {
- label: "申请人",
- width: 120,
- overHidden: true,
- prop: "creator",
- },
- {
- label: "申请时间",
- width: 120,
- overHidden: true,
- prop: "created",
- },
- {
- label: "审核人",
- width: 120,
- overHidden: true,
- prop: "auditUser",
- },
- {
- label: "审核时间",
- width: 120,
- overHidden: true,
- prop: "auditTime",
- },
- {
- label: "接收人",
- width: 120,
- overHidden: true,
- prop: "receiveUser",
- },
- {
- label: "接收时间",
- width: 120,
- overHidden: true,
- prop: "receiveTime",
- },
- ],
- });
- onMounted(() => {
- // console.log("crudRef", crudRef)
- dataList();
- });
- </script>
- <style>
- /* 添加自定义类名以区分不同表格的样式 */
- .gray-header-table .el-table__header-wrapper {
- background-color: #f2f2f2; /* 灰色背景 */
- }
- </style>
|