123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356 |
- <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="{ row, index, type }">
- <el-button
- @click="showTable(row)"
- link
- type="primary"
- size="small"
- >查看</el-button
- >
- <el-button
- type="primary"
- size="small"
- link
- @click="showSeq(row.seqList)"
- >查看管号</el-button
- >
- <el-button
- link
- @click="doEdit(row, index)"
- type="primary"
- v-if="row.state === 0 || row.state === 1"
- size="small"
- >编辑</el-button
- >
- <el-button
- @click="operation(row)"
- link
- size="small"
- type="primary"
- >返工工序</el-button
- >
- <el-button
- link
- @click="handle(row, index, 2)"
- type="primary"
- v-if="row.state === 0"
- size="small"
- >驳回</el-button
- >
- <el-button
- link
- @click="handle(row, index, 1)"
- type="primary"
- v-if="row.state === 0"
- size="small"
- >确认返工</el-button
- >
- <!-- <el-button
- link
- v-if="row.state === 1"
- @click="handle(row, index, 3)"
- type="primary"
- size="small"
- >返工完成</el-button
- >-->
- <el-button
- link
- v-if="row.state === 1"
- @click="handle(row, index, 3)"
- type="primary"
- size="small"
- >返工完成</el-button
- >
- <el-button
- @click="document(row)"
- link
- size="small"
- v-if="row.state > 0 && row.state!==2 "
- type="primary"
- >领料单</el-button
- >
- </template>
- <template #menu-right="{}">
- <el-button
- class="ml-3"
- @click="exportData('/api/v1/rework/record/export')"
- >
- <template #icon> <i-ep-download /> </template>导出
- </el-button>
- </template>
- </avue-crud>
- <el-dialog
- v-model="dialog.visible"
- :title="dialog.title"
- width="900px"
- @close="closeOperation"
- :destroy-on-close="true"
- >
- <ReworkItem
- :recordId="record.id"
- :dialog="dialog"
- :status="record.state"
- />
- </el-dialog>
- <el-dialog
- v-model="dialog1.visible"
- :title="dialog1.title"
- width="900px"
- @close="dialog1.visible=false"
- :destroy-on-close="true"
- >
- <ReworkDocument
- :recordId="record.id"
- :dialog="dialog1"
- :orderCode="record.orderCode"
- :status="record.state"
- />
- </el-dialog>
- <el-dialog
- v-model="dialog2.visible"
- :title="dialog2.title"
- width="950px"
- @close="dialog2.visible = false"
- >
- <el-card
- style="cursor: pointer; font-size: 20px"
- shadow="always"
- :key="item"
- v-for="item in showSeqList"
- >{{ item }}</el-card
- >
- </el-dialog>
- <ReworkShow v-model="showState" :tableData="tableData" />
- </div>
- </template>
- <script setup>
- import { useCrud } from "@/hooks/userCrud";
- import dictDataUtil from "@/common/configs/dictDataUtil";
- import ButtonPermKeys from "@/common/configs/buttonPermission";
- import { useCommonStoreHook, useDictionaryStore } from "@/store";
- import ReworkItem from "@/views/quality/rework/components/rework-detail.vue";
- import { ref } from "vue";
- import { handleReworkRecord, getReworkItem } from "@/api/fault/index";
- import ReworkShow from "@/views/quality/rework/components/rework-show.vue";
- import ReworkDocument from "@/views/quality/rework/components/rework-document.vue";
- // 数据字典相关
- const { dicts } = useDictionaryStore();
- const showSeqList = ref([]);
- // 传入一个url,后面不带/
- const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
- useCrud({
- src: "/api/v1/rework/record",
- });
- const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
- Methords; //增删改查
- const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
- const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
- const tableData = ref({});
- const crudRef = ref(null); //crudRef.value 获取avue-crud对象
- const dialog = ref({
- title: "关联工序",
- visible: false,
- });
- const dialog1 = ref({
- title: "领料单",
- visible: false,
- });
- const dialog2 = reactive({
- title: "管号列表",
- visible: false,
- });
- const showSeq = (seqs) => {
- showSeqList.value = seqs;
- dialog2.visible = true;
- };
- const doEdit = (row, index) => {
- crudRef.value && crudRef.value.rowEdit(row, index);
- };
- onMounted(() => {
- dataList();
- });
- const record = ref({});
- const operation = (row) => {
- record.value = row;
- dialog.value.visible = true;
- };
- const document = (row) => {
- record.value = row;
- console.log(record.value);
- dialog1.value.visible = true;
- };
- const showState = ref(false);
- const showTable = (row) => {
- reworkItem.value.recordId = row.id;
- getReworkItem(reworkItem.value).then((data) => {
- if (data.code === "200") {
- tableData.value = row;
- tableData.value.itemList = data.data;
- showState.value = true;
- } else {
- ElMessage({
- message: data.msg,
- type: "error",
- });
- }
- });
- };
- const closeOperation = () => {
- dialog.value.visible = false;
- };
- const handleData = ref({});
- const reworkItem = ref({});
- const handle = (row, index, state) => {
- handleData.value.id = row.id;
- handleData.value.state = state;
- handleData.value.seqNos = row.seqNos;
- handleReworkRecord(handleData.value).then((data) => {
- if (data.code === "200") {
- ElMessage({
- message: data.msg,
- type: "success",
- });
- dataList();
- } else {
- ElMessage({
- message: data.msg,
- type: "error",
- });
- }
- });
- };
- // 设置表格列或者其他自定义的option
- option.value = Object.assign(option.value, {
- searchEnter: true,
- selection: false,
- addBtn: false,
- delBtn: false,
- editBtn: false,
- viewBtn: false,
- column: [
- {
- label: "生产批号",
- prop: "workOrderCode",
- editDisabled: true,
- overHidden: true,
- width: 120,
- search: true,
- },
- {
- label: "产品名称",
- prop: "materialName",
- editDisabled: true,
- search: true,
- },
- {
- label: "数量",
- editDisabled: true,
- prop: "num",
- },
- {
- label: "管号",
- prop: "seqNo",
- search: true,
- editDisabled: true,
- hide: true,
- display: false,
- },
- {
- label: "返工原因",
- prop: "reason",
- width: 160,
- search: true,
- overHidden: true,
- type: "textarea",
- },
- {
- label: "产品规格",
- prop: "materialModel",
- width: 160,
- search: true,
- overHidden: true,
- },
- {
- label: "返工内容",
- prop: "remark",
- width: 160,
- overHidden: true,
- type: "textarea",
- },
- {
- label: "状态",
- prop: "state",
- type: "select",
- display: false,
- dicData: [
- {
- label: "待处理",
- value: 0,
- },
- {
- label: "返工中",
- value: 1,
- },
- {
- label: "驳回",
- value: 2,
- },
- {
- label: "返工完成",
- value: 3,
- },
- ],
- },
- {
- label: "创建人",
- prop: "creator",
- editDisplay: false,
- },
- {
- label: "创建日期",
- prop: "created",
- type: "date",
- width: 160,
- editDisplay: false,
- overHidden: true,
- },
- {
- label: "日期",
- prop: "createdSearch",
- width: 160,
- type: "daterange",
- searchRange: true,
- display: false,
- hide: true,
- startPlaceholder: "开始范围",
- endPlaceholder: "结束范围",
- format: "YYYY-MM-DD",
- valueFormat: "YYYY-MM-DD",
- overHidden: true,
- search: true,
- },
- ],
- });
- </script>
|