|
@@ -7,6 +7,7 @@
|
|
|
:data="data"
|
|
|
:option="option"
|
|
|
v-model:page="page"
|
|
|
+ :permission="permission"
|
|
|
@row-save="createRow"
|
|
|
@row-update="updateRow"
|
|
|
@row-del="deleteRow"
|
|
@@ -25,6 +26,47 @@
|
|
|
@click="multipleDelete"
|
|
|
>删除</el-button
|
|
|
>
|
|
|
+ <el-button
|
|
|
+ :disabled="toDeleteIds.length < 1"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-primary"
|
|
|
+ :size="size"
|
|
|
+ @click="aps1"
|
|
|
+ >批量排程</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ <template #menu="{size,row,index}">
|
|
|
+ <el-button
|
|
|
+ v-hasPerm="[buttonPermission.PLAN.BTNS.work_order_edit]"
|
|
|
+ v-if="row.workOrderState === '0' || row.workOrderState === '1' || row.workOrderState === '2'"
|
|
|
+ type="primary"
|
|
|
+ link
|
|
|
+ size="small"
|
|
|
+ @click="handleEdit(row,0)"
|
|
|
+ ><i-ep-edit />编辑
|
|
|
+ </el-button>
|
|
|
+ <el-button @click="aps(row.id)"
|
|
|
+ icon="el-icon-setting"
|
|
|
+ text
|
|
|
+ v-hasPerm="[buttonPermission.PLAN.BTNS.work_order_aps]"
|
|
|
+ v-if="row.workOrderState === '0' || row.workOrderState === '1' || row.workOrderState === '2'"
|
|
|
+ type="primary"
|
|
|
+ :size="size">排程</el-button>
|
|
|
+ <el-button
|
|
|
+ icon="el-icon-setting"
|
|
|
+ text
|
|
|
+ v-if="row.workOrderState === '2'"
|
|
|
+ @click="distribute(row.id)"
|
|
|
+ type="primary"
|
|
|
+ v-hasPerm="[buttonPermission.PLAN.BTNS.work_order_aps]"
|
|
|
+ :size="size">下发</el-button>
|
|
|
+ <el-button
|
|
|
+ icon="el-icon-setting"
|
|
|
+ text
|
|
|
+ v-if="row.workOrderState !== '0' && row.workOrderState !== '1'"
|
|
|
+ @click="dialog4.visible = true"
|
|
|
+ type="primary"
|
|
|
+ :size="size">流水</el-button>
|
|
|
</template>
|
|
|
</avue-crud>
|
|
|
<el-dialog
|
|
@@ -60,24 +102,80 @@
|
|
|
width="80%"
|
|
|
@close="dialog3.visible = false"
|
|
|
>
|
|
|
- <choice-line-page @orderInfo="lineInfo"/>
|
|
|
+ <choice-line-page :parentCode="form.workshopCode" :materialCode="form.materialCode" @lineInfo="lineInfo"/>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ v-model="dialog4.visible"
|
|
|
+ :title="dialog4.title"
|
|
|
+ width="950px"
|
|
|
+ @close="dialog4.visible = false"
|
|
|
+ >
|
|
|
+ <work-order-seq :workOrderId="form.id"/>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ v-model="dialog5.visible"
|
|
|
+ :title="dialog5.title"
|
|
|
+ width="450px"
|
|
|
+ @close="dialog5.visible = false"
|
|
|
+ >
|
|
|
+ <el-form
|
|
|
+ ref="dataFormRef"
|
|
|
+ :model="formData"
|
|
|
+ :rules="rules"
|
|
|
+ label-width="150px">
|
|
|
+ <el-form-item label="排程时间" prop="apsTime">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="formData.apsTime"
|
|
|
+ type="date"
|
|
|
+ :picker-options="pickerOptions"
|
|
|
+ placeholder="请选择时间"
|
|
|
+ format="YYYY/MM/DD"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ />
|
|
|
+
|
|
|
+<!-- <el-input width="250px" v-model="formData.apsTime" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD"/>-->
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="排程类型" prop="apsModel">
|
|
|
+ <el-radio-group v-model="formData.apsModel">
|
|
|
+ <el-radio :value="0">排产</el-radio>
|
|
|
+<!-- <el-radio :value="1">停用</el-radio>-->
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="handleSubmit">确 定</el-button>
|
|
|
+ <el-button @click="dialog5.visible = false">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script setup>
|
|
|
import { ref, getCurrentInstance } from "vue";
|
|
|
import { useCrud } from "@/hooks/userCrud";
|
|
|
-import ButtonPermKeys from "@/common/configs/buttonPermission";
|
|
|
-
|
|
|
+import buttonPermission from "@/common/configs/buttonPermission";
|
|
|
+import {apsWorkOrder,distributeWorkOrder} from "@/api/order"
|
|
|
import { useCommonStoreHook } from "@/store";
|
|
|
import dictDataUtil from "@/common/configs/dictDataUtil";
|
|
|
import ChoiceRoutePage from "./components/choice-route-page.vue";
|
|
|
import ChoiceWorkshopPage from "./components/choice-workshop-page.vue";
|
|
|
+import WorkOrderSeq from "./components/work-order-seq.vue";
|
|
|
+import { checkPerm } from "@/directive/permission";
|
|
|
const { isShowTable, tableType } = toRefs(useCommonStoreHook());
|
|
|
const test = () => {
|
|
|
isShowTable.value = true;
|
|
|
tableType.value = tableType.value == 1 ? 2 : 1;
|
|
|
};
|
|
|
+const permission = reactive({
|
|
|
+ delBtn: checkPerm(buttonPermission.PLAN.BTNS.work_order_del),
|
|
|
+ addBtn: checkPerm(buttonPermission.PLAN.BTNS.work_order_add),
|
|
|
+ editBtn: checkPerm(buttonPermission.PLAN.BTNS.work_order_edit),
|
|
|
+ menu: true,
|
|
|
+});
|
|
|
const dialog = reactive({
|
|
|
title: "订单选择",
|
|
|
visible: false,
|
|
@@ -94,6 +192,69 @@ const dialog3 = reactive({
|
|
|
title: "产线选择",
|
|
|
visible: false,
|
|
|
});
|
|
|
+const dialog4 = reactive({
|
|
|
+ title: "工单流水",
|
|
|
+ visible: false,
|
|
|
+});
|
|
|
+const dialog5 = reactive({
|
|
|
+ title: "排程确认",
|
|
|
+ visible: false,
|
|
|
+});
|
|
|
+const pickerOptions = ref({
|
|
|
+ disabledDate(time) {
|
|
|
+ return time.getTime() < Date.now() - 8.64e7;
|
|
|
+ }
|
|
|
+})
|
|
|
+const aps =(id)=>{
|
|
|
+ formData.workOrderIds = [id]
|
|
|
+ dialog5.visible = true
|
|
|
+}
|
|
|
+const distribute = (id)=>{
|
|
|
+ ElMessageBox.confirm("当前操作不可逆,确定下发工单吗?")
|
|
|
+ .then(() => {
|
|
|
+ distributeWorkOrder(id).then((data)=>{
|
|
|
+ ElMessage.success(data.msg);
|
|
|
+ dataList()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ // catch error
|
|
|
+ });
|
|
|
+}
|
|
|
+const handleEdit = (row, index) =>{
|
|
|
+ crudRef.value && crudRef.value.rowEdit(row, index);
|
|
|
+}
|
|
|
+const aps1 =()=>{
|
|
|
+ formData.workOrderIds = toDeleteIds
|
|
|
+ dialog5.visible = true
|
|
|
+}
|
|
|
+const dataFormRef = ref(ElForm);
|
|
|
+
|
|
|
+const formData = reactive({
|
|
|
+ apsTime: null,
|
|
|
+ apsModel: 0,
|
|
|
+ workOrderId: 0
|
|
|
+});
|
|
|
+
|
|
|
+const rules = reactive({
|
|
|
+ apsTime: [{ required: true, message: "排程时间不能为空", trigger: "blur" }],
|
|
|
+ apsModel: [{ required: true, message: "排程类型不能为空", trigger: "blur" }],
|
|
|
+});
|
|
|
+const handleSubmit =()=>{
|
|
|
+ dataFormRef.value.validate((isValid) => {
|
|
|
+ if (isValid) {
|
|
|
+ apsWorkOrder(formData).then((data)=>{
|
|
|
+ if(data.code === '200'){
|
|
|
+ ElMessage.success(data.msg);
|
|
|
+ dialog5.visible = false
|
|
|
+ dataList()
|
|
|
+ }else{
|
|
|
+ ElMessage.error(data.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
const orderInfo = (value) => {
|
|
|
form.value.orderCode = value.orderCode
|
|
|
form.value.orderName = value.orderName
|
|
@@ -104,12 +265,14 @@ const orderInfo = (value) => {
|
|
|
dialog.visible = false
|
|
|
}
|
|
|
const lineInfo = (value) => {
|
|
|
- form.value.orderCode = value.orderCode
|
|
|
+ form.value.productLineId = value.id
|
|
|
+ form.value.productLineName = value.name
|
|
|
dialog3.visible = false
|
|
|
}
|
|
|
const workShopInfo = (value) => {
|
|
|
- form.value.workShopId = value.id
|
|
|
- form.value.workShopName = value.id
|
|
|
+ form.value.workshopName = value.id
|
|
|
+ form.value.workshopCode = value.code
|
|
|
+ form.value.workshopName = value.name
|
|
|
dialog2.visible = false
|
|
|
}
|
|
|
const routeInfo = (value) => {
|
|
@@ -132,20 +295,21 @@ const crudRef = ref(null); //crudRef.value 获取avue-crud对象
|
|
|
// 设置表格列或者其他自定义的option
|
|
|
option.value = Object.assign(option.value, {
|
|
|
delBtn: false,
|
|
|
- selection: false,
|
|
|
+ selection: true,
|
|
|
+ editBtn: false,
|
|
|
column: [
|
|
|
{
|
|
|
label: "工单编号",
|
|
|
prop: "workOrderCode",
|
|
|
search: true,
|
|
|
display: false,
|
|
|
- width: 115,
|
|
|
+ width: 125,
|
|
|
},
|
|
|
{
|
|
|
label: "订单编号",
|
|
|
prop: "orderCode",
|
|
|
search: true,
|
|
|
- width: 115,
|
|
|
+ width: 125,
|
|
|
rules: [
|
|
|
{
|
|
|
required: true,
|
|
@@ -271,6 +435,13 @@ option.value = Object.assign(option.value, {
|
|
|
],
|
|
|
click: ({ value, column }) => {
|
|
|
if(column.boxType){
|
|
|
+ if(!form.value.workshopCode){
|
|
|
+ ElMessage({
|
|
|
+ message: "请先选择生产车间",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
dialog3.visible = true
|
|
|
}
|
|
|
},
|
|
@@ -278,14 +449,14 @@ option.value = Object.assign(option.value, {
|
|
|
{
|
|
|
label: "开始时间",
|
|
|
prop: "planStartWhen",
|
|
|
- width: 120,
|
|
|
+ width: 180,
|
|
|
overHidden: true,
|
|
|
display: false,
|
|
|
},
|
|
|
{
|
|
|
label: "结束时间",
|
|
|
prop: "planStartEnd",
|
|
|
- width: 120,
|
|
|
+ width: 180,
|
|
|
display: false,
|
|
|
overHidden: true,
|
|
|
},
|
|
@@ -293,6 +464,9 @@ option.value = Object.assign(option.value, {
|
|
|
label: "工单数量",
|
|
|
prop: "planNum",
|
|
|
width: 85,
|
|
|
+ type: "number",
|
|
|
+ min: 1,
|
|
|
+ max: 99999,
|
|
|
rules: [
|
|
|
{
|
|
|
required: true,
|
|
@@ -322,7 +496,7 @@ option.value = Object.assign(option.value, {
|
|
|
},
|
|
|
{
|
|
|
label: "创建时间",
|
|
|
- width: 100,
|
|
|
+ width: 180,
|
|
|
display: false,
|
|
|
prop: "created",
|
|
|
},
|
|
@@ -339,18 +513,4 @@ onMounted(() => {
|
|
|
// console.log("crudRef", crudRef)
|
|
|
dataList();
|
|
|
});
|
|
|
-/**
|
|
|
- * 上传excel相关
|
|
|
- */
|
|
|
-const uploadRef = ref(null);
|
|
|
-const uploadFinished = () => {
|
|
|
- // 上传完成后的刷新操作
|
|
|
- page.currentPage = 1;
|
|
|
- dataList();
|
|
|
-};
|
|
|
-const importExcelData = () => {
|
|
|
- if (uploadRef.value) {
|
|
|
- uploadRef.value.show("/api/v1/device/import");
|
|
|
- }
|
|
|
-};
|
|
|
</script>
|