若依前端-APP中使用数据字典

yqj234 2024-07-08 15:33:02 阅读 84

 

<code><template>

<div class="app-container">code>

<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">code>

<el-form-item label="入库单编号" prop="recptCode">code>

<el-input

v-model="queryParams.recptCode"code>

placeholder="请输入入库单编号"code>

clearable

@keyup.enter.native="handleQuery"code>

/>

</el-form-item>

<el-form-item label="入库单名称" prop="recptName">code>

<el-input

v-model="queryParams.recptName"code>

placeholder="请输入入库单名称"code>

clearable

@keyup.enter.native="handleQuery"code>

/>

</el-form-item>

<el-form-item label="生产工单" prop="workorderCode">code>

<el-input

v-model="queryParams.workorderCode"code>

placeholder="请输入生产工单编码"code>

clearable

@keyup.enter.native="handleQuery"code>

/>

</el-form-item>

<el-form-item label="仓库" prop="warehouseName">code>

<el-input

v-model="queryParams.warehouseName"code>

placeholder="请输入仓库名称"code>

clearable

@keyup.enter.native="handleQuery"code>

/>

</el-form-item>

<el-form-item>

<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>code>

<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>code>

</el-form-item>

</el-form>

<el-row :gutter="10" class="mb8">code>

<el-col :span="1.5">code>

<el-button

type="primary"code>

plain

icon="el-icon-plus"code>

size="mini"code>

@click="handleAdd"code>

v-hasPermi="['mes:wm:productrecpt:add']"code>

>新增</el-button>

</el-col>

<el-col :span="1.5">code>

<el-button

type="success"code>

plain

icon="el-icon-edit"code>

size="mini"code>

:disabled="single"code>

@click="handleUpdate"code>

v-hasPermi="['mes:wm:productrecpt:edit']"code>

>修改</el-button>

</el-col>

<el-col :span="1.5">code>

<el-button

type="danger"code>

plain

icon="el-icon-delete"code>

size="mini"code>

:disabled="multiple"code>

@click="handleDelete"code>

v-hasPermi="['mes:wm:productrecpt:remove']"code>

>删除</el-button>

</el-col>

<el-col :span="1.5">code>

<el-button

type="warning"code>

plain

icon="el-icon-download"code>

size="mini"code>

@click="handleExport"code>

v-hasPermi="['mes:wm:productrecpt:export']"code>

>导出</el-button>

</el-col>

<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>code>

</el-row>

<el-table v-loading="loading" :data="productrecptList" @selection-change="handleSelectionChange">code>

<el-table-column type="selection" width="55" align="center" />code>

<el-table-column label="入库单编号" width="130px" align="center" prop="recptCode" >code>

<template slot-scope="scope">code>

<el-button

type="text"code>

@click="handleView(scope.row)"code>

v-hasPermi="['mes:wm:productrecpt:query']"code>

>{ {scope.row.recptCode}}</el-button>

</template>

</el-table-column>

<el-table-column label="入库单名称" width="150px" align="center" prop="recptName" :show-overflow-tooltip="true"/>code>

<el-table-column label="生产工单编码" width="150px" align="center" prop="workorderCode" />code>

<el-table-column label="产品编码" align="center" prop="itemCode" />code>

<el-table-column label="产品名称" align="center" prop="itemName" />code>

<el-table-column label="入库日期" align="center" prop="recptDate" width="120">code>

<template slot-scope="scope">code>

<span>{ { parseTime(scope.row.recptDate, '{y}-{m}-{d}') }}</span>

</template>

</el-table-column>

<el-table-column label="单据状态" align="center" prop="status">code>

<template slot-scope="scope">code>

<dict-tag :options="dict.type.mes_order_status" :value="scope.row.status"/>code>

</template>

</el-table-column>

<el-table-column label="操作" align="center" class-name="small-padding fixed-width">code>

<template slot-scope="scope">code>

<el-button

size="mini"code>

type="text"code>

icon="el-icon-video-play"code>

v-if="scope.row.status =='PREPARE'"code>

@click="handleExecute(scope.row)"code>

v-hasPermi="['mes:wm:productrecpt:edit']"code>

>执行入库</el-button>

<el-button

size="mini"code>

type="text"code>

icon="el-icon-edit"code>

@click="handleUpdate(scope.row)"code>

v-if="scope.row.status =='PREPARE'"code>

v-hasPermi="['mes:wm:productrecpt:edit']"code>

>修改</el-button>

<el-button

size="mini"code>

type="text"code>

icon="el-icon-delete"code>

@click="handleDelete(scope.row)"code>

v-if="scope.row.status =='PREPARE'"code>

v-hasPermi="['mes:wm:productrecpt:remove']"code>

>删除</el-button>

</template>

</el-table-column>

</el-table>

<pagination

v-show="total>0"code>

:total="total"code>

:page.sync="queryParams.pageNum"code>

:limit.sync="queryParams.pageSize"code>

@pagination="getList"code>

/>

<!-- 添加或修改产品入库录对话框 -->

<el-dialog :title="title" :visible.sync="open" width="960px" append-to-body>code>

<el-form ref="form" :model="form" :rules="rules" label-width="100px">code>

<el-row>

<el-col :span="8">code>

<el-form-item label="入库单编号" prop="recptCode">code>

<el-input v-model="form.recptCode" placeholder="请输入入库单编号" />code>

</el-form-item>

</el-col>

<el-col :span="4">code>

<el-form-item label-width="80">code>

<el-switch v-model="autoGenFlag"code>

active-color="#13ce66"code>

active-text="自动生成"code>

@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view' && form.status =='PREPARE'"> code>

</el-switch>

</el-form-item>

</el-col>

<el-col :span="12">code>

<el-form-item label="入库单名称" prop="recptName">code>

<el-input v-model="form.recptName" placeholder="请输入入库单名称" />code>

</el-form-item>

</el-col>

</el-row>

<el-row>

<el-col :span="8">code>

<el-form-item label="生产工单" prop="workorderCode">code>

<el-input v-model="form.workorderCode" placeholder="请选择生产工单" >code>

<el-button slot="append" icon="el-icon-search" @click="handleWorkorderSelect"></el-button>code>

</el-input>

<WorkorderSelect ref="woSelect" @onSelected="onWorkorderSelected"></WorkorderSelect>code>

</el-form-item>

</el-col>

<el-col :span="8">code>

<el-form-item label="生产工单名称" prop="workorderName">code>

<el-input v-model="form.workorderName" readonly="readonly" />code>

</el-form-item>

</el-col>

<el-col :span="8">code>

<el-form-item label="入库日期" prop="recptDate">code>

<el-date-picker clearable

v-model="form.recptDate"code>

type="date"code>

value-format="yyyy-MM-dd"code>

placeholder="请选择入库日期">code>

</el-date-picker>

</el-form-item>

</el-col>

</el-row>

<el-row>

<el-col :span="24">code>

<el-form-item label="备注" prop="remark">code>

<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />code>

</el-form-item>

</el-col>

</el-row>

</el-form>

<el-divider v-if="form.recptId !=null" content-position="center">物料信息</el-divider> code>

<el-card shadow="always" v-if="form.recptId !=null" class="box-card">code>

<Productrecptline :recptId="form.recptId" :optType="optType" :workorderId="form.workorderId" :itemId="form.itemId"></Productrecptline>code>

</el-card>

<div slot="footer" class="dialog-footer">code>

<el-button type="primary" @click="cancel" v-if="optType =='view' || form.status !='PREPARE' ">返回</el-button>code>

<el-button type="primary" @click="submitForm" v-if="form.status =='PREPARE' && optType !='view' ">保 存</el-button> code>

<el-button @click="cancel">取 消</el-button>code>

</div>

</el-dialog>

</div>

</template>

<script>

import { listProductrecpt, getProductrecpt, delProductrecpt, addProductrecpt, updateProductrecpt ,execute} from "@/api/mes/wm/productrecpt";

import WorkorderSelect from "@/components/workorderSelect/single.vue"

import Productrecptline from "./line.vue"

import {getTreeList} from "@/api/mes/wm/warehouse"

import {genCode} from "@/api/system/autocode/rule"

export default {

name: "Productrecpt",

dicts: ['mes_order_status'],

components:{WorkorderSelect,Productrecptline},

data() {

return {

//自动生成编码

autoGenFlag:false,

optType: undefined,

warehouseInfo:[],

warehouseOptions:[],

warehouseProps:{

multiple: false,

value: 'pId',

label: 'pName',

},

// 遮罩层

loading: true,

// 选中数组

ids: [],

// 非单个禁用

single: true,

// 非多个禁用

multiple: true,

// 显示搜索条件

showSearch: true,

// 总条数

total: 0,

// 产品入库录表格数据

productrecptList: [],

// 弹出层标题

title: "",

// 是否显示弹出层

open: false,

// 查询参数

queryParams: {

pageNum: 1,

pageSize: 10,

recptCode: null,

recptName: null,

workorderId: null,

workorderCode: null,

workorderName: null,

warehouseId: null,

warehouseCode: null,

warehouseName: null,

locationId: null,

locationCode: null,

locationName: null,

areaId: null,

areaCode: null,

areaName: null,

recptDate: null,

status: null,

},

// 表单参数

form: {},

// 表单校验

rules: {

recptCode: [

{ required: true, message: "入库单编号不能为空", trigger: "blur" }

],

recptDate: [

{ required: true, message: "请选择入库日期", trigger: "blur" }

],

workorderCode: [

{ required: true, message: "请选择生产工单", trigger: "blur" }

],

}

};

},

created() {

this.getList();

this.getWarehouseList();

},

methods: {

/** 查询产品入库录列表 */

getList() {

this.loading = true;

listProductrecpt(this.queryParams).then(response => {

this.productrecptList = response.rows;

this.total = response.total;

this.loading = false;

});

},

getWarehouseList(){

getTreeList().then( response =>{

this.warehouseOptions = response.data;

this.warehouseOptions.map(w =>{

w.children.map(l =>{

let lstr =JSON.stringify(l.children).replace(/locationId/g,'lId').replace(/areaId/g, 'pId').replace(/areaName/g,'pName');

l.children = JSON.parse(lstr);

});

let wstr = JSON.stringify(w.children).replace(/warehouseId/g,'wId').replace(/locationId/g, 'pId').replace(/locationName/g,'pName');

w.children = JSON.parse(wstr);

});

let ostr=JSON.stringify(this.warehouseOptions).replace(/warehouseId/g,'pId').replace(/warehouseName/g, 'pName');

this.warehouseOptions = JSON.parse(ostr);

});

},

// 取消按钮

cancel() {

this.open = false;

this.reset();

},

// 表单重置

reset() {

this.form = {

recptId: null,

recptCode: null,

recptName: null,

workorderId: null,

workorderCode: null,

workorderName: null,

warehouseId: null,

warehouseCode: null,

warehouseName: null,

locationId: null,

locationCode: null,

locationName: null,

itemId: null,

itemCode: null,

itemName: null,

unitOfMeasure: null,

clientCode: null,

clientName: null,

areaId: null,

areaCode: null,

areaName: null,

recptDate: new Date(),

status: "PREPARE",

remark: null,

attr1: null,

attr2: null,

attr3: null,

attr4: null,

createBy: null,

createTime: null,

updateBy: null,

updateTime: null

};

this.autoGenFlag = false;

this.resetForm("form");

},

/** 搜索按钮操作 */

handleQuery() {

this.queryParams.pageNum = 1;

this.getList();

},

/** 重置按钮操作 */

resetQuery() {

this.resetForm("queryForm");

this.handleQuery();

},

// 多选框选中数据

handleSelectionChange(selection) {

this.ids = selection.map(item => item.recptId)

this.single = selection.length!==1

this.multiple = !selection.length

},

// 查询明细按钮操作

handleView(row){

this.reset();

const recptId = row.recptId || this.ids

getProductrecpt(recptId).then(response => {

this.form = response.data;

this.open = true;

this.title = "查看产品入库单";

this.optType = "view";

});

},

/** 新增按钮操作 */

handleAdd() {

this.reset();

this.open = true;

this.title = "添加产品入库单";

},

/** 修改按钮操作 */

handleUpdate(row) {

this.reset();

const recptId = row.recptId || this.ids

getProductrecpt(recptId).then(response => {

this.form = response.data;

this.open = true;

this.title = "修改产品入库单";

});

},

//执行入库

handleExecute(row){

const recptIds = row.recptId || this.ids;

this.$modal.confirm('确认执行入库?').then(function() {

return execute(recptIds)//执行入库

}).then(() => {

this.getList();

this.$modal.msgSuccess("入库成功");

}).catch(() => {});

},

/** 提交按钮 */

submitForm() {

this.$refs["form"].validate(valid => {

if (valid) {

if (this.form.recptId != null) {

updateProductrecpt(this.form).then(response => {

this.$modal.msgSuccess("修改成功");

this.open = false;

this.getList();

});

} else {

addProductrecpt(this.form).then(response => {

this.$modal.msgSuccess("新增成功");

this.open = false;

this.getList();

});

}

}

});

},

/** 删除按钮操作 */

handleDelete(row) {

const recptIds = row.recptId || this.ids;

this.$modal.confirm('是否确认删除产品入库单编号为"' + recptIds + '"的数据项?').then(function() {

return delProductrecpt(recptIds);

}).then(() => {

this.getList();

this.$modal.msgSuccess("删除成功");

}).catch(() => {});

},

/** 导出按钮操作 */

handleExport() {

this.download('wm/productrecpt/export', {

...this.queryParams

}, `productrecpt_${new Date().getTime()}.xlsx`)

},

//选择生产工单

handleWorkorderSelect(){

this.$refs.woSelect.showFlag = true;

},

onWorkorderSelected(row){

if(row != undefined && row != null){

debugger;

this.form.workorderId = row.workorderId;

this.form.workorderCode = row.workorderCode;

this.form.workorderName = row.workorderName;

this.form.itemId = row.productId;

this.form.itemCode = row.productCode;

this.form.itemName = row.productName;

this.form.unitOfMeasure = row.unitOfMeasure;

this.form.clientCode = row.clientCode;

this.form.clientName = row.clientName;

}

},

//选择默认的仓库、库区、库位

handleWarehouseChanged(obj){

if(obj !=null){

this.form.warehouseId = obj[0];

this.form.locationId = obj[1];

this.form.areaId = obj[2];

}

},

//自动生成编码

handleAutoGenChange(autoGenFlag){

if(autoGenFlag){

genCode('PRODUCTRECPT_CODE').then(response =>{

this.form.recptCode = response;

});

}else{

this.form.recptCode = null;

}

}

}

};

</script>

 

<template>

<div class="app-container">code>

<el-row :gutter="10" class="mb8">code>

<el-col :span="1.5">code>

<el-button

type="primary"code>

plain

icon="el-icon-plus"code>

size="mini"code>

@click="handleAdd"code>

v-hasPermi="['mes:wm:productrecpt:add']"code>

>新增</el-button>

</el-col>

<el-col :span="1.5">code>

<el-button

type="success"code>

plain

icon="el-icon-edit"code>

size="mini"code>

:disabled="single"code>

@click="handleUpdate"code>

v-if="optType != 'view'"code>

v-hasPermi="['mes:wm:productrecpt:edit']"code>

>修改</el-button>

</el-col>

<el-col :span="1.5">code>

<el-button

type="danger"code>

plain

icon="el-icon-delete"code>

size="mini"code>

:disabled="multiple"code>

@click="handleDelete"code>

v-if="optType != 'view'"code>

v-hasPermi="['mes:wm:productrecpt:remove']"code>

>删除</el-button>

</el-col>

<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>code>

</el-row>

<el-table v-loading="loading" :data="productrecptlineList" @selection-change="handleSelectionChange">code>

<el-table-column type="selection" width="55" align="center" />code>

<el-table-column label="产品物料编码" width="120px" align="center" prop="itemCode" />code>

<el-table-column label="产品物料名称" width="150px" align="center" prop="itemName" :show-overflow-tooltip="true"/>code>

<el-table-column label="规格型号" width="120px" align="center" prop="specification" :show-overflow-tooltip="true"/>code>

<el-table-column label="单位" align="center" prop="unitOfMeasure" />code>

<el-table-column label="入库数量" align="center" prop="quantityRecived" />code>

<el-table-column label="良品数" align="center" prop="quantityQualified" />code>

<el-table-column label="不良品数" align="center" prop="quantityUnqualified" />code>

<el-table-column label="批次号" align="center" prop="batchCode" />code>

<el-table-column label="仓库名称" align="center" prop="warehouseName" />code>

<el-table-column label="库区名称" align="center" prop="locationName" />code>

<el-table-column label="库位名称" align="center" prop="areaName" />code>

<el-table-column label="操作" align="center" class-name="small-padding fixed-width">code>

<template slot-scope="scope">code>

<el-button

size="mini"code>

type="text"code>

icon="el-icon-edit"code>

@click="handleUpdate(scope.row)"code>

v-if="optType != 'view'"code>

v-hasPermi="['mes:wm:productrecpt:edit']"code>

>修改</el-button>

<el-button

size="mini"code>

type="text"code>

icon="el-icon-delete"code>

@click="handleDelete(scope.row)"code>

v-if="optType != 'view'"code>

v-hasPermi="['mes:wm:productrecpt:remove']"code>

>删除</el-button>

</template>

</el-table-column>

</el-table>

<pagination

v-show="total>0"code>

:total="total"code>

:page.sync="queryParams.pageNum"code>

:limit.sync="queryParams.pageSize"code>

@pagination="getList"code>

/>

<!-- 添加或修改产品入库记录行对话框 -->

<el-dialog :title="title" :visible.sync="open" width="960px" append-to-body>code>

<el-form ref="form" :model="form" :rules="rules" label-width="100px">code>

<el-row>

<el-col :span="8">code>

<el-form-item label="产品物料编码" prop="itemCode">code>

<el-input v-model="form.itemCode" placeholder="请输入产品物料编码" >code>

<el-button slot="append" @click="handleSelectStock" icon="el-icon-search"></el-button>code>

</el-input>

<StockSelect ref="stockSelect" :workorderId="workorderId" :itemId="itemId" warehouseCode="XBK_VIRTUAL" @onSelected="onStockSelected"></StockSelect>code>

</el-form-item>

</el-col>

<el-col :span="8">code>

<el-form-item label="产品物料名称" prop="itemName">code>

<el-input v-model="form.itemName" placeholder="请输入产品物料名称" />code>

</el-form-item>

</el-col>

<el-col :span="8">code>

<el-form-item label="单位" prop="unitOfMeasure">code>

<el-input v-model="form.unitOfMeasure" placeholder="请输入单位" />code>

</el-form-item>

</el-col>

</el-row>

<el-row>

<el-col :span="24">code>

<el-form-item label="规格型号" prop="specification">code>

<el-input v-model="form.specification" type="textarea" placeholder="请输入内容" />code>

</el-form-item>

</el-col>

</el-row>

<el-row>

<el-col :span="8">code>

<el-form-item label="入库数量" prop="quantityRecived">code>

<el-input-number :min="0" :max="form.quantityMax" v-model="form.quantityRecived" placeholder="请输入入库数量" />code>

</el-form-item>

</el-col>

<el-col :span="8">code>

<el-form-item label="批次号" prop="batchCode">code>

<el-input v-model="form.batchCode" placeholder="请输入批次号" />code>

</el-form-item>

</el-col>

<el-col :span="8">code>

<el-form-item label="入库仓库" prop="warehouseId">code>

<el-cascader v-model="warehouseInfo"code>

:options="warehouseOptions"code>

:props="warehouseProps"code>

@change="handleWarehouseChanged"code>

>

</el-cascader>

</el-form-item>

</el-col>

</el-row>

<el-row>

<el-col :span="24">code>

<el-form-item label="备注" prop="remark">code>

<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />code>

</el-form-item>

</el-col>

</el-row>

</el-form>

<div slot="footer" class="dialog-footer">code>

<el-button type="primary" @click="submitForm">确 定</el-button>code>

<el-button @click="cancel">取 消</el-button>code>

</div>

</el-dialog>

</div>

</template>

<script>

import { listProductrecptline, getProductrecptline, delProductrecptline, addProductrecptline, updateProductrecptline } from "@/api/mes/wm/productrecptline";

import StockSelect from "@/components/stockSelect/single.vue"

import {getTreeList} from "@/api/mes/wm/warehouse"

export default {

name: "Productrecptline",

components:{

StockSelect

},

props: {

recptId: null,

optType: null,

workorderId:null,

itemId: null

},

data() {

return {

warehouseInfo:[],

warehouseOptions:[],

warehouseProps:{

multiple: false,

value: 'pId',

label: 'pName',

},

// 遮罩层

loading: true,

// 选中数组

ids: [],

// 非单个禁用

single: true,

// 非多个禁用

multiple: true,

// 显示搜索条件

showSearch: true,

// 总条数

total: 0,

// 产品入库记录行表格数据

productrecptlineList: [],

// 弹出层标题

title: "",

// 是否显示弹出层

open: false,

// 查询参数

queryParams: {

pageNum: 1,

pageSize: 10,

recptId: this.recptId,

materialStockId: null,

itemId: null,

itemCode: null,

itemName: null,

specification: null,

unitOfMeasure: null,

quantityRecived: null,

batchCode: null,

warehouseId: null,

warehouseCode: null,

warehouseName: null,

locationId: null,

locationCode: null,

locationName: null,

areaId: null,

areaCode: null,

areaName: null,

},

// 表单参数

form: {},

// 表单校验

rules: {

itemId: [

{ required: true, message: "产品不能为空", trigger: "blur" }

],

warehouseId: [

{ required: true, message: "入库仓库不能为空", trigger: "blur" }

],

quantityRecived: [

{ required: true, message: "入库数量不能为空", trigger: "blur" }

],

}

};

},

created() {

this.getList();

this.getWarehouseList();

},

methods: {

/** 查询产品入库记录行列表 */

getList() {

this.loading = true;

listProductrecptline(this.queryParams).then(response => {

this.productrecptlineList = response.rows;

this.total = response.total;

this.loading = false;

});

},

getWarehouseList(){

getTreeList().then( response =>{

this.warehouseOptions = response.data;

this.warehouseOptions.map(w =>{

w.children.map(l =>{

let lstr =JSON.stringify(l.children).replace(/locationId/g,'lId').replace(/areaId/g, 'pId').replace(/areaName/g,'pName');

l.children = JSON.parse(lstr);

});

let wstr = JSON.stringify(w.children).replace(/warehouseId/g,'wId').replace(/locationId/g, 'pId').replace(/locationName/g,'pName');

w.children = JSON.parse(wstr);

});

let ostr=JSON.stringify(this.warehouseOptions).replace(/warehouseId/g,'pId').replace(/warehouseName/g, 'pName');

this.warehouseOptions = JSON.parse(ostr);

});

},

// 取消按钮

cancel() {

this.open = false;

this.reset();

},

// 表单重置

reset() {

this.form = {

lineId: null,

recptId: this.recptId,

materialStockId: null,

itemId: null,

itemCode: null,

itemName: null,

specification: null,

unitOfMeasure: null,

quantityRecived: null,

batchCode: null,

warehouseId: null,

warehouseCode: null,

warehouseName: null,

locationId: null,

locationCode: null,

locationName: null,

areaId: null,

areaCode: null,

areaName: null,

remark: null,

attr1: null,

attr2: null,

attr3: null,

attr4: null,

createBy: null,

createTime: null,

updateBy: null,

updateTime: null

};

this.resetForm("form");

},

/** 搜索按钮操作 */

handleQuery() {

this.queryParams.pageNum = 1;

this.getList();

},

/** 重置按钮操作 */

resetQuery() {

this.resetForm("queryForm");

this.handleQuery();

},

// 多选框选中数据

handleSelectionChange(selection) {

this.ids = selection.map(item => item.lineId)

this.single = selection.length!==1

this.multiple = !selection.length

},

/** 新增按钮操作 */

handleAdd() {

this.reset();

this.open = true;

this.title = "添加产品入库记录行";

},

/** 修改按钮操作 */

handleUpdate(row) {

this.reset();

const lineId = row.lineId || this.ids

getProductrecptline(lineId).then(response => {

this.form = response.data;

this.open = true;

this.title = "修改产品入库记录行";

});

},

/** 提交按钮 */

submitForm() {

this.$refs["form"].validate(valid => {

if (valid) {

if (this.form.lineId != null) {

updateProductrecptline(this.form).then(response => {

this.$modal.msgSuccess("修改成功");

this.open = false;

this.getList();

});

} else {

addProductrecptline(this.form).then(response => {

this.$modal.msgSuccess("新增成功");

this.open = false;

this.getList();

});

}

}

});

},

/** 删除按钮操作 */

handleDelete(row) {

const lineIds = row.lineId || this.ids;

this.$modal.confirm('是否确认删除产品入库记录行编号为"' + lineIds + '"的数据项?').then(function() {

return delProductrecptline(lineIds);

}).then(() => {

this.getList();

this.$modal.msgSuccess("删除成功");

}).catch(() => {});

},

/** 导出按钮操作 */

handleExport() {

this.download('wm/productrecptline/export', {

...this.queryParams

}, `productrecptline_${new Date().getTime()}.xlsx`)

},

handleSelectStock(){

this.$refs.stockSelect.showFlag = true;

this.$refs.stockSelect.getList();

},

//物料选择弹出框

onStockSelected(obj){

if(obj != undefined && obj != null){

this.form.materialStockId = obj.materialStockId;

this.form.itemId = obj.itemId;

this.form.itemCode = obj.itemCode;

this.form.itemName = obj.itemName;

this.form.specification = obj.specification;

this.form.unitOfMeasure = obj.unitOfMeasure;

this.form.batchCode = obj.batchCode;

this.form.quantityRecived = obj.quantityOnhand;

this.form.quantityMax = obj.quantityOnhand;

}

},

//选择默认的仓库、库区、库位

handleWarehouseChanged(obj){

if(obj !=null){

this.form.warehouseId = obj[0];

this.form.locationId = obj[1];

this.form.areaId = obj[2];

}

},

}

};

</script>


<template>

<view class="container">code>

<!-- 显示收料单表头 -->

<uni-section title="扫码委外收料表身" type="line" class="mb-10">code>

<template v-slot:right>

查询清单

</template>

<uni-collapse>

<uni-collapse-item :title="'委外收料单:'+outreceive.receiveCode+' 状态:'+outreceive.status"code>

thumb="/static/images/workorder.png">code>

<view class="content">code>

<view class="container">code>

<uni-list>

<uni-list-item showExtraIcon="true" :extraIcon="{type: 'location-filled'}" title="ID"code>

:rightText="outreceive.receiveId" />code>

<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="类型"code>

:rightText="outreceive.receiveType" />code>

<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="供应商"code>

:rightText="outreceive.vendorCode" />code>

<uni-list-item showExtraIcon="true" :extraIcon="{type: 'chat-filled'}" title="供应商名称"code>

:rightText="outreceive.vendorName" />code>

<uni-list-item showExtraIcon="true" :extraIcon="{type: 'calendar-filled'}" title="开单时间"code>

:rightText="outreceive.createTime" />code>

</uni-list>

</view>

</view>

</uni-collapse-item>

<view class="dist-flex">code>

<button type="primary" class="uni-btn-small" size="mini"code>

@click="openAddOutreceiveLine">增加收料数量</button>code>

<button type="primary" class="uni-btn-small" size="mini" @click="openEditOutissueLine"code>

v-show="false">修改收料数量</button>code>

<button type="primary" class="uni-btn-small" size="mini"code>

@click="openQueryOutreceiveLine">查询收料明细</button>code>

</view>

</uni-collapse>

</uni-section>

<!-- 显示收料单表头 -->

<!-- 显示收料单明细 -->

<uni-section title="查询收料单明细" type="line" class="mb-10" v-show="showQueryOutreceiveLine">code>

<template v-slot:right>

</template>

<uni-collapse v-for="(value, key, index) in outrececLineList">code>

<uni-collapse-item :title="'料号:'+value.productCode+' 良品数:'+value.quantityQualified"code>

thumb="/static/images/workorder.png">code>

<view class="container">code>

<view class="container">code>

<uni-list>

<uni-list-item showExtraIcon="true" :extraIcon="{type: 'location-filled'}" title="ID"code>

:rightText="value.receiveLineId" />code>

<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="委外工单号码"code>

:rightText="value.outworkorderCode" />code>

<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="生产工单号码"code>

:rightText="value.workorderCode" />code>

<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="委外工序"code>

:rightText="value.productCode" />code>

<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="工序名称"code>

:rightText="value.productName" />code>

<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="需求数量"code>

:rightText="value.quantityScrot" />code>

<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="发料数量"code>

:rightText="value.quantityIssue" />code>

<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="收料良品数"code>

:rightText="value.quantityQualified" />code>

<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="收料不良品数"code>

:rightText="value.quantityUnquanlified" />code>

<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="收料时间"code>

:rightText="value.createTime" />code>

</uni-list>

</view>

</view>

</uni-collapse-item>

</uni-collapse>

</uni-section>

<!-- 显示收料单明细 -->

<!-- 编辑收料单明细 -->

<view class="content example" v-show="showEditOutreceiveLine">code>

<uni-forms ref="form" :model="outreceiveLine" labelWidth="100px">code>

<uni-forms-item label="扫码委外发料行码" name="issueCode" label-width="100">code>

<view class="dist-flex">code>

<uni-easyinput v-model="outreceiveLine.issueCode" placeholder="委外工单号码"></uni-easyinput>code>

<uni-icons type="camera-filled" size="30" @click="onH5Scan"></uni-icons>code>

</view>

</uni-forms-item>

<uni-forms-item label="收料单ID" name="receiveId" labelWidth="100">code>

<uni-easyinput disabled v-model="outreceiveLine.receiveId" placeholder="收料单" />code>

</uni-forms-item>

<uni-forms-item label="收料单号" name="receiveCode" labelWidth="100">code>

<uni-easyinput disabled v-model="outreceiveLine.receiveCode" placeholder="收料单" />code>

</uni-forms-item>

<uni-forms-item label="发料行ID" name="issueLineId" labelWidth="100">code>

<uni-easyinput disabled v-model="outreceiveLine.issueLineId" placeholder="系统自动生成" />code>

</uni-forms-item>

<uni-forms-item label="委外工单" name="outworkorderCode" label-width="100">code>

<uni-easyinput disabled v-model="outreceiveLine.outworkorderCode" placeholder="收料数量" />code>

</uni-forms-item>

<uni-forms-item label="生厂工单" name="workorderCode" label-width="100">code>

<uni-easyinput disabled v-model="outreceiveLine.workorderCode" placeholder="收料数量" />code>

</uni-forms-item>

<uni-forms-item label="需求数量" name="quantityScrot" labelWidth="100">code>

<uni-easyinput disabled v-model="outreceiveLine.quantityScrot" placeholder="需求数量" />code>

</uni-forms-item>

<uni-forms-item label="发料数量" name="quantity" label-width="100">code>

<uni-easyinput disabled v-model="outreceiveLine.quantity" placeholder="收料数量" />code>

</uni-forms-item>

<uni-forms-item label="收料良品数" name="quantityQualifiedReceive" label-width="100">code>

<uni-easyinput v-model="outreceiveLine.quantityQualifiedReceive" placeholder="收料良品数" />code>

</uni-forms-item>

<uni-forms-item label="收料不良品数" name="quantityUnqualifiedReceive" label-width="100">code>

<uni-easyinput v-model="outreceiveLine.quantityUnqualifiedReceive" placeholder="收料不良品数" />code>

</uni-forms-item>

</uni-forms>

</uni-section>

<view style="text-align: center;">code>

<button type="primary" @click="submitForm" size="mini">保存委外收料单明细</button>code>

</view>

</view>

<!-- 编辑收料单明细 -->

</view>

</template>

<script>

import {

getUserProfile

} from "@/api/system/user"

import {

updateUserProfile

} from "@/api/system/user"

import {

listWorkorder

} from "@/api/mes/pro/workorder"

import {

listOutworkorder

} from "@/api/mes/pro/outworkorder"

import {

getOutissue,

addOutissue,

listOutissue,

updateOutissue,

getOutissueByIssueCode

} from "@/api/mes/pro/outissue.js"

import {

getOutissueLine,

addOutissueLine,

listOutissueLine,

updateOutissueLine

} from "@/api/mes/pro/outissueLine.js"

import {

getOutrececive,

addOutrececive,

listOutrececive,

updateOutrececive,

getOutreceiveByReceiveCode

} from "@/api/mes/pro/outreceive.js"

import {

getOutreceiveLine,

addOutreceiveLine,

listOutreceiveLine,

updateOutreceiveLine

} from "@/api/mes/pro/outreceiveLine.js"

import {

listUser,

getUser,

delUser,

addUser,

updateUser,

resetUserPwd,

changeUserStatus

} from "@/api/system/user"

import {

getJsapiSignature

} from "@/api/notice/qywx.js"

import storage from '@/utils/storage'

import {

getDicts

} from "@/api/system/dict/data"

import {

listVendor,

getVendor,

delVendor,

addVendor,

updateVendor

} from "@/api/mes/md/vendor"

import {

genCode

} from "@/api/system/autocode/rule"

import {

listOutworkorderline

} from "../../../../api/mes/pro/outworkorderline"

export default {

dicts: ['mes_order_status'],

data() {

return {

vendorList: [],

selectVendorCode: null,

rules: {

nickName: {

rules: [{

required: true,

errorMessage: '用户昵称不能为空'

}]

},

phonenumber: {

rules: [{

required: true,

errorMessage: '手机号码不能为空'

}, {

pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,

errorMessage: '请输入正确的手机号码'

}]

},

email: {

rules: [{

required: true,

errorMessage: '邮箱地址不能为空'

}, {

format: 'email',

errorMessage: '请输入正确的邮箱地址'

}]

}

},

workorderCodeList: [],

selectWorkorderCode: null,

outworkorderCodeList: [],

selectOutworkorderCode: null,

outworkorderLineProductList: [],

outworkorderLineWorkorderList: [],

outissueCodeList: [],

outissueLineList: [],

selectOutissueCode: null,

selectProductCode: null,

workorderList: [],

protaskList: [],

receiveCode: null,

outissue: {

issueId: null,

issueCode: null,

issueName: null,

issueType: null,

orderSource: null,

sourceCode: null,

productId: null,

productCode: null,

productName: null,

productSpc: null,

unitOfMeasure: null,

quantity: null,

quantityProduced: null,

quantityChanged: null,

quantityScheduled: null,

clientId: null,

clientCode: null,

clientName: null,

vendorId: null,

vendorCode: null,

vendorName: null,

requestDate: null,

parentId: null,

status: null,

remark: null,

createBy: null,

createTime: null,

updateBy: null,

updateTime: null

},

outissueline: {

issueLineId: null,

issueId: null,

issueCode: null,

issueName: null,

issueType: null,

outworkorderId: null,

outwrkorderCode: null,

outworkorderLineId: null,

workorderId: null,

workorderCode: null,

lineNo: null,

routeId: null,

routeCode: null,

processId: null,

processCode: null,

processName: null,

productId: null,

productCode: null,

productName: null,

productSpc: null,

unitOfMeasure: null,

quantity: null,

quantityProduced: null,

quantityChanged: null,

quantityScheduled: null,

quantityScrot: null,

clientId: null,

clientCode: null,

clientName: null,

vendorId: null,

vendorCode: null,

vendorName: null,

requestDate: null,

parentId: null,

status: null,

remark: null,

createBy: null,

createTime: null,

updateBy: null,

updateTime: null

},

outissueLineList: [],

outreceive: {

receiveId: null,

receiveCode: null,

receiveName: null,

receiveType: null,

orderSource: null,

sourceCode: null,

productId: null,

productCode: null,

productName: null,

productSpc: null,

unitOfMeasure: null,

quantity: null,

quantityProduced: null,

quantityChanged: null,

quantityScheduled: null,

clientId: null,

clientCode: null,

clientName: null,

vendorId: null,

vendorCode: null,

vendorName: null,

requestDate: null,

parentId: null,

status: null,

remark: null,

createBy: null,

createTime: null,

updateBy: null,

updateTime: null

},

outreceiveLine: {

receiveLineId: null,

receiveId: null,

receiveCode: null,

receiveName: null,

receiveType: null,

issueId: null,

issueCode: null,

issueName: null,

issueType: null,

issueLineId: null,

outworkorderId: null,

outwrkorderCode: null,

outworkorderLineId: null,

workorderId: null,

workorderCode: null,

lineNo: null,

routeId: null,

routeCode: null,

processId: null,

processCode: null,

processName: null,

productId: null,

productCode: null,

productName: null,

productSpc: null,

unitOfMeasure: null,

quantity: null,

quantityProduced: null,

quantityChanged: null,

quantityScheduled: null,

quantityScrot: null,

quantityIssue: null,

quantityUnquanlified: null,

clientId: null,

clientCode: null,

clientName: null,

vendorId: null,

vendorCode: null,

vendorName: null,

requestDate: null,

parentId: null,

status: null,

remark: null,

createBy: null,

createTime: null,

updateBy: null,

updateTime: null

},

outreceiveLineList: [],

workorderStatus: [],

// 遮罩层

loading: true,

showEditOutworkorderLine: false,

showQueryOutworkorderLine: false,

showOutissueLine: false,

showQueryOutreceiveLine: false,

showEditOutreceiveLine: false,

// 查询参数

queryOutissueParams: {

issueCode: null,

},

queryOutissueLineParams: {

issueCode: null,

},

queryOutreceiveParams: {

receiveCode: null,

},

queryOutreceiveLineParams: {

receiveCode: null,

},

queryOutworkorderLineParams: {

outworkorderCode: null,

},

//卡片相关数据

cover: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao.jpg',

avatar: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png',

extraIcon: {

color: '#4cd964',

size: '22',

type: 'gear-filled'

}

}

},

created() {

},

onLoad: function(option) {

this.receiveCode = JSON.parse(decodeURIComponent(option.item));

console.log("receiveCode:" + this.receiveCode)

this.outreceive.receiveCode = this.receiveCode

this.queryOutreceiveParams.receiveCode = this.receiveCode

this.queryOutreceiveLineParams.receiveCode = this.receiveCode

this.queryOutreceive();

this.queryOutreceiveLineList();

this.queryListOutworkorder();

//调用微信扫一扫的配置

this.getCofig()

},

onReady() {

//设定Form提交的规则

this.$refs.form.setRules(this.rules)

},

methods: {

/** 提交按钮 保存报工按钮 */

submitForm() {

console.log("保存委外收料单开始")

console.log(this.outissueLineList)

this.$refs.form.validate().then(res => {

console.log("收料行数据");

console.log(this.outreceiveLine);

addOutreceiveLine(this.outreceiveLine).then(response => {

//this.showEditOutworkorderLine=false

this.$modal.msgSuccess("新增成功:" + this.outreceiveLine.productName);

});

});

console.log("保存委外收料单结束")

},

changeOutissue(e) {

console.log("选择委外发料单号码")

console.log(e)

let row = JSON.parse(e)

console.log(row.issueCode)

this.showOutissueLine = true

this.queryOutissueParams.issueCode = row.issueCode;

this.outworkorderLineProductList = []

this.outworkorderLineWorkorderList = []

this.outissueline.productCode = null

this.outissueline.productName = null

this.outissueline.quantityScrot = null

this.outissueline.quantity = null

this.outworkorderCodeList = []

listOutissueLine(this.queryOutissueParams).then(response => {

this.loading = false;

this.outissueLineList = response.rows;

for (var i in response.rows) {

this.outworkorderCodeList.push({

value: JSON.stringify(response.rows[i]),

text: response.rows[i].outworkorderCode

});

}

})

//委外工单发料列表

console.log(row.outworkorderCodeList)

},

changeOutworkorder(e) {

console.log("选择委外工单号码")

console.log(e)

let row = JSON.parse(e)

console.log(row.outworkorderCode)

this.queryOutworkorderLineParams.outworkorderCode = row.outworkorderCode;

this.outworkorderLineProductList = []

this.outworkorderLineWorkorderList = []

this.outissueline.productCode = null

this.outissueline.productName = null

this.outissueline.quantityScrot = null

this.outissueline.quantity = null

listOutworkorderline(this.queryOutworkorderLineParams).then(response => {

//this.protaskList = response.rows;

this.loading = false;

for (var i in response.rows) {

this.outworkorderLineProductList.push({

value: JSON.stringify(response.rows[i]),

text: response.rows[i].productCode + "|" + response.rows[i].productName

});

this.outworkorderLineWorkorderList.push({

value: JSON.stringify(response.rows[i]),

text: response.rows[i].workorderCode

});

}

})

//委外工单发料列表

console.log(row.outworkorderLineProductList)

},

changeOutworkorderLineWorkorder(e) {

console.log("选择委外工单明细的生产工单")

console.log(e)

let row = JSON.parse(e)

console.log(row)

this.outissueline.processId = row.processId

this.outissueline.productCode = row.productCode

this.outissueline.productName = row.productName

this.outissueline.quantityScrot = row.quantity

this.outissueline.outworkorderId = row.outworkorderId

this.outissueline.outworkorderCode = row.outworkorderCode

this.outissueline.outworkorderLineId = row.outworkorderLineId

this.outissueline.workorderId = row.workorderId

this.outissueline.workorderCode = row.workorderCode

this.outissueline.routeId = row.routeId

this.outissueline.routeCode = row.routeCode

this.outissueline.routeName = row.routeName

this.outissueline.processId = row.processId

this.outissueline.processCode = row.processCode

this.outissueline.processName = row.processName

},

changeUser(e) {

console.log("选择审核人")

console.log(e)

let row = JSON.parse(e)

console.log(row.userName)

this.feedback.recordUser = row.userName

this.feedback.recordNick = row.nickNamethis.outissueline.outworkorderId = row.outworkorderId

this.loading = true

getOutissueByreceiveCode(this.receiveCode).then(response => {

this.loading = false;

console.log("委外收料单表头");

console.log(response.data);

this.outissue = response.data;

this.outissueline.issueId = response.data.issueId;

this.outissueline.receiveCode = response.data.receiveCode;

});

},

queryOutreceive() {

this.loading = true

getOutreceiveByReceiveCode(this.receiveCode).then(response => {

this.loading = false;

console.log("委外收料单表头");

console.log(response.data);

this.outreceive = response.data;

});

},

queryOutreceiveLineList() {

this.loading = true

listOutreceiveLine(this.queryOutreceiveLineParams).then(response => {

this.loading = false;

console.log("委外收料单明细");

console.log(response.rows);

this.outrececLineList = response.rows;

});

},

queryListOutissue() {

console.log("查询委外发料单-可发料范围")

listOutissue().then(response => {

this.loading = false;

for (var i in response.rows) {

this.outissueCodeList.push({

value: JSON.stringify(response.rows[i]),

text: response.rows[i].issueCode

});

}

});

console.log(this.outissueCodeList);

console.log("查询委外发料单-可发料范围")

},

queryListOutworkorder() {

console.log("查询委外工单清单-可发料范围")

listOutworkorder().then(response => {

this.loading = false;

for (var i in response.rows) {

this.outworkorderCodeList.push({

value: JSON.stringify(response.rows[i]),

text: response.rows[i].outworkorderCode

});

}

});

console.log(this.outworkorderCodeList);

console.log("查询委外工单清单-可发料范围")

},

getListProTask() {

console.log("查询排产任务开始")

listProtask(this.queryProTaskParams).then(response => {

//this.protaskList = response.rows;

this.loading = false;

for (var i in response.rows) {

this.protaskList.push({

value: JSON.stringify(response.rows[i]),

text: response.rows[i].taskCode + "|" + response.rows[i].workstationName

});

}

});

console.log(this.protaskList);

console.log("查询排产任务结束")

},

openAddOutreceiveLine() {

//this.$refs.showRight.open();

//this.$tab.navigateTo('/pages/mes/pro/workorder/saveowoissueline?item=' + encodeURIComponent(JSON.stringify(this

//.outissue)));

this.showEditOutreceiveLine = true;

this.showQueryOutreceiveLine = false;

//查询发料单可发料列表

//this.queryListOutissue();

},

openQueryOutreceiveLine() {

console.log("查询委外工单收料明细")

this.showQueryOutreceiveLine = true;

this.showEditOutreceiveLine = false;

this.queryOutreceiveLineList();

},

closeDrawer() {

this.$refs.showRight.close();

},

//微信扫描save

onH5Scan() {

//如果有调用相关的内容,要使用that的这个常量

const that = this;

console.log('onH5Scan进来了');code>

this.$wx.scanQRCode({

needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,

scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有

success: function(res) {

//alert(JSON.stringify(res)) //测试使用

var result = res.resultStr; // 当 needResult 为 1 时,扫码返回的结果

var resultArr = result.split(',') // 扫描结果以逗号分割数组

var codeContent = resultArr[resultArr.length - 1] // 获取数组最后一个元素,也就是最终的内容

扫描结果赋值

console.log('onH5Scan——success');

console.log("onH5Scan" + result + "===" + resultArr + "===" + codeContent);

var str = codeContent.trim();

var array = str.split('^');

alert(array);

that.outreceiveLine.receiveId=that.outreceive.receiveId

that.outreceiveLine.receiveCode=that.outreceive.receiveCode

that.outreceiveLine.issueLineId = parseInt(array[0])

that.outreceiveLine.issueId = parseInt(array[1])

that.outreceiveLine.issueCode = array[2]

that.outreceiveLine.outworkorderLineId = parseInt(array[3])

that.outreceiveLine.outworkorderId = parseInt(array[4])

that.outreceiveLine.outworkorderCode = array[5]

that.outreceiveLine.workorderId = parseInt(array[6])

that.outreceiveLine.workorderCode = array[7]

that.outreceiveLine.productId = parseInt(array[8])

that.outreceiveLine.productCode = array[9]

that.outreceiveLine.productName = array[10]

that.outreceiveLine.routeId = parseInt(array[11])

that.outreceiveLine.routeCode = array[12]

//that.outissueline.routeName = array[13]

that.outreceiveLine.processId = parseInt(array[14])

that.outreceiveLine.processCode = array[15]

that.outreceiveLine.processName = array[16]

that.outreceiveLine.quantityScrot = parseFloat(array[17])

that.outreceiveLine.quantity = array[18]

},

fail: function(response) {

if (res.errMsg.indexOf('function_not_exist') > 0) {

console.log('onH5Scan版本过低请升级');

}

uni.showToast({

icon: "none",

title: "onH5Scan——调用扫码失败" + response.errMsg

})

},

});

},

// 配置信息

getCofig() {

const that = this;

let url = window.location.href.split('#')[0];

let params = {

'url': url

}

getJsapiSignature(params).then(res => {

const result = res;

if (res) {

that.wxConfig(

result.appId,

result.timestamp,

result.nonceStr,

result.signature

);

} else {

alert('获取配置信息返回为空');

}

})

},

//wx.config的配置

wxConfig(appId, timestamp, nonceStr, signature) {

this.$wx.config({

debug: false, // 开启调试模式,

appId: appId, // 必填,企业号的唯一标识

timestamp: timestamp, // 必填,生成签名的时间戳

nonceStr: nonceStr, // 必填,生成签名的随机串

signature: signature, // 必填,签名

jsApiList: [

'chooseImage',

'previewImage',

'uploadImage',

'downloadImage',

'scanQRCode',

'checkJsApi'

], // 必填,需要使用的JS接口列表

});

this.$wx.ready(() => {

this.$wx.checkJsApi({ //判断当前客户端版本是否支持指定JS接口

jsApiList: [

'chooseImage',

'previewImage',

'uploadImage',

'downloadImage',

'scanQRCode',

],

success: function(

res

) { // 以键值对的形式返回,可用true,不可用false。如:{"checkResult":{"scanQRCode":true},"errMsg":"checkJsApi:ok"}

//alert(res)

//取消配置提示框

this.$modal.msgSuccess(res.checkResult)

if (res.checkResult.scanQRCode != true) {

this.$modal.msgSuccess('抱歉,当前客户端版本不支持扫一扫')

}

},

fail: function(res) { //检测getNetworkType该功能失败时处理

this.$modal.msgSuccess(res)

alert('checkJsApi error');

}

});

console.log("wxConfig配置完成,扫码前准备完成");

//this.$modal.msgSuccess("wxConfig配置完成,扫码前准备完成")

})

this.$wx.error(function(res) {

this.$modal.msgSuccess('wxConfig出错了:' + res.errMsg)

console.log('wxConfig出错了:' + res.errMsg);

//wx.config配置错误,会弹出窗口哪里错误,然后根据微信文档查询即可。

});

},

}

}

</script>

<style lang="scss">code>

page {

background-color: #ffffff;

}

.example {

padding: 15px;

background-color: #ffffff;

}

.segmented-control {

margin-bottom: 15px;

}

.button-group {

margin-top: 15px;

display: flex;

justify-content: space-around;

}

.form-item {

display: flex;

align-items: center;

flex: 1;

}

.button {

display: flex;

align-items: center;

height: 35px;

line-height: 35px;

margin-left: 10px;

}

.dist-flex {

display: flex !important;

}

/*卡片格式*/

.container {

overflow: hidden;

}

.custom-cover {

flex: 1;

flex-direction: row;

position: relative;

}

.cover-content {

position: absolute;

bottom: 0;

left: 0;

right: 0;

height: 40px;

background-color: rgba($color: #000000, $alpha: 0.4);

display: flex;

flex-direction: row;

align-items: center;

padding-left: 15px;

font-size: 14px;

color: #fff;

}

.card-actions {

display: flex;

flex-direction: row;

justify-content: space-around;

align-items: center;

height: 45px;

border-top: 1px #eee solid;

}

.card-actions-item {

display: flex;

flex-direction: row;

align-items: center;

}

.card-actions-item-text {

font-size: 12px;

color: #666;

margin-left: 5px;

}

.cover-image {

flex: 1;

height: 150px;

}

.no-border {

border-width: 0;

}

</style>

ALTER TABLE ryvue_mes.pro_task ADD first_flag INT NULL COMMENT '首道工序(0否/1是)';

ALTER TABLE ryvue_mes.pro_task ADD last_flag INT NULL COMMENT '末道工序(0否/1是)';

ALTER TABLE ryvue_mes.pro_task ADD bf_flag INT NULL COMMENT 'BFFlag 倒冲工序(0否/1是)';

ALTER TABLE ryvue_mes.pro_task ADD report_flag INT NULL COMMENT 'ReportFlag 报告点 (0否/1是)';

ALTER TABLE ryvue_mes.pro_task ADD fee_flag INT NULL COMMENT 'FeeFlag 计费点(0否/1是)';

ALTER TABLE ryvue_mes.pro_task ADD delivery_days DECIMAL NULL COMMENT 'DeliveryDays 交货天数';

 1 在main.js文件中注册有关字典的组件和相关的属性等,如下所示,有添加字典注解的地方

import Vue from 'vue'

import App from './App'

import wx from 'weixin-js-sdk'

import store from './store' // store

import plugins from './plugins' // plugins

import './permission' // permission

//字典

import { getDicts } from "@/api/system/dict/data"

// 字典标签组件

import DictTag from '@/components/DictTag'

// 字典数据组件

import DictData from '@/components/DictData'

Vue.use(plugins)

//安装字典

DictData.install()

Vue.config.productionTip = false

Vue.prototype.$store = store

Vue.prototype.getDicts = getDicts

//全局注册字典

Vue.component('DictTag', DictTag)

App.mpType = 'app'

const app = new Vue({

...App

})

app.$mount()

2  在D:\ideaProject\RuoYi-App-master\components目录,添加从前端的项目复制DictData,DictTag两个目录的全部文件
3在D:\ideaProject\RuoYi-App-master\utils目录,添加从前端的项目复制utils的文件,存在的文件就跳过
4 在组件文件中直接使用<dict-tag :options="dict.type.mes_order_status" value="CONFIRMED" />来表示字典显示的内容

4.1 定义字典的内容

<code>dicts: ['mes_order_status','mes_workorder_sourcetype','mes_workorder_type'],

 4.2 在要显示标签的地方,写下dict-tag标签的语法,vaule属性可以使用变量

<dict-tag :options="dict.type.mes_order_status" value="CONFIRMED" />code>

<template>

<view class="normal-login-container">code>

<view class="logo-content align-center justify-center flex">code>

<image style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix">code>

</image>

<text class="title">若依移动端登录</text>code>

<view>

<dict-tag :options="dict.type.mes_order_status" value="CONFIRMED" />code>

</view>

</view>

<view class="login-form-content">code>

<view class="input-item flex align-center">code>

<view class="iconfont icon-user icon"></view>code>

<input v-model="loginForm.username" class="input" type="text" placeholder="请输入账号" maxlength="30" />code>

</view>

<view class="input-item flex align-center">code>

<view class="iconfont icon-password icon"></view>code>

<input v-model="loginForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" />code>

</view>

<view class="input-item flex align-center" style="width: 60%;margin: 0px;" v-if="captchaEnabled">code>

<view class="iconfont icon-code icon"></view>code>

<input v-model="loginForm.code" type="number" class="input" placeholder="请输入验证码" maxlength="4" />code>

<view class="login-code">code>

<image :src="codeUrl" @click="getCode" class="login-code-img"></image>code>

</view>

</view>

<view class="action-btn">code>

<button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">登录</button>code>

</view>

<view class="reg text-center" v-if="register">code>

<text class="text-grey1">没有账号?</text>code>

<text @click="handleUserRegister" class="text-blue">立即注册</text>code>

</view>

<view class="xieyi text-center">code>

<text class="text-grey1">登录即代表同意</text>code>

<text @click="handleUserAgrement" class="text-blue">《用户协议》</text>code>

<text @click="handlePrivacy" class="text-blue">《隐私协议》</text>code>

</view>

</view>

</view>

</template>

<script>

import {

getCodeImg

} from '@/api/login'

export default {

dicts: ['mes_order_status','mes_workorder_sourcetype','mes_workorder_type'],

data() {

return {

codeUrl: "",

captchaEnabled: true,

// 用户注册开关

register: false,

globalConfig: getApp().globalData.config,

loginForm: {

username: "admin",

password: "admin123",

code: "",

uuid: ''

}

}

},

created() {

this.getCode()

},

methods: {

// 用户注册

handleUserRegister() {

this.$tab.redirectTo(`/pages/register`)

},

// 隐私协议

handlePrivacy() {

let site = this.globalConfig.appInfo.agreements[0]

this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)

},

// 用户协议

handleUserAgrement() {

let site = this.globalConfig.appInfo.agreements[1]

this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)

},

// 获取图形验证码

getCode() {

getCodeImg().then(res => {

this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled

if (this.captchaEnabled) {

this.codeUrl = 'data:image/gif;base64,' + res.img

this.loginForm.uuid = res.uuid

}

})

},

// 登录方法

async handleLogin() {

if (this.loginForm.username === "") {

this.$modal.msgError("请输入您的账号")

} else if (this.loginForm.password === "") {

this.$modal.msgError("请输入您的密码")

} else if (this.loginForm.code === "" && this.captchaEnabled) {

this.$modal.msgError("请输入验证码")

} else {

this.$modal.loading("登录中,请耐心等待...")

this.pwdLogin()

}

},

// 密码登录

async pwdLogin() {

this.$store.dispatch('Login', this.loginForm).then(() => {

this.$modal.closeLoading()

this.loginSuccess()

}).catch(() => {

if (this.captchaEnabled) {

this.getCode()

}

})

},

// 登录成功后,处理函数

loginSuccess(result) {

// 设置用户信息

this.$store.dispatch('GetInfo').then(res => {

this.$tab.reLaunch('/pages/index')

})

}

}

}

</script>

<style lang="scss">code>

page {

background-color: #ffffff;

}

.normal-login-container {

width: 100%;

.logo-content {

width: 100%;

font-size: 21px;

text-align: center;

padding-top: 15%;

image {

border-radius: 4px;

}

.title {

margin-left: 10px;

}

}

.login-form-content {

text-align: center;

margin: 20px auto;

margin-top: 15%;

width: 80%;

.input-item {

margin: 20px auto;

background-color: #f5f6f7;

height: 45px;

border-radius: 20px;

.icon {

font-size: 38rpx;

margin-left: 10px;

color: #999;

}

.input {

width: 100%;

font-size: 14px;

line-height: 20px;

text-align: left;

padding-left: 15px;

}

}

.login-btn {

margin-top: 40px;

height: 45px;

}

.reg {

margin-top: 15px;

}

.xieyi {

color: #333;

margin-top: 20px;

}

.login-code {

height: 38px;

float: right;

.login-code-img {

height: 38px;

position: absolute;

margin-left: 10px;

width: 200rpx;

}

}

}

}

</style>


1 为表添加数据同步相关的信息 

ALTER TABLE ryvue_mes.out_workorder ADD sync_id varchar(100) NULL COMMENT '同步ID(接名名称或AP名行或JOB名称等)';

ALTER TABLE ryvue_mes.out_workorder ADD sync_status INT NULL COMMENT '同步状态(0成功1失败2执行3重传)';

ALTER TABLE ryvue_mes.out_workorder ADD sync_time DATETIME NULL COMMENT '同步完成时间';

ALTER TABLE ryvue_mes.out_workorder ADD sync_qty INT NULL COMMENT '同步记录数';

ALTER TABLE ryvue_mes.out_workorder ADD sync_message varchar(100) NULL COMMENT '同步消息';

ALTER TABLE ryvue_mes.pro_route ADD run_card_flag INT NULL COMMENT '启用流转卡 (0否1是)';

ALTER TABLE ryvue_mes.pro_route ADD aux_unit_code varchar(100) NULL COMMENT '辅助计量单位';

ALTER TABLE ryvue_mes.pro_route ADD runcard_batch_qty DECIMAL NULL COMMENT '流转卡批量数据';

ALTER TABLE ryvue_mes.pro_route ADD route_tyype INT NULL COMMENT 'RountingType 类型(1-主要/2-替代) ';

ALTER TABLE ryvue_mes.pro_route ADD route_version varchar(100) NULL COMMENT '版本';

ALTER TABLE ryvue_mes.pro_route ADD version_desc varchar(100) NULL COMMENT '版本说明';

ALTER TABLE ryvue_mes.pro_route ADD version_start_date DATE NULL COMMENT '版本生效日期';

ALTER TABLE ryvue_mes.pro_route ADD version_end_date DATE NULL COMMENT '版本结束日期';

ALTER TABLE ryvue_mes.pro_route ADD ident_code varchar(100) NULL COMMENT '替代标识';

ALTER TABLE ryvue_mes.pro_route ADD ident_desc varchar(100) NULL COMMENT '替代说明';

ALTER TABLE ryvue_mes.pro_route ADD auditor_user varchar(100) NULL COMMENT '审核人员';

ALTER TABLE ryvue_mes.pro_route ADD auditor_time DATETIME NULL;

ALTER TABLE ryvue_mes.pro_route ADD close_user varchar(100) NULL COMMENT '关闭人员';

ALTER TABLE ryvue_mes.pro_route ADD close_time varchar(100) NULL;

ALTER TABLE ryvue_mes.pro_route ADD change_rate DECIMAL NULL COMMENT '换算率';

ALTER TABLE ryvue_mes.pro_route ADD update_count varchar(100) NULL COMMENT '修改次数';

ALTER TABLE ryvue_mes.pro_route ADD print_count varchar(100) NULL COMMENT '打印次数';

<select id="checkFirstProTask" parameterType="ProTask" resultMap="ProTaskResult">code>

<include refid="selectProTaskVo"/>code>

<where>

<if test="workorderCode != null and workorderCode != ''"> and t.workorder_code = #{workorderCode}</if>

<if test="processCode != null"> and t.process_code = #{processCode} </if>

<if test="workorderCode != null and workorderCode != ''"> and (workorder_code,process_order_num) in (select workorder_code,min(process_order_num) from ryvue_mes.pro_task where workorder_code =#{workorderCode} ) </if>

</where>

</select>

<select id="checkLastProTask" parameterType="ProTask" resultMap="ProTaskResult">code>

<include refid="selectProTaskVo"/>code>

<where>

<if test="workorderCode != null and workorderCode != ''"> and t.workorder_code = #{workorderCode}</if>

<if test="processCode != null"> and t.process_code = #{processCode} </if>

<if test="workorderCode != null and workorderCode != ''"> and (workorder_code,process_order_num) in (select workorder_code,min(process_order_num) from pro_task where workorder_code =#{workorderCode} ) </if>

</where>

</select>

<select id="queryPreviousProTask" parameterType="ProTask" resultMap="ProTaskResult">code>

<include refid="selectProTaskVo"/>code>

<where>

<if test="workorderCode != null and workorderCode != ''"> and t.workorder_code = #{workorderCode}</if>

<if test="workorderCode != null and workorderCode != '' and processCode != null "> and process_order_num &lt; (select min(process_order_num) from pro_task where workorder_code =#{workorderCode} and process_code = #{processCode} ) </if>

</where>

order by process_order_num desc limit 1

</select>

<select id="queryNextProTask" parameterType="ProTask" resultMap="ProTaskResult">code>

<include refid="selectProTaskVo"/>code>

<where>

<if test="workorderCode != null and workorderCode != ''"> and t.workorder_code = #{workorderCode}</if>

<if test="workorderCode != null and workorderCode != '' and processCode != null "> and process_order_num &gt; (select min(process_order_num) from pro_task where workorder_code =#{workorderCode} and process_code = #{processCode} ) </if>

</where>

order by process_order_num limit 1

</select>

https://blog.csdn.net/hmmmmm/article/details/124625612



声明

本文内容仅代表作者观点,或转载于其他网站,本站不以此文作为商业用途
如有涉及侵权,请联系本站进行删除
转载本站原创文章,请注明来源及作者。