Commit 8d90a966 authored by 仇晓婷's avatar 仇晓婷

Merge branch 'product' of http://git.mes123.com/zhouyx/mes-ui into product

parents f578aa44 16e2557d
<template>
<div>
<Input v-model="newName" placeholder="请选择上传文件" disabled>
<Button v-if="view" icon="md-download" slot="prepend" @click="downFile(newName)"> </Button>
<Button type="primary" icon="ios-cloud-upload-outline" slot="append" @click="handler">上传</Button>
</Input>
<Upload
v-model="name"
:action="postUrl"
:on-success="uploadSuccess"
:on-error="uploadError"
:on-remove="removeFile"
:format="formatList"
:max-size="maxSize"
:on-exceeded-size="onExceededSize"
:on-format-error="onFormatError"
:show-upload-list="false"
:files="files"
:on-progress="onProgress"
>
<Button v-show="1==2" type="primary" ref="upload">上传</Button>
</Upload>
<Progress :percent="per" :stroke-width="5" v-show="vshowPro" />
</div>
</template>
<script>
import util from "@/libs/util";
export default {
name: "inputExcel",
model: {
prop: "value",
event: "on-change"
},
data() {
return {
file: null,
name: this.value,
downUrl: fileUrlDown,
fileUrlPath: "",
nameList: [],
postUrl:
fileUrl +
"/upload/?token=Bearer " +
util.cookies.get("token") +
"&" +
this.parms,
formatList: ["xlsx", "xls"],
newName: "",
newPath: "",
per: 0,
vshowPro: false
};
},
created() {},
props: {
value: [String, Number, Array, Object],
maxSize: {
type: Number,
default: 10240
},
files: {
type: Boolean,
default: false
},
parms: {
type: String,
default: ""
},
showButton: {
type: Boolean,
default: true
}
},
methods: {
onProgress(event, file, fileList) {
this.per = 0;
this.vshowPro = true;
},
handler() {
this.$refs.upload.$el.click();
},
// change(event) {
// this.$emit('on-change', event.target.value)
// },
//上传成功文件
uploadSuccess(response, file, fileList) {
this.per = 60;
this.vshowPro = true;
const hbaseFileList = [];
const filesList = [];
if (file.response.status == 0) {
let objImag = {};
objImag.fileName = file.response.data.fileName;
objImag.filePath = file.response.data.downloadPath;
filesList.push(objImag);
this.newName = file.response.data.fileName;
this.newPath = file.response.data.downloadPath;
this.$emit("on-change", JSON.stringify(filesList));
this.per = 100;
setTimeout(() => {
this.per = 0;
this.vshowPro = false;
}, 2000);
} else {
this.$Message.error("上传失败,请重新上传!");
}
},
//上传文件失败
uploadError(response, file, fileList) {
this.$Message.error("上传失败,请重新上传!");
},
//文件大小验证返回
onExceededSize(file, fileList) {
if (Object.keys(file).length == 0) {
this.$Message.error(
"上传文件不能大于" + this.maxSize + "k,请重新上传!"
);
}
},
//文件格式验证
onFormatError(file, fileList) {
if (Object.keys(file).length == 0) {
this.$Message.error("上传文件格式不正确,请重新上传!");
}
},
//删除上传
removeFile(file, fileList) {},
formatL() {
if (this.files) {
this.formatList = [
"pdf",
"docx",
"doc",
"xls",
"xlsx",
"txt",
"png",
"jpg",
"gif",
"zip",
"rar"
];
}
return this.formatList;
},
downFile(path) {
let truePath = path.trim();
if (truePath.length > 2) {
if (
truePath.substring(0, 7).toLowerCase() == "http://" ||
truePath.substring(0, 8).toLowerCase() == "https://"
) {
window.open(truePath, "_blank");
} else {
this.fileUrlPath = this.downUrl + path;
window.open(this.fileUrlPath, "_blank");
}
}
}
},
mounted() {
this.formatL();
},
computed: {
nativeInputValue() {
return this.value === null || this.value === undefined ? "" : this.value;
},
view(){
return true
}
},
watch: {
value(v) {
this.name = v;
}
}
};
</script>
<style lang="less">
</style>
\ No newline at end of file
/* eslint-disable */
/* Blob.js
* A Blob implementation.
* 2014-05-27
*
* By Eli Grey, http://eligrey.com
* By Devin Samarin, https://github.com/eboyjr
* License: X11/MIT
* See LICENSE.md
*/
/*global self, unescape */
/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
plusplus: true */
/*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */
(function (view) {
"use strict";
view.URL = view.URL || view.webkitURL;
if (view.Blob && view.URL) {
try {
new Blob;
return;
} catch (e) {}
}
// Internally we use a BlobBuilder implementation to base Blob off of
// in order to support older browsers that only have BlobBuilder
var BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function(view) {
var
get_class = function(object) {
return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1];
}
, FakeBlobBuilder = function BlobBuilder() {
this.data = [];
}
, FakeBlob = function Blob(data, type, encoding) {
this.data = data;
this.size = data.length;
this.type = type;
this.encoding = encoding;
}
, FBB_proto = FakeBlobBuilder.prototype
, FB_proto = FakeBlob.prototype
, FileReaderSync = view.FileReaderSync
, FileException = function(type) {
this.code = this[this.name = type];
}
, file_ex_codes = (
"NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR "
+ "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR"
).split(" ")
, file_ex_code = file_ex_codes.length
, real_URL = view.URL || view.webkitURL || view
, real_create_object_URL = real_URL.createObjectURL
, real_revoke_object_URL = real_URL.revokeObjectURL
, URL = real_URL
, btoa = view.btoa
, atob = view.atob
, ArrayBuffer = view.ArrayBuffer
, Uint8Array = view.Uint8Array
;
FakeBlob.fake = FB_proto.fake = true;
while (file_ex_code--) {
FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;
}
if (!real_URL.createObjectURL) {
URL = view.URL = {};
}
URL.createObjectURL = function(blob) {
var
type = blob.type
, data_URI_header
;
if (type === null) {
type = "application/octet-stream";
}
if (blob instanceof FakeBlob) {
data_URI_header = "data:" + type;
if (blob.encoding === "base64") {
return data_URI_header + ";base64," + blob.data;
} else if (blob.encoding === "URI") {
return data_URI_header + "," + decodeURIComponent(blob.data);
} if (btoa) {
return data_URI_header + ";base64," + btoa(blob.data);
} else {
return data_URI_header + "," + encodeURIComponent(blob.data);
}
} else if (real_create_object_URL) {
return real_create_object_URL.call(real_URL, blob);
}
};
URL.revokeObjectURL = function(object_URL) {
if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) {
real_revoke_object_URL.call(real_URL, object_URL);
}
};
FBB_proto.append = function(data/*, endings*/) {
var bb = this.data;
// decode data to a binary string
if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) {
var
str = ""
, buf = new Uint8Array(data)
, i = 0
, buf_len = buf.length
;
for (; i < buf_len; i++) {
str += String.fromCharCode(buf[i]);
}
bb.push(str);
} else if (get_class(data) === "Blob" || get_class(data) === "File") {
if (FileReaderSync) {
var fr = new FileReaderSync;
bb.push(fr.readAsBinaryString(data));
} else {
// async FileReader won't work as BlobBuilder is sync
throw new FileException("NOT_READABLE_ERR");
}
} else if (data instanceof FakeBlob) {
if (data.encoding === "base64" && atob) {
bb.push(atob(data.data));
} else if (data.encoding === "URI") {
bb.push(decodeURIComponent(data.data));
} else if (data.encoding === "raw") {
bb.push(data.data);
}
} else {
if (typeof data !== "string") {
data += ""; // convert unsupported types to strings
}
// decode UTF-16 to binary string
bb.push(unescape(encodeURIComponent(data)));
}
};
FBB_proto.getBlob = function(type) {
if (!arguments.length) {
type = null;
}
return new FakeBlob(this.data.join(""), type, "raw");
};
FBB_proto.toString = function() {
return "[object BlobBuilder]";
};
FB_proto.slice = function(start, end, type) {
var args = arguments.length;
if (args < 3) {
type = null;
}
return new FakeBlob(
this.data.slice(start, args > 1 ? end : this.data.length)
, type
, this.encoding
);
};
FB_proto.toString = function() {
return "[object Blob]";
};
FB_proto.close = function() {
this.size = this.data.length = 0;
};
return FakeBlobBuilder;
}(view));
view.Blob = function Blob(blobParts, options) {
var type = options ? (options.type || "") : "";
var builder = new BlobBuilder();
if (blobParts) {
for (var i = 0, len = blobParts.length; i < len; i++) {
builder.append(blobParts[i]);
}
}
return builder.getBlob(type);
};
}(typeof self !== "undefined" && self || typeof window !== "undefined" && window || this.content || this));
/* eslint-disable */
require('script-loader!file-saver');
require('./Blob.js');
require('script-loader!xlsx/dist/xlsx.core.min');
function generateArray(table) {
var out = [];
var rows = table.querySelectorAll('tr');
var ranges = [];
for (var R = 0; R < rows.length; ++R) {
var outRow = [];
var row = rows[R];
var columns = row.querySelectorAll('td');
for (var C = 0; C < columns.length; ++C) {
var cell = columns[C];
var colspan = cell.getAttribute('colspan');
var rowspan = cell.getAttribute('rowspan');
var cellValue = cell.innerText;
if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
//Skip ranges
ranges.forEach(function (range) {
if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
}
});
//Handle Row Span
if (rowspan || colspan) {
rowspan = rowspan || 1;
colspan = colspan || 1;
ranges.push({s: {r: R, c: outRow.length}, e: {r: R + rowspan - 1, c: outRow.length + colspan - 1}});
}
;
//Handle Value
outRow.push(cellValue !== "" ? cellValue : null);
//Handle Colspan
if (colspan) for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
}
out.push(outRow);
}
return [out, ranges];
};
function datenum(v, date1904) {
if (date1904) v += 1462;
var epoch = Date.parse(v);
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
}
function sheet_from_array_of_arrays(data, opts) {
var ws = {};
var range = {s: {c: 10000000, r: 10000000}, e: {c: 0, r: 0}};
for (var R = 0; R != data.length; ++R) {
for (var C = 0; C != data[R].length; ++C) {
if (range.s.r > R) range.s.r = R;
if (range.s.c > C) range.s.c = C;
if (range.e.r < R) range.e.r = R;
if (range.e.c < C) range.e.c = C;
var cell = {v: data[R][C]};
if (cell.v == null) continue;
var cell_ref = XLSX.utils.encode_cell({c: C, r: R});
if (typeof cell.v === 'number') cell.t = 'n';
else if (typeof cell.v === 'boolean') cell.t = 'b';
else if (cell.v instanceof Date) {
cell.t = 'n';
cell.z = XLSX.SSF._table[14];
cell.v = datenum(cell.v);
}
else cell.t = 's';
ws[cell_ref] = cell;
}
}
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
return ws;
}
function Workbook() {
if (!(this instanceof Workbook)) return new Workbook();
this.SheetNames = [];
this.Sheets = {};
}
function s2ab(s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
export function export_table_to_excel(id) {
var theTable = document.getElementById(id);
console.log('a')
var oo = generateArray(theTable);
var ranges = oo[1];
/* original data */
var data = oo[0];
var ws_name = "SheetJS";
console.log(data);
var wb = new Workbook(), ws = sheet_from_array_of_arrays(data);
/* add ranges to worksheet */
// ws['!cols'] = ['apple', 'banan'];
ws['!merges'] = ranges;
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'});
saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), "test.xlsx")
}
function formatJson(jsonData) {
console.log(jsonData)
}
export function export_json_to_excel(th, jsonData, defaultTitle) {
/* original data */
var data = jsonData;
data.unshift(th);
var ws_name = "SheetJS";
var wb = new Workbook(), ws = sheet_from_array_of_arrays(data);
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'});
var title = defaultTitle || '列表'
saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), title + ".xlsx")
}
......@@ -1658,5 +1658,21 @@ export default {
stockCode: '物料序号',
count1:"可申请数",
count2:"申请数"
},
//导入中心
import_center:{
creationTime:'创建时间',
creatorUserId:'创建人',
lastModificationTime:'更新时间',
lastModifierUserId:'更新人',
isDeleted:'是否删除',
deletionTime:'删除时间',
deleterUserId:'删除人',
creator:'上传人',
lastModifier:'更新人名',
name:'名称',
file:'文件',
status:'状态',
remark:'备注',
}
}
import XLSX from 'xlsx';
let henq = {};
let pdfInfo = ''
henq.clone = (obj) => {
......@@ -146,7 +147,7 @@ henq.treeToList = (tree) => {
treeToList(tree, null)
return list;
}
henq.findRoots=(arr1, id)=>{
henq.findRoots = (arr1, id) => {
var temp = []
var forFn = function (arr, id) {
for (var i = 0; i < arr.length; i++) {
......@@ -189,7 +190,7 @@ henq.outPdf = (ele, fileName) => {
window.open("/static/pdf.html", '_blank');
}, 1000)
}
henq.getArry = (arryList) => {//得到数据字典对应的label和value,用于table排序
henq.getArry = (arryList) => { //得到数据字典对应的label和value,用于table排序
let arry = [];
arryList.forEach(data => {
var that = this;
......@@ -200,13 +201,13 @@ henq.getArry = (arryList) => {//得到数据字典对应的label和value,用
});
return arry;
}
henq.random=(minNum, maxNum)=> {
henq.random = (minNum, maxNum) => {
switch (arguments.length) {
case 1:
return parseInt(Math.random() * minNum + 1, 10);
break;
case 2:
return parseInt(Math.random() * ( maxNum - minNum + 1 ) + minNum, 10);
return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
//或者 Math.floor(Math.random()*( maxNum - minNum + 1 ) + minNum );
break;
default:
......@@ -214,4 +215,96 @@ henq.random=(minNum, maxNum)=> {
break;
}
}
//导出json为excel
henq.outExcel = (fileName, title, key, outdata) => {
var that = henq
require.ensure([], () => {
const {
export_json_to_excel
} = require("@/excel/Export2Excel");
const tHeader = title; // 设置Excel的表格第一行的标题
const filterVal = key; //list里对象的属性
const list = outdata; //把data里的tableData存到list
const data = that.formatJson(filterVal, list);
export_json_to_excel(tHeader, data, fileName); //导出Excel 文件名
})
}
henq.formatJson = (filterVal, jsonData) => {
return jsonData.map((v) => filterVal.map((j) => v[j]));
}
//获取当前年月日时分秒
henq.getNowTime = () => {
var myDate = new Date();
let year = myDate.getFullYear().toString();
let month = (myDate.getMonth() + 1).toString();
if (month.length == 1) {
month = "0" + month;
}
let date = myDate.getDate().toString();
if (date.length == 1) {
date = "0" + date;
}
let hours = myDate.getHours().toString();
if (hours.length == 1) {
hours = "0" + hours;
}
let minutes = myDate.getMinutes().toString();
if (minutes.length == 1) {
minutes = "0" + minutes;
}
let seconds = myDate.getSeconds().toString();
if (seconds.length == 1) {
seconds = "0" + seconds;
}
return year + month + date + hours + minutes + seconds;
}
//读取本地excel
henq.readXLSX = (file) => {
let nameSplit = file.name.split(".");
let format = nameSplit[nameSplit.length - 1];
if (!["xlsx", "csv"].includes(format)) {
return false;
}
return new Promise((resolve, reject) => {
let reader = new FileReader();
reader.readAsBinaryString(file);
reader.onload = function (evt) {
let data = evt.target.result; // 读到的数据
var workbook = XLSX.read(data, {
type: "binary"
});
resolve(workbook);
};
});
}
//得到根据value得到对应数据字典的name
henq.dirName = (code, v) => {
var items = ""
let i = 0
code.forEach(ele => {
if (ele.code == v) {
items = ele.name
i++
}
});
if (i == 0) { //如果没查到对应的name,则返回默认name
items = code[0].name
}
return items
}
//得到根据name得到对应数据字典的code
henq.dirCode = (code, v) => {
var items = ""
let i = 0
code.forEach(ele => {
if (ele.name == v) {
items = ele.code
i++
}
});
if (i == 0) { //如果没查到对应的name,则返回默认name
items = code[0].code
}
return items
}
export default henq;
......@@ -4037,21 +4037,13 @@
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
},
"cfb": {
"version": "1.1.4",
"resolved": "http://r.cnpmjs.org/cfb/download/cfb-1.1.4.tgz",
"integrity": "sha1-gf017eTJGdjwliqUWC4d+vcFHio=",
"version": "1.2.0",
"resolved": "https://registry.npm.taobao.org/cfb/download/cfb-1.2.0.tgz",
"integrity": "sha1-ak0IcrUl7WA0nh71H7Swv3Psqag=",
"requires": {
"adler-32": "~1.2.0",
"commander": "^2.16.0",
"crc-32": "~1.2.0",
"printj": "~1.1.2"
},
"dependencies": {
"commander": {
"version": "2.20.3",
"resolved": "http://r.cnpmjs.org/commander/download/commander-2.20.3.tgz",
"integrity": "sha1-/UhehMA+tIgcIHIrpIA16FMa6zM="
}
}
},
"chalk": {
......@@ -4696,7 +4688,7 @@
"dependencies": {
"commander": {
"version": "2.14.1",
"resolved": "http://r.cnpmjs.org/commander/download/commander-2.14.1.tgz",
"resolved": "https://registry.npm.taobao.org/commander/download/commander-2.14.1.tgz?cache=0&sync_timestamp=1595168224685&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcommander%2Fdownload%2Fcommander-2.14.1.tgz",
"integrity": "sha1-IjUSPjevjKPGXfRbAm29NXsBuao="
}
}
......@@ -5224,7 +5216,7 @@
},
"crc-32": {
"version": "1.2.0",
"resolved": "http://r.cnpmjs.org/crc-32/download/crc-32-1.2.0.tgz",
"resolved": "https://registry.npm.taobao.org/crc-32/download/crc-32-1.2.0.tgz",
"integrity": "sha1-yy224puIUI4y2d0OwWk+e0Ghggg=",
"requires": {
"exit-on-epipe": "~1.0.1",
......@@ -6093,11 +6085,11 @@
}
},
"echarts": {
"version": "4.7.0",
"resolved": "http://r.cnpmjs.org/echarts/download/echarts-4.7.0.tgz",
"integrity": "sha1-Wzh1pML5HjkpQl+rq56s5+QJiz8=",
"version": "4.8.0",
"resolved": "https://registry.npm.taobao.org/echarts/download/echarts-4.8.0.tgz",
"integrity": "sha1-ssHPuSKbE9No7hBPyO6mALV01MQ=",
"requires": {
"zrender": "4.3.0"
"zrender": "4.3.1"
}
},
"echarts-liquidfill": {
......@@ -6916,7 +6908,7 @@
},
"exit-on-epipe": {
"version": "1.0.1",
"resolved": "http://r.cnpmjs.org/exit-on-epipe/download/exit-on-epipe-1.0.1.tgz",
"resolved": "https://registry.npm.taobao.org/exit-on-epipe/download/exit-on-epipe-1.0.1.tgz",
"integrity": "sha1-C92S6H1ShdJn2qgXHQ6wYVlolpI="
},
"expand-brackets": {
......@@ -7327,6 +7319,11 @@
"schema-utils": "^2.5.0"
}
},
"file-saver": {
"version": "2.0.2",
"resolved": "https://registry.npm.taobao.org/file-saver/download/file-saver-2.0.2.tgz",
"integrity": "sha1-BtbnKKnqLfLM4vjZ6E383DOOwXo="
},
"file-uri-to-path": {
"version": "1.0.0",
"resolved": "http://r.cnpmjs.org/file-uri-to-path/download/file-uri-to-path-1.0.0.tgz",
......@@ -7558,7 +7555,7 @@
},
"frac": {
"version": "1.1.2",
"resolved": "http://r.cnpmjs.org/frac/download/frac-1.1.2.tgz",
"resolved": "https://registry.npm.taobao.org/frac/download/frac-1.1.2.tgz",
"integrity": "sha1-PXT39keMiKG1AgMG10fcYxPHTQs="
},
"fragment-cache": {
......@@ -14593,7 +14590,7 @@
},
"printj": {
"version": "1.1.2",
"resolved": "http://r.cnpmjs.org/printj/download/printj-1.1.2.tgz",
"resolved": "https://registry.npm.taobao.org/printj/download/printj-1.1.2.tgz",
"integrity": "sha1-2Q3rKXWoufYA+zoclOP0xTx4oiI="
},
"private": {
......@@ -20054,7 +20051,7 @@
},
"script-loader": {
"version": "0.7.2",
"resolved": "http://r.cnpmjs.org/script-loader/download/script-loader-0.7.2.tgz",
"resolved": "https://registry.npm.taobao.org/script-loader/download/script-loader-0.7.2.tgz",
"integrity": "sha1-IBbbb4byX1z1baOJFdgzeLsWa6c=",
"dev": true,
"requires": {
......@@ -20641,7 +20638,7 @@
},
"ssf": {
"version": "0.10.3",
"resolved": "http://r.cnpmjs.org/ssf/download/ssf-0.10.3.tgz",
"resolved": "https://registry.npm.taobao.org/ssf/download/ssf-0.10.3.tgz",
"integrity": "sha1-jq4fwpyQpVLnkhII+BiS1vd6yys=",
"requires": {
"frac": "~1.1.2"
......@@ -23297,7 +23294,7 @@
},
"wmf": {
"version": "1.0.2",
"resolved": "http://r.cnpmjs.org/wmf/download/wmf-1.0.2.tgz",
"resolved": "https://registry.npm.taobao.org/wmf/download/wmf-1.0.2.tgz",
"integrity": "sha1-fRnWIQcaCMK9xrfmiKnENSmMwto="
},
"word-wrap": {
......@@ -23453,7 +23450,7 @@
},
"xlsx": {
"version": "0.15.6",
"resolved": "http://r.cnpmjs.org/xlsx/download/xlsx-0.15.6.tgz",
"resolved": "https://registry.npm.taobao.org/xlsx/download/xlsx-0.15.6.tgz?cache=0&sync_timestamp=1597272342311&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fxlsx%2Fdownload%2Fxlsx-0.15.6.tgz",
"integrity": "sha1-Rh+EHW2eoag3XizSRr8jrs4IodU=",
"requires": {
"adler-32": "~1.2.0",
......@@ -23468,7 +23465,7 @@
"dependencies": {
"commander": {
"version": "2.17.1",
"resolved": "http://r.cnpmjs.org/commander/download/commander-2.17.1.tgz",
"resolved": "https://registry.npm.taobao.org/commander/download/commander-2.17.1.tgz?cache=0&sync_timestamp=1595168224685&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcommander%2Fdownload%2Fcommander-2.17.1.tgz",
"integrity": "sha1-vXerfebelCBc6sxy8XFtKfIKd78="
}
}
......@@ -23637,9 +23634,9 @@
}
},
"zrender": {
"version": "4.3.0",
"resolved": "http://r.cnpmjs.org/zrender/download/zrender-4.3.0.tgz",
"integrity": "sha1-nwVhIbILuuREFNKHv2oRn/cEJmE="
"version": "4.3.1",
"resolved": "https://registry.npm.taobao.org/zrender/download/zrender-4.3.1.tgz?cache=0&sync_timestamp=1597683748542&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fzrender%2Fdownload%2Fzrender-4.3.1.tgz",
"integrity": "sha1-uviqbcgYei+BlpLX1fm+36K5D6M="
}
}
}
......@@ -19,8 +19,9 @@
"better-scroll": "^1.12.1",
"cross-env": "^5.2.0",
"dayjs": "^1.8.27",
"echarts": "^4.7.0",
"echarts": "^4.8.0",
"echarts-liquidfill": "^2.0.5",
"file-saver": "^2.0.2",
"gantt-elastic": "^1.0.11",
"gantt-elastic-header": "^0.1.11",
"gojs": "^2.1.19",
......@@ -55,7 +56,7 @@
"vue2-editor": "^2.10.2",
"vuedraggable": "^2.23.0",
"vuex-along": "^1.2.10",
"xlsx": "^0.15.1"
"xlsx": "^0.15.6"
},
"devDependencies": {
"@babel/plugin-transform-runtime": "^7.2.0",
......@@ -72,9 +73,9 @@
"less": "^2.7.3",
"less-loader": "^4.1.0",
"lint-staged": "^7.2.0",
"script-loader": "^0.7.2",
"svg-sprite-loader": "^3.8.0",
"text-loader": "0.0.1",
"vue-template-compiler": "^2.6.11",
"script-loader": "^0.7.2"
"vue-template-compiler": "^2.6.11"
}
}
......@@ -32,7 +32,7 @@ export default {
return Api.get(`${PlanUrl}/messchedule/getpoolordercount`);
},
listbyuser(params) {//获取当前登录用户可操作的排产
return Api.post(`${Platform}/setschedulecompany/listbyuser`, params);
return Api.post(`${Platform}/setschedulecompany/listbyuser`, params);//61
},
moveintoai(){////跳转进入智能排产池前判断
return Api.post(`${PlanUrl}/messchedule/moveintoai`);
......
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12">
<FormItem :label="l('name')" prop="name">
<Input v-model="entity.name"></Input>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('file')" prop="file">
<InputExcel v-model="imgName" :parms="parms" :showButton="false" />
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('remark')" prop="remark">
<Input v-model="entity.remark" type="textarea" :rows="5"></Input>
</FormItem>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from "./api";
import InputExcel from "@/components/page/inputExcel.vue";
export default {
name: "Add",
components: {
InputExcel
},
data() {
return {
disabled: false,
parms: "app=import&eid="+this.$u.guid()+"&name=excel",
imgName: "",
entity: {
name: "",
file: "",
filePath:"",
remark: "",
},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }],
file:[{ required: true, message: "请上传文件", trigger: "change" }]
},
};
},
props: {
v: Object,
eid: Number,
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true;
Api.create(this.entity)
.then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result;
this.entity.id = 0;
});
},
getEid() {
this.parms.eid = this.$u.guid()
this.parms.app = 'import'
this.$refs.refFile.intFiles()
},
l(key) {
key = "import_center" + "." + key;
return this.$t(key);
},
},
watch: {
imgName(newName, oldName) {
const imgPathsArr = JSON.parse(newName);
this.entity.file=imgPathsArr[0].fileName
this.entity.filePath=imgPathsArr[0].filePath
},
v() {
this.entity = this.$u.clone(this.v);
},
eid(v) {
if (v > 0) {
this.load(v);
}
},
},
};
</script>
import Api from '@/plugins/request'
export default {
index: `${systemUrl}/importcenter/paged`,
paged(params) {
return Api.post(`${systemUrl}/importcenter/paged`, params);
},
get(params) {
return Api.get(`${systemUrl}/importcenter/get`, params);
},
create(params) {
return Api.post(`${systemUrl}/importcenter/create`, params);
},
update(params) {
return Api.post(`${systemUrl}/importcenter/update`, params);
},
delete(id) {
return Api.delete(`${systemUrl}/importcenter/delete`, {
params: {
id: id
}
});
},
deletes(params) {
return Api.post(`${systemUrl}/importcenter/batchdelete`, params);
}
}
<template>
<div class="detail">
<Row>
<Filed :span="12" :name="l('name')">{{entity.name}}</Filed>
<Filed :span="12" :name="l('file')"><a @click="downFile(entity.filePath)">{{entity.file}}</a></Filed>
<Filed :span="12" :name="l('status')">{{entity.status}}</Filed>
<Filed :span="24" :name="l('remark')">{{entity.remark}}</Filed>
<Filed :span="12" :name="l('creationTime')">{{entity.creationTime}}</Filed>
<Filed :span="12" :name="l('creatorUserId')">{{entity.creatorUserId}}</Filed>
<Filed :span="12" :name="l('lastModificationTime')">{{entity.lastModificationTime}}</Filed>
<Filed :span="12" :name="l('lastModifierUserId')">{{entity.lastModifierUserId}}</Filed>
<Filed :span="12" :name="l('isDeleted')">{{entity.isDeleted}}</Filed>
<Filed :span="12" :name="l('deletionTime')">{{entity.deletionTime}}</Filed>
<Filed :span="12" :name="l('deleterUserId')">{{entity.deleterUserId}}</Filed>
<Filed :span="12" :name="l('creator')">{{entity.creator}}</Filed>
<Filed :span="12" :name="l('lastModifier')">{{entity.lastModifier}}</Filed>
</Row>
</div>
</template>
<script>
import Api from "./api";
export default {
name: "Add",
data() {
return {
entity: {},
downUrl: fileUrlDown,
fileUrlPath: "",
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }],
code: [{ required: true, message: "必填", trigger: "blur" }],
},
};
},
props: {
eid: Number,
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result;
this.$emit("on-load");
});
},
handleClose() {
this.$emit("on-close");
},
downFile(path) {
alert(path)
let truePath = path.trim();
if (truePath.length > 2) {
if (
truePath.substring(0, 7).toLowerCase() == "http://" ||
truePath.substring(0, 8).toLowerCase() == "https://"
) {
window.open(truePath, "_blank");
} else {
this.fileUrlPath = this.downUrl + path;
window.open(this.fileUrlPath, "_blank");
}
}
},
l(key) {
key = "import_center" + "." + key;
return this.$t(key);
},
},
watch: {
eid(v) {
if (v > 0) {
this.load(v);
}
},
},
};
</script>
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12">
<FormItem :label="l('creationTime')" prop="creationTime">
<DatePicker type="date" v-model="entity.creationTime"></DatePicker>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('creatorUserId')" prop="creatorUserId">
<InputNumber v-model="entity.creatorUserId"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('lastModificationTime')" prop="lastModificationTime">
<DatePicker type="date" v-model="entity.lastModificationTime"></DatePicker>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('lastModifierUserId')" prop="lastModifierUserId">
<InputNumber v-model="entity.lastModifierUserId"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('isDeleted')" prop="isDeleted">
<InputNumber v-model="entity.isDeleted"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('deletionTime')" prop="deletionTime">
<DatePicker type="date" v-model="entity.deletionTime"></DatePicker>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('deleterUserId')" prop="deleterUserId">
<InputNumber v-model="entity.deleterUserId"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('creator')" prop="creator">
<Input v-model="entity.creator"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('lastModifier')" prop="lastModifier">
<Input v-model="entity.lastModifier"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('name')" prop="name">
<Input v-model="entity.name"></Input>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('file')" prop="file">
<Input v-model="entity.file" type="textarea" :rows="5"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('status')" prop="status">
<Dictionary code="mes.import_center.Status" v-model="entity.status"></Dictionary>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('remark')" prop="remark">
<Input v-model="entity.remark" type="textarea" :rows="5"></Input>
</FormItem>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from "./api";
export default {
name: "Edit",
data() {
return {
disabled: false,
entity: {},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }],
},
};
},
props: {
eid: Number,
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result;
});
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true;
Api.update(this.entity)
.then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "import_center" + "." + key;
return this.$t(key);
},
},
watch: {
eid(v) {
if (v != 0) {
this.load(v);
}
},
},
};
</script>
<template>
<div>
<DataGrid :columns="columns" ref="grid" :action="action">
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input placeholder="请输入名称查询" v-model="easySearch.keys.value" />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
<template slot="searchForm">
<Search />
</template>
<template slot="buttons">
<Button type="primary" @click="add">新增</Button>
</template>
</DataGrid>
<Modal v-model="modal" :title="title" width="1200" :fullscreen="full" footer-hide>
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" />
</Modal>
</div>
</template>
<script>
import Api from "./api";
import Search from "./search";
export default {
name: "list",
components: {
Search,
},
head: {
title: "导入中心记录",
author: "henq",
description: "import_center 8/20/2020 3:45:58 PM",
},
data() {
return {
action: Api.index,
easySearch: {
keys: { op: "name", value: null },
},
modal: false,
full:false,
title: "新增",
detail: null,
curId: 0,
columns: [
{
key: "id",
title: this.$t("id"),
hide: true,
align: "left",
high: true,
},
{
key: "name",
title: this.l("name"),
align: "left",
easy: true,
high: true,
},
{
key: "file",
title: this.l("file"),
align: "left",
easy: true,
high: true,
},
{
key: "creationTime",
title: this.l("creationTime"),
align: "center",
width:"180",
high: true,
},
{
key: "creatorUserId",
title: this.l("creatorUserId"),
align: "left",
high: true,
type:"user",
width:"180",
},
{
key: "lastModificationTime",
title: this.l("lastModificationTime"),
align: "left",
high: true,
hide: true,
},
{
key: "lastModifierUserId",
title: this.l("lastModifierUserId"),
align: "left",
high: true,
hide: true,
},
{
key: "isDeleted",
title: this.l("isDeleted"),
align: "left",
high: true,
hide: true,
},
{
key: "deletionTime",
title: this.l("deletionTime"),
align: "left",
high: true,
hide: true,
},
{
key: "deleterUserId",
title: this.l("deleterUserId"),
align: "left",
high: true,
hide: true,
},
{ key: "creator", title: this.l("creator"), align: "left", high: true,hide: true, },
{
key: "lastModifier",
title: this.l("lastModifier"),
align: "left",
high: true,
hide: true,
},
{
key: "status",
title: this.l("status"),
align: "center",
high: true,
code: "mes.import_center.Status",
width:"150",
},
{
title: "操作",
key: "action",
width: 140,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{
attrs: { oprate: "detail" },
on: { click: () => this.view(params.row.id) },
},
"查看"
),
h(
"op",
{
attrs: { oprate: "delete" },
on: { click: () => this.remove(params.row.id) },
},
"删除"
),
h(
"op",
{
attrs: { oprate: "edit" },
on: { click: () => this.process(params.row.id) },
},
"处理"
),
]);
},
},
],
};
},
mounted() {
console.log(this);
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
add() {
this.curId = 0;
this.full=false;
this.title = "新增";
this.detail = () => import("./add");
this.modal = true;
},
copy(id) {
this.curId = id;
this.title = "克隆";
this.detail = () => import("./add");
this.modal = true;
},
view(id) {
this.curId = id;
this.title = "详情";
this.full=false;
this.detail = () => import("./detail");
this.modal = true;
},
edit(id) {
this.curId = id;
this.title = "编辑";
this.full=false;
this.detail = () => import("./edit");
this.modal = true;
},
process(id) {
this.curId = id;
this.title = "处理";
this.full=true;
this.detail = () => import("./process");
this.modal = true;
},
remove(id) {
Api.delete(id).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success("删除成功");
}
});
},
cancel() {
this.curId = 0;
this.modal = false;
},
l(key) {
let vkey = "import_center" + "." + key;
return this.$t(vkey) || key;
},
},
};
</script>
<style lang="less">
</style>
\ No newline at end of file
This diff is collapsed.
<template>
<Form ref="form" :model="condition" :label-width="90">
<Row>
<Col :span="12" :v-if="condition.id.show">
<FormItem :label="$t('id')" prop="id">
<Input v-model="condition.id.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.creationTime.show">
<FormItem :label="l('creationTime')" prop="creationTime">
<DatePicker type="daterange" v-model="condition.creationTime.value"></DatePicker>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.creatorUserId.show">
<FormItem :label="l('creatorUserId')" prop="creatorUserId">
<Input v-model="condition.creatorUserId.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.lastModificationTime.show">
<FormItem :label="l('lastModificationTime')" prop="lastModificationTime">
<DatePicker type="daterange" v-model="condition.lastModificationTime.value"></DatePicker>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.lastModifierUserId.show">
<FormItem :label="l('lastModifierUserId')" prop="lastModifierUserId">
<Input v-model="condition.lastModifierUserId.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.deletionTime.show">
<FormItem :label="l('deletionTime')" prop="deletionTime">
<DatePicker type="daterange" v-model="condition.deletionTime.value"></DatePicker>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.creator.show">
<FormItem :label="l('creator')" prop="creator">
<Input v-model="condition.creator.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.lastModifier.show">
<FormItem :label="l('lastModifier')" prop="lastModifier">
<Input v-model="condition.lastModifier.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.name.show">
<FormItem :label="l('name')" prop="name">
<Input v-model="condition.name.value"></Input>
</FormItem>
</Col>
<Col :span="24" :v-if="condition.file.show">
<FormItem :label="l('file')" prop="file">
<Input v-model="condition.file.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.status.show">
<FormItem :label="l('status')" prop="status">
<Dictionary code="mes.import_center.Status" v-model="condition.status.value"></Dictionary>
</FormItem>
</Col>
<Col :span="24" :v-if="condition.remark.show">
<FormItem :label="l('remark')" prop="remark">
<Input v-model="condition.remark.value"></Input>
</FormItem>
</Col>
</Row>
</Form>
</template>
<script>
import Api from "./api";
export default {
name: "Add",
data() {
return {
condition: {
id: { op: "Equal", value: null, show: true },
creationTime: { op: "Range", value: null, show: true },
creatorUserId: { op: "Equal", value: null, show: true },
lastModificationTime: { op: "Range", value: null, show: true },
lastModifierUserId: { op: "Equal", value: null, show: true },
deletionTime: { op: "Range", value: null, show: true },
creator: { op: "Equal", value: null, show: true },
lastModifier: { op: "Equal", value: null, show: true },
name: { op: "Equal", value: null, show: true },
file: { op: "Equal", value: null, show: true },
status: { op: "Equal", value: null, show: true },
remark: { op: "Equal", value: null, show: true },
},
};
},
methods: {
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "import_center" + "." + key;
return this.$t(key);
},
},
};
</script>
......@@ -2,6 +2,7 @@ import Vue from 'vue'
import ViewUI from 'view-design'
import VueI18n from 'vue-i18n';
import Languages from '@/i18n/locale';
import XLSX from 'xlsx'
// 插件
import util from '@/libs/util';
import { includeArray } from '@/libs/system';
......@@ -86,6 +87,7 @@ Viewer.setDefaults({
// 内置组件
import iLink from '@/components/link';
Vue.component("iLink", iLink)
Vue.use(XLSX)
Vue.prototype.$echarts = echarts
Vue.component("Tools", Tools)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment