|
@@ -1,11 +1,11 @@
|
|
|
<template>
|
|
|
<div class="mainContentBox">
|
|
|
<avue-crud
|
|
|
- ref="crudRef"
|
|
|
+ ref="crudRef"
|
|
|
:option="option"
|
|
|
v-model:page="page"
|
|
|
v-model:search="search"
|
|
|
- v-model="form"
|
|
|
+ v-model="form"
|
|
|
:table-loading="loading"
|
|
|
:permission="permission"
|
|
|
@search-change="handleQuery"
|
|
@@ -17,6 +17,9 @@
|
|
|
@row-del="rowDel"
|
|
|
:data="pageData"
|
|
|
>
|
|
|
+ <template #menu-left="{ size }">
|
|
|
+ <el-button type="primary" @click="scan">扫码导入</el-button>
|
|
|
+ </template>
|
|
|
<template #menu-right="{}">
|
|
|
<el-dropdown split-button v-hasPerm="['plan:order:import']"
|
|
|
>导入
|
|
@@ -39,17 +42,21 @@
|
|
|
<template #icon> <i-ep-download /> </template>导出
|
|
|
</el-button>
|
|
|
</template>
|
|
|
- <template #menu="{size,row,index}">
|
|
|
+ <template #menu="{ size, row, index }">
|
|
|
<el-button
|
|
|
- v-hasPerm="[buttonPermission.PLAN.BTNS.order_edit]"
|
|
|
- v-if="row.orderState === '0' || row.orderState === '1' || row.orderState === '2'"
|
|
|
- type="primary"
|
|
|
- link
|
|
|
- size="small"
|
|
|
- @click="handleEdit(row,0)"
|
|
|
- ><i-ep-edit />编辑
|
|
|
+ v-hasPerm="[buttonPermission.PLAN.BTNS.order_edit]"
|
|
|
+ v-if="
|
|
|
+ row.orderState === '0' ||
|
|
|
+ row.orderState === '1' ||
|
|
|
+ row.orderState === '2'
|
|
|
+ "
|
|
|
+ type="primary"
|
|
|
+ link
|
|
|
+ size="small"
|
|
|
+ @click="handleEdit(row, 0)"
|
|
|
+ ><i-ep-edit />编辑
|
|
|
</el-button>
|
|
|
-<!-- <el-button
|
|
|
+ <!-- <el-button
|
|
|
v-if="row.nameplated === 1"
|
|
|
type="info"
|
|
|
link
|
|
@@ -58,23 +65,30 @@
|
|
|
><i-ep-edit />铭牌
|
|
|
</el-button>-->
|
|
|
<el-button
|
|
|
- v-hasPerm="[buttonPermission.PLAN.BTNS.order_del]"
|
|
|
- v-if="row.orderState === '0' || row.orderState === '1' || row.orderState === '2'"
|
|
|
- type="danger"
|
|
|
- link
|
|
|
- size="small"
|
|
|
- @click="rowDel(row,0)"
|
|
|
- ><i-ep-edit />删除
|
|
|
+ v-hasPerm="[buttonPermission.PLAN.BTNS.order_del]"
|
|
|
+ v-if="
|
|
|
+ row.orderState === '0' ||
|
|
|
+ row.orderState === '1' ||
|
|
|
+ row.orderState === '2'
|
|
|
+ "
|
|
|
+ type="danger"
|
|
|
+ link
|
|
|
+ size="small"
|
|
|
+ @click="rowDel(row, 0)"
|
|
|
+ ><i-ep-edit />删除
|
|
|
+ </el-button>
|
|
|
+ <el-button type="primary" size="small" @click="handleScanCode(row.id)"
|
|
|
+ >二维码生成
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</avue-crud>
|
|
|
<el-dialog
|
|
|
- v-model="dialog1.visible"
|
|
|
- :title="dialog1.title"
|
|
|
- width="950px"
|
|
|
- @close="dialog1.visible = false"
|
|
|
+ v-model="dialog1.visible"
|
|
|
+ :title="dialog1.title"
|
|
|
+ width="950px"
|
|
|
+ @close="dialog1.visible = false"
|
|
|
>
|
|
|
- <choice-item-page @materialInfo="materialInfo"/>
|
|
|
+ <choice-item-page @material-info="materialInfo" />
|
|
|
</el-dialog>
|
|
|
<el-dialog
|
|
|
v-model="dialog.visible"
|
|
@@ -120,6 +134,71 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+ <el-dialog
|
|
|
+ v-model="dialog2.visible"
|
|
|
+ :title="dialog2.title"
|
|
|
+ width="950px"
|
|
|
+ @close="
|
|
|
+ dialog2.visible = false;
|
|
|
+ scanArray = [];
|
|
|
+ scanCpArray = [];
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ @keyup.enter="scanFnc"
|
|
|
+ v-model="scanCode"
|
|
|
+ style="padding: 20px"
|
|
|
+ placeholder="请扫码"
|
|
|
+ />
|
|
|
+
|
|
|
+ <div class="scanInfo">
|
|
|
+ <el-scrollbar class="scrollbar">
|
|
|
+ <div class="item" v-for="(item, index) in scanArray" :key="index">
|
|
|
+ <div class="text">扫码Cp: {{ item.cp }}</div>
|
|
|
+ <div @click="deleteItem(index)" class="text">
|
|
|
+ <el-icon><Delete /></el-icon>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-if="scanArray.length < 1">暂无数据</div>
|
|
|
+ </el-scrollbar>
|
|
|
+ <div class="bottombtn">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ :disabled="scanArray.length < 1"
|
|
|
+ @click="scanSubmit"
|
|
|
+ >生 成</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- <vue-qrcode value="1241421gaga" size="45" error-level="H" /> -->
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ <el-dialog
|
|
|
+ v-model="dialog3.visible"
|
|
|
+ :title="dialog3.title"
|
|
|
+ width="950px"
|
|
|
+ @close="
|
|
|
+ dialog3.visible = false;
|
|
|
+ scanCodeArray = [];
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <div class="scanInfo">
|
|
|
+ <div style="padding: 0 20px; text-align: center">
|
|
|
+ 二维码数量:{{ scanCodeArray.length }}
|
|
|
+ </div>
|
|
|
+ <el-scrollbar class="scrollbar">
|
|
|
+ <div
|
|
|
+ class="scancodeitem"
|
|
|
+ v-for="(item, index) in scanCodeArray"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <vue-qrcode :value="item" size="45" error-level="H" />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div v-if="scanCodeArray.length < 1">暂无数据</div>
|
|
|
+ </el-scrollbar>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
<CommonTable
|
|
|
ref="ctableRef"
|
|
|
tableTitle="报故单"
|
|
@@ -143,8 +222,11 @@ import {
|
|
|
importOrder,
|
|
|
updateOrder,
|
|
|
getExpandAlias,
|
|
|
+ scanImport,
|
|
|
+ getScanCode,
|
|
|
} from "@/api/order";
|
|
|
-import {ref} from "vue";
|
|
|
+import { ref } from "vue";
|
|
|
+import _ from "lodash-es";
|
|
|
import ChoiceItemPage from "@/views/base/materials/components/choice-item-page.vue";
|
|
|
|
|
|
// 弹窗对象
|
|
@@ -168,15 +250,23 @@ const importData = reactive({
|
|
|
fileList: [],
|
|
|
});
|
|
|
const materialInfo = (value) => {
|
|
|
- form.value.materialCode = value.materialCode
|
|
|
- form.value.materialName = value.materialName
|
|
|
- form.value.materialModel = value.spec
|
|
|
- dialog1.visible = false
|
|
|
-}
|
|
|
+ form.value.materialCode = value.materialCode;
|
|
|
+ form.value.materialName = value.materialName;
|
|
|
+ form.value.materialModel = value.spec;
|
|
|
+ dialog1.visible = false;
|
|
|
+};
|
|
|
const dialog1 = reactive({
|
|
|
title: "物料选择",
|
|
|
visible: false,
|
|
|
});
|
|
|
+const dialog2 = reactive({
|
|
|
+ title: "扫码导入",
|
|
|
+ visible: false,
|
|
|
+});
|
|
|
+const dialog3 = reactive({
|
|
|
+ title: "二维码详情",
|
|
|
+ visible: false,
|
|
|
+});
|
|
|
const permission = reactive({
|
|
|
delBtn: checkPerm(buttonPermission.PLAN.BTNS.order_del),
|
|
|
addBtn: checkPerm(buttonPermission.PLAN.BTNS.order_add),
|
|
@@ -241,7 +331,7 @@ option.value = {
|
|
|
type: "select", //类型为下拉选择框
|
|
|
width: 100,
|
|
|
overHidden: true,
|
|
|
- editDisabled:true,
|
|
|
+ editDisabled: true,
|
|
|
dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.plan_order_type,
|
|
|
props: {
|
|
|
label: "dictLabel",
|
|
@@ -257,15 +347,15 @@ option.value = {
|
|
|
},
|
|
|
],
|
|
|
change: ({ value, column }) => {
|
|
|
- if(value==='2'){
|
|
|
- option.value.column[4].display=true;
|
|
|
- option.value.column[6].disabled=true;
|
|
|
- option.value.column[10].disabled=true;
|
|
|
+ if (value === "2") {
|
|
|
+ option.value.column[4].display = true;
|
|
|
+ option.value.column[6].disabled = true;
|
|
|
+ option.value.column[10].disabled = true;
|
|
|
}
|
|
|
- if(value==='1'){
|
|
|
- option.value.column[4].display=false;
|
|
|
- option.value.column[6].disabled=false;
|
|
|
- option.value.column[10].disabled=false;
|
|
|
+ if (value === "1") {
|
|
|
+ option.value.column[4].display = false;
|
|
|
+ option.value.column[6].disabled = false;
|
|
|
+ option.value.column[10].disabled = false;
|
|
|
}
|
|
|
},
|
|
|
},
|
|
@@ -273,21 +363,19 @@ option.value = {
|
|
|
label: "报故单",
|
|
|
prop: "trackingNumber",
|
|
|
width: 100,
|
|
|
- display:false,
|
|
|
- click:({ value, column }) => {
|
|
|
+ display: false,
|
|
|
+ click: ({ value, column }) => {
|
|
|
if (ctableRef.value) {
|
|
|
ctableRef.value.startSelect();
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
},
|
|
|
{
|
|
|
label: "报故单id",
|
|
|
prop: "faultId",
|
|
|
width: 100,
|
|
|
- display:false,
|
|
|
- hide:true,
|
|
|
-
|
|
|
+ display: false,
|
|
|
+ hide: true,
|
|
|
},
|
|
|
{
|
|
|
label: "产品编码",
|
|
@@ -303,8 +391,8 @@ option.value = {
|
|
|
},
|
|
|
],
|
|
|
click: ({ value, column }) => {
|
|
|
- if(column.boxType){
|
|
|
- dialog1.visible = true
|
|
|
+ if (column.boxType) {
|
|
|
+ dialog1.visible = true;
|
|
|
}
|
|
|
},
|
|
|
},
|
|
@@ -347,7 +435,6 @@ option.value = {
|
|
|
filterable: true, //添加filterable属性即可启用搜索功能
|
|
|
},
|
|
|
|
|
|
-
|
|
|
{
|
|
|
label: "订单数量",
|
|
|
prop: "orderNum",
|
|
@@ -409,7 +496,7 @@ option.value = {
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
- /* {
|
|
|
+ /* {
|
|
|
label: "所属公司",
|
|
|
prop: "companyId",
|
|
|
width: 100,
|
|
@@ -478,7 +565,84 @@ option.value = {
|
|
|
},
|
|
|
],
|
|
|
};
|
|
|
+function useScanCode() {
|
|
|
+ const scanCodeArray = ref([]);
|
|
|
+ const handleScanCode = async (id: string) => {
|
|
|
+ const { data, code } = await getScanCode(id);
|
|
|
+ let data1 = [];
|
|
|
+ data1.push(data[0]);
|
|
|
+ data1.push(data[0]);
|
|
|
+ scanCodeArray.value = data1;
|
|
|
+ dialog3.visible = true;
|
|
|
+ };
|
|
|
+ return { scanCodeArray, handleScanCode };
|
|
|
+}
|
|
|
+const { scanCodeArray, handleScanCode } = useScanCode();
|
|
|
+//扫码板块
|
|
|
|
|
|
+function useScan() {
|
|
|
+ const scanCode = ref("");
|
|
|
+ const scanArray = ref([]);
|
|
|
+ const scanCpArray = ref([]);
|
|
|
+ const scanStatus = ref(false);
|
|
|
+ const deleteItem = (index: any) => {
|
|
|
+ scanArray.value.splice(index, 1);
|
|
|
+ };
|
|
|
+ const scan = () => {
|
|
|
+ dialog2.visible = true;
|
|
|
+ };
|
|
|
+ const scanFnc = () => {
|
|
|
+ if (scanCode.value) {
|
|
|
+ // scanCode.value =
|
|
|
+ // '{"id":"453b5261e07745f2b7f4a042171f0644","tp":"10","cp":"1", "data":"PD94bWwgdmVyc2lvbj0iMS4wliBlbmNvZGluZz0iROlyMzEylj8+PFI+PERBIEIEPSJhc2QyMzRhZGYzNDJkZGZhc3NzliBOcDOiNSlgY3A9liEiPjxsaXN0IE5hPSJCT00iPjxCT00gdHk9lkkiPjxBPuS6p+WTgeWei+WPtzQT48Qj7lm77li7c8L0|+PEM+5qOA6agM5L6d5o2uPC9DPjxUSj"}';
|
|
|
+ let obj = {};
|
|
|
+ obj = JSON.parse(scanCode.value);
|
|
|
+ if (!_.includes(scanCpArray.value, obj.cp)) {
|
|
|
+ scanArray.value.push(obj);
|
|
|
+ scanCpArray.value.push(obj.cp);
|
|
|
+ ElMessage.success("扫码成功");
|
|
|
+ } else {
|
|
|
+ ElMessage.error("请勿重复扫码");
|
|
|
+ }
|
|
|
+ //判定是否重复扫码
|
|
|
+ } else {
|
|
|
+ ElMessage.error("请正确扫码");
|
|
|
+ }
|
|
|
+ scanCode.value = "";
|
|
|
+ };
|
|
|
+ const scanSubmit = async () => {
|
|
|
+ const { data, code } = await scanImport({
|
|
|
+ planOrderImportList: scanArray.value,
|
|
|
+ });
|
|
|
+ if (code == "200") {
|
|
|
+ ElMessage.success("导入成功!");
|
|
|
+ dialog2.visible = false;
|
|
|
+ scanArray.value = [];
|
|
|
+ scanCpArray.value = [];
|
|
|
+ handleQuery(null, null);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ return {
|
|
|
+ scanCode,
|
|
|
+ scanArray,
|
|
|
+ scanCpArray,
|
|
|
+ scanStatus,
|
|
|
+ scan,
|
|
|
+ scanFnc,
|
|
|
+ deleteItem,
|
|
|
+ scanSubmit,
|
|
|
+ };
|
|
|
+}
|
|
|
+const {
|
|
|
+ scanCode,
|
|
|
+ scanArray,
|
|
|
+ scanCpArray,
|
|
|
+ scanStatus,
|
|
|
+ scanSubmit,
|
|
|
+ scan,
|
|
|
+ scanFnc,
|
|
|
+ deleteItem,
|
|
|
+} = useScan();
|
|
|
const queryExpandAlias = () => {
|
|
|
getExpandAlias(dictDataUtil.EXPAND_FIELD_TABLE.plan_order_info).then(
|
|
|
(data: any) => {
|
|
@@ -541,9 +705,9 @@ const rowUpdate = (form: any, index: any, done: any, loading: any) => {
|
|
|
handleQuery(null, null);
|
|
|
});
|
|
|
};
|
|
|
-const handleNameplated = (row) =>{
|
|
|
- ElMessage.warning("功能开发中")
|
|
|
-}
|
|
|
+const handleNameplated = (row) => {
|
|
|
+ ElMessage.warning("功能开发中");
|
|
|
+};
|
|
|
const rowDel = (form: any, index) => {
|
|
|
ElMessageBox.confirm("当前操作会删除数据,你确认要继续吗?")
|
|
|
.then(() => {
|
|
@@ -582,9 +746,9 @@ const downloadTemplate = () => {
|
|
|
downFile(response);
|
|
|
});
|
|
|
};
|
|
|
-const handleEdit = (row: any, index: any) =>{
|
|
|
+const handleEdit = (row: any, index: any) => {
|
|
|
crudRef.value && crudRef.value.rowEdit(row, index);
|
|
|
-}
|
|
|
+};
|
|
|
/** 弹窗提交 */
|
|
|
const handleSubmit = () => {
|
|
|
importOrder(importData).then((data: any) => {
|
|
@@ -638,12 +802,52 @@ onMounted?.(() => {
|
|
|
});
|
|
|
|
|
|
/** 选择报故单 */
|
|
|
-const onSelectedFinish=(selectedValue)=>{
|
|
|
- form.value.materialCode=selectedValue.materialCode;
|
|
|
- form.value.materialName=selectedValue.materialName;
|
|
|
- form.value.materialModel=selectedValue.spec;
|
|
|
- form.value.faultId=selectedValue.id;
|
|
|
- form.value.trackingNumber=selectedValue.trackingNumber;
|
|
|
- form.value.orderNum=selectedValue.unqualifiedNum;
|
|
|
-}
|
|
|
+const onSelectedFinish = (selectedValue) => {
|
|
|
+ form.value.materialCode = selectedValue.materialCode;
|
|
|
+ form.value.materialName = selectedValue.materialName;
|
|
|
+ form.value.materialModel = selectedValue.spec;
|
|
|
+ form.value.faultId = selectedValue.id;
|
|
|
+ form.value.trackingNumber = selectedValue.trackingNumber;
|
|
|
+ form.value.orderNum = selectedValue.unqualifiedNum;
|
|
|
+};
|
|
|
</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.scanInfo {
|
|
|
+ width: 100%;
|
|
|
+
|
|
|
+ .scrollbar {
|
|
|
+ padding: 20px;
|
|
|
+ height: 350px;
|
|
|
+ .item {
|
|
|
+ margin: 20px 0;
|
|
|
+ width: 100%;
|
|
|
+ background-color: #80808030;
|
|
|
+ border-radius: 16px;
|
|
|
+ height: 60px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ padding: 0 20px;
|
|
|
+ .el-icon {
|
|
|
+ width: 50px;
|
|
|
+ height: 50px;
|
|
|
+ color: red;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .scancodeitem {
|
|
|
+ width: 100%;
|
|
|
+ margin: 10px 0;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .bottombtn {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|