123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470 |
- <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"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- @selection-change="selectionChange"
- >
- <template #menu="{ size, row, index }">
- <el-button
- icon="el-icon-info"
- text
- @click="openDialog(row.id)"
- type="primary"
- :size="size"
- >
- 详情</el-button
- >
- </template>
- </avue-crud>
- <el-dialog
- v-model="dialog1.visible"
- :title="dialog1.title"
- width="950px"
- @close="dialog1.visible = false"
- >
- <work-order-page
- :opType="0"
- :semiFinishedStock="1"
- :queryComplete="1"
- @order-info="materialInfo1"
- />
- </el-dialog>
- <el-dialog
- v-model="dialog2.visible"
- :title="dialog2.title"
- width="950px"
- @close="dialog2.visible = false"
- >
- <work-order-seqNos-page
- :workOrderCode="
- form.stockType == '1' ? form.inWorkOrderCode : form.outWorkOrderCode
- "
- :semiFinishedStock="'1'"
- :state="'2'"
- @order-info="materialInfo2"
- />
- </el-dialog>
- <el-dialog
- v-model="dialog3.visible"
- :title="dialog3.title"
- width="950px"
- @close="dialog3.visible = false;dataList();"
- >
- <Details
- :id="selectId"
- @close="
- dialog3.visible = false;
- "
- />
- </el-dialog>
- </div>
- </template>
- <script setup>
- import { ref, getCurrentInstance } from "vue";
- import { useCrud } from "@/hooks/userCrud";
- import ButtonPermKeys from "@/common/configs/buttonPermission";
- import { useCommonStoreHook } from "@/store";
- import dictDataUtil from "@/common/configs/dictDataUtil";
- import { useDictionaryStore } from "@/store";
- import Details from "./components/details.vue";
- const { dicts } = useDictionaryStore();
- const { isShowTable, tableType } = toRefs(useCommonStoreHook());
- // 传入一个url,后面不带/
- const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
- useCrud({
- src: "/api/v1/semiFinishedStock",
- });
- const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
- Methords; //增删改查
- const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
- const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
- const crudRef = ref(null); //crudRef.value 获取avue-crud对象
- const openDialog = (id) => {
- selectId.value = id;
- dialog3.visible = true;
- };
- const dialog1 = reactive({
- title: "工单号选择",
- visible: false,
- });
- const dialog2 = reactive({
- title: "流转卡号选择",
- visible: false,
- });
- const dialog3 = reactive({
- title: "详情",
- visible: false,
- });
- const selectId = ref(null);
- const materialInfo1 = (value) => {
- if (form.value.stockType == "1") {
- form.value.inWorkOrderCode = value.workOrderCode;
- form.value.outWorkOrderCode = null;
- } else if (form.value.stockType == "2") {
- form.value.outWorkOrderCode = value.workOrderCode;
- }
- form.value.workOrderId = value.id;
- form.value.workOrderSeqNos = [];
- dialog1.visible = false;
- };
- const materialInfo2 = (value) => {
- form.value.workOrderSeqNos = value;
- dialog2.visible = false;
- };
- const seqDisabled = computed(() => {
- return !form.value.workOrderId;
- });
- const displayIn = computed(() => {
- return form.value.stockType == "2" || !form.value.stockType;
- });
- const displayShowIn = computed(() => {
- return !(form.value.stockType == "2" || !form.value.stockType);
- });
- const displayOut = computed(() => {
- return form.value.stockType == "1" || !form.value.stockType;
- });
- const displayShowOut = computed(() => {
- return !(form.value.stockType == "1" || !form.value.stockType);
- });
- // 设置表格列或者其他自定义的option
- option.value = Object.assign(option.value, {
- searchEnter: true,
- delBtn: false,
- selection: true,
- labelWidth: 100,
- editBtn: false,
- viewBtn: false,
- addBtn: false,
- column: [
- {
- label: "产品编码",
- prop: "materialCode",
- editDisabled: true,
- addDisplay: false,
- rules: [
- {
- required: true,
- trigger: "trigger",
- },
- ],
- },
- {
- label: "工艺路线名称",
- prop: "processRouteName",
- editDisabled: true,
- addDisplay: false,
- rules: [
- {
- required: true,
- trigger: "trigger",
- },
- ],
- },
- {
- label: "工艺路线版本",
- prop: "processRouteVersion",
- editDisabled: true,
- addDisplay: false,
- rules: [
- {
- required: true,
- trigger: "trigger",
- },
- ],
- },
- {
- label: "分组标识",
- prop: "opGroup",
- editDisabled: true,
- addDisplay: false,
- rules: [
- {
- required: true,
- trigger: "trigger",
- },
- ],
- },
- /*{
- label: "库存数量",
- prop: "stockNum",
- editDisabled: true,
- addDisplay: false,
- rules: [
- {
- required: true,
- trigger: "trigger",
- },
- ],
- render: ({ row }) => {
- return h("p", row.stockType == "2" ? "-" : row.stockNum);
- },
- },*/
- {
- label: "入库数量",
- prop: "operateNum",
- addDisplay: false,
- editDisabled: true,
- rules: [
- {
- required: true,
- trigger: "trigger",
- },
- ],
- },
- {
- label: "出库数量",
- prop: "outNum",
- addDisplay: false,
- editDisabled: true,
- rules: [
- {
- required: true,
- trigger: "trigger",
- },
- ],
- },
- /*{
- label: "出入库类型",
- prop: "stockType",
- editDisabled: true,
- disabled: true,
- addDisplay: true,
- rules: [
- {
- required: true,
- trigger: "trigger",
- },
- ],
- type: "select",
- dicData: [
- {
- label: "入库",
- value: "1",
- },
- {
- label: "出库",
- value: "2",
- },
- ],
- value: "1",
- },*/
- /*{
- label: "入库工单",
- prop: "inWorkOrderCode",
- editDisabled: true,
- addDisplay: displayShowIn,
- disabled: displayIn,
- rules: [
- {
- required: true,
- trigger: "trigger",
- },
- ],
- type: "select",
- click: ({ value, column }) => {
- if (column.boxType) {
- dialog1.visible = true;
- }
- },
- change: ({ value, column }) => {
- if (value != form.value.materialCode) {
- dialog1.visible = true;
- form.value.workOrderSeqNos = null;
- }
- },
- },
- {
- label: "出库工单",
- prop: "outWorkOrderCode",
- editDisabled: true,
- addDisplay: displayShowOut,
- disabled: displayOut,
- rules: [
- {
- required: true,
- trigger: "trigger",
- },
- ],
- type: "select",
- click: ({ value, column }) => {
- if (column.boxType) {
- dialog1.visible = true;
- form.value.workOrderSeqNos = null;
- }
- },
- change: ({ value, column }) => {
- if (value != form.value.materialCode) {
- dialog1.visible = true;
- }
- },
- render: ({ row }) => {
- return h(
- "p",
- row.stockType == "1"
- ? "-"
- : row?.outWorkOrderCode
- ? row.outWorkOrderCode
- : "-"
- );
- },
- },*/
- {
- label: "流转卡号",
- prop: "workOrderSeqNos",
- editDisabled: true,
- hide: true,
- disabled: seqDisabled,
- addDisplay: true,
- filterable: true,
- rules: [
- {
- required: true,
- trigger: "trigger",
- },
- ],
- click: ({ value, column }) => {
- if (column.boxType && dialog1.visible == false) {
- dialog2.visible = true;
- }
- },
- },
- /* {
- label: "库位",
- prop: "location",
- addDisplay: true,
- rules: [
- {
- required: true,
- trigger: "trigger",
- },
- ],
- },*/
- // {
- // label: "物料类型",
- // prop: "taskNo",
- // type: "select",
- // search: true,
- // width: 90,
- // overHidden: true,
- // dicUrl: dictDataUtil.request_url + "stock_material_type",
- // props: {
- // label: "dictLabel",
- // value: "dictValue",
- // },
- // rules: [
- // {
- // required: true,
- // message: "物料类型不能为空",
- // trigger: "trigger",
- // },
- // ],
- // },
- // {
- // label: "料箱编号",
- // prop: "vehicleCode",
- // editDisabled: true,
- // rules: [
- // {
- // required: true,
- // message: "料箱编号不能为空",
- // trigger: "trigger",
- // },
- // ],
- // },
- // {
- // label: "仓库坐标",
- // prop: "locationNo",
- // editDisabled: true,
- // rules: [
- // {
- // required: true,
- // message: "仓库位置不能为空",
- // trigger: "trigger",
- // },
- // ],
- // },
- // {
- // label: "二维码",
- // width: 120,
- // overHidden: true,
- // prop: "batchCode",
- // search: true,
- // },
- // {
- // label: "物料名称",
- // prop: "materialName",
- // width: 130,
- // overHidden: true,
- // click: ({ value, column }) => {
- // if (column.boxType) {
- // dialog1.visible = true;
- // }
- // },
- // },
- // {
- // label: "数量",
- // prop: "num",
- // type: "number",
- // min: 0,
- // max: 99999,
- // width: 150,
- // overHidden: true,
- // formatter: (val, value, label) => {
- // if (val.warningMsg) {
- // return val.num + "(" + val.warningMsg + ")";
- // } else {
- // return val.num;
- // }
- // },
- // },
- ],
- });
- const rowStyle = ({ row, column, rowIndex }) => {
- if (row.warningMsg) {
- return {
- backgroundColor: "#f3d2d2",
- color: "#6c6a6a",
- };
- }
- };
- const cellStyle = ({ row, column, rowIndex, columnIndex }) => {
- if (columnIndex === 10) {
- if (row.warningMsg) {
- return {
- color: "red",
- fontWeight: "bold",
- fontSize: "20",
- };
- } else {
- return {
- color: "#60fc56",
- fontWeight: "bold",
- fontSize: "20",
- };
- }
- }
- };
- onMounted(() => {
- dataList();
- });
- </script>
|