parent
78d8fcc073
commit
b2a03493ad
@ -0,0 +1,65 @@
|
|||||||
|
package jnpf.ocr_sdk.baiduUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base64 工具类
|
||||||
|
*/
|
||||||
|
public class Base64Util {
|
||||||
|
private static final char last2byte = (char) Integer.parseInt("00000011", 2);
|
||||||
|
private static final char last4byte = (char) Integer.parseInt("00001111", 2);
|
||||||
|
private static final char last6byte = (char) Integer.parseInt("00111111", 2);
|
||||||
|
private static final char lead6byte = (char) Integer.parseInt("11111100", 2);
|
||||||
|
private static final char lead4byte = (char) Integer.parseInt("11110000", 2);
|
||||||
|
private static final char lead2byte = (char) Integer.parseInt("11000000", 2);
|
||||||
|
private static final char[] encodeTable = new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'};
|
||||||
|
|
||||||
|
public Base64Util() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String encode(byte[] from) {
|
||||||
|
StringBuilder to = new StringBuilder((int) ((double) from.length * 1.34D) + 3);
|
||||||
|
int num = 0;
|
||||||
|
char currentByte = 0;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < from.length; ++i) {
|
||||||
|
for (num %= 8; num < 8; num += 6) {
|
||||||
|
switch (num) {
|
||||||
|
case 0:
|
||||||
|
currentByte = (char) (from[i] & lead6byte);
|
||||||
|
currentByte = (char) (currentByte >>> 2);
|
||||||
|
case 1:
|
||||||
|
case 3:
|
||||||
|
case 5:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
currentByte = (char) (from[i] & last6byte);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
currentByte = (char) (from[i] & last4byte);
|
||||||
|
currentByte = (char) (currentByte << 2);
|
||||||
|
if (i + 1 < from.length) {
|
||||||
|
currentByte = (char) (currentByte | (from[i + 1] & lead2byte) >>> 6);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
currentByte = (char) (from[i] & last2byte);
|
||||||
|
currentByte = (char) (currentByte << 4);
|
||||||
|
if (i + 1 < from.length) {
|
||||||
|
currentByte = (char) (currentByte | (from[i + 1] & lead4byte) >>> 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
to.append(encodeTable[currentByte]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (to.length() % 4 != 0) {
|
||||||
|
for (i = 4 - to.length() % 4; i > 0; --i) {
|
||||||
|
to.append("=");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return to.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Baidu, Inc. All Rights Reserved.
|
||||||
|
*/
|
||||||
|
package jnpf.ocr_sdk.baiduUtils;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.google.gson.JsonParseException;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Json工具类.
|
||||||
|
*/
|
||||||
|
public class GsonUtils {
|
||||||
|
private static Gson gson = new GsonBuilder().create();
|
||||||
|
|
||||||
|
public static String toJson(Object value) {
|
||||||
|
return gson.toJson(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T fromJson(String json, Class<T> classOfT) throws JsonParseException {
|
||||||
|
return gson.fromJson(json, classOfT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T fromJson(String json, Type typeOfT) throws JsonParseException {
|
||||||
|
return (T) gson.fromJson(json, typeOfT);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
package jnpf.ocr_sdk.baiduUtils;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* http 工具类
|
||||||
|
*/
|
||||||
|
public class HttpUtil {
|
||||||
|
|
||||||
|
public static String post(String requestUrl, String accessToken, String params)
|
||||||
|
throws Exception {
|
||||||
|
String contentType = "application/x-www-form-urlencoded";
|
||||||
|
return HttpUtil.post(requestUrl, accessToken, contentType, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String post(String requestUrl, String accessToken, String contentType, String params)
|
||||||
|
throws Exception {
|
||||||
|
String encoding = "UTF-8";
|
||||||
|
if (requestUrl.contains("nlp")) {
|
||||||
|
encoding = "GBK";
|
||||||
|
}
|
||||||
|
return HttpUtil.post(requestUrl, accessToken, contentType, params, encoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String post(String requestUrl, String accessToken, String contentType, String params, String encoding)
|
||||||
|
throws Exception {
|
||||||
|
String url = requestUrl + "?access_token=" + accessToken;
|
||||||
|
return HttpUtil.postGeneralUrl(url, contentType, params, encoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String postGeneralUrl(String generalUrl, String contentType, String params, String encoding)
|
||||||
|
throws Exception {
|
||||||
|
URL url = new URL(generalUrl);
|
||||||
|
// 打开和URL之间的连接
|
||||||
|
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||||
|
connection.setRequestMethod("POST");
|
||||||
|
// 设置通用的请求属性
|
||||||
|
connection.setRequestProperty("Content-Type", contentType);
|
||||||
|
connection.setRequestProperty("Connection", "Keep-Alive");
|
||||||
|
connection.setUseCaches(false);
|
||||||
|
connection.setDoOutput(true);
|
||||||
|
connection.setDoInput(true);
|
||||||
|
|
||||||
|
// 得到请求的输出流对象
|
||||||
|
DataOutputStream out = new DataOutputStream(connection.getOutputStream());
|
||||||
|
out.write(params.getBytes(encoding));
|
||||||
|
out.flush();
|
||||||
|
out.close();
|
||||||
|
|
||||||
|
// 建立实际的连接
|
||||||
|
connection.connect();
|
||||||
|
// 获取所有响应头字段
|
||||||
|
Map<String, List<String>> headers = connection.getHeaderFields();
|
||||||
|
// 遍历所有的响应头字段
|
||||||
|
for (String key : headers.keySet()) {
|
||||||
|
System.err.println(key + "--->" + headers.get(key));
|
||||||
|
}
|
||||||
|
// 定义 BufferedReader输入流来读取URL的响应
|
||||||
|
BufferedReader in = null;
|
||||||
|
in = new BufferedReader(
|
||||||
|
new InputStreamReader(connection.getInputStream(), encoding));
|
||||||
|
String result = "";
|
||||||
|
String getLine;
|
||||||
|
while ((getLine = in.readLine()) != null) {
|
||||||
|
result += getLine;
|
||||||
|
}
|
||||||
|
in.close();
|
||||||
|
System.err.println("result:" + result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package jnpf.ocr_sdk.controller;
|
||||||
|
|
||||||
|
import ai.djl.ModelException;
|
||||||
|
import ai.djl.translate.TranslateException;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import jnpf.base.ActionResult;
|
||||||
|
import jnpf.ocr_sdk.baiduUtils.VatInvoice;
|
||||||
|
import jnpf.util.JsonUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: WangChuang
|
||||||
|
* @Date: 10/2/2023 上午9:20
|
||||||
|
* @Description //注释:
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "baiduAI识别图像API" , value = "BaiduAI识别图像API")
|
||||||
|
@RequestMapping("/api/OcrAPI/BaiduOcr")
|
||||||
|
public class BaiduOcrController {
|
||||||
|
@ApiOperation("发票识别")
|
||||||
|
@PostMapping("/uPicture")
|
||||||
|
public ActionResult UploadPicture(MultipartFile file ) throws IOException, ModelException, TranslateException {
|
||||||
|
String s = VatInvoice.vatInvoice(file);
|
||||||
|
return ActionResult.success(JsonUtil.stringToMap(s));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("榜单识别")
|
||||||
|
@PostMapping("/weightNote")
|
||||||
|
public ActionResult weightNote(MultipartFile file ) throws IOException, ModelException, TranslateException {
|
||||||
|
String s = VatInvoice.weightNote(file);
|
||||||
|
return ActionResult.success(JsonUtil.stringToMap(s));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="jnpf.inventoryOrd.mapper.InventoryOrgMapper">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="jnpf.inventoryOrdDetail.mapper.InventoryOrgDetailMapper">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,93 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog title="详情"
|
||||||
|
:close-on-click-modal="false" append-to-body
|
||||||
|
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
|
||||||
|
width="600px">
|
||||||
|
<el-row :gutter="15" class="">
|
||||||
|
<el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" >
|
||||||
|
<template v-if="!loading">
|
||||||
|
<el-col :span="24" >
|
||||||
|
<el-form-item label="编码"
|
||||||
|
prop="inventoryOrgCode" >
|
||||||
|
<p>{{dataForm.inventoryOrgCode}}</p>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" >
|
||||||
|
<el-form-item label="名称"
|
||||||
|
prop="inventoryOrgName" >
|
||||||
|
<p>{{dataForm.inventoryOrgName}}</p>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" >
|
||||||
|
<el-form-item label="所属组织"
|
||||||
|
prop="companyId" >
|
||||||
|
<p>{{dataForm.companyId}}</p>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</template>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="visible = false"> 取 消</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import request from '@/utils/request'
|
||||||
|
import PrintBrowse from '@/components/PrintBrowse'
|
||||||
|
import jnpf from '@/utils/jnpf'
|
||||||
|
export default {
|
||||||
|
components: {PrintBrowse},
|
||||||
|
props: [],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
loading: false,
|
||||||
|
printBrowseVisible: false,
|
||||||
|
printId: '',
|
||||||
|
dataForm: {
|
||||||
|
id :'',
|
||||||
|
inventoryOrgCode : '',
|
||||||
|
inventoryOrgName : '',
|
||||||
|
companyId : "",
|
||||||
|
lastModifyUserName : "",
|
||||||
|
lastModifyTime : "",
|
||||||
|
creatorUserName : "",
|
||||||
|
creatorTime : "",
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
watch: {},
|
||||||
|
created() {
|
||||||
|
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
methods: {
|
||||||
|
dataInfo(dataAll){
|
||||||
|
let _dataAll =dataAll
|
||||||
|
this.dataForm = _dataAll
|
||||||
|
},
|
||||||
|
|
||||||
|
init(id) {
|
||||||
|
this.dataForm.id = id || 0;
|
||||||
|
this.visible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if(this.dataForm.id){
|
||||||
|
this.loading = true
|
||||||
|
request({
|
||||||
|
url: '/api/example/InventoryOrg/detail/'+this.dataForm.id,
|
||||||
|
method: 'get'
|
||||||
|
}).then(res => {
|
||||||
|
this.dataInfo(res.data)
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
@ -0,0 +1,68 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog title="导出数据" :close-on-click-modal="false" :visible.sync="visible"
|
||||||
|
class="JNPF-dialog JNPF-dialog_center" lock-scroll width="600px">
|
||||||
|
<el-form label-position="top" label-width="80px">
|
||||||
|
<el-form-item label="数据选择">
|
||||||
|
<el-radio-group v-model="type">
|
||||||
|
<el-radio :label="0">当前页面数据</el-radio>
|
||||||
|
<el-radio :label="1">全部页面数据</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="导出字段">
|
||||||
|
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll"
|
||||||
|
@change="handleCheckAllChange">全选</el-checkbox>
|
||||||
|
<el-checkbox-group v-model="columns" @change="handleCheckedChange">
|
||||||
|
<el-checkbox v-for="item in columnList" :label="item.prop" :key="item.prop">
|
||||||
|
{{item.label}}
|
||||||
|
</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="visible=false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="downLoad">导 出</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
btnLoading: false,
|
||||||
|
type: 0,
|
||||||
|
columns: [],
|
||||||
|
checkAll: true,
|
||||||
|
isIndeterminate: false,
|
||||||
|
columnList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init(columnList) {
|
||||||
|
this.visible = true
|
||||||
|
this.checkAll = true
|
||||||
|
this.isIndeterminate = false
|
||||||
|
this.columnList = columnList
|
||||||
|
this.columns = columnList.map(o => o.prop)
|
||||||
|
},
|
||||||
|
handleCheckAllChange(val) {
|
||||||
|
this.columns = val ? this.columnList.map(o => o.prop) : [];
|
||||||
|
this.isIndeterminate = false;
|
||||||
|
},
|
||||||
|
handleCheckedChange(value) {
|
||||||
|
let checkedCount = value.length;
|
||||||
|
this.checkAll = checkedCount === this.columnList.length;
|
||||||
|
this.isIndeterminate = checkedCount > 0 && checkedCount < this.columnList.length;
|
||||||
|
},
|
||||||
|
downLoad() {
|
||||||
|
this.$emit('download', { dataType: this.type, selectKey: this.columns.join(',') })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
>>> .el-dialog__body {
|
||||||
|
padding: 20px !important;
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,181 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'"
|
||||||
|
:close-on-click-modal="false" append-to-body
|
||||||
|
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
|
||||||
|
width="600px">
|
||||||
|
<el-row :gutter="15" class="">
|
||||||
|
<el-form ref="elForm" :model="dataForm" :rules="rules" size="small" label-width="100px" label-position="right" >
|
||||||
|
<template v-if="!loading">
|
||||||
|
<el-col :span="24" >
|
||||||
|
<el-form-item label="编码"
|
||||||
|
prop="inventoryOrgCode" >
|
||||||
|
<el-input v-model="dataForm.inventoryOrgCode"
|
||||||
|
placeholder="请输入库存组织编码" clearable :style='{"width":"100%"}'>
|
||||||
|
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" >
|
||||||
|
<el-form-item label="名称"
|
||||||
|
prop="inventoryOrgName" >
|
||||||
|
<el-input v-model="dataForm.inventoryOrgName"
|
||||||
|
placeholder="请输入库存组织名称" clearable :style='{"width":"100%"}'>
|
||||||
|
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" >
|
||||||
|
<el-form-item label="所属组织"
|
||||||
|
prop="companyId" >
|
||||||
|
<el-select v-model="dataForm.companyId"
|
||||||
|
placeholder="请选择" clearable :style='{"width":"100%"}'>
|
||||||
|
<el-option v-for="(item, index) in companyIdOptions" :key="index" :label="item.F_FullName" :value="item.F_Id" :disabled="item.disabled" ></el-option>
|
||||||
|
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</template>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="visible = false"> 取 消</el-button>
|
||||||
|
<el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail"> 确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import request from '@/utils/request'
|
||||||
|
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
|
||||||
|
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
|
||||||
|
export default {
|
||||||
|
components: {},
|
||||||
|
props: [],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
loading: false,
|
||||||
|
isDetail: false,
|
||||||
|
dataForm: {
|
||||||
|
inventoryOrgCode : '',
|
||||||
|
inventoryOrgName : '',
|
||||||
|
companyId : "",
|
||||||
|
lastModifyUserName : "",
|
||||||
|
lastModifyTime : "",
|
||||||
|
creatorUserName : "",
|
||||||
|
creatorTime : "",
|
||||||
|
},
|
||||||
|
rules:
|
||||||
|
{
|
||||||
|
inventoryOrgCode: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入库存组织编码',
|
||||||
|
trigger: 'blur'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
companyIdOptions:[],
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
watch: {},
|
||||||
|
created() {
|
||||||
|
this.getcompanyIdOptions();
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
methods: {
|
||||||
|
getcompanyIdOptions() {
|
||||||
|
getDataInterfaceRes('394016341591396805').then(res => {
|
||||||
|
let data = res.data.data
|
||||||
|
this.companyIdOptions = data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
clearData(data){
|
||||||
|
for (let key in data) {
|
||||||
|
if (data[key] instanceof Array) {
|
||||||
|
data[key] = [];
|
||||||
|
} else if (data[key] instanceof Object) {
|
||||||
|
this.clearData(data[key]);
|
||||||
|
} else {
|
||||||
|
data[key] = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
init(id, isDetail) {
|
||||||
|
this.dataForm.id = id || 0;
|
||||||
|
this.visible = true;
|
||||||
|
this.isDetail = isDetail || false;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs['elForm'].resetFields();
|
||||||
|
if(this.dataForm.id){
|
||||||
|
this.loading = true
|
||||||
|
request({
|
||||||
|
url: '/api/example/InventoryOrg/'+this.dataForm.id,
|
||||||
|
method: 'get'
|
||||||
|
}).then(res => {
|
||||||
|
this.dataInfo(res.data)
|
||||||
|
this.loading = false
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
this.clearData(this.dataForm)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
|
||||||
|
},
|
||||||
|
// 表单提交
|
||||||
|
dataFormSubmit() {
|
||||||
|
this.$refs['elForm'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.request()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
request() {
|
||||||
|
var _data =this.dataList()
|
||||||
|
if (!this.dataForm.id) {
|
||||||
|
request({
|
||||||
|
url: '/api/example/InventoryOrg',
|
||||||
|
method: 'post',
|
||||||
|
data: _data
|
||||||
|
}).then((res) => {
|
||||||
|
this.$message({
|
||||||
|
message: res.msg,
|
||||||
|
type: 'success',
|
||||||
|
duration: 1000,
|
||||||
|
onClose: () => {
|
||||||
|
this.visible = false
|
||||||
|
this.$emit('refresh', true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
request({
|
||||||
|
url: '/api/example/InventoryOrg/'+this.dataForm.id,
|
||||||
|
method: 'PUT',
|
||||||
|
data: _data
|
||||||
|
}).then((res) => {
|
||||||
|
this.$message({
|
||||||
|
message: res.msg,
|
||||||
|
type: 'success',
|
||||||
|
duration: 1000,
|
||||||
|
onClose: () => {
|
||||||
|
this.visible = false
|
||||||
|
this.$emit('refresh', true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dataList(){
|
||||||
|
var _data = JSON.parse(JSON.stringify(this.dataForm));
|
||||||
|
return _data;
|
||||||
|
},
|
||||||
|
dataInfo(dataAll){
|
||||||
|
let _dataAll =dataAll
|
||||||
|
this.dataForm = _dataAll
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
@ -0,0 +1,219 @@
|
|||||||
|
<template>
|
||||||
|
<div class="JNPF-common-layout">
|
||||||
|
|
||||||
|
<div class="JNPF-common-layout-center">
|
||||||
|
<el-row class="JNPF-common-search-box" :gutter="16">
|
||||||
|
<el-form @submit.native.prevent>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="编码">
|
||||||
|
<el-input v-model="query.inventoryOrgCode" placeholder="请输入" clearable> </el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="名称">
|
||||||
|
<el-input v-model="query.inventoryOrgName" placeholder="请输入" clearable> </el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" @click="search()">查询</el-button>
|
||||||
|
<el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
<div class="JNPF-common-layout-main JNPF-flex-main">
|
||||||
|
<div class="JNPF-common-head">
|
||||||
|
<div>
|
||||||
|
<el-button type="primary" icon="el-icon-plus" @click="addOrUpdateHandle()">新增
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="JNPF-common-head-right">
|
||||||
|
<el-tooltip effect="dark" content="刷新" placement="top">
|
||||||
|
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
|
||||||
|
@click="reset()"/>
|
||||||
|
</el-tooltip>
|
||||||
|
<screenfull isContainer/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange' >
|
||||||
|
<el-table-column prop="inventoryOrgCode" label="编码" width="0" align="left"
|
||||||
|
/>
|
||||||
|
<el-table-column prop="inventoryOrgName" label="名称" width="0" align="left"
|
||||||
|
/>
|
||||||
|
<el-table-column prop="creatorTime" label="创建时间" width="0" align="left"
|
||||||
|
/>
|
||||||
|
<el-table-column prop="companyId" label="所属组织" width="0" align="left"
|
||||||
|
/>
|
||||||
|
<el-table-column label="操作" fixed="right"
|
||||||
|
width="100" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button type="text"
|
||||||
|
@click="addOrUpdateHandle(scope.row.id)" >编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button type="text" class="JNPF-table-delBtn" @click="handleDel(scope.row.id)">删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</JNPF-table>
|
||||||
|
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initData"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<JNPF-Form v-if="formVisible" ref="JNPFForm" @refresh="refresh"/>
|
||||||
|
<ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download"/>
|
||||||
|
<Detail v-if="detailVisible" ref="Detail" @refresh="detailVisible=false"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import request from '@/utils/request'
|
||||||
|
import {getDictionaryDataSelector} from '@/api/systemData/dictionary'
|
||||||
|
import JNPFForm from './Form'
|
||||||
|
import ExportBox from './ExportBox'
|
||||||
|
import {getDataInterfaceRes} from '@/api/systemData/dataInterface'
|
||||||
|
import Detail from './Detail'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {JNPFForm, ExportBox,Detail},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
detailVisible: false,
|
||||||
|
query: {
|
||||||
|
inventoryOrgCode:undefined,
|
||||||
|
inventoryOrgName:undefined,
|
||||||
|
},
|
||||||
|
treeProps: {
|
||||||
|
children: 'children',
|
||||||
|
label: 'fullName',
|
||||||
|
value: 'id'
|
||||||
|
},
|
||||||
|
list: [],
|
||||||
|
listLoading: true,
|
||||||
|
total: 0,
|
||||||
|
listQuery: {
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
sort: "desc",
|
||||||
|
sidx: "creatorTime",
|
||||||
|
},
|
||||||
|
formVisible: false,
|
||||||
|
exportBoxVisible: false,
|
||||||
|
columnList: [
|
||||||
|
{prop: 'inventoryOrgCode', label: '编码'},
|
||||||
|
{prop: 'inventoryOrgName', label: '名称'},
|
||||||
|
{prop: 'creatorTime', label: '创建时间'},
|
||||||
|
{prop: 'companyId', label: '所属组织'},
|
||||||
|
],
|
||||||
|
companyIdOptions:[],
|
||||||
|
companyIdProps:{"label":"F_FullName","value":"F_Id"},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
menuId() {
|
||||||
|
return this.$route.meta.modelId || ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.initData()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
goDetail(id){
|
||||||
|
this.detailVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.Detail.init(id)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
sortChange({column, prop, order}) {
|
||||||
|
this.listQuery.sort = order == 'ascending' ? 'asc' : 'desc'
|
||||||
|
this.listQuery.sidx = !order ? '' : prop
|
||||||
|
this.initData()
|
||||||
|
},
|
||||||
|
initData() {
|
||||||
|
this.listLoading = true;
|
||||||
|
let _query = {
|
||||||
|
...this.listQuery,
|
||||||
|
...this.query,
|
||||||
|
menuId:this.menuId
|
||||||
|
};
|
||||||
|
request({
|
||||||
|
url: `/api/example/InventoryOrg/getList`,
|
||||||
|
method: 'post',
|
||||||
|
data: _query
|
||||||
|
}).then(res => {
|
||||||
|
var _list =[];
|
||||||
|
for(let i=0;i<res.data.list.length;i++){
|
||||||
|
let _data = res.data.list[i];
|
||||||
|
_list.push(_data)
|
||||||
|
}
|
||||||
|
this.list = _list
|
||||||
|
this.total = res.data.pagination.total
|
||||||
|
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleDel(id) {
|
||||||
|
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
request({
|
||||||
|
url: `/api/example/InventoryOrg/${id}`,
|
||||||
|
method: 'DELETE'
|
||||||
|
}).then(res => {
|
||||||
|
this.$message({
|
||||||
|
type: 'success',
|
||||||
|
message: res.msg,
|
||||||
|
onClose: () => {
|
||||||
|
this.initData()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addOrUpdateHandle(id, isDetail) {
|
||||||
|
this.formVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.JNPFForm.init(id, isDetail)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
exportData() {
|
||||||
|
this.exportBoxVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.ExportBox.init(this.columnList)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
download(data) {
|
||||||
|
let query = {...data, ...this.listQuery, ...this.query,menuId:this.menuId}
|
||||||
|
request({
|
||||||
|
url: `/api/example/InventoryOrg/Actions/Export`,
|
||||||
|
method: 'GET',
|
||||||
|
data: query
|
||||||
|
}).then(res => {
|
||||||
|
if (!res.data.url) return
|
||||||
|
this.jnpf.downloadFile(res.data.url)
|
||||||
|
this.$refs.ExportBox.visible = false
|
||||||
|
this.exportBoxVisible = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
search() {
|
||||||
|
this.listQuery = {
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
sort: "desc",
|
||||||
|
sidx: "creatorTime",
|
||||||
|
}
|
||||||
|
this.initData()
|
||||||
|
},
|
||||||
|
refresh(isrRefresh) {
|
||||||
|
this.formVisible = false
|
||||||
|
if (isrRefresh) this.reset()
|
||||||
|
},
|
||||||
|
reset() {
|
||||||
|
for (let key in this.query) {
|
||||||
|
this.query[key] = undefined
|
||||||
|
}
|
||||||
|
this.search()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -0,0 +1,93 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog title="详情"
|
||||||
|
:close-on-click-modal="false" append-to-body
|
||||||
|
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
|
||||||
|
width="600px">
|
||||||
|
<el-row :gutter="15" class="">
|
||||||
|
<el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" >
|
||||||
|
<template v-if="!loading">
|
||||||
|
<el-col :span="24" >
|
||||||
|
<el-form-item label="编码"
|
||||||
|
prop="inventoryOrgDetailCode" >
|
||||||
|
<p>{{dataForm.inventoryOrgDetailCode}}</p>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" >
|
||||||
|
<el-form-item label="名称"
|
||||||
|
prop="inventoryOrgDetailName" >
|
||||||
|
<p>{{dataForm.inventoryOrgDetailName}}</p>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" >
|
||||||
|
<el-form-item label="库存组织"
|
||||||
|
prop="inventoryId" >
|
||||||
|
<p>{{dataForm.inventoryId}}</p>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</template>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="visible = false"> 取 消</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import request from '@/utils/request'
|
||||||
|
import PrintBrowse from '@/components/PrintBrowse'
|
||||||
|
import jnpf from '@/utils/jnpf'
|
||||||
|
export default {
|
||||||
|
components: {PrintBrowse},
|
||||||
|
props: [],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
loading: false,
|
||||||
|
printBrowseVisible: false,
|
||||||
|
printId: '',
|
||||||
|
dataForm: {
|
||||||
|
id :'',
|
||||||
|
inventoryOrgDetailCode : '',
|
||||||
|
inventoryOrgDetailName : '',
|
||||||
|
inventoryId : "",
|
||||||
|
lastModifyUserName : "",
|
||||||
|
lastModifyTime : "",
|
||||||
|
creatorUserName : "",
|
||||||
|
creatorTime : "",
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
watch: {},
|
||||||
|
created() {
|
||||||
|
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
methods: {
|
||||||
|
dataInfo(dataAll){
|
||||||
|
let _dataAll =dataAll
|
||||||
|
this.dataForm = _dataAll
|
||||||
|
},
|
||||||
|
|
||||||
|
init(id) {
|
||||||
|
this.dataForm.id = id || 0;
|
||||||
|
this.visible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if(this.dataForm.id){
|
||||||
|
this.loading = true
|
||||||
|
request({
|
||||||
|
url: '/api/example/InventoryOrgDetail/detail/'+this.dataForm.id,
|
||||||
|
method: 'get'
|
||||||
|
}).then(res => {
|
||||||
|
this.dataInfo(res.data)
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
@ -0,0 +1,68 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog title="导出数据" :close-on-click-modal="false" :visible.sync="visible"
|
||||||
|
class="JNPF-dialog JNPF-dialog_center" lock-scroll width="600px">
|
||||||
|
<el-form label-position="top" label-width="80px">
|
||||||
|
<el-form-item label="数据选择">
|
||||||
|
<el-radio-group v-model="type">
|
||||||
|
<el-radio :label="0">当前页面数据</el-radio>
|
||||||
|
<el-radio :label="1">全部页面数据</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="导出字段">
|
||||||
|
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll"
|
||||||
|
@change="handleCheckAllChange">全选</el-checkbox>
|
||||||
|
<el-checkbox-group v-model="columns" @change="handleCheckedChange">
|
||||||
|
<el-checkbox v-for="item in columnList" :label="item.prop" :key="item.prop">
|
||||||
|
{{item.label}}
|
||||||
|
</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="visible=false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="downLoad">导 出</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
btnLoading: false,
|
||||||
|
type: 0,
|
||||||
|
columns: [],
|
||||||
|
checkAll: true,
|
||||||
|
isIndeterminate: false,
|
||||||
|
columnList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init(columnList) {
|
||||||
|
this.visible = true
|
||||||
|
this.checkAll = true
|
||||||
|
this.isIndeterminate = false
|
||||||
|
this.columnList = columnList
|
||||||
|
this.columns = columnList.map(o => o.prop)
|
||||||
|
},
|
||||||
|
handleCheckAllChange(val) {
|
||||||
|
this.columns = val ? this.columnList.map(o => o.prop) : [];
|
||||||
|
this.isIndeterminate = false;
|
||||||
|
},
|
||||||
|
handleCheckedChange(value) {
|
||||||
|
let checkedCount = value.length;
|
||||||
|
this.checkAll = checkedCount === this.columnList.length;
|
||||||
|
this.isIndeterminate = checkedCount > 0 && checkedCount < this.columnList.length;
|
||||||
|
},
|
||||||
|
downLoad() {
|
||||||
|
this.$emit('download', { dataType: this.type, selectKey: this.columns.join(',') })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
>>> .el-dialog__body {
|
||||||
|
padding: 20px !important;
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,175 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'"
|
||||||
|
:close-on-click-modal="false" append-to-body
|
||||||
|
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
|
||||||
|
width="600px">
|
||||||
|
<el-row :gutter="15" class="">
|
||||||
|
<el-form ref="elForm" :model="dataForm" :rules="rules" size="small" label-width="100px" label-position="right" >
|
||||||
|
<template v-if="!loading">
|
||||||
|
<el-col :span="24" >
|
||||||
|
<el-form-item label="编码"
|
||||||
|
prop="inventoryOrgDetailCode" >
|
||||||
|
<el-input v-model="dataForm.inventoryOrgDetailCode"
|
||||||
|
placeholder="请输入库存组织编码" clearable :style='{"width":"100%"}'>
|
||||||
|
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" >
|
||||||
|
<el-form-item label="名称"
|
||||||
|
prop="inventoryOrgDetailName" >
|
||||||
|
<el-input v-model="dataForm.inventoryOrgDetailName"
|
||||||
|
placeholder="请输入库存组织名称" clearable :style='{"width":"100%"}'>
|
||||||
|
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" >
|
||||||
|
<el-form-item label="库存组织"
|
||||||
|
prop="inventoryId" >
|
||||||
|
<popupSelect v-model="dataForm.inventoryId"
|
||||||
|
placeholder="请选择库存组织" clearable field="inventoryId" interfaceId="394085757268070853" :columnOptions="inventoryIdcolumnOptions" propsValue="id" relationField="inventory_org_name" popupType="dialog"
|
||||||
|
popupTitle="选择数据" popupWidth="800px"
|
||||||
|
>
|
||||||
|
|
||||||
|
</popupSelect>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</template>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="visible = false"> 取 消</el-button>
|
||||||
|
<el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail"> 确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import request from '@/utils/request'
|
||||||
|
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
|
||||||
|
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
|
||||||
|
export default {
|
||||||
|
components: {},
|
||||||
|
props: [],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
loading: false,
|
||||||
|
isDetail: false,
|
||||||
|
dataForm: {
|
||||||
|
inventoryOrgDetailCode : '',
|
||||||
|
inventoryOrgDetailName : '',
|
||||||
|
inventoryId : "",
|
||||||
|
lastModifyUserName : "",
|
||||||
|
lastModifyTime : "",
|
||||||
|
creatorUserName : "",
|
||||||
|
creatorTime : "",
|
||||||
|
},
|
||||||
|
rules:
|
||||||
|
{
|
||||||
|
inventoryOrgDetailCode: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入库存组织编码',
|
||||||
|
trigger: 'blur'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
inventoryIdcolumnOptions:[ {"label":"组织编码","value":"inventory_org_code"}, {"label":"组织名称","value":"inventory_org_name"},],
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
watch: {},
|
||||||
|
created() {
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
methods: {
|
||||||
|
clearData(data){
|
||||||
|
for (let key in data) {
|
||||||
|
if (data[key] instanceof Array) {
|
||||||
|
data[key] = [];
|
||||||
|
} else if (data[key] instanceof Object) {
|
||||||
|
this.clearData(data[key]);
|
||||||
|
} else {
|
||||||
|
data[key] = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
init(id, isDetail) {
|
||||||
|
this.dataForm.id = id || 0;
|
||||||
|
this.visible = true;
|
||||||
|
this.isDetail = isDetail || false;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs['elForm'].resetFields();
|
||||||
|
if(this.dataForm.id){
|
||||||
|
this.loading = true
|
||||||
|
request({
|
||||||
|
url: '/api/example/InventoryOrgDetail/'+this.dataForm.id,
|
||||||
|
method: 'get'
|
||||||
|
}).then(res => {
|
||||||
|
this.dataInfo(res.data)
|
||||||
|
this.loading = false
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
this.clearData(this.dataForm)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
|
||||||
|
},
|
||||||
|
// 表单提交
|
||||||
|
dataFormSubmit() {
|
||||||
|
this.$refs['elForm'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.request()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
request() {
|
||||||
|
var _data =this.dataList()
|
||||||
|
if (!this.dataForm.id) {
|
||||||
|
request({
|
||||||
|
url: '/api/example/InventoryOrgDetail',
|
||||||
|
method: 'post',
|
||||||
|
data: _data
|
||||||
|
}).then((res) => {
|
||||||
|
this.$message({
|
||||||
|
message: res.msg,
|
||||||
|
type: 'success',
|
||||||
|
duration: 1000,
|
||||||
|
onClose: () => {
|
||||||
|
this.visible = false
|
||||||
|
this.$emit('refresh', true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
request({
|
||||||
|
url: '/api/example/InventoryOrgDetail/'+this.dataForm.id,
|
||||||
|
method: 'PUT',
|
||||||
|
data: _data
|
||||||
|
}).then((res) => {
|
||||||
|
this.$message({
|
||||||
|
message: res.msg,
|
||||||
|
type: 'success',
|
||||||
|
duration: 1000,
|
||||||
|
onClose: () => {
|
||||||
|
this.visible = false
|
||||||
|
this.$emit('refresh', true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dataList(){
|
||||||
|
var _data = JSON.parse(JSON.stringify(this.dataForm));
|
||||||
|
return _data;
|
||||||
|
},
|
||||||
|
dataInfo(dataAll){
|
||||||
|
let _dataAll =dataAll
|
||||||
|
this.dataForm = _dataAll
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
@ -0,0 +1,219 @@
|
|||||||
|
<template>
|
||||||
|
<div class="JNPF-common-layout">
|
||||||
|
|
||||||
|
<div class="JNPF-common-layout-center">
|
||||||
|
<el-row class="JNPF-common-search-box" :gutter="16">
|
||||||
|
<el-form @submit.native.prevent>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="编码">
|
||||||
|
<el-input v-model="query.inventoryOrgDetailCode" placeholder="请输入" clearable> </el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="名称">
|
||||||
|
<el-input v-model="query.inventoryOrgDetailName" placeholder="请输入" clearable> </el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" @click="search()">查询</el-button>
|
||||||
|
<el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
<div class="JNPF-common-layout-main JNPF-flex-main">
|
||||||
|
<div class="JNPF-common-head">
|
||||||
|
<div>
|
||||||
|
<el-button type="primary" icon="el-icon-plus" @click="addOrUpdateHandle()">新增
|
||||||
|
</el-button>
|
||||||
|
<el-button type="text" icon="el-icon-download" @click="exportData()" >导出
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="JNPF-common-head-right">
|
||||||
|
<el-tooltip effect="dark" content="刷新" placement="top">
|
||||||
|
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
|
||||||
|
@click="reset()"/>
|
||||||
|
</el-tooltip>
|
||||||
|
<screenfull isContainer/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange' >
|
||||||
|
<el-table-column prop="inventoryOrgDetailCode" label="编码" width="0" align="left"
|
||||||
|
/>
|
||||||
|
<el-table-column prop="inventoryOrgDetailName" label="名称" width="0" align="left"
|
||||||
|
/>
|
||||||
|
<el-table-column prop="inventoryId" label="库存组织" width="0" align="left"
|
||||||
|
/>
|
||||||
|
<el-table-column prop="creatorTime" label="创建时间" width="0" align="left"
|
||||||
|
/>
|
||||||
|
<el-table-column label="操作" fixed="right"
|
||||||
|
width="100" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button type="text"
|
||||||
|
@click="addOrUpdateHandle(scope.row.id)" >编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button type="text" class="JNPF-table-delBtn" @click="handleDel(scope.row.id)">删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</JNPF-table>
|
||||||
|
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initData"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<JNPF-Form v-if="formVisible" ref="JNPFForm" @refresh="refresh"/>
|
||||||
|
<ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download"/>
|
||||||
|
<Detail v-if="detailVisible" ref="Detail" @refresh="detailVisible=false"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import request from '@/utils/request'
|
||||||
|
import {getDictionaryDataSelector} from '@/api/systemData/dictionary'
|
||||||
|
import JNPFForm from './Form'
|
||||||
|
import ExportBox from './ExportBox'
|
||||||
|
import {getDataInterfaceRes} from '@/api/systemData/dataInterface'
|
||||||
|
import Detail from './Detail'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {JNPFForm, ExportBox,Detail},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
detailVisible: false,
|
||||||
|
query: {
|
||||||
|
inventoryOrgDetailCode:undefined,
|
||||||
|
inventoryOrgDetailName:undefined,
|
||||||
|
},
|
||||||
|
treeProps: {
|
||||||
|
children: 'children',
|
||||||
|
label: 'fullName',
|
||||||
|
value: 'id'
|
||||||
|
},
|
||||||
|
list: [],
|
||||||
|
listLoading: true,
|
||||||
|
total: 0,
|
||||||
|
listQuery: {
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
sort: "desc",
|
||||||
|
sidx: "creatorTime",
|
||||||
|
},
|
||||||
|
formVisible: false,
|
||||||
|
exportBoxVisible: false,
|
||||||
|
columnList: [
|
||||||
|
{prop: 'inventoryOrgDetailCode', label: '编码'},
|
||||||
|
{prop: 'inventoryOrgDetailName', label: '名称'},
|
||||||
|
{prop: 'inventoryId', label: '库存组织'},
|
||||||
|
{prop: 'creatorTime', label: '创建时间'},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
menuId() {
|
||||||
|
return this.$route.meta.modelId || ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.initData()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
goDetail(id){
|
||||||
|
this.detailVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.Detail.init(id)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
sortChange({column, prop, order}) {
|
||||||
|
this.listQuery.sort = order == 'ascending' ? 'asc' : 'desc'
|
||||||
|
this.listQuery.sidx = !order ? '' : prop
|
||||||
|
this.initData()
|
||||||
|
},
|
||||||
|
initData() {
|
||||||
|
this.listLoading = true;
|
||||||
|
let _query = {
|
||||||
|
...this.listQuery,
|
||||||
|
...this.query,
|
||||||
|
menuId:this.menuId
|
||||||
|
};
|
||||||
|
request({
|
||||||
|
url: `/api/example/InventoryOrgDetail/getList`,
|
||||||
|
method: 'post',
|
||||||
|
data: _query
|
||||||
|
}).then(res => {
|
||||||
|
var _list =[];
|
||||||
|
for(let i=0;i<res.data.list.length;i++){
|
||||||
|
let _data = res.data.list[i];
|
||||||
|
_list.push(_data)
|
||||||
|
}
|
||||||
|
this.list = _list
|
||||||
|
this.total = res.data.pagination.total
|
||||||
|
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleDel(id) {
|
||||||
|
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
request({
|
||||||
|
url: `/api/example/InventoryOrgDetail/${id}`,
|
||||||
|
method: 'DELETE'
|
||||||
|
}).then(res => {
|
||||||
|
this.$message({
|
||||||
|
type: 'success',
|
||||||
|
message: res.msg,
|
||||||
|
onClose: () => {
|
||||||
|
this.initData()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addOrUpdateHandle(id, isDetail) {
|
||||||
|
this.formVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.JNPFForm.init(id, isDetail)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
exportData() {
|
||||||
|
this.exportBoxVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.ExportBox.init(this.columnList)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
download(data) {
|
||||||
|
let query = {...data, ...this.listQuery, ...this.query,menuId:this.menuId}
|
||||||
|
request({
|
||||||
|
url: `/api/example/InventoryOrgDetail/Actions/Export`,
|
||||||
|
method: 'GET',
|
||||||
|
data: query
|
||||||
|
}).then(res => {
|
||||||
|
if (!res.data.url) return
|
||||||
|
this.jnpf.downloadFile(res.data.url)
|
||||||
|
this.$refs.ExportBox.visible = false
|
||||||
|
this.exportBoxVisible = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
search() {
|
||||||
|
this.listQuery = {
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
sort: "desc",
|
||||||
|
sidx: "creatorTime",
|
||||||
|
}
|
||||||
|
this.initData()
|
||||||
|
},
|
||||||
|
refresh(isrRefresh) {
|
||||||
|
this.formVisible = false
|
||||||
|
if (isrRefresh) this.reset()
|
||||||
|
},
|
||||||
|
reset() {
|
||||||
|
for (let key in this.query) {
|
||||||
|
this.query[key] = undefined
|
||||||
|
}
|
||||||
|
this.search()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in new issue