初始版本
This commit is contained in:
1
statics/js/common/areasData.php
Executable file
1
statics/js/common/areasData.php
Executable file
File diff suppressed because one or more lines are too long
6
statics/js/common/grid.js
Executable file
6
statics/js/common/grid.js
Executable file
File diff suppressed because one or more lines are too long
9791
statics/js/common/libs/jquery/jquery-1.10.2.min.js
vendored
Executable file
9791
statics/js/common/libs/jquery/jquery-1.10.2.min.js
vendored
Executable file
File diff suppressed because it is too large
Load Diff
486
statics/js/common/libs/json2.js
Executable file
486
statics/js/common/libs/json2.js
Executable file
@@ -0,0 +1,486 @@
|
||||
/*
|
||||
json2.js
|
||||
2013-05-26
|
||||
|
||||
Public Domain.
|
||||
|
||||
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
||||
|
||||
See http://www.JSON.org/js.html
|
||||
|
||||
|
||||
This code should be minified before deployment.
|
||||
See http://javascript.crockford.com/jsmin.html
|
||||
|
||||
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
|
||||
NOT CONTROL.
|
||||
|
||||
|
||||
This file creates a global JSON object containing two methods: stringify
|
||||
and parse.
|
||||
|
||||
JSON.stringify(value, replacer, space)
|
||||
value any JavaScript value, usually an object or array.
|
||||
|
||||
replacer an optional parameter that determines how object
|
||||
values are stringified for objects. It can be a
|
||||
function or an array of strings.
|
||||
|
||||
space an optional parameter that specifies the indentation
|
||||
of nested structures. If it is omitted, the text will
|
||||
be packed without extra whitespace. If it is a number,
|
||||
it will specify the number of spaces to indent at each
|
||||
level. If it is a string (such as '\t' or ' '),
|
||||
it contains the characters used to indent at each level.
|
||||
|
||||
This method produces a JSON text from a JavaScript value.
|
||||
|
||||
When an object value is found, if the object contains a toJSON
|
||||
method, its toJSON method will be called and the result will be
|
||||
stringified. A toJSON method does not serialize: it returns the
|
||||
value represented by the name/value pair that should be serialized,
|
||||
or undefined if nothing should be serialized. The toJSON method
|
||||
will be passed the key associated with the value, and this will be
|
||||
bound to the value
|
||||
|
||||
For example, this would serialize Dates as ISO strings.
|
||||
|
||||
Date.prototype.toJSON = function (key) {
|
||||
function f(n) {
|
||||
// Format integers to have at least two digits.
|
||||
return n < 10 ? '0' + n : n;
|
||||
}
|
||||
|
||||
return this.getUTCFullYear() + '-' +
|
||||
f(this.getUTCMonth() + 1) + '-' +
|
||||
f(this.getUTCDate()) + 'T' +
|
||||
f(this.getUTCHours()) + ':' +
|
||||
f(this.getUTCMinutes()) + ':' +
|
||||
f(this.getUTCSeconds()) + 'Z';
|
||||
};
|
||||
|
||||
You can provide an optional replacer method. It will be passed the
|
||||
key and value of each member, with this bound to the containing
|
||||
object. The value that is returned from your method will be
|
||||
serialized. If your method returns undefined, then the member will
|
||||
be excluded from the serialization.
|
||||
|
||||
If the replacer parameter is an array of strings, then it will be
|
||||
used to select the members to be serialized. It filters the results
|
||||
such that only members with keys listed in the replacer array are
|
||||
stringified.
|
||||
|
||||
Values that do not have JSON representations, such as undefined or
|
||||
functions, will not be serialized. Such values in objects will be
|
||||
dropped; in arrays they will be replaced with null. You can use
|
||||
a replacer function to replace those with JSON values.
|
||||
JSON.stringify(undefined) returns undefined.
|
||||
|
||||
The optional space parameter produces a stringification of the
|
||||
value that is filled with line breaks and indentation to make it
|
||||
easier to read.
|
||||
|
||||
If the space parameter is a non-empty string, then that string will
|
||||
be used for indentation. If the space parameter is a number, then
|
||||
the indentation will be that many spaces.
|
||||
|
||||
Example:
|
||||
|
||||
text = JSON.stringify(['e', {pluribus: 'unum'}]);
|
||||
// text is '["e",{"pluribus":"unum"}]'
|
||||
|
||||
|
||||
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
|
||||
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
|
||||
|
||||
text = JSON.stringify([new Date()], function (key, value) {
|
||||
return this[key] instanceof Date ?
|
||||
'Date(' + this[key] + ')' : value;
|
||||
});
|
||||
// text is '["Date(---current time---)"]'
|
||||
|
||||
|
||||
JSON.parse(text, reviver)
|
||||
This method parses a JSON text to produce an object or array.
|
||||
It can throw a SyntaxError exception.
|
||||
|
||||
The optional reviver parameter is a function that can filter and
|
||||
transform the results. It receives each of the keys and values,
|
||||
and its return value is used instead of the original value.
|
||||
If it returns what it received, then the structure is not modified.
|
||||
If it returns undefined then the member is deleted.
|
||||
|
||||
Example:
|
||||
|
||||
// Parse the text. Values that look like ISO date strings will
|
||||
// be converted to Date objects.
|
||||
|
||||
myData = JSON.parse(text, function (key, value) {
|
||||
var a;
|
||||
if (typeof value === 'string') {
|
||||
a =
|
||||
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
|
||||
if (a) {
|
||||
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
|
||||
+a[5], +a[6]));
|
||||
}
|
||||
}
|
||||
return value;
|
||||
});
|
||||
|
||||
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
|
||||
var d;
|
||||
if (typeof value === 'string' &&
|
||||
value.slice(0, 5) === 'Date(' &&
|
||||
value.slice(-1) === ')') {
|
||||
d = new Date(value.slice(5, -1));
|
||||
if (d) {
|
||||
return d;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
});
|
||||
|
||||
|
||||
This is a reference implementation. You are free to copy, modify, or
|
||||
redistribute.
|
||||
*/
|
||||
|
||||
/*jslint evil: true, regexp: true */
|
||||
|
||||
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
|
||||
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
|
||||
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
|
||||
lastIndex, length, parse, prototype, push, replace, slice, stringify,
|
||||
test, toJSON, toString, valueOf
|
||||
*/
|
||||
|
||||
|
||||
// Create a JSON object only if one does not already exist. We create the
|
||||
// methods in a closure to avoid creating global variables.
|
||||
|
||||
if (typeof JSON !== 'object') {
|
||||
JSON = {};
|
||||
}
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function f(n) {
|
||||
// Format integers to have at least two digits.
|
||||
return n < 10 ? '0' + n : n;
|
||||
}
|
||||
|
||||
if (typeof Date.prototype.toJSON !== 'function') {
|
||||
|
||||
Date.prototype.toJSON = function () {
|
||||
|
||||
return isFinite(this.valueOf())
|
||||
? this.getUTCFullYear() + '-' +
|
||||
f(this.getUTCMonth() + 1) + '-' +
|
||||
f(this.getUTCDate()) + 'T' +
|
||||
f(this.getUTCHours()) + ':' +
|
||||
f(this.getUTCMinutes()) + ':' +
|
||||
f(this.getUTCSeconds()) + 'Z'
|
||||
: null;
|
||||
};
|
||||
|
||||
String.prototype.toJSON =
|
||||
Number.prototype.toJSON =
|
||||
Boolean.prototype.toJSON = function () {
|
||||
return this.valueOf();
|
||||
};
|
||||
}
|
||||
|
||||
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
gap,
|
||||
indent,
|
||||
meta = { // table of character substitutions
|
||||
'\b': '\\b',
|
||||
'\t': '\\t',
|
||||
'\n': '\\n',
|
||||
'\f': '\\f',
|
||||
'\r': '\\r',
|
||||
'"' : '\\"',
|
||||
'\\': '\\\\'
|
||||
},
|
||||
rep;
|
||||
|
||||
|
||||
function quote(string) {
|
||||
|
||||
// If the string contains no control characters, no quote characters, and no
|
||||
// backslash characters, then we can safely slap some quotes around it.
|
||||
// Otherwise we must also replace the offending characters with safe escape
|
||||
// sequences.
|
||||
|
||||
escapable.lastIndex = 0;
|
||||
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
|
||||
var c = meta[a];
|
||||
return typeof c === 'string'
|
||||
? c
|
||||
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
}) + '"' : '"' + string + '"';
|
||||
}
|
||||
|
||||
|
||||
function str(key, holder) {
|
||||
|
||||
// Produce a string from holder[key].
|
||||
|
||||
var i, // The loop counter.
|
||||
k, // The member key.
|
||||
v, // The member value.
|
||||
length,
|
||||
mind = gap,
|
||||
partial,
|
||||
value = holder[key];
|
||||
|
||||
// If the value has a toJSON method, call it to obtain a replacement value.
|
||||
|
||||
if (value && typeof value === 'object' &&
|
||||
typeof value.toJSON === 'function') {
|
||||
value = value.toJSON(key);
|
||||
}
|
||||
|
||||
// If we were called with a replacer function, then call the replacer to
|
||||
// obtain a replacement value.
|
||||
|
||||
if (typeof rep === 'function') {
|
||||
value = rep.call(holder, key, value);
|
||||
}
|
||||
|
||||
// What happens next depends on the value's type.
|
||||
|
||||
switch (typeof value) {
|
||||
case 'string':
|
||||
return quote(value);
|
||||
|
||||
case 'number':
|
||||
|
||||
// JSON numbers must be finite. Encode non-finite numbers as null.
|
||||
|
||||
return isFinite(value) ? String(value) : 'null';
|
||||
|
||||
case 'boolean':
|
||||
case 'null':
|
||||
|
||||
// If the value is a boolean or null, convert it to a string. Note:
|
||||
// typeof null does not produce 'null'. The case is included here in
|
||||
// the remote chance that this gets fixed someday.
|
||||
|
||||
return String(value);
|
||||
|
||||
// If the type is 'object', we might be dealing with an object or an array or
|
||||
// null.
|
||||
|
||||
case 'object':
|
||||
|
||||
// Due to a specification blunder in ECMAScript, typeof null is 'object',
|
||||
// so watch out for that case.
|
||||
|
||||
if (!value) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
// Make an array to hold the partial results of stringifying this object value.
|
||||
|
||||
gap += indent;
|
||||
partial = [];
|
||||
|
||||
// Is the value an array?
|
||||
|
||||
if (Object.prototype.toString.apply(value) === '[object Array]') {
|
||||
|
||||
// The value is an array. Stringify every element. Use null as a placeholder
|
||||
// for non-JSON values.
|
||||
|
||||
length = value.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
partial[i] = str(i, value) || 'null';
|
||||
}
|
||||
|
||||
// Join all of the elements together, separated with commas, and wrap them in
|
||||
// brackets.
|
||||
|
||||
v = partial.length === 0
|
||||
? '[]'
|
||||
: gap
|
||||
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
|
||||
: '[' + partial.join(',') + ']';
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
|
||||
// If the replacer is an array, use it to select the members to be stringified.
|
||||
|
||||
if (rep && typeof rep === 'object') {
|
||||
length = rep.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
if (typeof rep[i] === 'string') {
|
||||
k = rep[i];
|
||||
v = str(k, value);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// Otherwise, iterate through all of the keys in the object.
|
||||
|
||||
for (k in value) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||
v = str(k, value);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Join all of the member texts together, separated with commas,
|
||||
// and wrap them in braces.
|
||||
|
||||
v = partial.length === 0
|
||||
? '{}'
|
||||
: gap
|
||||
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
|
||||
: '{' + partial.join(',') + '}';
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
// If the JSON object does not yet have a stringify method, give it one.
|
||||
|
||||
if (typeof JSON.stringify !== 'function') {
|
||||
JSON.stringify = function (value, replacer, space) {
|
||||
|
||||
// The stringify method takes a value and an optional replacer, and an optional
|
||||
// space parameter, and returns a JSON text. The replacer can be a function
|
||||
// that can replace values, or an array of strings that will select the keys.
|
||||
// A default replacer method can be provided. Use of the space parameter can
|
||||
// produce text that is more easily readable.
|
||||
|
||||
var i;
|
||||
gap = '';
|
||||
indent = '';
|
||||
|
||||
// If the space parameter is a number, make an indent string containing that
|
||||
// many spaces.
|
||||
|
||||
if (typeof space === 'number') {
|
||||
for (i = 0; i < space; i += 1) {
|
||||
indent += ' ';
|
||||
}
|
||||
|
||||
// If the space parameter is a string, it will be used as the indent string.
|
||||
|
||||
} else if (typeof space === 'string') {
|
||||
indent = space;
|
||||
}
|
||||
|
||||
// If there is a replacer, it must be a function or an array.
|
||||
// Otherwise, throw an error.
|
||||
|
||||
rep = replacer;
|
||||
if (replacer && typeof replacer !== 'function' &&
|
||||
(typeof replacer !== 'object' ||
|
||||
typeof replacer.length !== 'number')) {
|
||||
throw new Error('JSON.stringify');
|
||||
}
|
||||
|
||||
// Make a fake root object containing our value under the key of ''.
|
||||
// Return the result of stringifying the value.
|
||||
|
||||
return str('', {'': value});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// If the JSON object does not yet have a parse method, give it one.
|
||||
|
||||
if (typeof JSON.parse !== 'function') {
|
||||
JSON.parse = function (text, reviver) {
|
||||
|
||||
// The parse method takes a text and an optional reviver function, and returns
|
||||
// a JavaScript value if the text is a valid JSON text.
|
||||
|
||||
var j;
|
||||
|
||||
function walk(holder, key) {
|
||||
|
||||
// The walk method is used to recursively walk the resulting structure so
|
||||
// that modifications can be made.
|
||||
|
||||
var k, v, value = holder[key];
|
||||
if (value && typeof value === 'object') {
|
||||
for (k in value) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||
v = walk(value, k);
|
||||
if (v !== undefined) {
|
||||
value[k] = v;
|
||||
} else {
|
||||
delete value[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return reviver.call(holder, key, value);
|
||||
}
|
||||
|
||||
|
||||
// Parsing happens in four stages. In the first stage, we replace certain
|
||||
// Unicode characters with escape sequences. JavaScript handles many characters
|
||||
// incorrectly, either silently deleting them, or treating them as line endings.
|
||||
|
||||
text = String(text);
|
||||
cx.lastIndex = 0;
|
||||
if (cx.test(text)) {
|
||||
text = text.replace(cx, function (a) {
|
||||
return '\\u' +
|
||||
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
});
|
||||
}
|
||||
|
||||
// In the second stage, we run the text against regular expressions that look
|
||||
// for non-JSON patterns. We are especially concerned with '()' and 'new'
|
||||
// because they can cause invocation, and '=' because it can cause mutation.
|
||||
// But just to be safe, we want to reject all unexpected forms.
|
||||
|
||||
// We split the second stage into 4 regexp operations in order to work around
|
||||
// crippling inefficiencies in IE's and Safari's regexp engines. First we
|
||||
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
|
||||
// replace all simple value tokens with ']' characters. Third, we delete all
|
||||
// open brackets that follow a colon or comma or that begin the text. Finally,
|
||||
// we look to see that the remaining characters are only whitespace or ']' or
|
||||
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
|
||||
|
||||
if (/^[\],:{}\s]*$/
|
||||
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
|
||||
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
|
||||
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
||||
|
||||
// In the third stage we use the eval function to compile the text into a
|
||||
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
|
||||
// in JavaScript: it can begin a block or an object literal. We wrap the text
|
||||
// in parens to eliminate the ambiguity.
|
||||
|
||||
j = eval('(' + text + ')');
|
||||
|
||||
// In the optional fourth stage, we recursively walk the new structure, passing
|
||||
// each name/value pair to a reviver function for possible transformation.
|
||||
|
||||
return typeof reviver === 'function'
|
||||
? walk({'': j}, '')
|
||||
: j;
|
||||
}
|
||||
|
||||
// If the text is not JSON parseable, then a SyntaxError is thrown.
|
||||
|
||||
throw new SyntaxError('JSON.parse');
|
||||
};
|
||||
}
|
||||
}());
|
||||
159
statics/js/common/libs/swfupload/fileprogress.js
Executable file
159
statics/js/common/libs/swfupload/fileprogress.js
Executable file
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
[Leo.C, Studio] (C)2004 - 2008
|
||||
|
||||
$Hanization: LeoChung $
|
||||
$E-Mail: who@imll.net $
|
||||
$HomePage: http://imll.net $
|
||||
$Date: 2008/11/8 18:02 $
|
||||
*/
|
||||
/*
|
||||
A simple class for displaying file information and progress
|
||||
Note: This is a demonstration only and not part of SWFUpload.
|
||||
Note: Some have had problems adapting this class in IE7. It may not be suitable for your application.
|
||||
*/
|
||||
|
||||
// Constructor
|
||||
// file is a SWFUpload file object
|
||||
// targetID is the HTML element id attribute that the FileProgress HTML structure will be added to.
|
||||
// Instantiating a new FileProgress object with an existing file will reuse/update the existing DOM elements
|
||||
function FileProgress(file, targetID) {
|
||||
this.fileProgressID = file.id;
|
||||
|
||||
this.opacity = 100;
|
||||
this.height = 0;
|
||||
|
||||
this.fileProgressWrapper = document.getElementById(this.fileProgressID);
|
||||
if (!this.fileProgressWrapper) {
|
||||
this.fileProgressWrapper = document.createElement("div");
|
||||
this.fileProgressWrapper.className = "progressWrapper";
|
||||
this.fileProgressWrapper.id = this.fileProgressID;
|
||||
|
||||
this.fileProgressElement = document.createElement("div");
|
||||
this.fileProgressElement.className = "progressContainer";
|
||||
|
||||
var progressCancel = document.createElement("a");
|
||||
progressCancel.className = "progressCancel";
|
||||
progressCancel.href = "#";
|
||||
progressCancel.style.visibility = "hidden";
|
||||
progressCancel.appendChild(document.createTextNode(" "));
|
||||
|
||||
var progressText = document.createElement("div");
|
||||
progressText.className = "progressName";
|
||||
progressText.appendChild(document.createTextNode(file.name));
|
||||
|
||||
var progressBar = document.createElement("div");
|
||||
progressBar.className = "progressBarInProgress";
|
||||
|
||||
var progressStatus = document.createElement("div");
|
||||
progressStatus.className = "progressBarStatus";
|
||||
progressStatus.innerHTML = " ";
|
||||
|
||||
this.fileProgressElement.appendChild(progressCancel);
|
||||
this.fileProgressElement.appendChild(progressText);
|
||||
this.fileProgressElement.appendChild(progressStatus);
|
||||
this.fileProgressElement.appendChild(progressBar);
|
||||
|
||||
this.fileProgressWrapper.appendChild(this.fileProgressElement);
|
||||
|
||||
document.getElementById(targetID).appendChild(this.fileProgressWrapper);
|
||||
} else {
|
||||
this.fileProgressElement = this.fileProgressWrapper.firstChild;
|
||||
}
|
||||
|
||||
this.height = this.fileProgressWrapper.offsetHeight;
|
||||
|
||||
}
|
||||
FileProgress.prototype.setProgress = function (percentage) {
|
||||
this.fileProgressElement.className = "progressContainer green";
|
||||
this.fileProgressElement.childNodes[3].className = "progressBarInProgress";
|
||||
this.fileProgressElement.childNodes[3].style.width = percentage + "%";
|
||||
};
|
||||
FileProgress.prototype.setComplete = function () {
|
||||
this.fileProgressElement.className = "progressContainer blue";
|
||||
this.fileProgressElement.childNodes[3].className = "progressBarComplete";
|
||||
this.fileProgressElement.childNodes[3].style.width = "";
|
||||
|
||||
var oSelf = this;
|
||||
setTimeout(function () {
|
||||
oSelf.disappear();
|
||||
}, 10000);
|
||||
};
|
||||
FileProgress.prototype.setError = function () {
|
||||
this.fileProgressElement.className = "progressContainer red";
|
||||
this.fileProgressElement.childNodes[3].className = "progressBarError";
|
||||
this.fileProgressElement.childNodes[3].style.width = "";
|
||||
|
||||
var oSelf = this;
|
||||
setTimeout(function () {
|
||||
oSelf.disappear();
|
||||
}, 5000);
|
||||
};
|
||||
FileProgress.prototype.setCancelled = function () {
|
||||
this.fileProgressElement.className = "progressContainer";
|
||||
this.fileProgressElement.childNodes[3].className = "progressBarError";
|
||||
this.fileProgressElement.childNodes[3].style.width = "";
|
||||
|
||||
var oSelf = this;
|
||||
setTimeout(function () {
|
||||
oSelf.disappear();
|
||||
}, 2000);
|
||||
};
|
||||
FileProgress.prototype.setStatus = function (status) {
|
||||
this.fileProgressElement.childNodes[2].innerHTML = status;
|
||||
};
|
||||
|
||||
// Show/Hide the cancel button
|
||||
FileProgress.prototype.toggleCancel = function (show, swfUploadInstance) {
|
||||
this.fileProgressElement.childNodes[0].style.visibility = show ? "visible" : "hidden";
|
||||
if (swfUploadInstance) {
|
||||
var fileID = this.fileProgressID;
|
||||
this.fileProgressElement.childNodes[0].onclick = function () {
|
||||
swfUploadInstance.cancelUpload(fileID);
|
||||
return false;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// Fades out and clips away the FileProgress box.
|
||||
FileProgress.prototype.disappear = function () {
|
||||
|
||||
var reduceOpacityBy = 15;
|
||||
var reduceHeightBy = 4;
|
||||
var rate = 30; // 15 fps
|
||||
|
||||
if (this.opacity > 0) {
|
||||
this.opacity -= reduceOpacityBy;
|
||||
if (this.opacity < 0) {
|
||||
this.opacity = 0;
|
||||
}
|
||||
|
||||
if (this.fileProgressWrapper.filters) {
|
||||
try {
|
||||
this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity = this.opacity;
|
||||
} catch (e) {
|
||||
// If it is not set initially, the browser will throw an error. This will set it if it is not set yet.
|
||||
this.fileProgressWrapper.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + this.opacity + ")";
|
||||
}
|
||||
} else {
|
||||
this.fileProgressWrapper.style.opacity = this.opacity / 100;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.height > 0) {
|
||||
this.height -= reduceHeightBy;
|
||||
if (this.height < 0) {
|
||||
this.height = 0;
|
||||
}
|
||||
|
||||
this.fileProgressWrapper.style.height = this.height + "px";
|
||||
}
|
||||
|
||||
if (this.height > 0 || this.opacity > 0) {
|
||||
var oSelf = this;
|
||||
setTimeout(function () {
|
||||
oSelf.disappear();
|
||||
}, rate);
|
||||
} else {
|
||||
this.fileProgressWrapper.style.display = "none";
|
||||
}
|
||||
};
|
||||
185
statics/js/common/libs/swfupload/handlers.js
Executable file
185
statics/js/common/libs/swfupload/handlers.js
Executable file
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
[Leo.C, Studio] (C)2004 - 2008
|
||||
|
||||
$Hanization: LeoChung $
|
||||
$E-Mail: who@imll.net $
|
||||
$HomePage: http://imll.net $
|
||||
$Date: 2008/11/8 18:02 $
|
||||
*/
|
||||
/* Demo Note: This demo uses a FileProgress class that handles the UI for displaying the file name and percent complete.
|
||||
The FileProgress class is not part of SWFUpload.
|
||||
*/
|
||||
|
||||
|
||||
/* **********************
|
||||
Event Handlers
|
||||
These are my custom event handlers to make my
|
||||
web application behave the way I went when SWFUpload
|
||||
completes different tasks. These aren't part of the SWFUpload
|
||||
package. They are part of my application. Without these none
|
||||
of the actions SWFUpload makes will show up in my application.
|
||||
********************** */
|
||||
function fileQueued(file) {
|
||||
try {
|
||||
var progress = new FileProgress(file, this.customSettings.progressTarget);
|
||||
progress.setStatus("正在等待...");
|
||||
progress.toggleCancel(true, this);
|
||||
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function fileQueueError(file, errorCode, message) {
|
||||
try {
|
||||
if (errorCode === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
|
||||
alert("您正在上传的文件队列过多.\n" + (message === 0 ? "您已达到上传限制" : "您最多能选择 " + (message > 1 ? "上传 " + message + " 文件." : "一个文件.")));
|
||||
return;
|
||||
}
|
||||
|
||||
var progress = new FileProgress(file, this.customSettings.progressTarget);
|
||||
progress.setError();
|
||||
progress.toggleCancel(false);
|
||||
|
||||
switch (errorCode) {
|
||||
case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
|
||||
progress.setStatus("文件尺寸过大.");
|
||||
this.debug("错误代码: 文件尺寸过大, 文件名: " + file.name + ", 文件尺寸: " + file.size + ", 信息: " + message);
|
||||
break;
|
||||
case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
|
||||
progress.setStatus("无法上传零字节文件.");
|
||||
this.debug("错误代码: 零字节文件, 文件名: " + file.name + ", 文件尺寸: " + file.size + ", 信息: " + message);
|
||||
break;
|
||||
case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
|
||||
progress.setStatus("不支持的文件类型.");
|
||||
this.debug("错误代码: 不支持的文件类型, 文件名: " + file.name + ", 文件尺寸: " + file.size + ", 信息: " + message);
|
||||
break;
|
||||
default:
|
||||
if (file !== null) {
|
||||
progress.setStatus("未处理的错误");
|
||||
}
|
||||
this.debug("错误代码: " + errorCode + ", 文件名: " + file.name + ", 文件尺寸: " + file.size + ", 信息: " + message);
|
||||
break;
|
||||
}
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
}
|
||||
}
|
||||
|
||||
function fileDialogComplete(numFilesSelected, numFilesQueued) {
|
||||
try {
|
||||
if (numFilesSelected > 0) {
|
||||
document.getElementById(this.customSettings.cancelButtonId).disabled = false;
|
||||
}
|
||||
|
||||
/* I want auto start the upload and I can do that here */
|
||||
this.startUpload();
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
}
|
||||
}
|
||||
|
||||
function uploadStart(file) {
|
||||
try {
|
||||
/* I don't want to do any file validation or anything, I'll just update the UI and
|
||||
return true to indicate that the upload should start.
|
||||
It's important to update the UI here because in Linux no uploadProgress events are called. The best
|
||||
we can do is say we are uploading.
|
||||
*/
|
||||
var progress = new FileProgress(file, this.customSettings.progressTarget);
|
||||
progress.setStatus("正在上传...");
|
||||
progress.toggleCancel(true, this);
|
||||
}
|
||||
catch (ex) {}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function uploadProgress(file, bytesLoaded, bytesTotal) {
|
||||
try {
|
||||
var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);
|
||||
|
||||
var progress = new FileProgress(file, this.customSettings.progressTarget);
|
||||
progress.setProgress(percent);
|
||||
progress.setStatus("正在上传...");
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
}
|
||||
}
|
||||
|
||||
function uploadSuccess(file, serverData) {
|
||||
try {
|
||||
var progress = new FileProgress(file, this.customSettings.progressTarget);
|
||||
progress.setComplete();
|
||||
progress.setStatus("上传成功");
|
||||
progress.toggleCancel(false);
|
||||
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
}
|
||||
}
|
||||
|
||||
function uploadError(file, errorCode, message) {
|
||||
try {
|
||||
var progress = new FileProgress(file, this.customSettings.progressTarget);
|
||||
progress.setError();
|
||||
progress.toggleCancel(false);
|
||||
|
||||
switch (errorCode) {
|
||||
case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
|
||||
progress.setStatus("上传错误: " + message);
|
||||
this.debug("错误代码: HTTP错误, 文件名: " + file.name + ", 信息: " + message);
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
|
||||
progress.setStatus("上传失败");
|
||||
this.debug("错误代码: 上传失败, 文件名: " + file.name + ", 文件尺寸: " + file.size + ", 信息: " + message);
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.IO_ERROR:
|
||||
progress.setStatus("服务器 (IO) 错误");
|
||||
this.debug("错误代码: IO 错误, 文件名: " + file.name + ", 信息: " + message);
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
|
||||
progress.setStatus("安全错误");
|
||||
this.debug("错误代码: 安全错误, 文件名: " + file.name + ", 信息: " + message);
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
|
||||
progress.setStatus("超出上传限制.");
|
||||
this.debug("错误代码: 超出上传限制, 文件名: " + file.name + ", 文件尺寸: " + file.size + ", 信息: " + message);
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
|
||||
progress.setStatus("无法验证. 跳过上传.");
|
||||
this.debug("错误代码: 文件验证失败, 文件名: " + file.name + ", 文件尺寸: " + file.size + ", 信息: " + message);
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
|
||||
// If there aren't any files left (they were all cancelled) disable the cancel button
|
||||
if (this.getStats().files_queued === 0) {
|
||||
document.getElementById(this.customSettings.cancelButtonId).disabled = true;
|
||||
}
|
||||
progress.setStatus("取消");
|
||||
progress.setCancelled();
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
|
||||
progress.setStatus("停止");
|
||||
break;
|
||||
default:
|
||||
progress.setStatus("未处理的错误: " + errorCode);
|
||||
this.debug("错误代码: " + errorCode + ", 文件名: " + file.name + ", 文件尺寸: " + file.size + ", 信息: " + message);
|
||||
break;
|
||||
}
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
}
|
||||
}
|
||||
|
||||
function uploadComplete(file) {
|
||||
if (this.getStats().files_queued === 0) {
|
||||
document.getElementById(this.customSettings.cancelButtonId).disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
// This event comes from the Queue Plugin
|
||||
function queueComplete(numFilesUploaded) {
|
||||
var status = document.getElementById("divStatus");
|
||||
status.innerHTML = numFilesUploaded + " 个文件" + (numFilesUploaded === 1 ? "" : "s") + "已上传.";
|
||||
}
|
||||
BIN
statics/js/common/libs/swfupload/import-btn.png
Executable file
BIN
statics/js/common/libs/swfupload/import-btn.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
980
statics/js/common/libs/swfupload/swfupload.js
Executable file
980
statics/js/common/libs/swfupload/swfupload.js
Executable file
@@ -0,0 +1,980 @@
|
||||
/**
|
||||
* SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com
|
||||
*
|
||||
* mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/
|
||||
*
|
||||
* SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilz<6C>n and Mammon Media and is released under the MIT License:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* ******************* */
|
||||
/* Constructor & Init */
|
||||
/* ******************* */
|
||||
var SWFUpload;
|
||||
|
||||
if (SWFUpload == undefined) {
|
||||
SWFUpload = function (settings) {
|
||||
this.initSWFUpload(settings);
|
||||
};
|
||||
}
|
||||
|
||||
SWFUpload.prototype.initSWFUpload = function (settings) {
|
||||
try {
|
||||
this.customSettings = {}; // A container where developers can place their own settings associated with this instance.
|
||||
this.settings = settings;
|
||||
this.eventQueue = [];
|
||||
this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
|
||||
this.movieElement = null;
|
||||
|
||||
|
||||
// Setup global control tracking
|
||||
SWFUpload.instances[this.movieName] = this;
|
||||
|
||||
// Load the settings. Load the Flash movie.
|
||||
this.initSettings();
|
||||
this.loadFlash();
|
||||
this.displayDebugInfo();
|
||||
} catch (ex) {
|
||||
delete SWFUpload.instances[this.movieName];
|
||||
throw ex;
|
||||
}
|
||||
};
|
||||
|
||||
/* *************** */
|
||||
/* Static Members */
|
||||
/* *************** */
|
||||
SWFUpload.instances = {};
|
||||
SWFUpload.movieCount = 0;
|
||||
SWFUpload.version = "2.2.0 2009-03-25";
|
||||
SWFUpload.QUEUE_ERROR = {
|
||||
QUEUE_LIMIT_EXCEEDED : -100,
|
||||
FILE_EXCEEDS_SIZE_LIMIT : -110,
|
||||
ZERO_BYTE_FILE : -120,
|
||||
INVALID_FILETYPE : -130
|
||||
};
|
||||
SWFUpload.UPLOAD_ERROR = {
|
||||
HTTP_ERROR : -200,
|
||||
MISSING_UPLOAD_URL : -210,
|
||||
IO_ERROR : -220,
|
||||
SECURITY_ERROR : -230,
|
||||
UPLOAD_LIMIT_EXCEEDED : -240,
|
||||
UPLOAD_FAILED : -250,
|
||||
SPECIFIED_FILE_ID_NOT_FOUND : -260,
|
||||
FILE_VALIDATION_FAILED : -270,
|
||||
FILE_CANCELLED : -280,
|
||||
UPLOAD_STOPPED : -290
|
||||
};
|
||||
SWFUpload.FILE_STATUS = {
|
||||
QUEUED : -1,
|
||||
IN_PROGRESS : -2,
|
||||
ERROR : -3,
|
||||
COMPLETE : -4,
|
||||
CANCELLED : -5
|
||||
};
|
||||
SWFUpload.BUTTON_ACTION = {
|
||||
SELECT_FILE : -100,
|
||||
SELECT_FILES : -110,
|
||||
START_UPLOAD : -120
|
||||
};
|
||||
SWFUpload.CURSOR = {
|
||||
ARROW : -1,
|
||||
HAND : -2
|
||||
};
|
||||
SWFUpload.WINDOW_MODE = {
|
||||
WINDOW : "window",
|
||||
TRANSPARENT : "transparent",
|
||||
OPAQUE : "opaque"
|
||||
};
|
||||
|
||||
// Private: takes a URL, determines if it is relative and converts to an absolute URL
|
||||
// using the current site. Only processes the URL if it can, otherwise returns the URL untouched
|
||||
SWFUpload.completeURL = function(url) {
|
||||
if (typeof(url) !== "string" || url.match(/^https?:\/\//i) || url.match(/^\//)) {
|
||||
return url;
|
||||
}
|
||||
|
||||
var currentURL = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");
|
||||
|
||||
var indexSlash = window.location.pathname.lastIndexOf("/");
|
||||
if (indexSlash <= 0) {
|
||||
path = "/";
|
||||
} else {
|
||||
path = window.location.pathname.substr(0, indexSlash) + "/";
|
||||
}
|
||||
|
||||
return /*currentURL +*/ path + url;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* ******************** */
|
||||
/* Instance Members */
|
||||
/* ******************** */
|
||||
|
||||
// Private: initSettings ensures that all the
|
||||
// settings are set, getting a default value if one was not assigned.
|
||||
SWFUpload.prototype.initSettings = function () {
|
||||
this.ensureDefault = function (settingName, defaultValue) {
|
||||
this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName];
|
||||
};
|
||||
|
||||
// Upload backend settings
|
||||
this.ensureDefault("upload_url", "");
|
||||
this.ensureDefault("preserve_relative_urls", false);
|
||||
this.ensureDefault("file_post_name", "Filedata");
|
||||
this.ensureDefault("post_params", {});
|
||||
this.ensureDefault("use_query_string", false);
|
||||
this.ensureDefault("requeue_on_error", false);
|
||||
this.ensureDefault("http_success", []);
|
||||
this.ensureDefault("assume_success_timeout", 0);
|
||||
|
||||
// File Settings
|
||||
this.ensureDefault("file_types", "*.*");
|
||||
this.ensureDefault("file_types_description", "All Files");
|
||||
this.ensureDefault("file_size_limit", 0); // Default zero means "unlimited"
|
||||
this.ensureDefault("file_upload_limit", 0);
|
||||
this.ensureDefault("file_queue_limit", 0);
|
||||
|
||||
// Flash Settings
|
||||
this.ensureDefault("flash_url", "swfupload.swf");
|
||||
this.ensureDefault("prevent_swf_caching", true);
|
||||
|
||||
// Button Settings
|
||||
this.ensureDefault("button_image_url", "");
|
||||
this.ensureDefault("button_width", 1);
|
||||
this.ensureDefault("button_height", 1);
|
||||
this.ensureDefault("button_text", "");
|
||||
this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;");
|
||||
this.ensureDefault("button_text_top_padding", 0);
|
||||
this.ensureDefault("button_text_left_padding", 0);
|
||||
this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES);
|
||||
this.ensureDefault("button_disabled", false);
|
||||
this.ensureDefault("button_placeholder_id", "");
|
||||
this.ensureDefault("button_placeholder", null);
|
||||
this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW);
|
||||
this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW);
|
||||
|
||||
// Debug Settings
|
||||
this.ensureDefault("debug", false);
|
||||
this.settings.debug_enabled = this.settings.debug; // Here to maintain v2 API
|
||||
|
||||
// Event Handlers
|
||||
this.settings.return_upload_start_handler = this.returnUploadStart;
|
||||
this.ensureDefault("swfupload_loaded_handler", null);
|
||||
this.ensureDefault("file_dialog_start_handler", null);
|
||||
this.ensureDefault("file_queued_handler", null);
|
||||
this.ensureDefault("file_queue_error_handler", null);
|
||||
this.ensureDefault("file_dialog_complete_handler", null);
|
||||
|
||||
this.ensureDefault("upload_start_handler", null);
|
||||
this.ensureDefault("upload_progress_handler", null);
|
||||
this.ensureDefault("upload_error_handler", null);
|
||||
this.ensureDefault("upload_success_handler", null);
|
||||
this.ensureDefault("upload_complete_handler", null);
|
||||
|
||||
this.ensureDefault("debug_handler", this.debugMessage);
|
||||
|
||||
this.ensureDefault("custom_settings", {});
|
||||
|
||||
// Other settings
|
||||
this.customSettings = this.settings.custom_settings;
|
||||
|
||||
// Update the flash url if needed
|
||||
if (!!this.settings.prevent_swf_caching) {
|
||||
this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime();
|
||||
}
|
||||
|
||||
if (!this.settings.preserve_relative_urls) {
|
||||
//this.settings.flash_url = SWFUpload.completeURL(this.settings.flash_url); // Don't need to do this one since flash doesn't look at it
|
||||
this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url);
|
||||
this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url);
|
||||
}
|
||||
|
||||
delete this.ensureDefault;
|
||||
};
|
||||
|
||||
// Private: loadFlash replaces the button_placeholder element with the flash movie.
|
||||
SWFUpload.prototype.loadFlash = function () {
|
||||
var targetElement, tempParent;
|
||||
|
||||
// Make sure an element with the ID we are going to use doesn't already exist
|
||||
if (document.getElementById(this.movieName) !== null) {
|
||||
throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";
|
||||
}
|
||||
|
||||
// Get the element where we will be placing the flash movie
|
||||
targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder;
|
||||
|
||||
if (targetElement == undefined) {
|
||||
throw "Could not find the placeholder element: " + this.settings.button_placeholder_id;
|
||||
}
|
||||
|
||||
// Append the container and load the flash
|
||||
tempParent = document.createElement("div");
|
||||
tempParent.innerHTML = this.getFlashHTML(); // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
|
||||
targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement);
|
||||
|
||||
// Fix IE Flash/Form bug
|
||||
if (window[this.movieName] == undefined) {
|
||||
window[this.movieName] = this.getMovieElement();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Private: getFlashHTML generates the object tag needed to embed the flash in to the document
|
||||
SWFUpload.prototype.getFlashHTML = function () {
|
||||
// Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay
|
||||
return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">',
|
||||
'<param name="wmode" value="', this.settings.button_window_mode, '" />',
|
||||
'<param name="movie" value="', this.settings.flash_url, '" />',
|
||||
'<param name="quality" value="high" />',
|
||||
'<param name="menu" value="false" />',
|
||||
'<param name="allowScriptAccess" value="always" />',
|
||||
'<param name="flashvars" value="' + this.getFlashVars() + '" />',
|
||||
'</object>'].join("");
|
||||
};
|
||||
|
||||
// Private: getFlashVars builds the parameter string that will be passed
|
||||
// to flash in the flashvars param.
|
||||
SWFUpload.prototype.getFlashVars = function () {
|
||||
// Build a string from the post param object
|
||||
var paramString = this.buildParamString();
|
||||
var httpSuccessString = this.settings.http_success.join(",");
|
||||
|
||||
// Build the parameter string
|
||||
return ["movieName=", encodeURIComponent(this.movieName),
|
||||
"&uploadURL=", encodeURIComponent(this.settings.upload_url),
|
||||
"&useQueryString=", encodeURIComponent(this.settings.use_query_string),
|
||||
"&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error),
|
||||
"&httpSuccess=", encodeURIComponent(httpSuccessString),
|
||||
"&assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout),
|
||||
"&params=", encodeURIComponent(paramString),
|
||||
"&filePostName=", encodeURIComponent(this.settings.file_post_name),
|
||||
"&fileTypes=", encodeURIComponent(this.settings.file_types),
|
||||
"&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description),
|
||||
"&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit),
|
||||
"&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit),
|
||||
"&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit),
|
||||
"&debugEnabled=", encodeURIComponent(this.settings.debug_enabled),
|
||||
"&buttonImageURL=", encodeURIComponent(this.settings.button_image_url),
|
||||
"&buttonWidth=", encodeURIComponent(this.settings.button_width),
|
||||
"&buttonHeight=", encodeURIComponent(this.settings.button_height),
|
||||
"&buttonText=", encodeURIComponent(this.settings.button_text),
|
||||
"&buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding),
|
||||
"&buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding),
|
||||
"&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style),
|
||||
"&buttonAction=", encodeURIComponent(this.settings.button_action),
|
||||
"&buttonDisabled=", encodeURIComponent(this.settings.button_disabled),
|
||||
"&buttonCursor=", encodeURIComponent(this.settings.button_cursor)
|
||||
].join("");
|
||||
};
|
||||
|
||||
// Public: getMovieElement retrieves the DOM reference to the Flash element added by SWFUpload
|
||||
// The element is cached after the first lookup
|
||||
SWFUpload.prototype.getMovieElement = function () {
|
||||
if (this.movieElement == undefined) {
|
||||
this.movieElement = document.getElementById(this.movieName);
|
||||
}
|
||||
|
||||
if (this.movieElement === null) {
|
||||
throw "Could not find Flash element";
|
||||
}
|
||||
|
||||
return this.movieElement;
|
||||
};
|
||||
|
||||
// Private: buildParamString takes the name/value pairs in the post_params setting object
|
||||
// and joins them up in to a string formatted "name=value&name=value"
|
||||
SWFUpload.prototype.buildParamString = function () {
|
||||
var postParams = this.settings.post_params;
|
||||
var paramStringPairs = [];
|
||||
|
||||
if (typeof(postParams) === "object") {
|
||||
for (var name in postParams) {
|
||||
if (postParams.hasOwnProperty(name)) {
|
||||
paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return paramStringPairs.join("&");
|
||||
};
|
||||
|
||||
// Public: Used to remove a SWFUpload instance from the page. This method strives to remove
|
||||
// all references to the SWF, and other objects so memory is properly freed.
|
||||
// Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state.
|
||||
// Credits: Major improvements provided by steffen
|
||||
SWFUpload.prototype.destroy = function () {
|
||||
try {
|
||||
// Make sure Flash is done before we try to remove it
|
||||
this.cancelUpload(null, false);
|
||||
|
||||
|
||||
// Remove the SWFUpload DOM nodes
|
||||
var movieElement = null;
|
||||
movieElement = this.getMovieElement();
|
||||
|
||||
if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
|
||||
// Loop through all the movie's properties and remove all function references (DOM/JS IE 6/7 memory leak workaround)
|
||||
for (var i in movieElement) {
|
||||
try {
|
||||
if (typeof(movieElement[i]) === "function") {
|
||||
movieElement[i] = null;
|
||||
}
|
||||
} catch (ex1) {}
|
||||
}
|
||||
|
||||
// Remove the Movie Element from the page
|
||||
try {
|
||||
movieElement.parentNode.removeChild(movieElement);
|
||||
} catch (ex) {}
|
||||
}
|
||||
|
||||
// Remove IE form fix reference
|
||||
window[this.movieName] = null;
|
||||
|
||||
// Destroy other references
|
||||
SWFUpload.instances[this.movieName] = null;
|
||||
delete SWFUpload.instances[this.movieName];
|
||||
|
||||
this.movieElement = null;
|
||||
this.settings = null;
|
||||
this.customSettings = null;
|
||||
this.eventQueue = null;
|
||||
this.movieName = null;
|
||||
|
||||
|
||||
return true;
|
||||
} catch (ex2) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Public: displayDebugInfo prints out settings and configuration
|
||||
// information about this SWFUpload instance.
|
||||
// This function (and any references to it) can be deleted when placing
|
||||
// SWFUpload in production.
|
||||
SWFUpload.prototype.displayDebugInfo = function () {
|
||||
this.debug(
|
||||
[
|
||||
"---SWFUpload Instance Info---\n",
|
||||
"Version: ", SWFUpload.version, "\n",
|
||||
"Movie Name: ", this.movieName, "\n",
|
||||
"Settings:\n",
|
||||
"\t", "upload_url: ", this.settings.upload_url, "\n",
|
||||
"\t", "flash_url: ", this.settings.flash_url, "\n",
|
||||
"\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n",
|
||||
"\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n",
|
||||
"\t", "http_success: ", this.settings.http_success.join(", "), "\n",
|
||||
"\t", "assume_success_timeout: ", this.settings.assume_success_timeout, "\n",
|
||||
"\t", "file_post_name: ", this.settings.file_post_name, "\n",
|
||||
"\t", "post_params: ", this.settings.post_params.toString(), "\n",
|
||||
"\t", "file_types: ", this.settings.file_types, "\n",
|
||||
"\t", "file_types_description: ", this.settings.file_types_description, "\n",
|
||||
"\t", "file_size_limit: ", this.settings.file_size_limit, "\n",
|
||||
"\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n",
|
||||
"\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n",
|
||||
"\t", "debug: ", this.settings.debug.toString(), "\n",
|
||||
|
||||
"\t", "prevent_swf_caching: ", this.settings.prevent_swf_caching.toString(), "\n",
|
||||
|
||||
"\t", "button_placeholder_id: ", this.settings.button_placeholder_id.toString(), "\n",
|
||||
"\t", "button_placeholder: ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n",
|
||||
"\t", "button_image_url: ", this.settings.button_image_url.toString(), "\n",
|
||||
"\t", "button_width: ", this.settings.button_width.toString(), "\n",
|
||||
"\t", "button_height: ", this.settings.button_height.toString(), "\n",
|
||||
"\t", "button_text: ", this.settings.button_text.toString(), "\n",
|
||||
"\t", "button_text_style: ", this.settings.button_text_style.toString(), "\n",
|
||||
"\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n",
|
||||
"\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n",
|
||||
"\t", "button_action: ", this.settings.button_action.toString(), "\n",
|
||||
"\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n",
|
||||
|
||||
"\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n",
|
||||
"Event Handlers:\n",
|
||||
"\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n",
|
||||
"\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n",
|
||||
"\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n",
|
||||
"\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n",
|
||||
"\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n",
|
||||
"\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n",
|
||||
"\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n",
|
||||
"\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n",
|
||||
"\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n",
|
||||
"\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n"
|
||||
].join("")
|
||||
);
|
||||
};
|
||||
|
||||
/* Note: addSetting and getSetting are no longer used by SWFUpload but are included
|
||||
the maintain v2 API compatibility
|
||||
*/
|
||||
// Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used.
|
||||
SWFUpload.prototype.addSetting = function (name, value, default_value) {
|
||||
if (value == undefined) {
|
||||
return (this.settings[name] = default_value);
|
||||
} else {
|
||||
return (this.settings[name] = value);
|
||||
}
|
||||
};
|
||||
|
||||
// Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found.
|
||||
SWFUpload.prototype.getSetting = function (name) {
|
||||
if (this.settings[name] != undefined) {
|
||||
return this.settings[name];
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Private: callFlash handles function calls made to the Flash element.
|
||||
// Calls are made with a setTimeout for some functions to work around
|
||||
// bugs in the ExternalInterface library.
|
||||
SWFUpload.prototype.callFlash = function (functionName, argumentArray) {
|
||||
argumentArray = argumentArray || [];
|
||||
|
||||
var movieElement = this.getMovieElement();
|
||||
var returnValue, returnString;
|
||||
|
||||
// Flash's method if calling ExternalInterface methods (code adapted from MooTools).
|
||||
try {
|
||||
returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + '</invoke>');
|
||||
returnValue = eval(returnString);
|
||||
} catch (ex) {
|
||||
throw "Call to " + functionName + " failed";
|
||||
}
|
||||
|
||||
// Unescape file post param values
|
||||
if (returnValue != undefined && typeof returnValue.post === "object") {
|
||||
returnValue = this.unescapeFilePostParams(returnValue);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
/* *****************************
|
||||
-- Flash control methods --
|
||||
Your UI should use these
|
||||
to operate SWFUpload
|
||||
***************************** */
|
||||
|
||||
// WARNING: this function does not work in Flash Player 10
|
||||
// Public: selectFile causes a File Selection Dialog window to appear. This
|
||||
// dialog only allows 1 file to be selected.
|
||||
SWFUpload.prototype.selectFile = function () {
|
||||
this.callFlash("SelectFile");
|
||||
};
|
||||
|
||||
// WARNING: this function does not work in Flash Player 10
|
||||
// Public: selectFiles causes a File Selection Dialog window to appear/ This
|
||||
// dialog allows the user to select any number of files
|
||||
// Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names.
|
||||
// If the selection name length is too long the dialog will fail in an unpredictable manner. There is no work-around
|
||||
// for this bug.
|
||||
SWFUpload.prototype.selectFiles = function () {
|
||||
this.callFlash("SelectFiles");
|
||||
};
|
||||
|
||||
|
||||
// Public: startUpload starts uploading the first file in the queue unless
|
||||
// the optional parameter 'fileID' specifies the ID
|
||||
SWFUpload.prototype.startUpload = function (fileID) {
|
||||
this.callFlash("StartUpload", [fileID]);
|
||||
};
|
||||
|
||||
// Public: cancelUpload cancels any queued file. The fileID parameter may be the file ID or index.
|
||||
// If you do not specify a fileID the current uploading file or first file in the queue is cancelled.
|
||||
// If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter.
|
||||
SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) {
|
||||
if (triggerErrorEvent !== false) {
|
||||
triggerErrorEvent = true;
|
||||
}
|
||||
this.callFlash("CancelUpload", [fileID, triggerErrorEvent]);
|
||||
};
|
||||
|
||||
// Public: stopUpload stops the current upload and requeues the file at the beginning of the queue.
|
||||
// If nothing is currently uploading then nothing happens.
|
||||
SWFUpload.prototype.stopUpload = function () {
|
||||
this.callFlash("StopUpload");
|
||||
};
|
||||
|
||||
/* ************************
|
||||
* Settings methods
|
||||
* These methods change the SWFUpload settings.
|
||||
* SWFUpload settings should not be changed directly on the settings object
|
||||
* since many of the settings need to be passed to Flash in order to take
|
||||
* effect.
|
||||
* *********************** */
|
||||
|
||||
// Public: getStats gets the file statistics object.
|
||||
SWFUpload.prototype.getStats = function () {
|
||||
return this.callFlash("GetStats");
|
||||
};
|
||||
|
||||
// Public: setStats changes the SWFUpload statistics. You shouldn't need to
|
||||
// change the statistics but you can. Changing the statistics does not
|
||||
// affect SWFUpload accept for the successful_uploads count which is used
|
||||
// by the upload_limit setting to determine how many files the user may upload.
|
||||
SWFUpload.prototype.setStats = function (statsObject) {
|
||||
this.callFlash("SetStats", [statsObject]);
|
||||
};
|
||||
|
||||
// Public: getFile retrieves a File object by ID or Index. If the file is
|
||||
// not found then 'null' is returned.
|
||||
SWFUpload.prototype.getFile = function (fileID) {
|
||||
if (typeof(fileID) === "number") {
|
||||
return this.callFlash("GetFileByIndex", [fileID]);
|
||||
} else {
|
||||
return this.callFlash("GetFile", [fileID]);
|
||||
}
|
||||
};
|
||||
|
||||
// Public: addFileParam sets a name/value pair that will be posted with the
|
||||
// file specified by the Files ID. If the name already exists then the
|
||||
// exiting value will be overwritten.
|
||||
SWFUpload.prototype.addFileParam = function (fileID, name, value) {
|
||||
return this.callFlash("AddFileParam", [fileID, name, value]);
|
||||
};
|
||||
|
||||
// Public: removeFileParam removes a previously set (by addFileParam) name/value
|
||||
// pair from the specified file.
|
||||
SWFUpload.prototype.removeFileParam = function (fileID, name) {
|
||||
this.callFlash("RemoveFileParam", [fileID, name]);
|
||||
};
|
||||
|
||||
// Public: setUploadUrl changes the upload_url setting.
|
||||
SWFUpload.prototype.setUploadURL = function (url) {
|
||||
this.settings.upload_url = url.toString();
|
||||
this.callFlash("SetUploadURL", [url]);
|
||||
};
|
||||
|
||||
// Public: setPostParams changes the post_params setting
|
||||
SWFUpload.prototype.setPostParams = function (paramsObject) {
|
||||
this.settings.post_params = paramsObject;
|
||||
this.callFlash("SetPostParams", [paramsObject]);
|
||||
};
|
||||
|
||||
// Public: addPostParam adds post name/value pair. Each name can have only one value.
|
||||
SWFUpload.prototype.addPostParam = function (name, value) {
|
||||
this.settings.post_params[name] = value;
|
||||
this.callFlash("SetPostParams", [this.settings.post_params]);
|
||||
};
|
||||
|
||||
// Public: removePostParam deletes post name/value pair.
|
||||
SWFUpload.prototype.removePostParam = function (name) {
|
||||
delete this.settings.post_params[name];
|
||||
this.callFlash("SetPostParams", [this.settings.post_params]);
|
||||
};
|
||||
|
||||
// Public: setFileTypes changes the file_types setting and the file_types_description setting
|
||||
SWFUpload.prototype.setFileTypes = function (types, description) {
|
||||
this.settings.file_types = types;
|
||||
this.settings.file_types_description = description;
|
||||
this.callFlash("SetFileTypes", [types, description]);
|
||||
};
|
||||
|
||||
// Public: setFileSizeLimit changes the file_size_limit setting
|
||||
SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) {
|
||||
this.settings.file_size_limit = fileSizeLimit;
|
||||
this.callFlash("SetFileSizeLimit", [fileSizeLimit]);
|
||||
};
|
||||
|
||||
// Public: setFileUploadLimit changes the file_upload_limit setting
|
||||
SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) {
|
||||
this.settings.file_upload_limit = fileUploadLimit;
|
||||
this.callFlash("SetFileUploadLimit", [fileUploadLimit]);
|
||||
};
|
||||
|
||||
// Public: setFileQueueLimit changes the file_queue_limit setting
|
||||
SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) {
|
||||
this.settings.file_queue_limit = fileQueueLimit;
|
||||
this.callFlash("SetFileQueueLimit", [fileQueueLimit]);
|
||||
};
|
||||
|
||||
// Public: setFilePostName changes the file_post_name setting
|
||||
SWFUpload.prototype.setFilePostName = function (filePostName) {
|
||||
this.settings.file_post_name = filePostName;
|
||||
this.callFlash("SetFilePostName", [filePostName]);
|
||||
};
|
||||
|
||||
// Public: setUseQueryString changes the use_query_string setting
|
||||
SWFUpload.prototype.setUseQueryString = function (useQueryString) {
|
||||
this.settings.use_query_string = useQueryString;
|
||||
this.callFlash("SetUseQueryString", [useQueryString]);
|
||||
};
|
||||
|
||||
// Public: setRequeueOnError changes the requeue_on_error setting
|
||||
SWFUpload.prototype.setRequeueOnError = function (requeueOnError) {
|
||||
this.settings.requeue_on_error = requeueOnError;
|
||||
this.callFlash("SetRequeueOnError", [requeueOnError]);
|
||||
};
|
||||
|
||||
// Public: setHTTPSuccess changes the http_success setting
|
||||
SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) {
|
||||
if (typeof http_status_codes === "string") {
|
||||
http_status_codes = http_status_codes.replace(" ", "").split(",");
|
||||
}
|
||||
|
||||
this.settings.http_success = http_status_codes;
|
||||
this.callFlash("SetHTTPSuccess", [http_status_codes]);
|
||||
};
|
||||
|
||||
// Public: setHTTPSuccess changes the http_success setting
|
||||
SWFUpload.prototype.setAssumeSuccessTimeout = function (timeout_seconds) {
|
||||
this.settings.assume_success_timeout = timeout_seconds;
|
||||
this.callFlash("SetAssumeSuccessTimeout", [timeout_seconds]);
|
||||
};
|
||||
|
||||
// Public: setDebugEnabled changes the debug_enabled setting
|
||||
SWFUpload.prototype.setDebugEnabled = function (debugEnabled) {
|
||||
this.settings.debug_enabled = debugEnabled;
|
||||
this.callFlash("SetDebugEnabled", [debugEnabled]);
|
||||
};
|
||||
|
||||
// Public: setButtonImageURL loads a button image sprite
|
||||
SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) {
|
||||
if (buttonImageURL == undefined) {
|
||||
buttonImageURL = "";
|
||||
}
|
||||
|
||||
this.settings.button_image_url = buttonImageURL;
|
||||
this.callFlash("SetButtonImageURL", [buttonImageURL]);
|
||||
};
|
||||
|
||||
// Public: setButtonDimensions resizes the Flash Movie and button
|
||||
SWFUpload.prototype.setButtonDimensions = function (width, height) {
|
||||
this.settings.button_width = width;
|
||||
this.settings.button_height = height;
|
||||
|
||||
var movie = this.getMovieElement();
|
||||
if (movie != undefined) {
|
||||
movie.style.width = width + "px";
|
||||
movie.style.height = height + "px";
|
||||
}
|
||||
|
||||
this.callFlash("SetButtonDimensions", [width, height]);
|
||||
};
|
||||
// Public: setButtonText Changes the text overlaid on the button
|
||||
SWFUpload.prototype.setButtonText = function (html) {
|
||||
this.settings.button_text = html;
|
||||
this.callFlash("SetButtonText", [html]);
|
||||
};
|
||||
// Public: setButtonTextPadding changes the top and left padding of the text overlay
|
||||
SWFUpload.prototype.setButtonTextPadding = function (left, top) {
|
||||
this.settings.button_text_top_padding = top;
|
||||
this.settings.button_text_left_padding = left;
|
||||
this.callFlash("SetButtonTextPadding", [left, top]);
|
||||
};
|
||||
|
||||
// Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button
|
||||
SWFUpload.prototype.setButtonTextStyle = function (css) {
|
||||
this.settings.button_text_style = css;
|
||||
this.callFlash("SetButtonTextStyle", [css]);
|
||||
};
|
||||
// Public: setButtonDisabled disables/enables the button
|
||||
SWFUpload.prototype.setButtonDisabled = function (isDisabled) {
|
||||
this.settings.button_disabled = isDisabled;
|
||||
this.callFlash("SetButtonDisabled", [isDisabled]);
|
||||
};
|
||||
// Public: setButtonAction sets the action that occurs when the button is clicked
|
||||
SWFUpload.prototype.setButtonAction = function (buttonAction) {
|
||||
this.settings.button_action = buttonAction;
|
||||
this.callFlash("SetButtonAction", [buttonAction]);
|
||||
};
|
||||
|
||||
// Public: setButtonCursor changes the mouse cursor displayed when hovering over the button
|
||||
SWFUpload.prototype.setButtonCursor = function (cursor) {
|
||||
this.settings.button_cursor = cursor;
|
||||
this.callFlash("SetButtonCursor", [cursor]);
|
||||
};
|
||||
|
||||
/* *******************************
|
||||
Flash Event Interfaces
|
||||
These functions are used by Flash to trigger the various
|
||||
events.
|
||||
|
||||
All these functions a Private.
|
||||
|
||||
Because the ExternalInterface library is buggy the event calls
|
||||
are added to a queue and the queue then executed by a setTimeout.
|
||||
This ensures that events are executed in a determinate order and that
|
||||
the ExternalInterface bugs are avoided.
|
||||
******************************* */
|
||||
|
||||
SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) {
|
||||
// Warning: Don't call this.debug inside here or you'll create an infinite loop
|
||||
|
||||
if (argumentArray == undefined) {
|
||||
argumentArray = [];
|
||||
} else if (!(argumentArray instanceof Array)) {
|
||||
argumentArray = [argumentArray];
|
||||
}
|
||||
|
||||
var self = this;
|
||||
if (typeof this.settings[handlerName] === "function") {
|
||||
// Queue the event
|
||||
this.eventQueue.push(function () {
|
||||
this.settings[handlerName].apply(this, argumentArray);
|
||||
});
|
||||
|
||||
// Execute the next queued event
|
||||
setTimeout(function () {
|
||||
self.executeNextEvent();
|
||||
}, 0);
|
||||
|
||||
} else if (this.settings[handlerName] !== null) {
|
||||
throw "Event handler " + handlerName + " is unknown or is not a function";
|
||||
}
|
||||
};
|
||||
|
||||
// Private: Causes the next event in the queue to be executed. Since events are queued using a setTimeout
|
||||
// we must queue them in order to garentee that they are executed in order.
|
||||
SWFUpload.prototype.executeNextEvent = function () {
|
||||
// Warning: Don't call this.debug inside here or you'll create an infinite loop
|
||||
|
||||
var f = this.eventQueue ? this.eventQueue.shift() : null;
|
||||
if (typeof(f) === "function") {
|
||||
f.apply(this);
|
||||
}
|
||||
};
|
||||
|
||||
// Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have
|
||||
// properties that contain characters that are not valid for JavaScript identifiers. To work around this
|
||||
// the Flash Component escapes the parameter names and we must unescape again before passing them along.
|
||||
SWFUpload.prototype.unescapeFilePostParams = function (file) {
|
||||
var reg = /[$]([0-9a-f]{4})/i;
|
||||
var unescapedPost = {};
|
||||
var uk;
|
||||
|
||||
if (file != undefined) {
|
||||
for (var k in file.post) {
|
||||
if (file.post.hasOwnProperty(k)) {
|
||||
uk = k;
|
||||
var match;
|
||||
while ((match = reg.exec(uk)) !== null) {
|
||||
uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16)));
|
||||
}
|
||||
unescapedPost[uk] = file.post[k];
|
||||
}
|
||||
}
|
||||
|
||||
file.post = unescapedPost;
|
||||
}
|
||||
|
||||
return file;
|
||||
};
|
||||
|
||||
// Private: Called by Flash to see if JS can call in to Flash (test if External Interface is working)
|
||||
SWFUpload.prototype.testExternalInterface = function () {
|
||||
try {
|
||||
return this.callFlash("TestExternalInterface");
|
||||
} catch (ex) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// Private: This event is called by Flash when it has finished loading. Don't modify this.
|
||||
// Use the swfupload_loaded_handler event setting to execute custom code when SWFUpload has loaded.
|
||||
SWFUpload.prototype.flashReady = function () {
|
||||
// Check that the movie element is loaded correctly with its ExternalInterface methods defined
|
||||
var movieElement = this.getMovieElement();
|
||||
|
||||
if (!movieElement) {
|
||||
this.debug("Flash called back ready but the flash movie can't be found.");
|
||||
return;
|
||||
}
|
||||
|
||||
this.cleanUp(movieElement);
|
||||
|
||||
this.queueEvent("swfupload_loaded_handler");
|
||||
};
|
||||
|
||||
// Private: removes Flash added fuctions to the DOM node to prevent memory leaks in IE.
|
||||
// This function is called by Flash each time the ExternalInterface functions are created.
|
||||
SWFUpload.prototype.cleanUp = function (movieElement) {
|
||||
// Pro-actively unhook all the Flash functions
|
||||
try {
|
||||
if (this.movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
|
||||
this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
|
||||
for (var key in movieElement) {
|
||||
try {
|
||||
if (typeof(movieElement[key]) === "function") {
|
||||
movieElement[key] = null;
|
||||
}
|
||||
} catch (ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ex1) {
|
||||
|
||||
}
|
||||
|
||||
// Fix Flashes own cleanup code so if the SWFMovie was removed from the page
|
||||
// it doesn't display errors.
|
||||
window["__flash__removeCallback"] = function (instance, name) {
|
||||
try {
|
||||
if (instance) {
|
||||
instance[name] = null;
|
||||
}
|
||||
} catch (flashEx) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* This is a chance to do something before the browse window opens */
|
||||
SWFUpload.prototype.fileDialogStart = function () {
|
||||
this.queueEvent("file_dialog_start_handler");
|
||||
};
|
||||
|
||||
|
||||
/* Called when a file is successfully added to the queue. */
|
||||
SWFUpload.prototype.fileQueued = function (file) {
|
||||
file = this.unescapeFilePostParams(file);
|
||||
this.queueEvent("file_queued_handler", file);
|
||||
};
|
||||
|
||||
|
||||
/* Handle errors that occur when an attempt to queue a file fails. */
|
||||
SWFUpload.prototype.fileQueueError = function (file, errorCode, message) {
|
||||
file = this.unescapeFilePostParams(file);
|
||||
this.queueEvent("file_queue_error_handler", [file, errorCode, message]);
|
||||
};
|
||||
|
||||
/* Called after the file dialog has closed and the selected files have been queued.
|
||||
You could call startUpload here if you want the queued files to begin uploading immediately. */
|
||||
SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued, numFilesInQueue) {
|
||||
this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]);
|
||||
};
|
||||
|
||||
SWFUpload.prototype.uploadStart = function (file) {
|
||||
file = this.unescapeFilePostParams(file);
|
||||
this.queueEvent("return_upload_start_handler", file);
|
||||
};
|
||||
|
||||
SWFUpload.prototype.returnUploadStart = function (file) {
|
||||
var returnValue;
|
||||
if (typeof this.settings.upload_start_handler === "function") {
|
||||
file = this.unescapeFilePostParams(file);
|
||||
returnValue = this.settings.upload_start_handler.call(this, file);
|
||||
} else if (this.settings.upload_start_handler != undefined) {
|
||||
throw "upload_start_handler must be a function";
|
||||
}
|
||||
|
||||
// Convert undefined to true so if nothing is returned from the upload_start_handler it is
|
||||
// interpretted as 'true'.
|
||||
if (returnValue === undefined) {
|
||||
returnValue = true;
|
||||
}
|
||||
|
||||
returnValue = !!returnValue;
|
||||
|
||||
this.callFlash("ReturnUploadStart", [returnValue]);
|
||||
};
|
||||
|
||||
|
||||
|
||||
SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) {
|
||||
file = this.unescapeFilePostParams(file);
|
||||
this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]);
|
||||
};
|
||||
|
||||
SWFUpload.prototype.uploadError = function (file, errorCode, message) {
|
||||
file = this.unescapeFilePostParams(file);
|
||||
this.queueEvent("upload_error_handler", [file, errorCode, message]);
|
||||
};
|
||||
|
||||
SWFUpload.prototype.uploadSuccess = function (file, serverData, responseReceived) {
|
||||
file = this.unescapeFilePostParams(file);
|
||||
this.queueEvent("upload_success_handler", [file, serverData, responseReceived]);
|
||||
};
|
||||
|
||||
SWFUpload.prototype.uploadComplete = function (file) {
|
||||
file = this.unescapeFilePostParams(file);
|
||||
this.queueEvent("upload_complete_handler", file);
|
||||
};
|
||||
|
||||
/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the
|
||||
internal debug console. You can override this event and have messages written where you want. */
|
||||
SWFUpload.prototype.debug = function (message) {
|
||||
this.queueEvent("debug_handler", message);
|
||||
};
|
||||
|
||||
|
||||
/* **********************************
|
||||
Debug Console
|
||||
The debug console is a self contained, in page location
|
||||
for debug message to be sent. The Debug Console adds
|
||||
itself to the body if necessary.
|
||||
|
||||
The console is automatically scrolled as messages appear.
|
||||
|
||||
If you are using your own debug handler or when you deploy to production and
|
||||
have debug disabled you can remove these functions to reduce the file size
|
||||
and complexity.
|
||||
********************************** */
|
||||
|
||||
// Private: debugMessage is the default debug_handler. If you want to print debug messages
|
||||
// call the debug() function. When overriding the function your own function should
|
||||
// check to see if the debug setting is true before outputting debug information.
|
||||
SWFUpload.prototype.debugMessage = function (message) {
|
||||
if (this.settings.debug) {
|
||||
var exceptionMessage, exceptionValues = [];
|
||||
|
||||
// Check for an exception object and print it nicely
|
||||
if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") {
|
||||
for (var key in message) {
|
||||
if (message.hasOwnProperty(key)) {
|
||||
exceptionValues.push(key + ": " + message[key]);
|
||||
}
|
||||
}
|
||||
exceptionMessage = exceptionValues.join("\n") || "";
|
||||
exceptionValues = exceptionMessage.split("\n");
|
||||
exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: ");
|
||||
SWFUpload.Console.writeLine(exceptionMessage);
|
||||
} else {
|
||||
SWFUpload.Console.writeLine(message);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
SWFUpload.Console = {};
|
||||
SWFUpload.Console.writeLine = function (message) {
|
||||
var console, documentForm;
|
||||
|
||||
try {
|
||||
console = document.getElementById("SWFUpload_Console");
|
||||
|
||||
if (!console) {
|
||||
documentForm = document.createElement("form");
|
||||
document.getElementsByTagName("body")[0].appendChild(documentForm);
|
||||
|
||||
console = document.createElement("textarea");
|
||||
console.id = "SWFUpload_Console";
|
||||
console.style.fontFamily = "monospace";
|
||||
console.setAttribute("wrap", "off");
|
||||
console.wrap = "off";
|
||||
console.style.overflow = "auto";
|
||||
console.style.width = "700px";
|
||||
console.style.height = "350px";
|
||||
console.style.margin = "5px";
|
||||
documentForm.appendChild(console);
|
||||
}
|
||||
|
||||
console.value += message + "\n";
|
||||
|
||||
console.scrollTop = console.scrollHeight - console.clientHeight;
|
||||
} catch (ex) {
|
||||
alert("Exception: " + ex.name + " Message: " + ex.message);
|
||||
}
|
||||
};
|
||||
85
statics/js/common/libs/swfupload/swfupload.queue.js
Executable file
85
statics/js/common/libs/swfupload/swfupload.queue.js
Executable file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
[Leo.C, Studio] (C)2004 - 2008
|
||||
|
||||
$Hanization: LeoChung $
|
||||
$E-Mail: who@imll.net $
|
||||
$HomePage: http://imll.net $
|
||||
$Date: 2008/11/8 18:02 $
|
||||
*/
|
||||
/*
|
||||
Queue Plug-in
|
||||
|
||||
Features:
|
||||
*Adds a cancelQueue() method for cancelling the entire queue.
|
||||
*All queued files are uploaded when startUpload() is called.
|
||||
*If false is returned from uploadComplete then the queue upload is stopped.
|
||||
If false is not returned (strict comparison) then the queue upload is continued.
|
||||
*Adds a QueueComplete event that is fired when all the queued files have finished uploading.
|
||||
Set the event handler with the queue_complete_handler setting.
|
||||
|
||||
*/
|
||||
|
||||
var SWFUpload;
|
||||
if (typeof(SWFUpload) === "function") {
|
||||
SWFUpload.queue = {};
|
||||
|
||||
SWFUpload.prototype.initSettings = (function (oldInitSettings) {
|
||||
return function () {
|
||||
if (typeof(oldInitSettings) === "function") {
|
||||
oldInitSettings.call(this);
|
||||
}
|
||||
|
||||
this.customSettings.queue_cancelled_flag = false;
|
||||
this.customSettings.queue_upload_count = 0;
|
||||
|
||||
this.settings.user_upload_complete_handler = this.settings.upload_complete_handler;
|
||||
this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
|
||||
|
||||
this.settings.queue_complete_handler = this.settings.queue_complete_handler || null;
|
||||
};
|
||||
})(SWFUpload.prototype.initSettings);
|
||||
|
||||
SWFUpload.prototype.startUpload = function (fileID) {
|
||||
this.customSettings.queue_cancelled_flag = false;
|
||||
this.callFlash("StartUpload", false, [fileID]);
|
||||
};
|
||||
|
||||
SWFUpload.prototype.cancelQueue = function () {
|
||||
this.customSettings.queue_cancelled_flag = true;
|
||||
this.stopUpload();
|
||||
|
||||
var stats = this.getStats();
|
||||
while (stats.files_queued > 0) {
|
||||
this.cancelUpload();
|
||||
stats = this.getStats();
|
||||
}
|
||||
};
|
||||
|
||||
SWFUpload.queue.uploadCompleteHandler = function (file) {
|
||||
var user_upload_complete_handler = this.settings.user_upload_complete_handler;
|
||||
var continueUpload;
|
||||
|
||||
if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
|
||||
this.customSettings.queue_upload_count++;
|
||||
}
|
||||
|
||||
if (typeof(user_upload_complete_handler) === "function") {
|
||||
continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
|
||||
} else {
|
||||
continueUpload = true;
|
||||
}
|
||||
|
||||
if (continueUpload) {
|
||||
var stats = this.getStats();
|
||||
if (stats.files_queued > 0 && this.customSettings.queue_cancelled_flag === false) {
|
||||
this.startUpload();
|
||||
} else if (this.customSettings.queue_cancelled_flag === false) {
|
||||
this.queueEvent("queue_complete_handler", [this.customSettings.queue_upload_count]);
|
||||
this.customSettings.queue_upload_count = 0;
|
||||
} else {
|
||||
this.customSettings.queue_cancelled_flag = false;
|
||||
this.customSettings.queue_upload_count = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
BIN
statics/js/common/libs/swfupload/swfupload.swf
Executable file
BIN
statics/js/common/libs/swfupload/swfupload.swf
Executable file
Binary file not shown.
29
statics/js/common/libs/uploader/jquery.uploader.css
Executable file
29
statics/js/common/libs/uploader/jquery.uploader.css
Executable file
@@ -0,0 +1,29 @@
|
||||
/*队列*/
|
||||
.upload-queue {zoom:1}
|
||||
.upload-queue:after {display:block;content:'\20';height:0;clear:both}
|
||||
.upload-queue .queue {position:relative;}
|
||||
.upload-queue ul {position:relative; z-index:2; height:24px; margin:0; padding:0; border-bottom:1px solid #F0F2F6; color:#555; overflow:hidden;}
|
||||
.upload-queue ul:nth-child(2n) { background:#F8F8F8;}
|
||||
.upload-queue .last-queue ul {border-bottom:none;}
|
||||
.upload-queue li {float:left; height:24px; line-height:24px; padding-left:10px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
|
||||
.upload-queue .f-name {width:220px;}
|
||||
.upload-queue .f-progress {width:100px;}
|
||||
.upload-queue .f-size {width:60px;}
|
||||
.upload-queue .f-operate {float:right;padding-right:0;}
|
||||
.upload-queue .f-operate a {padding:0 5px; color:#333; text-decoration:none;font-size:16px; font-family:'Microsoft Yahei',Tahoma}
|
||||
.upload-queue .f-operate a:hover {color:#d00;}
|
||||
|
||||
/*进度条*/
|
||||
.upload-progress {
|
||||
position:absolute; top:0; left:0; z-index:1;
|
||||
height:24px;
|
||||
overflow:hidden;
|
||||
background:#B4D9FC;
|
||||
background:-webkit-linear-gradient(top, #C1E4FD, #B4D9FC 100%);
|
||||
background:-moz-linear-gradient(top, #C1E4FD, #B4D9FC 100%);
|
||||
background:-o-linear-gradient(top, #C1E4FD, #B4D9FC 100%);
|
||||
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#C1E4FD', endColorstr='#B4D9FC');
|
||||
}
|
||||
|
||||
.upload-error .upload-progress {background:#FEE8D6; filter:0; width:100%;}
|
||||
.upload-error .f-progress {color:#c00;}
|
||||
5
statics/js/common/libs/uploader/jquery.uploader.js
Executable file
5
statics/js/common/libs/uploader/jquery.uploader.js
Executable file
File diff suppressed because one or more lines are too long
3766
statics/js/common/main.js
Executable file
3766
statics/js/common/main.js
Executable file
File diff suppressed because it is too large
Load Diff
4
statics/js/common/plugins.js
Executable file
4
statics/js/common/plugins.js
Executable file
File diff suppressed because one or more lines are too long
941
statics/js/common/plugins/datepicker/pikaday.js
Executable file
941
statics/js/common/plugins/datepicker/pikaday.js
Executable file
@@ -0,0 +1,941 @@
|
||||
(function(window, undefined)
|
||||
{
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* feature detection and helper functions
|
||||
*/
|
||||
var hasMoment = typeof moment === 'function',
|
||||
|
||||
hasEventListeners = !!window.addEventListener,
|
||||
|
||||
document = window.document,
|
||||
|
||||
sto = window.setTimeout,
|
||||
|
||||
addEvent = function(el, e, callback, capture)
|
||||
{
|
||||
if (hasEventListeners) {
|
||||
el.addEventListener(e, callback, !!capture);
|
||||
} else {
|
||||
el.attachEvent('on' + e, callback);
|
||||
}
|
||||
},
|
||||
|
||||
removeEvent = function(el, e, callback, capture)
|
||||
{
|
||||
if (hasEventListeners) {
|
||||
el.removeEventListener(e, callback, !!capture);
|
||||
} else {
|
||||
el.detachEvent('on' + e, callback);
|
||||
}
|
||||
},
|
||||
|
||||
fireEvent = function(el, eventName, data)
|
||||
{
|
||||
var ev;
|
||||
|
||||
if (document.createEvent) {
|
||||
ev = document.createEvent('HTMLEvents');
|
||||
ev.initEvent(eventName, true, false);
|
||||
ev = extend(ev, data);
|
||||
el.dispatchEvent(ev);
|
||||
} else if (document.createEventObject) {
|
||||
ev = document.createEventObject();
|
||||
ev = extend(ev, data);
|
||||
el.fireEvent('on' + eventName, ev);
|
||||
}
|
||||
},
|
||||
|
||||
trim = function(str)
|
||||
{
|
||||
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g,'');
|
||||
},
|
||||
|
||||
hasClass = function(el, cn)
|
||||
{
|
||||
return (' ' + el.className + ' ').indexOf(' ' + cn + ' ') !== -1;
|
||||
},
|
||||
|
||||
addClass = function(el, cn)
|
||||
{
|
||||
if (!hasClass(el, cn)) {
|
||||
el.className = (el.className === '') ? cn : el.className + ' ' + cn;
|
||||
}
|
||||
},
|
||||
|
||||
removeClass = function(el, cn)
|
||||
{
|
||||
el.className = trim((' ' + el.className + ' ').replace(' ' + cn + ' ', ' '));
|
||||
},
|
||||
|
||||
isArray = function(obj)
|
||||
{
|
||||
return (/Array/).test(Object.prototype.toString.call(obj));
|
||||
},
|
||||
|
||||
isDate = function(obj)
|
||||
{
|
||||
return (/Date/).test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime());
|
||||
},
|
||||
|
||||
parseDate = function(str) {
|
||||
return new Date( Date.parse(str.replace(/\.|\-/g, '/')) );
|
||||
},
|
||||
|
||||
isLeapYear = function(year)
|
||||
{
|
||||
// solution by Matti Virkkunen: http://stackoverflow.com/a/4881951
|
||||
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
|
||||
},
|
||||
|
||||
getDaysInMonth = function(year, month)
|
||||
{
|
||||
return [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
|
||||
},
|
||||
|
||||
setToStartOfDay = function(date)
|
||||
{
|
||||
if (isDate(date)) date.setHours(0,0,0,0);
|
||||
},
|
||||
|
||||
compareDates = function(a,b)
|
||||
{
|
||||
// weak date comparison (use setToStartOfDay(date) to ensure correct result)
|
||||
return a.getTime() === b.getTime();
|
||||
},
|
||||
|
||||
extend = function(to, from, overwrite)
|
||||
{
|
||||
var prop, hasProp;
|
||||
for (prop in from) {
|
||||
hasProp = to[prop] !== undefined;
|
||||
if (hasProp && typeof from[prop] === 'object' && from[prop].nodeName === undefined) {
|
||||
if (isDate(from[prop])) {
|
||||
if (overwrite) {
|
||||
to[prop] = new Date(from[prop].getTime());
|
||||
}
|
||||
}
|
||||
else if (isArray(from[prop])) {
|
||||
if (overwrite) {
|
||||
to[prop] = from[prop].slice(0);
|
||||
}
|
||||
} else {
|
||||
to[prop] = extend({}, from[prop], overwrite);
|
||||
}
|
||||
} else if (overwrite || !hasProp) {
|
||||
to[prop] = from[prop];
|
||||
}
|
||||
}
|
||||
return to;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* defaults and localisation
|
||||
*/
|
||||
defaults = {
|
||||
|
||||
// bind the picker to a form field
|
||||
field: null,
|
||||
|
||||
// automatically show/hide the picker on `field` focus (default `true` if `field` is set)
|
||||
bound: undefined,
|
||||
|
||||
// the default output format for `.toString()` and `field` value
|
||||
format: 'YYYY-MM-DD',
|
||||
|
||||
// the initial date to view when first opened
|
||||
defaultDate: null,
|
||||
|
||||
// make the `defaultDate` the initial selected value
|
||||
setDefaultDate: false,
|
||||
|
||||
// first day of week (0: Sunday, 1: Monday etc)
|
||||
firstDay: 0,
|
||||
|
||||
// the minimum/earliest date that can be selected
|
||||
minDate: null,
|
||||
// the maximum/latest date that can be selected
|
||||
maxDate: null,
|
||||
|
||||
// number of years either side, or array of upper/lower range
|
||||
yearRange: 10,
|
||||
|
||||
// used internally (don't config outside)
|
||||
minYear: 1990,
|
||||
maxYear: 2099,
|
||||
minMonth: undefined,
|
||||
maxMonth: undefined,
|
||||
|
||||
isRTL: false,
|
||||
|
||||
// Additional text to append to the year in the calendar title
|
||||
yearSuffix: '年',
|
||||
|
||||
// Render the month after year in the calendar title
|
||||
showMonthAfterYear: true,
|
||||
|
||||
// how many months are visible (not implemented yet)
|
||||
numberOfMonths: 1,
|
||||
|
||||
// internationalization
|
||||
/* i18n: {
|
||||
|
||||
months : ['January','February','March','April','May','June','July','August','September','October','November','December'],
|
||||
//monthsShort : ['Jan_Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
|
||||
weekdays : ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
|
||||
weekdaysShort : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
|
||||
}, */
|
||||
|
||||
i18n: {
|
||||
|
||||
months : ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
|
||||
monthsShort : ['1','2','3','4','5','6','7','8','9','10','11','12'],
|
||||
weekdays : ['星期天', '星期一','星期二','星期三','星期四','星期五','星期六'],
|
||||
weekdaysShort : ['日','一','二','三','四','五','六']
|
||||
},
|
||||
|
||||
// callback function
|
||||
onSelect: null,
|
||||
onOpen: null,
|
||||
onClose: null,
|
||||
onDraw: null
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* templating functions to abstract HTML rendering
|
||||
*/
|
||||
renderDayName = function(opts, day, abbr)
|
||||
{
|
||||
day += opts.firstDay;
|
||||
while (day >= 7) {
|
||||
day -= 7;
|
||||
}
|
||||
return abbr ? opts.i18n.weekdaysShort[day] : opts.i18n.weekdays[day];
|
||||
},
|
||||
|
||||
renderDay = function(i, isSelected, isToday, isDisabled, isEmpty)
|
||||
{
|
||||
if (isEmpty) {
|
||||
return '<td class="is-empty"></td>';
|
||||
}
|
||||
var arr = [];
|
||||
if (isDisabled) {
|
||||
arr.push('is-disabled');
|
||||
}
|
||||
if (isToday) {
|
||||
arr.push('is-today');
|
||||
}
|
||||
if (isSelected) {
|
||||
arr.push('is-selected');
|
||||
}
|
||||
return '<td data-day="' + i + '" class="' + arr.join(' ') + '"><a class="pika-button" href="javascript:void(0);">' + i + '</a>' + '</td>';
|
||||
},
|
||||
|
||||
renderRow = function(days, isRTL)
|
||||
{
|
||||
return '<tr>' + (isRTL ? days.reverse() : days).join('') + '</tr>';
|
||||
},
|
||||
|
||||
renderBody = function(rows)
|
||||
{
|
||||
return '<tbody>' + rows.join('') + '</tbody>';
|
||||
},
|
||||
|
||||
renderHead = function(opts)
|
||||
{
|
||||
var i, arr = [];
|
||||
for (i = 0; i < 7; i++) {
|
||||
arr.push('<th scope="col"><abbr title="' + renderDayName(opts, i) + '">' + renderDayName(opts, i, true) + '</abbr></th>');
|
||||
}
|
||||
return '<thead>' + (opts.isRTL ? arr.reverse() : arr).join('') + '</thead>';
|
||||
},
|
||||
|
||||
renderTitle = function(instance)
|
||||
{
|
||||
var i, j, arr,
|
||||
opts = instance._o,
|
||||
month = instance._m,
|
||||
year = instance._y,
|
||||
isMinYear = year === opts.minYear,
|
||||
isMaxYear = year === opts.maxYear,
|
||||
html = '<div class="pika-title">',
|
||||
monthHtml,
|
||||
yearHtml,
|
||||
prev = true,
|
||||
next = true;
|
||||
|
||||
html += '<a class="pika-prev' + (prev ? '' : ' is-disabled') + '" href="javascript:void(0);"><</a>';
|
||||
|
||||
for (arr = [], i = 0; i < 12; i++) {
|
||||
arr.push('<option value="' + i + '"' +
|
||||
(i === month ? ' selected': '') +
|
||||
((isMinYear && i < opts.minMonth) || (isMaxYear && i > opts.maxMonth) ? 'disabled' : '') + '>' +
|
||||
opts.i18n.months[i] + '</option>');
|
||||
}
|
||||
monthHtml = '<div class="pika-label pika-label-month">' + opts.i18n.months[month] + '<select class="pika-select pika-select-month">' + arr.join('') + '</select></div>';
|
||||
|
||||
if (isArray(opts.yearRange)) {
|
||||
i = opts.yearRange[0];
|
||||
j = opts.yearRange[1] + 1;
|
||||
} else {
|
||||
i = year - opts.yearRange;
|
||||
j = 1 + year + opts.yearRange;
|
||||
}
|
||||
|
||||
for (arr = []; i < j && i <= opts.maxYear; i++) {
|
||||
if (i >= opts.minYear) {
|
||||
arr.push('<option value="' + i + '"' + (i === year ? ' selected': '') + '>' + (i) + '</option>');
|
||||
}
|
||||
}
|
||||
yearHtml = '<div class="pika-label pika-label-year">' + year + opts.yearSuffix + '<select class="pika-select pika-select-year">' + arr.join('') + '</select></div>';
|
||||
|
||||
if (opts.showMonthAfterYear) {
|
||||
html += yearHtml + monthHtml;
|
||||
} else {
|
||||
html += monthHtml + yearHtml;
|
||||
}
|
||||
|
||||
if (isMinYear && (month === 0 || opts.minMonth >= month)) {
|
||||
prev = false;
|
||||
}
|
||||
|
||||
if (isMaxYear && (month === 11 || opts.maxMonth <= month)) {
|
||||
next = false;
|
||||
}
|
||||
|
||||
|
||||
html += '<a class="pika-next' + (next ? '' : ' is-disabled') + '" href="javascript:void(0);">></a>';
|
||||
|
||||
return html += '</div>';
|
||||
},
|
||||
|
||||
renderTable = function(opts, data)
|
||||
{
|
||||
return '<table cellpadding="0" cellspacing="0" class="pika-table">' + renderHead(opts) + renderBody(data) + '</table>';
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Pikaday constructor
|
||||
*/
|
||||
Pikaday = function(options)
|
||||
{
|
||||
var self = this,
|
||||
opts = self.config(options);
|
||||
|
||||
self._onMouseDown = function(e)
|
||||
{
|
||||
if (!self._v) {
|
||||
return;
|
||||
}
|
||||
e = e || window.event;
|
||||
var target = e.target || e.srcElement;
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!hasClass(target, 'is-disabled')) {
|
||||
if (hasClass(target, 'pika-button') && !hasClass(target, 'is-empty')) {
|
||||
self.setDate(new Date(self._y, self._m, parseInt(target.innerHTML, 10)));
|
||||
if (opts.bound) {
|
||||
sto(function() {
|
||||
self.hide();
|
||||
}, 100);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (hasClass(target, 'pika-prev')) {
|
||||
self.prevMonth();
|
||||
}
|
||||
else if (hasClass(target, 'pika-next')) {
|
||||
self.nextMonth();
|
||||
}
|
||||
}
|
||||
self._c = true;
|
||||
if (!hasClass(target, 'pika-select')) {
|
||||
if (e.preventDefault) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
} else {
|
||||
e.returnValue = false;
|
||||
e.cancelBubble = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
self._onChange = function(e)
|
||||
{
|
||||
e = e || window.event;
|
||||
var target = e.target || e.srcElement;
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
if (hasClass(target, 'pika-select-month')) {
|
||||
self.gotoMonth(target.value);
|
||||
}
|
||||
else if (hasClass(target, 'pika-select-year')) {
|
||||
self.gotoYear(target.value);
|
||||
}
|
||||
};
|
||||
|
||||
self._onInputChange = function(e)
|
||||
{
|
||||
var date;
|
||||
|
||||
if (e.firedBy === self) {
|
||||
return;
|
||||
}
|
||||
if (hasMoment) {
|
||||
date = moment(opts.field.value, opts.format);
|
||||
date = (date && date.isValid()) ? date.toDate() : null;
|
||||
}
|
||||
else {
|
||||
date = parseDate(opts.field.value);
|
||||
}
|
||||
self.setDate(isDate(date) ? date : null);
|
||||
if (!self._v) {
|
||||
self.show();
|
||||
}
|
||||
};
|
||||
|
||||
self._onInputFocus = function()
|
||||
{
|
||||
self.show();
|
||||
};
|
||||
|
||||
self._onInputClick = function()
|
||||
{
|
||||
self.show();
|
||||
};
|
||||
|
||||
self._onInputBlur = function()
|
||||
{
|
||||
if (!self._c) {
|
||||
self._b = sto(function() {
|
||||
self.hide();
|
||||
}, 50);
|
||||
}
|
||||
self._c = false;
|
||||
};
|
||||
|
||||
self._onClick = function(e)
|
||||
{
|
||||
e = e || window.event;
|
||||
var target = e.target || e.srcElement,
|
||||
pEl = target;
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
if (!hasEventListeners && hasClass(target, 'pika-select')) {
|
||||
if (!target.onchange) {
|
||||
target.setAttribute('onchange', 'return;');
|
||||
addEvent(target, 'change', self._onChange);
|
||||
}
|
||||
}
|
||||
do {
|
||||
if (hasClass(pEl, 'pika-single')) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
while ((pEl = pEl.parentNode));
|
||||
if (self._v && target !== opts.trigger) {
|
||||
self.hide();
|
||||
}
|
||||
};
|
||||
|
||||
self.el = document.createElement('div');
|
||||
self.el.className = 'pika-single' + (opts.isRTL ? ' is-rtl' : '');
|
||||
|
||||
addEvent(self.el, 'mousedown', self._onMouseDown, true);
|
||||
addEvent(self.el, 'change', self._onChange);
|
||||
|
||||
if (opts.field) {
|
||||
if (opts.bound) {
|
||||
document.body.appendChild(self.el);
|
||||
} else {
|
||||
opts.field.parentNode.insertBefore(self.el, opts.field.nextSibling);
|
||||
}
|
||||
addEvent(opts.field, 'change', self._onInputChange);
|
||||
|
||||
if (!opts.defaultDate) {
|
||||
if (hasMoment && opts.field.value) {
|
||||
opts.defaultDate = moment(opts.field.value, opts.format).toDate();
|
||||
} else {
|
||||
opts.defaultDate = parseDate(opts.field.value);
|
||||
}
|
||||
opts.setDefaultDate = true;
|
||||
}
|
||||
}
|
||||
|
||||
var defDate = opts.defaultDate;
|
||||
|
||||
if (isDate(defDate)) {
|
||||
if (opts.setDefaultDate) {
|
||||
self.setDate(defDate, true);
|
||||
} else {
|
||||
self.gotoDate(defDate);
|
||||
}
|
||||
} else {
|
||||
self.gotoDate(new Date());
|
||||
}
|
||||
|
||||
if (opts.bound) {
|
||||
this.hide();
|
||||
self.el.className += ' is-bound';
|
||||
addEvent(opts.trigger, 'click', self._onInputClick);
|
||||
addEvent(opts.trigger, 'focus', self._onInputFocus);
|
||||
addEvent(opts.trigger, 'blur', self._onInputBlur);
|
||||
} else {
|
||||
this.show();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* public Pikaday API
|
||||
*/
|
||||
Pikaday.prototype = {
|
||||
|
||||
|
||||
/**
|
||||
* configure functionality
|
||||
*/
|
||||
config: function(options)
|
||||
{
|
||||
if (!this._o) {
|
||||
this._o = extend({}, defaults, true);
|
||||
}
|
||||
|
||||
var opts = extend(this._o, options, true);
|
||||
|
||||
opts.isRTL = !!opts.isRTL;
|
||||
|
||||
opts.field = (opts.field && opts.field.nodeName) ? opts.field : null;
|
||||
|
||||
opts.bound = !!(opts.bound !== undefined ? opts.field && opts.bound : opts.field);
|
||||
|
||||
opts.trigger = (opts.trigger && opts.trigger.nodeName) ? opts.trigger : opts.field;
|
||||
|
||||
var nom = parseInt(opts.numberOfMonths, 10) || 1;
|
||||
opts.numberOfMonths = nom > 4 ? 4 : nom;
|
||||
|
||||
if (!isDate(opts.minDate)) {
|
||||
opts.minDate = false;
|
||||
}
|
||||
if (!isDate(opts.maxDate)) {
|
||||
opts.maxDate = false;
|
||||
}
|
||||
if ((opts.minDate && opts.maxDate) && opts.maxDate < opts.minDate) {
|
||||
opts.maxDate = opts.minDate = false;
|
||||
}
|
||||
if (opts.minDate) {
|
||||
setToStartOfDay(opts.minDate);
|
||||
opts.minYear = opts.minDate.getFullYear();
|
||||
opts.minMonth = opts.minDate.getMonth();
|
||||
}
|
||||
if (opts.maxDate) {
|
||||
setToStartOfDay(opts.maxDate);
|
||||
opts.maxYear = opts.maxDate.getFullYear();
|
||||
opts.maxMonth = opts.maxDate.getMonth();
|
||||
}
|
||||
|
||||
if (isArray(opts.yearRange)) {
|
||||
var fallback = new Date().getFullYear() - 10;
|
||||
opts.yearRange[0] = parseInt(opts.yearRange[0], 10) || fallback;
|
||||
opts.yearRange[1] = parseInt(opts.yearRange[1], 10) || fallback;
|
||||
} else {
|
||||
opts.yearRange = Math.abs(parseInt(opts.yearRange, 10)) || defaults.yearRange;
|
||||
if (opts.yearRange > 100) {
|
||||
opts.yearRange = 100;
|
||||
}
|
||||
}
|
||||
|
||||
return opts;
|
||||
},
|
||||
|
||||
/**
|
||||
* return a formatted string of the current selection (using Moment.js if available)
|
||||
*/
|
||||
toString: function(format)
|
||||
{
|
||||
if(!isDate(this._d)) return '';
|
||||
var y = this._d.getFullYear();
|
||||
var m = this._d.getMonth() + 1;
|
||||
var d = this._d.getDate();
|
||||
m = m < 10 ? '0' + m : m;
|
||||
d = d < 10 ? '0' + d : d;
|
||||
return !isDate(this._d) ? '' : hasMoment ? moment(this._d).format(format || this._o.format) : (y + '-' + m + '-' + d);
|
||||
},
|
||||
|
||||
/**
|
||||
* return a Moment.js object of the current selection (if available)
|
||||
*/
|
||||
getMoment: function()
|
||||
{
|
||||
return hasMoment ? moment(this._d) : null;
|
||||
},
|
||||
|
||||
/**
|
||||
* set the current selection from a Moment.js object (if available)
|
||||
*/
|
||||
setMoment: function(date)
|
||||
{
|
||||
if (hasMoment && moment.isMoment(date)) {
|
||||
this.setDate(date.toDate());
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* return a Date object of the current selection
|
||||
*/
|
||||
getDate: function()
|
||||
{
|
||||
return isDate(this._d) ? new Date(this._d.getTime()) : null;
|
||||
},
|
||||
|
||||
/**
|
||||
* set the current selection
|
||||
*/
|
||||
setDate: function(date, preventOnSelect)
|
||||
{
|
||||
if (!date) {
|
||||
this._d = null;
|
||||
return this.draw();
|
||||
}
|
||||
if (typeof date === 'string') {
|
||||
date = parseDate(date);
|
||||
}
|
||||
if (!isDate(date)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var min = this._o.minDate,
|
||||
max = this._o.maxDate;
|
||||
|
||||
if (isDate(min) && date < min) {
|
||||
date = min;
|
||||
} else if (isDate(max) && date > max) {
|
||||
date = max;
|
||||
}
|
||||
|
||||
this._d = new Date(date.getTime());
|
||||
setToStartOfDay(this._d);
|
||||
this.gotoDate(this._d);
|
||||
|
||||
if (this._o.field) {
|
||||
this._o.field.value = this.toString();
|
||||
fireEvent(this._o.field, 'change', { firedBy: this });
|
||||
}
|
||||
if (!preventOnSelect && typeof this._o.onSelect === 'function') {
|
||||
this._o.onSelect.call(this, this.getDate());
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* change view to a specific date
|
||||
*/
|
||||
gotoDate: function(date)
|
||||
{
|
||||
if (!isDate(date)) {
|
||||
return;
|
||||
}
|
||||
this._y = date.getFullYear();
|
||||
this._m = date.getMonth();
|
||||
this.draw();
|
||||
},
|
||||
|
||||
gotoToday: function()
|
||||
{
|
||||
this.gotoDate(new Date());
|
||||
},
|
||||
|
||||
/**
|
||||
* change view to a specific month (zero-index, e.g. 0: January)
|
||||
*/
|
||||
gotoMonth: function(month)
|
||||
{
|
||||
if (!isNaN( (month = parseInt(month, 10)) )) {
|
||||
this._m = month < 0 ? 0 : month > 11 ? 11 : month;
|
||||
this.draw();
|
||||
}
|
||||
},
|
||||
|
||||
nextMonth: function()
|
||||
{
|
||||
if (++this._m > 11) {
|
||||
this._m = 0;
|
||||
this._y++;
|
||||
}
|
||||
this.draw();
|
||||
},
|
||||
|
||||
prevMonth: function()
|
||||
{
|
||||
if (--this._m < 0) {
|
||||
this._m = 11;
|
||||
this._y--;
|
||||
}
|
||||
this.draw();
|
||||
},
|
||||
|
||||
/**
|
||||
* change view to a specific full year (e.g. "2012")
|
||||
*/
|
||||
gotoYear: function(year)
|
||||
{
|
||||
if (!isNaN(year)) {
|
||||
this._y = parseInt(year, 10);
|
||||
this.draw();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* change the minDate
|
||||
*/
|
||||
setMinDate: function(value)
|
||||
{
|
||||
this._o.minDate = value;
|
||||
},
|
||||
|
||||
/**
|
||||
* change the maxDate
|
||||
*/
|
||||
setMaxDate: function(value)
|
||||
{
|
||||
this._o.maxDate = value;
|
||||
},
|
||||
|
||||
/**
|
||||
* refresh the HTML
|
||||
*/
|
||||
draw: function(force)
|
||||
{
|
||||
if (!this._v && !force) {
|
||||
return;
|
||||
}
|
||||
var opts = this._o,
|
||||
minYear = opts.minYear,
|
||||
maxYear = opts.maxYear,
|
||||
minMonth = opts.minMonth,
|
||||
maxMonth = opts.maxMonth;
|
||||
|
||||
if (this._y <= minYear) {
|
||||
this._y = minYear;
|
||||
if (!isNaN(minMonth) && this._m < minMonth) {
|
||||
this._m = minMonth;
|
||||
}
|
||||
}
|
||||
if (this._y >= maxYear) {
|
||||
this._y = maxYear;
|
||||
if (!isNaN(maxMonth) && this._m > maxMonth) {
|
||||
this._m = maxMonth;
|
||||
}
|
||||
}
|
||||
|
||||
this.el.innerHTML = renderTitle(this) + this.render(this._y, this._m);
|
||||
|
||||
if (opts.bound) {
|
||||
this.adjustPosition();
|
||||
if(opts.field.type !== 'hidden') {
|
||||
sto(function() {
|
||||
opts.trigger.focus();
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof this._o.onDraw === 'function') {
|
||||
var self = this;
|
||||
sto(function() {
|
||||
self._o.onDraw.call(self);
|
||||
}, 0);
|
||||
}
|
||||
},
|
||||
|
||||
adjustPosition: function()
|
||||
{
|
||||
var field = this._o.trigger, pEl = field,
|
||||
width = this.el.offsetWidth, height = this.el.offsetHeight,
|
||||
viewportWidth = window.innerWidth || document.documentElement.clientWidth,
|
||||
viewportHeight = window.innerHeight || document.documentElement.clientHeight,
|
||||
scrollTop = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop,
|
||||
left, top, clientRect;
|
||||
|
||||
addClass(this.el, 'is-hidden');//计算定位前先隐藏弹出层,避免影响计算结果
|
||||
if (typeof field.getBoundingClientRect === 'function') {
|
||||
clientRect = field.getBoundingClientRect();
|
||||
left = clientRect.left + window.pageXOffset;
|
||||
top = clientRect.bottom + window.pageYOffset;
|
||||
} else {
|
||||
left = pEl.offsetLeft;
|
||||
top = pEl.offsetTop + pEl.offsetHeight;
|
||||
while((pEl = pEl.offsetParent)) {
|
||||
left += pEl.offsetLeft;
|
||||
top += pEl.offsetTop;
|
||||
}
|
||||
}
|
||||
removeClass(this.el, 'is-hidden');//计算结束恢复弹出层
|
||||
|
||||
if (left + width > viewportWidth) {
|
||||
left = left - width + field.offsetWidth;
|
||||
}
|
||||
if (top + height > viewportHeight + scrollTop) {
|
||||
top = top - height - field.offsetHeight;
|
||||
}
|
||||
this.el.style.cssText = 'position:absolute;left:' + left + 'px;top:' + top + 'px;';
|
||||
},
|
||||
|
||||
/**
|
||||
* render HTML for a particular month
|
||||
*/
|
||||
render: function(year, month)
|
||||
{
|
||||
var opts = this._o,
|
||||
now = new Date(),
|
||||
days = getDaysInMonth(year, month),
|
||||
before = new Date(year, month, 1).getDay(),
|
||||
data = [],
|
||||
row = [];
|
||||
setToStartOfDay(now);
|
||||
if (opts.firstDay > 0) {
|
||||
before -= opts.firstDay;
|
||||
if (before < 0) {
|
||||
before += 7;
|
||||
}
|
||||
}
|
||||
var cells = days + before,
|
||||
after = cells;
|
||||
while(after > 7) {
|
||||
after -= 7;
|
||||
}
|
||||
cells += 7 - after;
|
||||
for (var i = 0, r = 0; i < cells; i++)
|
||||
{
|
||||
var day = new Date(year, month, 1 + (i - before)),
|
||||
isDisabled = (opts.minDate && day < opts.minDate) || (opts.maxDate && day > opts.maxDate),
|
||||
isSelected = isDate(this._d) ? compareDates(day, this._d) : false,
|
||||
isToday = compareDates(day, now),
|
||||
isEmpty = i < before || i >= (days + before);
|
||||
|
||||
row.push(renderDay(1 + (i - before), isSelected, isToday, isDisabled, isEmpty));
|
||||
|
||||
if (++r === 7) {
|
||||
data.push(renderRow(row, opts.isRTL));
|
||||
row = [];
|
||||
r = 0;
|
||||
}
|
||||
}
|
||||
return renderTable(opts, data);
|
||||
},
|
||||
|
||||
isVisible: function()
|
||||
{
|
||||
return this._v;
|
||||
},
|
||||
|
||||
show: function()
|
||||
{
|
||||
if (!this._v) {
|
||||
if (this._o.bound) {
|
||||
addEvent(document, 'click', this._onClick);
|
||||
}
|
||||
removeClass(this.el, 'is-hidden');
|
||||
this._v = true;
|
||||
this.draw();
|
||||
if (typeof this._o.onOpen === 'function') {
|
||||
this._o.onOpen.call(this);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
hide: function()
|
||||
{
|
||||
var v = this._v;
|
||||
if (v !== false) {
|
||||
if (this._o.bound) {
|
||||
removeEvent(document, 'click', this._onClick);
|
||||
}
|
||||
this.el.style.cssText = '';
|
||||
addClass(this.el, 'is-hidden');
|
||||
this._v = false;
|
||||
if (v !== undefined && typeof this._o.onClose === 'function') {
|
||||
this._o.onClose.call(this);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* GAME OVER
|
||||
*/
|
||||
destroy: function()
|
||||
{
|
||||
this.hide();
|
||||
removeEvent(this.el, 'mousedown', this._onMouseDown, true);
|
||||
removeEvent(this.el, 'change', this._onChange);
|
||||
if (this._o.field) {
|
||||
removeEvent(this._o.field, 'change', this._onInputChange);
|
||||
if (this._o.bound) {
|
||||
removeEvent(this._o.trigger, 'click', this._onInputClick);
|
||||
removeEvent(this._o.trigger, 'focus', this._onInputFocus);
|
||||
removeEvent(this._o.trigger, 'blur', this._onInputBlur);
|
||||
}
|
||||
}
|
||||
if (this.el.parentNode) {
|
||||
this.el.parentNode.removeChild(this.el);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
window.Pikaday = Pikaday;
|
||||
|
||||
})(window);
|
||||
|
||||
/*!
|
||||
* Pikaday jQuery plugin.
|
||||
*/
|
||||
(function (root, factory) {
|
||||
if (root.define && typeof define === 'function') {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(function(require){
|
||||
//require("./pikaday.css");
|
||||
factory( require('jquery'), root.Pikaday );
|
||||
});
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(root.jQuery, root.Pikaday);
|
||||
}
|
||||
}(this, function ($, Pikaday) {
|
||||
if (!$) return;
|
||||
$.fn.datepicker = $.fn.pikaday = function() {
|
||||
var args = arguments;
|
||||
|
||||
if (!args || !args.length) {
|
||||
args = [{ }];
|
||||
}
|
||||
|
||||
return this.each(function()
|
||||
{
|
||||
var self = $(this),
|
||||
plugin = self.data('pikaday');
|
||||
|
||||
if (!(plugin instanceof Pikaday)) {
|
||||
if (typeof args[0] === 'object') {
|
||||
var options = $.extend({}, args[0]);
|
||||
options.field = self[0];
|
||||
self.data('pikaday', new Pikaday(options));
|
||||
}
|
||||
} else {
|
||||
if (typeof args[0] === 'string' && typeof plugin[args[0]] === 'function') {
|
||||
plugin[args[0]].apply(plugin, Array.prototype.slice.call(args,1));
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
}));
|
||||
21
statics/js/common/plugins/fileupload/css/demo-ie8.css
Executable file
21
statics/js/common/plugins/fileupload/css/demo-ie8.css
Executable file
@@ -0,0 +1,21 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
* jQuery File Upload Demo CSS Fixes for IE<9 1.0.0
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
.navigation {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 1em 0;
|
||||
}
|
||||
.navigation li {
|
||||
display: inline;
|
||||
margin-right: 10px;
|
||||
}
|
||||
67
statics/js/common/plugins/fileupload/css/demo.css
Executable file
67
statics/js/common/plugins/fileupload/css/demo.css
Executable file
@@ -0,0 +1,67 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
* jQuery File Upload Demo CSS 1.1.0
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
body {
|
||||
max-width: 750px;
|
||||
margin: 0 auto;
|
||||
padding: 1em;
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
|
||||
font-size: 1em;
|
||||
line-height: 1.4em;
|
||||
background: #222;
|
||||
color: #fff;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-ms-text-size-adjust: 100%;
|
||||
}
|
||||
a {
|
||||
color: orange;
|
||||
text-decoration: none;
|
||||
}
|
||||
img {
|
||||
border: 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
h1 {
|
||||
line-height: 1em;
|
||||
}
|
||||
blockquote {
|
||||
padding: 0 0 0 15px;
|
||||
margin: 0 0 20px;
|
||||
border-left: 5px solid #eee;
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.fileupload-progress {
|
||||
margin: 10px 0;
|
||||
}
|
||||
.fileupload-progress .progress-extended {
|
||||
margin-top: 5px;
|
||||
}
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
@media (min-width: 481px) {
|
||||
.navigation {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
.navigation li {
|
||||
display: inline-block;
|
||||
}
|
||||
.navigation li:not(:first-child):before {
|
||||
content: "| ";
|
||||
}
|
||||
}
|
||||
22
statics/js/common/plugins/fileupload/css/jquery.fileupload-noscript.css
Executable file
22
statics/js/common/plugins/fileupload/css/jquery.fileupload-noscript.css
Executable file
@@ -0,0 +1,22 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
* jQuery File Upload Plugin NoScript CSS 1.2.0
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
.fileinput-button input {
|
||||
position: static;
|
||||
opacity: 1;
|
||||
filter: none;
|
||||
font-size: inherit;
|
||||
direction: inherit;
|
||||
}
|
||||
.fileinput-button span {
|
||||
display: none;
|
||||
}
|
||||
17
statics/js/common/plugins/fileupload/css/jquery.fileupload-ui-noscript.css
Executable file
17
statics/js/common/plugins/fileupload/css/jquery.fileupload-ui-noscript.css
Executable file
@@ -0,0 +1,17 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
* jQuery File Upload UI Plugin NoScript CSS 8.8.5
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2012, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
.fileinput-button i,
|
||||
.fileupload-buttonbar .delete,
|
||||
.fileupload-buttonbar .toggle {
|
||||
display: none;
|
||||
}
|
||||
57
statics/js/common/plugins/fileupload/css/jquery.fileupload-ui.css
Executable file
57
statics/js/common/plugins/fileupload/css/jquery.fileupload-ui.css
Executable file
@@ -0,0 +1,57 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
* jQuery File Upload UI Plugin CSS 9.0.0
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
.fileupload-buttonbar .btn,
|
||||
.fileupload-buttonbar .toggle {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.progress-animated .progress-bar,
|
||||
.progress-animated .bar {
|
||||
background: url("../img/progressbar.gif") !important;
|
||||
filter: none;
|
||||
}
|
||||
.fileupload-process {
|
||||
float: right;
|
||||
display: none;
|
||||
}
|
||||
.fileupload-processing .fileupload-process,
|
||||
.files .processing .preview {
|
||||
display: block;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background: url("../img/loading.gif") center no-repeat;
|
||||
background-size: contain;
|
||||
}
|
||||
.files audio,
|
||||
.files video {
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.fileupload-buttonbar .toggle,
|
||||
.files .toggle,
|
||||
.files .btn span {
|
||||
display: none;
|
||||
}
|
||||
.files .name {
|
||||
width: 80px;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.files audio,
|
||||
.files video {
|
||||
max-width: 80px;
|
||||
}
|
||||
.files img,
|
||||
.files canvas {
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
36
statics/js/common/plugins/fileupload/css/jquery.fileupload.css
Executable file
36
statics/js/common/plugins/fileupload/css/jquery.fileupload.css
Executable file
@@ -0,0 +1,36 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
* jQuery File Upload Plugin CSS 1.3.0
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
.fileinput-button {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.fileinput-button input {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin: 0;
|
||||
opacity: 0;
|
||||
-ms-filter: 'alpha(opacity=0)';
|
||||
font-size: 200px;
|
||||
direction: ltr;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Fixes for IE < 8 */
|
||||
@media screen\9 {
|
||||
.fileinput-button input {
|
||||
filter: alpha(opacity=0);
|
||||
font-size: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
15
statics/js/common/plugins/fileupload/css/style.css
Executable file
15
statics/js/common/plugins/fileupload/css/style.css
Executable file
@@ -0,0 +1,15 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
* jQuery File Upload Plugin CSS Example 8.8.2
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
body {
|
||||
padding-top: 60px;
|
||||
}
|
||||
BIN
statics/js/common/plugins/fileupload/img/loading.gif
Executable file
BIN
statics/js/common/plugins/fileupload/img/loading.gif
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
BIN
statics/js/common/plugins/fileupload/img/progressbar.gif
Executable file
BIN
statics/js/common/plugins/fileupload/img/progressbar.gif
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
101
statics/js/common/plugins/fileupload/js/app.js
Executable file
101
statics/js/common/plugins/fileupload/js/app.js
Executable file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* jQuery File Upload Plugin Angular JS Example 1.2.1
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* jshint nomen:false */
|
||||
/* global window, angular */
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var isOnGitHub = window.location.hostname === 'blueimp.github.io',
|
||||
url = isOnGitHub ? '//jquery-file-upload.appspot.com/' : 'server/php/';
|
||||
|
||||
angular.module('demo', [
|
||||
'blueimp.fileupload'
|
||||
])
|
||||
.config([
|
||||
'$httpProvider', 'fileUploadProvider',
|
||||
function ($httpProvider, fileUploadProvider) {
|
||||
delete $httpProvider.defaults.headers.common['X-Requested-With'];
|
||||
fileUploadProvider.defaults.redirect = window.location.href.replace(
|
||||
/\/[^\/]*$/,
|
||||
'/cors/result.html?%s'
|
||||
);
|
||||
if (isOnGitHub) {
|
||||
// Demo settings:
|
||||
angular.extend(fileUploadProvider.defaults, {
|
||||
// Enable image resizing, except for Android and Opera,
|
||||
// which actually support image resizing, but fail to
|
||||
// send Blob objects via XHR requests:
|
||||
disableImageResize: /Android(?!.*Chrome)|Opera/
|
||||
.test(window.navigator.userAgent),
|
||||
maxFileSize: 5000000,
|
||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i
|
||||
});
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
.controller('DemoFileUploadController', [
|
||||
'$scope', '$http', '$filter', '$window',
|
||||
function ($scope, $http) {
|
||||
$scope.options = {
|
||||
url: url
|
||||
};
|
||||
if (!isOnGitHub) {
|
||||
$scope.loadingFiles = true;
|
||||
$http.get(url)
|
||||
.then(
|
||||
function (response) {
|
||||
$scope.loadingFiles = false;
|
||||
$scope.queue = response.data.files || [];
|
||||
},
|
||||
function () {
|
||||
$scope.loadingFiles = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
.controller('FileDestroyController', [
|
||||
'$scope', '$http',
|
||||
function ($scope, $http) {
|
||||
var file = $scope.file,
|
||||
state;
|
||||
if (file.url) {
|
||||
file.$state = function () {
|
||||
return state;
|
||||
};
|
||||
file.$destroy = function () {
|
||||
state = 'pending';
|
||||
return $http({
|
||||
url: file.deleteUrl,
|
||||
method: file.deleteType
|
||||
}).then(
|
||||
function () {
|
||||
state = 'resolved';
|
||||
$scope.clear(file);
|
||||
},
|
||||
function () {
|
||||
state = 'rejected';
|
||||
}
|
||||
);
|
||||
};
|
||||
} else if (!file.$cancel && !file._index) {
|
||||
file.$cancel = function () {
|
||||
$scope.clear(file);
|
||||
};
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
}());
|
||||
120
statics/js/common/plugins/fileupload/js/cors/jquery.postmessage-transport.js
Executable file
120
statics/js/common/plugins/fileupload/js/cors/jquery.postmessage-transport.js
Executable file
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* jQuery postMessage Transport Plugin 1.1.2
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* global define, require, window, document */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
var counter = 0,
|
||||
names = [
|
||||
'accepts',
|
||||
'cache',
|
||||
'contents',
|
||||
'contentType',
|
||||
'crossDomain',
|
||||
'data',
|
||||
'dataType',
|
||||
'headers',
|
||||
'ifModified',
|
||||
'mimeType',
|
||||
'password',
|
||||
'processData',
|
||||
'timeout',
|
||||
'traditional',
|
||||
'type',
|
||||
'url',
|
||||
'username'
|
||||
],
|
||||
convert = function (p) {
|
||||
return p;
|
||||
};
|
||||
|
||||
$.ajaxSetup({
|
||||
converters: {
|
||||
'postmessage text': convert,
|
||||
'postmessage json': convert,
|
||||
'postmessage html': convert
|
||||
}
|
||||
});
|
||||
|
||||
$.ajaxTransport('postmessage', function (options) {
|
||||
if (options.postMessage && window.postMessage) {
|
||||
var iframe,
|
||||
loc = $('<a>').prop('href', options.postMessage)[0],
|
||||
target = loc.protocol + '//' + loc.host,
|
||||
xhrUpload = options.xhr().upload;
|
||||
return {
|
||||
send: function (_, completeCallback) {
|
||||
counter += 1;
|
||||
var message = {
|
||||
id: 'postmessage-transport-' + counter
|
||||
},
|
||||
eventName = 'message.' + message.id;
|
||||
iframe = $(
|
||||
'<iframe style="display:none;" src="' +
|
||||
options.postMessage + '" name="' +
|
||||
message.id + '"></iframe>'
|
||||
).bind('load', function () {
|
||||
$.each(names, function (i, name) {
|
||||
message[name] = options[name];
|
||||
});
|
||||
message.dataType = message.dataType.replace('postmessage ', '');
|
||||
$(window).bind(eventName, function (e) {
|
||||
e = e.originalEvent;
|
||||
var data = e.data,
|
||||
ev;
|
||||
if (e.origin === target && data.id === message.id) {
|
||||
if (data.type === 'progress') {
|
||||
ev = document.createEvent('Event');
|
||||
ev.initEvent(data.type, false, true);
|
||||
$.extend(ev, data);
|
||||
xhrUpload.dispatchEvent(ev);
|
||||
} else {
|
||||
completeCallback(
|
||||
data.status,
|
||||
data.statusText,
|
||||
{postmessage: data.result},
|
||||
data.headers
|
||||
);
|
||||
iframe.remove();
|
||||
$(window).unbind(eventName);
|
||||
}
|
||||
}
|
||||
});
|
||||
iframe[0].contentWindow.postMessage(
|
||||
message,
|
||||
target
|
||||
);
|
||||
}).appendTo(document.body);
|
||||
},
|
||||
abort: function () {
|
||||
if (iframe) {
|
||||
iframe.remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
}));
|
||||
89
statics/js/common/plugins/fileupload/js/cors/jquery.xdr-transport.js
Executable file
89
statics/js/common/plugins/fileupload/js/cors/jquery.xdr-transport.js
Executable file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* jQuery XDomainRequest Transport Plugin 1.1.4
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*
|
||||
* Based on Julian Aubourg's ajaxHooks xdr.js:
|
||||
* https://github.com/jaubourg/ajaxHooks/
|
||||
*/
|
||||
|
||||
/* global define, require, window, XDomainRequest */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
if (window.XDomainRequest && !$.support.cors) {
|
||||
$.ajaxTransport(function (s) {
|
||||
if (s.crossDomain && s.async) {
|
||||
if (s.timeout) {
|
||||
s.xdrTimeout = s.timeout;
|
||||
delete s.timeout;
|
||||
}
|
||||
var xdr;
|
||||
return {
|
||||
send: function (headers, completeCallback) {
|
||||
var addParamChar = /\?/.test(s.url) ? '&' : '?';
|
||||
function callback(status, statusText, responses, responseHeaders) {
|
||||
xdr.onload = xdr.onerror = xdr.ontimeout = $.noop;
|
||||
xdr = null;
|
||||
completeCallback(status, statusText, responses, responseHeaders);
|
||||
}
|
||||
xdr = new XDomainRequest();
|
||||
// XDomainRequest only supports GET and POST:
|
||||
if (s.type === 'DELETE') {
|
||||
s.url = s.url + addParamChar + '_method=DELETE';
|
||||
s.type = 'POST';
|
||||
} else if (s.type === 'PUT') {
|
||||
s.url = s.url + addParamChar + '_method=PUT';
|
||||
s.type = 'POST';
|
||||
} else if (s.type === 'PATCH') {
|
||||
s.url = s.url + addParamChar + '_method=PATCH';
|
||||
s.type = 'POST';
|
||||
}
|
||||
xdr.open(s.type, s.url);
|
||||
xdr.onload = function () {
|
||||
callback(
|
||||
200,
|
||||
'OK',
|
||||
{text: xdr.responseText},
|
||||
'Content-Type: ' + xdr.contentType
|
||||
);
|
||||
};
|
||||
xdr.onerror = function () {
|
||||
callback(404, 'Not Found');
|
||||
};
|
||||
if (s.xdrTimeout) {
|
||||
xdr.ontimeout = function () {
|
||||
callback(0, 'timeout');
|
||||
};
|
||||
xdr.timeout = s.xdrTimeout;
|
||||
}
|
||||
xdr.send((s.hasContent && s.data) || null);
|
||||
},
|
||||
abort: function () {
|
||||
if (xdr) {
|
||||
xdr.onerror = $.noop();
|
||||
xdr.abort();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
}));
|
||||
429
statics/js/common/plugins/fileupload/js/jquery.fileupload-angular.js
vendored
Executable file
429
statics/js/common/plugins/fileupload/js/jquery.fileupload-angular.js
vendored
Executable file
@@ -0,0 +1,429 @@
|
||||
/*
|
||||
* jQuery File Upload AngularJS Plugin 2.2.0
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* jshint nomen:false */
|
||||
/* global define, angular */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery',
|
||||
'angular',
|
||||
'./jquery.fileupload-image',
|
||||
'./jquery.fileupload-audio',
|
||||
'./jquery.fileupload-video',
|
||||
'./jquery.fileupload-validate'
|
||||
], factory);
|
||||
} else {
|
||||
factory();
|
||||
}
|
||||
}(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('blueimp.fileupload', [])
|
||||
|
||||
// The fileUpload service provides configuration options
|
||||
// for the fileUpload directive and default handlers for
|
||||
// File Upload events:
|
||||
.provider('fileUpload', function () {
|
||||
var scopeEvalAsync = function (expression) {
|
||||
var scope = angular.element(this)
|
||||
.fileupload('option', 'scope');
|
||||
// Schedule a new $digest cycle if not already inside of one
|
||||
// and evaluate the given expression:
|
||||
scope.$evalAsync(expression);
|
||||
},
|
||||
addFileMethods = function (scope, data) {
|
||||
var files = data.files,
|
||||
file = files[0];
|
||||
angular.forEach(files, function (file, index) {
|
||||
file._index = index;
|
||||
file.$state = function () {
|
||||
return data.state();
|
||||
};
|
||||
file.$processing = function () {
|
||||
return data.processing();
|
||||
};
|
||||
file.$progress = function () {
|
||||
return data.progress();
|
||||
};
|
||||
file.$response = function () {
|
||||
return data.response();
|
||||
};
|
||||
});
|
||||
file.$submit = function () {
|
||||
if (!file.error) {
|
||||
return data.submit();
|
||||
}
|
||||
};
|
||||
file.$cancel = function () {
|
||||
return data.abort();
|
||||
};
|
||||
},
|
||||
$config;
|
||||
$config = this.defaults = {
|
||||
handleResponse: function (e, data) {
|
||||
var files = data.result && data.result.files;
|
||||
if (files) {
|
||||
data.scope.replace(data.files, files);
|
||||
} else if (data.errorThrown ||
|
||||
data.textStatus === 'error') {
|
||||
data.files[0].error = data.errorThrown ||
|
||||
data.textStatus;
|
||||
}
|
||||
},
|
||||
add: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var scope = data.scope,
|
||||
filesCopy = [];
|
||||
angular.forEach(data.files, function (file) {
|
||||
filesCopy.push(file);
|
||||
});
|
||||
scope.$apply(function () {
|
||||
addFileMethods(scope, data);
|
||||
var method = scope.option('prependFiles') ?
|
||||
'unshift' : 'push';
|
||||
Array.prototype[method].apply(scope.queue, data.files);
|
||||
});
|
||||
data.process(function () {
|
||||
return scope.process(data);
|
||||
}).always(function () {
|
||||
scope.$apply(function () {
|
||||
addFileMethods(scope, data);
|
||||
scope.replace(filesCopy, data.files);
|
||||
});
|
||||
}).then(function () {
|
||||
if ((scope.option('autoUpload') ||
|
||||
data.autoUpload) &&
|
||||
data.autoUpload !== false) {
|
||||
data.submit();
|
||||
}
|
||||
});
|
||||
},
|
||||
progress: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
data.scope.$apply();
|
||||
},
|
||||
done: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var that = this;
|
||||
data.scope.$apply(function () {
|
||||
data.handleResponse.call(that, e, data);
|
||||
});
|
||||
},
|
||||
fail: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var that = this,
|
||||
scope = data.scope;
|
||||
if (data.errorThrown === 'abort') {
|
||||
scope.clear(data.files);
|
||||
return;
|
||||
}
|
||||
scope.$apply(function () {
|
||||
data.handleResponse.call(that, e, data);
|
||||
});
|
||||
},
|
||||
stop: scopeEvalAsync,
|
||||
processstart: scopeEvalAsync,
|
||||
processstop: scopeEvalAsync,
|
||||
getNumberOfFiles: function () {
|
||||
var scope = this.scope;
|
||||
return scope.queue.length - scope.processing();
|
||||
},
|
||||
dataType: 'json',
|
||||
autoUpload: false
|
||||
};
|
||||
this.$get = [
|
||||
function () {
|
||||
return {
|
||||
defaults: $config
|
||||
};
|
||||
}
|
||||
];
|
||||
})
|
||||
|
||||
// Format byte numbers to readable presentations:
|
||||
.provider('formatFileSizeFilter', function () {
|
||||
var $config = {
|
||||
// Byte units following the IEC format
|
||||
// http://en.wikipedia.org/wiki/Kilobyte
|
||||
units: [
|
||||
{size: 1000000000, suffix: ' GB'},
|
||||
{size: 1000000, suffix: ' MB'},
|
||||
{size: 1000, suffix: ' KB'}
|
||||
]
|
||||
};
|
||||
this.defaults = $config;
|
||||
this.$get = function () {
|
||||
return function (bytes) {
|
||||
if (!angular.isNumber(bytes)) {
|
||||
return '';
|
||||
}
|
||||
var unit = true,
|
||||
i = 0,
|
||||
prefix,
|
||||
suffix;
|
||||
while (unit) {
|
||||
unit = $config.units[i];
|
||||
prefix = unit.prefix || '';
|
||||
suffix = unit.suffix || '';
|
||||
if (i === $config.units.length - 1 || bytes >= unit.size) {
|
||||
return prefix + (bytes / unit.size).toFixed(2) + suffix;
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
// The FileUploadController initializes the fileupload widget and
|
||||
// provides scope methods to control the File Upload functionality:
|
||||
.controller('FileUploadController', [
|
||||
'$scope', '$element', '$attrs', '$window', 'fileUpload',
|
||||
function ($scope, $element, $attrs, $window, fileUpload) {
|
||||
var uploadMethods = {
|
||||
progress: function () {
|
||||
return $element.fileupload('progress');
|
||||
},
|
||||
active: function () {
|
||||
return $element.fileupload('active');
|
||||
},
|
||||
option: function (option, data) {
|
||||
if (arguments.length === 1) {
|
||||
return $element.fileupload('option', option);
|
||||
}
|
||||
$element.fileupload('option', option, data);
|
||||
},
|
||||
add: function (data) {
|
||||
return $element.fileupload('add', data);
|
||||
},
|
||||
send: function (data) {
|
||||
return $element.fileupload('send', data);
|
||||
},
|
||||
process: function (data) {
|
||||
return $element.fileupload('process', data);
|
||||
},
|
||||
processing: function (data) {
|
||||
return $element.fileupload('processing', data);
|
||||
}
|
||||
};
|
||||
$scope.disabled = !$window.jQuery.support.fileInput;
|
||||
$scope.queue = $scope.queue || [];
|
||||
$scope.clear = function (files) {
|
||||
var queue = this.queue,
|
||||
i = queue.length,
|
||||
file = files,
|
||||
length = 1;
|
||||
if (angular.isArray(files)) {
|
||||
file = files[0];
|
||||
length = files.length;
|
||||
}
|
||||
while (i) {
|
||||
i -= 1;
|
||||
if (queue[i] === file) {
|
||||
return queue.splice(i, length);
|
||||
}
|
||||
}
|
||||
};
|
||||
$scope.replace = function (oldFiles, newFiles) {
|
||||
var queue = this.queue,
|
||||
file = oldFiles[0],
|
||||
i,
|
||||
j;
|
||||
for (i = 0; i < queue.length; i += 1) {
|
||||
if (queue[i] === file) {
|
||||
for (j = 0; j < newFiles.length; j += 1) {
|
||||
queue[i + j] = newFiles[j];
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
$scope.applyOnQueue = function (method) {
|
||||
var list = this.queue.slice(0),
|
||||
i,
|
||||
file;
|
||||
for (i = 0; i < list.length; i += 1) {
|
||||
file = list[i];
|
||||
if (file[method]) {
|
||||
file[method]();
|
||||
}
|
||||
}
|
||||
};
|
||||
$scope.submit = function () {
|
||||
this.applyOnQueue('$submit');
|
||||
};
|
||||
$scope.cancel = function () {
|
||||
this.applyOnQueue('$cancel');
|
||||
};
|
||||
// Add upload methods to the scope:
|
||||
angular.extend($scope, uploadMethods);
|
||||
// The fileupload widget will initialize with
|
||||
// the options provided via "data-"-parameters,
|
||||
// as well as those given via options object:
|
||||
$element.fileupload(angular.extend(
|
||||
{scope: $scope},
|
||||
fileUpload.defaults
|
||||
)).on('fileuploadadd', function (e, data) {
|
||||
data.scope = $scope;
|
||||
}).on('fileuploadfail', function (e, data) {
|
||||
if (data.errorThrown === 'abort') {
|
||||
return;
|
||||
}
|
||||
if (data.dataType &&
|
||||
data.dataType.indexOf('json') === data.dataType.length - 4) {
|
||||
try {
|
||||
data.result = angular.fromJson(data.jqXHR.responseText);
|
||||
} catch (ignore) {}
|
||||
}
|
||||
}).on([
|
||||
'fileuploadadd',
|
||||
'fileuploadsubmit',
|
||||
'fileuploadsend',
|
||||
'fileuploaddone',
|
||||
'fileuploadfail',
|
||||
'fileuploadalways',
|
||||
'fileuploadprogress',
|
||||
'fileuploadprogressall',
|
||||
'fileuploadstart',
|
||||
'fileuploadstop',
|
||||
'fileuploadchange',
|
||||
'fileuploadpaste',
|
||||
'fileuploaddrop',
|
||||
'fileuploaddragover',
|
||||
'fileuploadchunksend',
|
||||
'fileuploadchunkdone',
|
||||
'fileuploadchunkfail',
|
||||
'fileuploadchunkalways',
|
||||
'fileuploadprocessstart',
|
||||
'fileuploadprocess',
|
||||
'fileuploadprocessdone',
|
||||
'fileuploadprocessfail',
|
||||
'fileuploadprocessalways',
|
||||
'fileuploadprocessstop'
|
||||
].join(' '), function (e, data) {
|
||||
if ($scope.$emit(e.type, data).defaultPrevented) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}).on('remove', function () {
|
||||
// Remove upload methods from the scope,
|
||||
// when the widget is removed:
|
||||
var method;
|
||||
for (method in uploadMethods) {
|
||||
if (uploadMethods.hasOwnProperty(method)) {
|
||||
delete $scope[method];
|
||||
}
|
||||
}
|
||||
});
|
||||
// Observe option changes:
|
||||
$scope.$watch(
|
||||
$attrs.fileUpload,
|
||||
function (newOptions) {
|
||||
if (newOptions) {
|
||||
$element.fileupload('option', newOptions);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
])
|
||||
|
||||
// Provide File Upload progress feedback:
|
||||
.controller('FileUploadProgressController', [
|
||||
'$scope', '$attrs', '$parse',
|
||||
function ($scope, $attrs, $parse) {
|
||||
var fn = $parse($attrs.fileUploadProgress),
|
||||
update = function () {
|
||||
var progress = fn($scope);
|
||||
if (!progress || !progress.total) {
|
||||
return;
|
||||
}
|
||||
$scope.num = Math.floor(
|
||||
progress.loaded / progress.total * 100
|
||||
);
|
||||
};
|
||||
update();
|
||||
$scope.$watch(
|
||||
$attrs.fileUploadProgress + '.loaded',
|
||||
function (newValue, oldValue) {
|
||||
if (newValue !== oldValue) {
|
||||
update();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
])
|
||||
|
||||
// Display File Upload previews:
|
||||
.controller('FileUploadPreviewController', [
|
||||
'$scope', '$element', '$attrs',
|
||||
function ($scope, $element, $attrs) {
|
||||
$scope.$watch(
|
||||
$attrs.fileUploadPreview + '.preview',
|
||||
function (preview) {
|
||||
$element.empty();
|
||||
if (preview) {
|
||||
$element.append(preview);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
])
|
||||
|
||||
.directive('fileUpload', function () {
|
||||
return {
|
||||
controller: 'FileUploadController',
|
||||
scope: true
|
||||
};
|
||||
})
|
||||
|
||||
.directive('fileUploadProgress', function () {
|
||||
return {
|
||||
controller: 'FileUploadProgressController',
|
||||
scope: true
|
||||
};
|
||||
})
|
||||
|
||||
.directive('fileUploadPreview', function () {
|
||||
return {
|
||||
controller: 'FileUploadPreviewController'
|
||||
};
|
||||
})
|
||||
|
||||
// Enhance the HTML5 download attribute to
|
||||
// allow drag&drop of files to the desktop:
|
||||
.directive('download', function () {
|
||||
return function (scope, elm) {
|
||||
elm.on('dragstart', function (e) {
|
||||
try {
|
||||
e.originalEvent.dataTransfer.setData(
|
||||
'DownloadURL',
|
||||
[
|
||||
'application/octet-stream',
|
||||
elm.prop('download'),
|
||||
elm.prop('href')
|
||||
].join(':')
|
||||
);
|
||||
} catch (ignore) {}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
}));
|
||||
112
statics/js/common/plugins/fileupload/js/jquery.fileupload-audio.js
vendored
Executable file
112
statics/js/common/plugins/fileupload/js/jquery.fileupload-audio.js
vendored
Executable file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* jQuery File Upload Audio Preview Plugin 1.0.4
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* jshint nomen:false */
|
||||
/* global define, require, window, document */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery',
|
||||
'load-image',
|
||||
'./jquery.fileupload-process'
|
||||
], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(
|
||||
require('jquery'),
|
||||
require('load-image')
|
||||
);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery,
|
||||
window.loadImage
|
||||
);
|
||||
}
|
||||
}(function ($, loadImage) {
|
||||
'use strict';
|
||||
|
||||
// Prepend to the default processQueue:
|
||||
$.blueimp.fileupload.prototype.options.processQueue.unshift(
|
||||
{
|
||||
action: 'loadAudio',
|
||||
// Use the action as prefix for the "@" options:
|
||||
prefix: true,
|
||||
fileTypes: '@',
|
||||
maxFileSize: '@',
|
||||
disabled: '@disableAudioPreview'
|
||||
},
|
||||
{
|
||||
action: 'setAudio',
|
||||
name: '@audioPreviewName',
|
||||
disabled: '@disableAudioPreview'
|
||||
}
|
||||
);
|
||||
|
||||
// The File Upload Audio Preview plugin extends the fileupload widget
|
||||
// with audio preview functionality:
|
||||
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
// The regular expression for the types of audio files to load,
|
||||
// matched against the file type:
|
||||
loadAudioFileTypes: /^audio\/.*$/
|
||||
},
|
||||
|
||||
_audioElement: document.createElement('audio'),
|
||||
|
||||
processActions: {
|
||||
|
||||
// Loads the audio file given via data.files and data.index
|
||||
// as audio element if the browser supports playing it.
|
||||
// Accepts the options fileTypes (regular expression)
|
||||
// and maxFileSize (integer) to limit the files to load:
|
||||
loadAudio: function (data, options) {
|
||||
if (options.disabled) {
|
||||
return data;
|
||||
}
|
||||
var file = data.files[data.index],
|
||||
url,
|
||||
audio;
|
||||
if (this._audioElement.canPlayType &&
|
||||
this._audioElement.canPlayType(file.type) &&
|
||||
($.type(options.maxFileSize) !== 'number' ||
|
||||
file.size <= options.maxFileSize) &&
|
||||
(!options.fileTypes ||
|
||||
options.fileTypes.test(file.type))) {
|
||||
url = loadImage.createObjectURL(file);
|
||||
if (url) {
|
||||
audio = this._audioElement.cloneNode(false);
|
||||
audio.src = url;
|
||||
audio.controls = true;
|
||||
data.audio = audio;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
// Sets the audio element as a property of the file object:
|
||||
setAudio: function (data, options) {
|
||||
if (data.audio && !options.disabled) {
|
||||
data.files[data.index][options.name || 'preview'] = data.audio;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
321
statics/js/common/plugins/fileupload/js/jquery.fileupload-image.js
vendored
Executable file
321
statics/js/common/plugins/fileupload/js/jquery.fileupload-image.js
vendored
Executable file
@@ -0,0 +1,321 @@
|
||||
/*
|
||||
* jQuery File Upload Image Preview & Resize Plugin 1.7.3
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* jshint nomen:false */
|
||||
/* global define, require, window, Blob */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery',
|
||||
'load-image',
|
||||
'load-image-meta',
|
||||
'load-image-exif',
|
||||
'load-image-ios',
|
||||
'canvas-to-blob',
|
||||
'./jquery.fileupload-process'
|
||||
], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(
|
||||
require('jquery'),
|
||||
require('load-image')
|
||||
);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery,
|
||||
window.loadImage
|
||||
);
|
||||
}
|
||||
}(function ($, loadImage) {
|
||||
'use strict';
|
||||
|
||||
// Prepend to the default processQueue:
|
||||
$.blueimp.fileupload.prototype.options.processQueue.unshift(
|
||||
{
|
||||
action: 'loadImageMetaData',
|
||||
disableImageHead: '@',
|
||||
disableExif: '@',
|
||||
disableExifThumbnail: '@',
|
||||
disableExifSub: '@',
|
||||
disableExifGps: '@',
|
||||
disabled: '@disableImageMetaDataLoad'
|
||||
},
|
||||
{
|
||||
action: 'loadImage',
|
||||
// Use the action as prefix for the "@" options:
|
||||
prefix: true,
|
||||
fileTypes: '@',
|
||||
maxFileSize: '@',
|
||||
noRevoke: '@',
|
||||
disabled: '@disableImageLoad'
|
||||
},
|
||||
{
|
||||
action: 'resizeImage',
|
||||
// Use "image" as prefix for the "@" options:
|
||||
prefix: 'image',
|
||||
maxWidth: '@',
|
||||
maxHeight: '@',
|
||||
minWidth: '@',
|
||||
minHeight: '@',
|
||||
crop: '@',
|
||||
orientation: '@',
|
||||
forceResize: '@',
|
||||
disabled: '@disableImageResize'
|
||||
},
|
||||
{
|
||||
action: 'saveImage',
|
||||
quality: '@imageQuality',
|
||||
type: '@imageType',
|
||||
disabled: '@disableImageResize'
|
||||
},
|
||||
{
|
||||
action: 'saveImageMetaData',
|
||||
disabled: '@disableImageMetaDataSave'
|
||||
},
|
||||
{
|
||||
action: 'resizeImage',
|
||||
// Use "preview" as prefix for the "@" options:
|
||||
prefix: 'preview',
|
||||
maxWidth: '@',
|
||||
maxHeight: '@',
|
||||
minWidth: '@',
|
||||
minHeight: '@',
|
||||
crop: '@',
|
||||
orientation: '@',
|
||||
thumbnail: '@',
|
||||
canvas: '@',
|
||||
disabled: '@disableImagePreview'
|
||||
},
|
||||
{
|
||||
action: 'setImage',
|
||||
name: '@imagePreviewName',
|
||||
disabled: '@disableImagePreview'
|
||||
},
|
||||
{
|
||||
action: 'deleteImageReferences',
|
||||
disabled: '@disableImageReferencesDeletion'
|
||||
}
|
||||
);
|
||||
|
||||
// The File Upload Resize plugin extends the fileupload widget
|
||||
// with image resize functionality:
|
||||
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
// The regular expression for the types of images to load:
|
||||
// matched against the file type:
|
||||
loadImageFileTypes: /^image\/(gif|jpeg|png|svg\+xml)$/,
|
||||
// The maximum file size of images to load:
|
||||
loadImageMaxFileSize: 10000000, // 10MB
|
||||
// The maximum width of resized images:
|
||||
imageMaxWidth: 1920,
|
||||
// The maximum height of resized images:
|
||||
imageMaxHeight: 1080,
|
||||
// Defines the image orientation (1-8) or takes the orientation
|
||||
// value from Exif data if set to true:
|
||||
imageOrientation: false,
|
||||
// Define if resized images should be cropped or only scaled:
|
||||
imageCrop: false,
|
||||
// Disable the resize image functionality by default:
|
||||
disableImageResize: true,
|
||||
// The maximum width of the preview images:
|
||||
previewMaxWidth: 80,
|
||||
// The maximum height of the preview images:
|
||||
previewMaxHeight: 80,
|
||||
// Defines the preview orientation (1-8) or takes the orientation
|
||||
// value from Exif data if set to true:
|
||||
previewOrientation: true,
|
||||
// Create the preview using the Exif data thumbnail:
|
||||
previewThumbnail: true,
|
||||
// Define if preview images should be cropped or only scaled:
|
||||
previewCrop: false,
|
||||
// Define if preview images should be resized as canvas elements:
|
||||
previewCanvas: true
|
||||
},
|
||||
|
||||
processActions: {
|
||||
|
||||
// Loads the image given via data.files and data.index
|
||||
// as img element, if the browser supports the File API.
|
||||
// Accepts the options fileTypes (regular expression)
|
||||
// and maxFileSize (integer) to limit the files to load:
|
||||
loadImage: function (data, options) {
|
||||
if (options.disabled) {
|
||||
return data;
|
||||
}
|
||||
var that = this,
|
||||
file = data.files[data.index],
|
||||
dfd = $.Deferred();
|
||||
if (($.type(options.maxFileSize) === 'number' &&
|
||||
file.size > options.maxFileSize) ||
|
||||
(options.fileTypes &&
|
||||
!options.fileTypes.test(file.type)) ||
|
||||
!loadImage(
|
||||
file,
|
||||
function (img) {
|
||||
if (img.src) {
|
||||
data.img = img;
|
||||
}
|
||||
dfd.resolveWith(that, [data]);
|
||||
},
|
||||
options
|
||||
)) {
|
||||
return data;
|
||||
}
|
||||
return dfd.promise();
|
||||
},
|
||||
|
||||
// Resizes the image given as data.canvas or data.img
|
||||
// and updates data.canvas or data.img with the resized image.
|
||||
// Also stores the resized image as preview property.
|
||||
// Accepts the options maxWidth, maxHeight, minWidth,
|
||||
// minHeight, canvas and crop:
|
||||
resizeImage: function (data, options) {
|
||||
if (options.disabled || !(data.canvas || data.img)) {
|
||||
return data;
|
||||
}
|
||||
options = $.extend({canvas: true}, options);
|
||||
var that = this,
|
||||
dfd = $.Deferred(),
|
||||
img = (options.canvas && data.canvas) || data.img,
|
||||
resolve = function (newImg) {
|
||||
if (newImg && (newImg.width !== img.width ||
|
||||
newImg.height !== img.height ||
|
||||
options.forceResize)) {
|
||||
data[newImg.getContext ? 'canvas' : 'img'] = newImg;
|
||||
}
|
||||
data.preview = newImg;
|
||||
dfd.resolveWith(that, [data]);
|
||||
},
|
||||
thumbnail;
|
||||
if (data.exif) {
|
||||
if (options.orientation === true) {
|
||||
options.orientation = data.exif.get('Orientation');
|
||||
}
|
||||
if (options.thumbnail) {
|
||||
thumbnail = data.exif.get('Thumbnail');
|
||||
if (thumbnail) {
|
||||
loadImage(thumbnail, resolve, options);
|
||||
return dfd.promise();
|
||||
}
|
||||
}
|
||||
// Prevent orienting the same image twice:
|
||||
if (data.orientation) {
|
||||
delete options.orientation;
|
||||
} else {
|
||||
data.orientation = options.orientation;
|
||||
}
|
||||
}
|
||||
if (img) {
|
||||
resolve(loadImage.scale(img, options));
|
||||
return dfd.promise();
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
// Saves the processed image given as data.canvas
|
||||
// inplace at data.index of data.files:
|
||||
saveImage: function (data, options) {
|
||||
if (!data.canvas || options.disabled) {
|
||||
return data;
|
||||
}
|
||||
var that = this,
|
||||
file = data.files[data.index],
|
||||
dfd = $.Deferred();
|
||||
if (data.canvas.toBlob) {
|
||||
data.canvas.toBlob(
|
||||
function (blob) {
|
||||
if (!blob.name) {
|
||||
if (file.type === blob.type) {
|
||||
blob.name = file.name;
|
||||
} else if (file.name) {
|
||||
blob.name = file.name.replace(
|
||||
/\.\w+$/,
|
||||
'.' + blob.type.substr(6)
|
||||
);
|
||||
}
|
||||
}
|
||||
// Don't restore invalid meta data:
|
||||
if (file.type !== blob.type) {
|
||||
delete data.imageHead;
|
||||
}
|
||||
// Store the created blob at the position
|
||||
// of the original file in the files list:
|
||||
data.files[data.index] = blob;
|
||||
dfd.resolveWith(that, [data]);
|
||||
},
|
||||
options.type || file.type,
|
||||
options.quality
|
||||
);
|
||||
} else {
|
||||
return data;
|
||||
}
|
||||
return dfd.promise();
|
||||
},
|
||||
|
||||
loadImageMetaData: function (data, options) {
|
||||
if (options.disabled) {
|
||||
return data;
|
||||
}
|
||||
var that = this,
|
||||
dfd = $.Deferred();
|
||||
loadImage.parseMetaData(data.files[data.index], function (result) {
|
||||
$.extend(data, result);
|
||||
dfd.resolveWith(that, [data]);
|
||||
}, options);
|
||||
return dfd.promise();
|
||||
},
|
||||
|
||||
saveImageMetaData: function (data, options) {
|
||||
if (!(data.imageHead && data.canvas &&
|
||||
data.canvas.toBlob && !options.disabled)) {
|
||||
return data;
|
||||
}
|
||||
var file = data.files[data.index],
|
||||
blob = new Blob([
|
||||
data.imageHead,
|
||||
// Resized images always have a head size of 20 bytes,
|
||||
// including the JPEG marker and a minimal JFIF header:
|
||||
this._blobSlice.call(file, 20)
|
||||
], {type: file.type});
|
||||
blob.name = file.name;
|
||||
data.files[data.index] = blob;
|
||||
return data;
|
||||
},
|
||||
|
||||
// Sets the resized version of the image as a property of the
|
||||
// file object, must be called after "saveImage":
|
||||
setImage: function (data, options) {
|
||||
if (data.preview && !options.disabled) {
|
||||
data.files[data.index][options.name || 'preview'] = data.preview;
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
deleteImageReferences: function (data, options) {
|
||||
if (!options.disabled) {
|
||||
delete data.img;
|
||||
delete data.canvas;
|
||||
delete data.preview;
|
||||
delete data.imageHead;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
155
statics/js/common/plugins/fileupload/js/jquery.fileupload-jquery-ui.js
Executable file
155
statics/js/common/plugins/fileupload/js/jquery.fileupload-jquery-ui.js
Executable file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* jQuery File Upload jQuery UI Plugin 8.7.2
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* jshint nomen:false */
|
||||
/* global define, require, window */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(['jquery', './jquery.fileupload-ui'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
processdone: function (e, data) {
|
||||
data.context.find('.start').button('enable');
|
||||
},
|
||||
progress: function (e, data) {
|
||||
if (data.context) {
|
||||
data.context.find('.progress').progressbar(
|
||||
'option',
|
||||
'value',
|
||||
parseInt(data.loaded / data.total * 100, 10)
|
||||
);
|
||||
}
|
||||
},
|
||||
progressall: function (e, data) {
|
||||
var $this = $(this);
|
||||
$this.find('.fileupload-progress')
|
||||
.find('.progress').progressbar(
|
||||
'option',
|
||||
'value',
|
||||
parseInt(data.loaded / data.total * 100, 10)
|
||||
).end()
|
||||
.find('.progress-extended').each(function () {
|
||||
$(this).html(
|
||||
($this.data('blueimp-fileupload') ||
|
||||
$this.data('fileupload'))
|
||||
._renderExtendedProgress(data)
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_renderUpload: function (func, files) {
|
||||
var node = this._super(func, files),
|
||||
showIconText = $(window).width() > 480;
|
||||
node.find('.progress').empty().progressbar();
|
||||
node.find('.start').button({
|
||||
icons: {primary: 'ui-icon-circle-arrow-e'},
|
||||
text: showIconText
|
||||
});
|
||||
node.find('.cancel').button({
|
||||
icons: {primary: 'ui-icon-cancel'},
|
||||
text: showIconText
|
||||
});
|
||||
if (node.hasClass('fade')) {
|
||||
node.hide();
|
||||
}
|
||||
return node;
|
||||
},
|
||||
|
||||
_renderDownload: function (func, files) {
|
||||
var node = this._super(func, files),
|
||||
showIconText = $(window).width() > 480;
|
||||
node.find('.delete').button({
|
||||
icons: {primary: 'ui-icon-trash'},
|
||||
text: showIconText
|
||||
});
|
||||
if (node.hasClass('fade')) {
|
||||
node.hide();
|
||||
}
|
||||
return node;
|
||||
},
|
||||
|
||||
_startHandler: function (e) {
|
||||
$(e.currentTarget).button('disable');
|
||||
this._super(e);
|
||||
},
|
||||
|
||||
_transition: function (node) {
|
||||
var deferred = $.Deferred();
|
||||
if (node.hasClass('fade')) {
|
||||
node.fadeToggle(
|
||||
this.options.transitionDuration,
|
||||
this.options.transitionEasing,
|
||||
function () {
|
||||
deferred.resolveWith(node);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
deferred.resolveWith(node);
|
||||
}
|
||||
return deferred;
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
this._super();
|
||||
this.element
|
||||
.find('.fileupload-buttonbar')
|
||||
.find('.fileinput-button').each(function () {
|
||||
var input = $(this).find('input:file').detach();
|
||||
$(this)
|
||||
.button({icons: {primary: 'ui-icon-plusthick'}})
|
||||
.append(input);
|
||||
})
|
||||
.end().find('.start')
|
||||
.button({icons: {primary: 'ui-icon-circle-arrow-e'}})
|
||||
.end().find('.cancel')
|
||||
.button({icons: {primary: 'ui-icon-cancel'}})
|
||||
.end().find('.delete')
|
||||
.button({icons: {primary: 'ui-icon-trash'}})
|
||||
.end().find('.progress').progressbar();
|
||||
},
|
||||
|
||||
_destroy: function () {
|
||||
this.element
|
||||
.find('.fileupload-buttonbar')
|
||||
.find('.fileinput-button').each(function () {
|
||||
var input = $(this).find('input:file').detach();
|
||||
$(this)
|
||||
.button('destroy')
|
||||
.append(input);
|
||||
})
|
||||
.end().find('.start')
|
||||
.button('destroy')
|
||||
.end().find('.cancel')
|
||||
.button('destroy')
|
||||
.end().find('.delete')
|
||||
.button('destroy')
|
||||
.end().find('.progress').progressbar('destroy');
|
||||
this._super();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
175
statics/js/common/plugins/fileupload/js/jquery.fileupload-process.js
vendored
Executable file
175
statics/js/common/plugins/fileupload/js/jquery.fileupload-process.js
vendored
Executable file
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
* jQuery File Upload Processing Plugin 1.3.1
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2012, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* jshint nomen:false */
|
||||
/* global define, require, window */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery',
|
||||
'./jquery.fileupload'
|
||||
], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery
|
||||
);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
var originalAdd = $.blueimp.fileupload.prototype.options.add;
|
||||
|
||||
// The File Upload Processing plugin extends the fileupload widget
|
||||
// with file processing functionality:
|
||||
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
// The list of processing actions:
|
||||
processQueue: [
|
||||
/*
|
||||
{
|
||||
action: 'log',
|
||||
type: 'debug'
|
||||
}
|
||||
*/
|
||||
],
|
||||
add: function (e, data) {
|
||||
var $this = $(this);
|
||||
data.process(function () {
|
||||
return $this.fileupload('process', data);
|
||||
});
|
||||
originalAdd.call(this, e, data);
|
||||
}
|
||||
},
|
||||
|
||||
processActions: {
|
||||
/*
|
||||
log: function (data, options) {
|
||||
console[options.type](
|
||||
'Processing "' + data.files[data.index].name + '"'
|
||||
);
|
||||
}
|
||||
*/
|
||||
},
|
||||
|
||||
_processFile: function (data, originalData) {
|
||||
var that = this,
|
||||
dfd = $.Deferred().resolveWith(that, [data]),
|
||||
chain = dfd.promise();
|
||||
this._trigger('process', null, data);
|
||||
$.each(data.processQueue, function (i, settings) {
|
||||
var func = function (data) {
|
||||
if (originalData.errorThrown) {
|
||||
return $.Deferred()
|
||||
.rejectWith(that, [originalData]).promise();
|
||||
}
|
||||
return that.processActions[settings.action].call(
|
||||
that,
|
||||
data,
|
||||
settings
|
||||
);
|
||||
};
|
||||
chain = chain.pipe(func, settings.always && func);
|
||||
});
|
||||
chain
|
||||
.done(function () {
|
||||
that._trigger('processdone', null, data);
|
||||
that._trigger('processalways', null, data);
|
||||
})
|
||||
.fail(function () {
|
||||
that._trigger('processfail', null, data);
|
||||
that._trigger('processalways', null, data);
|
||||
});
|
||||
return chain;
|
||||
},
|
||||
|
||||
// Replaces the settings of each processQueue item that
|
||||
// are strings starting with an "@", using the remaining
|
||||
// substring as key for the option map,
|
||||
// e.g. "@autoUpload" is replaced with options.autoUpload:
|
||||
_transformProcessQueue: function (options) {
|
||||
var processQueue = [];
|
||||
$.each(options.processQueue, function () {
|
||||
var settings = {},
|
||||
action = this.action,
|
||||
prefix = this.prefix === true ? action : this.prefix;
|
||||
$.each(this, function (key, value) {
|
||||
if ($.type(value) === 'string' &&
|
||||
value.charAt(0) === '@') {
|
||||
settings[key] = options[
|
||||
value.slice(1) || (prefix ? prefix +
|
||||
key.charAt(0).toUpperCase() + key.slice(1) : key)
|
||||
];
|
||||
} else {
|
||||
settings[key] = value;
|
||||
}
|
||||
|
||||
});
|
||||
processQueue.push(settings);
|
||||
});
|
||||
options.processQueue = processQueue;
|
||||
},
|
||||
|
||||
// Returns the number of files currently in the processsing queue:
|
||||
processing: function () {
|
||||
return this._processing;
|
||||
},
|
||||
|
||||
// Processes the files given as files property of the data parameter,
|
||||
// returns a Promise object that allows to bind callbacks:
|
||||
process: function (data) {
|
||||
var that = this,
|
||||
options = $.extend({}, this.options, data);
|
||||
if (options.processQueue && options.processQueue.length) {
|
||||
this._transformProcessQueue(options);
|
||||
if (this._processing === 0) {
|
||||
this._trigger('processstart');
|
||||
}
|
||||
$.each(data.files, function (index) {
|
||||
var opts = index ? $.extend({}, options) : options,
|
||||
func = function () {
|
||||
if (data.errorThrown) {
|
||||
return $.Deferred()
|
||||
.rejectWith(that, [data]).promise();
|
||||
}
|
||||
return that._processFile(opts, data);
|
||||
};
|
||||
opts.index = index;
|
||||
that._processing += 1;
|
||||
that._processingQueue = that._processingQueue.pipe(func, func)
|
||||
.always(function () {
|
||||
that._processing -= 1;
|
||||
if (that._processing === 0) {
|
||||
that._trigger('processstop');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return this._processingQueue;
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
this._super();
|
||||
this._processing = 0;
|
||||
this._processingQueue = $.Deferred().resolveWith(this)
|
||||
.promise();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
710
statics/js/common/plugins/fileupload/js/jquery.fileupload-ui.js
vendored
Executable file
710
statics/js/common/plugins/fileupload/js/jquery.fileupload-ui.js
vendored
Executable file
@@ -0,0 +1,710 @@
|
||||
/*
|
||||
* jQuery File Upload User Interface Plugin 9.6.1
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* jshint nomen:false */
|
||||
/* global define, require, window */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery',
|
||||
'tmpl',
|
||||
'./jquery.fileupload-image',
|
||||
'./jquery.fileupload-audio',
|
||||
'./jquery.fileupload-video',
|
||||
'./jquery.fileupload-validate'
|
||||
], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(
|
||||
require('jquery'),
|
||||
require('tmpl')
|
||||
);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery,
|
||||
window.tmpl
|
||||
);
|
||||
}
|
||||
}(function ($, tmpl) {
|
||||
'use strict';
|
||||
|
||||
$.blueimp.fileupload.prototype._specialOptions.push(
|
||||
'filesContainer',
|
||||
'uploadTemplateId',
|
||||
'downloadTemplateId'
|
||||
);
|
||||
|
||||
// The UI version extends the file upload widget
|
||||
// and adds complete user interface interaction:
|
||||
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
// By default, files added to the widget are uploaded as soon
|
||||
// as the user clicks on the start buttons. To enable automatic
|
||||
// uploads, set the following option to true:
|
||||
autoUpload: false,
|
||||
// The ID of the upload template:
|
||||
uploadTemplateId: 'template-upload',
|
||||
// The ID of the download template:
|
||||
downloadTemplateId: 'template-download',
|
||||
// The container for the list of files. If undefined, it is set to
|
||||
// an element with class "files" inside of the widget element:
|
||||
filesContainer: undefined,
|
||||
// By default, files are appended to the files container.
|
||||
// Set the following option to true, to prepend files instead:
|
||||
prependFiles: false,
|
||||
// The expected data type of the upload response, sets the dataType
|
||||
// option of the $.ajax upload requests:
|
||||
dataType: 'json',
|
||||
|
||||
// Error and info messages:
|
||||
messages: {
|
||||
unknownError: 'Unknown error'
|
||||
},
|
||||
|
||||
// Function returning the current number of files,
|
||||
// used by the maxNumberOfFiles validation:
|
||||
getNumberOfFiles: function () {
|
||||
return this.filesContainer.children()
|
||||
.not('.processing').length;
|
||||
},
|
||||
|
||||
// Callback to retrieve the list of files from the server response:
|
||||
getFilesFromResponse: function (data) {
|
||||
if (data.result && $.isArray(data.result.files)) {
|
||||
return data.result.files;
|
||||
}
|
||||
return [];
|
||||
},
|
||||
|
||||
// The add callback is invoked as soon as files are added to the fileupload
|
||||
// widget (via file input selection, drag & drop or add API call).
|
||||
// See the basic file upload widget for more information:
|
||||
add: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var $this = $(this),
|
||||
that = $this.data('blueimp-fileupload') ||
|
||||
$this.data('fileupload'),
|
||||
options = that.options;
|
||||
data.context = that._renderUpload(data.files)
|
||||
.data('data', data)
|
||||
.addClass('processing');
|
||||
options.filesContainer[
|
||||
options.prependFiles ? 'prepend' : 'append'
|
||||
](data.context);
|
||||
that._forceReflow(data.context);
|
||||
that._transition(data.context);
|
||||
data.process(function () {
|
||||
return $this.fileupload('process', data);
|
||||
}).always(function () {
|
||||
data.context.each(function (index) {
|
||||
$(this).find('.size').text(
|
||||
that._formatFileSize(data.files[index].size)
|
||||
);
|
||||
}).removeClass('processing');
|
||||
that._renderPreviews(data);
|
||||
}).done(function () {
|
||||
data.context.find('.start').prop('disabled', false);
|
||||
if ((that._trigger('added', e, data) !== false) &&
|
||||
(options.autoUpload || data.autoUpload) &&
|
||||
data.autoUpload !== false) {
|
||||
data.submit();
|
||||
}
|
||||
}).fail(function () {
|
||||
if (data.files.error) {
|
||||
data.context.each(function (index) {
|
||||
var error = data.files[index].error;
|
||||
if (error) {
|
||||
$(this).find('.error').text(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// Callback for the start of each file upload request:
|
||||
send: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var that = $(this).data('blueimp-fileupload') ||
|
||||
$(this).data('fileupload');
|
||||
if (data.context && data.dataType &&
|
||||
data.dataType.substr(0, 6) === 'iframe') {
|
||||
// Iframe Transport does not support progress events.
|
||||
// In lack of an indeterminate progress bar, we set
|
||||
// the progress to 100%, showing the full animated bar:
|
||||
data.context
|
||||
.find('.progress').addClass(
|
||||
!$.support.transition && 'progress-animated'
|
||||
)
|
||||
.attr('aria-valuenow', 100)
|
||||
.children().first().css(
|
||||
'width',
|
||||
'100%'
|
||||
);
|
||||
}
|
||||
return that._trigger('sent', e, data);
|
||||
},
|
||||
// Callback for successful uploads:
|
||||
done: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var that = $(this).data('blueimp-fileupload') ||
|
||||
$(this).data('fileupload'),
|
||||
getFilesFromResponse = data.getFilesFromResponse ||
|
||||
that.options.getFilesFromResponse,
|
||||
files = getFilesFromResponse(data),
|
||||
template,
|
||||
deferred;
|
||||
if (data.context) {
|
||||
data.context.each(function (index) {
|
||||
var file = files[index] ||
|
||||
{error: 'Empty file upload result'};
|
||||
deferred = that._addFinishedDeferreds();
|
||||
that._transition($(this)).done(
|
||||
function () {
|
||||
var node = $(this);
|
||||
template = that._renderDownload([file])
|
||||
.replaceAll(node);
|
||||
that._forceReflow(template);
|
||||
that._transition(template).done(
|
||||
function () {
|
||||
data.context = $(this);
|
||||
that._trigger('completed', e, data);
|
||||
that._trigger('finished', e, data);
|
||||
deferred.resolve();
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
} else {
|
||||
template = that._renderDownload(files)[
|
||||
that.options.prependFiles ? 'prependTo' : 'appendTo'
|
||||
](that.options.filesContainer);
|
||||
that._forceReflow(template);
|
||||
deferred = that._addFinishedDeferreds();
|
||||
that._transition(template).done(
|
||||
function () {
|
||||
data.context = $(this);
|
||||
that._trigger('completed', e, data);
|
||||
that._trigger('finished', e, data);
|
||||
deferred.resolve();
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
// Callback for failed (abort or error) uploads:
|
||||
fail: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var that = $(this).data('blueimp-fileupload') ||
|
||||
$(this).data('fileupload'),
|
||||
template,
|
||||
deferred;
|
||||
if (data.context) {
|
||||
data.context.each(function (index) {
|
||||
if (data.errorThrown !== 'abort') {
|
||||
var file = data.files[index];
|
||||
file.error = file.error || data.errorThrown ||
|
||||
data.i18n('unknownError');
|
||||
deferred = that._addFinishedDeferreds();
|
||||
that._transition($(this)).done(
|
||||
function () {
|
||||
var node = $(this);
|
||||
template = that._renderDownload([file])
|
||||
.replaceAll(node);
|
||||
that._forceReflow(template);
|
||||
that._transition(template).done(
|
||||
function () {
|
||||
data.context = $(this);
|
||||
that._trigger('failed', e, data);
|
||||
that._trigger('finished', e, data);
|
||||
deferred.resolve();
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
deferred = that._addFinishedDeferreds();
|
||||
that._transition($(this)).done(
|
||||
function () {
|
||||
$(this).remove();
|
||||
that._trigger('failed', e, data);
|
||||
that._trigger('finished', e, data);
|
||||
deferred.resolve();
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
} else if (data.errorThrown !== 'abort') {
|
||||
data.context = that._renderUpload(data.files)[
|
||||
that.options.prependFiles ? 'prependTo' : 'appendTo'
|
||||
](that.options.filesContainer)
|
||||
.data('data', data);
|
||||
that._forceReflow(data.context);
|
||||
deferred = that._addFinishedDeferreds();
|
||||
that._transition(data.context).done(
|
||||
function () {
|
||||
data.context = $(this);
|
||||
that._trigger('failed', e, data);
|
||||
that._trigger('finished', e, data);
|
||||
deferred.resolve();
|
||||
}
|
||||
);
|
||||
} else {
|
||||
that._trigger('failed', e, data);
|
||||
that._trigger('finished', e, data);
|
||||
that._addFinishedDeferreds().resolve();
|
||||
}
|
||||
},
|
||||
// Callback for upload progress events:
|
||||
progress: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var progress = Math.floor(data.loaded / data.total * 100);
|
||||
if (data.context) {
|
||||
data.context.each(function () {
|
||||
$(this).find('.progress')
|
||||
.attr('aria-valuenow', progress)
|
||||
.children().first().css(
|
||||
'width',
|
||||
progress + '%'
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
// Callback for global upload progress events:
|
||||
progressall: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var $this = $(this),
|
||||
progress = Math.floor(data.loaded / data.total * 100),
|
||||
globalProgressNode = $this.find('.fileupload-progress'),
|
||||
extendedProgressNode = globalProgressNode
|
||||
.find('.progress-extended');
|
||||
if (extendedProgressNode.length) {
|
||||
extendedProgressNode.html(
|
||||
($this.data('blueimp-fileupload') || $this.data('fileupload'))
|
||||
._renderExtendedProgress(data)
|
||||
);
|
||||
}
|
||||
globalProgressNode
|
||||
.find('.progress')
|
||||
.attr('aria-valuenow', progress)
|
||||
.children().first().css(
|
||||
'width',
|
||||
progress + '%'
|
||||
);
|
||||
},
|
||||
// Callback for uploads start, equivalent to the global ajaxStart event:
|
||||
start: function (e) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var that = $(this).data('blueimp-fileupload') ||
|
||||
$(this).data('fileupload');
|
||||
that._resetFinishedDeferreds();
|
||||
that._transition($(this).find('.fileupload-progress')).done(
|
||||
function () {
|
||||
that._trigger('started', e);
|
||||
}
|
||||
);
|
||||
},
|
||||
// Callback for uploads stop, equivalent to the global ajaxStop event:
|
||||
stop: function (e) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var that = $(this).data('blueimp-fileupload') ||
|
||||
$(this).data('fileupload'),
|
||||
deferred = that._addFinishedDeferreds();
|
||||
$.when.apply($, that._getFinishedDeferreds())
|
||||
.done(function () {
|
||||
that._trigger('stopped', e);
|
||||
});
|
||||
that._transition($(this).find('.fileupload-progress')).done(
|
||||
function () {
|
||||
$(this).find('.progress')
|
||||
.attr('aria-valuenow', '0')
|
||||
.children().first().css('width', '0%');
|
||||
$(this).find('.progress-extended').html(' ');
|
||||
deferred.resolve();
|
||||
}
|
||||
);
|
||||
},
|
||||
processstart: function (e) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
$(this).addClass('fileupload-processing');
|
||||
},
|
||||
processstop: function (e) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
$(this).removeClass('fileupload-processing');
|
||||
},
|
||||
// Callback for file deletion:
|
||||
destroy: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var that = $(this).data('blueimp-fileupload') ||
|
||||
$(this).data('fileupload'),
|
||||
removeNode = function () {
|
||||
that._transition(data.context).done(
|
||||
function () {
|
||||
$(this).remove();
|
||||
that._trigger('destroyed', e, data);
|
||||
}
|
||||
);
|
||||
};
|
||||
if (data.url) {
|
||||
data.dataType = data.dataType || that.options.dataType;
|
||||
$.ajax(data).done(removeNode).fail(function () {
|
||||
that._trigger('destroyfailed', e, data);
|
||||
});
|
||||
} else {
|
||||
removeNode();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_resetFinishedDeferreds: function () {
|
||||
this._finishedUploads = [];
|
||||
},
|
||||
|
||||
_addFinishedDeferreds: function (deferred) {
|
||||
if (!deferred) {
|
||||
deferred = $.Deferred();
|
||||
}
|
||||
this._finishedUploads.push(deferred);
|
||||
return deferred;
|
||||
},
|
||||
|
||||
_getFinishedDeferreds: function () {
|
||||
return this._finishedUploads;
|
||||
},
|
||||
|
||||
// Link handler, that allows to download files
|
||||
// by drag & drop of the links to the desktop:
|
||||
_enableDragToDesktop: function () {
|
||||
var link = $(this),
|
||||
url = link.prop('href'),
|
||||
name = link.prop('download'),
|
||||
type = 'application/octet-stream';
|
||||
link.bind('dragstart', function (e) {
|
||||
try {
|
||||
e.originalEvent.dataTransfer.setData(
|
||||
'DownloadURL',
|
||||
[type, name, url].join(':')
|
||||
);
|
||||
} catch (ignore) {}
|
||||
});
|
||||
},
|
||||
|
||||
_formatFileSize: function (bytes) {
|
||||
if (typeof bytes !== 'number') {
|
||||
return '';
|
||||
}
|
||||
if (bytes >= 1000000000) {
|
||||
return (bytes / 1000000000).toFixed(2) + ' GB';
|
||||
}
|
||||
if (bytes >= 1000000) {
|
||||
return (bytes / 1000000).toFixed(2) + ' MB';
|
||||
}
|
||||
return (bytes / 1000).toFixed(2) + ' KB';
|
||||
},
|
||||
|
||||
_formatBitrate: function (bits) {
|
||||
if (typeof bits !== 'number') {
|
||||
return '';
|
||||
}
|
||||
if (bits >= 1000000000) {
|
||||
return (bits / 1000000000).toFixed(2) + ' Gbit/s';
|
||||
}
|
||||
if (bits >= 1000000) {
|
||||
return (bits / 1000000).toFixed(2) + ' Mbit/s';
|
||||
}
|
||||
if (bits >= 1000) {
|
||||
return (bits / 1000).toFixed(2) + ' kbit/s';
|
||||
}
|
||||
return bits.toFixed(2) + ' bit/s';
|
||||
},
|
||||
|
||||
_formatTime: function (seconds) {
|
||||
var date = new Date(seconds * 1000),
|
||||
days = Math.floor(seconds / 86400);
|
||||
days = days ? days + 'd ' : '';
|
||||
return days +
|
||||
('0' + date.getUTCHours()).slice(-2) + ':' +
|
||||
('0' + date.getUTCMinutes()).slice(-2) + ':' +
|
||||
('0' + date.getUTCSeconds()).slice(-2);
|
||||
},
|
||||
|
||||
_formatPercentage: function (floatValue) {
|
||||
return (floatValue * 100).toFixed(2) + ' %';
|
||||
},
|
||||
|
||||
_renderExtendedProgress: function (data) {
|
||||
return this._formatBitrate(data.bitrate) + ' | ' +
|
||||
this._formatTime(
|
||||
(data.total - data.loaded) * 8 / data.bitrate
|
||||
) + ' | ' +
|
||||
this._formatPercentage(
|
||||
data.loaded / data.total
|
||||
) + ' | ' +
|
||||
this._formatFileSize(data.loaded) + ' / ' +
|
||||
this._formatFileSize(data.total);
|
||||
},
|
||||
|
||||
_renderTemplate: function (func, files) {
|
||||
if (!func) {
|
||||
return $();
|
||||
}
|
||||
var result = func({
|
||||
files: files,
|
||||
formatFileSize: this._formatFileSize,
|
||||
options: this.options
|
||||
});
|
||||
if (result instanceof $) {
|
||||
return result;
|
||||
}
|
||||
return $(this.options.templatesContainer).html(result).children();
|
||||
},
|
||||
|
||||
_renderPreviews: function (data) {
|
||||
data.context.find('.preview').each(function (index, elm) {
|
||||
$(elm).append(data.files[index].preview);
|
||||
});
|
||||
},
|
||||
|
||||
_renderUpload: function (files) {
|
||||
return this._renderTemplate(
|
||||
this.options.uploadTemplate,
|
||||
files
|
||||
);
|
||||
},
|
||||
|
||||
_renderDownload: function (files) {
|
||||
return this._renderTemplate(
|
||||
this.options.downloadTemplate,
|
||||
files
|
||||
).find('a[download]').each(this._enableDragToDesktop).end();
|
||||
},
|
||||
|
||||
_startHandler: function (e) {
|
||||
e.preventDefault();
|
||||
var button = $(e.currentTarget),
|
||||
template = button.closest('.template-upload'),
|
||||
data = template.data('data');
|
||||
button.prop('disabled', true);
|
||||
if (data && data.submit) {
|
||||
data.submit();
|
||||
}
|
||||
},
|
||||
|
||||
_cancelHandler: function (e) {
|
||||
e.preventDefault();
|
||||
var template = $(e.currentTarget)
|
||||
.closest('.template-upload,.template-download'),
|
||||
data = template.data('data') || {};
|
||||
data.context = data.context || template;
|
||||
if (data.abort) {
|
||||
data.abort();
|
||||
} else {
|
||||
data.errorThrown = 'abort';
|
||||
this._trigger('fail', e, data);
|
||||
}
|
||||
},
|
||||
|
||||
_deleteHandler: function (e) {
|
||||
e.preventDefault();
|
||||
var button = $(e.currentTarget);
|
||||
this._trigger('destroy', e, $.extend({
|
||||
context: button.closest('.template-download'),
|
||||
type: 'DELETE'
|
||||
}, button.data()));
|
||||
},
|
||||
|
||||
_forceReflow: function (node) {
|
||||
return $.support.transition && node.length &&
|
||||
node[0].offsetWidth;
|
||||
},
|
||||
|
||||
_transition: function (node) {
|
||||
var dfd = $.Deferred();
|
||||
if ($.support.transition && node.hasClass('fade') && node.is(':visible')) {
|
||||
node.bind(
|
||||
$.support.transition.end,
|
||||
function (e) {
|
||||
// Make sure we don't respond to other transitions events
|
||||
// in the container element, e.g. from button elements:
|
||||
if (e.target === node[0]) {
|
||||
node.unbind($.support.transition.end);
|
||||
dfd.resolveWith(node);
|
||||
}
|
||||
}
|
||||
).toggleClass('in');
|
||||
} else {
|
||||
node.toggleClass('in');
|
||||
dfd.resolveWith(node);
|
||||
}
|
||||
return dfd;
|
||||
},
|
||||
|
||||
_initButtonBarEventHandlers: function () {
|
||||
var fileUploadButtonBar = this.element.find('.fileupload-buttonbar'),
|
||||
filesList = this.options.filesContainer;
|
||||
this._on(fileUploadButtonBar.find('.start'), {
|
||||
click: function (e) {
|
||||
e.preventDefault();
|
||||
filesList.find('.start').click();
|
||||
}
|
||||
});
|
||||
this._on(fileUploadButtonBar.find('.cancel'), {
|
||||
click: function (e) {
|
||||
e.preventDefault();
|
||||
filesList.find('.cancel').click();
|
||||
}
|
||||
});
|
||||
this._on(fileUploadButtonBar.find('.delete'), {
|
||||
click: function (e) {
|
||||
e.preventDefault();
|
||||
filesList.find('.toggle:checked')
|
||||
.closest('.template-download')
|
||||
.find('.delete').click();
|
||||
fileUploadButtonBar.find('.toggle')
|
||||
.prop('checked', false);
|
||||
}
|
||||
});
|
||||
this._on(fileUploadButtonBar.find('.toggle'), {
|
||||
change: function (e) {
|
||||
filesList.find('.toggle').prop(
|
||||
'checked',
|
||||
$(e.currentTarget).is(':checked')
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_destroyButtonBarEventHandlers: function () {
|
||||
this._off(
|
||||
this.element.find('.fileupload-buttonbar')
|
||||
.find('.start, .cancel, .delete'),
|
||||
'click'
|
||||
);
|
||||
this._off(
|
||||
this.element.find('.fileupload-buttonbar .toggle'),
|
||||
'change.'
|
||||
);
|
||||
},
|
||||
|
||||
_initEventHandlers: function () {
|
||||
this._super();
|
||||
this._on(this.options.filesContainer, {
|
||||
'click .start': this._startHandler,
|
||||
'click .cancel': this._cancelHandler,
|
||||
'click .delete': this._deleteHandler
|
||||
});
|
||||
this._initButtonBarEventHandlers();
|
||||
},
|
||||
|
||||
_destroyEventHandlers: function () {
|
||||
this._destroyButtonBarEventHandlers();
|
||||
this._off(this.options.filesContainer, 'click');
|
||||
this._super();
|
||||
},
|
||||
|
||||
_enableFileInputButton: function () {
|
||||
this.element.find('.fileinput-button input')
|
||||
.prop('disabled', false)
|
||||
.parent().removeClass('disabled');
|
||||
},
|
||||
|
||||
_disableFileInputButton: function () {
|
||||
this.element.find('.fileinput-button input')
|
||||
.prop('disabled', true)
|
||||
.parent().addClass('disabled');
|
||||
},
|
||||
|
||||
_initTemplates: function () {
|
||||
var options = this.options;
|
||||
options.templatesContainer = this.document[0].createElement(
|
||||
options.filesContainer.prop('nodeName')
|
||||
);
|
||||
if (tmpl) {
|
||||
if (options.uploadTemplateId) {
|
||||
options.uploadTemplate = tmpl(options.uploadTemplateId);
|
||||
}
|
||||
if (options.downloadTemplateId) {
|
||||
options.downloadTemplate = tmpl(options.downloadTemplateId);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_initFilesContainer: function () {
|
||||
var options = this.options;
|
||||
if (options.filesContainer === undefined) {
|
||||
options.filesContainer = this.element.find('.files');
|
||||
} else if (!(options.filesContainer instanceof $)) {
|
||||
options.filesContainer = $(options.filesContainer);
|
||||
}
|
||||
},
|
||||
|
||||
_initSpecialOptions: function () {
|
||||
this._super();
|
||||
this._initFilesContainer();
|
||||
this._initTemplates();
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
this._super();
|
||||
this._resetFinishedDeferreds();
|
||||
if (!$.support.fileInput) {
|
||||
this._disableFileInputButton();
|
||||
}
|
||||
},
|
||||
|
||||
enable: function () {
|
||||
var wasDisabled = false;
|
||||
if (this.options.disabled) {
|
||||
wasDisabled = true;
|
||||
}
|
||||
this._super();
|
||||
if (wasDisabled) {
|
||||
this.element.find('input, button').prop('disabled', false);
|
||||
this._enableFileInputButton();
|
||||
}
|
||||
},
|
||||
|
||||
disable: function () {
|
||||
if (!this.options.disabled) {
|
||||
this.element.find('input, button').prop('disabled', true);
|
||||
this._disableFileInputButton();
|
||||
}
|
||||
this._super();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
122
statics/js/common/plugins/fileupload/js/jquery.fileupload-validate.js
vendored
Executable file
122
statics/js/common/plugins/fileupload/js/jquery.fileupload-validate.js
vendored
Executable file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* jQuery File Upload Validation Plugin 1.1.3
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* global define, require, window */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery',
|
||||
'./jquery.fileupload-process'
|
||||
], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery
|
||||
);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
// Append to the default processQueue:
|
||||
$.blueimp.fileupload.prototype.options.processQueue.push(
|
||||
{
|
||||
action: 'validate',
|
||||
// Always trigger this action,
|
||||
// even if the previous action was rejected:
|
||||
always: true,
|
||||
// Options taken from the global options map:
|
||||
acceptFileTypes: '@',
|
||||
maxFileSize: '@',
|
||||
minFileSize: '@',
|
||||
maxNumberOfFiles: '@',
|
||||
disabled: '@disableValidation'
|
||||
}
|
||||
);
|
||||
|
||||
// The File Upload Validation plugin extends the fileupload widget
|
||||
// with file validation functionality:
|
||||
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
/*
|
||||
// The regular expression for allowed file types, matches
|
||||
// against either file type or file name:
|
||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
|
||||
// The maximum allowed file size in bytes:
|
||||
maxFileSize: 10000000, // 10 MB
|
||||
// The minimum allowed file size in bytes:
|
||||
minFileSize: undefined, // No minimal file size
|
||||
// The limit of files to be uploaded:
|
||||
maxNumberOfFiles: 10,
|
||||
*/
|
||||
|
||||
// Function returning the current number of files,
|
||||
// has to be overriden for maxNumberOfFiles validation:
|
||||
getNumberOfFiles: $.noop,
|
||||
|
||||
// Error and info messages:
|
||||
messages: {
|
||||
maxNumberOfFiles: 'Maximum number of files exceeded',
|
||||
acceptFileTypes: 'File type not allowed',
|
||||
maxFileSize: 'File is too large',
|
||||
minFileSize: 'File is too small'
|
||||
}
|
||||
},
|
||||
|
||||
processActions: {
|
||||
|
||||
validate: function (data, options) {
|
||||
if (options.disabled) {
|
||||
return data;
|
||||
}
|
||||
var dfd = $.Deferred(),
|
||||
settings = this.options,
|
||||
file = data.files[data.index],
|
||||
fileSize;
|
||||
if (options.minFileSize || options.maxFileSize) {
|
||||
fileSize = file.size;
|
||||
}
|
||||
if ($.type(options.maxNumberOfFiles) === 'number' &&
|
||||
(settings.getNumberOfFiles() || 0) + data.files.length >
|
||||
options.maxNumberOfFiles) {
|
||||
file.error = settings.i18n('maxNumberOfFiles');
|
||||
} else if (options.acceptFileTypes &&
|
||||
!(options.acceptFileTypes.test(file.type) ||
|
||||
options.acceptFileTypes.test(file.name))) {
|
||||
file.error = settings.i18n('acceptFileTypes');
|
||||
} else if (fileSize > options.maxFileSize) {
|
||||
file.error = settings.i18n('maxFileSize');
|
||||
} else if ($.type(fileSize) === 'number' &&
|
||||
fileSize < options.minFileSize) {
|
||||
file.error = settings.i18n('minFileSize');
|
||||
} else {
|
||||
delete file.error;
|
||||
}
|
||||
if (file.error || data.files.error) {
|
||||
data.files.error = true;
|
||||
dfd.rejectWith(this, [data]);
|
||||
} else {
|
||||
dfd.resolveWith(this, [data]);
|
||||
}
|
||||
return dfd.promise();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
112
statics/js/common/plugins/fileupload/js/jquery.fileupload-video.js
vendored
Executable file
112
statics/js/common/plugins/fileupload/js/jquery.fileupload-video.js
vendored
Executable file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* jQuery File Upload Video Preview Plugin 1.0.4
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* jshint nomen:false */
|
||||
/* global define, require, window, document */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery',
|
||||
'load-image',
|
||||
'./jquery.fileupload-process'
|
||||
], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(
|
||||
require('jquery'),
|
||||
require('load-image')
|
||||
);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery,
|
||||
window.loadImage
|
||||
);
|
||||
}
|
||||
}(function ($, loadImage) {
|
||||
'use strict';
|
||||
|
||||
// Prepend to the default processQueue:
|
||||
$.blueimp.fileupload.prototype.options.processQueue.unshift(
|
||||
{
|
||||
action: 'loadVideo',
|
||||
// Use the action as prefix for the "@" options:
|
||||
prefix: true,
|
||||
fileTypes: '@',
|
||||
maxFileSize: '@',
|
||||
disabled: '@disableVideoPreview'
|
||||
},
|
||||
{
|
||||
action: 'setVideo',
|
||||
name: '@videoPreviewName',
|
||||
disabled: '@disableVideoPreview'
|
||||
}
|
||||
);
|
||||
|
||||
// The File Upload Video Preview plugin extends the fileupload widget
|
||||
// with video preview functionality:
|
||||
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
// The regular expression for the types of video files to load,
|
||||
// matched against the file type:
|
||||
loadVideoFileTypes: /^video\/.*$/
|
||||
},
|
||||
|
||||
_videoElement: document.createElement('video'),
|
||||
|
||||
processActions: {
|
||||
|
||||
// Loads the video file given via data.files and data.index
|
||||
// as video element if the browser supports playing it.
|
||||
// Accepts the options fileTypes (regular expression)
|
||||
// and maxFileSize (integer) to limit the files to load:
|
||||
loadVideo: function (data, options) {
|
||||
if (options.disabled) {
|
||||
return data;
|
||||
}
|
||||
var file = data.files[data.index],
|
||||
url,
|
||||
video;
|
||||
if (this._videoElement.canPlayType &&
|
||||
this._videoElement.canPlayType(file.type) &&
|
||||
($.type(options.maxFileSize) !== 'number' ||
|
||||
file.size <= options.maxFileSize) &&
|
||||
(!options.fileTypes ||
|
||||
options.fileTypes.test(file.type))) {
|
||||
url = loadImage.createObjectURL(file);
|
||||
if (url) {
|
||||
video = this._videoElement.cloneNode(false);
|
||||
video.src = url;
|
||||
video.controls = true;
|
||||
data.video = video;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
// Sets the video element as a property of the file object:
|
||||
setVideo: function (data, options) {
|
||||
if (data.video && !options.disabled) {
|
||||
data.files[data.index][options.name || 'preview'] = data.video;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
1467
statics/js/common/plugins/fileupload/js/jquery.fileupload.js
vendored
Executable file
1467
statics/js/common/plugins/fileupload/js/jquery.fileupload.js
vendored
Executable file
File diff suppressed because it is too large
Load Diff
217
statics/js/common/plugins/fileupload/js/jquery.iframe-transport.js
Executable file
217
statics/js/common/plugins/fileupload/js/jquery.iframe-transport.js
Executable file
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* jQuery Iframe Transport Plugin 1.8.3
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* global define, require, window, document */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
// Helper variable to create unique names for the transport iframes:
|
||||
var counter = 0;
|
||||
|
||||
// The iframe transport accepts four additional options:
|
||||
// options.fileInput: a jQuery collection of file input fields
|
||||
// options.paramName: the parameter name for the file form data,
|
||||
// overrides the name property of the file input field(s),
|
||||
// can be a string or an array of strings.
|
||||
// options.formData: an array of objects with name and value properties,
|
||||
// equivalent to the return data of .serializeArray(), e.g.:
|
||||
// [{name: 'a', value: 1}, {name: 'b', value: 2}]
|
||||
// options.initialIframeSrc: the URL of the initial iframe src,
|
||||
// by default set to "javascript:false;"
|
||||
$.ajaxTransport('iframe', function (options) {
|
||||
if (options.async) {
|
||||
// javascript:false as initial iframe src
|
||||
// prevents warning popups on HTTPS in IE6:
|
||||
/*jshint scripturl: true */
|
||||
var initialIframeSrc = options.initialIframeSrc || 'javascript:false;',
|
||||
/*jshint scripturl: false */
|
||||
form,
|
||||
iframe,
|
||||
addParamChar;
|
||||
return {
|
||||
send: function (_, completeCallback) {
|
||||
form = $('<form style="display:none;"></form>');
|
||||
form.attr('accept-charset', options.formAcceptCharset);
|
||||
addParamChar = /\?/.test(options.url) ? '&' : '?';
|
||||
// XDomainRequest only supports GET and POST:
|
||||
if (options.type === 'DELETE') {
|
||||
options.url = options.url + addParamChar + '_method=DELETE';
|
||||
options.type = 'POST';
|
||||
} else if (options.type === 'PUT') {
|
||||
options.url = options.url + addParamChar + '_method=PUT';
|
||||
options.type = 'POST';
|
||||
} else if (options.type === 'PATCH') {
|
||||
options.url = options.url + addParamChar + '_method=PATCH';
|
||||
options.type = 'POST';
|
||||
}
|
||||
// IE versions below IE8 cannot set the name property of
|
||||
// elements that have already been added to the DOM,
|
||||
// so we set the name along with the iframe HTML markup:
|
||||
counter += 1;
|
||||
iframe = $(
|
||||
'<iframe src="' + initialIframeSrc +
|
||||
'" name="iframe-transport-' + counter + '"></iframe>'
|
||||
).bind('load', function () {
|
||||
var fileInputClones,
|
||||
paramNames = $.isArray(options.paramName) ?
|
||||
options.paramName : [options.paramName];
|
||||
iframe
|
||||
.unbind('load')
|
||||
.bind('load', function () {
|
||||
var response;
|
||||
// Wrap in a try/catch block to catch exceptions thrown
|
||||
// when trying to access cross-domain iframe contents:
|
||||
try {
|
||||
response = iframe.contents();
|
||||
// Google Chrome and Firefox do not throw an
|
||||
// exception when calling iframe.contents() on
|
||||
// cross-domain requests, so we unify the response:
|
||||
if (!response.length || !response[0].firstChild) {
|
||||
throw new Error();
|
||||
}
|
||||
} catch (e) {
|
||||
response = undefined;
|
||||
}
|
||||
// The complete callback returns the
|
||||
// iframe content document as response object:
|
||||
completeCallback(
|
||||
200,
|
||||
'success',
|
||||
{'iframe': response}
|
||||
);
|
||||
// Fix for IE endless progress bar activity bug
|
||||
// (happens on form submits to iframe targets):
|
||||
$('<iframe src="' + initialIframeSrc + '"></iframe>')
|
||||
.appendTo(form);
|
||||
window.setTimeout(function () {
|
||||
// Removing the form in a setTimeout call
|
||||
// allows Chrome's developer tools to display
|
||||
// the response result
|
||||
form.remove();
|
||||
}, 0);
|
||||
});
|
||||
form
|
||||
.prop('target', iframe.prop('name'))
|
||||
.prop('action', options.url)
|
||||
.prop('method', options.type);
|
||||
if (options.formData) {
|
||||
$.each(options.formData, function (index, field) {
|
||||
$('<input type="hidden"/>')
|
||||
.prop('name', field.name)
|
||||
.val(field.value)
|
||||
.appendTo(form);
|
||||
});
|
||||
}
|
||||
if (options.fileInput && options.fileInput.length &&
|
||||
options.type === 'POST') {
|
||||
fileInputClones = options.fileInput.clone();
|
||||
// Insert a clone for each file input field:
|
||||
options.fileInput.after(function (index) {
|
||||
return fileInputClones[index];
|
||||
});
|
||||
if (options.paramName) {
|
||||
options.fileInput.each(function (index) {
|
||||
$(this).prop(
|
||||
'name',
|
||||
paramNames[index] || options.paramName
|
||||
);
|
||||
});
|
||||
}
|
||||
// Appending the file input fields to the hidden form
|
||||
// removes them from their original location:
|
||||
form
|
||||
.append(options.fileInput)
|
||||
.prop('enctype', 'multipart/form-data')
|
||||
// enctype must be set as encoding for IE:
|
||||
.prop('encoding', 'multipart/form-data');
|
||||
// Remove the HTML5 form attribute from the input(s):
|
||||
options.fileInput.removeAttr('form');
|
||||
}
|
||||
form.submit();
|
||||
// Insert the file input fields at their original location
|
||||
// by replacing the clones with the originals:
|
||||
if (fileInputClones && fileInputClones.length) {
|
||||
options.fileInput.each(function (index, input) {
|
||||
var clone = $(fileInputClones[index]);
|
||||
// Restore the original name and form properties:
|
||||
$(input)
|
||||
.prop('name', clone.prop('name'))
|
||||
.attr('form', clone.attr('form'));
|
||||
clone.replaceWith(input);
|
||||
});
|
||||
}
|
||||
});
|
||||
form.append(iframe).appendTo(document.body);
|
||||
},
|
||||
abort: function () {
|
||||
if (iframe) {
|
||||
// javascript:false as iframe src aborts the request
|
||||
// and prevents warning popups on HTTPS in IE6.
|
||||
// concat is used to avoid the "Script URL" JSLint error:
|
||||
iframe
|
||||
.unbind('load')
|
||||
.prop('src', initialIframeSrc);
|
||||
}
|
||||
if (form) {
|
||||
form.remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// The iframe transport returns the iframe content document as response.
|
||||
// The following adds converters from iframe to text, json, html, xml
|
||||
// and script.
|
||||
// Please note that the Content-Type for JSON responses has to be text/plain
|
||||
// or text/html, if the browser doesn't include application/json in the
|
||||
// Accept header, else IE will show a download dialog.
|
||||
// The Content-Type for XML responses on the other hand has to be always
|
||||
// application/xml or text/xml, so IE properly parses the XML response.
|
||||
// See also
|
||||
// https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation
|
||||
$.ajaxSetup({
|
||||
converters: {
|
||||
'iframe text': function (iframe) {
|
||||
return iframe && $(iframe[0].body).text();
|
||||
},
|
||||
'iframe json': function (iframe) {
|
||||
return iframe && $.parseJSON($(iframe[0].body).text());
|
||||
},
|
||||
'iframe html': function (iframe) {
|
||||
return iframe && $(iframe[0].body).html();
|
||||
},
|
||||
'iframe xml': function (iframe) {
|
||||
var xmlDoc = iframe && iframe[0];
|
||||
return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc :
|
||||
$.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||
|
||||
$(xmlDoc.body).html());
|
||||
},
|
||||
'iframe script': function (iframe) {
|
||||
return iframe && $.globalEval($(iframe[0].body).text());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}));
|
||||
75
statics/js/common/plugins/fileupload/js/main.js
Executable file
75
statics/js/common/plugins/fileupload/js/main.js
Executable file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* jQuery File Upload Plugin JS Example 8.9.1
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* global $, window */
|
||||
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
// Initialize the jQuery File Upload widget:
|
||||
$('#fileupload').fileupload({
|
||||
// Uncomment the following to send cross-domain cookies:
|
||||
//xhrFields: {withCredentials: true},
|
||||
url: 'server/php/'
|
||||
});
|
||||
|
||||
// Enable iframe cross-domain access via redirect option:
|
||||
$('#fileupload').fileupload(
|
||||
'option',
|
||||
'redirect',
|
||||
window.location.href.replace(
|
||||
/\/[^\/]*$/,
|
||||
'/cors/result.html?%s'
|
||||
)
|
||||
);
|
||||
|
||||
if (window.location.hostname === 'blueimp.github.io') {
|
||||
// Demo settings:
|
||||
$('#fileupload').fileupload('option', {
|
||||
url: '//jquery-file-upload.appspot.com/',
|
||||
// Enable image resizing, except for Android and Opera,
|
||||
// which actually support image resizing, but fail to
|
||||
// send Blob objects via XHR requests:
|
||||
disableImageResize: /Android(?!.*Chrome)|Opera/
|
||||
.test(window.navigator.userAgent),
|
||||
maxFileSize: 5000000,
|
||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i
|
||||
});
|
||||
// Upload server status check for browsers with CORS support:
|
||||
if ($.support.cors) {
|
||||
$.ajax({
|
||||
url: '//jquery-file-upload.appspot.com/',
|
||||
type: 'HEAD'
|
||||
}).fail(function () {
|
||||
$('<div class="alert alert-danger"/>')
|
||||
.text('Upload server currently unavailable - ' +
|
||||
new Date())
|
||||
.appendTo('#fileupload');
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Load existing files:
|
||||
$('#fileupload').addClass('fileupload-processing');
|
||||
$.ajax({
|
||||
// Uncomment the following to send cross-domain cookies:
|
||||
//xhrFields: {withCredentials: true},
|
||||
url: $('#fileupload').fileupload('option', 'url'),
|
||||
dataType: 'json',
|
||||
context: $('#fileupload')[0]
|
||||
}).always(function () {
|
||||
$(this).removeClass('fileupload-processing');
|
||||
}).done(function (result) {
|
||||
$(this).fileupload('option', 'done')
|
||||
.call(this, $.Event('done'), {result: result});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
563
statics/js/common/plugins/fileupload/js/vendor/jquery.ui.widget.js
vendored
Executable file
563
statics/js/common/plugins/fileupload/js/vendor/jquery.ui.widget.js
vendored
Executable file
@@ -0,0 +1,563 @@
|
||||
/*! jQuery UI - v1.11.1+CommonJS - 2014-09-17
|
||||
* http://jqueryui.com
|
||||
* Includes: widget.js
|
||||
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
|
||||
|
||||
(function( factory ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define([ "jquery" ], factory );
|
||||
|
||||
} else if (typeof exports === "object") {
|
||||
// Node/CommonJS:
|
||||
factory(require("jquery"));
|
||||
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}(function( $ ) {
|
||||
/*!
|
||||
* jQuery UI Widget 1.11.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2014 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/jQuery.widget/
|
||||
*/
|
||||
|
||||
|
||||
var widget_uuid = 0,
|
||||
widget_slice = Array.prototype.slice;
|
||||
|
||||
$.cleanData = (function( orig ) {
|
||||
return function( elems ) {
|
||||
var events, elem, i;
|
||||
for ( i = 0; (elem = elems[i]) != null; i++ ) {
|
||||
try {
|
||||
|
||||
// Only trigger remove when necessary to save time
|
||||
events = $._data( elem, "events" );
|
||||
if ( events && events.remove ) {
|
||||
$( elem ).triggerHandler( "remove" );
|
||||
}
|
||||
|
||||
// http://bugs.jquery.com/ticket/8235
|
||||
} catch( e ) {}
|
||||
}
|
||||
orig( elems );
|
||||
};
|
||||
})( $.cleanData );
|
||||
|
||||
$.widget = function( name, base, prototype ) {
|
||||
var fullName, existingConstructor, constructor, basePrototype,
|
||||
// proxiedPrototype allows the provided prototype to remain unmodified
|
||||
// so that it can be used as a mixin for multiple widgets (#8876)
|
||||
proxiedPrototype = {},
|
||||
namespace = name.split( "." )[ 0 ];
|
||||
|
||||
name = name.split( "." )[ 1 ];
|
||||
fullName = namespace + "-" + name;
|
||||
|
||||
if ( !prototype ) {
|
||||
prototype = base;
|
||||
base = $.Widget;
|
||||
}
|
||||
|
||||
// create selector for plugin
|
||||
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
|
||||
return !!$.data( elem, fullName );
|
||||
};
|
||||
|
||||
$[ namespace ] = $[ namespace ] || {};
|
||||
existingConstructor = $[ namespace ][ name ];
|
||||
constructor = $[ namespace ][ name ] = function( options, element ) {
|
||||
// allow instantiation without "new" keyword
|
||||
if ( !this._createWidget ) {
|
||||
return new constructor( options, element );
|
||||
}
|
||||
|
||||
// allow instantiation without initializing for simple inheritance
|
||||
// must use "new" keyword (the code above always passes args)
|
||||
if ( arguments.length ) {
|
||||
this._createWidget( options, element );
|
||||
}
|
||||
};
|
||||
// extend with the existing constructor to carry over any static properties
|
||||
$.extend( constructor, existingConstructor, {
|
||||
version: prototype.version,
|
||||
// copy the object used to create the prototype in case we need to
|
||||
// redefine the widget later
|
||||
_proto: $.extend( {}, prototype ),
|
||||
// track widgets that inherit from this widget in case this widget is
|
||||
// redefined after a widget inherits from it
|
||||
_childConstructors: []
|
||||
});
|
||||
|
||||
basePrototype = new base();
|
||||
// we need to make the options hash a property directly on the new instance
|
||||
// otherwise we'll modify the options hash on the prototype that we're
|
||||
// inheriting from
|
||||
basePrototype.options = $.widget.extend( {}, basePrototype.options );
|
||||
$.each( prototype, function( prop, value ) {
|
||||
if ( !$.isFunction( value ) ) {
|
||||
proxiedPrototype[ prop ] = value;
|
||||
return;
|
||||
}
|
||||
proxiedPrototype[ prop ] = (function() {
|
||||
var _super = function() {
|
||||
return base.prototype[ prop ].apply( this, arguments );
|
||||
},
|
||||
_superApply = function( args ) {
|
||||
return base.prototype[ prop ].apply( this, args );
|
||||
};
|
||||
return function() {
|
||||
var __super = this._super,
|
||||
__superApply = this._superApply,
|
||||
returnValue;
|
||||
|
||||
this._super = _super;
|
||||
this._superApply = _superApply;
|
||||
|
||||
returnValue = value.apply( this, arguments );
|
||||
|
||||
this._super = __super;
|
||||
this._superApply = __superApply;
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
})();
|
||||
});
|
||||
constructor.prototype = $.widget.extend( basePrototype, {
|
||||
// TODO: remove support for widgetEventPrefix
|
||||
// always use the name + a colon as the prefix, e.g., draggable:start
|
||||
// don't prefix for widgets that aren't DOM-based
|
||||
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
|
||||
}, proxiedPrototype, {
|
||||
constructor: constructor,
|
||||
namespace: namespace,
|
||||
widgetName: name,
|
||||
widgetFullName: fullName
|
||||
});
|
||||
|
||||
// If this widget is being redefined then we need to find all widgets that
|
||||
// are inheriting from it and redefine all of them so that they inherit from
|
||||
// the new version of this widget. We're essentially trying to replace one
|
||||
// level in the prototype chain.
|
||||
if ( existingConstructor ) {
|
||||
$.each( existingConstructor._childConstructors, function( i, child ) {
|
||||
var childPrototype = child.prototype;
|
||||
|
||||
// redefine the child widget using the same prototype that was
|
||||
// originally used, but inherit from the new version of the base
|
||||
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
|
||||
});
|
||||
// remove the list of existing child constructors from the old constructor
|
||||
// so the old child constructors can be garbage collected
|
||||
delete existingConstructor._childConstructors;
|
||||
} else {
|
||||
base._childConstructors.push( constructor );
|
||||
}
|
||||
|
||||
$.widget.bridge( name, constructor );
|
||||
|
||||
return constructor;
|
||||
};
|
||||
|
||||
$.widget.extend = function( target ) {
|
||||
var input = widget_slice.call( arguments, 1 ),
|
||||
inputIndex = 0,
|
||||
inputLength = input.length,
|
||||
key,
|
||||
value;
|
||||
for ( ; inputIndex < inputLength; inputIndex++ ) {
|
||||
for ( key in input[ inputIndex ] ) {
|
||||
value = input[ inputIndex ][ key ];
|
||||
if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
|
||||
// Clone objects
|
||||
if ( $.isPlainObject( value ) ) {
|
||||
target[ key ] = $.isPlainObject( target[ key ] ) ?
|
||||
$.widget.extend( {}, target[ key ], value ) :
|
||||
// Don't extend strings, arrays, etc. with objects
|
||||
$.widget.extend( {}, value );
|
||||
// Copy everything else by reference
|
||||
} else {
|
||||
target[ key ] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
||||
|
||||
$.widget.bridge = function( name, object ) {
|
||||
var fullName = object.prototype.widgetFullName || name;
|
||||
$.fn[ name ] = function( options ) {
|
||||
var isMethodCall = typeof options === "string",
|
||||
args = widget_slice.call( arguments, 1 ),
|
||||
returnValue = this;
|
||||
|
||||
// allow multiple hashes to be passed on init
|
||||
options = !isMethodCall && args.length ?
|
||||
$.widget.extend.apply( null, [ options ].concat(args) ) :
|
||||
options;
|
||||
|
||||
if ( isMethodCall ) {
|
||||
this.each(function() {
|
||||
var methodValue,
|
||||
instance = $.data( this, fullName );
|
||||
if ( options === "instance" ) {
|
||||
returnValue = instance;
|
||||
return false;
|
||||
}
|
||||
if ( !instance ) {
|
||||
return $.error( "cannot call methods on " + name + " prior to initialization; " +
|
||||
"attempted to call method '" + options + "'" );
|
||||
}
|
||||
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
|
||||
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
|
||||
}
|
||||
methodValue = instance[ options ].apply( instance, args );
|
||||
if ( methodValue !== instance && methodValue !== undefined ) {
|
||||
returnValue = methodValue && methodValue.jquery ?
|
||||
returnValue.pushStack( methodValue.get() ) :
|
||||
methodValue;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.each(function() {
|
||||
var instance = $.data( this, fullName );
|
||||
if ( instance ) {
|
||||
instance.option( options || {} );
|
||||
if ( instance._init ) {
|
||||
instance._init();
|
||||
}
|
||||
} else {
|
||||
$.data( this, fullName, new object( options, this ) );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
};
|
||||
|
||||
$.Widget = function( /* options, element */ ) {};
|
||||
$.Widget._childConstructors = [];
|
||||
|
||||
$.Widget.prototype = {
|
||||
widgetName: "widget",
|
||||
widgetEventPrefix: "",
|
||||
defaultElement: "<div>",
|
||||
options: {
|
||||
disabled: false,
|
||||
|
||||
// callbacks
|
||||
create: null
|
||||
},
|
||||
_createWidget: function( options, element ) {
|
||||
element = $( element || this.defaultElement || this )[ 0 ];
|
||||
this.element = $( element );
|
||||
this.uuid = widget_uuid++;
|
||||
this.eventNamespace = "." + this.widgetName + this.uuid;
|
||||
this.options = $.widget.extend( {},
|
||||
this.options,
|
||||
this._getCreateOptions(),
|
||||
options );
|
||||
|
||||
this.bindings = $();
|
||||
this.hoverable = $();
|
||||
this.focusable = $();
|
||||
|
||||
if ( element !== this ) {
|
||||
$.data( element, this.widgetFullName, this );
|
||||
this._on( true, this.element, {
|
||||
remove: function( event ) {
|
||||
if ( event.target === element ) {
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.document = $( element.style ?
|
||||
// element within the document
|
||||
element.ownerDocument :
|
||||
// element is window or document
|
||||
element.document || element );
|
||||
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
|
||||
}
|
||||
|
||||
this._create();
|
||||
this._trigger( "create", null, this._getCreateEventData() );
|
||||
this._init();
|
||||
},
|
||||
_getCreateOptions: $.noop,
|
||||
_getCreateEventData: $.noop,
|
||||
_create: $.noop,
|
||||
_init: $.noop,
|
||||
|
||||
destroy: function() {
|
||||
this._destroy();
|
||||
// we can probably remove the unbind calls in 2.0
|
||||
// all event bindings should go through this._on()
|
||||
this.element
|
||||
.unbind( this.eventNamespace )
|
||||
.removeData( this.widgetFullName )
|
||||
// support: jquery <1.6.3
|
||||
// http://bugs.jquery.com/ticket/9413
|
||||
.removeData( $.camelCase( this.widgetFullName ) );
|
||||
this.widget()
|
||||
.unbind( this.eventNamespace )
|
||||
.removeAttr( "aria-disabled" )
|
||||
.removeClass(
|
||||
this.widgetFullName + "-disabled " +
|
||||
"ui-state-disabled" );
|
||||
|
||||
// clean up events and states
|
||||
this.bindings.unbind( this.eventNamespace );
|
||||
this.hoverable.removeClass( "ui-state-hover" );
|
||||
this.focusable.removeClass( "ui-state-focus" );
|
||||
},
|
||||
_destroy: $.noop,
|
||||
|
||||
widget: function() {
|
||||
return this.element;
|
||||
},
|
||||
|
||||
option: function( key, value ) {
|
||||
var options = key,
|
||||
parts,
|
||||
curOption,
|
||||
i;
|
||||
|
||||
if ( arguments.length === 0 ) {
|
||||
// don't return a reference to the internal hash
|
||||
return $.widget.extend( {}, this.options );
|
||||
}
|
||||
|
||||
if ( typeof key === "string" ) {
|
||||
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
||||
options = {};
|
||||
parts = key.split( "." );
|
||||
key = parts.shift();
|
||||
if ( parts.length ) {
|
||||
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
|
||||
for ( i = 0; i < parts.length - 1; i++ ) {
|
||||
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
|
||||
curOption = curOption[ parts[ i ] ];
|
||||
}
|
||||
key = parts.pop();
|
||||
if ( arguments.length === 1 ) {
|
||||
return curOption[ key ] === undefined ? null : curOption[ key ];
|
||||
}
|
||||
curOption[ key ] = value;
|
||||
} else {
|
||||
if ( arguments.length === 1 ) {
|
||||
return this.options[ key ] === undefined ? null : this.options[ key ];
|
||||
}
|
||||
options[ key ] = value;
|
||||
}
|
||||
}
|
||||
|
||||
this._setOptions( options );
|
||||
|
||||
return this;
|
||||
},
|
||||
_setOptions: function( options ) {
|
||||
var key;
|
||||
|
||||
for ( key in options ) {
|
||||
this._setOption( key, options[ key ] );
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
_setOption: function( key, value ) {
|
||||
this.options[ key ] = value;
|
||||
|
||||
if ( key === "disabled" ) {
|
||||
this.widget()
|
||||
.toggleClass( this.widgetFullName + "-disabled", !!value );
|
||||
|
||||
// If the widget is becoming disabled, then nothing is interactive
|
||||
if ( value ) {
|
||||
this.hoverable.removeClass( "ui-state-hover" );
|
||||
this.focusable.removeClass( "ui-state-focus" );
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
enable: function() {
|
||||
return this._setOptions({ disabled: false });
|
||||
},
|
||||
disable: function() {
|
||||
return this._setOptions({ disabled: true });
|
||||
},
|
||||
|
||||
_on: function( suppressDisabledCheck, element, handlers ) {
|
||||
var delegateElement,
|
||||
instance = this;
|
||||
|
||||
// no suppressDisabledCheck flag, shuffle arguments
|
||||
if ( typeof suppressDisabledCheck !== "boolean" ) {
|
||||
handlers = element;
|
||||
element = suppressDisabledCheck;
|
||||
suppressDisabledCheck = false;
|
||||
}
|
||||
|
||||
// no element argument, shuffle and use this.element
|
||||
if ( !handlers ) {
|
||||
handlers = element;
|
||||
element = this.element;
|
||||
delegateElement = this.widget();
|
||||
} else {
|
||||
element = delegateElement = $( element );
|
||||
this.bindings = this.bindings.add( element );
|
||||
}
|
||||
|
||||
$.each( handlers, function( event, handler ) {
|
||||
function handlerProxy() {
|
||||
// allow widgets to customize the disabled handling
|
||||
// - disabled as an array instead of boolean
|
||||
// - disabled class as method for disabling individual parts
|
||||
if ( !suppressDisabledCheck &&
|
||||
( instance.options.disabled === true ||
|
||||
$( this ).hasClass( "ui-state-disabled" ) ) ) {
|
||||
return;
|
||||
}
|
||||
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
||||
.apply( instance, arguments );
|
||||
}
|
||||
|
||||
// copy the guid so direct unbinding works
|
||||
if ( typeof handler !== "string" ) {
|
||||
handlerProxy.guid = handler.guid =
|
||||
handler.guid || handlerProxy.guid || $.guid++;
|
||||
}
|
||||
|
||||
var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
|
||||
eventName = match[1] + instance.eventNamespace,
|
||||
selector = match[2];
|
||||
if ( selector ) {
|
||||
delegateElement.delegate( selector, eventName, handlerProxy );
|
||||
} else {
|
||||
element.bind( eventName, handlerProxy );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_off: function( element, eventName ) {
|
||||
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
|
||||
element.unbind( eventName ).undelegate( eventName );
|
||||
},
|
||||
|
||||
_delay: function( handler, delay ) {
|
||||
function handlerProxy() {
|
||||
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
||||
.apply( instance, arguments );
|
||||
}
|
||||
var instance = this;
|
||||
return setTimeout( handlerProxy, delay || 0 );
|
||||
},
|
||||
|
||||
_hoverable: function( element ) {
|
||||
this.hoverable = this.hoverable.add( element );
|
||||
this._on( element, {
|
||||
mouseenter: function( event ) {
|
||||
$( event.currentTarget ).addClass( "ui-state-hover" );
|
||||
},
|
||||
mouseleave: function( event ) {
|
||||
$( event.currentTarget ).removeClass( "ui-state-hover" );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_focusable: function( element ) {
|
||||
this.focusable = this.focusable.add( element );
|
||||
this._on( element, {
|
||||
focusin: function( event ) {
|
||||
$( event.currentTarget ).addClass( "ui-state-focus" );
|
||||
},
|
||||
focusout: function( event ) {
|
||||
$( event.currentTarget ).removeClass( "ui-state-focus" );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_trigger: function( type, event, data ) {
|
||||
var prop, orig,
|
||||
callback = this.options[ type ];
|
||||
|
||||
data = data || {};
|
||||
event = $.Event( event );
|
||||
event.type = ( type === this.widgetEventPrefix ?
|
||||
type :
|
||||
this.widgetEventPrefix + type ).toLowerCase();
|
||||
// the original event may come from any element
|
||||
// so we need to reset the target on the new event
|
||||
event.target = this.element[ 0 ];
|
||||
|
||||
// copy original event properties over to the new event
|
||||
orig = event.originalEvent;
|
||||
if ( orig ) {
|
||||
for ( prop in orig ) {
|
||||
if ( !( prop in event ) ) {
|
||||
event[ prop ] = orig[ prop ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.element.trigger( event, data );
|
||||
return !( $.isFunction( callback ) &&
|
||||
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
|
||||
event.isDefaultPrevented() );
|
||||
}
|
||||
};
|
||||
|
||||
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
|
||||
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
|
||||
if ( typeof options === "string" ) {
|
||||
options = { effect: options };
|
||||
}
|
||||
var hasOptions,
|
||||
effectName = !options ?
|
||||
method :
|
||||
options === true || typeof options === "number" ?
|
||||
defaultEffect :
|
||||
options.effect || defaultEffect;
|
||||
options = options || {};
|
||||
if ( typeof options === "number" ) {
|
||||
options = { duration: options };
|
||||
}
|
||||
hasOptions = !$.isEmptyObject( options );
|
||||
options.complete = callback;
|
||||
if ( options.delay ) {
|
||||
element.delay( options.delay );
|
||||
}
|
||||
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
|
||||
element[ method ]( options );
|
||||
} else if ( effectName !== method && element[ effectName ] ) {
|
||||
element[ effectName ]( options.duration, options.easing, callback );
|
||||
} else {
|
||||
element.queue(function( next ) {
|
||||
$( this )[ method ]();
|
||||
if ( callback ) {
|
||||
callback.call( element[ 0 ] );
|
||||
}
|
||||
next();
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
var widget = $.widget;
|
||||
|
||||
|
||||
|
||||
}));
|
||||
1734
statics/js/common/plugins/jquery.dialog.js
Executable file
1734
statics/js/common/plugins/jquery.dialog.js
Executable file
File diff suppressed because it is too large
Load Diff
139
statics/js/common/plugins/jquery.print.js
Executable file
139
statics/js/common/plugins/jquery.print.js
Executable file
@@ -0,0 +1,139 @@
|
||||
define(function(require){
|
||||
var $ = require("jquery");
|
||||
require("../../../../statics/css/print.css");
|
||||
/**
|
||||
* @name 打印
|
||||
* @author Jony
|
||||
* TODO
|
||||
table宽度自适应
|
||||
*/
|
||||
|
||||
var document = window.document;
|
||||
|
||||
/**
|
||||
* 打印页面的一个区域
|
||||
*
|
||||
* @param {Object} opt 选项
|
||||
* @example
|
||||
$('#content').printArea();
|
||||
*/
|
||||
$.fn.printArea = function (opt) {
|
||||
opt = $.extend({
|
||||
preview: false, // 是否预览
|
||||
table: false, // 是否打印table
|
||||
usePageStyle: true // 是否使用页面中的样式
|
||||
}, opt);
|
||||
|
||||
var content,
|
||||
iframe,
|
||||
win,
|
||||
links = document.getElementsByTagName("link"),
|
||||
html = '<!doctype html><html><head><meta charset="utf-8"><title></title>';
|
||||
|
||||
// 自动添加样式
|
||||
for (var i=0,len=links.length; i<len; i++) {
|
||||
if (links[i].rel === 'stylesheet') {
|
||||
if ( opt.usePageStyle || links[i].href.indexOf('print.css') !== -1 ) {
|
||||
html += links[i].outerHTML;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//content += '<object classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" width="0" height="0" id="wb" viewastext></object>';
|
||||
content = opt.table ? '' : this[0].outerHTML;
|
||||
html += '</head><body>' + content + '</body></html>';
|
||||
|
||||
// 构造iframe
|
||||
var _self = this , timer , firstCall ,win , $html = $(html);
|
||||
iframe = document.createElement("iframe");
|
||||
iframe.id = "printProxyIframe";
|
||||
iframe.frameBorder = 0;
|
||||
iframe.setAttribute("style", 'position:absolute;z-index:100;left:0;top:0;width:100%;height:100%;background:#fff;'+ (opt.preview ? '' : 'visibility:hidden;') );
|
||||
iframe.onload = function() {
|
||||
// console.log(iframe.contentWindow.document.location);
|
||||
// iframe.onload = null;
|
||||
win = iframe.contentWindow;
|
||||
win.canAccess = true;
|
||||
}
|
||||
iframe.src = "javascript:void((function(){document.open();document.domain='"+ document.domain + "';document.close()})())";
|
||||
document.body.appendChild(iframe);
|
||||
var timer = setInterval(function(){
|
||||
if(iframe.contentWindow.canAccess){
|
||||
clearInterval(timer);
|
||||
//iframe.contentWindow.document.body.innerHTML = '这是新设置的页面内容';
|
||||
// 重新构造jqgrid渲染的table为单个table
|
||||
//win.document.write(html);
|
||||
win.onafterprint = function() {
|
||||
win.onafterprint = null;
|
||||
iframe.parentNode.removeChild(iframe);
|
||||
};
|
||||
if (opt.table) {
|
||||
var $tb = _self.find("table.ui-jqgrid-htable").eq(0).clone().removeAttr("style").attr("class", "ui-table-print");
|
||||
var $data = _self.find("table.ui-jqgrid-btable").eq(0).find("tbody").clone();
|
||||
var $title = _self.find("div.grid-title");
|
||||
var $subtitle = _self.find("div.grid-subtitle");
|
||||
var $summary = _self.find("table.ui-jqgrid-ftable").find("tbody").clone();
|
||||
|
||||
if ($title.length) {
|
||||
$('<caption/>').prependTo($tb).append($title.clone()).append($subtitle.clone());
|
||||
}
|
||||
$tb.find("th").css("width", "auto");
|
||||
$summary.find("td").css("width", "auto");
|
||||
$data.children().eq(0).remove();
|
||||
$tb.append($data).append($summary);
|
||||
//win.document.body.appendChild($tb[0]);
|
||||
$(win.document.body).append($html).append($tb);
|
||||
}
|
||||
|
||||
// 开始打印
|
||||
if(timer){
|
||||
clearTimeout(timer);
|
||||
}
|
||||
timer = setTimeout(function(){
|
||||
win.focus();
|
||||
win.print();
|
||||
},100);
|
||||
|
||||
if (!opt.preview) {
|
||||
// 自销毁
|
||||
setTimeout(function(){
|
||||
iframe.parentNode && iframe.parentNode.removeChild(iframe);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
|
||||
//openWindow(html);
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 打印jqgrid渲染的table
|
||||
*
|
||||
* @param {Object} opt 选项
|
||||
* @example
|
||||
$('#content').printTable();
|
||||
*/
|
||||
$.fn.printTable = function (opt) {
|
||||
opt = opt || {};
|
||||
opt.table = true;
|
||||
opt.usePageStyle = false;
|
||||
return this.printArea(opt);
|
||||
};
|
||||
|
||||
|
||||
// 新开窗口打印
|
||||
function openWindow(html) {
|
||||
var win;
|
||||
win = window.open("", "_blank", "top=0,left=0,width="+ window.innerWidth +",height="+ window.innerHeight +",toolbar=no,menubar=no");
|
||||
win.document.write(html);
|
||||
win.document.close();
|
||||
win.focus();
|
||||
win.print();
|
||||
win.onafterprint = function() {
|
||||
win.close();
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
BIN
statics/js/common/plugins/validator/images/loading.gif
Executable file
BIN
statics/js/common/plugins/validator/images/loading.gif
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 457 B |
BIN
statics/js/common/plugins/validator/images/validator_simple.png
Executable file
BIN
statics/js/common/plugins/validator/images/validator_simple.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
65
statics/js/common/plugins/validator/jquery.validator.css
Executable file
65
statics/js/common/plugins/validator/jquery.validator.css
Executable file
@@ -0,0 +1,65 @@
|
||||
@charset "utf-8";
|
||||
/*! nice Validator 0.8.0
|
||||
* (c) 2012-2014 Jony Zhang <zj86@live.cn>, MIT Licensed
|
||||
* http://niceue.com/validator/
|
||||
*/
|
||||
.n-inline-block,.nice-validator input,.nice-validator select,.nice-validator textarea,.msg-wrap,.n-icon,.n-msg{display:inline-block;*display:inline;*zoom:1}
|
||||
.msg-box{position:relative;*zoom:1}
|
||||
.msg-wrap{position:relative;white-space:nowrap}
|
||||
.msg-wrap,.n-icon,.n-msg{vertical-align:top}
|
||||
.n-arrow{position:absolute;overflow:hidden;}
|
||||
.n-arrow b,.n-arrow i{position:absolute;left:0;top:0;border:0;margin:0;padding:0;overflow:hidden;font-weight:400;font-style:normal;font-size:12px;font-family:serif;line-height:14px;_line-height:15px}
|
||||
.n-arrow i{text-shadow:none}
|
||||
.n-icon{width:16px;height:16px;overflow:hidden;background-repeat:no-repeat}
|
||||
.n-msg{display:inline-block;line-height:15px;margin-left:2px;*margin-top:-1px;_margin-top:0;font-size:12px;font-family:simsun}
|
||||
.n-error{color:#c33}
|
||||
.n-ok{color:#390}
|
||||
.n-tip,.n-loading{color:#808080}
|
||||
.n-error .n-icon{background-position:0 0}
|
||||
.n-ok .n-icon{background-position:-16px 0}
|
||||
.n-tip .n-icon{background-position:-32px 0}
|
||||
.n-loading .n-icon{background:url("images/loading.gif") 0 center no-repeat !important}
|
||||
.n-top,.n-right,.n-bottom,.n-left{display:inline-block;line-height:0;vertical-align:top;outline:0}
|
||||
.n-top .n-arrow,.n-bottom .n-arrow{height:6px;width:12px;left:8px}
|
||||
.n-left .n-arrow,.n-right .n-arrow{width:6px;height:12px;top:6px}
|
||||
.n-top{vertical-align:top;}
|
||||
.n-top .msg-wrap{margin-bottom:6px}
|
||||
.n-top .n-arrow{bottom:-6px;}
|
||||
.n-top .n-arrow b{top:-6px}
|
||||
.n-top .n-arrow i{top:-7px}
|
||||
.n-bottom{vertical-align:bottom;}
|
||||
.n-bottom .msg-wrap{margin-top:6px}
|
||||
.n-bottom .n-arrow{top:-6px;}
|
||||
.n-bottom .n-arrow b{top:-1px}
|
||||
.n-bottom .n-arrow i{top:0}
|
||||
.n-left .msg-wrap{right:100%;margin-right:6px}
|
||||
.n-left .n-arrow{right:-6px;}
|
||||
.n-left .n-arrow b{left:-6px}
|
||||
.n-left .n-arrow i{left:-7px}
|
||||
.n-right .msg-wrap{margin-left:6px}
|
||||
.n-right .n-arrow{left:-6px;}
|
||||
.n-right .n-arrow b{left:1px}
|
||||
.n-right .n-arrow i{left:2px}
|
||||
.n-default .n-left,.n-default .n-right{margin-top:5px}
|
||||
.n-default .n-top .msg-wrap{bottom:100%}
|
||||
.n-default .n-bottom .msg-wrap{top:100%}
|
||||
.n-default .msg-wrap{position:absolute;z-index:1;}
|
||||
.n-default .msg-wrap .n-icon{background-image:url("images/validator_default.png")}
|
||||
.n-default .n-tip .n-icon{display:none}
|
||||
.n-simple .msg-wrap{position:absolute;z-index:1;}
|
||||
.n-simple .msg-wrap .n-icon{background-image:url("images/validator_simple.png")}
|
||||
.n-simple .n-top .msg-wrap{bottom:100%}
|
||||
.n-simple .n-bottom .msg-wrap{top:100%}
|
||||
.n-simple .n-left,.n-simple .n-right{margin-top:5px}
|
||||
.n-simple .n-bottom .msg-wrap{margin-top:3px}
|
||||
.n-simple .n-tip .n-icon{display:none}
|
||||
.n-yellow .msg-wrap{position:absolute;z-index:1;padding:4px 6px;font-size:12px;border:1px solid transparent;background-color:#fffcef;border-color:#ffbb76;color:#db7c22;box-shadow:0 1px 3px #ccc;border-radius:2px;}
|
||||
.n-yellow .msg-wrap .n-arrow b{color:#ffbb76;text-shadow:0 0 2px #ccc}
|
||||
.n-yellow .msg-wrap .n-arrow i{color:#fffcef}
|
||||
.n-yellow .msg-wrap .n-icon{background-image:url("images/validator_simple.png")}
|
||||
.n-yellow .n-top .msg-wrap{bottom:100%}
|
||||
.n-yellow .n-bottom .msg-wrap{top:100%}
|
||||
.n-yellow .n-tip,.n-yellow .n-ok,.n-yellow .n-loading{background-color:#f8fdff;border-color:#ddd;color:#333;box-shadow:0 1px 3px #ccc;}
|
||||
.n-yellow .n-tip .n-arrow b,.n-yellow .n-ok .n-arrow b,.n-yellow .n-loading .n-arrow b{color:#ddd;text-shadow:0 0 2px #ccc}
|
||||
.n-yellow .n-tip .n-arrow i,.n-yellow .n-ok .n-arrow i,.n-yellow .n-loading .n-arrow i{color:#f8fdff}
|
||||
.n-yellow .n-tip .n-icon{display:none}
|
||||
5
statics/js/common/plugins/validator/jquery.validator.js
Executable file
5
statics/js/common/plugins/validator/jquery.validator.js
Executable file
File diff suppressed because one or more lines are too long
162
statics/js/common/plugins/validator/local/zh_CN.js
Executable file
162
statics/js/common/plugins/validator/local/zh_CN.js
Executable file
@@ -0,0 +1,162 @@
|
||||
/*********************************
|
||||
* Themes, rules, and i18n support
|
||||
* Locale: Chinese; 中文
|
||||
*********************************/
|
||||
(function(factory) {
|
||||
if (typeof define === 'function') {
|
||||
define(function(require, exports, module){
|
||||
var $ = require('jquery'); $._VALIDATOR_URI = module.uri;
|
||||
require('../jquery.validator')($);
|
||||
factory($);
|
||||
});
|
||||
} else {
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function($) {
|
||||
/* Global configuration
|
||||
*/
|
||||
$.validator.config({
|
||||
//stopOnError: false,
|
||||
//theme: 'yellow_right',
|
||||
defaultMsg: "{0}格式不正确",
|
||||
loadingMsg: "正在验证...",
|
||||
|
||||
// Custom rules
|
||||
rules: {
|
||||
digits: [/^\d+$/, "请输入数字"]
|
||||
,letters: [/^[a-z]+$/i, "请输入字母"]
|
||||
,date: [/^\d{4}-\d{1,2}-\d{1,2}$/, "请输入有效的日期,格式:yyyy-mm-dd"]
|
||||
,time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "请输入有效的时间,00:00到23:59之间"]
|
||||
,email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "请输入有效的邮箱"]
|
||||
,url: [/^(https?|s?ftp):\/\/\S+$/i, "请输入有效的网址"]
|
||||
,qq: [/^[1-9]\d{4,}$/, "请输入有效的QQ号"]
|
||||
,IDcard: [/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[A-Z])$/, "请输入正确的身份证号码"]
|
||||
,tel: [/^(?:(?:0\d{2,3}[\- ]?[1-9]\d{6,7})|(?:[48]00[\- ]?[1-9]\d{6}))$/, "请输入有效的电话号码"]
|
||||
,mobile: [/^1[3-9]\d{9}$/, "请输入有效的手机号"]
|
||||
,zipcode: [/^\d{6}$/, "请检查邮政编码格式"]
|
||||
,chinese: [/^[\u0391-\uFFE5]+$/, "请输入中文字符"]
|
||||
,username: [/^\w{3,12}$/, "请输入3-12位数字、字母、下划线"]
|
||||
,password: [/^[\S]{6,16}$/, "请输入6-16位字符,不能包含空格"]
|
||||
,accept: function (element, params){
|
||||
if (!params) return true;
|
||||
var ext = params[0];
|
||||
return (ext === '*') ||
|
||||
(new RegExp(".(?:" + ext + ")$", "i")).test(element.value) ||
|
||||
this.renderMsg("只接受{1}后缀的文件", ext.replace(/\|/g, ','));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
/* Default error messages
|
||||
*/
|
||||
$.validator.config({
|
||||
messages: {
|
||||
error: "网络异常",
|
||||
timeout: "请求超时",
|
||||
required: "{0}不能为空",
|
||||
remote: "{0}已被使用",
|
||||
integer: {
|
||||
'*': "请输入整数",
|
||||
'+': "请输入正整数",
|
||||
'+0': "请输入正整数或0",
|
||||
'-': "请输入负整数",
|
||||
'-0': "请输入负整数或0"
|
||||
},
|
||||
match: {
|
||||
eq: "{0}与{1}不一致",
|
||||
neq: "{0}与{1}不能相同",
|
||||
lt: "{0}必须小于{1}",
|
||||
gt: "{0}必须大于{1}",
|
||||
lte: "{0}必须小于或等于{1}",
|
||||
gte: "{0}必须大于或等于{1}"
|
||||
},
|
||||
range: {
|
||||
rg: "请输入{1}到{2}的数",
|
||||
gte: "请输入大于或等于{1}的数",
|
||||
lte: "请输入小于或等于{1}的数"
|
||||
},
|
||||
checked: {
|
||||
eq: "请选择{1}项",
|
||||
rg: "请选择{1}到{2}项",
|
||||
gte: "请至少选择{1}项",
|
||||
lte: "请最多选择{1}项"
|
||||
},
|
||||
length: {
|
||||
eq: "请输入{1}个字符",
|
||||
rg: "请输入{1}到{2}个字符",
|
||||
gte: "请至少输入{1}个字符",
|
||||
lte: "请最多输入{1}个字符",
|
||||
eq_2: "",
|
||||
rg_2: "",
|
||||
gte_2: "",
|
||||
lte_2: ""
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/* Themes
|
||||
*/
|
||||
var TPL_ICON = '<span class="n-arrow"><b>◆</b><i>◆</i></span><span class="n-icon"></span>';
|
||||
$.validator.setTheme({
|
||||
'simple_right': {
|
||||
formClass: 'n-simple',
|
||||
msgClass: 'n-right'
|
||||
},
|
||||
'simple_bottom': {
|
||||
formClass: 'n-simple',
|
||||
msgClass: 'n-bottom'
|
||||
},
|
||||
'yellow_top': {
|
||||
formClass: 'n-yellow',
|
||||
msgClass: 'n-top',
|
||||
msgIcon: TPL_ICON
|
||||
},
|
||||
'yellow_bottom': {
|
||||
formClass: 'n-yellow',
|
||||
msgClass: 'n-bottom',
|
||||
msgIcon: TPL_ICON
|
||||
},
|
||||
'yellow_right': {
|
||||
formClass: 'n-yellow',
|
||||
msgClass: 'n-right',
|
||||
msgIcon: TPL_ICON
|
||||
},
|
||||
'yellow_right_effect': {
|
||||
formClass: 'n-yellow',
|
||||
msgClass: 'n-right',
|
||||
msgIcon: TPL_ICON,
|
||||
msgShow: function($msgbox, type){
|
||||
var $el = $msgbox.children();
|
||||
if ($el.is(':animated')) return;
|
||||
if (type === 'error') {
|
||||
$el.css({
|
||||
left: '20px',
|
||||
opacity: 0
|
||||
}).delay(100).show().stop().animate({
|
||||
left: '-4px',
|
||||
opacity: 1
|
||||
}, 150).animate({
|
||||
left: '3px'
|
||||
}, 80).animate({
|
||||
left: 0
|
||||
}, 80);
|
||||
} else {
|
||||
$el.css({
|
||||
left: 0,
|
||||
opacity: 1
|
||||
}).fadeIn(200);
|
||||
}
|
||||
},
|
||||
msgHide: function($msgbox, type){
|
||||
var $el = $msgbox.children();
|
||||
$el.stop().delay(100).show().animate({
|
||||
left: '20px',
|
||||
opacity: 0
|
||||
}, 300, function(){
|
||||
$msgbox.hide();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
50
statics/js/common/seajs/2.1.1/sea.js
Executable file
50
statics/js/common/seajs/2.1.1/sea.js
Executable file
@@ -0,0 +1,50 @@
|
||||
/*! Sea.js 2.1.1 | seajs.org/LICENSE.md
|
||||
//# sourceMappingURL=sea.js.map
|
||||
*/(function(t,u){function v(b){return function(c){return Object.prototype.toString.call(c)==="[object "+b+"]"}}function Q(){return w++}function I(b,c){var a;a=b.charAt(0);if(R.test(b))a=b;else if("."===a){a=(c?c.match(E)[0]:h.cwd)+b;for(a=a.replace(S,"/");a.match(J);)a=a.replace(J,"/")}else a="/"===a?(a=h.cwd.match(T))?a[0]+b.substring(1):b:h.base+b;return a}function K(b,c){if(!b)return"";var a=b,d=h.alias,a=b=d&&F(d[a])?d[a]:a,d=h.paths,g;if(d&&(g=a.match(U))&&F(d[g[1]]))a=d[g[1]]+g[2];g=a;var e=h.vars;
|
||||
e&&-1<g.indexOf("{")&&(g=g.replace(V,function(a,b){return F(e[b])?e[b]:a}));a=g.length-1;d=g.charAt(a);b="#"===d?g.substring(0,a):".js"===g.substring(a-2)||0<g.indexOf("?")||".css"===g.substring(a-3)||"/"===d?g:g+".js";g=I(b,c);var a=h.map,l=g;if(a)for(var d=0,f=a.length;d<f&&!(l=a[d],l=x(l)?l(g)||g:g.replace(l[0],l[1]),l!==g);d++);return l}function L(b,c){var a=b.sheet,d;if(M)a&&(d=!0);else if(a)try{a.cssRules&&(d=!0)}catch(g){"NS_ERROR_DOM_SECURITY_ERR"===g.name&&(d=!0)}setTimeout(function(){d?
|
||||
c():L(b,c)},20)}function W(){if(y)return y;if(z&&"interactive"===z.readyState)return z;for(var b=s.getElementsByTagName("script"),c=b.length-1;0<=c;c--){var a=b[c];if("interactive"===a.readyState)return z=a}}function e(b,c){this.uri=b;this.dependencies=c||[];this.exports=null;this.status=0;this._waitings={};this._remain=0}if(!t.seajs){var f=t.seajs={version:"2.1.1"},h=f.data={},X=v("Object"),F=v("String"),A=Array.isArray||v("Array"),x=v("Function"),w=0,p=h.events={};f.on=function(b,c){(p[b]||(p[b]=
|
||||
[])).push(c);return f};f.off=function(b,c){if(!b&&!c)return p=h.events={},f;var a=p[b];if(a)if(c)for(var d=a.length-1;0<=d;d--)a[d]===c&&a.splice(d,1);else delete p[b];return f};var m=f.emit=function(b,c){var a=p[b],d;if(a)for(a=a.slice();d=a.shift();)d(c);return f},E=/[^?#]*\//,S=/\/\.\//g,J=/\/[^/]+\/\.\.\//,U=/^([^/:]+)(\/.+)$/,V=/{([^{]+)}/g,R=/^\/\/.|:\//,T=/^.*?\/\/.*?\//,n=document,q=location,B=q.href.match(E)[0],k=n.getElementsByTagName("script"),k=n.getElementById("seajsnode")||k[k.length-
|
||||
1],k=((k.hasAttribute?k.src:k.getAttribute("src",4))||B).match(E)[0],s=n.getElementsByTagName("head")[0]||n.documentElement,N=s.getElementsByTagName("base")[0],O=/\.css(?:\?|$)/i,Y=/^(?:loaded|complete|undefined)$/,y,z,M=536>1*navigator.userAgent.replace(/.*AppleWebKit\/(\d+)\..*/,"$1"),Z=/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\/\*[\S\s]*?\*\/|\/(?:\\\/|[^\/\r\n])+\/(?=[^\/])|\/\/.*|\.\s*require|(?:^|[^$])\brequire\s*\(\s*(["'])(.+?)\1\s*\)/g,$=/\\\\/g,r=f.cache={},C,G={},H={},D={},j=e.STATUS={FETCHING:1,
|
||||
SAVED:2,LOADING:3,LOADED:4,EXECUTING:5,EXECUTED:6};e.prototype.resolve=function(){for(var b=this.dependencies,c=[],a=0,d=b.length;a<d;a++)c[a]=e.resolve(b[a],this.uri);return c};e.prototype.load=function(){if(!(this.status>=j.LOADING)){this.status=j.LOADING;var b=this.resolve();m("load",b);for(var c=this._remain=b.length,a,d=0;d<c;d++)a=e.get(b[d]),a.status<j.LOADED?a._waitings[this.uri]=(a._waitings[this.uri]||0)+1:this._remain--;if(0===this._remain)this.onload();else{for(var g={},d=0;d<c;d++)a=
|
||||
r[b[d]],a.status<j.FETCHING?a.fetch(g):a.status===j.SAVED&&a.load();for(var h in g)if(g.hasOwnProperty(h))g[h]()}}};e.prototype.onload=function(){this.status=j.LOADED;this.callback&&this.callback();var b=this._waitings,c,a;for(c in b)if(b.hasOwnProperty(c)&&(a=r[c],a._remain-=b[c],0===a._remain))a.onload();delete this._waitings;delete this._remain};e.prototype.fetch=function(b){function c(){var a=g.requestUri,b=g.onRequest,c=g.charset,d=O.test(a),e=n.createElement(d?"link":"script");if(c&&(c=x(c)?
|
||||
c(a):c))e.charset=c;var f=e;d&&(M||!("onload"in f))?setTimeout(function(){L(f,b)},1):f.onload=f.onerror=f.onreadystatechange=function(){Y.test(f.readyState)&&(f.onload=f.onerror=f.onreadystatechange=null,!d&&!h.debug&&s.removeChild(f),f=null,b())};d?(e.rel="stylesheet",e.href=a):(e.async=!0,e.src=a);y=e;N?s.insertBefore(e,N):s.appendChild(e);y=null}function a(){delete G[f];H[f]=!0;C&&(e.save(d,C),C=null);var a,b=D[f];for(delete D[f];a=b.shift();)a.load()}var d=this.uri;this.status=j.FETCHING;var g=
|
||||
{uri:d};m("fetch",g);var f=g.requestUri||d;!f||H[f]?this.load():G[f]?D[f].push(this):(G[f]=!0,D[f]=[this],m("request",g={uri:d,requestUri:f,onRequest:a,charset:h.charset}),g.requested||(b?b[g.requestUri]=c:c()))};e.prototype.exec=function(){function b(a){return e.get(b.resolve(a)).exec()}if(this.status>=j.EXECUTING)return this.exports;this.status=j.EXECUTING;var c=this.uri;b.resolve=function(a){return e.resolve(a,c)};b.async=function(a,g){e.use(a,g,c+"_async_"+w++);return b};var a=this.factory,a=
|
||||
x(a)?a(b,this.exports={},this):a;a===u&&(a=this.exports);null===a&&!O.test(c)&&m("error",this);delete this.factory;this.exports=a;this.status=j.EXECUTED;m("exec",this);return a};e.resolve=function(b,c){var a={id:b,refUri:c};m("resolve",a);return a.uri||K(a.id,c)};e.define=function(b,c,a){var d=arguments.length;1===d?(a=b,b=u):2===d&&(a=c,A(b)?(c=b,b=u):c=u);if(!A(c)&&x(a)){var g=[];a.toString().replace($,"").replace(Z,function(a,b,c){c&&g.push(c)});c=g}d={id:b,uri:e.resolve(b),deps:c,factory:a};if(!d.uri&&
|
||||
n.attachEvent){var f=W();f&&(d.uri=f.src)}m("define",d);d.uri?e.save(d.uri,d):C=d};e.save=function(b,c){var a=e.get(b);a.status<j.SAVED&&(a.id=c.id||b,a.dependencies=c.deps||[],a.factory=c.factory,a.status=j.SAVED)};e.get=function(b,c){return r[b]||(r[b]=new e(b,c))};e.use=function(b,c,a){var d=e.get(a,A(b)?b:[b]);d.callback=function(){for(var a=[],b=d.resolve(),e=0,f=b.length;e<f;e++)a[e]=r[b[e]].exec();c&&c.apply(t,a);delete d.callback};d.load()};e.preload=function(b){var c=h.preload,a=c.length;
|
||||
a?e.use(c,function(){c.splice(0,a);e.preload(b)},h.cwd+"_preload_"+w++):b()};f.use=function(b,c){e.preload(function(){e.use(b,c,h.cwd+"_use_"+w++)});return f};e.define.cmd={};t.define=e.define;f.Module=e;h.fetchedList=H;h.cid=Q;f.resolve=K;f.require=function(b){return(r[e.resolve(b)]||{}).exports};h.base=(k.match(/^(.+?\/)(\?\?)?(seajs\/)+/)||["",k])[1];h.dir=k;h.cwd=B;h.charset="utf-8";var B=h,P=[],q=q.search.replace(/(seajs-\w+)(&|$)/g,"$1=1$2"),q=q+(" "+n.cookie);q.replace(/(seajs-\w+)=1/g,function(b,
|
||||
c){P.push(c)});B.preload=P;f.config=function(b){for(var c in b){var a=b[c],d=h[c];if(d&&X(d))for(var e in a)d[e]=a[e];else A(d)?a=d.concat(a):"base"===c&&("/"===a.slice(-1)||(a+="/"),a=I(a)),h[c]=a}m("config",b);return f}}})(this);
|
||||
|
||||
// Ç¨ÒÆjQueryµÈAMDÄ£¿éµ½CMD
|
||||
define.amd = define.cmd;
|
||||
|
||||
document.getElementById("seajsnode").getAttribute("src").replace(/(?:\?|&)(\w+)=([^&]*)/g, function(m, m1, m2) {
|
||||
seajs.data[m1] = m1==="debug" ? true : m2;
|
||||
});
|
||||
|
||||
seajs.config({
|
||||
base: "../../statics/js/",
|
||||
map: seajs.data.debug ? [] : [function(url) {
|
||||
return (url in seajs.cache || ~url.search(/jquery-(?:\d+\.){3}|json2/)) ? url :
|
||||
url + (~url.lastIndexOf("?")?"&":"?") + "ver=" + seajs.data.ver;
|
||||
}],
|
||||
paths: {
|
||||
jqgrid: "common/plugins/grid",
|
||||
dist: seajs.data.debug ? 'src' : 'dist'
|
||||
},
|
||||
alias: {
|
||||
jquery: "common/libs/jquery/jquery-1.10.2.min.js",
|
||||
plugins: "common/plugins.js",
|
||||
grid: "common/grid.js",
|
||||
dialog: "common/plugins/jquery.dialog.js?self=true",
|
||||
datepicker: "common/plugins/datepicker/pikaday.js",
|
||||
print: "common/plugins/jquery.print.js",
|
||||
main: "common/main.js"
|
||||
},
|
||||
preload: [
|
||||
this.JSON ? '' : 'common/libs/json2.js',
|
||||
"plugins",
|
||||
"grid",
|
||||
"dialog",
|
||||
"main"
|
||||
]
|
||||
});
|
||||
176
statics/js/dist/Contract.js
vendored
Executable file
176
statics/js/dist/Contract.js
vendored
Executable file
@@ -0,0 +1,176 @@
|
||||
//调试 打印对象
|
||||
function dump_obj(myObject) {
|
||||
var s = "";
|
||||
for (var property in myObject) {
|
||||
s = s + "\n "+property +": " + myObject[property] ;
|
||||
}
|
||||
alert(s);
|
||||
}
|
||||
$(function() {
|
||||
var a = {
|
||||
fileList: {},
|
||||
api: frameElement.api,
|
||||
page: {
|
||||
$container: $(".container"),
|
||||
$upfile: $("#upfile"),
|
||||
$content: $(".content"),
|
||||
$progress: $("#progress"),
|
||||
$fileinputButton: $("#fileinput-button"),
|
||||
uploadLock: !1
|
||||
},
|
||||
init: function() {
|
||||
try {
|
||||
document.domain = thisDomain
|
||||
} catch (a) {}
|
||||
this.initUpload(), this.initPopBtns(), this.initEvent(), this.initDom()
|
||||
},
|
||||
initDom: function() {
|
||||
var b = a.api.data || {};
|
||||
b.id && Public.ajaxPost("../scm/invPu/getImagesById", {
|
||||
id: b.id
|
||||
}, function(b) {
|
||||
200 == b.status ? a.addImgDiv(b.files) : parent.parent.Public.tips({
|
||||
type: 1,
|
||||
content: "获取附件失败!"
|
||||
})
|
||||
})
|
||||
},
|
||||
initPopBtns: function() {
|
||||
var b = ["保存", "关闭"];
|
||||
this.api.button({
|
||||
id: "ok",
|
||||
name: b[0],
|
||||
focus: !0,
|
||||
callback: function() {
|
||||
return a.postData(), !1
|
||||
}
|
||||
}, {
|
||||
id: "cancel",
|
||||
name: b[1]
|
||||
})
|
||||
},
|
||||
postData: function() {
|
||||
var b = a.api.data || {},
|
||||
c = (b.callback, a.getCurrentFiles()),
|
||||
d = [];
|
||||
for (var e in c) d.push(c[e]);
|
||||
if (b.id) {
|
||||
var f = {
|
||||
id: b.id,
|
||||
files: d
|
||||
};
|
||||
Public.ajaxPost("../scm/invPu/addImagesToInv?action=addImagesToInv", {
|
||||
postData: JSON.stringify(f)
|
||||
}, function(a) {
|
||||
parent.parent.Public.tips(200 == a.status ? {
|
||||
content: "保存附件成功!"
|
||||
} : {
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
initEvent: function() {
|
||||
var b = this.page;
|
||||
b.$container.on("click", ".uploading", function() {
|
||||
parent.parent.Public.tips({
|
||||
type: 2,
|
||||
content: "正在上传,请稍等!"
|
||||
})
|
||||
}), b.$container.on("mouseenter", ".imgDiv", function() {
|
||||
$(this).addClass("hover")
|
||||
}), b.$container.on("mouseleave", ".imgDiv", function() {
|
||||
$(this).removeClass("hover")
|
||||
}), b.$container.on("click", ".del", function(b) {
|
||||
b.stopPropagation();
|
||||
var c = $(this).closest(".imgDiv").hide().data("pid");
|
||||
a.fileList[c].status = 0
|
||||
}), b.$container.on("click", "img", function() {
|
||||
var a = $(this),
|
||||
b = a.prop("src");
|
||||
window.open(b)
|
||||
})
|
||||
},
|
||||
initUpload: function() {
|
||||
var b = this.page;
|
||||
b.liList = b.$content.find("li");
|
||||
b.$upfile.fileupload({
|
||||
url: "../scm/invPu/uploadImages",
|
||||
maxFileSize: 5e6,
|
||||
sequentialUploads: !0,
|
||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|png|bmp)$/i,
|
||||
dataType: "json",
|
||||
done: function(b, c) {
|
||||
200 != c.result.status ? parent.parent.Public.tips({
|
||||
type: 2,
|
||||
content: c.result.msg || "上传失败!"
|
||||
}) : a.addImgDiv(c.result.files)
|
||||
},
|
||||
add: function(a, c) {
|
||||
$.each(c.files, function() {
|
||||
b.$fileinputButton.addClass("uploading"), c.submit()
|
||||
})
|
||||
},
|
||||
beforeSend: function() {
|
||||
"775px" === $("#progress .bar").css("width") && $("#progress .bar").css("width", "0")
|
||||
},
|
||||
progressall: function(a, c) {
|
||||
var d = parseInt(c.loaded / c.total * 100, 10);
|
||||
$("#progress .bar").stop().animate({
|
||||
width: d + "%"
|
||||
}, 1e3), 100 == d && b.$fileinputButton.removeClass("uploading")
|
||||
}
|
||||
})
|
||||
},
|
||||
addImgDiv: function(b) {
|
||||
$.each(b, function(b, c) {
|
||||
a.fileList[c.pid] = c;
|
||||
var d = a.getHeightMinLi();
|
||||
if (d) {
|
||||
var fname = c.name;
|
||||
var fext = fname.substring(fname.lastIndexOf('.'));
|
||||
var fnm = decodeURI(fname.substring(0,fname.indexOf('$')));
|
||||
var strRegex = "(.jpg|.png|.gif|.ps|.jpeg)$"; //用于验证图片扩展名的正则表达式
|
||||
var re=new RegExp(strRegex);
|
||||
if (re.test(fname.toLowerCase())){
|
||||
/*var e = $('<div class="imgDiv" data-pid="' + c.pid + '">'+
|
||||
'<p class="imgControl">'+
|
||||
'<span class="del">X</span>'+
|
||||
'</p>'+
|
||||
'<img src="' + c.url + '" alt="' + c.name + '"/>'+
|
||||
'</div>');*/
|
||||
var e = $('<div class="imgDiv" data-pid="' + c.pid + '">'+
|
||||
'<p class="imgControl">'+
|
||||
'<span class="del">X</span>'+
|
||||
'</p>'+
|
||||
'<div><img src="' + c.url + '" onclick="return false;" />' + fnm+fext + '</div>'+
|
||||
'</div>');
|
||||
}else{
|
||||
var e = $('<div class="imgDiv" data-pid="' + c.pid + '">'+
|
||||
'<p class="imgControl">'+
|
||||
'<span class="del">X</span>'+
|
||||
'</p>'+
|
||||
'<div onclick="javascript:window.open(\''+c.url + '\')" ><div style="background-size:100%;background-image:url(../../statics/css/img/fujian.png);height:101px;"></div>' + fnm+fext + '</div>'+
|
||||
//'<div style="background-image:url(../../statics/css/img/fujian.jpg);height:110px;" onclick="javascript:window.open(\''+c.url + '\')" alt="' + fnm+fext + '"></div>' +
|
||||
'</div>');
|
||||
}
|
||||
d.append(e)
|
||||
}
|
||||
}), $(".img-warp").animate({
|
||||
scrollTop: $("body")[0].scrollHeight
|
||||
}, 500)
|
||||
},
|
||||
getHeightMinLi: function() {
|
||||
var a, b = this.page;
|
||||
return b.liList.each(function() {
|
||||
var b = $(this);
|
||||
a ? b.height() < a.height() && (a = b) : a = b
|
||||
}), a
|
||||
},
|
||||
getCurrentFiles: function() {
|
||||
return this.fileList
|
||||
}
|
||||
};
|
||||
a.init()
|
||||
});
|
||||
123
statics/js/dist/accountPayDetail.js
vendored
Executable file
123
statics/js/dist/accountPayDetail.js
vendored
Executable file
@@ -0,0 +1,123 @@
|
||||
var $_curTr;
|
||||
$(function() {
|
||||
var a = function(a) {
|
||||
var b = Public.urlParam(),
|
||||
c = "../report/fundBalance_detailSupplier?action=detailSupplier&type=10",
|
||||
d = "../report/fundBalance_exporterSupplier?action=exporterSupplier&type=10";
|
||||
$_fromDate = $("#filter-fromDate"), $_toDate = $("#filter-toDate"), $_accountNoInput = $("#supplierAuto");
|
||||
var e = {
|
||||
SALE: {
|
||||
tabid: "sales-sales",
|
||||
text: "销货单",
|
||||
right: "SA_QUERY",
|
||||
url: "../scm/invsa?action=editSale&id="
|
||||
},
|
||||
PUR: {
|
||||
tabid: "purchase-purchase",
|
||||
text: "购货单",
|
||||
right: "PU_QUERY",
|
||||
url: "../scm/invpu?action=editPur&id="
|
||||
},
|
||||
TRANSFER: {
|
||||
tabid: "storage-transfers",
|
||||
text: "调拨单",
|
||||
right: "TF_QUERY",
|
||||
url: "../scm/invtf?action=editTf&id="
|
||||
},
|
||||
OO: {
|
||||
tabid: "storage-otherOutbound",
|
||||
text: "其它出库 ",
|
||||
right: "OO_QUERY",
|
||||
url: "../scm/invOi?action=editOi&type=in&id="
|
||||
},
|
||||
OI: {
|
||||
tabid: "storage-otherWarehouse",
|
||||
text: "其它入库 ",
|
||||
right: "IO_QUERY",
|
||||
url: "../scm/invOi?action=editOi&type=out&id="
|
||||
},
|
||||
CADJ: {
|
||||
tabid: "storage-adjustment",
|
||||
text: "成本调整",
|
||||
right: "CADJ_QUERY",
|
||||
url: "../storage/adjustment.jsp?id="
|
||||
},
|
||||
PAYMENT: {
|
||||
tabid: "money-payment",
|
||||
text: "付款单",
|
||||
right: "PAYMENT_QUERY",
|
||||
url: "../scm/payment?action=editPay&id="
|
||||
},
|
||||
RECEIPT: {
|
||||
tabid: "money-receipt",
|
||||
text: "收款单",
|
||||
right: "RECEIPT_QUERY",
|
||||
url: "../scm/receipt?action=editReceipt&id="
|
||||
},
|
||||
VERIFICA: {
|
||||
tabid: "money-verifica",
|
||||
text: "核销单 ",
|
||||
right: "VERIFICA_QUERY",
|
||||
url: "../money/verification.jsp?id="
|
||||
}
|
||||
},
|
||||
f = {
|
||||
beginDate: b.beginDate || defParams.beginDate,
|
||||
endDate: b.endDate || defParams.endDate,
|
||||
accountNo: b.accountNo || ""
|
||||
},
|
||||
g = function() {
|
||||
$_fromDate.datepicker(), $_toDate.datepicker()
|
||||
},
|
||||
h = function() {
|
||||
Business.moreFilterEvent(), $("#conditions-trigger").trigger("click")
|
||||
},
|
||||
i = function() {
|
||||
var a = "";
|
||||
for (key in f) f[key] && (a += "&" + key + "=" + encodeURIComponent(f[key]));
|
||||
window.location = c + a
|
||||
},
|
||||
j = function() {
|
||||
$("#filter-submit").on("click", function(a) {
|
||||
a.preventDefault();
|
||||
var b = $_fromDate.val(),
|
||||
c = $_toDate.val();
|
||||
return b && c && new Date(b).getTime() > new Date(c).getTime() ? void parent.Public.tips({
|
||||
type: 1,
|
||||
content: "开始日期不能大于结束日期"
|
||||
}) : (f = {
|
||||
beginDate: b,
|
||||
endDate: c,
|
||||
accountNo: $_accountNoInput.val() || ""
|
||||
}, void i())
|
||||
}), $(document).on("click", "#ui-datepicker-div,.ui-datepicker-header", function(a) {
|
||||
a.stopPropagation()
|
||||
}), $("#filter-reset").on("click", function(a) {
|
||||
a.preventDefault(), $_fromDate.val(""), $_toDate.val(""), $_accountNoInput.val("")
|
||||
}), $("#refresh").on("click", function(a) {
|
||||
a.preventDefault(), i()
|
||||
}), $("#btn-print").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("PAYMENTDETAIL_PRINT") && window.print()
|
||||
}), $("#btn-export").click(function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("PAYMENTDETAIL_EXPORT")) {
|
||||
var b = {};
|
||||
for (var c in f) f[c] && (b[c] = f[c]);
|
||||
Business.getFile(d, b)
|
||||
}
|
||||
}), $(".grid-wrap").on("click", ".link", function() {
|
||||
var a = $(this).data("id"),
|
||||
b = $(this).data("type").toLocaleUpperCase(),
|
||||
c = e[b];
|
||||
c && Business.verifyRight(c.right) && (parent.tab.addTabItem({
|
||||
tabid: c.tabid,
|
||||
text: c.text,
|
||||
url: c.url + a
|
||||
}), $(this).addClass("tr-hover"), $_curTr = $(this))
|
||||
}), Business.gridEvent()
|
||||
};
|
||||
return a.init = function() {
|
||||
$_fromDate.val(f.beginDate || ""), $_toDate.val(f.endDate || ""), $_accountNoInput.val(f.accountNo || ""), f.beginDate && f.endDate && $("#selected-period").text(f.beginDate + "至" + f.endDate), Business.filterSupplier(), $("#supplierAuto").val(""), g(), h(), j()
|
||||
}, a
|
||||
}(a || {});
|
||||
a.init(), Public.initCustomGrid($("table.list"))
|
||||
});
|
||||
286
statics/js/dist/accountPayDetailNew.js
vendored
Executable file
286
statics/js/dist/accountPayDetailNew.js
vendored
Executable file
@@ -0,0 +1,286 @@
|
||||
define(["jquery", "print"], function(a, b, c) {
|
||||
function d() {
|
||||
Business.filterSupplier(), k("#filter-fromDate").val(m.beginDate || ""), k("#filter-toDate").val(m.endDate || ""), m.beginDate && m.endDate && k("div.grid-subtitle").text("日期: " + m.beginDate + " 至 " + m.endDate), k("#filter-fromDate, #filter-toDate").datepicker(), Public.dateCheck(), k("#filter-submit").on("click", function(a) {
|
||||
a.preventDefault();
|
||||
var b = k("#filter-fromDate").val(),
|
||||
c = k("#filter-toDate").val();
|
||||
return b && c && new Date(b).getTime() > new Date(c).getTime() ? void parent.Public.tips({
|
||||
type: 1,
|
||||
content: "开始日期不能大于结束日期"
|
||||
}) : (m = {
|
||||
beginDate: b,
|
||||
endDate: c,
|
||||
accountNo: k("#supplierAuto").val() || ""
|
||||
}, k("div.grid-subtitle").text("日期: " + b + " 至 " + c), void j())
|
||||
})
|
||||
}
|
||||
function e() {
|
||||
k("#btn-print").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("PAYMENTDETAIL_PRINT") && k("div.ui-print").printTable()
|
||||
}), k("#btn-export").click(function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("PAYMENTDETAIL_EXPORT")) {
|
||||
var b = {};
|
||||
for (var c in m) m[c] && (b[c] = m[c]);
|
||||
Business.getFile(n, b)
|
||||
}
|
||||
}), k("#config").click(function(a) {
|
||||
p.config()
|
||||
})
|
||||
}
|
||||
function f() {
|
||||
var a = !1,
|
||||
b = !1,
|
||||
c = !1;
|
||||
l.isAdmin !== !1 || l.rights.AMOUNT_COSTAMOUNT || (a = !0), l.isAdmin !== !1 || l.rights.AMOUNT_OUTAMOUNT || (b = !0), l.isAdmin !== !1 || l.rights.AMOUNT_INAMOUNT || (c = !0);
|
||||
var d = l.serviceType,
|
||||
e = "";
|
||||
(12 == d || 13 == d) && (e = "支付应付款"), 12 != d && 13 != d && (e = "增加预付款");
|
||||
var f = [{
|
||||
name: "buName",
|
||||
label: "供应商",
|
||||
width: 150,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "date",
|
||||
label: "单据日期",
|
||||
width: 100,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billNo",
|
||||
label: "单据编号",
|
||||
width: 110,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "transType",
|
||||
label: "业务类型",
|
||||
width: 110,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "income",
|
||||
label: "增加应付款",
|
||||
align: "right",
|
||||
width: 120,
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.amountPlaces)
|
||||
}
|
||||
}, {
|
||||
name: "expenditure",
|
||||
label: e,
|
||||
width: 120,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.amountPlaces)
|
||||
}
|
||||
}, {
|
||||
name: "balance",
|
||||
label: "应付款余额",
|
||||
width: 120,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalSeparator: ".",
|
||||
decimalPlaces: Number(l.amountPlaces)
|
||||
}
|
||||
}, {
|
||||
name: "billId",
|
||||
label: "",
|
||||
width: 0,
|
||||
align: "center",
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "billTypeNo",
|
||||
label: "",
|
||||
width: 0,
|
||||
align: "center",
|
||||
hidden: !0
|
||||
}],
|
||||
h = "local",
|
||||
i = "#";
|
||||
m.autoSearch && (h = "json", i = o), p.gridReg("grid", f), f = p.conf.grids.grid.colModel, k("#grid").jqGrid({
|
||||
url: i,
|
||||
postData: m,
|
||||
datatype: h,
|
||||
autowidth: !0,
|
||||
gridview: !0,
|
||||
colModel: f,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "date",
|
||||
sortorder: "desc",
|
||||
rowNum: 3e3,
|
||||
loadonce: !0,
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
forceFit: !0,
|
||||
footerrow: !0,
|
||||
userDataOnFooter: !0,
|
||||
cellLayout: 0,
|
||||
jsonReader: {
|
||||
root: "data.list",
|
||||
userdata: "data.total",
|
||||
repeatitems: !1,
|
||||
id: "0"
|
||||
},
|
||||
onCellSelect: function(a) {
|
||||
var b = k("#grid").getRowData(a),
|
||||
c = b.billId,
|
||||
d = b.billTypeNo.toUpperCase();
|
||||
switch (d) {
|
||||
case "PUR":
|
||||
if (!Business.verifyRight("PU_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "purchase-purchase",
|
||||
text: "购货单",
|
||||
url: "../scm/invPu?action=editPur&id=" + c
|
||||
});
|
||||
break;
|
||||
case "SALE":
|
||||
if (!Business.verifyRight("SA_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "sales-sales",
|
||||
text: "销售单",
|
||||
url: "../scm/invSa?action=editSale&id=" + c
|
||||
});
|
||||
break;
|
||||
case "TRANSFER":
|
||||
if (!Business.verifyRight("TF_QUERY")) return;
|
||||
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-transfers",
|
||||
text: "调拨单",
|
||||
url: "../scm/invTf?action=editTf&id=" + c
|
||||
});
|
||||
break;
|
||||
case "OI":
|
||||
if (!Business.verifyRight("IO_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-otherWarehouse",
|
||||
text: "其他入库",
|
||||
url: "../scm/invOi?action=editOi&type=in&id=" + c
|
||||
});
|
||||
break;
|
||||
case "OO":
|
||||
if (!Business.verifyRight("OO_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-otherOutbound",
|
||||
text: "其他出库",
|
||||
url: "../scm/invOi?action=editOi&type=out&id=" + c
|
||||
});
|
||||
break;
|
||||
case "CADJ":
|
||||
if (!Business.verifyRight("CADJ_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-adjustment",
|
||||
text: "成本调整单",
|
||||
url: "../scm/invOi?action=editOi&type=cbtz&id=" + c
|
||||
});
|
||||
break;
|
||||
case "PAYMENT":
|
||||
if (!Business.verifyRight("PAYMENT_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-payment",
|
||||
text: "付款单",
|
||||
url: "../scm/payment?action=editPay&id=" + c
|
||||
});
|
||||
break;
|
||||
case "VERIFICA":
|
||||
if (!Business.verifyRight("VERIFICA_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-verifica",
|
||||
text: "核销单",
|
||||
url: "/money/verification.jsp?id=" + c
|
||||
});
|
||||
break;
|
||||
case "RECEIPT":
|
||||
if (!Business.verifyRight("RECEIPT_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-receipt",
|
||||
text: "收款单",
|
||||
url: "../scm/receipt?action=editReceipt&id=" + c
|
||||
});
|
||||
break;
|
||||
case "QTSR":
|
||||
if (!Business.verifyRight("QTSR_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-otherIncome",
|
||||
text: "其它收入单",
|
||||
url: "../scm/ori?action=editInc&id=" + c
|
||||
});
|
||||
break;
|
||||
case "QTZC":
|
||||
if (!Business.verifyRight("QTZC_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-otherExpense",
|
||||
text: "其它支出单",
|
||||
url: "../scm/ori?action=editExp&id=" + c
|
||||
})
|
||||
}
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
var b;
|
||||
if (a && a.data) {
|
||||
var c = a.data.list.length;
|
||||
b = c ? 31 * c : 1
|
||||
}
|
||||
g(b)
|
||||
},
|
||||
gridComplete: function() {
|
||||
k("#grid").footerData("set", {
|
||||
transType: "合计:"
|
||||
})
|
||||
},
|
||||
resizeStop: function(a, b) {
|
||||
p.setGridWidthByIndex(a, b + 1, "grid")
|
||||
}
|
||||
}), m.autoSearch ? (k(".no-query").remove(), k(".ui-print").show()) : k(".ui-print").hide()
|
||||
}
|
||||
function g(a) {
|
||||
a && (g.h = a);
|
||||
var b = h(),
|
||||
c = g.h,
|
||||
d = i(),
|
||||
e = k("#grid");
|
||||
c > d && (c = d), b < e.width() && (c += 17), k("#grid-wrap").height(function() {
|
||||
return document.body.clientHeight - this.offsetTop - 36 - 5
|
||||
}), e.jqGrid("setGridHeight", c), e.jqGrid("setGridWidth", b, !1)
|
||||
}
|
||||
function h() {
|
||||
return k(window).width() - k("#grid-wrap").offset().left - 36 - 20
|
||||
}
|
||||
function i() {
|
||||
return k(window).height() - k("#grid").offset().top - 36 - 16
|
||||
}
|
||||
function j() {
|
||||
k(".no-query").remove(), k(".ui-print").show(), k("#grid").clearGridData(!0), k("#grid").jqGrid("setGridParam", {
|
||||
datatype: "json",
|
||||
postData: m,
|
||||
url: o
|
||||
}).trigger("reloadGrid")
|
||||
}
|
||||
var k = a("jquery"),
|
||||
l = parent.SYSTEM,
|
||||
m = k.extend({
|
||||
beginDate: "",
|
||||
endDate: "",
|
||||
accountNo: ""
|
||||
}, Public.urlParam()),
|
||||
n = "../report/fundBalance_exporterSupplier?action=exporterSupplier&type=10",
|
||||
o = "../report/fundBalance_detailSupplier?action=detailSupplier&type=10";
|
||||
a("print");
|
||||
var p = Public.mod_PageConfig.init("accountPayDetailNew");
|
||||
d(), e(), f();
|
||||
var q;
|
||||
k(window).on("resize", function(a) {
|
||||
q || (q = setTimeout(function() {
|
||||
g(), q = null
|
||||
}, 50))
|
||||
})
|
||||
});
|
||||
123
statics/js/dist/accountProceedsDetail.js
vendored
Executable file
123
statics/js/dist/accountProceedsDetail.js
vendored
Executable file
@@ -0,0 +1,123 @@
|
||||
var $_curTr;
|
||||
$(function() {
|
||||
var a = function(a) {
|
||||
var b = Public.urlParam(),
|
||||
c = "../report/fundBalance_detail?action=detail",
|
||||
d = "../report/fundBalance_exporter?action=exporter";
|
||||
$_fromDate = $("#filter-fromDate"), $_toDate = $("#filter-toDate"), $_accountNoInput = $("#customerAuto");
|
||||
var e = {
|
||||
SALE: {
|
||||
tabid: "sales-sales",
|
||||
text: "销货单",
|
||||
right: "SA_QUERY",
|
||||
url: "../scm/invsa?action=editSale&id="
|
||||
},
|
||||
PUR: {
|
||||
tabid: "purchase-purchase",
|
||||
text: "购货单",
|
||||
right: "PU_QUERY",
|
||||
url: "../scm/invpu?action=editPur&id="
|
||||
},
|
||||
TRANSFER: {
|
||||
tabid: "storage-transfers",
|
||||
text: "调拨单",
|
||||
right: "TF_QUERY",
|
||||
url: "../scm/invtf?action=editTf&id="
|
||||
},
|
||||
OO: {
|
||||
tabid: "storage-otherOutbound",
|
||||
text: "其它出库 ",
|
||||
right: "OO_QUERY",
|
||||
url: "../scm/invOi?action=editOi&type=in&id="
|
||||
},
|
||||
OI: {
|
||||
tabid: "storage-otherWarehouse",
|
||||
text: "其它入库 ",
|
||||
right: "IO_QUERY",
|
||||
url: "../scm/invOi?action=editOi&type=out&id="
|
||||
},
|
||||
CADJ: {
|
||||
tabid: "storage-adjustment",
|
||||
text: "成本调整",
|
||||
right: "CADJ_QUERY",
|
||||
url: "../storage/adjustment.jsp?id="
|
||||
},
|
||||
PAYMENT: {
|
||||
tabid: "money-payment",
|
||||
text: "付款单",
|
||||
right: "PAYMENT_QUERY",
|
||||
url: "../scm/payment?action=editPay&id="
|
||||
},
|
||||
RECEIPT: {
|
||||
tabid: "money-receipt",
|
||||
text: "收款单",
|
||||
right: "RECEIPT_QUERY",
|
||||
url: "../scm/receipt?action=editReceipt&id="
|
||||
},
|
||||
VERIFICA: {
|
||||
tabid: "money-verifica",
|
||||
text: "核销单 ",
|
||||
right: "VERIFICA_QUERY",
|
||||
url: "../money/verification.jsp?id="
|
||||
}
|
||||
},
|
||||
f = {
|
||||
beginDate: b.beginDate || defParams.beginDate,
|
||||
endDate: b.endDate || defParams.endDate,
|
||||
accountNo: b.accountNo || ""
|
||||
},
|
||||
g = function() {
|
||||
$_fromDate.datepicker(), $_toDate.datepicker()
|
||||
},
|
||||
h = function() {
|
||||
Business.moreFilterEvent(), $("#conditions-trigger").trigger("click")
|
||||
},
|
||||
i = function() {
|
||||
var a = "";
|
||||
for (key in f) f[key] && (a += "&" + key + "=" + encodeURIComponent(f[key]));
|
||||
window.location = c + a
|
||||
},
|
||||
j = function() {
|
||||
$("#filter-submit").on("click", function(a) {
|
||||
a.preventDefault();
|
||||
var b = $_fromDate.val(),
|
||||
c = $_toDate.val();
|
||||
return b && c && new Date(b).getTime() > new Date(c).getTime() ? void parent.Public.tips({
|
||||
type: 1,
|
||||
content: "开始日期不能大于结束日期"
|
||||
}) : (f = {
|
||||
beginDate: b,
|
||||
endDate: c,
|
||||
accountNo: $_accountNoInput.val() || ""
|
||||
}, void i())
|
||||
}), $(document).on("click", "#ui-datepicker-div,.ui-datepicker-header", function(a) {
|
||||
a.stopPropagation()
|
||||
}), $("#filter-reset").on("click", function(a) {
|
||||
a.preventDefault(), $_fromDate.val(""), $_toDate.val(""), $_accountNoInput.val("")
|
||||
}), $("#refresh").on("click", function(a) {
|
||||
a.preventDefault(), i()
|
||||
}), $("#btn-print").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("RECEIPTDETAIL_PRINT") && window.print()
|
||||
}), $("#btn-export").click(function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("RECEIPTDETAIL_EXPORT")) {
|
||||
var b = {};
|
||||
for (var c in f) f[c] && (b[c] = f[c]);
|
||||
Business.getFile(d, b)
|
||||
}
|
||||
}), $(".grid-wrap").on("click", ".link", function() {
|
||||
var a = $(this).data("id"),
|
||||
b = $(this).data("type").toLocaleUpperCase(),
|
||||
c = e[b];
|
||||
c && Business.verifyRight(c.right) && (parent.tab.addTabItem({
|
||||
tabid: c.tabid,
|
||||
text: c.text,
|
||||
url: c.url + a
|
||||
}), $(this).addClass("tr-hover"), $_curTr = $(this))
|
||||
}), Business.gridEvent()
|
||||
};
|
||||
return a.init = function() {
|
||||
$_fromDate.val(f.beginDate || ""), $_toDate.val(f.endDate || ""), $_accountNoInput.val(f.accountNo || ""), f.beginDate && f.endDate && $("#selected-period").text(f.beginDate + "至" + f.endDate), Business.filterCustomer(), $("#customerAuto").val(""), g(), h(), j()
|
||||
}, a
|
||||
}(a || {});
|
||||
a.init(), Public.initCustomGrid($("table.list"))
|
||||
});
|
||||
284
statics/js/dist/accountProceedsDetailNew.js
vendored
Executable file
284
statics/js/dist/accountProceedsDetailNew.js
vendored
Executable file
@@ -0,0 +1,284 @@
|
||||
define(["jquery", "print"], function(a, b, c) {
|
||||
function d() {
|
||||
Business.filterCustomer(), k("#filter-fromDate").val(m.beginDate || ""), k("#filter-toDate").val(m.endDate || ""), m.beginDate && m.endDate && k("div.grid-subtitle").text("日期: " + m.beginDate + " 至 " + m.endDate), k("#filter-fromDate, #filter-toDate").datepicker(), Public.dateCheck(), k("#filter-submit").on("click", function(a) {
|
||||
a.preventDefault();
|
||||
var b = k("#filter-fromDate").val(),
|
||||
c = k("#filter-toDate").val();
|
||||
return b && c && new Date(b).getTime() > new Date(c).getTime() ? void parent.Public.tips({
|
||||
type: 1,
|
||||
content: "开始日期不能大于结束日期"
|
||||
}) : (m = {
|
||||
beginDate: b,
|
||||
endDate: c,
|
||||
accountNo: k("#customerAuto").val() || ""
|
||||
}, k("div.grid-subtitle").text("日期: " + b + " 至 " + c), void j())
|
||||
})
|
||||
}
|
||||
function e() {
|
||||
k("#btn-print").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("RECEIPTDETAIL_PRINT") && k("div.ui-print").printTable()
|
||||
}), k("#btn-export").click(function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("RECEIPTDETAIL_EXPORT")) {
|
||||
var b = {};
|
||||
for (var c in m) m[c] && (b[c] = m[c]);
|
||||
Business.getFile(n, b)
|
||||
}
|
||||
}), k("#config").click(function(a) {
|
||||
p.config()
|
||||
})
|
||||
}
|
||||
function f() {
|
||||
var a = !1,
|
||||
b = !1,
|
||||
c = !1;
|
||||
l.isAdmin !== !1 || l.rights.AMOUNT_COSTAMOUNT || (a = !0), l.isAdmin !== !1 || l.rights.AMOUNT_OUTAMOUNT || (b = !0), l.isAdmin !== !1 || l.rights.AMOUNT_INAMOUNT || (c = !0);
|
||||
var d = l.serviceType,
|
||||
e = "";
|
||||
(12 == d || 13 == d) && (e = "支付应收款"), 12 != d && 13 != d && (e = "增加预收款");
|
||||
var f = [{
|
||||
name: "buName",
|
||||
label: "客户",
|
||||
width: 150,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "date",
|
||||
label: "单据日期",
|
||||
width: 100,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billNo",
|
||||
label: "单据编号",
|
||||
width: 110,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "transType",
|
||||
label: "业务类型",
|
||||
width: 110,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "income",
|
||||
label: "增加应收款",
|
||||
width: 120,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.amountPlaces)
|
||||
}
|
||||
}, {
|
||||
name: "expenditure",
|
||||
label: e,
|
||||
width: 120,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.amountPlaces)
|
||||
}
|
||||
}, {
|
||||
name: "balance",
|
||||
label: "应收款余额",
|
||||
width: 120,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.amountPlaces)
|
||||
}
|
||||
}, {
|
||||
name: "billId",
|
||||
label: "",
|
||||
width: 0,
|
||||
align: "center",
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "billTypeNo",
|
||||
label: "",
|
||||
width: 0,
|
||||
align: "center",
|
||||
hidden: !0
|
||||
}],
|
||||
h = "local",
|
||||
i = "#";
|
||||
m.autoSearch && (h = "json", i = o), p.gridReg("grid", f), f = p.conf.grids.grid.colModel, k("#grid").jqGrid({
|
||||
url: i,
|
||||
postData: m,
|
||||
datatype: h,
|
||||
autowidth: !0,
|
||||
gridview: !0,
|
||||
colModel: f,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "date",
|
||||
sortorder: "desc",
|
||||
rowNum: 3e3,
|
||||
loadonce: !0,
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
forceFit: !0,
|
||||
footerrow: !0,
|
||||
userDataOnFooter: !0,
|
||||
cellLayout: 0,
|
||||
jsonReader: {
|
||||
root: "data.list",
|
||||
userdata: "data.total",
|
||||
repeatitems: !1,
|
||||
id: "0"
|
||||
},
|
||||
onCellSelect: function(a) {
|
||||
var b = k("#grid").getRowData(a),
|
||||
c = b.billId,
|
||||
d = b.billTypeNo.toUpperCase();
|
||||
switch (d) {
|
||||
case "PUR":
|
||||
if (!Business.verifyRight("PU_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "purchase-purchase",
|
||||
text: "购货单",
|
||||
url: "../scm/invPu?action=editPur&id=" + c
|
||||
});
|
||||
break;
|
||||
case "SALE":
|
||||
if (!Business.verifyRight("SA_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "sales-sales",
|
||||
text: "销售单",
|
||||
url: "../scm/invSa?action=editSale&id=" + c
|
||||
});
|
||||
break;
|
||||
case "TRANSFER":
|
||||
if (!Business.verifyRight("TF_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-transfers",
|
||||
text: "调拨单",
|
||||
url: "../scm/invTf?action=editTf&id=" + c
|
||||
});
|
||||
break;
|
||||
case "OI":
|
||||
if (!Business.verifyRight("IO_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-otherWarehouse",
|
||||
text: "其他入库",
|
||||
url: "../scm/invOi?action=editOi&type=in&id=" + c
|
||||
});
|
||||
break;
|
||||
case "OO":
|
||||
if (!Business.verifyRight("OO_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-otherOutbound",
|
||||
text: "其他出库",
|
||||
url: "../scm/invOi?action=editOi&type=out&id=" + c
|
||||
});
|
||||
break;
|
||||
case "CADJ":
|
||||
if (!Business.verifyRight("CADJ_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-adjustment",
|
||||
text: "成本调整单",
|
||||
url: "../scm/invOi?action=editOi&type=cbtz&id=" + c
|
||||
});
|
||||
break;
|
||||
case "PAYMENT":
|
||||
if (!Business.verifyRight("PAYMENT_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-payment",
|
||||
text: "付款单",
|
||||
url: "../scm/payment?action=editPay&id=" + c
|
||||
});
|
||||
break;
|
||||
case "VERIFICA":
|
||||
if (!Business.verifyRight("VERIFICA_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-verifica",
|
||||
text: "核销单",
|
||||
url: "/money/verification.jsp?id=" + c
|
||||
});
|
||||
break;
|
||||
case "RECEIPT":
|
||||
if (!Business.verifyRight("RECEIPT_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-receipt",
|
||||
text: "收款单",
|
||||
url: "../scm/receipt?action=editReceipt&id=" + c
|
||||
});
|
||||
break;
|
||||
case "QTSR":
|
||||
if (!Business.verifyRight("QTSR_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-otherIncome",
|
||||
text: "其它收入单",
|
||||
url: "../scm/ori?action=editInc&id=" + c
|
||||
});
|
||||
break;
|
||||
case "QTZC":
|
||||
if (!Business.verifyRight("QTZC_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-otherExpense",
|
||||
text: "其它支出单",
|
||||
url: "../scm/ori?action=editExp&id=" + c
|
||||
})
|
||||
}
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
var b;
|
||||
if (a && a.data) {
|
||||
var c = a.data.list.length;
|
||||
b = c ? 31 * c : 1
|
||||
}
|
||||
g(b)
|
||||
},
|
||||
gridComplete: function() {
|
||||
k("#grid").footerData("set", {
|
||||
transType: "合计:"
|
||||
})
|
||||
},
|
||||
resizeStop: function(a, b) {
|
||||
p.setGridWidthByIndex(a, b + 1, "grid")
|
||||
}
|
||||
}), m.autoSearch ? (k(".no-query").remove(), k(".ui-print").show()) : k(".ui-print").hide()
|
||||
}
|
||||
function g(a) {
|
||||
a && (g.h = a);
|
||||
var b = h(),
|
||||
c = g.h,
|
||||
d = i(),
|
||||
e = k("#grid");
|
||||
c > d && (c = d), b < e.width() && (c += 17), k("#grid-wrap").height(function() {
|
||||
return document.body.clientHeight - this.offsetTop - 36 - 5
|
||||
}), e.jqGrid("setGridHeight", c), e.jqGrid("setGridWidth", b, !1)
|
||||
}
|
||||
function h() {
|
||||
return k(window).width() - k("#grid-wrap").offset().left - 36 - 20
|
||||
}
|
||||
function i() {
|
||||
return k(window).height() - k("#grid").offset().top - 36 - 16
|
||||
}
|
||||
function j() {
|
||||
k(".no-query").remove(), k(".ui-print").show(), k("#grid").clearGridData(!0), k("#grid").jqGrid("setGridParam", {
|
||||
datatype: "json",
|
||||
postData: m,
|
||||
url: o
|
||||
}).trigger("reloadGrid")
|
||||
}
|
||||
var k = a("jquery"),
|
||||
l = parent.SYSTEM,
|
||||
m = k.extend({
|
||||
beginDate: "",
|
||||
endDate: "",
|
||||
accountNo: ""
|
||||
}, Public.urlParam()),
|
||||
n = "../report/fundBalance_exporter?action=exporter",
|
||||
o = "../report/fundBalance_detail?action=detail";
|
||||
a("print");
|
||||
var p = Public.mod_PageConfig.init("accountProceeDetailNew");
|
||||
d(), e(), f();
|
||||
var q;
|
||||
k(window).on("resize", function(a) {
|
||||
q || (q = setTimeout(function() {
|
||||
g(), q = null
|
||||
}, 50))
|
||||
})
|
||||
});
|
||||
485
statics/js/dist/accountTransfer.js
vendored
Executable file
485
statics/js/dist/accountTransfer.js
vendored
Executable file
@@ -0,0 +1,485 @@
|
||||
var curRow, curCol, curArrears, loading, urlParam = Public.urlParam(),
|
||||
SYSTEM = parent.SYSTEM,
|
||||
hiddenAmount = !1,
|
||||
requiredMoney = SYSTEM.requiredMoney,
|
||||
qtyPlaces = Number(parent.SYSTEM.qtyPlaces),
|
||||
pricePlaces = Number(parent.SYSTEM.pricePlaces),
|
||||
amountPlaces = Number(parent.SYSTEM.amountPlaces),
|
||||
hasLoaded = !1,
|
||||
originalData, THISPAGE = {
|
||||
init: function(a) {
|
||||
this.mod_PageConfig = Public.mod_PageConfig.init("accountTransfer"), SYSTEM.isAdmin !== !1 || SYSTEM.rights.AMOUNT_COSTAMOUNT || (hiddenAmount = !0), this.loadGrid(a), this.initDom(a), this.initCombo(), this.addEvent(), THISPAGE.calTotal()
|
||||
},
|
||||
initDom: function(a) {
|
||||
this.$_date = $("#date").val(SYSTEM.endDate), this.$_number = $("#number"), this.$_note = $("#note"), this.$_toolTop = $("#toolTop"), this.$_toolBottom = $("#toolBottom"), this.$_userName = $("#userName"), this.$_modifyTime = $("#modifyTime"), this.$_createTime = $("#createTime"), this.$_note.placeholder(), this.$_date.datepicker({
|
||||
onSelect: function(a) {
|
||||
if (!(originalData.id > 0)) {
|
||||
var b = a.format("yyyy-MM-dd");
|
||||
THISPAGE.$_number.text(""), Public.ajaxPost("../basedata/systemProfile/generateDocNo?action=generateDocNo", {
|
||||
billType: "ZJZZ",
|
||||
billDate: b
|
||||
}, function(a) {
|
||||
200 === a.status ? THISPAGE.$_number.text(a.data.billNo) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}), a.id > 0 ? (this.$_number.text(a.billNo), this.$_date.val(a.billDate), a.description && this.$_note.val(a.description), $("#grid").jqGrid("footerData", "set", {
|
||||
qty: a.totalQty,
|
||||
amount: a.totalAmount
|
||||
}), this.$_toolBottom.html('<a id="add" class="ui-btn ui-btn-sp mrb">新增</a><a id="edit" class="ui-btn mrb">保存</a>'), this.accountTransferListIds = parent.accountTransferListIds || [], this.idPostion = $.inArray(String(a.id), this.accountTransferListIds), this.idLength = this.accountTransferListIds.length, 0 === this.idPostion && $("#prev").addClass("ui-btn-prev-dis"), this.idPostion === this.idLength - 1 && $("#next").addClass("ui-btn-next-dis"), this.$_userName.html(a.userName), this.$_modifyTime.html(a.modifyTime), this.$_createTime.html(a.createTime)) : (this.$_toolBottom.html('<a id="savaAndAdd" class="ui-btn ui-btn-sp mrb">保存并新增</a><a id="save" class="ui-btn">保存</a>'), this.$_userName.html(SYSTEM.realName || ""), this.$_modifyTime.parent().hide(), this.$_createTime.parent().hide())
|
||||
},
|
||||
loadGrid: function(a) {
|
||||
function b(a, b, c) {
|
||||
return a ? a : " "
|
||||
}
|
||||
function c(a, b) {
|
||||
var c = $(".accountAuto_0")[0];
|
||||
return c
|
||||
}
|
||||
function d(a, b, c) {
|
||||
if ("get" === b) {
|
||||
if ("" !== $(".accountAuto_0").getCombo().getValue()) return $(a).val();
|
||||
var d = $(a).parents("tr");
|
||||
return d.removeData("accountInfo_0"), ""
|
||||
}
|
||||
"set" === b && $("input", a).val(c)
|
||||
}
|
||||
function e() {
|
||||
$("#initCombo").append($(".accountAuto_0").val("").unbind("focus.once"))
|
||||
}
|
||||
function f(a, b, c) {
|
||||
return a ? a : " "
|
||||
}
|
||||
function g(a, b) {
|
||||
var c = $(".accountAuto")[0];
|
||||
return c
|
||||
}
|
||||
function h(a, b, c) {
|
||||
if ("get" === b) {
|
||||
if ("" !== $(".accountAuto").getCombo().getValue()) return $(a).val();
|
||||
var d = $(a).parents("tr");
|
||||
return d.removeData("accountInfo"), ""
|
||||
}
|
||||
"set" === b && $("input", a).val(c)
|
||||
}
|
||||
function i() {
|
||||
$("#initCombo").append($(".accountAuto").val("").unbind("focus.once"))
|
||||
}
|
||||
function j(a, b, c) {
|
||||
return a ? a : " "
|
||||
}
|
||||
function k(a, b) {
|
||||
var c = $(".payTypeAuto")[0];
|
||||
return c
|
||||
}
|
||||
function l(a, b, c) {
|
||||
if ("get" === b) {
|
||||
if ("" !== $(".payTypeAuto").getCombo().getValue()) return $(a).val();
|
||||
var d = $(a).parents("tr");
|
||||
return d.removeData("payTypeInfo"), ""
|
||||
}
|
||||
"set" === b && $("input", a).val(c)
|
||||
}
|
||||
function m() {
|
||||
$("#initCombo").append($(".payTypeAuto").val("").unbind("focus.once"))
|
||||
}
|
||||
var n = this;
|
||||
if (a.id) {
|
||||
var o = 8 - a.entries.length;
|
||||
if (o > 0) for (var p = 0; o > p; p++) a.entries.push({})
|
||||
}
|
||||
n.newId = 9;
|
||||
var q = [{
|
||||
name: "operating",
|
||||
label: " ",
|
||||
width: 40,
|
||||
fixed: !0,
|
||||
formatter: Public.billsOper,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "paySettacctName",
|
||||
label: "转出账户",
|
||||
width: 200,
|
||||
title: !0,
|
||||
classes: "ui-ellipsis",
|
||||
formatter: b,
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: c,
|
||||
custom_value: d,
|
||||
handle: e,
|
||||
trigger: "ui-icon-triangle-1-s"
|
||||
}
|
||||
}, {
|
||||
name: "recSettacctName",
|
||||
label: "转入账户",
|
||||
width: 200,
|
||||
title: !0,
|
||||
classes: "ui-ellipsis",
|
||||
formatter: f,
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: g,
|
||||
custom_value: h,
|
||||
handle: i,
|
||||
trigger: "ui-icon-triangle-1-s"
|
||||
}
|
||||
}, {
|
||||
name: "amount",
|
||||
label: "金额",
|
||||
width: 80,
|
||||
align: "right",
|
||||
formatter: "number",
|
||||
formatoptions: {
|
||||
decimalPlaces: amountPlaces
|
||||
},
|
||||
editable: !0
|
||||
}, {
|
||||
name: "wayName",
|
||||
label: "结算方式",
|
||||
width: 200,
|
||||
title: !0,
|
||||
classes: "ui-ellipsis",
|
||||
formatter: j,
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: k,
|
||||
custom_value: l,
|
||||
handle: m,
|
||||
trigger: "ui-icon-triangle-1-s"
|
||||
}
|
||||
}, {
|
||||
name: "refNo",
|
||||
label: "结算号",
|
||||
width: 150,
|
||||
title: !0,
|
||||
editable: !0
|
||||
}, {
|
||||
name: "desc",
|
||||
label: "备注",
|
||||
width: 150,
|
||||
title: !0,
|
||||
editable: !0
|
||||
}];
|
||||
n.mod_PageConfig.gridReg("grid", q), q = n.mod_PageConfig.conf.grids.grid.colModel, $("#grid").jqGrid({
|
||||
data: a.entries,
|
||||
datatype: "clientSide",
|
||||
autowidth: !0,
|
||||
height: "100%",
|
||||
rownumbers: !0,
|
||||
gridview: !0,
|
||||
onselectrow: !1,
|
||||
colModel: q,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
shrinkToFit: !1,
|
||||
forceFit: !0,
|
||||
rowNum: 1e3,
|
||||
cellEdit: !1,
|
||||
cellsubmit: "clientArray",
|
||||
localReader: {
|
||||
root: "rows",
|
||||
records: "records",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
jsonReader: {
|
||||
root: "data.entries",
|
||||
records: "records",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
if (urlParam.id > 0) {
|
||||
var b = a.rows,
|
||||
c = b.length;
|
||||
n.newId = c + 1;
|
||||
for (var d = 0; c > d; d++) {
|
||||
var e = d + 1,
|
||||
f = b[d];
|
||||
if ($.isEmptyObject(b[d])) break;
|
||||
$("#" + e).data("accountInfo_0", {
|
||||
id: f.paySettacctId,
|
||||
name: f.paySettacctName
|
||||
}).data("accountInfo", {
|
||||
id: f.recSettacctId,
|
||||
name: f.recSettacctName
|
||||
}).data("payTypeInfo", {
|
||||
id: f.wayId,
|
||||
name: f.wayName
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
gridComplete: function() {},
|
||||
afterEditCell: function(a, b, c, d, e) {
|
||||
"paySettacctName" === b && ($("#" + d + "_paySettacctName", "#grid").val(c), THISPAGE.accountCombo_0.selectByText(c), THISPAGE.curID = a), "recSettacctName" === b && ($("#" + d + "_recSettacctName", "#grid").val(c), THISPAGE.accountCombo.selectByText(c), THISPAGE.curID = a), "wayName" === b && ($("#" + d + "_wayName", "#grid").val(c), THISPAGE.paymentCombo.selectByText(c), THISPAGE.curID = a)
|
||||
},
|
||||
formatCell: function(a, b, c, d, e) {},
|
||||
beforeSubmitCell: function(a, b, c, d, e) {},
|
||||
afterSaveCell: function(a, b, c, d, e) {
|
||||
"amount" === b && n.calTotal()
|
||||
},
|
||||
resizeStop: function(a, b) {
|
||||
n.mod_PageConfig.setGridWidthByIndex(a, b, "grid")
|
||||
},
|
||||
loadonce: !0,
|
||||
footerrow: !0,
|
||||
userData: {
|
||||
categoryName: "合计:",
|
||||
amount: a.totalAmount
|
||||
},
|
||||
userDataOnFooter: !0,
|
||||
loadError: function(a, b, c) {
|
||||
Public.tips({
|
||||
type: 1,
|
||||
content: "Type: " + b + "; Response: " + a.status + " " + a.statusText
|
||||
})
|
||||
}
|
||||
}), $("#grid").jqGrid("setGridParam", {
|
||||
cellEdit: !0
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
$("#grid").clearGridData();
|
||||
var b = 8 - a.entries.length;
|
||||
if (b > 0) for (var c = 0; b > c; c++) a.entries.push({})
|
||||
},
|
||||
initCombo: function() {
|
||||
requiredMoney && (SYSTEM.isAdmin !== !1 || SYSTEM.rights.SettAcct_QUERY ? (this.accountCombo_0 = Business.accountCombo($(".accountAuto_0"), {
|
||||
trigger: !1,
|
||||
callback: {
|
||||
onChange: function(a) {
|
||||
var b = this.input.parents("tr"),
|
||||
c = b.data("accountInfo_0") || {};
|
||||
a ? a.id != c.id && b.data("accountInfo_0", a) : b.data("accountInfo_0", null)
|
||||
}
|
||||
}
|
||||
}), this.accountCombo = Business.accountCombo($(".accountAuto"), {
|
||||
trigger: !1,
|
||||
callback: {
|
||||
onChange: function(a) {
|
||||
var b = this.input.parents("tr"),
|
||||
c = b.data("accountInfo") || {};
|
||||
a ? a.id != c.id && b.data("accountInfo", a) : b.data("accountInfo", null)
|
||||
}
|
||||
}
|
||||
})) : (this.accountCombo_0 = Business.accountCombo($(".accountAuto_0"), {
|
||||
data: [],
|
||||
addOptions: {
|
||||
text: "(没有账户管理权限)",
|
||||
value: 0
|
||||
},
|
||||
trigger: !1
|
||||
}), this.accountCombo = Business.accountCombo($(".accountAuto"), {
|
||||
data: [],
|
||||
addOptions: {
|
||||
text: "(没有账户管理权限)",
|
||||
value: 0
|
||||
},
|
||||
trigger: !1
|
||||
}))), this.paymentCombo = Business.paymentCombo($(".payTypeAuto"), {
|
||||
trigger: !1,
|
||||
width: "",
|
||||
callback: {
|
||||
onChange: function(a) {
|
||||
var b = this.input.parents("tr"),
|
||||
c = b.data("payTypeInfo") || {};
|
||||
a ? a.id != c.id && b.data("payTypeInfo", a) : b.data("payTypeInfo", null)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
this.$_date.bind("keydown", function(a) {
|
||||
13 === a.which && $("#grid").jqGrid("editCell", 1, 2, !0)
|
||||
}).bind("focus", function(b) {
|
||||
a.dateValue = $(this).val()
|
||||
}).bind("blur", function(b) {
|
||||
var c = /((^((1[8-9]\d{2})|([2-9]\d{3}))(-)(10|12|0?[13578])(-)(3[01]|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))(-)(11|0?[469])(-)(30|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))(-)(0?2)(-)(2[0-8]|1[0-9]|0?[1-9])$)|(^([2468][048]00)(-)(0?2)(-)(29)$)|(^([3579][26]00)(-)(0?2)(-)(29)$)|(^([1][89][0][48])(-)(0?2)(-)(29)$)|(^([2-9][0-9][0][48])(-)(0?2)(-)(29)$)|(^([1][89][2468][048])(-)(0?2)(-)(29)$)|(^([2-9][0-9][2468][048])(-)(0?2)(-)(29)$)|(^([1][89][13579][26])(-)(0?2)(-)(29)$)|(^([2-9][0-9][13579][26])(-)(0?2)(-)(29)$))/;
|
||||
c.test($(this).val()) || (parent.Public.tips({
|
||||
type: 2,
|
||||
content: "日期格式有误!如:2012-08-08。"
|
||||
}), $(this).val(a.dateValue))
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-triangle-1-s", function(b) {
|
||||
var c, d = $(this).siblings();
|
||||
d.hasClass("accountAuto_0") && (c = a.accountCombo_0), d.hasClass("accountAuto") && (c = a.accountCombo), d.hasClass("payTypeAuto") && (c = a.paymentCombo), setTimeout(function() {
|
||||
c.active = !0, c.doQuery()
|
||||
}, 10)
|
||||
}), Business.billsEvent(a, "accountTransfer"), $(".wrapper").on("click", "#save", function(b) {
|
||||
b.preventDefault();
|
||||
var c = THISPAGE.getPostData();
|
||||
c && ("edit" === originalData.stata && (c.id = originalData.id, c.stata = "edit"), Public.ajaxPost("../scm/fundTf/add?action=add", {
|
||||
postData: JSON.stringify(c)
|
||||
}, function(b) {
|
||||
200 === b.status ? (a.$_modifyTime.html((new Date).format("yyyy-MM-dd hh:mm:ss")).parent().show(), a.$_createTime.html((new Date).format("yyyy-MM-dd hh:mm:ss")).parent().show(), originalData.id = b.data.id, urlParam.id = b.data.id, a.$_toolBottom.html('<a id="add" class="ui-btn ui-btn-sp mrb">新增</a><a id="edit" class="ui-btn mrb">保存</a>'), parent.Public.tips({
|
||||
content: "保存成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
}))
|
||||
}), $(".wrapper").on("click", "#edit", function(b) {
|
||||
if (b.preventDefault(), Business.verifyRight("ZJZZ_UPDATE")) {
|
||||
var c = THISPAGE.getPostData();
|
||||
c && Public.ajaxPost("../scm/fundTf/updateFundTf?action=updateFundTf", {
|
||||
postData: JSON.stringify(c)
|
||||
}, function(b) {
|
||||
200 === b.status ? (a.$_modifyTime.html((new Date).format("yyyy-MM-dd hh:mm:ss")).parent().show(), originalData.id = b.data.id, urlParam.id = b.data.id, parent.Public.tips({
|
||||
content: "修改成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
}), $(".wrapper").on("click", "#savaAndAdd", function(b) {
|
||||
b.preventDefault();
|
||||
var c = THISPAGE.getPostData();
|
||||
c && Public.ajaxPost("../scm/fundTf/addNew?action=addNew", {
|
||||
postData: JSON.stringify(c)
|
||||
}, function(b) {
|
||||
if (200 === b.status) {
|
||||
a.$_number.text(b.data.billNo), $("#grid").clearGridData(), $("#grid").clearGridData(!0);
|
||||
for (var c = 1; 8 >= c; c++) $("#grid").jqGrid("addRowData", c, {});
|
||||
a.newId = 9, a.$_note.val(""), parent.Public.tips({
|
||||
content: "保存成功!"
|
||||
})
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
})
|
||||
}), $(".wrapper").on("click", "#add", function(a) {
|
||||
a.preventDefault(), Business.verifyRight("ZJZZ_ADD") && parent.tab.overrideSelectedTabItem({
|
||||
tabid: "money-accountTransfer",
|
||||
text: "资金转账单",
|
||||
url: "../scm/fundTf/initFundTf?action=initFundTf"
|
||||
})
|
||||
}), $(".wrapper").on("click", "#print", function(a) {
|
||||
return Business.verifyRight("ZJZZ_PRINT") ? void a.preventDefault() : void a.preventDefault()
|
||||
}), $("#config").show().click(function(b) {
|
||||
a.mod_PageConfig.config()
|
||||
}), $(window).resize(function(a) {
|
||||
Public.autoGrid($("#grid"))
|
||||
})
|
||||
},
|
||||
resetData: function() {
|
||||
var a = this;
|
||||
$("#grid").clearGridData();
|
||||
for (var b = 1; 8 >= b; b++) $("#grid").jqGrid("addRowData", b, {}), $("#grid").jqGrid("footerData", "set", {
|
||||
qty: 0,
|
||||
amount: 0
|
||||
});
|
||||
a.$_note.val("")
|
||||
},
|
||||
calTotal: function() {
|
||||
for (var a = $("#grid").jqGrid("getDataIDs"), b = 0, c = 0, d = a.length; d > c; c++) {
|
||||
var e = a[c],
|
||||
f = $("#grid").jqGrid("getRowData", e);
|
||||
f.amount && (b += parseFloat(f.amount))
|
||||
}
|
||||
$("#grid").jqGrid("footerData", "set", {
|
||||
amount: b
|
||||
})
|
||||
},
|
||||
_getEntriesData: function() {
|
||||
for (var a = [], b = $("#grid").jqGrid("getDataIDs"), c = 0, d = b.length; d > c; c++) {
|
||||
var e, f = b[c],
|
||||
g = $("#grid").jqGrid("getRowData", f);
|
||||
if ("" !== g.paySettacctName && "" !== g.recSettacctName && "" !== g.amount) {
|
||||
var h = $("#" + f).data("accountInfo_0"),
|
||||
i = $("#" + f).data("accountInfo");
|
||||
if (g.amount <= 0) return parent.Public.tips({
|
||||
type: 2,
|
||||
content: "金额必须大于0!"
|
||||
}), !1;
|
||||
if (h.id === i.id) return parent.Public.tips({
|
||||
type: 2,
|
||||
content: "转入转出账户不能相同!"
|
||||
}), !1;
|
||||
var j = $("#" + f).data("payTypeInfo");
|
||||
e = {
|
||||
paySettacctId: h.id,
|
||||
recSettacctId: i.id,
|
||||
wayId: j ? j.id || 0 : 0,
|
||||
amount: g.amount,
|
||||
refNo: g.refNo,
|
||||
desc: g.desc || ""
|
||||
}, a.push(e)
|
||||
}
|
||||
}
|
||||
return a
|
||||
},
|
||||
getPostData: function() {
|
||||
var a = this;
|
||||
null !== curRow && null !== curCol && ($("#grid").jqGrid("saveCell", curRow, curCol), curRow = null, curCol = null);
|
||||
var b = this._getEntriesData();
|
||||
if (b) {
|
||||
var c = $.trim(a.$_note.val());
|
||||
if (b.length > 0) {
|
||||
a.calTotal();
|
||||
var d = {
|
||||
id: originalData.id,
|
||||
date: $.trim(a.$_date.val()),
|
||||
billNo: $.trim(a.$_number.text()),
|
||||
entries: b,
|
||||
description: "暂无备注信息" === c ? "" : c,
|
||||
totalAmount: $("#grid").jqGrid("footerData", "get").amount.replace(/,/g, "")
|
||||
};
|
||||
return d
|
||||
}
|
||||
return parent.Public.tips({
|
||||
type: 2,
|
||||
content: "至少保存一条有效分录数据!"
|
||||
}), $("#grid").jqGrid("editCell", 1, 2, !0), !1
|
||||
}
|
||||
}
|
||||
};
|
||||
$(function() {
|
||||
urlParam.id ? hasLoaded || Public.ajaxGet("../scm/fundTf/update?action=update", {
|
||||
id: urlParam.id
|
||||
}, function(a) {
|
||||
200 === a.status ? (originalData = a.data, originalData.id = originalData.billId, originalData.date = originalData.createDate, THISPAGE.init(originalData), hasLoaded = !0) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
}) : (originalData = {
|
||||
id: -1,
|
||||
status: "add",
|
||||
customer: 0,
|
||||
entries: [{
|
||||
id: "1"
|
||||
}, {
|
||||
id: "2"
|
||||
}, {
|
||||
id: "3"
|
||||
}, {
|
||||
id: "4"
|
||||
}, {
|
||||
id: "5"
|
||||
}, {
|
||||
id: "6"
|
||||
}, {
|
||||
id: "7"
|
||||
}, {
|
||||
id: "8"
|
||||
}],
|
||||
totalQty: 0,
|
||||
totalAmount: 0,
|
||||
disRate: 0,
|
||||
disAmount: 0,
|
||||
amount: "0.00",
|
||||
rpAmount: "0.00",
|
||||
arrears: "0.00"
|
||||
}, THISPAGE.init(originalData))
|
||||
});
|
||||
205
statics/js/dist/accountTransferList.js
vendored
Executable file
205
statics/js/dist/accountTransferList.js
vendored
Executable file
@@ -0,0 +1,205 @@
|
||||
var urlParam = Public.urlParam(),
|
||||
queryConditions = {
|
||||
matchCon: ""
|
||||
},
|
||||
hiddenAmount = !1,
|
||||
SYSTEM = system = parent.SYSTEM,
|
||||
THISPAGE = {
|
||||
init: function(a) {
|
||||
SYSTEM.isAdmin !== !1 || SYSTEM.rights.AMOUNT_COSTAMOUNT || (hiddenAmount = !0), this.mod_PageConfig = Public.mod_PageConfig.init("accountTransferList"), this.initDom(), this.loadGrid(), this.addEvent()
|
||||
},
|
||||
initDom: function() {
|
||||
this.$_matchCon = $("#matchCon"), this.$_beginDate = $("#beginDate").val(system.beginDate), this.$_endDate = $("#endDate").val(system.endDate), this.$_acctPay = $("#acctPay"), this.$_acctRec = $("#acctRec"), this.$_matchCon.placeholder(), this.$_beginDate.datepicker(), this.$_endDate.datepicker(), SYSTEM.isAdmin !== !1 || SYSTEM.rights.SettAcct_QUERY ? (this.acctPayCombo = Business.accountCombo(this.$_acctPay, {
|
||||
addOptions: {
|
||||
text: "(全部)",
|
||||
value: -1
|
||||
},
|
||||
width: 110
|
||||
}), this.acctRecCombo = Business.accountCombo(this.$_acctRec, {
|
||||
addOptions: {
|
||||
text: "(全部)",
|
||||
value: -1
|
||||
},
|
||||
width: 110
|
||||
})) : (this.$_acctPay.parent().hide(), this.$_acctRec.parent().hide())
|
||||
},
|
||||
splitFmatter: function(a, b, c) {
|
||||
var d;
|
||||
if (c.entries && c.entries.length && b.colModel.name && (d = $.map(c.entries, function(a) {
|
||||
return "<span>" + a["" + b.colModel.name] + "</span>"
|
||||
})), d) var e = d.join('<p class="line" />');
|
||||
return e || " "
|
||||
},
|
||||
loadGrid: function() {
|
||||
function a(a, b, c) {
|
||||
var d = '<div class="operating" data-id="' + c.billId + '"><span class="ui-icon ui-icon-pencil" title="修改"></span><span class="ui-icon ui-icon-trash" title="删除"></span></div>';
|
||||
return d
|
||||
}
|
||||
var b = Public.setGrid();
|
||||
queryConditions.beginDate = this.$_beginDate.val(), queryConditions.endDate = this.$_endDate.val(), "undefined" != typeof urlParam.id && "" != urlParam.id && (queryConditions.id = urlParam.id);
|
||||
var c = !(SYSTEM.isAdmin === !1 && !SYSTEM.rights.SettAcct_QUERY),
|
||||
d = [{
|
||||
name: "operating",
|
||||
label: "操作",
|
||||
width: 60,
|
||||
fixed: !0,
|
||||
formatter: a,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billDate",
|
||||
label: "转账日期",
|
||||
width: 100,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billNo",
|
||||
label: "单据编号",
|
||||
width: 120,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "paySettacctName",
|
||||
label: "转出账户",
|
||||
width: 100,
|
||||
align: "center",
|
||||
classes: "ui-ellipsis",
|
||||
hidden: !c,
|
||||
formatter: THISPAGE.splitFmatter
|
||||
}, {
|
||||
name: "recSettacctName",
|
||||
label: "转入账户",
|
||||
width: 100,
|
||||
align: "center",
|
||||
classes: "ui-ellipsis",
|
||||
hidden: !c,
|
||||
formatter: THISPAGE.splitFmatter
|
||||
}, {
|
||||
name: "amount",
|
||||
label: "金额",
|
||||
width: 100,
|
||||
align: "right",
|
||||
classes: "ui-ellipsis",
|
||||
hidden: !c,
|
||||
formatter: THISPAGE.splitFmatter
|
||||
}, {
|
||||
name: "amount",
|
||||
label: "合计金额",
|
||||
hidden: hiddenAmount,
|
||||
width: 100,
|
||||
align: "right",
|
||||
formatter: "currency"
|
||||
}, {
|
||||
name: "description",
|
||||
label: "备注",
|
||||
width: 150
|
||||
}];
|
||||
this.mod_PageConfig.gridReg("grid", d), d = this.mod_PageConfig.conf.grids.grid.colModel, $("#grid").jqGrid({
|
||||
url: "../scm/fundTf?action=list",
|
||||
postData: queryConditions,
|
||||
datatype: "json",
|
||||
autowidth: !0,
|
||||
height: b.h,
|
||||
altRows: !0,
|
||||
gridview: !0,
|
||||
multiselect: !0,
|
||||
multiboxonly: !0,
|
||||
colModel: d,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "number",
|
||||
sortorder: "desc",
|
||||
pager: "#page",
|
||||
rowNum: 100,
|
||||
rowList: [100, 200, 500],
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
forceFit: !0,
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
records: "data.records",
|
||||
repeatitems: !1,
|
||||
total: "data.total",
|
||||
id: "billId"
|
||||
},
|
||||
loadError: function(a, b, c) {},
|
||||
ondblClickRow: function(a, b, c, d) {
|
||||
$("#" + a).find(".ui-icon-pencil").trigger("click")
|
||||
},
|
||||
resizeStop: function(a, b) {
|
||||
THISPAGE.mod_PageConfig.setGridWidthByIndex(a, b, "grid")
|
||||
}
|
||||
}).navGrid("#page", {
|
||||
edit: !1,
|
||||
add: !1,
|
||||
del: !1,
|
||||
search: !1,
|
||||
refresh: !1
|
||||
}).navButtonAdd("#page", {
|
||||
caption: "",
|
||||
buttonicon: "ui-icon-config",
|
||||
onClickButton: function() {
|
||||
THISPAGE.mod_PageConfig.config()
|
||||
},
|
||||
position: "last"
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
$("#grid").jqGrid("setGridParam", {
|
||||
url: "../scm/fundTf?action=list",
|
||||
datatype: "json",
|
||||
postData: a
|
||||
}).trigger("reloadGrid")
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
$(".grid-wrap").on("click", ".ui-icon-pencil", function(a) {
|
||||
a.preventDefault();
|
||||
var b = $(this).parent().data("id");
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-accountTransfer",
|
||||
text: "资金转账单",
|
||||
url: "../scm/fundTf?action=editFundTf&id=" + b
|
||||
});
|
||||
$("#grid").jqGrid("getDataIDs");
|
||||
parent.accountTransferListIds = $("#grid").jqGrid("getDataIDs")
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-trash", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("ZJZZ_DELETE")) {
|
||||
var b = $(this).parent().data("id");
|
||||
$.dialog.confirm("您确定要删除该收入记录吗?", function() {
|
||||
Public.ajaxGet("../scm/fundTf/delete?action=delete", {
|
||||
id: b
|
||||
}, function(a) {
|
||||
200 === a.status ? ($("#grid").jqGrid("delRowData", b), parent.Public.tips({
|
||||
content: "删除成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}), $("#search").click(function() {
|
||||
queryConditions.matchCon = "请输入单据号或备注" === a.$_matchCon.val() ? "" : a.$_matchCon.val(), queryConditions.beginDate = a.$_beginDate.val(), queryConditions.endDate = a.$_endDate.val(), a.acctPayCombo && (queryConditions.paySettacctId = a.acctPayCombo.getValue()), a.acctRecCombo && (queryConditions.recSettacctId = a.acctRecCombo.getValue()), THISPAGE.reloadData(queryConditions)
|
||||
}), $("#add").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("ZJZZ_ADD") && parent.tab.addTabItem({
|
||||
tabid: "money-accountTransfer",
|
||||
text: "资金转账单",
|
||||
url: "../scm/fundTf?action=initFundTf"
|
||||
})
|
||||
}), $("#export").click(function(a) {
|
||||
if (!Business.verifyRight("ZJZZ_EXPORT")) return void a.preventDefault();
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow"),
|
||||
c = b.join(),
|
||||
d = c ? "&id=" + c : "";
|
||||
for (var e in queryConditions) queryConditions[e] && (d += "&" + e + "=" + queryConditions[e]);
|
||||
var f = "../scm/fundTf/export?action=export" + d;
|
||||
$(this).attr("href", f)
|
||||
}), $(window).resize(function() {
|
||||
Public.resizeGrid()
|
||||
})
|
||||
}
|
||||
};
|
||||
$(function() {
|
||||
THISPAGE.init()
|
||||
});
|
||||
13
statics/js/dist/addedServiceList.js
vendored
Executable file
13
statics/js/dist/addedServiceList.js
vendored
Executable file
@@ -0,0 +1,13 @@
|
||||
function initServices() {
|
||||
for (var a = ["<tr>", '<td class="img"><i width="64" height="64" style="#{imgOutStyle}"></i></td>', "<td>", "<h3>#{name}</h3>", '<p>#{desc}<a href="#{detailsLink}" class="details" target="_blank">详情>></a></p>', "</td>", '<td class="price">¥ <strong>#{price}</strong> <span>#{unit}</span></td>', '<td class="w80 #{linkType}"><a href="#{buyLink}" class="ui-btn ui-btn-sc" target="_blank" data-product-id="#{productId}">#{btnValue}</a></td>', "</tr>"].join(""), b = [], c = 0; c < addedService.length; c++) {
|
||||
var d = addedService[c],
|
||||
e = a.replace(/\#{([\w\-]+)\}/g, function(a, b) {
|
||||
return d[b] || ""
|
||||
});
|
||||
b.push(e)
|
||||
}
|
||||
$("#addedService").html(b.join(""))
|
||||
}!
|
||||
function() {
|
||||
initServices()
|
||||
}(jQuery);
|
||||
272
statics/js/dist/addressManage.js
vendored
Executable file
272
statics/js/dist/addressManage.js
vendored
Executable file
@@ -0,0 +1,272 @@
|
||||
$(function() {
|
||||
api = frameElement.api;
|
||||
var a = this,
|
||||
b = api.data.oper,
|
||||
c = api.data.rowData || {},
|
||||
d = api.data.callback,
|
||||
e = api.data.hasDefault,
|
||||
f = !1;
|
||||
_page = {
|
||||
$shortName: $("#shortName"),
|
||||
$postalcode: $("#postalcode"),
|
||||
$province: $("#province"),
|
||||
$city: $("#city"),
|
||||
$area: $("#area"),
|
||||
$address: $("#address"),
|
||||
$linkman: $("#linkman"),
|
||||
$phone: $("#phone"),
|
||||
$mobile: $("#mobile"),
|
||||
$isDefault: $("#isDefault"),
|
||||
init: function() {
|
||||
mod_AreasCombo.init(_page.$province, _page.$city, _page.$area, function() {
|
||||
_page.provinceCombo = mod_AreasCombo.provinceCombo, _page.cityCombo = mod_AreasCombo.cityCombo, _page.areaCombo = mod_AreasCombo.areaCombo;
|
||||
var b = 1 == c.isDefault ? 0 : 1;
|
||||
f = c.isDefault ? !0 : !1;
|
||||
var d = e ? f : !0;
|
||||
_page.isDefaultCombo = _page.$isDefault.combo({
|
||||
data: [{
|
||||
id: 1,
|
||||
name: "是"
|
||||
}, {
|
||||
id: 0,
|
||||
name: "否"
|
||||
}],
|
||||
value: "id",
|
||||
text: "name",
|
||||
width: 197,
|
||||
defaultSelected: b || void 0,
|
||||
editable: !1,
|
||||
disabled: !d
|
||||
}).getCombo(), _page.$shortName.val(c.shortName), _page.$postalcode.val(c.postalcode), _page.provinceCombo.selectByText(c.province), _page.cityCombo.selectByText(c.city), _page.areaCombo.selectByText(c.area || c.county), _page.$address.val(c.address), _page.$linkman.val(c.linkman), _page.$phone.val(c.phone), _page.$mobile.val(c.mobile), $("#province").find("input").attr("name", "provinceInput"), $("#city").find("input").attr("name", "cityInput"), $("#area").find("input").attr("name", "areaInput"), a.initButton(), a.initValidator(), _page.$shortName.focus().select()
|
||||
})
|
||||
}
|
||||
}, _event = {}, a.initButton = function() {
|
||||
var d = "add" == b ? ["保存", "关闭"] : ["确定", "取消"];
|
||||
api.button({
|
||||
id: "confirm",
|
||||
name: d[0],
|
||||
focus: !0,
|
||||
callback: function() {
|
||||
return a.postData(b, c.id), !1
|
||||
}
|
||||
}, {
|
||||
id: "cancel",
|
||||
name: d[1]
|
||||
})
|
||||
}, a.initValidator = function() {
|
||||
$.validator.addMethod("mobile", function(a) {
|
||||
return a ? /0?(13|14|15|18)[0-9]{9}/.test(a) : !0
|
||||
}), $.validator.addMethod("phone", function(a) {
|
||||
return a ? /[0-9-()()]{7,18}/.test(a) : !0
|
||||
}), $.validator.addMethod("postalcode", function(a) {
|
||||
return a ? /\d{6}/.test(a) : !0
|
||||
}), $.validator.addMethod("require_from_group", function(a, b, c) {
|
||||
var d = this,
|
||||
e = c[1],
|
||||
f = $(e, b.form).filter(function() {
|
||||
return d.elementValue(this)
|
||||
}).length >= c[0];
|
||||
if (!$(b).data("being_validated")) {
|
||||
var g = $(e, b.form);
|
||||
g.data("being_validated", !0), g.valid(), g.data("being_validated", !1)
|
||||
}
|
||||
return f
|
||||
}, jQuery.format("请输入电话或者手机号码")), $("#manage-form").validate({
|
||||
errorPlacement: function(a, b) {
|
||||
a.appendTo(b.parent());
|
||||
var c = "10px",
|
||||
d = "35px";
|
||||
a.parent().hasClass("ui-combo-wrap") && (c = "6px", d = "15px"), a.css({
|
||||
display: "block",
|
||||
position: "absolute",
|
||||
top: c,
|
||||
right: d
|
||||
})
|
||||
},
|
||||
rules: {
|
||||
shortName: {},
|
||||
address: {
|
||||
required: !0
|
||||
},
|
||||
linkman: {
|
||||
required: !0
|
||||
},
|
||||
mobile: {
|
||||
require_from_group: [1, ".phone-group"]
|
||||
},
|
||||
phone: {
|
||||
require_from_group: [1, ".phone-group"]
|
||||
},
|
||||
postalcode: {
|
||||
required: !0
|
||||
},
|
||||
provinceInput: {
|
||||
required: !1
|
||||
},
|
||||
cityInput: {
|
||||
required: !1
|
||||
},
|
||||
areaInput: {
|
||||
required: !1
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
shortName: {
|
||||
required: "名称不能为空"
|
||||
},
|
||||
mobile: {
|
||||
mobile: "手机格式不正确"
|
||||
},
|
||||
phone: {
|
||||
phone: "电话格式不正确"
|
||||
},
|
||||
postalcode: {
|
||||
postalcode: "邮编格式不正确",
|
||||
required: "邮编不能为空"
|
||||
},
|
||||
address: {
|
||||
required: "详细地址不能为空"
|
||||
},
|
||||
linkman: {
|
||||
required: "联系人不能为空"
|
||||
},
|
||||
provinceInput: {
|
||||
required: "省份不能为空"
|
||||
},
|
||||
cityInput: {
|
||||
required: "市不能为空"
|
||||
},
|
||||
areaInput: {
|
||||
required: "区不能为空"
|
||||
}
|
||||
},
|
||||
errorClass: "valid-error"
|
||||
})
|
||||
}, a.postData = function(a, b) {
|
||||
if (!$("#manage-form").validate().form()) return void $("#manage-form").find("input.valid-error").eq(0).focus();
|
||||
var e = $.trim(_page.$shortName.val()),
|
||||
f = $.trim(_page.$postalcode.val()),
|
||||
g = _page.provinceCombo.getText(),
|
||||
h = _page.cityCombo.getText(),
|
||||
i = _page.areaCombo.getText(),
|
||||
j = $.trim(_page.$address.val()),
|
||||
k = $.trim(_page.$linkman.val()),
|
||||
l = $.trim(_page.$phone.val()),
|
||||
m = $.trim(_page.$mobile.val()),
|
||||
n = _page.isDefaultCombo && _page.isDefaultCombo.getValue();
|
||||
params = c.id ? {
|
||||
id: b,
|
||||
shortName: e,
|
||||
postalcode: f,
|
||||
province: g,
|
||||
city: h,
|
||||
area: i,
|
||||
address: j,
|
||||
linkman: k,
|
||||
phone: l,
|
||||
mobile: m,
|
||||
isDefault: n
|
||||
} : {
|
||||
shortName: e,
|
||||
postalcode: f,
|
||||
province: g,
|
||||
city: h,
|
||||
area: i,
|
||||
address: j,
|
||||
linkman: k,
|
||||
phone: l,
|
||||
mobile: m,
|
||||
isDefault: n
|
||||
}, d(params, api)
|
||||
}, _page.init(), window.resetForm = function() {
|
||||
$("#manage-form").validate().resetForm(), _page.$shortName.val(""), _page.$postalcode.val(""), _page.provinceCombo.selectByText(""), _page.cityCombo.selectByText(""), _page.areaCombo.selectByText(""), _page.$address.val(""), _page.$linkman.val(""), _page.$phone.val(""), _page.$mobile.val(""), _page.isDefaultCombo.selectByText("否"), e && "add" == b && _page.isDefaultCombo.disable()
|
||||
}
|
||||
});
|
||||
var mod_AreasCombo = function(a) {
|
||||
function b(b, c) {
|
||||
return b.combo({
|
||||
data: c,
|
||||
text: "name",
|
||||
value: "id",
|
||||
width: 195,
|
||||
listHeight: 100,
|
||||
defaultSelected: -1,
|
||||
cache: !1,
|
||||
editable: !0,
|
||||
callback: {
|
||||
onFocus: null,
|
||||
onBlur: null,
|
||||
beforeChange: null,
|
||||
onChange: function() {
|
||||
switch (this) {
|
||||
case a.provinceCombo:
|
||||
a.cityCombo.loadData(d(a.provinceCombo.getValue()), -1, !1), a.areaCombo.loadData([], -1, !1);
|
||||
break;
|
||||
case a.cityCombo:
|
||||
a.areaCombo.loadData(e(a.cityCombo.getValue()), -1, !1);
|
||||
break;
|
||||
case a.areaCombo:
|
||||
}
|
||||
},
|
||||
onExpand: null,
|
||||
onCollapse: null
|
||||
}
|
||||
}).getCombo()
|
||||
}
|
||||
function c() {
|
||||
var a = [];
|
||||
for (i = 0, len = l.length; i < len; i++) 2 === l[i].type && 1 === l[i].parent_id && a.push({
|
||||
name: l[i].name,
|
||||
id: l[i].id
|
||||
});
|
||||
return a
|
||||
}
|
||||
function d(a) {
|
||||
var b = [];
|
||||
for (i = 0, len = m.length; i < len; i++) m[i].parent_id === a && b.push({
|
||||
name: m[i].name,
|
||||
id: m[i].id
|
||||
});
|
||||
return b
|
||||
}
|
||||
function e(a) {
|
||||
var b = [];
|
||||
if (n[a]) b = n[a].areaData;
|
||||
else {
|
||||
for (i = 0, len = j.length; i < len; i++) 4 === j[i].type && j[i].parent_id === a && b.push({
|
||||
name: j[i].name,
|
||||
id: j[i].id
|
||||
});
|
||||
n[a] = {
|
||||
areaData: b
|
||||
}
|
||||
}
|
||||
return b
|
||||
}
|
||||
var f, g, h, j = [],
|
||||
k = !1,
|
||||
l = [],
|
||||
m = [],
|
||||
n = {};
|
||||
return a.init = function(d, e, n, o) {
|
||||
return f = d, g = e, h = n, d && e && n ? (Public.ajaxPost("../../statics/js/common/areasData.php", {}, function(d) {
|
||||
if (d) {
|
||||
for (k = !0, j = d.areas_get_response.areas.area, i = 0, len = j.length; i < len; i++) 2 === j[i].type && 1 === j[i].parent_id && l.push({
|
||||
name: j[i].name,
|
||||
id: j[i].id,
|
||||
type: 2,
|
||||
parent_id: 1
|
||||
}), 3 === j[i].type && m.push({
|
||||
name: j[i].name,
|
||||
id: j[i].id,
|
||||
type: j[i].type,
|
||||
parent_id: j[i].parent_id
|
||||
});
|
||||
a.provinceCombo = b(f, c()), a.cityCombo = b(g, []), a.areaCombo = b(h, []), o()
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: "初始化省市区失败!"
|
||||
})
|
||||
}), a) : void 0
|
||||
}, a
|
||||
}(mod_AreasCombo || {});
|
||||
570
statics/js/dist/adjustment.js
vendored
Executable file
570
statics/js/dist/adjustment.js
vendored
Executable file
@@ -0,0 +1,570 @@
|
||||
var curRow, curCol, curArrears, loading, urlParam = Public.urlParam(),
|
||||
SYSTEM = parent.SYSTEM,
|
||||
hiddenAmount = !1,
|
||||
qtyPlaces = Number(parent.SYSTEM.qtyPlaces),
|
||||
pricePlaces = Number(parent.SYSTEM.pricePlaces),
|
||||
amountPlaces = Number(parent.SYSTEM.amountPlaces),
|
||||
defaultPage = Public.getDefaultPage(),
|
||||
THISPAGE = {
|
||||
init: function(a) {
|
||||
this.mod_PageConfig = Public.mod_PageConfig.init("adjustment"), SYSTEM.isAdmin !== !1 || SYSTEM.rights.AMOUNT_COSTAMOUNT || (hiddenAmount = !0), this.loadGrid(a), this.initDom(a), this.initCombo(), this.addEvent()
|
||||
},
|
||||
initDom: function(a) {
|
||||
this.$_date = $("#date").val(SYSTEM.endDate), this.$_number = $("#number"), this.$_note = $("#note"), this.$_toolTop = $("#toolTop"), this.$_toolBottom = $("#toolBottom"), this.$_userName = $("#userName"), this.$_note.placeholder(), this.$_date.datepicker({
|
||||
onSelect: function(a) {
|
||||
if (!(originalData.id > 0)) {
|
||||
var b = a.format("yyyy-MM-dd");
|
||||
THISPAGE.$_number.text(""), Public.ajaxPost("../basedata/systemProfile/generateDocNo?action=generateDocNo", {
|
||||
billType: "CADJ",
|
||||
billDate: b
|
||||
}, function(a) {
|
||||
200 === a.status ? THISPAGE.$_number.text(a.data.billNo) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}), a.id > 0 ? (this.$_number.text(a.billNo), this.$_date.val(a.date), a.description && this.$_note.val(a.description), $("#grid").jqGrid("footerData", "set", {
|
||||
qty: a.totalQty,
|
||||
amount: a.totalAmount
|
||||
}), this.$_toolBottom.html("edit" === a.status ? '<a id="add" class="ui-btn ui-btn-sp mrb">新增</a><a href="../scm/invOi/toCBTZPdf?action=toCBTZPdf&id=' + a.id + '" target="_blank" id="print" class="ui-btn mrb">打印</a><a id="edit" class="ui-btn">保存</a>' : '<a id="add" class="ui-btn ui-btn-sp mrb">新增</a><a href="../scm/invOi/toCBTZPdf?action=toCBTZPdf&id=' + a.id + '" target="_blank" id="print" class="ui-btn mrb">打印</a><a class="ui-btn-prev mrb" id="prev" title="上一张"><b></b></a><a class="ui-btn-next" id="next" title="下一张"><b></b></a>'), this.salesListIds = parent.salesListIds || [], this.idPostion = $.inArray(String(a.id), this.salesListIds), this.idLength = this.salesListIds.length, 0 === this.idPostion && $("#prev").addClass("ui-btn-prev-dis"), this.idPostion === this.idLength - 1 && $("#next").addClass("ui-btn-next-dis"), this.$_userName.html(a.userName)) : (this.$_toolBottom.html('<a id="savaAndAdd" class="ui-btn ui-btn-sp mrb">保存并新增</a><a id="save" class="ui-btn">保存</a>'), this.$_userName.html(SYSTEM.realName || ""))
|
||||
},
|
||||
loadGrid: function(a) {
|
||||
function b(a, b, c) {
|
||||
return a ? (i(b.rowId), a) : c.invNumber ? c.invSpec ? c.invNumber + " " + c.invName + "_" + c.invSpec : c.invNumber + " " + c.invName : " "
|
||||
}
|
||||
function c() {
|
||||
var a = $(".goodsAuto")[0];
|
||||
return a
|
||||
}
|
||||
function d(a, b, c) {
|
||||
if ("get" === b) {
|
||||
if ("" !== $(".goodsAuto").getCombo().getValue()) return $(a).val();
|
||||
var d = $(a).parents("tr");
|
||||
return d.removeData("goodsInfo"), ""
|
||||
}
|
||||
"set" === b && $("input", a).val(c)
|
||||
}
|
||||
function e() {
|
||||
$("#initCombo").append($(".goodsAuto").val("").unbind("focus.once"))
|
||||
}
|
||||
function f() {
|
||||
var a = $(".storageAuto")[0];
|
||||
return a
|
||||
}
|
||||
function g(a, b, c) {
|
||||
if ("get" === b) {
|
||||
if ("" !== $(".storageAuto").getCombo().getValue()) return $(a).val();
|
||||
var d = $(a).parents("tr");
|
||||
return d.removeData("storageInfo"), ""
|
||||
}
|
||||
"set" === b && $("input", a).val(c)
|
||||
}
|
||||
function h() {
|
||||
$("#initCombo").append($(".storageAuto").val(""))
|
||||
}
|
||||
function i(a) {
|
||||
var b = $("#" + a).data("goodsInfo"),
|
||||
c = $("#grid").jqGrid("getRowData", a);
|
||||
if (b) {
|
||||
var c = {
|
||||
skuId: b.skuId || -1,
|
||||
skuName: b.skuName || "",
|
||||
mainUnit: b.mainUnit || b.unitName,
|
||||
unitId: b.unitId,
|
||||
amount: c.amount || 0,
|
||||
locationName: b.locationName
|
||||
},
|
||||
d = $("#grid").jqGrid("setRowData", a, c);
|
||||
d && THISPAGE.calTotal()
|
||||
}
|
||||
}
|
||||
var j = this;
|
||||
if (a.id) {
|
||||
var k = 8 - a.entries.length;
|
||||
if (k > 0) for (var l = 0; k > l; l++) a.entries.push({})
|
||||
}
|
||||
j.newId = 9;
|
||||
var m = "grid",
|
||||
n = [{
|
||||
name: "operating",
|
||||
label: " ",
|
||||
width: 40,
|
||||
fixed: !0,
|
||||
formatter: Public.billsOper,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "goods",
|
||||
label: "商品",
|
||||
width: 320,
|
||||
title: !0,
|
||||
classes: "goods",
|
||||
formatter: b,
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: c,
|
||||
custom_value: d,
|
||||
handle: e,
|
||||
trigger: "ui-icon-ellipsis disableSku"
|
||||
}
|
||||
}, {
|
||||
name: "skuId",
|
||||
label: "属性ID",
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "mainUnit",
|
||||
label: "单位",
|
||||
width: 60
|
||||
}, {
|
||||
name: "amount",
|
||||
label: "调整金额",
|
||||
hidden: hiddenAmount,
|
||||
width: 100,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
showZero: !0,
|
||||
decimalPlaces: amountPlaces
|
||||
},
|
||||
editable: !0
|
||||
}, {
|
||||
name: "locationName",
|
||||
label: '仓库<small id="batchStorage">(批量)</small>',
|
||||
width: 100,
|
||||
title: !0,
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: f,
|
||||
custom_value: g,
|
||||
handle: h,
|
||||
trigger: "ui-icon-triangle-1-s"
|
||||
}
|
||||
}, {
|
||||
name: "description",
|
||||
label: "备注",
|
||||
width: 150,
|
||||
title: !0,
|
||||
editable: !0
|
||||
}];
|
||||
j.mod_PageConfig.gridReg(m, n), n = j.mod_PageConfig.conf.grids[m].colModel, $("#grid").jqGrid({
|
||||
data: a.entries,
|
||||
datatype: "clientSide",
|
||||
autowidth: !0,
|
||||
height: "100%",
|
||||
rownumbers: !0,
|
||||
gridview: !0,
|
||||
onselectrow: !1,
|
||||
colModel: n,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
shrinkToFit: !1,
|
||||
forceFit: !0,
|
||||
rowNum: 1e3,
|
||||
cellEdit: !1,
|
||||
cellsubmit: "clientArray",
|
||||
localReader: {
|
||||
root: "rows",
|
||||
records: "records",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
jsonReader: {
|
||||
root: "data.entries",
|
||||
records: "records",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
if (urlParam.id > 0) {
|
||||
var b = a.rows,
|
||||
c = b.length;
|
||||
j.newId = c + 1;
|
||||
for (var d = 0; c > d; d++) {
|
||||
var e = d + 1,
|
||||
f = b[d];
|
||||
if ($.isEmptyObject(b[d])) break;
|
||||
var g = $.extend(!0, {
|
||||
id: f.invId,
|
||||
number: f.invNumber,
|
||||
name: f.invName,
|
||||
spec: f.invSpec,
|
||||
unitId: f.unitId,
|
||||
unitName: f.mainUnit
|
||||
}, f);
|
||||
g.id = f.invId, $("#" + e).data("goodsInfo", g).data("storageInfo", {
|
||||
id: f.locationId,
|
||||
name: f.locationName
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
gridComplete: function() {
|
||||
setTimeout(function() {
|
||||
Public.autoGrid($("#grid"))
|
||||
}, 10)
|
||||
},
|
||||
afterEditCell: function(a, b, c, d) {
|
||||
if ("goods" === b) {
|
||||
var e = $("#" + a).data("goodsInfo");
|
||||
if (e) {
|
||||
var f = $("#grid").jqGrid("getRowData", a);
|
||||
e = $.extend(!0, {}, e), e.mainUnit = f.mainUnit, e.unitId = f.unitId, e.qty = f.qty, e.price = f.price, e.discountRate = f.discountRate, e.deduction = f.deduction, e.amount = f.amount, e.taxRate = f.taxRate, e.tax = f.tax, e.taxAmount = f.taxAmount, e.locationName = f.locationName, $("#" + a).data("goodsInfo", e)
|
||||
}
|
||||
$("#" + d + "_goods", "#grid").val(c), THISPAGE.goodsCombo.selectByText(c), THISPAGE.curID = a
|
||||
}
|
||||
"locationName" === b && ($("#" + d + "_locationName", "#grid").val(c), THISPAGE.storageCombo.selectByText(c))
|
||||
},
|
||||
formatCell: function() {},
|
||||
beforeSubmitCell: function() {},
|
||||
beforeSaveCell: function(a, b, c) {
|
||||
if ("goods" === b) {
|
||||
var d = $("#" + a).data("goodsInfo");
|
||||
if (d) return c;
|
||||
j.skey = c;
|
||||
var e, f = function(b) {
|
||||
$("#" + a).data("goodsInfo", b).data("storageInfo", {
|
||||
id: b.locationId,
|
||||
name: b.locationName
|
||||
}).data("unitInfo", {
|
||||
unitId: b.unitId,
|
||||
name: b.unitName
|
||||
}), e = Business.formatGoodsName(b)
|
||||
};
|
||||
return THISPAGE.$_barCodeInsert && THISPAGE.$_barCodeInsert.hasClass("active") ? Business.cacheManage.getGoodsInfoByBarCode(c, f, !0) : Business.cacheManage.getGoodsInfoByNumber(c, f, !0), e ? e : ($.dialog({
|
||||
width: 775,
|
||||
height: 510,
|
||||
title: "选择商品",
|
||||
content: "url:../settings/goods_batch",
|
||||
data: {
|
||||
skuMult: SYSTEM.enableAssistingProp,
|
||||
skey: j.skey,
|
||||
callback: function(a, b, c) {
|
||||
"" === b && ($("#grid").jqGrid("addRowData", a, {}, "last"), j.newId = a + 1), setTimeout(function() {
|
||||
$("#grid").jqGrid("editCell", c, 2, !0)
|
||||
}, 10), j.calTotal()
|
||||
}
|
||||
},
|
||||
init: function() {
|
||||
j.skey = ""
|
||||
},
|
||||
lock: !0,
|
||||
button: [{
|
||||
name: "选中",
|
||||
defClass: "ui_state_highlight fl",
|
||||
focus: !0,
|
||||
callback: function() {
|
||||
return this.content.callback && this.content.callback(), !1
|
||||
}
|
||||
}, {
|
||||
name: "选中并关闭",
|
||||
defClass: "ui_state_highlight",
|
||||
callback: function() {
|
||||
return this.content.callback(), this.close(), !1
|
||||
}
|
||||
}, {
|
||||
name: "关闭",
|
||||
callback: function() {
|
||||
return !0
|
||||
}
|
||||
}]
|
||||
}), setTimeout(function() {
|
||||
$("#grid").jqGrid("editCell", curRow, 2, !0), $("#grid").jqGrid("setCell", curRow, 2, "")
|
||||
}, 10), " ")
|
||||
}
|
||||
},
|
||||
afterSaveCell: function(a, b, c, d, e) {
|
||||
if ("qty" == b) {
|
||||
var f = $("#grid").jqGrid("getCell", a, e + 1);
|
||||
if (!isNaN(parseFloat(f))) {
|
||||
var g = $("#grid").jqGrid("setRowData", a, {
|
||||
amount: parseFloat(c) * parseFloat(f)
|
||||
});
|
||||
g && THISPAGE.calTotal()
|
||||
}
|
||||
}
|
||||
if ("price" == b) {
|
||||
var h = $("#grid").jqGrid("getCell", a, e - 1);
|
||||
if (!isNaN(parseFloat(h))) {
|
||||
var g = $("#grid").jqGrid("setRowData", a, {
|
||||
amount: parseFloat(c) * parseFloat(h)
|
||||
});
|
||||
g && THISPAGE.calTotal()
|
||||
}
|
||||
}
|
||||
if ("amount" == b) {
|
||||
var h = $("#grid").jqGrid("getCell", a, e - 2);
|
||||
if (!isNaN(parseFloat(h))) {
|
||||
var f = parseFloat(c) / parseFloat(h);
|
||||
$("#grid").jqGrid("setRowData", a, {
|
||||
price: f
|
||||
})
|
||||
}
|
||||
THISPAGE.calTotal()
|
||||
}
|
||||
},
|
||||
loadonce: !0,
|
||||
resizeStop: function(a, b) {
|
||||
j.mod_PageConfig.updatePageConfig("grid", ["width", j.mod_PageConfig.conf.grids.grid.defColModel[b - 1].name, a])
|
||||
},
|
||||
footerrow: !0,
|
||||
userData: {
|
||||
goods: "合计:",
|
||||
qty: a.totalQty,
|
||||
amount: a.totalAmount
|
||||
},
|
||||
userDataOnFooter: !0,
|
||||
loadError: function(a, b) {
|
||||
Public.tips({
|
||||
type: 1,
|
||||
content: "Type: " + b + "; Response: " + a.status + " " + a.statusText
|
||||
})
|
||||
}
|
||||
}), $("#grid").jqGrid("setGridParam", {
|
||||
cellEdit: !0
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
function b() {
|
||||
c.customerCombo.selectByValue(a.buId, !1), c.$_date.val(a.date), c.$_number.text(a.billNo), a.note && c.$_note.val(a.note), c.$_userName.html(a.userName)
|
||||
}
|
||||
$("#grid").clearGridData();
|
||||
var c = this,
|
||||
d = 8 - a.entries.length;
|
||||
if (d > 0) for (var e = 0; d > e; e++) a.entries.push({});
|
||||
"edit" === a.status ? ($("#grid").jqGrid("setGridParam", {
|
||||
data: a.entries,
|
||||
userData: {
|
||||
qty: a.totalQty,
|
||||
amount: a.totalAmount
|
||||
},
|
||||
cellEdit: !0,
|
||||
datatype: "clientSide"
|
||||
}).trigger("reloadGrid"), b(), this.editable || (this.customerCombo.enable(), this.$_date.removeAttr("disabled"), this.editable = !0)) : ($("#grid").jqGrid("setGridParam", {
|
||||
url: "",
|
||||
datatype: "json",
|
||||
cellEdit: !1
|
||||
}).trigger("reloadGrid"), b(), this.editable && (this.customerCombo.disable(), this.$_data.attr(disabled, "disabled"), this.editable = !1))
|
||||
},
|
||||
initCombo: function() {
|
||||
this.goodsCombo = Business.goodsCombo($(".goodsAuto"), {
|
||||
data: function() {
|
||||
if (defaultPage.SYSTEM.goodsInfo) {
|
||||
for (var a = [], b = 0; b < defaultPage.SYSTEM.goodsInfo.length; b++) {
|
||||
var c = defaultPage.SYSTEM.goodsInfo[b];
|
||||
c["delete"] || a.push(c)
|
||||
}
|
||||
return a
|
||||
}
|
||||
return "../basedata/inventory?action=list"
|
||||
}
|
||||
}), this.storageCombo = Business.billStorageCombo($(".storageAuto"))
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
this.$_date.bind("keydown", function(a) {
|
||||
13 === a.which && $("#grid").jqGrid("editCell", 1, 2, !0)
|
||||
}).bind("focus", function() {
|
||||
a.dateValue = $(this).val()
|
||||
}).bind("blur", function() {
|
||||
var b = /((^((1[8-9]\d{2})|([2-9]\d{3}))(-)(10|12|0?[13578])(-)(3[01]|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))(-)(11|0?[469])(-)(30|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))(-)(0?2)(-)(2[0-8]|1[0-9]|0?[1-9])$)|(^([2468][048]00)(-)(0?2)(-)(29)$)|(^([3579][26]00)(-)(0?2)(-)(29)$)|(^([1][89][0][48])(-)(0?2)(-)(29)$)|(^([2-9][0-9][0][48])(-)(0?2)(-)(29)$)|(^([1][89][2468][048])(-)(0?2)(-)(29)$)|(^([2-9][0-9][2468][048])(-)(0?2)(-)(29)$)|(^([1][89][13579][26])(-)(0?2)(-)(29)$)|(^([2-9][0-9][13579][26])(-)(0?2)(-)(29)$))/;
|
||||
b.test($(this).val()) || (parent.Public.tips({
|
||||
type: 2,
|
||||
content: "日期格式有误!如:2012-08-08。"
|
||||
}), $(this).val(a.dateValue))
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-triangle-1-s", function() {
|
||||
var b = $(this).siblings();
|
||||
setTimeout(function() {
|
||||
b.hasClass("unitAuto") ? b.trigger("click") : (a.storageCombo.active = !0, a.storageCombo.doQuery())
|
||||
}, 10)
|
||||
}), Business.billsEvent(a), $(".wrapper").on("click", "#save", function(b) {
|
||||
b.preventDefault();
|
||||
var c = THISPAGE.getPostData();
|
||||
c && ("edit" === originalData.stata && (c.id = originalData.id, c.stata = "edit"), Public.ajaxPost("../scm/invOi/addCADJ?action=addCADJ&type=cbtz", {
|
||||
postData: JSON.stringify(c)
|
||||
}, function(b) {
|
||||
200 === b.status ? (originalData.id = b.data.id, a.$_toolBottom.html('<a id="add" class="ui-btn ui-btn-sp mrb">新增</a><a id="edit" class="ui-btn mrb">保存</a><a href="../scm/invOi/toCBTZPdf?action=toCBTZPdf&id=' + originalData.id + '" target="_blank" id="print" class="ui-btn">打印</a>'), parent.Public.tips({
|
||||
content: "保存成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
}))
|
||||
}), $(".wrapper").on("click", "#edit", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("CADJ_UPDATE")) {
|
||||
var b = THISPAGE.getPostData();
|
||||
b && Public.ajaxPost("../scm/invOi/updateCADJ?action=updateCADJ&type=cbtz", {
|
||||
postData: JSON.stringify(b)
|
||||
}, function(a) {
|
||||
200 === a.status ? (originalData.id = a.data.id, parent.Public.tips({
|
||||
content: "修改成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
}), $(".wrapper").on("click", "#savaAndAdd", function(b) {
|
||||
b.preventDefault();
|
||||
var c = THISPAGE.getPostData();
|
||||
c && Public.ajaxPost("../scm/invOi/addNewCADJ?action=addNewCADJ&type=cbtz", {
|
||||
postData: JSON.stringify(c)
|
||||
}, function(b) {
|
||||
if (200 === b.status) {
|
||||
a.$_number.text(b.data.billNo), $("#grid").clearGridData(), $("#grid").clearGridData(!0);
|
||||
for (var c = 1; 8 >= c; c++) $("#grid").jqGrid("addRowData", c, {});
|
||||
a.newId = 9, a.$_note.val(""), parent.Public.tips({
|
||||
content: "保存成功!"
|
||||
})
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
})
|
||||
}), $(".wrapper").on("click", "#add", function(a) {
|
||||
a.preventDefault(), Business.verifyRight("CADJ_ADD") && parent.tab.overrideSelectedTabItem({
|
||||
tabid: "storage-adjustment",
|
||||
text: "成本调整单",
|
||||
url: "/scm/invOi.do?action=initOi&type=cbtz"
|
||||
})
|
||||
}), $(".wrapper").on("click", "#print", function(a) {
|
||||
return Business.verifyRight("CADJ_PRINT") ? void 0 : void a.preventDefault()
|
||||
}), $("#prev").click(function(b) {
|
||||
return b.preventDefault(), $(this).hasClass("ui-btn-prev-dis") ? (parent.Public.tips({
|
||||
type: 2,
|
||||
content: "已经没有上一张了!"
|
||||
}), !1) : (a.idPostion = a.idPostion - 1, 0 === a.idPostion && $(this).addClass("ui-btn-prev-dis"), loading = $.dialog.tips("数据加载中...", 1e3, "loading.gif", !0), Public.ajaxGet("../scm/invOi/updateCbtz?action=updateCbtz&type=cbtz", {
|
||||
id: a.salesListIds[a.idPostion]
|
||||
}, function(a) {
|
||||
THISPAGE.reloadData(a.data), $("#next").removeClass("ui-btn-next-dis"), loading && loading.close()
|
||||
}), void 0)
|
||||
}), $("#next").click(function(b) {
|
||||
return b.preventDefault(), $(this).hasClass("ui-btn-next-dis") ? (parent.Public.tips({
|
||||
type: 2,
|
||||
content: "已经没有下一张了!"
|
||||
}), !1) : (a.idPostion = a.idPostion + 1, a.idLength === a.idPostion + 1 && $(this).addClass("ui-btn-next-dis"), loading = $.dialog.tips("数据加载中...", 1e3, "loading.gif", !0), Public.ajaxGet("../scm/invOi/updateCbtz?action=updateCbtz&type=cbtz", {
|
||||
id: a.salesListIds[a.idPostion]
|
||||
}, function(a) {
|
||||
THISPAGE.reloadData(a.data), $("#prev").removeClass("ui-btn-prev-dis"), loading && loading.close()
|
||||
}), void 0)
|
||||
}), $("#config").click(function() {
|
||||
a.mod_PageConfig.config()
|
||||
}), $(window).resize(function() {
|
||||
Public.autoGrid($("#grid"))
|
||||
})
|
||||
},
|
||||
resetData: function() {
|
||||
var a = this;
|
||||
$("#grid").clearGridData();
|
||||
for (var b = 1; 8 >= b; b++) $("#grid").jqGrid("addRowData", b, {}), $("#grid").jqGrid("footerData", "set", {
|
||||
qty: 0,
|
||||
amount: 0
|
||||
});
|
||||
a.$_note.val(""), a.$_discountRate.val(originalData.disRate), a.$_deduction.val(originalData.disAmount), a.$_discount.val(originalData.amount), a.$_payment.val(originalData.rpAmount), a.$_arrears.val(originalData.arrears)
|
||||
},
|
||||
calTotal: function() {
|
||||
for (var a = $("#grid").jqGrid("getDataIDs"), b = 0, c = 0, d = 0, e = a.length; e > d; d++) {
|
||||
var f = a[d],
|
||||
g = $("#grid").jqGrid("getRowData", f);
|
||||
g.qty && (b += parseFloat(g.qty)), g.amount && (c += parseFloat(g.amount))
|
||||
}
|
||||
$("#grid").jqGrid("footerData", "set", {
|
||||
qty: b,
|
||||
amount: c
|
||||
})
|
||||
},
|
||||
_getEntriesData: function() {
|
||||
for (var a = [], b = $("#grid").jqGrid("getDataIDs"), c = 0, d = b.length; d > c; c++) {
|
||||
var e, f = b[c],
|
||||
g = $("#grid").jqGrid("getRowData", f);
|
||||
if ("" !== g.goods) {
|
||||
var h = $("#" + f).data("goodsInfo"),
|
||||
i = $("#" + f).data("storageInfo");
|
||||
e = {
|
||||
invId: h.id,
|
||||
invNumber: h.number,
|
||||
invName: h.name,
|
||||
invSpec: h.spec,
|
||||
unitId: h.unitId,
|
||||
mainUnit: h.unitName,
|
||||
skuId: h.skuId || -1,
|
||||
skuName: h.skuName || "",
|
||||
qty: g.qty,
|
||||
price: g.price,
|
||||
amount: g.amount,
|
||||
description: g.description,
|
||||
locationId: i.id,
|
||||
locationName: i.name
|
||||
}, a.push(e)
|
||||
}
|
||||
}
|
||||
return a
|
||||
},
|
||||
getPostData: function() {
|
||||
var a = this;
|
||||
null !== curRow && null !== curCol && ($("#grid").jqGrid("saveCell", curRow, curCol), curRow = null, curCol = null);
|
||||
var b = this._getEntriesData();
|
||||
if (b.length > 0) {
|
||||
var c = $.trim(a.$_note.val());
|
||||
a.calTotal();
|
||||
var d = {
|
||||
id: originalData.id,
|
||||
date: $.trim(a.$_date.val()),
|
||||
billNo: $.trim(a.$_number.text()),
|
||||
entries: b,
|
||||
totalAmount: $("#grid").jqGrid("footerData", "get").amount.replace(/,/g, ""),
|
||||
description: c === a.$_note[0].defaultValue ? "" : c
|
||||
};
|
||||
return d
|
||||
}
|
||||
return parent.Public.tips({
|
||||
type: 2,
|
||||
content: "商品信息不能为空!"
|
||||
}), $("#grid").jqGrid("editCell", 1, 2, !0), !1
|
||||
}
|
||||
},
|
||||
hasLoaded = !1,
|
||||
originalData;
|
||||
$(function() {
|
||||
urlParam.id ? hasLoaded || Public.ajaxGet("../scm/invOi/updateCbtz?action=updateCbtz&type=cbtz", {
|
||||
id: urlParam.id
|
||||
}, function(a) {
|
||||
200 === a.status ? (originalData = a.data, THISPAGE.init(a.data), hasLoaded = !0) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: msg
|
||||
})
|
||||
}) : (originalData = {
|
||||
id: -1,
|
||||
status: "add",
|
||||
customer: 0,
|
||||
transType: "150601",
|
||||
entries: [{
|
||||
id: "1"
|
||||
}, {
|
||||
id: "2"
|
||||
}, {
|
||||
id: "3"
|
||||
}, {
|
||||
id: "4"
|
||||
}, {
|
||||
id: "5"
|
||||
}, {
|
||||
id: "6"
|
||||
}, {
|
||||
id: "7"
|
||||
}, {
|
||||
id: "8"
|
||||
}],
|
||||
totalQty: 0,
|
||||
totalAmount: 0,
|
||||
disRate: 0,
|
||||
disAmount: 0,
|
||||
amount: "0.00",
|
||||
rpAmount: "0.00",
|
||||
arrears: "0.00"
|
||||
}, THISPAGE.init(originalData))
|
||||
});
|
||||
188
statics/js/dist/adjustmentList.js
vendored
Executable file
188
statics/js/dist/adjustmentList.js
vendored
Executable file
@@ -0,0 +1,188 @@
|
||||
var queryConditions = {
|
||||
matchCon: ""
|
||||
},
|
||||
hiddenAmount = !1,
|
||||
SYSTEM = system = parent.SYSTEM,
|
||||
THISPAGE = {
|
||||
init: function() {
|
||||
SYSTEM.isAdmin !== !1 || SYSTEM.rights.AMOUNT_COSTAMOUNT || (hiddenAmount = !0), this.initDom(), this.loadGrid(), this.addEvent()
|
||||
},
|
||||
initDom: function() {
|
||||
this.$_matchCon = $("#matchCon"), this.$_beginDate = $("#beginDate").val(system.beginDate), this.$_endDate = $("#endDate").val(system.endDate), this.$_matchCon.placeholder(), this.$_beginDate.datepicker(), this.$_endDate.datepicker(), this.storageCombo = $("#storageA").combo({
|
||||
data: function() {
|
||||
return parent.parent.SYSTEM.storageInfo
|
||||
},
|
||||
text: "name",
|
||||
value: "id",
|
||||
width: 112,
|
||||
defaultSelected: 0,
|
||||
addOptions: {
|
||||
text: "(所有)",
|
||||
value: -1
|
||||
},
|
||||
cache: !1
|
||||
}).getCombo()
|
||||
},
|
||||
loadGrid: function() {
|
||||
function a(a, b, c) {
|
||||
var d = '<div class="operating" data-id="' + c.id + '"><span class="ui-icon ui-icon-pencil" title="修改"></span><span class="ui-icon ui-icon-trash" title="删除"></span></div>';
|
||||
return d
|
||||
}
|
||||
var b = Public.setGrid();
|
||||
queryConditions.beginDate = this.$_beginDate.val(), queryConditions.endDate = this.$_endDate.val(), $("#grid").jqGrid({
|
||||
url: "../scm/invOi/listCbtz?action=listCbtz&type=cbtz",
|
||||
postData: queryConditions,
|
||||
datatype: "json",
|
||||
autowidth: !0,
|
||||
height: b.h,
|
||||
altRows: !0,
|
||||
gridview: !0,
|
||||
multiselect: !0,
|
||||
multiboxonly: !0,
|
||||
colModel: [{
|
||||
name: "operating",
|
||||
label: "操作",
|
||||
width: 60,
|
||||
fixed: !0,
|
||||
formatter: a,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billDate",
|
||||
label: "单据日期",
|
||||
width: 100,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billNo",
|
||||
label: "单据编号",
|
||||
width: 120,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "transTypeName",
|
||||
label: "业务类别",
|
||||
width: 150,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "amount",
|
||||
label: "金额",
|
||||
hidden: hiddenAmount,
|
||||
width: 100,
|
||||
align: "right",
|
||||
formatter: "currency"
|
||||
}, {
|
||||
name: "userName",
|
||||
label: "制单人",
|
||||
index: "userName",
|
||||
width: 80,
|
||||
fixed: !0,
|
||||
align: "center",
|
||||
title: !1
|
||||
}, {
|
||||
name: "description",
|
||||
label: "备注",
|
||||
width: 200,
|
||||
classes: "ui-ellipsis"
|
||||
}],
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "number",
|
||||
sortorder: "desc",
|
||||
pager: "#page",
|
||||
rowNum: 100,
|
||||
rowList: [100, 200, 500],
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
forceFit: !1,
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
records: "data.records",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
loadError: function() {},
|
||||
ondblClickRow: function(a) {
|
||||
$("#" + a).find(".ui-icon-pencil").trigger("click")
|
||||
}
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
$("#grid").jqGrid("setGridParam", {
|
||||
url: "../scm/invOi/listCbtz?action=listCbtz&type=cbtz",
|
||||
datatype: "json",
|
||||
postData: a
|
||||
}).trigger("reloadGrid")
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
$(".grid-wrap").on("click", ".ui-icon-pencil", function(a) {
|
||||
a.preventDefault();
|
||||
var b = $(this).parent().data("id");
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-adjustment",
|
||||
text: "成本调整单",
|
||||
url: "../scm/invOi?action=editOi&type=cbtz&id=" + b
|
||||
});
|
||||
$("#grid").jqGrid("getDataIDs");
|
||||
parent.salesListIds = $("#grid").jqGrid("getDataIDs")
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-trash", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("CADJ_DELETE")) {
|
||||
var b = $(this).parent().data("id");
|
||||
$.dialog.confirm("您确定要删除该成本调整记录吗?", function() {
|
||||
Public.ajaxGet("../scm/invOi/deleteCbtz?action=deleteCbtz", {
|
||||
id: b
|
||||
}, function(a) {
|
||||
200 === a.status ? ($("#grid").jqGrid("delRowData", b), parent.Public.tips({
|
||||
content: "删除成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}), $("#search").click(function() {
|
||||
queryConditions.matchCon = "请输入单据号或客户名或备注" === a.$_matchCon.val() ? "" : a.$_matchCon.val(), queryConditions.beginDate = a.$_beginDate.val(), queryConditions.endDate = a.$_endDate.val(), queryConditions.locationId = a.storageCombo.getValue(), THISPAGE.reloadData(queryConditions)
|
||||
}), $("#moreCon").click(function() {
|
||||
queryConditions.matchCon = a.$_matchCon.val(), queryConditions.beginDate = a.$_beginDate.val(), queryConditions.endDate = a.$_endDate.val(), $.dialog({
|
||||
id: "moreCon",
|
||||
width: 480,
|
||||
height: 300,
|
||||
min: !1,
|
||||
max: !1,
|
||||
title: "高级搜索",
|
||||
button: [{
|
||||
name: "确定",
|
||||
focus: !0,
|
||||
callback: function() {
|
||||
var b = this.content.handle(queryConditions);
|
||||
THISPAGE.reloadData(b), "" !== b.matchCon && a.$_matchCon.val(b.matchCon), a.$_beginDate.val(b.beginDate), a.$_endDate.val(b.endDate)
|
||||
}
|
||||
}, {
|
||||
name: "取消"
|
||||
}],
|
||||
resize: !1,
|
||||
content: "url:../storage/other_search?type=other",
|
||||
data: queryConditions
|
||||
})
|
||||
}), $("#add").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("CADJ_ADD") && parent.tab.addTabItem({
|
||||
tabid: "storage-adjustment",
|
||||
text: "成本调整单",
|
||||
url: "../scm/invOi?action=initOi&type=cbtz"
|
||||
})
|
||||
}), $(window).resize(function() {
|
||||
Public.resizeGrid()
|
||||
}), $(".wrapper").on("click", "#export", function(a) {
|
||||
if (!Business.verifyRight("CADJ_EXPORT")) return void a.preventDefault();
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow"),
|
||||
c = b.join(),
|
||||
d = c ? "&id=" + c : "";
|
||||
for (var e in queryConditions) queryConditions[e] && (d += "&" + e + "=" + queryConditions[e]);
|
||||
var f = "../scm/invOi/exportInvCadj?action=exportInvCadj" + d;
|
||||
$(this).attr("href", f)
|
||||
})
|
||||
}
|
||||
};
|
||||
THISPAGE.init();
|
||||
112
statics/js/dist/advSearch.js
vendored
Executable file
112
statics/js/dist/advSearch.js
vendored
Executable file
@@ -0,0 +1,112 @@
|
||||
var queryConditions = {
|
||||
matchCon: ""
|
||||
},
|
||||
api = frameElement.api,
|
||||
handle, urlParam = Public.urlParam(),
|
||||
THISPAGE = {
|
||||
init: function() {
|
||||
this.initDom(), this.addEvent()
|
||||
},
|
||||
initDom: function() {
|
||||
var a = api.data;
|
||||
switch (this.$_matchCon = $("#matchCon"), this.$_beginDate = $("#beginDate").val(a.beginDate), this.$_endDate = $("#endDate").val(a.endDate), this.$_hxState = $("#hxState"), a.matchCon && "请输入单据号或客户名或序列号或备注" != a.matchCon ? (this.$_matchCon.removeClass("ui-input-ph"), this.$_matchCon.val(a.matchCon)) : (this.$_matchCon.addClass("ui-input-ph"), this.$_matchCon.placeholder()), this.$_beginDate.datepicker(), this.$_endDate.datepicker(), urlParam.type) {
|
||||
case "sales":
|
||||
this.salesCombo = Business.salesCombo($("#sales"), {
|
||||
defaultSelected: 0,
|
||||
extraListHtml: ""
|
||||
}), this.hxStateCombo = this.$_hxState.combo({
|
||||
data: function() {
|
||||
return [{
|
||||
name: "未收款",
|
||||
id: 1
|
||||
}, {
|
||||
name: "部分收款",
|
||||
id: 2
|
||||
}, {
|
||||
name: "全部收款",
|
||||
id: 3
|
||||
}]
|
||||
},
|
||||
width: 120,
|
||||
height: 300,
|
||||
text: "name",
|
||||
value: "id",
|
||||
defaultSelected: 0,
|
||||
cache: !1,
|
||||
emptyOptions: !0
|
||||
}).getCombo();
|
||||
break;
|
||||
case "transfers":
|
||||
this.outStorageCombo = $("#storageA").combo({
|
||||
data: function() {
|
||||
return parent.parent.SYSTEM.storageInfo
|
||||
},
|
||||
text: "name",
|
||||
value: "id",
|
||||
width: 112,
|
||||
defaultSelected: 0,
|
||||
emptyOptions: !0,
|
||||
cache: !1
|
||||
}).getCombo(), -1 !== a.outLocationId && this.outStorageCombo.selectByValue(a.outLocationId), this.inStorageCombo = $("#storageB").combo({
|
||||
data: function() {
|
||||
return parent.parent.SYSTEM.storageInfo
|
||||
},
|
||||
text: "name",
|
||||
value: "id",
|
||||
width: 112,
|
||||
defaultSelected: 0,
|
||||
emptyOptions: !0,
|
||||
cache: !1
|
||||
}).getCombo(), -1 !== a.inLocationId && this.inStorageCombo.selectByValue(a.inLocationId);
|
||||
break;
|
||||
case "other":
|
||||
if (this.storageCombo = $("#storageA").combo({
|
||||
data: function() {
|
||||
return parent.parent.SYSTEM.storageInfo
|
||||
},
|
||||
text: "name",
|
||||
value: "id",
|
||||
width: 112,
|
||||
defaultSelected: 0,
|
||||
addOptions: {
|
||||
text: "(所有)",
|
||||
value: -1
|
||||
},
|
||||
cache: !1
|
||||
}).getCombo(), -1 !== a.locationId && this.storageCombo.selectByValue(a.locationId), "outbound" === urlParam.diff) var b = "../scm/invOi/queryTransType?action=queryTransType&type=out";
|
||||
else var b = "../scm/invOi/queryTransType?action=queryTransType&type=in";
|
||||
this.transTypeCombo = $("#transType").combo({
|
||||
data: b,
|
||||
ajaxOptions: {
|
||||
formatData: function(a) {
|
||||
return a.data.items
|
||||
}
|
||||
},
|
||||
text: "name",
|
||||
value: "id",
|
||||
width: 112,
|
||||
defaultSelected: 0,
|
||||
addOptions: {
|
||||
text: "(所有)",
|
||||
value: -1
|
||||
},
|
||||
cache: !1
|
||||
}).getCombo(), -1 !== a.transTypeId && this.transTypeCombo.selectByValue(a.transTypeId)
|
||||
}
|
||||
},
|
||||
addEvent: function() {},
|
||||
handle: function(a) {
|
||||
switch (a = a || {}, a.matchCon = "请输入单据号或客户名或序列号或备注" === THISPAGE.$_matchCon.val() ? "" : THISPAGE.$_matchCon.val(), a.beginDate = THISPAGE.$_beginDate.val(), a.endDate = THISPAGE.$_endDate.val(), THISPAGE.hxStateCombo && (a.hxState = THISPAGE.hxStateCombo.getValue() ? THISPAGE.hxStateCombo.getValue() - 1 : ""), urlParam.type) {
|
||||
case "sales":
|
||||
a.salesId = THISPAGE.salesCombo.getValue();
|
||||
break;
|
||||
case "transfers":
|
||||
a.outLocationId = THISPAGE.outStorageCombo.getValue(), a.inLocationId = THISPAGE.inStorageCombo.getValue();
|
||||
break;
|
||||
case "other":
|
||||
a.locationId = THISPAGE.storageCombo.getValue(), a.transTypeId = THISPAGE.transTypeCombo.getValue()
|
||||
}
|
||||
return a
|
||||
}
|
||||
};
|
||||
THISPAGE.init(), handle = THISPAGE.handle;
|
||||
1552
statics/js/dist/assemble.js
vendored
Executable file
1552
statics/js/dist/assemble.js
vendored
Executable file
File diff suppressed because it is too large
Load Diff
270
statics/js/dist/assembleList.js
vendored
Executable file
270
statics/js/dist/assembleList.js
vendored
Executable file
@@ -0,0 +1,270 @@
|
||||
var queryConditions = {
|
||||
matchCon: ""
|
||||
},
|
||||
system = parent.SYSTEM,
|
||||
qtyPlaces = Number(parent.SYSTEM.qtyPlaces),
|
||||
pricePlaces = Number(parent.SYSTEM.pricePlaces),
|
||||
amountPlaces = Number(parent.SYSTEM.amountPlaces),
|
||||
hiddenAmount = !1;
|
||||
system.isAdmin !== !1 || system.rights.AMOUNT_COSTAMOUNT || (hiddenAmount = !0);
|
||||
var THISPAGE = {
|
||||
init: function(a) {
|
||||
this.mod_PageConfig = Public.mod_PageConfig.init("assembleList"), this.initDom(), this.loadGrid(), this.addEvent()
|
||||
},
|
||||
initDom: function() {
|
||||
this.$_matchCon = $("#matchCon"), this.$_beginDate = $("#beginDate").val(system.beginDate), this.$_endDate = $("#endDate").val(system.endDate), this.$_matchCon.placeholder(), this.$_beginDate.datepicker(), this.$_endDate.datepicker()
|
||||
},
|
||||
loadGrid: function() {
|
||||
function a(a, b, c) {
|
||||
var d = '<div class="operating" data-id="' + c.id + '"><span class="ui-icon ui-icon-pencil" title="修改"></span><span class="ui-icon ui-icon-trash" title="删除"></span></div>';
|
||||
return d
|
||||
}
|
||||
function b(a, b, c) {
|
||||
var d;
|
||||
if (d = "unitCosts" === b.colModel.name && a ? $.map(a, function(a) {
|
||||
return Number(a).toFixed(pricePlaces)
|
||||
}) : "costs" === b.colModel.name && a ? $.map(a, function(a) {
|
||||
return Number(a).toFixed(amountPlaces)
|
||||
}) : a) var e = d.join('<p class="line" />');
|
||||
return e || " "
|
||||
}
|
||||
var c = Public.setGrid();
|
||||
queryConditions.beginDate = this.$_beginDate.val(), queryConditions.endDate = this.$_endDate.val();
|
||||
var d = [{
|
||||
name: "operating",
|
||||
label: "操作",
|
||||
width: 60,
|
||||
fixed: !0,
|
||||
formatter: a,
|
||||
align: "center",
|
||||
title: !1
|
||||
}, {
|
||||
name: "billDate",
|
||||
label: "单据日期",
|
||||
width: 80,
|
||||
align: "center",
|
||||
title: !1
|
||||
}, {
|
||||
name: "billNo",
|
||||
label: "单据编号",
|
||||
width: 120,
|
||||
align: "center",
|
||||
title: !1
|
||||
}, {
|
||||
name: "good",
|
||||
label: "组合件",
|
||||
width: 200,
|
||||
title: !0,
|
||||
classes: "ui-ellipsis"
|
||||
}, {
|
||||
name: "qty",
|
||||
label: "组合件数量",
|
||||
width: 80,
|
||||
title: !1
|
||||
}, {
|
||||
name: "mainUnit",
|
||||
label: "单位",
|
||||
width: 35,
|
||||
title: !1,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "unitCost",
|
||||
label: "组合件单位成本",
|
||||
width: 100,
|
||||
title: !1,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
showZero: !0,
|
||||
decimalPlaces: pricePlaces
|
||||
},
|
||||
hidden: hiddenAmount
|
||||
}, {
|
||||
name: "cost",
|
||||
label: "组合件成本",
|
||||
width: 80,
|
||||
title: !1,
|
||||
align: "right",
|
||||
hidden: hiddenAmount
|
||||
}, {
|
||||
name: "goods",
|
||||
label: "子件",
|
||||
index: "userName",
|
||||
formatter: b,
|
||||
classes: "ui-ellipsis",
|
||||
width: 200,
|
||||
fixed: !0,
|
||||
title: !0
|
||||
}, {
|
||||
name: "qtys",
|
||||
label: "子件数量",
|
||||
width: 80,
|
||||
formatter: b,
|
||||
classes: "ui-ellipsis"
|
||||
}, {
|
||||
name: "mainUnits",
|
||||
label: "单位",
|
||||
width: 35,
|
||||
formatter: b,
|
||||
classes: "ui-ellipsis",
|
||||
align: "center"
|
||||
}, {
|
||||
name: "unitCosts",
|
||||
label: "子件单位成本",
|
||||
width: 100,
|
||||
formatter: b,
|
||||
classes: "ui-ellipsis",
|
||||
align: "right",
|
||||
hidden: hiddenAmount
|
||||
}, {
|
||||
name: "costs",
|
||||
label: "子件成本",
|
||||
width: 80,
|
||||
formatter: b,
|
||||
classes: "ui-ellipsis",
|
||||
align: "right",
|
||||
hidden: hiddenAmount
|
||||
}, {
|
||||
name: "description",
|
||||
label: "备注",
|
||||
width: 200
|
||||
}];
|
||||
this.mod_PageConfig.gridReg("grid", d), d = this.mod_PageConfig.conf.grids.grid.colModel, $("#grid").jqGrid({
|
||||
url: "../scm/invOi/listZz?action=listZz&type=zz",
|
||||
postData: queryConditions,
|
||||
datatype: "json",
|
||||
autowidth: !0,
|
||||
height: c.h,
|
||||
altRows: !0,
|
||||
gridview: !0,
|
||||
multiselect: !0,
|
||||
colModel: d,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "number",
|
||||
sortorder: "desc",
|
||||
pager: "#page",
|
||||
rowNum: 100,
|
||||
rowList: [100, 200, 500],
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
forceFit: !0,
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
records: "data.records",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
loadError: function(a, b, c) {},
|
||||
ondblClickRow: function(a, b, c, d) {
|
||||
$("#" + a).find(".ui-icon-pencil").trigger("click")
|
||||
},
|
||||
resizeStop: function(a, b) {
|
||||
THISPAGE.mod_PageConfig.setGridWidthByIndex(a, b, "grid")
|
||||
}
|
||||
}).navGrid("#page", {
|
||||
edit: !1,
|
||||
add: !1,
|
||||
del: !1,
|
||||
search: !1,
|
||||
refresh: !1
|
||||
}).navButtonAdd("#page", {
|
||||
caption: "",
|
||||
buttonicon: "ui-icon-config",
|
||||
onClickButton: function() {
|
||||
THISPAGE.mod_PageConfig.config()
|
||||
},
|
||||
position: "last"
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
$("#grid").jqGrid("setGridParam", {
|
||||
url: "../scm/invOi/listZz?action=listZz&type=zz",
|
||||
datatype: "json",
|
||||
postData: a
|
||||
}).trigger("reloadGrid")
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
$(".grid-wrap").on("click", ".ui-icon-pencil", function(a) {
|
||||
a.preventDefault();
|
||||
var b = $(this).parent().data("id");
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-assemble",
|
||||
text: "组装单",
|
||||
url: "/storage/assemble.jsp?id=" + b
|
||||
});
|
||||
$("#grid").jqGrid("getDataIDs");
|
||||
parent.salesListIds = $("#grid").jqGrid("getDataIDs")
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-trash", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("ZZD_DELETE")) {
|
||||
var b = $(this).parent().data("id");
|
||||
$.dialog.confirm("您确定要删除该组装记录吗?", function() {
|
||||
Public.ajaxGet("../scm/invOi/deleteZz?action=deleteZz", {
|
||||
id: b
|
||||
}, function(a) {
|
||||
200 === a.status ? ($("#grid").jqGrid("delRowData", b), parent.Public.tips({
|
||||
content: "删除成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}), $("#search").click(function() {
|
||||
queryConditions.matchCon = "请输入单据号或备注" === a.$_matchCon.val() ? "" : a.$_matchCon.val(), queryConditions.beginDate = a.$_beginDate.val(), queryConditions.endDate = a.$_endDate.val(), THISPAGE.reloadData(queryConditions)
|
||||
}), $(".wrapper").on("click", "#print", function(a) {
|
||||
a.preventDefault(), Business.verifyRight("ZZD_PRINT") && Public.print({
|
||||
title: "组装单列表",
|
||||
$grid: $("#grid"),
|
||||
pdf: "../scm/invOi/toZzdPdf?action=toZzdPdf",
|
||||
billType: 10419,
|
||||
filterConditions: queryConditions
|
||||
})
|
||||
}), $("#moreCon").click(function() {
|
||||
queryConditions.matchCon = a.$_matchCon.val(), queryConditions.beginDate = a.$_beginDate.val(), queryConditions.endDate = a.$_endDate.val(), $.dialog({
|
||||
id: "moreCon",
|
||||
width: 480,
|
||||
height: 330,
|
||||
min: !1,
|
||||
max: !1,
|
||||
title: "高级搜索",
|
||||
button: [{
|
||||
name: "确定",
|
||||
focus: !0,
|
||||
callback: function() {
|
||||
queryConditions = this.content.handle(queryConditions), THISPAGE.reloadData(queryConditions), "" !== queryConditions.matchCon ? a.$_matchCon.val(queryConditions.matchCon) : a.$_matchCon.val("请输入单据号或备注"), a.$_beginDate.val(queryConditions.beginDate), a.$_endDate.val(queryConditions.endDate)
|
||||
}
|
||||
}, {
|
||||
name: "取消"
|
||||
}],
|
||||
resize: !1,
|
||||
content: "url:/storage/assemble-search.jsp?type=transfers",
|
||||
data: queryConditions
|
||||
})
|
||||
}), $("#add").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("ZZD_ADD") && parent.tab.addTabItem({
|
||||
tabid: "storage-assemble",
|
||||
text: "组装单",
|
||||
url: "../scm/invOi.do?action=initOi&type=zz"
|
||||
})
|
||||
}), $(window).resize(function() {
|
||||
Public.resizeGrid()
|
||||
}), $(".wrapper").on("click", "#export", function(a) {
|
||||
if (!Business.verifyRight("ZZD_EXPORT")) return void a.preventDefault();
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow"),
|
||||
c = b.join(),
|
||||
d = c ? "&id=" + c : "";
|
||||
for (var e in queryConditions) queryConditions[e] && (d += "&" + e + "=" + queryConditions[e]);
|
||||
var f = "../scm/invOi/exportInvZzd?action=exportInvZzd" + d;
|
||||
$(this).attr("href", f)
|
||||
})
|
||||
}
|
||||
};
|
||||
$(function() {
|
||||
THISPAGE.init()
|
||||
});
|
||||
158
statics/js/dist/assistingProp.js
vendored
Executable file
158
statics/js/dist/assistingProp.js
vendored
Executable file
@@ -0,0 +1,158 @@
|
||||
!
|
||||
function(a) {
|
||||
function b() {
|
||||
a("#assisting-list").on("mouseover", ">li", function() {
|
||||
a(this).addClass("on").siblings().removeClass("on")
|
||||
}).on("mouseleave", ">li", function() {
|
||||
a(this).removeClass("on")
|
||||
}), a("#assisting-list").on("click", ".btn-edit", function(b) {
|
||||
if (b.preventDefault(), Business.verifyRight("FZSX_UPDATE")) {
|
||||
var d = a(this).parents("#assisting-list li").find(".item"),
|
||||
e = {
|
||||
id: d.data("id"),
|
||||
name: d.text()
|
||||
};
|
||||
c("edit", e)
|
||||
}
|
||||
}), a("#assisting-list").on("click", ".btn-del", function(b) {
|
||||
if (b.preventDefault(), Business.verifyRight("FZSX_DELETE")) {
|
||||
var c = a(this).parents("#assisting-list li").find(".item").data("id");
|
||||
a.dialog.confirm("删除后不可恢复!您确定要删除该辅助属性吗?", function() {
|
||||
e(c)
|
||||
})
|
||||
}
|
||||
}), a("#btn-add,#add-custom-assisting .item").on("click", function(a) {
|
||||
a.preventDefault(), Business.verifyRight("FZSX_ADD") && c("add")
|
||||
}), a("#assisting-list").on("click", ".item", function(b) {
|
||||
if (b.preventDefault(), "add-custom-assisting" != a(this).parent().attr("id")) {
|
||||
var c = a(this).text(),
|
||||
d = a(this).data("id");
|
||||
parent.tab.addTabItem({
|
||||
text: c + "分类",
|
||||
url: "settings/prop_list?typeNumber=" + d + "&name=" + encodeURIComponent(c) + "&rd=" + (new Date).getTime(),
|
||||
tabid: "setting-propList"
|
||||
}), window.setTimeout(function() {
|
||||
a("#assisting-list > li").removeClass("on")
|
||||
}, 100)
|
||||
}
|
||||
})
|
||||
}
|
||||
function c(b, c) {
|
||||
var e = "add" == b ? "新增分类" : "编辑分类",
|
||||
f = "add" == b ? ["保存", "关闭"] : ["确定", "取消"],
|
||||
g = c ? c.id : void 0,
|
||||
i = "edit" == b ? c.name : "",
|
||||
j = ['<div class="manage-wrap assisting-manage" id="manage-wrap">', '<form action="#" id="manage-form">', '<ul class="mod-form-rows">', '<li class="row-item">', '<div class="label-wrap fl">', '<label for="assistingName">名称:</label>', "</div>", '<div class="ctn-wrap fl">', '<input type="text" id="assistingName" name="assistingName" class="ui-input" value="' + i + '" />', "</div>", "</li>", "</ul>", "</form>", "<div>"].join("");
|
||||
h = a.dialog({
|
||||
title: e,
|
||||
width: 320,
|
||||
height: 100,
|
||||
data: c,
|
||||
content: j,
|
||||
min: !1,
|
||||
max: !1,
|
||||
lock: !0,
|
||||
ok: function() {
|
||||
return d(b, g), !1
|
||||
},
|
||||
cancel: !0,
|
||||
okVal: f[0],
|
||||
cancelVal: f[1]
|
||||
}), a("#assistingName").focus(), a("#manage-form").on("submit", function(a) {
|
||||
a.preventDefault()
|
||||
}), Public.bindEnterSkip(a("#manage-wrap"), d, b, g), a("#manage-form").validate({
|
||||
rules: {
|
||||
assistingName: {
|
||||
required: !0
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
assistingName: {
|
||||
required: "名称不能为空!"
|
||||
}
|
||||
},
|
||||
errorClass: "valid-error"
|
||||
})
|
||||
}
|
||||
function d(b, c) {
|
||||
if (!a("#manage-form").validate().form()) return void a("#manage-form").find("input.valid-error").eq(0).focus();
|
||||
var d = a.trim(a("#assistingName").val()),
|
||||
e = {
|
||||
id: c,
|
||||
name: d
|
||||
};
|
||||
a.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: e,
|
||||
url: "../basedata/assistType/" + ("add" == b ? "add" : "update"),
|
||||
success: function(d) {
|
||||
if (200 == d.status) if (a("#manage-form").validate().resetForm(), parent.Public.tips({
|
||||
content: "保存成功!"
|
||||
}), "edit" === b) {
|
||||
a("li a[data-id=" + c + "]").val(d.data.id).find("strong").text(d.data.name), h.close();
|
||||
for (var e = 0, f = parent.SYSTEM.assistPropTypeInfo.length; f > e; e++) {
|
||||
var i = parent.SYSTEM.assistPropTypeInfo[e];
|
||||
i.id === c && (parent.SYSTEM.assistPropTypeInfo[e] = d.data)
|
||||
}
|
||||
} else {
|
||||
var j = [];
|
||||
j.push(d.data), g(j), a("#assistingName").val("").focus(), parent.SYSTEM.assistPropTypeInfo.push(d.data)
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: "保存失败!" + d.msg
|
||||
})
|
||||
},
|
||||
error: function() {
|
||||
parent.Public.tips({
|
||||
type: 1,
|
||||
content: "系统繁忙,请重试!"
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
function e(b) {
|
||||
a.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: "../basedata/assistType/delete?action=delete&id=" + b,
|
||||
success: function(c) {
|
||||
if (200 == c.status) {
|
||||
a("li a[data-id=" + b + "]").parent().remove(), parent.Public.tips({
|
||||
content: "删除成功!"
|
||||
});
|
||||
for (var d = 0, e = parent.SYSTEM.assistPropTypeInfo.length; e > d; d++) {
|
||||
var f = parent.SYSTEM.assistPropTypeInfo[d];
|
||||
f.id === b && (parent.SYSTEM.assistPropTypeInfo.splice(d, 1), e--, d--)
|
||||
}
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: "删除失败!" + c.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
function f() {
|
||||
a.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: "../basedata/assistType?action=list",
|
||||
success: function(a) {
|
||||
200 == a.status ? (a = a.data.items, g(a)) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: "获取自定义辅助属性失败!请刷新页面重试。",
|
||||
autoClose: !1
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
function g(b) {
|
||||
for (var c = '<li class="custom"><a href="#" data-id="#{id}" class="item"><i></i><strong>#{name}</strong></a><span class="operation"><a href="#" class="btn-edit ui-icon-edit" title="编辑">编辑</a><a href="#" class="btn-del ui-icon-del" title="删除">删除</a></span></li>', d = [], e = 0, f = b.length; f > e; e++) {
|
||||
var g = b[e];
|
||||
d.push(c.replace(/\#{id}/g, g.id).replace(/\#{name}/g, g.name))
|
||||
}
|
||||
a("#add-custom-assisting").before(d.join(""))
|
||||
}
|
||||
var h;
|
||||
f(), b()
|
||||
}(jQuery);
|
||||
177
statics/js/dist/assistingPropBatch.js
vendored
Executable file
177
statics/js/dist/assistingPropBatch.js
vendored
Executable file
@@ -0,0 +1,177 @@
|
||||
function callback() {
|
||||
var a, b;
|
||||
if (isSingle) a = $("#grid").jqGrid("getRowData", $("#grid").jqGrid("getGridParam", "selrow")), b = [a];
|
||||
else {
|
||||
rowDatas = $("#grid").jqGrid("getRowData"), b = [];
|
||||
for (var c = 0, d = rowDatas.length; d > c; c++) {
|
||||
var e = rowDatas[c];
|
||||
e.qty && b.push(e)
|
||||
}
|
||||
}
|
||||
"function" == typeof THISPAGE.data.callback && b.length && THISPAGE.data.callback(b, api)
|
||||
}
|
||||
var curRow, curCol, api = frameElement.api,
|
||||
queryConditions = {
|
||||
skey: "",
|
||||
skuClassId: api.data.skuClassId
|
||||
},
|
||||
defaultPage = Public.getDefaultPage(),
|
||||
SYSTEM = defaultPage.SYSTEM,
|
||||
data = api.data,
|
||||
isSingle = data ? data.isSingle : 0,
|
||||
qtyPlaces = Number(SYSTEM.qtyPlaces),
|
||||
pricePlaces = Number(SYSTEM.pricePlaces),
|
||||
amountPlaces = Number(SYSTEM.amountPlaces),
|
||||
THISPAGE = {
|
||||
init: function() {
|
||||
this.data = api.data, this.initDom(), this.loadGrid(), this.addEvent(), this.initButton()
|
||||
},
|
||||
initButton: function() {
|
||||
var a = ["确定", "取消"];
|
||||
api.button({
|
||||
id: "confirm",
|
||||
name: a[0],
|
||||
focus: !0,
|
||||
callback: function() {
|
||||
return null != curRow && null != curCol && ($("#grid").jqGrid("saveCell", curRow, curCol), curRow = null, curCol = null), callback(), !1
|
||||
}
|
||||
}, {
|
||||
id: "cancel",
|
||||
name: a[1]
|
||||
})
|
||||
},
|
||||
initDom: function() {
|
||||
this.$_matchCon = $("#matchCon"), this.$_matchCon.placeholder()
|
||||
},
|
||||
loadGrid: function() {
|
||||
{
|
||||
var a = "../basedata/assistSku?action=list";
|
||||
$(window).height() - $(".grid-wrap").offset().top - 84
|
||||
}
|
||||
$("#grid").jqGrid({
|
||||
url: a,
|
||||
postData: queryConditions,
|
||||
datatype: "json",
|
||||
width: 424,
|
||||
height: 254,
|
||||
altRows: !0,
|
||||
colModel: [{
|
||||
name: "operate",
|
||||
label: "操作",
|
||||
width: 30,
|
||||
fixed: !0,
|
||||
formatter: function(a, b, c) {
|
||||
var d = '<div class="operating" data-id="' + c.id + '"><span class="ui-icon ui-icon-trash" title="删除"></span></div>';
|
||||
return d
|
||||
}
|
||||
}, {
|
||||
name: "skuName",
|
||||
width: isSingle ? 320 : 260,
|
||||
label: "规格名称"
|
||||
}, {
|
||||
name: "skuId",
|
||||
label: "skuId",
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "qty",
|
||||
label: "数量",
|
||||
width: 60,
|
||||
editable: !0,
|
||||
align: "right",
|
||||
formatter: "number",
|
||||
formatoptions: {
|
||||
decimalPlaces: qtyPlaces
|
||||
},
|
||||
hidden: isSingle
|
||||
}],
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
pager: "#page",
|
||||
rowNum: 2e3,
|
||||
rowList: [300, 500, 1e3],
|
||||
scroll: 1,
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
forceFit: !1,
|
||||
cellEdit: !0,
|
||||
rownumbers: !0,
|
||||
triggerAdd: !1,
|
||||
cellsubmit: "clientArray",
|
||||
jsonReader: {
|
||||
root: "data.items",
|
||||
records: "data.records",
|
||||
total: "data.total",
|
||||
repeatitems: !1,
|
||||
id: "skuId"
|
||||
},
|
||||
loadError: function() {},
|
||||
afterSaveCell: function() {},
|
||||
ondblClickRow: function() {
|
||||
isSingle && (callback(), frameElement.api.close())
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
var b = a.data.items;
|
||||
b.length && $("#grid").jqGrid("nextCell", 0, 4)
|
||||
}
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
var b = this.data.url;
|
||||
$("#grid").jqGrid("setGridParam", {
|
||||
url: b,
|
||||
datatype: "json",
|
||||
postData: a
|
||||
}).trigger("reloadGrid")
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
$("#search").click(function() {
|
||||
var b = $.trim(a.$_matchCon.val());
|
||||
queryConditions.skuName = "输入规格、属性名称查询" === b ? "" : b, THISPAGE.reloadData(queryConditions)
|
||||
}), $("#refresh").click(function() {
|
||||
THISPAGE.reloadData(queryConditions)
|
||||
}), $("#add").click(function() {
|
||||
Business.verifyRight("FZSX_ADD") && $.dialog({
|
||||
width: 300,
|
||||
height: 180,
|
||||
title: "新增商品规格",
|
||||
content: "url:assistingPropGroupManage",
|
||||
data: {
|
||||
skuClassId: queryConditions.skuClassId,
|
||||
callback: function(a, b) {
|
||||
$("#grid").jqGrid("addRowData", a.skuId, a, "first"), $("#grid").jqGrid("nextCell", 0, 4), b && b.close()
|
||||
}
|
||||
},
|
||||
init: function() {
|
||||
a.skey = ""
|
||||
},
|
||||
lock: !1,
|
||||
ok: !1,
|
||||
cancle: !1
|
||||
})
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-trash", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("FZSX_DELETE")) {
|
||||
var b = $(this).closest("tr").prop("id");
|
||||
$.dialog.confirm("您确定要删除该规格吗?", function() {
|
||||
Public.ajaxGet("../basedata/assistSku/delete?action=delete", {
|
||||
id: b
|
||||
}, function(a) {
|
||||
200 === a.status ? ($("#grid").jqGrid("delRowData", b), parent.Public.tips({
|
||||
content: "删除成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}), $(document).bind("click.cancel", function(a) {
|
||||
var b = a.target || a.srcElement;
|
||||
!$(b).closest("#grid").length > 0 && ($("#grid").jqGrid("saveCell", curRow, curCol), curRow = null, curCol = null)
|
||||
})
|
||||
}
|
||||
};
|
||||
THISPAGE.init();
|
||||
117
statics/js/dist/assistingPropGroupManage.js
vendored
Executable file
117
statics/js/dist/assistingPropGroupManage.js
vendored
Executable file
@@ -0,0 +1,117 @@
|
||||
var curRow, curCol;
|
||||
$(function() {
|
||||
var a = frameElement.api,
|
||||
b = (a.data.oper, a.data.opener, a.data.callback),
|
||||
c = a.data.skuClassId,
|
||||
d = Public.getDefaultPage(),
|
||||
e = {
|
||||
$comboField: $("#comboField"),
|
||||
combolist: [],
|
||||
init: function() {
|
||||
c && (this.initButton(), this.initDom(), this.initEvent())
|
||||
},
|
||||
initButton: function() {
|
||||
var f = ["保存", "关闭"];
|
||||
a.button({
|
||||
id: "confirm",
|
||||
name: f[0],
|
||||
focus: !0,
|
||||
callback: function() {
|
||||
for (var f = {
|
||||
skuClassId: c,
|
||||
skuName: "",
|
||||
skuAssistId: ""
|
||||
}, g = 0, h = e.combolist.length; h > g; g++) {
|
||||
var i = e.combolist[g].getSelectedRow();
|
||||
if (0 == i.value) return void d.Public.tips({
|
||||
type: 1,
|
||||
content: "属性不能为空!"
|
||||
});
|
||||
f.skuName = f.skuName ? f.skuName + "/" + i.name : i.name, f.skuAssistId = f.skuAssistId ? f.skuAssistId + "," + i.id : i.id
|
||||
}
|
||||
return Public.ajaxPost("../basedata/assistSku/add?action=add", f, function(c) {
|
||||
200 == c.status ? (d.Public.tips({
|
||||
content: "新增规格成功!"
|
||||
}), d.SYSTEM.assistPropGroupInfo.push(c.data), b && "function" == typeof b && b(c.data, a)) : d.Public.tips({
|
||||
type: 1,
|
||||
content: c.msg
|
||||
})
|
||||
}), !1
|
||||
}
|
||||
}, {
|
||||
id: "cancel",
|
||||
name: f[1]
|
||||
})
|
||||
},
|
||||
initDom: function() {
|
||||
for (var a, b = 0, f = d.SYSTEM.assistPropGroupInfo.length; f > b; b++) d.SYSTEM.assistPropGroupInfo[b].skuId == c && (a = d.SYSTEM.assistPropGroupInfo[b].skuAssistId.split(","));
|
||||
for (var b = 0, f = a.length; f > b; b++) {
|
||||
var g = ['<li class="row-item">', '<div class="ctn-wrap"><span id="' + a[b] + '"></span></div>', "</li>"];
|
||||
this.$comboField.append(g.join("")), function(c) {
|
||||
for (var f = "", g = 0, h = d.SYSTEM.assistPropTypeInfo.length; h > g; g++) d.SYSTEM.assistPropTypeInfo[g].id == c && (f = d.SYSTEM.assistPropTypeInfo[g].name);
|
||||
e.combolist.push($("#" + c).combo({
|
||||
data: function() {
|
||||
return e.handle.getComboData(c)
|
||||
},
|
||||
ajaxOptions: {
|
||||
formatData: function(a) {
|
||||
d.SYSTEM.assistPropInfo = a.data.items;
|
||||
for (var b = [], e = 0, f = d.SYSTEM.assistPropInfo.length; f > e; e++) d.SYSTEM.assistPropInfo[e].typeNumber === c && b.push(d.SYSTEM.assistPropInfo[e]);
|
||||
return b
|
||||
}
|
||||
},
|
||||
value: "id",
|
||||
text: "name",
|
||||
width: 230,
|
||||
defaultSelected: 0,
|
||||
editable: !0,
|
||||
extraListHtml: '<a href="javascript:void(0);" id="quickAddSku" class="quick-add-link"><i class="ui-icon-add"></i>新增属性</a>',
|
||||
maxListWidth: 500,
|
||||
cache: !1,
|
||||
forceSelection: !0,
|
||||
listHeight: 100,
|
||||
listWrapCls: "ui-droplist-wrap",
|
||||
noDataText: "请先添加" + f + "属性",
|
||||
callback: {
|
||||
onChange: function() {}
|
||||
}
|
||||
}).getCombo(a[b]))
|
||||
}(a[b])
|
||||
}
|
||||
},
|
||||
initEvent: function() {
|
||||
$(".quick-add-link").on("click", function() {
|
||||
for (var a = 0, b = e.combolist.length; b > a; a++) if (e.combolist[a].active) var c = e.combolist[a],
|
||||
d = c.obj[0].id,
|
||||
f = "新增" + c.opts.noDataText.replace("请先添加", ""),
|
||||
g = parent.$.dialog({
|
||||
title: f,
|
||||
content: "url:propManage.jsp",
|
||||
data: {
|
||||
oper: "add",
|
||||
typeNumber: d,
|
||||
callback: function(a) {
|
||||
c.loadData(e.handle.getComboData(d), "-1", !1), c.selectByValue(a.id), g.close()
|
||||
}
|
||||
},
|
||||
width: 280,
|
||||
height: 90,
|
||||
max: !1,
|
||||
min: !1,
|
||||
cache: !1,
|
||||
lock: !1
|
||||
})
|
||||
})
|
||||
},
|
||||
handle: {
|
||||
getComboData: function(a) {
|
||||
if (d.SYSTEM.assistPropInfo) {
|
||||
for (var b = [], c = 0, e = d.SYSTEM.assistPropInfo.length; e > c; c++) d.SYSTEM.assistPropInfo[c].typeNumber === a && b.push(d.SYSTEM.assistPropInfo[c]);
|
||||
return b
|
||||
}
|
||||
return "../basedata/assist?action=list&isDelete=2&typeNumber=" + a
|
||||
}
|
||||
}
|
||||
};
|
||||
e.init()
|
||||
});
|
||||
267
statics/js/dist/backup.js
vendored
Executable file
267
statics/js/dist/backup.js
vendored
Executable file
@@ -0,0 +1,267 @@
|
||||
function init() {
|
||||
(12 == parent.SYSTEM.serviceType || 16 == parent.SYSTEM.serviceType) && $("#localRecover").hide(), getBackupData(), $("#start-backup").on("click", function(a) {
|
||||
a.preventDefault(), Business.verifyRight("BACKUP_ADD") && backupConfirm()
|
||||
}), $("#localRecover").on("click", function(a) {
|
||||
if (12 !== parent.SYSTEM.serviceType || 16 !== parent.SYSTEM.serviceType) {
|
||||
if (a.preventDefault(), !Business.verifyRight("BACKUP_RECOVER")) return;
|
||||
recoverLocalBackup()
|
||||
}
|
||||
}), $("#backup-status").on("click", ".btn-recover", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("BACKUP_RECOVER")) {
|
||||
var b = $(this).parent().data("id");
|
||||
recoverConfirm(function() {
|
||||
recoverBackup(b)
|
||||
})
|
||||
}
|
||||
}), $("#backup-status").on("click", ".btn-del", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("BACKUP_DELETE")) {
|
||||
var b = $(this).parent().data("id");
|
||||
deleteBackupConfirm(b)
|
||||
}
|
||||
})
|
||||
}
|
||||
function getBackupData() {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: "../scm/backup/queryBackupFile?m=queryBackupFile",
|
||||
success: function(a) {
|
||||
a && a.data && (BACKUP_DATA = a.data.items), BACKUP_DATA.length > 0 ? showBackup() : showNoBackup()
|
||||
},
|
||||
error: function() {
|
||||
parent.Public.tips({
|
||||
type: 1,
|
||||
content: "获取用户备份情况失败,请刷新页面重试!",
|
||||
autoClose: !1
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
function showNoBackup() {
|
||||
var a = "<h3>温馨提示:</h3><p>您还没有备份记录,请点击“开始备份”按钮备份您的数据。</p>";
|
||||
$("#backup-status").html(a)
|
||||
}
|
||||
function showBackup() {
|
||||
var a = '<div id="dataGrid"><table id="grid"></table></div>';
|
||||
$("#backup-status").html(a), initGrid()
|
||||
}
|
||||
function initGrid() {
|
||||
var a = [400, 150, 80, 90];
|
||||
$("#grid").jqGrid({
|
||||
data: BACKUP_DATA,
|
||||
datatype: "local",
|
||||
height: Public.setGrid().h,
|
||||
autowidth: !0,
|
||||
shrinkToFit: !1,
|
||||
altRows: !0,
|
||||
gridview: !0,
|
||||
colModel: [{
|
||||
name: "operate",
|
||||
label: "操作",
|
||||
index: "operate",
|
||||
width: a[3],
|
||||
align: "center",
|
||||
title: !1,
|
||||
formatter: opeFmatter
|
||||
}, {
|
||||
name: "filename",
|
||||
label: "备份名称",
|
||||
index: "filename",
|
||||
width: a[0],
|
||||
title: !1
|
||||
}, {
|
||||
name: "createTime",
|
||||
label: "时间",
|
||||
index: "createTime",
|
||||
width: a[1],
|
||||
align: "center",
|
||||
title: !1
|
||||
}, {
|
||||
name: "size",
|
||||
label: "文件大小",
|
||||
index: "size",
|
||||
width: a[2],
|
||||
align: "center",
|
||||
title: !1,
|
||||
formatter: sizeFormatter
|
||||
}],
|
||||
cmTemplate: {
|
||||
sortable: !1
|
||||
},
|
||||
viewrecords: !0,
|
||||
localReader: {
|
||||
repeatitems: !1,
|
||||
id: "fid"
|
||||
}
|
||||
})
|
||||
}
|
||||
function nameFormatter(a) {
|
||||
return a.substr(a.lastIndexOf("/") + 1)
|
||||
}
|
||||
function sizeFormatter(a) {
|
||||
return a = parseInt(a), a = isNaN(a) ? 0 : a, Math.round(a / 1024) + " KB"
|
||||
}
|
||||
function opeFmatter(a, b, c) {
|
||||
return '<p data-id="' + c.fid + '" class="operate-wrap operating"><a class="btn-recover ui-icon ui-icon-copy" href="#" title="恢复">恢复</a><a class="btn-download ui-icon ui-icon-arrowthickstop-1-s" href="../scm/backup/download?fid=' + c.fid + '" target="_blank" title="下载">下载</a><a class="btn-del ui-icon ui-icon-trash" href="#" title="删除">删除</a></p>'
|
||||
}
|
||||
function backupConfirm() {
|
||||
var a = ["<p>为保证备份数据的完整性,<strong>请确保账套里的其他用户已经退出系统</strong>。</p>", "<p>确定执行备份?</p>"];
|
||||
$.dialog({
|
||||
title: "开始备份",
|
||||
id: "backupDialog",
|
||||
width: 300,
|
||||
height: 80,
|
||||
icon: "confirm.gif",
|
||||
fixed: !0,
|
||||
lock: !0,
|
||||
resize: !1,
|
||||
parent: parent || null,
|
||||
ok: function() {
|
||||
return window.setTimeout(function() {
|
||||
doBackup()
|
||||
}, 0), !0
|
||||
},
|
||||
cancel: !0,
|
||||
content: a.join("")
|
||||
})
|
||||
}
|
||||
function doBackup() {
|
||||
var a = $.dialog.tips("正在备份,这将需要几分钟时间,请耐心等候...", 1e3, "loading.gif", !0).show();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: "../scm/backup?m=backup",
|
||||
success: function(b) {
|
||||
if (a.close(), 200 == b.status) {
|
||||
parent.Public.tips({
|
||||
content: "备份完成!"
|
||||
}), b = b.data;
|
||||
var c = BACKUP_DATA.length;
|
||||
BACKUP_DATA.push(b), 0 == c ? showBackup() : ($("#grid").jqGrid("addRowData", b.fid, b, "first"), $("#" + b.fid).addClass("ui-state-add").siblings().removeClass("ui-state-add"))
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
},
|
||||
error: function() {
|
||||
a.close(), parent.Public.tips({
|
||||
type: 1,
|
||||
content: "备份失败!请重试。"
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
function deleteBackupConfirm(a) {
|
||||
$.dialog({
|
||||
title: "删除备份",
|
||||
width: 200,
|
||||
height: 80,
|
||||
icon: "confirm.gif",
|
||||
fixed: !0,
|
||||
lock: !0,
|
||||
resize: !1,
|
||||
parent: parent || null,
|
||||
ok: function() {
|
||||
return doDelete(a), !0
|
||||
},
|
||||
cancel: !0,
|
||||
content: "确定删除该备份?"
|
||||
})
|
||||
}
|
||||
function doDelete(a) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: "../scm/backup/deleteBackupFile?m=deleteBackupFile&id=" + a,
|
||||
success: function(b) {
|
||||
if (200 == b.status) {
|
||||
$("#grid").jqGrid("delRowData", a);
|
||||
for (var c = 0, d = BACKUP_DATA.length; d > c; c++) {
|
||||
var e = BACKUP_DATA[c];
|
||||
if (e.fid == a) {
|
||||
BACKUP_DATA.splice(c, 1);
|
||||
break
|
||||
}
|
||||
}
|
||||
0 == BACKUP_DATA.length && showNoBackup(), parent.Public.tips({
|
||||
content: "删除备份成功!"
|
||||
})
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
},
|
||||
error: function() {
|
||||
parent.Public.tips({
|
||||
type: 1,
|
||||
content: "删除备份失败!请重试。"
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
function recoverConfirm(a) {
|
||||
var b = ["<p>您将把帐套数据恢复到备份文件所在的状态,<strong>此操作不可回退</strong>,请谨慎操作。</p>", "<p>为保证备份数据的完整性,<strong>请确保账套里的其他用户已经退出系统</strong>。</p>", "<p>确定恢复备份?</p>"];
|
||||
$.dialog({
|
||||
title: "恢复备份",
|
||||
width: 340,
|
||||
height: 120,
|
||||
icon: "confirm.gif",
|
||||
fixed: !0,
|
||||
lock: !0,
|
||||
resize: !1,
|
||||
ok: function() {
|
||||
return window.setTimeout(function() {
|
||||
a()
|
||||
}, 0), !0
|
||||
},
|
||||
cancel: !0,
|
||||
content: b.join("")
|
||||
})
|
||||
}
|
||||
function recoverBackup(a) {
|
||||
var b = $.dialog.tips("正在恢复备份,这将需要几分钟时间,请耐心等候...", 1e3, "loading.gif", !0).show();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: "../scm/backup/recover?m=recover&id=" + a,
|
||||
success: function(a) {
|
||||
b.close(), 200 == a.status ?
|
||||
//parent.Public.tips({content: "恢复备份成功!请重新登陆"})
|
||||
(parent.window.$.cookie("ReloadTips", "恢复备份成功!"), parent.window.location.reload())//add by michen 20170723 for 修复恢复
|
||||
//(parent.window.$.cookie("ReloadTips", "恢复备份成功!"), parent.window.location.href = "../user/start?siId=" + parent.SYSTEM.DBID)
|
||||
: parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
},
|
||||
error: function() {
|
||||
b.close(), parent.Public.tips({
|
||||
type: 1,
|
||||
content: "恢复备份失败!请重试。"
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
function recoverLocalBackup() {
|
||||
$.dialog({
|
||||
title: "上传本地备份",
|
||||
id: "localBackupDialog",
|
||||
width: 460,
|
||||
height: 130,
|
||||
min: !1,
|
||||
max: !1,
|
||||
fixed: !0,
|
||||
resize: !1,
|
||||
lock: !0,
|
||||
content: "url:upload-backup.jsp",
|
||||
okVal: "上传",
|
||||
ok: function() {
|
||||
return this.content.doUpload(), !1
|
||||
},
|
||||
cancel: !0
|
||||
})
|
||||
}
|
||||
var BACKUP_DATA = [];
|
||||
init(), $(window).resize(function() {
|
||||
Public.resizeGrid()
|
||||
});
|
||||
137
statics/js/dist/cashBankJournal.js
vendored
Executable file
137
statics/js/dist/cashBankJournal.js
vendored
Executable file
@@ -0,0 +1,137 @@
|
||||
var $_curTr;
|
||||
$(function() {
|
||||
var a = function(a) {
|
||||
var b = Public.urlParam(),
|
||||
c = "../report/bankBalance_detail?action=detail",
|
||||
d = "../report/bankBalance_exporter?action=exporter",
|
||||
e = $("#filter-fromDate"),
|
||||
f = $("#filter-toDate"),
|
||||
g = $("#filter-settlementAccount input"),
|
||||
h = {
|
||||
SALE: {
|
||||
tabid: "sales-sales",
|
||||
text: "销货单",
|
||||
right: "SA_QUERY",
|
||||
url: "../scm/invsa?action=editSale&id="
|
||||
},
|
||||
PUR: {
|
||||
tabid: "purchase-purchase",
|
||||
text: "购货单",
|
||||
right: "PU_QUERY",
|
||||
url: "../scm/invpu?action=editPur&id="
|
||||
},
|
||||
TRANSFER: {
|
||||
tabid: "storage-transfers",
|
||||
text: "调拨单",
|
||||
right: "TF_QUERY",
|
||||
url: "../scm/invtf?action=editTf&id="
|
||||
},
|
||||
OO: {
|
||||
tabid: "storage-otherOutbound",
|
||||
text: "其它出库 ",
|
||||
right: "OO_QUERY",
|
||||
url: "../scm/invOi?action=editOi&type=in&id="
|
||||
},
|
||||
OI: {
|
||||
tabid: "storage-otherWarehouse",
|
||||
text: "其它入库 ",
|
||||
right: "IO_QUERY",
|
||||
url: "../scm/invOi?action=editOi&type=out&id="
|
||||
},
|
||||
CADJ: {
|
||||
tabid: "storage-adjustment",
|
||||
text: "成本调整",
|
||||
right: "CADJ_QUERY",
|
||||
url: "../storage/adjustment.jsp?id="
|
||||
},
|
||||
PAYMENT: {
|
||||
tabid: "money-payment",
|
||||
text: "付款单",
|
||||
right: "PAYMENT_QUERY",
|
||||
url: "../scm/payment?action=editPay&id="
|
||||
},
|
||||
RECEIPT: {
|
||||
tabid: "money-receipt",
|
||||
text: "收款单",
|
||||
right: "RECEIPT_QUERY",
|
||||
url: "../scm/receipt?action=editReceipt&id="
|
||||
},
|
||||
VERIFICA: {
|
||||
tabid: "money-verifica",
|
||||
text: "核销单 ",
|
||||
right: "VERIFICA_QUERY",
|
||||
url: "../money/verification.jsp?id="
|
||||
},
|
||||
QTSR: {
|
||||
tabid: "money-otherIncome",
|
||||
text: "其它收入单",
|
||||
right: "QTSR_QUERY",
|
||||
url: "scm/ori?action=editInc&id="
|
||||
},
|
||||
QTZC: {
|
||||
tabid: "money-otherExpense",
|
||||
text: "其它支出单",
|
||||
right: "QTZC_QUERY",
|
||||
url: "../scm/ori?action=editExp&id="
|
||||
}
|
||||
},
|
||||
i = {
|
||||
beginDate: b.beginDate || defParams.beginDate,
|
||||
endDate: b.endDate || defParams.endDate,
|
||||
accountNo: b.accountNo || ""
|
||||
},
|
||||
j = function() {
|
||||
e.datepicker(), f.datepicker()
|
||||
},
|
||||
k = function() {
|
||||
Business.moreFilterEvent(), $("#conditions-trigger").trigger("click")
|
||||
},
|
||||
l = function() {
|
||||
var a = "";
|
||||
for (key in i) i[key] && (a += "&" + key + "=" + encodeURIComponent(i[key]));
|
||||
window.location = c + a
|
||||
},
|
||||
m = function() {
|
||||
$("#filter-submit").on("click", function(a) {
|
||||
a.preventDefault();
|
||||
var b = e.val(),
|
||||
c = f.val();
|
||||
return b && c && new Date(b).getTime() > new Date(c).getTime() ? void parent.Public.tips({
|
||||
type: 1,
|
||||
content: "开始日期不能大于结束日期"
|
||||
}) : (i = {
|
||||
beginDate: b,
|
||||
endDate: c,
|
||||
accountNo: g.val() || ""
|
||||
}, void l())
|
||||
}), $(document).on("click", "#ui-datepicker-div,.ui-datepicker-header", function(a) {
|
||||
a.stopPropagation()
|
||||
}), $("#filter-reset").on("click", function(a) {
|
||||
a.preventDefault(), e.val(""), f.val(""), g.val("")
|
||||
}), $("#refresh").on("click", function(a) {
|
||||
a.preventDefault(), l()
|
||||
}), $("#btn-print").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("SettAcctReport_PRINT") && window.print()
|
||||
}), $("#btn-export").click(function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("SettAcctReport_EXPORT")) {
|
||||
var b = {};
|
||||
for (var c in i) i[c] && (b[c] = i[c]);
|
||||
Business.getFile(d, b)
|
||||
}
|
||||
}), $(".grid-wrap").on("click", ".link", function() {
|
||||
var a = $(this).data("id"),
|
||||
b = $(this).data("type").toLocaleUpperCase(),
|
||||
c = h[b];
|
||||
c && Business.verifyRight(c.right) && (parent.tab.addTabItem({
|
||||
tabid: c.tabid,
|
||||
text: c.text,
|
||||
url: c.url + a
|
||||
}), $(this).addClass("tr-hover"), $_curTr = $(this))
|
||||
}), Business.gridEvent()
|
||||
};
|
||||
return a.init = function() {
|
||||
e.val(i.beginDate || ""), f.val(i.endDate || ""), g.val(i.accountNo || ""), i.beginDate && i.endDate && $("#selected-period").text(i.beginDate + "至" + i.endDate), Business.filterSettlementAccount(), j(), k(), m()
|
||||
}, a
|
||||
}(a || {});
|
||||
a.init(), Public.initCustomGrid($("table.list"))
|
||||
});
|
||||
299
statics/js/dist/cashBankJournalNew.js
vendored
Executable file
299
statics/js/dist/cashBankJournalNew.js
vendored
Executable file
@@ -0,0 +1,299 @@
|
||||
define(["jquery", "print"], function(a, b, c) {
|
||||
function d() {
|
||||
Business.filterSettlementAccount(), k("#filter-fromDate").val(m.beginDate || ""), k("#filter-toDate").val(m.endDate || ""), m.beginDate && m.endDate && k("div.grid-subtitle").text("日期: " + m.beginDate + " 至 " + m.endDate), k("#filter-fromDate, #filter-toDate").datepicker(), Public.dateCheck(), k("#filter-submit").on("click", function(a) {
|
||||
a.preventDefault();
|
||||
var b = k("#filter-fromDate").val(),
|
||||
c = k("#filter-toDate").val();
|
||||
return b && c && new Date(b).getTime() > new Date(c).getTime() ? void parent.Public.tips({
|
||||
type: 1,
|
||||
content: "开始日期不能大于结束日期"
|
||||
}) : (m = {
|
||||
beginDate: b,
|
||||
endDate: c,
|
||||
accountNo: k("#settlementAccountAuto").val() || ""
|
||||
}, k("div.grid-subtitle").text("日期: " + b + " 至 " + c), void j(1))
|
||||
})
|
||||
}
|
||||
function e() {
|
||||
k("#btn-print").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("SettAcctReport_PRINT") && k("div.ui-print").printTable()
|
||||
}), k("#btn-export").click(function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("SettAcctReport_EXPORT")) {
|
||||
var b = {};
|
||||
for (var c in m) m[c] && (b[c] = m[c]);
|
||||
Business.getFile(n, b)
|
||||
}
|
||||
}), k("#config").click(function(a) {
|
||||
p.config()
|
||||
})
|
||||
}
|
||||
function f() {
|
||||
var a = !1,
|
||||
b = !1,
|
||||
c = !1;
|
||||
l.isAdmin !== !1 || l.rights.AMOUNT_COSTAMOUNT || (a = !0), l.isAdmin !== !1 || l.rights.AMOUNT_OUTAMOUNT || (b = !0), l.isAdmin !== !1 || l.rights.AMOUNT_INAMOUNT || (c = !0);
|
||||
var d = [{
|
||||
name: "accountNumber",
|
||||
label: "账户编号",
|
||||
width: 80,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "accountName",
|
||||
label: "账户名称",
|
||||
width: 100,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "date",
|
||||
label: "日期",
|
||||
width: 110,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billNo",
|
||||
label: "单据编号",
|
||||
width: 110,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billType",
|
||||
label: "业务类型",
|
||||
width: 80,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "income",
|
||||
label: "收入",
|
||||
width: 120,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.amountPlaces)
|
||||
}
|
||||
}, {
|
||||
name: "expenditure",
|
||||
label: "支出",
|
||||
align: "right",
|
||||
width: 120,
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.amountPlaces)
|
||||
}
|
||||
}, {
|
||||
name: "balance",
|
||||
label: "账户余额",
|
||||
width: 120,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.amountPlaces)
|
||||
}
|
||||
}, {
|
||||
name: "buName",
|
||||
label: "往来单位",
|
||||
width: 120,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billId",
|
||||
label: "",
|
||||
width: 0,
|
||||
align: "center",
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "billTypeNo",
|
||||
label: "",
|
||||
width: 0,
|
||||
align: "center",
|
||||
hidden: !0
|
||||
}],
|
||||
e = "local",
|
||||
f = "#";
|
||||
m.autoSearch && (e = "json", f = o), p.gridReg("grid", d), d = p.conf.grids.grid.colModel, k("#grid").jqGrid({
|
||||
url: f,
|
||||
postData: m,
|
||||
datatype: e,
|
||||
autowidth: !0,
|
||||
gridview: !0,
|
||||
colModel: d,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "date",
|
||||
sortorder: "desc",
|
||||
rowNum: 3e3,
|
||||
loadonce: !0,
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
forceFit: !0,
|
||||
footerrow: !0,
|
||||
userDataOnFooter: !0,
|
||||
cellLayout: 0,
|
||||
jsonReader: {
|
||||
root: "data.list",
|
||||
userdata: "data.total",
|
||||
repeatitems: !1,
|
||||
id: "0"
|
||||
},
|
||||
onCellSelect: function(a) {
|
||||
var b = k("#grid").getRowData(a),
|
||||
c = b.billId,
|
||||
d = b.billTypeNo.toUpperCase();
|
||||
switch (d) {
|
||||
case "PUR":
|
||||
if (!Business.verifyRight("PU_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "purchase-purchase",
|
||||
text: "购货单",
|
||||
url: "../scm/invPu?action=editPur&id=" + c
|
||||
});
|
||||
break;
|
||||
case "SALE":
|
||||
if (!Business.verifyRight("SA_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "sales-sales",
|
||||
text: "销售单",
|
||||
url: "../scm/invSa?action=editSale&id=" + c
|
||||
});
|
||||
break;
|
||||
case "TRANSFER":
|
||||
if (!Business.verifyRight("TF_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-transfers",
|
||||
text: "调拨单",
|
||||
url: "../scm/invTf?action=editTf&id=" + c
|
||||
});
|
||||
break;
|
||||
case "OI":
|
||||
if (!Business.verifyRight("IO_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-otherWarehouse",
|
||||
text: "其他入库",
|
||||
url: "../scm/invOi?action=editOi&type=in&id=" + c
|
||||
});
|
||||
break;
|
||||
case "OO":
|
||||
if (!Business.verifyRight("OO_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-otherOutbound",
|
||||
text: "其他出库",
|
||||
url: "../scm/invOi?action=editOi&type=out&id=" + c
|
||||
});
|
||||
break;
|
||||
case "CADJ":
|
||||
if (!Business.verifyRight("CADJ_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-adjustment",
|
||||
text: "成本调整单",
|
||||
url: "../scm/invOi?action=editOi&type=cbtz&id=" + c
|
||||
});
|
||||
break;
|
||||
case "PAYMENT":
|
||||
if (!Business.verifyRight("PAYMENT_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-payment",
|
||||
text: "付款单",
|
||||
url: "../scm/payment?action=editPay&id=" + c
|
||||
});
|
||||
break;
|
||||
case "VERIFICA":
|
||||
if (!Business.verifyRight("VERIFICA_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-verifica",
|
||||
text: "核销单",
|
||||
url: "/money/verification.jsp?id=" + c
|
||||
});
|
||||
break;
|
||||
case "RECEIPT":
|
||||
if (!Business.verifyRight("RECEIPT_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-receipt",
|
||||
text: "收款单",
|
||||
url: "../scm/receipt?action=editReceipt&id=" + c
|
||||
});
|
||||
break;
|
||||
case "QTSR":
|
||||
if (!Business.verifyRight("QTSR_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-otherIncome",
|
||||
text: "其它收入单",
|
||||
url: "../scm/ori?action=editInc&id=" + c
|
||||
});
|
||||
break;
|
||||
case "QTZC":
|
||||
if (!Business.verifyRight("QTZC_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-otherExpense",
|
||||
text: "其它支出单",
|
||||
url: "../scm/ori?action=editExp&id=" + c
|
||||
});
|
||||
break;
|
||||
case "ZJZZ":
|
||||
if (!Business.verifyRight("ZJZZ_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-accountTransfer",
|
||||
text: "资金转账单",
|
||||
url: "/scm/fundTf.do?action=initFundTfList&id=" + c
|
||||
})
|
||||
}
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
var b;
|
||||
if (a && a.data) {
|
||||
var c = a.data.list.length;
|
||||
b = c ? 31 * c : 1
|
||||
}
|
||||
g(b)
|
||||
},
|
||||
gridComplete: function() {
|
||||
k("#grid").footerData("set", {
|
||||
billType: "合计:"
|
||||
})
|
||||
},
|
||||
resizeStop: function(a, b) {
|
||||
p.setGridWidthByIndex(a, b + 1, "grid")
|
||||
}
|
||||
}), m.autoSearch ? (k(".no-query").remove(), k(".ui-print").show()) : k(".ui-print").hide()
|
||||
}
|
||||
function g(a) {
|
||||
a && (g.h = a);
|
||||
var b = h(),
|
||||
c = g.h,
|
||||
d = i(),
|
||||
e = k("#grid");
|
||||
c > d && (c = d), b < e.width() && (c += 17), k("#grid-wrap").height(function() {
|
||||
return document.body.clientHeight - this.offsetTop - 36 - 5
|
||||
}), e.jqGrid("setGridHeight", c), e.jqGrid("setGridWidth", b, !1)
|
||||
}
|
||||
function h() {
|
||||
return k(window).width() - k("#grid-wrap").offset().left - 36 - 20
|
||||
}
|
||||
function i() {
|
||||
return k(window).height() - k("#grid").offset().top - 36 - 16
|
||||
}
|
||||
function j() {
|
||||
k(".no-query").remove(), k(".ui-print").show(), k("#grid").clearGridData(!0), k("#grid").jqGrid("setGridParam", {
|
||||
datatype: "json",
|
||||
postData: m,
|
||||
url: o
|
||||
}).trigger("reloadGrid")
|
||||
}
|
||||
var k = a("jquery"),
|
||||
l = parent.SYSTEM,
|
||||
m = k.extend({
|
||||
beginDate: "",
|
||||
endDate: "",
|
||||
accountNo: ""
|
||||
}, Public.urlParam()),
|
||||
n = "../report/bankBalance_exporter?action=exporter",
|
||||
o = "../report/bankBalance_detail?action=detail";
|
||||
a("print");
|
||||
var p = Public.mod_PageConfig.init("cashBankJournalNew");
|
||||
d(), e(), f();
|
||||
var q;
|
||||
k(window).on("resize", function(a) {
|
||||
q || (q = setTimeout(function() {
|
||||
g(), q = null
|
||||
}, 50))
|
||||
})
|
||||
});
|
||||
354
statics/js/dist/categoryList.js
vendored
Executable file
354
statics/js/dist/categoryList.js
vendored
Executable file
@@ -0,0 +1,354 @@
|
||||
function initDom() {
|
||||
function a(a, b, c) {
|
||||
conditions.typeNumber = a, conditions.name = b, c || $("#grid").setGridParam({
|
||||
postData: conditions
|
||||
}).trigger("reloadGrid"), parent.$("li.l-selected a").eq(0).text(conditions.name + "类别")
|
||||
}
|
||||
var b, c = $(".ui-tab").on("click", "li", function() {
|
||||
var b = $(this),
|
||||
c = b.data("id"),
|
||||
d = b.html(),
|
||||
e = conditions.typeNumber,
|
||||
f = conditions.name;
|
||||
return conditions.typeNumber = c, conditions.name = d, verifyRight(rightsAction.query) ? ($(".cur").removeClass("cur"), b.addClass("cur"), $("#custom-assisting").getCombo().selectByIndex(0, !1), void a(c, d)) : (conditions.typeNumber = e, void(conditions.name = f))
|
||||
}),
|
||||
d = [],
|
||||
e = {
|
||||
customertype: "客户",
|
||||
supplytype: "供应商",
|
||||
trade: "商品",
|
||||
paccttype: "支出",
|
||||
raccttype: "收入"
|
||||
};
|
||||
for (var f in e) d.push('<li data-id="' + f + '">' + e[f] + "</li>");
|
||||
c.append(d.join(""));
|
||||
var g = $("#assisting-category-select li[data-id=" + typeNumber + "]");
|
||||
1 == g.length ? (g.addClass("cur"), b = 0) : (b = ["number", typeNumber], $("#custom-assisting").parent().addClass("cur")), a(typeNumber, e[typeNumber], !0), $("#custom-assisting").combo({
|
||||
data: "../basedata/assist/getAssistType?action=getAssistType",
|
||||
text: "name",
|
||||
value: "number",
|
||||
width: 170,
|
||||
ajaxOptions: {
|
||||
formatData: function(a) {
|
||||
var a = a.data.items;
|
||||
a.unshift({
|
||||
number: "",
|
||||
name: "选择其他类别"
|
||||
});
|
||||
for (var b = 0, c = a.length; c > b; b++) a[b].name = a[b].name.replace("类别", ""), e[a[b].number] && (a.splice(b, 1), b--, c--);
|
||||
return a.length > 1 && $("#custom-assisting").parent().show(), a
|
||||
}
|
||||
},
|
||||
defaultSelected: b,
|
||||
defaultFlag: !1,
|
||||
callback: {
|
||||
onChange: function(b) {
|
||||
if (b.number) {
|
||||
var c = b.number,
|
||||
d = b.name;
|
||||
$("#assisting-category-select li").removeClass("cur"), $("#custom-assisting").parent().addClass("cur"), a(c, d)
|
||||
} else $("#custom-assisting").getCombo().selectByValue(conditions.typeNumber, !1)
|
||||
},
|
||||
beforeChange: function(a) {
|
||||
var b = a.number,
|
||||
c = a.name;
|
||||
return _oType = conditions.typeNumber, _oName = conditions.name, conditions.typeNumber = b, conditions.name = c, verifyRight(rightsAction.query) ? !0 : (conditions.typeNumber = _oType, conditions.name = _oName, !1)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
function initEvent() {
|
||||
$("#btn-add").click(function(a) {
|
||||
a.preventDefault(), verifyRight(rightsAction.add) && handle.operate("add")
|
||||
}), $("#grid").on("click", ".operating .ui-icon-pencil", function(a) {
|
||||
if (a.preventDefault(), verifyRight(rightsAction.update)) {
|
||||
var b = $(this).parent().data("id");
|
||||
handle.operate("edit", b)
|
||||
}
|
||||
}), $("#grid").on("click", ".operating .ui-icon-trash", function(a) {
|
||||
if (a.preventDefault(), verifyRight(rightsAction.del)) {
|
||||
var b = $(this).parent().data("id");
|
||||
handle.del(b)
|
||||
}
|
||||
}), $("#btn-refresh").click(function(a) {
|
||||
a.preventDefault(), $("#grid").trigger("reloadGrid")
|
||||
}), $("#search").click(function(a) {
|
||||
a.preventDefault();
|
||||
var b = $.trim($("#matchCon").val());
|
||||
conditions.skey = "输入类别名称查询" == b ? "" : b, $("#grid").setGridParam({
|
||||
postData: conditions
|
||||
}).trigger("reloadGrid")
|
||||
}), $("#matchCon").placeholder(), $(window).resize(function() {
|
||||
Public.resizeGrid()
|
||||
})
|
||||
}
|
||||
function initGrid() {
|
||||
var a = [{
|
||||
name: "operate",
|
||||
label: "操作",
|
||||
width: 60,
|
||||
fixed: !0,
|
||||
align: "center",
|
||||
formatter: Public.operFmatter
|
||||
}, {
|
||||
name: "name",
|
||||
label: "类别",
|
||||
width: 200,
|
||||
formatter: function(a, b, c) {
|
||||
for (var d = parseInt(c.level) - 1, e = "", f = 0; d > f; f++) e += " ";
|
||||
return e + a
|
||||
}
|
||||
}, {
|
||||
name: "id",
|
||||
label: "id",
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "level",
|
||||
label: "level",
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "parentId",
|
||||
label: "parentId",
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "parentName",
|
||||
label: "parentName",
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "detail",
|
||||
label: "是否叶",
|
||||
hidden: !0
|
||||
}];
|
||||
$("#grid").jqGrid({
|
||||
url: url,
|
||||
postData: conditions,
|
||||
datatype: "json",
|
||||
height: Public.setGrid().h,
|
||||
altRows: !0,
|
||||
gridview: !0,
|
||||
colModel: a,
|
||||
autowidth: !0,
|
||||
viewrecords: !0,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
pager: "#page",
|
||||
rowNum: 2e3,
|
||||
shrinkToFit: !1,
|
||||
scroll: 1,
|
||||
jsonReader: {
|
||||
root: "data.items",
|
||||
records: "data.totalsize",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
if (a && 200 == a.status) {
|
||||
var b = {};
|
||||
a = a.data;
|
||||
for (var c = 0; c < a.items.length; c++) {
|
||||
var d = a.items[c];
|
||||
b[d.id] = d
|
||||
}
|
||||
showParentCategory = "trade" === conditions.typeNumber ? !0 : !1;
|
||||
for (var c = 0; c < a.items.length; c++) {
|
||||
var d = a.items[c],
|
||||
e = b[d.parentId] || {};
|
||||
e.name && (showParentCategory = !0, b[d.id].parentName = e.name)
|
||||
}
|
||||
parent.SYSTEM.categoryInfo = parent.SYSTEM.categoryInfo || {}, parent.SYSTEM.categoryInfo[conditions.typeNumber] = a.items, $("#grid").data("gridData", b)
|
||||
} else {
|
||||
var f = 250 == a.status ? "没有" + conditions.name + "类别数据!" : "获取" + conditions.name + "类别数据失败!" + a.msg;
|
||||
parent.Public.tips({
|
||||
type: 2,
|
||||
content: f
|
||||
})
|
||||
}
|
||||
},
|
||||
loadError: function() {
|
||||
parent.Public.tips({
|
||||
type: 1,
|
||||
content: "操作失败了哦,请检查您的网络链接!"
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
function initValidator() {
|
||||
$("#manage-form").validate({
|
||||
rules: {
|
||||
category: {
|
||||
required: !0
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
category: {
|
||||
required: "类别不能为空"
|
||||
}
|
||||
},
|
||||
errorClass: "valid-error"
|
||||
})
|
||||
}
|
||||
function postData(a) {
|
||||
if (!$("#manage-form").validate().form()) return void $("#manage-form").find("input.valid-error").eq(0).focus();
|
||||
var b = $.trim($("#category").val()),
|
||||
c = $.trim($("#ParentCategory").val()),
|
||||
d = a ? "update" : "add",
|
||||
e = c ? $("#ParentCategory").data("PID") : "";
|
||||
if (e === a) return void parent.parent.Public.tips({
|
||||
type: 2,
|
||||
content: "当前分类和上级分类不能相同!"
|
||||
});
|
||||
var f = {
|
||||
parentId: e,
|
||||
id: a,
|
||||
name: b
|
||||
},
|
||||
g = "add" == d ? "新增" + conditions.name + "类别" : "修改" + conditions.name + "类别";
|
||||
f.typeNumber = conditions.typeNumber, Public.ajaxPost("../basedata/assist/" + d, f, function(a) {
|
||||
200 == a.status ? (parent.parent.Public.tips({
|
||||
content: g + "成功!"
|
||||
}), handle.callback(a.data, d)) : parent.parent.Public.tips({
|
||||
type: 1,
|
||||
content: g + "失败!" + a.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
function resetForm() {
|
||||
$("#manage-form").validate().resetForm(), $("#ParentCategory").val(""), $("#category").val("").focus().select()
|
||||
}
|
||||
function verifyRight(a) {
|
||||
var b = rightsType[conditions.typeNumber];
|
||||
if (!b) return !0;
|
||||
switch (a) {
|
||||
case rightsAction.query:
|
||||
break;
|
||||
case rightsAction.add:
|
||||
break;
|
||||
case rightsAction.del:
|
||||
break;
|
||||
case rightsAction.update:
|
||||
break;
|
||||
default:
|
||||
return !1
|
||||
}
|
||||
return Business.verifyRight(b += a)
|
||||
}
|
||||
var typeNumber, showParentCategory, url = "../basedata/assist?action=list&isDelete=2",
|
||||
urlParam = Public.urlParam();
|
||||
urlParam.typeNumber && (typeNumber = urlParam.typeNumber);
|
||||
var conditions = {
|
||||
typeNumber: typeNumber,
|
||||
skey: "",
|
||||
name: ""
|
||||
},
|
||||
rightsType = {
|
||||
customertype: "BUTYPE",
|
||||
supplytype: "SUPPLYTYPE",
|
||||
trade: "TRADETYPE",
|
||||
raccttype: "RACCTTYPE",
|
||||
paccttype: "PACCTTYPE"
|
||||
},
|
||||
rightsAction = {
|
||||
query: "_QUERY",
|
||||
add: "_ADD",
|
||||
del: "_DELETE",
|
||||
update: "_UPDATE"
|
||||
},
|
||||
handle = {
|
||||
operate: function(a, b) {
|
||||
if ("add" == a) {
|
||||
var c = "新增" + conditions.name + "类别";
|
||||
({
|
||||
oper: a,
|
||||
callback: this.callback
|
||||
})
|
||||
} else {
|
||||
var c = "修改" + conditions.name + "类别";
|
||||
({
|
||||
oper: a,
|
||||
rowData: $("#grid").data("gridData")[b],
|
||||
callback: this.callback
|
||||
})
|
||||
}
|
||||
var d = ['<form id="manage-form" action="">', '<ul class="mod-form-rows manage-wrap" id="manager">', '<li class="row-item" style="position:relative; display:none;">', '<div class="label-wrap"><label for="ParentCategory">上级分类:</label></div>', '<div class="ctn-wrap" style="position:relative;"><input type="text" value="" class="ui-input" name="ParentCategory" id="ParentCategory" readonly></div>', '<div class="dn hideFeild"></div>', "</li>", '<li class="row-item">', '<div class="label-wrap"><label for="category">类别:</label></div>', '<div class="ctn-wrap"><input type="text" value="" class="ui-input" name="category" id="category"></div>', "</li>", "</ul>", "</form>"],
|
||||
e = 90;
|
||||
showParentCategory && (e = 150), this.dialog = $.dialog({
|
||||
title: c,
|
||||
content: d.join(""),
|
||||
width: 400,
|
||||
height: e,
|
||||
max: !1,
|
||||
min: !1,
|
||||
cache: !1,
|
||||
lock: !0,
|
||||
okVal: "确定",
|
||||
ok: function() {
|
||||
return postData(b), !1
|
||||
},
|
||||
cancelVal: "取消",
|
||||
cancel: function() {
|
||||
return !0
|
||||
},
|
||||
init: function() {
|
||||
var c = $(".hideFeild"),
|
||||
d = $("#ParentCategory"),
|
||||
e = $("#category");
|
||||
if (showParentCategory && (d.closest("li").show(), $("#ParentCategory").click(function() {
|
||||
c.show().data("hasInit") || (c.show().data("hasInit", !0), Public.zTree.init(c, {
|
||||
defaultClass: "ztreeDefault"
|
||||
}, {
|
||||
callback: {
|
||||
beforeClick: function(a, b) {
|
||||
d.val(b.name), d.data("PID", b.id), c.hide()
|
||||
}
|
||||
}
|
||||
}))
|
||||
}), $(".ui_dialog").click(function() {
|
||||
c.hide()
|
||||
}), $("#ParentCategory").closest(".row-item").click(function(a) {
|
||||
var b = a || window.event;
|
||||
b.stopPropagation ? b.stopPropagation() : window.event && (window.event.cancelBubble = !0)
|
||||
}), document.onclick = function() {
|
||||
c.hide()
|
||||
}), "add" != a) {
|
||||
var f = $("#grid").data("gridData")[b];
|
||||
e.val(f.name), d.val(f.parentName), d.data("PID", f.parentId)
|
||||
}
|
||||
initValidator()
|
||||
}
|
||||
})
|
||||
},
|
||||
del: function(a) {
|
||||
$.dialog.confirm("删除的" + conditions.name + "类别将不能恢复,请确认是否删除?", function() {
|
||||
Public.ajaxPost("../basedata/assist/delete?action=delete", {
|
||||
id: a,
|
||||
typeNumber: conditions.typeNumber
|
||||
}, function(b) {
|
||||
if (b && 200 == b.status) {
|
||||
parent.Public.tips({
|
||||
content: "删除" + conditions.name + "类别成功!"
|
||||
}), $("#grid").jqGrid("delRowData", a);
|
||||
for (var c = parent.SYSTEM.categoryInfo[conditions.typeNumber].length, d = 0; c > d; d++) parent.SYSTEM.categoryInfo[conditions.typeNumber][d].id === a && (parent.SYSTEM.categoryInfo[conditions.typeNumber].splice(d, 1), d--, c--)
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: "删除" + conditions.name + "类别失败!" + b.msg
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
callback: function(a, b) {
|
||||
var c = $("#grid").data("gridData");
|
||||
c || (c = {}, $("#grid").data("gridData", c));
|
||||
for (var d = parent.SYSTEM.categoryInfo[conditions.typeNumber].length, e = !0, f = 0; d > f; f++) parent.SYSTEM.categoryInfo[conditions.typeNumber][f].id === a.id && (parent.SYSTEM.categoryInfo[conditions.typeNumber][f] = a, e = !1);
|
||||
e && parent.SYSTEM.categoryInfo[conditions.typeNumber].push(a), c[a.id] = a, a.parentId && (c[a.id].parentName = c[a.parentId].name), "add" != b ? ($("#grid").jqGrid("setRowData", a.id, a), this.dialog.close()) : ($("#grid").jqGrid("addRowData", a.id, a, "last"), this.dialog.close()), $("#grid").setGridParam({
|
||||
postData: conditions
|
||||
}).trigger("reloadGrid")
|
||||
}
|
||||
};
|
||||
initDom(), initEvent(), initGrid();
|
||||
|
||||
|
||||
|
||||
|
||||
265
statics/js/dist/chooseAccount.js
vendored
Executable file
265
statics/js/dist/chooseAccount.js
vendored
Executable file
@@ -0,0 +1,265 @@
|
||||
function callback() {
|
||||
{
|
||||
var a = frameElement.api;
|
||||
a.data.oper, a.data.callback
|
||||
}
|
||||
null !== curRow && null !== curCol && ($("#accountGrid").jqGrid("saveCell", curRow, curCol), curRow = null, curCol = null);
|
||||
var b = {};
|
||||
return b.accounts = THISPAGE._getAccountsData(), b.accounts ? 0 === b.accounts.length ? (parent.parent.Public.tips({
|
||||
type: 1,
|
||||
content: "结算账户信息不能为空!"
|
||||
}), $("#accountGrid").jqGrid("editCell", 1, 2, !0), !1) : (b.payment = $("#accountGrid").jqGrid("footerData", "get").payment.replace(/,/g, ""), b) : !1
|
||||
}
|
||||
var SYSTEM = parent.parent.SYSTEM,
|
||||
curRow, curCol, qtyPlaces = Number(SYSTEM.qtyPlaces) || 4,
|
||||
pricePlaces = Number(SYSTEM.pricePlaces) || 4,
|
||||
amountPlaces = Number(SYSTEM.amountPlaces) || 2,
|
||||
api = frameElement.api,
|
||||
oper = api.data.oper,
|
||||
accountInfo = api.data.accountInfo ? [].concat(api.data.accountInfo) : api.data.accountInfo;
|
||||
if (accountInfo) {
|
||||
var gap = 4 - accountInfo.length;
|
||||
if (gap > 0) for (var i = 0; gap > i; i++) accountInfo.push({});
|
||||
var originalData = {
|
||||
accounts: accountInfo
|
||||
}
|
||||
} else var originalData = {
|
||||
accounts: [{
|
||||
id: "1"
|
||||
}, {
|
||||
id: "2"
|
||||
}, {
|
||||
id: "3"
|
||||
}, {
|
||||
id: "4"
|
||||
}]
|
||||
};
|
||||
var THISPAGE = {
|
||||
init: function(a) {
|
||||
this.loadGrid(a), this.initCombo(), this.addEvent()
|
||||
},
|
||||
initDom: function() {},
|
||||
loadGrid: function(a) {
|
||||
function b() {
|
||||
var a = $(".accountAuto")[0];
|
||||
return a
|
||||
}
|
||||
function c(a, b, c) {
|
||||
if ("get" === b) {
|
||||
if ("" !== $(".accountAuto").getCombo().getValue()) return $(a).val();
|
||||
var d = $(a).parents("tr");
|
||||
return d.removeData("accountInfo"), ""
|
||||
}
|
||||
"set" === b && $("input", a).val(c)
|
||||
}
|
||||
function d() {
|
||||
$("#initCombo").append($(".accountAuto").val(""))
|
||||
}
|
||||
function e() {
|
||||
var a = $(".paymentAuto")[0];
|
||||
return a
|
||||
}
|
||||
function f(a, b, c) {
|
||||
if ("get" === b) {
|
||||
if ("" !== $(".paymentAuto").getCombo().getValue()) return $(a).val();
|
||||
var d = $(a).parents("tr");
|
||||
return d.removeData("paymentInfo"), ""
|
||||
}
|
||||
"set" === b && $("input", a).val(c)
|
||||
}
|
||||
function g() {
|
||||
$("#initCombo").append($(".paymentAuto").val(""))
|
||||
}
|
||||
var h = this;
|
||||
$("#accountGrid").jqGrid({
|
||||
data: a.accounts,
|
||||
datatype: "clientSide",
|
||||
width: 628,
|
||||
height: "100%",
|
||||
rownumbers: !0,
|
||||
gridview: !0,
|
||||
onselectrow: !1,
|
||||
colModel: [{
|
||||
name: "operating",
|
||||
label: " ",
|
||||
width: 40,
|
||||
fixed: !0,
|
||||
formatter: Public.billsOper,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "account",
|
||||
label: "结算账户",
|
||||
width: 200,
|
||||
classes: "ui-ellipsis",
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: b,
|
||||
custom_value: c,
|
||||
handle: d
|
||||
}
|
||||
}, {
|
||||
name: "payment",
|
||||
label: "金额",
|
||||
width: 100,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
showZero: !0,
|
||||
decimalPlaces: amountPlaces
|
||||
},
|
||||
editable: !0
|
||||
}, {
|
||||
name: "way",
|
||||
label: "结算方式",
|
||||
width: 200,
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: e,
|
||||
custom_value: f,
|
||||
handle: g,
|
||||
trigger: "ui-icon-triangle-1-s payment-trigger"
|
||||
}
|
||||
}, {
|
||||
name: "settlement",
|
||||
label: "结算号",
|
||||
width: 100,
|
||||
editable: !0
|
||||
}],
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
idPrefix: "ac",
|
||||
shrinkToFit: !0,
|
||||
forceFit: !0,
|
||||
cellEdit: !0,
|
||||
cellsubmit: "clientArray",
|
||||
localReader: {
|
||||
root: "rows",
|
||||
records: "records",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
jsonReader: {
|
||||
root: "data.account",
|
||||
records: "records",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
if (accountInfo) for (var b = a.rows, c = 0, d = b.length; d > c; c++) {
|
||||
var e = c + 1,
|
||||
f = b[c];
|
||||
if ($.isEmptyObject(b[c])) break;
|
||||
$("#ac" + e).data("accountInfo", {
|
||||
id: f.accId
|
||||
}).data("paymentInfo", {
|
||||
id: f.wayId
|
||||
})
|
||||
}
|
||||
},
|
||||
gridComplete: function() {
|
||||
h.paymentTotal()
|
||||
},
|
||||
afterEditCell: function(a, b, c, d) {
|
||||
"account" === b && ($("#" + d + "_account", "#accountGrid").val(c), h.accountCombo.selectByText(c)), "way" === b && $("#" + d + "_way", "#accountGrid").val(c)
|
||||
},
|
||||
afterSaveCell: function(a, b) {
|
||||
"payment" == b && h.paymentTotal()
|
||||
},
|
||||
loadonce: !0,
|
||||
footerrow: !0,
|
||||
userData: {
|
||||
account: "合计:"
|
||||
},
|
||||
userDataOnFooter: !0
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
$("#grid").jqGrid("setGridParam", {
|
||||
url: "../../basedata/inventory?action=listForBill",
|
||||
datatype: "json",
|
||||
postData: a
|
||||
}).trigger("reloadGrid")
|
||||
},
|
||||
paymentTotal: function() {
|
||||
for (var a = $("#accountGrid"), b = a.jqGrid("getDataIDs"), c = 0, d = 0, e = b.length; e > d; d++) {
|
||||
var f = b[d],
|
||||
g = a.jqGrid("getRowData", f);
|
||||
g.payment && (c += parseFloat(g.payment))
|
||||
}
|
||||
a.jqGrid("footerData", "set", {
|
||||
payment: c
|
||||
})
|
||||
},
|
||||
initCombo: function() {
|
||||
this.accountCombo = Business.accountCombo($(".accountAuto"), {
|
||||
editable: !0,
|
||||
trigger: !1,
|
||||
callback: {
|
||||
onChange: function(a) {
|
||||
var b = this.input.parents("tr");
|
||||
a && b.data("accountInfo", a)
|
||||
}
|
||||
}
|
||||
}), Business.paymentCombo($(".paymentAuto"), {
|
||||
callback: {
|
||||
onChange: function(a) {
|
||||
var b = this.input.parents("tr");
|
||||
a && b.data("paymentInfo", a)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
a.newId = 5, $(".grid-wrap").on("click", ".account-trigger", function() {
|
||||
setTimeout(function() {
|
||||
a.accountCombo._onTriggerClick()
|
||||
}, 10)
|
||||
}), $(".grid-wrap").on("click", ".payment-trigger", function() {
|
||||
setTimeout(function() {
|
||||
$(".paymentAuto").trigger("click")
|
||||
}, 10)
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-plus", function() {
|
||||
var b = "ac" + $(this).parent().data("id"),
|
||||
c = ($("#accountGrid tbody tr").length, {
|
||||
id: a.newId
|
||||
}),
|
||||
d = $("#accountGrid").jqGrid("addRowData", a.newId, c, "after", b);
|
||||
d && ($(this).parents("td").removeAttr("class"), $(this).parents("tr").removeClass("selected-row ui-state-hover"), $("#accountGrid").jqGrid("resetSelection"), a.newId++)
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-trash", function() {
|
||||
if (2 === $("#accountGrid tbody tr").length) return parent.Public.tips({
|
||||
type: 2,
|
||||
content: "至少保留一条分录!"
|
||||
}), !1;
|
||||
var b = "ac" + $(this).parent().data("id"),
|
||||
c = $("#accountGrid").jqGrid("delRowData", b);
|
||||
c && a.calTotal()
|
||||
}), $(document).bind("click.cancel", function(a) {
|
||||
null !== curRow && null !== curCol && (!$(a.target).closest("#accountGrid").length > 0 && $("#accountGrid").jqGrid("saveCell", curRow, curCol), curRow = null, curCol = null)
|
||||
})
|
||||
},
|
||||
_getAccountsData: function() {
|
||||
for (var a = [], b = $("#accountGrid").jqGrid("getDataIDs"), c = 0, d = b.length; d > c; c++) {
|
||||
var e, f = b[c],
|
||||
g = $("#accountGrid").jqGrid("getRowData", f);
|
||||
if ("" !== g.account) {
|
||||
var h = $("#" + f).data("accountInfo"),
|
||||
i = $("#" + f).data("paymentInfo") || {};
|
||||
e = {
|
||||
accId: h.id,
|
||||
account: g.account,
|
||||
payment: g.payment,
|
||||
wayId: i.id || 0,
|
||||
way: g.way,
|
||||
settlement: g.settlement
|
||||
}, a.push(e)
|
||||
}
|
||||
}
|
||||
return a
|
||||
}
|
||||
};
|
||||
THISPAGE.init(originalData);
|
||||
51
statics/js/dist/contact-debt.js
vendored
Executable file
51
statics/js/dist/contact-debt.js
vendored
Executable file
@@ -0,0 +1,51 @@
|
||||
function initFilter() {
|
||||
var a = Public.urlParam();
|
||||
filterConditions = {
|
||||
matchCon: a.matchCon || "",
|
||||
customer: a.customer || "",
|
||||
supplier: a.supplier || ""
|
||||
}, filterConditions.matchCon ? $("#matchCon").val(filterConditions.matchCon || "请输入客户、供应商或编号查询") : ($("#matchCon").addClass("ui-input-ph"), $("#matchCon").placeholder()), filterConditions.customer && $("#customer").attr("checked", !0), filterConditions.supplier && $("#supplier").attr("checked", !0), $("#search").on("click", function(a) {
|
||||
a.preventDefault();
|
||||
var b = "请输入客户、供应商或编号查询" === $("#matchCon").val() ? "" : $.trim($("#matchCon").val());
|
||||
filterConditions = {
|
||||
matchCon: b,
|
||||
customer: $("#customer").is(":checked") ? 1 : "",
|
||||
supplier: $("#supplier").is(":checked") ? 1 : ""
|
||||
}, reloadReport()
|
||||
})
|
||||
}
|
||||
function initField() {
|
||||
var a = filterConditions.customer ? filterConditions.customer.split(",") : "",
|
||||
b = filterConditions.goods ? filterConditions.goods.split(",") : "",
|
||||
c = "";
|
||||
a && b ? c = "「您已选择了<b>" + a.length + "</b>个客户,<b>" + b.length + "</b>个商品进行查询」" : a ? c = "「您已选择了<b>" + a.length + "</b>个客户进行查询」" : b && (c = "「您已选择了<b>" + b.length + "</b>个商品进行查询」"), $("#cur-search-tip").html(c)
|
||||
}
|
||||
function initEvent() {
|
||||
$("#btn-print").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("ContactDebtReport_PRINT") && window.print()
|
||||
}), $("#btn-export").click(function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("ContactDebtReport_EXPORT")) {
|
||||
var b = {};
|
||||
for (var c in filterConditions) filterConditions[c] && (b[c] = filterConditions[c]);
|
||||
Business.getFile("report/contactDebt_exporter?action=exporter", b)
|
||||
}
|
||||
}), Business.gridEvent()
|
||||
}
|
||||
function reloadReport() {
|
||||
var a = "";
|
||||
for (key in filterConditions) filterConditions[key] && (a += "&" + key + "=" + encodeURIComponent(filterConditions[key]));
|
||||
window.location = "../report/contactDebt_detail?action=detail" + a
|
||||
}
|
||||
var filterConditions = {},
|
||||
profitChk, $_curTr;
|
||||
initFilter(), initEvent(), function() {
|
||||
if (Public.isIE6) {
|
||||
var a = $("#report-search"),
|
||||
b = $(window);
|
||||
a.width(b.width()), b.resize(function() {
|
||||
a.width(b.width())
|
||||
})
|
||||
}
|
||||
}(), $(function() {
|
||||
Public.initCustomGrid($("table.list"))
|
||||
});
|
||||
151
statics/js/dist/contactDebtNew.js
vendored
Executable file
151
statics/js/dist/contactDebtNew.js
vendored
Executable file
@@ -0,0 +1,151 @@
|
||||
define(["jquery", "print"], function(a, b, c) {
|
||||
function d() {
|
||||
m.matchCon ? k("#matchCon").val(m.matchCon || "请输入客户、供应商或编号查询") : (k("#matchCon").addClass("ui-input-ph"), k("#matchCon").placeholder()), m.customer && k("#customer").attr("checked", !0), m.supplier && k("#supplier").attr("checked", !0), k("#search").on("click", function(a) {
|
||||
a.preventDefault();
|
||||
var b = "请输入客户、供应商或编号查询" === k("#matchCon").val() ? "" : k.trim(k("#matchCon").val());
|
||||
m = {
|
||||
matchCon: b,
|
||||
customer: k("#customer").is(":checked") ? 1 : "",
|
||||
supplier: k("#supplier").is(":checked") ? 1 : ""
|
||||
}, j()
|
||||
})
|
||||
}
|
||||
function e() {
|
||||
k("#btn-print").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("ContactDebtReport_PRINT") && k("div.ui-print").printTable()
|
||||
}), k("#btn-export").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("ContactDebtReport_EXPORT") && Business.getFile(n, m)
|
||||
}), k("#config").click(function(a) {
|
||||
p.config()
|
||||
})
|
||||
}
|
||||
function f() {
|
||||
var a = !1,
|
||||
b = !1,
|
||||
c = !1;
|
||||
l.isAdmin !== !1 || l.rights.AMOUNT_COSTAMOUNT || (a = !0), l.isAdmin !== !1 || l.rights.AMOUNT_OUTAMOUNT || (b = !0), l.isAdmin !== !1 || l.rights.AMOUNT_INAMOUNT || (c = !0);
|
||||
var d = [{
|
||||
name: "number",
|
||||
label: "往来单位编号",
|
||||
width: 80,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "name",
|
||||
label: "名称",
|
||||
width: 120,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "displayName",
|
||||
label: "往来单位性质",
|
||||
width: 80,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "receivable",
|
||||
label: "应收款余额",
|
||||
width: 120,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.amountPlaces)
|
||||
}
|
||||
}, {
|
||||
name: "payable",
|
||||
label: "应付款余额",
|
||||
width: 120,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.amountPlaces)
|
||||
}
|
||||
}],
|
||||
e = "local",
|
||||
f = "#";
|
||||
m.autoSearch && (e = "json", f = o), p.gridReg("grid", d), d = p.conf.grids.grid.colModel, k("#grid").jqGrid({
|
||||
url: f,
|
||||
postData: m,
|
||||
datatype: e,
|
||||
autowidth: !0,
|
||||
gridview: !0,
|
||||
colModel: d,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "date",
|
||||
sortorder: "desc",
|
||||
rowNum: 1e6,
|
||||
loadonce: !0,
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
forceFit: !0,
|
||||
footerrow: !0,
|
||||
userDataOnFooter: !0,
|
||||
jsonReader: {
|
||||
root: "data.list",
|
||||
userdata: "data.total",
|
||||
repeatitems: !1,
|
||||
id: "0"
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
var b;
|
||||
if (a && a.data) {
|
||||
var c = a.data.list.length;
|
||||
b = c ? 31 * c : 1
|
||||
}
|
||||
g(b)
|
||||
},
|
||||
gridComplete: function() {
|
||||
k("#grid").footerData("set", {
|
||||
displayName: "合计:"
|
||||
}), k("table.ui-jqgrid-ftable").find('td[aria-describedby="grid_location"]').prevUntil().css("border-right-color", "#fff")
|
||||
},
|
||||
resizeStop: function(a, b) {
|
||||
p.setGridWidthByIndex(a, b + 1, "grid")
|
||||
}
|
||||
}), m.autoSearch ? (k(".no-query").remove(), k(".ui-print").show()) : k(".ui-print").hide()
|
||||
}
|
||||
function g(a) {
|
||||
a && (g.h = a);
|
||||
var b = h(),
|
||||
c = g.h,
|
||||
d = i(),
|
||||
e = k("#grid");
|
||||
c > d && (c = d), b < e.width() && (c += 17), k("#grid-wrap").height(function() {
|
||||
return document.body.clientHeight - this.offsetTop - 36 - 5
|
||||
}), e.jqGrid("setGridHeight", c), e.jqGrid("setGridWidth", b, !1)
|
||||
}
|
||||
function h() {
|
||||
return k(window).width() - k("#grid-wrap").offset().left - 36 - 20
|
||||
}
|
||||
function i() {
|
||||
return k(window).height() - k("#grid").offset().top - 36 - 16
|
||||
}
|
||||
function j() {
|
||||
k(".no-query").remove(), k(".ui-print").show(), k("#grid").clearGridData(!0), k("#grid").jqGrid("setGridParam", {
|
||||
datatype: "json",
|
||||
postData: m,
|
||||
url: o
|
||||
}).trigger("reloadGrid")
|
||||
}
|
||||
var k = a("jquery"),
|
||||
l = parent.SYSTEM,
|
||||
m = k.extend({
|
||||
matchCon: "",
|
||||
customer: "",
|
||||
supplier: ""
|
||||
}, Public.urlParam()),
|
||||
n = "../report/contactDebt_exporter?action=exporter",
|
||||
o = "../report/contactDebt_detail?action=detail";
|
||||
a("print");
|
||||
var p = Public.mod_PageConfig.init("contactDebtNew");
|
||||
d(), e(), f();
|
||||
var q;
|
||||
k(window).on("resize", function(a) {
|
||||
q || (q = setTimeout(function() {
|
||||
g(), q = null
|
||||
}, 50))
|
||||
})
|
||||
});
|
||||
203
statics/js/dist/cstList.js
vendored
Executable file
203
statics/js/dist/cstList.js
vendored
Executable file
@@ -0,0 +1,203 @@
|
||||
var THISPAGE = {
|
||||
$_customer : $("#customer")
|
||||
};
|
||||
function initEvent() {
|
||||
$("#btn-add").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("INVLOCTION_ADD") && handle.operate("add")
|
||||
}), $("#btn-disable").click(function(a) {
|
||||
a.preventDefault();
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow").concat();
|
||||
return b && 0 != b.length ? void handle.setStatuses(b, !0) : void parent.Public.tips({
|
||||
type: 1,
|
||||
content: " 请先选择要禁用的客户账号!"
|
||||
})
|
||||
}), $("#btn-enable").click(function(a) {
|
||||
a.preventDefault();
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow").concat();
|
||||
return b && 0 != b.length ? void handle.setStatuses(b, !1) : void parent.Public.tips({
|
||||
type: 1,
|
||||
content: " 请先选择要启用的客户账号!"
|
||||
})
|
||||
}), $("#btn-import").click(function(a) {
|
||||
a.preventDefault()
|
||||
}), $("#btn-export").click(function(a) {
|
||||
a.preventDefault()
|
||||
}), $("#btn-print").click(function(a) {
|
||||
a.preventDefault()
|
||||
}), $("#btn-refresh").click(function(a) {
|
||||
a.preventDefault(), $("#grid").jqGrid('setGridParam', {
|
||||
postData:{cstno:$("#customer").find("input").val()}
|
||||
}).trigger("reloadGrid")
|
||||
}), $("#grid").on("click", ".operating .ui-icon-pencil", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("INVLOCTION_UPDATE")) {
|
||||
var b = $(this).parent().data("id");
|
||||
handle.operate("edit", b)
|
||||
}
|
||||
}), $("#grid").on("click", ".operating .ui-icon-trash", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("INVLOCTION_DELETE")) {
|
||||
var b = $(this).parent().data("id");
|
||||
handle.del(b)
|
||||
}
|
||||
}), $("#grid").on("click", ".set-status", function(a) {
|
||||
if (a.stopPropagation(), a.preventDefault(), Business.verifyRight("INVLOCTION_UPDATE")) {
|
||||
var b = $(this).data("id"),
|
||||
c = !$(this).data("delete");
|
||||
handle.setStatus(b, c)
|
||||
}
|
||||
}), $(window).resize(function() {
|
||||
Public.resizeGrid()
|
||||
});
|
||||
Business.billsPrePriceEvent($("#customer"),'','客户');
|
||||
}
|
||||
function initGrid() {
|
||||
var a = ["操作", "客户账号", "客户名称", "客户密码", "所属客户编号", "所属集团", "积分", "状态"],
|
||||
b = [{
|
||||
name: "operate",
|
||||
width: 60,
|
||||
fixed: !0,
|
||||
align: "center",
|
||||
formatter: Public.operFmatter
|
||||
}, {
|
||||
name: "number",
|
||||
index: "number",
|
||||
width: 150
|
||||
}, {
|
||||
name: "name",
|
||||
index: "name",
|
||||
width: 100
|
||||
}, {
|
||||
name: "passWord",
|
||||
index: "passWord",
|
||||
width: 100
|
||||
}, {
|
||||
name: "deptId",
|
||||
index: "deptId",
|
||||
width: 100,
|
||||
hidden:true
|
||||
}, {
|
||||
name: "deptName",
|
||||
index: "deptName",
|
||||
width: 350
|
||||
}, {
|
||||
name: "score",
|
||||
index: "score",
|
||||
width: 100
|
||||
}, {
|
||||
name: "delete",
|
||||
index: "delete",
|
||||
width: 100,
|
||||
formatter: statusFmatter,
|
||||
align: "center"
|
||||
}];
|
||||
$("#grid").jqGrid({
|
||||
url: "../basedata/cst?action=list&isDelete=2",
|
||||
datatype: "json",
|
||||
height: Public.setGrid().h,
|
||||
altRows: !0,
|
||||
gridview: !0,
|
||||
colNames: a,
|
||||
colModel: b,
|
||||
autowidth: !0,
|
||||
pager: "#page",
|
||||
viewrecords: !0,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
rowNum: 100,
|
||||
rowList: [100, 200, 500],
|
||||
shrinkToFit: !1,
|
||||
cellLayout: 8,
|
||||
jsonReader: {
|
||||
root: "data.items",
|
||||
records: "data.records",
|
||||
total: "data.total",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
if (a && 200 == a.status) {
|
||||
var b = {};
|
||||
a = a.data;
|
||||
for (var c = 0; c < a.items.length; c++) {
|
||||
var d = a.items[c];
|
||||
b[d.id] = d
|
||||
}
|
||||
$("#grid").data("gridData", b)
|
||||
} else parent.Public.tips({
|
||||
type: 2,
|
||||
content: "获取职员数据失败!" + a.msg
|
||||
})
|
||||
},
|
||||
loadError: function() {
|
||||
parent.Public.tips({
|
||||
type: 1,
|
||||
content: "数据加载错误!"
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
function statusFmatter(a, b, c) {
|
||||
var d = a === !0 ? "已禁用" : "已启用",
|
||||
e = a === !0 ? "ui-label-default" : "ui-label-success";
|
||||
return '<span class="set-status ui-label ' + e + '" data-delete="' + a + '" data-id="' + c.id + '">' + d + "</span>"
|
||||
}
|
||||
var handle = {
|
||||
operate: function(a, b) {
|
||||
if ("add" == a) var c = "新增客户手机账号",
|
||||
d = {
|
||||
oper: a,
|
||||
callback: this.callback
|
||||
};
|
||||
else var c = "修改客户手机账号",
|
||||
d = {
|
||||
oper: a,
|
||||
rowData: $("#grid").data("gridData")[b],
|
||||
callback: this.callback
|
||||
};
|
||||
$.dialog({
|
||||
title: c,
|
||||
content: "url:cst_manage",
|
||||
data: d,
|
||||
width: 900,
|
||||
height: 420,
|
||||
max: !1,
|
||||
min: !1,
|
||||
cache: !1,
|
||||
lock: !0
|
||||
})
|
||||
},
|
||||
setStatus: function(a, b) {
|
||||
a && Public.ajaxPost("../basedata/cst/disable?action=disable", {
|
||||
employeeIds: a,
|
||||
disable: Number(b)
|
||||
}, function(c) {
|
||||
c && 200 == c.status ? (parent.Public.tips({
|
||||
content: "客户账号状态修改成功!"
|
||||
}), $("#grid").jqGrid("setCell", a, "delete", b)) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: "客户账号状态修改失败!" + c.msg
|
||||
})
|
||||
})
|
||||
},
|
||||
callback: function(a, b, c) {
|
||||
var d = $("#grid").data("gridData");
|
||||
d || (d = {}, $("#grid").data("gridData", d)), d[a.id] = a, "edit" == b ? ($("#grid").jqGrid("setRowData", a.id, a), c && c.api.close()) : ($("#grid").jqGrid("addRowData", a.id, a, "last"), c && c.resetForm(a))
|
||||
},
|
||||
del: function(a) {
|
||||
$.dialog.confirm("删除的职员将不能恢复,请确认是否删除?", function() {
|
||||
Public.ajaxPost("../basedata/cst/delete?action=delete", {
|
||||
id: a
|
||||
}, function(b) {
|
||||
b && 200 == b.status ? (parent.Public.tips({
|
||||
content: "客户账号删除成功!"
|
||||
}), $("#grid").jqGrid("delRowData", a)) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: "客户账号删除失败!" + b.msg
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
};
|
||||
initEvent(), initGrid();
|
||||
93
statics/js/dist/cstManage.js
vendored
Executable file
93
statics/js/dist/cstManage.js
vendored
Executable file
@@ -0,0 +1,93 @@
|
||||
var THISPAGE={
|
||||
$_customer : $("#customer"),
|
||||
}
|
||||
function initField() {
|
||||
rowData.id && ($("#number").val(rowData.number),
|
||||
$("#name").val(rowData.name),
|
||||
$("#customer").find("input").val(rowData.deptId+'_'+rowData.deptName),
|
||||
$("#passWord").val(rowData.passWord),
|
||||
$("#score").val(rowData.score))
|
||||
}
|
||||
function initEvent() {
|
||||
var a = $("#number");
|
||||
Public.limitInput(a, /^[a-zA-Z0-9\-_]*$/),Public.limitInput($("#score"), /^[0-9.]*$/),
|
||||
Public.bindEnterSkip($("#manage-wrap"), postData, oper, rowData.id),
|
||||
initValidator(), a.focus().select()
|
||||
}
|
||||
function initPopBtns() {
|
||||
var a = "add" == oper ? ["保存", "关闭"] : ["确定", "取消"];
|
||||
api.button({
|
||||
id: "confirm",
|
||||
name: a[0],
|
||||
focus: !0,
|
||||
callback: function() {
|
||||
return postData(oper, rowData.id), !1
|
||||
}
|
||||
}, {
|
||||
id: "cancel",
|
||||
name: a[1]
|
||||
})
|
||||
}
|
||||
function initValidator() {
|
||||
$.validator.addMethod("number", function(a) {
|
||||
return /^[a-zA-Z0-9\-_]*$/.test(a)
|
||||
}), $("#manage-form").validate({
|
||||
rules: {
|
||||
number: {
|
||||
required: !0,
|
||||
number: !0
|
||||
},
|
||||
name: {
|
||||
required: !0
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
number: {
|
||||
required: "职员编号不能为空",
|
||||
number: "职员编号只能由数字、字母、-或_等字符组成"
|
||||
},
|
||||
name: {
|
||||
required: "职员名称不能为空"
|
||||
}
|
||||
},
|
||||
errorClass: "valid-error"
|
||||
})
|
||||
}
|
||||
function postData(a, b) {
|
||||
if (!$("#manage-form").validate().form()) return void $("#manage-form").find("input.valid-error").eq(0).focus();
|
||||
var c = $.trim($("#number").val()),
|
||||
d = $.trim($("#name").val()),
|
||||
deptName = $.trim($("#customer").find("input").val()),
|
||||
passWord = $.trim($("#passWord").val()),
|
||||
score = $.trim($("#score").val()),
|
||||
e = "add" == a ? "新增客户账号" : "修改客户账号";
|
||||
params = rowData.id ? {
|
||||
id: b,
|
||||
number: c,
|
||||
name: d,
|
||||
score: score,
|
||||
deptName:deptName,
|
||||
passWord:passWord
|
||||
} : {
|
||||
number: c,
|
||||
name: d,
|
||||
score: score,
|
||||
deptName:deptName,
|
||||
passWord:passWord
|
||||
}, Public.ajaxPost("../basedata/cst/" + ("add" == a ? "add" : "update"), params, function(b) {
|
||||
200 == b.status ? (parent.parent.Public.tips({
|
||||
content: e + "成功!"
|
||||
}), callback && "function" == typeof callback && callback(b.data, a, window)) : parent.parent.Public.tips({
|
||||
type: 1,
|
||||
content: e + "失败!" + b.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
function resetForm(a) {
|
||||
$("#manage-form").validate().resetForm(), $("#name").val(""),$("#passWord").val(""),$("#customer").find("input").val(""),$("#score").val("0"), $("#number").val(Public.getSuggestNum(a.number)).focus().select()
|
||||
}
|
||||
var api = frameElement.api,
|
||||
oper = api.data.oper,
|
||||
rowData = api.data.rowData || {},
|
||||
callback = api.data.callback;
|
||||
initPopBtns(), initField(), initEvent();Business.billsPrePriceEvent(this, "purchase","客户");
|
||||
105
statics/js/dist/customerBatch.js
vendored
Executable file
105
statics/js/dist/customerBatch.js
vendored
Executable file
@@ -0,0 +1,105 @@
|
||||
var api = frameElement.api,
|
||||
data = api.data || {},
|
||||
$grid = $("#grid"),
|
||||
addList = {},
|
||||
queryConditions = {
|
||||
skey: "",
|
||||
isDelete: data.isDelete || 0
|
||||
},
|
||||
THISPAGE = {
|
||||
init: function() {
|
||||
this.initDom(), this.loadGrid(), this.addEvent()
|
||||
},
|
||||
initDom: function() {
|
||||
this.$_matchCon = $("#matchCon"), this.$_matchCon.placeholder()
|
||||
},
|
||||
loadGrid: function() {
|
||||
$(window).height() - $(".grid-wrap").offset().top - 84;
|
||||
$grid.jqGrid({
|
||||
url: "../basedata/contact?action=list",
|
||||
postData: queryConditions,
|
||||
datatype: "json",
|
||||
width: 528,
|
||||
height: 354,
|
||||
altRows: !0,
|
||||
gridview: !0,
|
||||
colModel: [{
|
||||
name: "number",
|
||||
label: "客户编号",
|
||||
width: 100,
|
||||
title: !1
|
||||
}, {
|
||||
name: "name",
|
||||
label: "客户名称",
|
||||
width: 170,
|
||||
classes: "ui-ellipsis"
|
||||
}, {
|
||||
name: "customerType",
|
||||
label: "客户类别",
|
||||
width: 106,
|
||||
title: !1
|
||||
}, {
|
||||
name: "amount",
|
||||
label: "期初应收款",
|
||||
width: 90,
|
||||
title: !1,
|
||||
align: "right"
|
||||
}],
|
||||
cmTemplate: {
|
||||
sortable: !1
|
||||
},
|
||||
multiselect: !0,
|
||||
page: 1,
|
||||
sortname: "number",
|
||||
sortorder: "desc",
|
||||
pager: "#page",
|
||||
rowNum: 100,
|
||||
rowList: [100, 200, 500],
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
forceFit: !1,
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
records: "data.records",
|
||||
total: "data.total",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
loadError: function() {},
|
||||
onSelectRow: function(a, b) {
|
||||
if (b) {
|
||||
var c = $grid.jqGrid("getRowData", a);
|
||||
addList[a] = c
|
||||
} else addList[a] && delete addList[a]
|
||||
},
|
||||
onSelectAll: function(a, b) {
|
||||
for (var c = 0, d = a.length; d > c; c++) {
|
||||
var e = a[c];
|
||||
if (b) {
|
||||
var f = $grid.jqGrid("getRowData", e);
|
||||
addList[e] = f
|
||||
} else addList[e] && delete addList[e]
|
||||
}
|
||||
},
|
||||
gridComplete: function() {
|
||||
for (item in addList) $grid.jqGrid("setSelection", item, !1)
|
||||
}
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
addList = {}, $grid.jqGrid("setGridParam", {
|
||||
url: "../basedata/contact?action=list",
|
||||
datatype: "json",
|
||||
postData: a
|
||||
}).trigger("reloadGrid")
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
$("#search").click(function() {
|
||||
queryConditions.skey = "请输入客户编号或名称或联系人" === a.$_matchCon.val() ? "" : a.$_matchCon.val(), THISPAGE.reloadData(queryConditions)
|
||||
}), $("#refresh").click(function() {
|
||||
THISPAGE.reloadData(queryConditions)
|
||||
})
|
||||
}
|
||||
};
|
||||
THISPAGE.init();
|
||||
348
statics/js/dist/customerList.js
vendored
Executable file
348
statics/js/dist/customerList.js
vendored
Executable file
@@ -0,0 +1,348 @@
|
||||
$(function() {
|
||||
function a() {
|
||||
e = Business.categoryCombo($("#catorage"), {
|
||||
editable: !1,
|
||||
extraListHtml: "",
|
||||
addOptions: {
|
||||
value: -1,
|
||||
text: "选择客户类别"
|
||||
},
|
||||
defaultSelected: 0,
|
||||
trigger: !0,
|
||||
width: 120
|
||||
}, "customertype")
|
||||
}
|
||||
function b() {
|
||||
var a = Public.setGrid(),
|
||||
b = !(parent.SYSTEM.isAdmin || parent.SYSTEM.rights.AMOUNT_OUTAMOUNT),
|
||||
c = [{
|
||||
name: "operate",
|
||||
label: "操作",
|
||||
width: 60,
|
||||
fixed: !0,
|
||||
formatter: Public.operFmatter,
|
||||
title: !1
|
||||
}, {
|
||||
name: "customerType",
|
||||
label: "客户类别",
|
||||
index: "customerType",
|
||||
width: 100,
|
||||
fixed: !0,
|
||||
title: !1
|
||||
}, {
|
||||
name: "number",
|
||||
label: "客户编号",
|
||||
index: "number",
|
||||
width: 100,
|
||||
title: !1
|
||||
}, {
|
||||
name: "name",
|
||||
label: "客户名称",
|
||||
index: "name",
|
||||
width: 220,
|
||||
classes: "ui-ellipsis"
|
||||
}, {
|
||||
name: "contacter",
|
||||
label: "联系人",
|
||||
index: "contacter",
|
||||
width: 80,
|
||||
align: "center",
|
||||
fixed: !0
|
||||
}, {
|
||||
name: "mobile",
|
||||
label: "手机",
|
||||
index: "mobile",
|
||||
width: 100,
|
||||
align: "center",
|
||||
title: !1
|
||||
}, {
|
||||
name: "telephone",
|
||||
label: "座机",
|
||||
index: "telephone",
|
||||
width: 100,
|
||||
title: !1
|
||||
}, {
|
||||
name: "place",
|
||||
label: "职位",
|
||||
index: "place",
|
||||
width: 80,
|
||||
title: !1
|
||||
}, {
|
||||
name: "linkIm",
|
||||
label: "QQ/MSN",
|
||||
index: "linkIm",
|
||||
width: 80,
|
||||
title: !1
|
||||
}, {
|
||||
name: "difMoney",
|
||||
label: "期初往来余额",
|
||||
index: "difMoney",
|
||||
width: 100,
|
||||
align: "right",
|
||||
title: !1,
|
||||
formatter: "currency",
|
||||
hidden: b
|
||||
}, {
|
||||
name: "deliveryAddress",
|
||||
label: "送货地址",
|
||||
index: "deliveryAddress",
|
||||
width: 200,
|
||||
classes: "ui-ellipsis",
|
||||
formatter: function(a, b, c) {
|
||||
return (c.province || "") + (c.city || "") + (c.county || "") + (a || "")
|
||||
}
|
||||
}, {
|
||||
name: "delete",
|
||||
label: "状态",
|
||||
index: "delete",
|
||||
width: 80,
|
||||
align: "center",
|
||||
formatter: d
|
||||
}];
|
||||
h.gridReg("grid", c), c = h.conf.grids.grid.colModel, $("#grid").jqGrid({
|
||||
url: "../basedata/contact?action=list&isDelete=2",
|
||||
datatype: "json",
|
||||
autowidth: !0,
|
||||
height: a.h,
|
||||
altRows: !0,
|
||||
gridview: !0,
|
||||
onselectrow: !1,
|
||||
multiselect: !0,
|
||||
colModel: c,
|
||||
pager: "#page",
|
||||
viewrecords: !0,
|
||||
cmTemplate: {
|
||||
sortable: !1
|
||||
},
|
||||
rowNum: 100,
|
||||
rowList: [100, 200, 500],
|
||||
shrinkToFit: !1,
|
||||
forceFit: !0,
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
records: "data.records",
|
||||
total: "data.total",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
if (a && 200 == a.status) {
|
||||
var b = {};
|
||||
a = a.data;
|
||||
for (var c = 0; c < a.rows.length; c++) {
|
||||
var d = a.rows[c];
|
||||
b[d.id] = d
|
||||
}
|
||||
$("#grid").data("gridData", b)
|
||||
} else {
|
||||
var e = 250 === a.status ? f ? "没有满足条件的结果哦!" : "没有客户数据哦!" : a.msg;
|
||||
parent.Public.tips({
|
||||
type: 2,
|
||||
content: e
|
||||
})
|
||||
}
|
||||
},
|
||||
loadError: function(a, b, c) {
|
||||
parent.Public.tips({
|
||||
type: 1,
|
||||
content: "操作失败了哦,请检查您的网络链接!"
|
||||
})
|
||||
},
|
||||
resizeStop: function(a, b) {
|
||||
h.setGridWidthByIndex(a, b, "grid")
|
||||
}
|
||||
}).navGrid("#page", {
|
||||
edit: !1,
|
||||
add: !1,
|
||||
del: !1,
|
||||
search: !1,
|
||||
refresh: !1
|
||||
}).navButtonAdd("#page", {
|
||||
caption: "",
|
||||
buttonicon: "ui-icon-config",
|
||||
onClickButton: function() {
|
||||
h.config()
|
||||
},
|
||||
position: "last"
|
||||
})
|
||||
}
|
||||
function c() {
|
||||
$_matchCon = $("#matchCon"), $_matchCon.placeholder(), $("#search").on("click", function(a) {
|
||||
a.preventDefault();
|
||||
var b = "输入客户编号/ 名称/ 联系人/ 电话查询" === $_matchCon.val() ? "" : $.trim($_matchCon.val()),
|
||||
c = e ? e.getValue() : -1;
|
||||
$("#grid").jqGrid("setGridParam", {
|
||||
page: 1,
|
||||
postData: {
|
||||
skey: b,
|
||||
categoryId: c
|
||||
}
|
||||
}).trigger("reloadGrid")
|
||||
}), $("#btn-add").on("click", function(a) {
|
||||
a.preventDefault(), Business.verifyRight("BU_ADD") && g.operate("add")
|
||||
}), $("#btn-print").on("click", function(a) {
|
||||
a.preventDefault()
|
||||
}), $("#btn-import").on("click", function(a) {
|
||||
a.preventDefault(), Business.verifyRight("BaseData_IMPORT") && parent.$.dialog({
|
||||
width: 560,
|
||||
height: 300,
|
||||
title: "批量导入",
|
||||
content: "url:../import",
|
||||
lock: !0,
|
||||
data:{
|
||||
callback: function() {
|
||||
$("#search").click();
|
||||
}
|
||||
}
|
||||
})
|
||||
}), $("#btn-export").on("click", function(a) {
|
||||
if (Business.verifyRight("BU_EXPORT")) {
|
||||
var b = "输入客户编号/ 名称/ 联系人/ 电话查询" === $_matchCon.val() ? "" : $.trim($_matchCon.val());
|
||||
$(this).attr("href", "../basedata/customer/exporter?action=exporter&isDelete=2&skey=" + b)
|
||||
}
|
||||
}), $("#grid").on("click", ".operating .ui-icon-pencil", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("BU_UPDATE")) {
|
||||
var b = $(this).parent().data("id");
|
||||
g.operate("edit", b)
|
||||
}
|
||||
}), $("#grid").on("click", ".operating .ui-icon-trash", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("BU_DELETE")) {
|
||||
var b = $(this).parent().data("id");
|
||||
g.del(b + "")
|
||||
}
|
||||
}), $("#btn-batchDel").click(function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("BU_DELETE")) {
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow");
|
||||
b.length ? g.del(b.join()) : parent.Public.tips({
|
||||
type: 2,
|
||||
content: "请选择需要删除的项"
|
||||
})
|
||||
}
|
||||
}), $("#btn-disable").click(function(a) {
|
||||
a.preventDefault();
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow").concat();
|
||||
return b && 0 != b.length ? void g.setStatuses(b, !0) : void parent.Public.tips({
|
||||
type: 1,
|
||||
content: " 请先选择要禁用的客户!"
|
||||
})
|
||||
}), $("#btn-enable").click(function(a) {
|
||||
a.preventDefault();
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow").concat();
|
||||
return b && 0 != b.length ? void g.setStatuses(b, !1) : void parent.Public.tips({
|
||||
type: 1,
|
||||
content: " 请先选择要启用的客户!"
|
||||
})
|
||||
}), $("#grid").on("click", ".set-status", function(a) {
|
||||
if (a.stopPropagation(), a.preventDefault(), Business.verifyRight("INVLOCTION_UPDATE")) {
|
||||
var b = $(this).data("id"),
|
||||
c = !$(this).data("delete");
|
||||
g.setStatus(b, c)
|
||||
}
|
||||
}), $(window).resize(function() {
|
||||
Public.resizeGrid()
|
||||
})
|
||||
}
|
||||
function d(a, b, c) {
|
||||
var d = 1 == a ? "已禁用" : "已启用",
|
||||
e = 1 == a ? "ui-label-default" : "ui-label-success";
|
||||
return '<span class="set-status ui-label ' + e + '" data-delete="' + a + '" data-id="' + c.id + '">' + d + "</span>"
|
||||
}
|
||||
var e, f = !1,
|
||||
g = {
|
||||
operate: function(a, b) {
|
||||
if ("add" == a) var c = "新增客户",
|
||||
d = {
|
||||
oper: a,
|
||||
callback: this.callback
|
||||
};
|
||||
else var c = "修改客户",
|
||||
d = {
|
||||
oper: a,
|
||||
rowId: b,
|
||||
callback: this.callback
|
||||
};
|
||||
$.dialog({
|
||||
title: c,
|
||||
content: "url:customer_manage",
|
||||
data: d,
|
||||
width: 640,
|
||||
height: 466,
|
||||
max: !1,
|
||||
min: !1,
|
||||
cache: !1,
|
||||
lock: !0
|
||||
})
|
||||
},
|
||||
del: function(a) {
|
||||
$.dialog.confirm("删除的客户将不能恢复,请确认是否删除?", function() {
|
||||
Public.ajaxPost("../basedata/contact/delete?action=delete", {
|
||||
id: a
|
||||
}, function(b) {
|
||||
if (b && 200 == b.status) {
|
||||
var c = b.data.id || [];
|
||||
a.split(",").length === c.length ? parent.Public.tips({
|
||||
content: "成功删除" + c.length + "个客户!"
|
||||
}) : parent.Public.tips({
|
||||
type: 2,
|
||||
content: b.data.msg
|
||||
});
|
||||
for (var d = 0, e = c.length; e > d; d++) $("#grid").jqGrid("setSelection", c[d]), $("#grid").jqGrid("delRowData", c[d])
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: "删除客户失败!" + b.msg
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
setStatus: function(a, b) {
|
||||
a && Public.ajaxPost("../basedata/contact/disable?action=disable", {
|
||||
contactIds: a,
|
||||
disable: Number(b)
|
||||
}, function(c) {
|
||||
c && 200 == c.status ? (parent.Public.tips({
|
||||
content: "客户状态修改成功!"
|
||||
}), $("#grid").jqGrid("setCell", a, "delete", b)) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: "客户状态修改失败!" + c.msg
|
||||
})
|
||||
})
|
||||
},
|
||||
setStatuses: function(a, b) {
|
||||
if (a && 0 != a.length) {
|
||||
var c = $("#grid").jqGrid("getGridParam", "selarrrow"),
|
||||
d = c.join();
|
||||
Public.ajaxPost("../basedata/contact/disable?action=disable", {
|
||||
contactIds: d,
|
||||
disable: Number(b)
|
||||
}, function(c) {
|
||||
if (c && 200 == c.status) {
|
||||
parent.Public.tips({
|
||||
content: "客户状态修改成功!"
|
||||
});
|
||||
for (var d = 0; d < a.length; d++) {
|
||||
var e = a[d];
|
||||
$("#grid").jqGrid("setCell", e, "delete", b)
|
||||
}
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: "客户状态修改失败!" + c.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
callback: function(a, b, c) {
|
||||
var d = $("#grid").data("gridData");
|
||||
d || (d = {}, $("#grid").data("gridData", d)), a.difMoney = a.amount - a.periodMoney, d[a.id] = a, "edit" == b ? ($("#grid").jqGrid("setRowData", a.id, a), c && c.api.close()) : ($("#grid").jqGrid("addRowData", a.id, a, "first"), c && c.resetForm(a))
|
||||
}
|
||||
},
|
||||
h = Public.mod_PageConfig.init("customerList");
|
||||
a(), b(), c()
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
466
statics/js/dist/customerManage.js
vendored
Executable file
466
statics/js/dist/customerManage.js
vendored
Executable file
@@ -0,0 +1,466 @@
|
||||
function init() {
|
||||
void 0 !== cRowId ? Public.ajaxPost("../basedata/contact/query?action=query", {
|
||||
id: cRowId
|
||||
}, function(a) {
|
||||
200 == a.status ? (rowData = a.data, initField(), initEvent(), initGrid(rowData.links)) : parent.$.dialog({
|
||||
title: "系统提示",
|
||||
content: "获取客户数据失败,暂不能修改客户,请稍候重试",
|
||||
icon: "alert.gif",
|
||||
max: !1,
|
||||
min: !1,
|
||||
cache: !1,
|
||||
lock: !0,
|
||||
ok: "确定",
|
||||
ok: function() {
|
||||
return !0
|
||||
},
|
||||
close: function() {
|
||||
api.close()
|
||||
}
|
||||
})
|
||||
}) : (initField(), initEvent(), initGrid())
|
||||
}
|
||||
function initPopBtns() {
|
||||
var a = "add" == oper ? ["保存", "关闭"] : ["确定", "取消"];
|
||||
api.button({
|
||||
id: "confirm",
|
||||
name: a[0],
|
||||
focus: !0,
|
||||
callback: function() {
|
||||
return cancleGridEdit(), $_form.trigger("validate"), !1
|
||||
}
|
||||
}, {
|
||||
id: "cancel",
|
||||
name: a[1]
|
||||
})
|
||||
}
|
||||
function initValidator() {
|
||||
$_form.validator({
|
||||
rules: {
|
||||
type: [/^[a-zA-Z0-9\-_]*$/, "编号只能由数字、字母、-或_等字符组成"],
|
||||
unique: function(a, b, c) {
|
||||
var d = $(a).val();
|
||||
return $.ajax({
|
||||
url: "../basedata/contact/checkName?action=checkName",
|
||||
type: "get",
|
||||
data: "name=" + d,
|
||||
dataType: "json",
|
||||
success: function(a) {
|
||||
return -1 != a.status ? !0 : void parent.parent.Public.tips({
|
||||
type: 2,
|
||||
content: "存在相同的客户名称!"
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
myRemote: function(a, b, c) {
|
||||
return c.old.value === a.value || $(a).data("tip") === !1 && a.value.length > 1 ? !0 : $.ajax({
|
||||
url: "../basedata/contact/getNextNo?action=getNextNo&type=-10",
|
||||
type: "post",
|
||||
data: "skey=" + a.value,
|
||||
dataType: "json",
|
||||
success: function(b) {
|
||||
if (b.data && b.data.number) {
|
||||
var c = a.value.length;
|
||||
a.value = b.data.number;
|
||||
var d = a.value.length;
|
||||
if (a.createTextRange) {
|
||||
var e = a.createTextRange();
|
||||
e.moveEnd("character", d), e.moveStart("character", c), e.select()
|
||||
} else a.setSelectionRange(c, d), a.focus();
|
||||
$(a).data("tip", !0)
|
||||
} else $(a).data("tip", !1)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
required: "请填写{0}"
|
||||
},
|
||||
fields: {
|
||||
number: {
|
||||
rule: "add" === oper ? "required; type; myRemote" : "required; type",
|
||||
timely: 3
|
||||
},
|
||||
name: "required;"
|
||||
},
|
||||
display: function(a) {
|
||||
return $(a).closest(".row-item").find("label").text()
|
||||
},
|
||||
valid: function(a) {
|
||||
var b = $.trim($("#name").val());
|
||||
Public.ajaxPost("../basedata/contact/checkName?action=checkName", {
|
||||
name: b,
|
||||
id: cRowId
|
||||
}, function(a) {
|
||||
-1 == a.status ? parent.$.dialog.confirm('客户名称 "' + b + '" 已经存在!是否继续?', function() {
|
||||
postCustomerData()
|
||||
}, function() {}) : postCustomerData()
|
||||
})
|
||||
},
|
||||
ignore: ":hidden",
|
||||
theme: "yellow_bottom",
|
||||
timely: 1,
|
||||
stopOnError: !0
|
||||
})
|
||||
}
|
||||
function postCustomerData() {
|
||||
var a = "add" == oper ? "新增客户" : "修改客户",
|
||||
b = getCustomerData(),
|
||||
c = b.firstLink || {};
|
||||
delete b.firstLink, Public.ajaxPost("../basedata/contact/" + ("add" == oper ? "add" : "update"), b, function(d) {
|
||||
if (200 == d.status) {
|
||||
if (parent.parent.Public.tips({
|
||||
content: a + "成功!"
|
||||
}), callback && "function" == typeof callback) {
|
||||
var e = d.data.id;
|
||||
d = b, d.id = e, d.customerType = d.cCategoryName, d.contacter = c.linkName || "", d.place = c.linkPlace || "", d.mobile = c.linkMobile || "", d.telephone = c.linkPhone || "", d.linkIm = c.linkIm || "", d.deliveryAddress = c.address || "", d.province = c.province || "", d.city = c.city || "", d.county = c.county || "", callback(d, oper, window)
|
||||
}
|
||||
} else parent.parent.Public.tips({
|
||||
type: 1,
|
||||
content: a + "失败!" + d.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
function getCustomerData() {
|
||||
var a = getEntriesData(),
|
||||
b = a.entriesData,
|
||||
c = {
|
||||
id: cRowId,
|
||||
number: $.trim($("#number").val()),
|
||||
name: $.trim($("#name").val()),
|
||||
cCategory: categoryCombo.getValue(),
|
||||
cCategoryName: categoryCombo.getText(),
|
||||
cLevel: levelCombo.getValue(),
|
||||
cLevelName: levelCombo.getText(),
|
||||
beginDate: $("#date").val(),
|
||||
amount: Public.currencyToNum($("#receiveFunds").val()),
|
||||
periodMoney: Public.currencyToNum($("#periodReceiveFunds").val()),
|
||||
linkMans: JSON.stringify(b),
|
||||
remark: $("#note").val() == $("#note")[0].defaultValue ? "" : $("#note").val()
|
||||
};
|
||||
return c.firstLink = a.firstLink, c
|
||||
}
|
||||
function getEntriesData() {
|
||||
for (var a = {}, b = [], c = $grid.jqGrid("getDataIDs"), d = !1, e = 0, f = c.length; f > e; e++) {
|
||||
var g, h = c[e],
|
||||
i = $grid.jqGrid("getRowData", h);
|
||||
if ("" == i.name) break;
|
||||
g = {
|
||||
linkName: i.name,
|
||||
linkMobile: i.mobile,
|
||||
linkPhone: i.phone,
|
||||
linkPlace: i.place,
|
||||
linkIm: i.im,
|
||||
linkAddress: i.address,
|
||||
linkFirst: "是" == i.first ? 1 : 0
|
||||
};
|
||||
var j = $("#" + h).data("addressInfo") || {};
|
||||
g.province = j.province, g.city = j.city, g.county = j.county, g.address = j.address, "edit" == oper ? g.id = -1 != $.inArray(h, linksIds) ? h : 0 : g.id = 0, "是" == i.first && (d = !0, a.firstLink = g), b.push(g)
|
||||
}
|
||||
return !d && b.length > 0 && (b[0].linkFirst = 1, a.firstLink = b[0]), a.entriesData = b, a
|
||||
}
|
||||
function getTempData(a) {
|
||||
for (var b, c = $.extend({
|
||||
contacter: "",
|
||||
mobile: "",
|
||||
place:"",
|
||||
telephone: "",
|
||||
linkIm: ""
|
||||
}, a), d = c.links, e = 0; e < d.length; e++) if (d[e].first) {
|
||||
b = d[e];
|
||||
break
|
||||
}
|
||||
return c.customerType = categoryData[c.cCategory] && categoryData[c.cCategory].name || "", c.firstLink = b, c
|
||||
}
|
||||
function initField() {
|
||||
if ($("#note").placeholder(), "edit" == oper) {
|
||||
//if ($("#number").val(rowData.number), $("#name").val(rowData.name), $("#category").data("defItem", ["id", rowData.cCategory + ""]), rowData.beginDate) {
|
||||
if ($("#number").val(rowData.number), $("#name").val(rowData.name), $("#category").data("defItem", ["id", rowData.cCategory]), rowData.beginDate) {
|
||||
var a = new Date(rowData.beginDate),
|
||||
b = a.getFullYear(),
|
||||
c = 1 * a.getMonth() + 1,
|
||||
d = a.getDate();
|
||||
$("#date").val(b + "-" + c + "-" + d)
|
||||
}
|
||||
void 0 != rowData.amount && $("#receiveFunds").val(Public.numToCurrency(rowData.amount)), void 0 != rowData.periodMoney && $("#periodReceiveFunds").val(Public.numToCurrency(rowData.periodMoney)), rowData.remark && $("#note").val(rowData.remark)
|
||||
} else $("#date").val(parent.parent.SYSTEM.startDate);
|
||||
api.opener.parent.SYSTEM.isAdmin || api.opener.parent.SYSTEM.rights.AMOUNT_OUTAMOUNT || ($("#receiveFunds").closest("li").hide(), $("#periodReceiveFunds").closest("li").hide());
|
||||
var e = rowData.cLevel;
|
||||
levelCombo = $("#customerLevel").combo({
|
||||
data: [{
|
||||
id: 0,
|
||||
name: "零售客户"
|
||||
}, {
|
||||
id: 1,
|
||||
name: "批发客户"
|
||||
}, {
|
||||
id: 2,
|
||||
name: "VIP客户"
|
||||
}, {
|
||||
id: 3,
|
||||
name: "折扣等级一"
|
||||
}, {
|
||||
id: 4,
|
||||
name: "折扣等级二"
|
||||
}],
|
||||
value: "id",
|
||||
text: "name",
|
||||
width: 210,
|
||||
defaultSelected: e || 0
|
||||
}).getCombo()
|
||||
}
|
||||
function initEvent() {
|
||||
var a = "customertype";
|
||||
categoryCombo = Business.categoryCombo($("#category"), {
|
||||
defaultSelected: $("#category").data("defItem") || void 0,
|
||||
editable: !0,
|
||||
trigger: !0,
|
||||
width: 210,
|
||||
ajaxOptions: {
|
||||
formatData: function(b) {
|
||||
categoryData = {};
|
||||
var c = Public.getDefaultPage();
|
||||
if (200 == b.status) {
|
||||
for (var d = 0; d < b.data.items.length; d++) {
|
||||
var e = b.data.items[d];
|
||||
categoryData[e.id] = e
|
||||
}
|
||||
return c.SYSTEM.categoryInfo = c.SYSTEM.categoryInfo || {}, c.SYSTEM.categoryInfo[a] = b.data.items, b.data.items.unshift({
|
||||
id: 0,
|
||||
name: "(空)"
|
||||
}), b.data.items
|
||||
}
|
||||
return []
|
||||
}
|
||||
}
|
||||
}, a);
|
||||
var b = $("#date");
|
||||
b.blur(function() {
|
||||
"" == b.val() && b.val(parent.parent.SYSTEM.startDate)
|
||||
}), b.datepicker({
|
||||
onClose: function(a, c) {
|
||||
var d = /^\d{4}-((0?[1-9])|(1[0-2]))-\d{1,2}/;
|
||||
d.test(b.val()) || b.val("")
|
||||
}
|
||||
}), $("#receiveFunds").keypress(Public.numerical).focus(function() {
|
||||
this.value = Public.currencyToNum(this.value), $(this).select()
|
||||
}).blur(function() {
|
||||
this.value = Public.numToCurrency(this.value)
|
||||
}), $("#periodReceiveFunds").keypress(Public.numerical).focus(function() {
|
||||
this.value = Public.currencyToNum(this.value), $(this).select()
|
||||
}).blur(function() {
|
||||
this.value = Public.numToCurrency(this.value)
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-ellipsis", function(a) {
|
||||
a.preventDefault();
|
||||
var b = $(this).siblings(),
|
||||
c = $(this).closest("tr"),
|
||||
d = c.data("addressInfo");
|
||||
parent.$.dialog({
|
||||
title: "联系地址",
|
||||
content: "url:../settings/addressManage",
|
||||
data: {
|
||||
rowData: d,
|
||||
callback: function(a, d) {
|
||||
if (a) {
|
||||
var e = {};
|
||||
e.province = a.province || "", e.city = a.city || "", e.county = a.area || "", e.address = a.address || "", b.val(e.province + e.city + e.county + e.address), c.data("addressInfo", e)
|
||||
}
|
||||
d.close()
|
||||
}
|
||||
},
|
||||
width: 640,
|
||||
height: 210,
|
||||
min: !1,
|
||||
max: !1,
|
||||
cache: !1,
|
||||
lock: !0
|
||||
})
|
||||
}), $(document).on("click.cancle", function(a) {
|
||||
var b = a.target || a.srcElement;
|
||||
!$(b).closest("#grid").length > 0 && cancleGridEdit()
|
||||
}), bindEventForEnterKey(), initValidator()
|
||||
}
|
||||
function addCategory() {
|
||||
Business.verifyRight("BUTYPE_ADD") && parent.$.dialog({
|
||||
title: "新增客户类别",
|
||||
content: "url:../settings/customer_category_manage",
|
||||
data: {
|
||||
oper: "add",
|
||||
callback: function(a, b, c) {
|
||||
categoryCombo.loadData("../basedata/assist?action=list&typeNumber=customertype", ["id", a.id]), c && c.api.close()
|
||||
}
|
||||
},
|
||||
width: 400,
|
||||
height: 100,
|
||||
max: !1,
|
||||
min: !1,
|
||||
cache: !1,
|
||||
lock: !1
|
||||
})
|
||||
}
|
||||
function bindEventForEnterKey() {
|
||||
Public.bindEnterSkip($("#base-form"), function() {
|
||||
$("#grid tr.jqgrow:eq(0) td:eq(0)").trigger("click")
|
||||
})
|
||||
}
|
||||
function initGrid(a) {
|
||||
if (a || (a = []), a.length < 3) for (var b = 3 - a.length, c = 0; b > c; c++) a.push({});
|
||||
a.push({}), $grid.jqGrid({
|
||||
data: a,
|
||||
datatype: "local",
|
||||
width: 598,
|
||||
gridview: !0,
|
||||
onselectrow: !1,
|
||||
colModel: [{
|
||||
name: "name",
|
||||
label: "联系人",
|
||||
width: 60,
|
||||
title: !1,
|
||||
editable: !0
|
||||
}, {
|
||||
name: "mobile",
|
||||
label: "手机",
|
||||
width: 80,
|
||||
title: !1,
|
||||
editable: !0
|
||||
}, {
|
||||
name: "phone",
|
||||
label: "座机",
|
||||
width: 80,
|
||||
title: !1,
|
||||
editable: !0
|
||||
}, {
|
||||
name: "place",
|
||||
label: "职位",
|
||||
width: 80,
|
||||
title: !1,
|
||||
editable: !0
|
||||
}, {
|
||||
name: "im",
|
||||
label: "QQ/MSN",
|
||||
width: 82,
|
||||
title: !1,
|
||||
editable: !0
|
||||
}, {
|
||||
name: "addressStr",
|
||||
label: "联系地址",
|
||||
width: 140,
|
||||
title: !0,
|
||||
formatter: addressFmt,
|
||||
classes: "ui-ellipsis",
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: addressElem,
|
||||
custom_value: addressValue,
|
||||
handle: addressHandle,
|
||||
trigger: "ui-icon-ellipsis"
|
||||
}
|
||||
}, {
|
||||
name: "first",
|
||||
label: "首要联系人",
|
||||
width: 70,
|
||||
title: !1,
|
||||
formatter: isFirstFormate,
|
||||
editable: !0,
|
||||
edittype: "select",
|
||||
editoptions: {
|
||||
value: {
|
||||
1: "是",
|
||||
0: "否"
|
||||
}
|
||||
}
|
||||
}],
|
||||
cmTemplate: {
|
||||
sortable: !1
|
||||
},
|
||||
shrinkToFit: !0,
|
||||
forceFit: !0,
|
||||
cellEdit: !0,
|
||||
cellsubmit: "clientArray",
|
||||
localReader: {
|
||||
root: "items",
|
||||
records: "records",
|
||||
repeatitems: !0
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
if ($grid.height() > 124 ? $grid.setGridHeight("124") : $grid.setGridHeight("auto"), $grid.setGridWidth(598), "add" != oper) {
|
||||
if (!a || !a.items) return void(linksIds = []);
|
||||
linksIds = [];
|
||||
for (var b = a.items, c = 0; c < b.length; c++) {
|
||||
var d = b[c];
|
||||
if (d.id) {
|
||||
linksIds.push(d.id + "");
|
||||
var e = {
|
||||
province: d.province,
|
||||
city: d.city,
|
||||
county: d.county,
|
||||
address: d.address
|
||||
};
|
||||
$("#" + d.id).data("addressInfo", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
afterEditCell: function(a, b, c, d, e) {
|
||||
$("#" + a).find("input").val(c)
|
||||
},
|
||||
afterSaveCell: function(a, b, c, d, e) {
|
||||
if ("first" == b && (c = "boolean" == typeof c ? c ? "1" : "0" : c, "1" === c)) for (var f = $grid.jqGrid("getDataIDs"), g = 0; g < f.length; g++) {
|
||||
var h = f[g];
|
||||
h != a && $grid.jqGrid("setCell", h, "first", "0")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
function addressFmt(a, b, c) {
|
||||
if (a) return a;
|
||||
var d = {};
|
||||
return d.province = c.province || "", d.city = c.city || "", d.county = c.county || "", d.address = c.address || "", $("#" + c.id).data("addressInfo", d), d.province + d.city + d.county + d.address || " "
|
||||
}
|
||||
function addressElem(a, b) {
|
||||
var c = $(".address")[0];
|
||||
return c
|
||||
}
|
||||
function addressValue(a, b, c) {
|
||||
if ("get" === b) {
|
||||
var d = $.trim($(".address").val());
|
||||
return "" !== d ? d : ""
|
||||
}
|
||||
"set" === b && $("input", a).val(c)
|
||||
}
|
||||
function addressHandle() {
|
||||
$(".hideFile").append($(".address").val("").unbind("focus.once"))
|
||||
}
|
||||
function phoneCheck(a, b) {
|
||||
var c = /^(13|18|15|14)[\d]{9}$/;
|
||||
return c.test(a) ? [!0, ""] : [!1, "请填写正确的手机号码"]
|
||||
}
|
||||
function telephoneCheck(a, b) {
|
||||
var c = /^([\d]+-){1,2}[\d]+$/;
|
||||
return c.test(a) ? [!0, ""] : [!1, "请填写正确的座机号码,格式为0754-1234567或086-0754-1234567。"]
|
||||
}
|
||||
function isFirstFormate(a, b, c) {
|
||||
return a = "boolean" == typeof a ? a ? "1" : "0" : a, "1" === a ? "是" : " "
|
||||
}
|
||||
function cancleGridEdit() {
|
||||
null !== curRow && null !== curCol && ($grid.jqGrid("saveCell", curRow, curCol), curRow = null, curCol = null)
|
||||
}
|
||||
function resetForm(a) {
|
||||
var b = [{}, {}, {}, {}];
|
||||
$("#name").val(""), $("#date").val(""), $("#receiveFunds").val(""), $("#note").val(""), $("#periodReceiveFunds").val(""), $grid.jqGrid("clearGridData").jqGrid("setGridParam", {
|
||||
data: b
|
||||
}).trigger("reloadGrid"), $("#number").val(Public.getSuggestNum(a.number)).focus().select()
|
||||
}
|
||||
var curRow, curCol, curArrears, api = frameElement.api,
|
||||
oper = api.data.oper,
|
||||
cRowId = api.data.rowId,
|
||||
rowData = {},
|
||||
linksIds = [],
|
||||
callback = api.data.callback,
|
||||
defaultPage = Public.getDefaultPage(),
|
||||
categoryCombo, levelCombo, categoryData = {},
|
||||
$grid = $("#grid"),
|
||||
$_form = $("#manage-form");
|
||||
initPopBtns(), init();
|
||||
172
statics/js/dist/customersReconciliation.js
vendored
Executable file
172
statics/js/dist/customersReconciliation.js
vendored
Executable file
@@ -0,0 +1,172 @@
|
||||
var $_curTr;
|
||||
$(function() {
|
||||
var a = function(a) {
|
||||
var b = this,
|
||||
c = Public.urlParam(),
|
||||
d = "../report/customerBalance_detail?action=detail",
|
||||
e = "../report/customerBalance_exporter?action=exporter";
|
||||
$_fromDate = $("#filter-fromDate"), $_toDate = $("#filter-toDate"), $_customer = $("#customer"), $_customerText = $("#customerText"), $_match = $("#match"), $_matchChk = $("#match").find("input"), b.$_customer = $_customer, b.$_customerText = $_customerText;
|
||||
var f = {
|
||||
SALE: {
|
||||
tabid: "sales-sales",
|
||||
text: "销货单",
|
||||
right: "SA_QUERY",
|
||||
url: "../scm/invsa?action=editSale&id="
|
||||
},
|
||||
PUR: {
|
||||
tabid: "purchase-purchase",
|
||||
text: "购货单",
|
||||
right: "PU_QUERY",
|
||||
url: "../scm/invpu?action=editPur&id="
|
||||
},
|
||||
TRANSFER: {
|
||||
tabid: "storage-transfers",
|
||||
text: "调拨单",
|
||||
right: "TF_QUERY",
|
||||
url: "../scm/invtf?action=editTf&id="
|
||||
},
|
||||
OO: {
|
||||
tabid: "storage-otherOutbound",
|
||||
text: "其它出库 ",
|
||||
right: "OO_QUERY",
|
||||
url: "../scm/invOi?action=editOi&type=in&id="
|
||||
},
|
||||
OI: {
|
||||
tabid: "storage-otherWarehouse",
|
||||
text: "其它入库 ",
|
||||
right: "IO_QUERY",
|
||||
url: "../scm/invOi?action=editOi&type=out&id="
|
||||
},
|
||||
CADJ: {
|
||||
tabid: "storage-adjustment",
|
||||
text: "成本调整",
|
||||
right: "CADJ_QUERY",
|
||||
url: "../storage/adjustment.jsp?id="
|
||||
},
|
||||
PAYMENT: {
|
||||
tabid: "money-payment",
|
||||
text: "付款单",
|
||||
right: "PAYMENT_QUERY",
|
||||
url: "../scm/payment?action=editPay&id="
|
||||
},
|
||||
RECEIPT: {
|
||||
tabid: "money-receipt",
|
||||
text: "收款单",
|
||||
right: "RECEIPT_QUERY",
|
||||
url: "../scm/receipt?action=editReceipt&id="
|
||||
},
|
||||
VERIFICA: {
|
||||
tabid: "money-verifica",
|
||||
text: "核销单 ",
|
||||
right: "VERIFICA_QUERY",
|
||||
url: "../money/verification.jsp?id="
|
||||
}
|
||||
},
|
||||
g = {
|
||||
beginDate: c.beginDate || defParams.beginDate,
|
||||
endDate: c.endDate || defParams.endDate,
|
||||
customerId: c.customerId || -1,
|
||||
customerName: c.customerName || "",
|
||||
showDetail: "true" === c.showDetail ? "true" : "false"
|
||||
},
|
||||
h = function() {
|
||||
$_fromDate.datepicker(), $_toDate.datepicker()
|
||||
},
|
||||
i = function() {
|
||||
Business.moreFilterEvent(), $("#conditions-trigger").trigger("click")
|
||||
},
|
||||
j = function() {
|
||||
var a = "";
|
||||
for (key in g) g[key] && (a += "&" + key + "=" + encodeURIComponent(g[key]));
|
||||
window.location = d + a
|
||||
},
|
||||
k = function() {
|
||||
$("#refresh").on("click", function(a) {
|
||||
a.preventDefault();
|
||||
var c = $_fromDate.val(),
|
||||
d = $_toDate.val();
|
||||
if (c && d && new Date(c).getTime() > new Date(d).getTime()) return void parent.Public.tips({
|
||||
type: 1,
|
||||
content: "开始日期不能大于结束日期"
|
||||
});
|
||||
g = {
|
||||
beginDate: c,
|
||||
endDate: d,
|
||||
showDetail: $_matchChk[0].checked ? "true" : "false"
|
||||
};
|
||||
var e = b.$_customer.find("input");
|
||||
if ("" === e.val() || "(请选择销货单位)" === e.val()) {
|
||||
var f = {};
|
||||
f.id = 0, f.name = "(请选择销货单位)", b.$_customer.removeData("contactInfo")
|
||||
} else {
|
||||
var f = b.$_customer.data("contactInfo");
|
||||
if (null === f) return setTimeout(function() {
|
||||
e.focus().select()
|
||||
}, 15), parent.Public.tips({
|
||||
type: 2,
|
||||
content: "当前客户不存在!"
|
||||
}), !1
|
||||
}
|
||||
g.customerId = f.id, g.customerName = f.name, j()
|
||||
}), $(document).on("click", "#ui-datepicker-div,.ui-datepicker-header", function(a) {
|
||||
a.stopPropagation()
|
||||
}), $("#filter-reset").on("click", function(a) {
|
||||
a.preventDefault(), $_fromDate.val(""), $_toDate.val(""), $_accountNoInput.val("")
|
||||
}), $("#btn-print").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("CUSTOMERBALANCE_PRINT") && window.print()
|
||||
}), $("#btn-export").click(function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("CUSTOMERBALANCE_EXPORT")) {
|
||||
var c = {};
|
||||
for (var d in g) g[d] && (c[d] = g[d]);
|
||||
c.customerName = $.trim(b.$_customerText.html()), Business.getFile(e, c)
|
||||
}
|
||||
}), $(".grid-wrap").on("click", ".link", function() {
|
||||
var a = $(this).data("id"),
|
||||
b = $(this).data("type").toLocaleUpperCase(),
|
||||
c = f[b];
|
||||
c && Business.verifyRight(c.right) && (parent.tab.addTabItem({
|
||||
tabid: c.tabid,
|
||||
text: c.text,
|
||||
url: c.url + a
|
||||
}), $(this).addClass("tr-hover"), $_curTr = $(this))
|
||||
}), $("#customer").on("click", ".ui-icon-ellipsis", function() {
|
||||
if ($(this).data("hasInstance")) b.customerDialog.show().zindex();
|
||||
else {
|
||||
var a = $("#customer").prev().text().slice(0, -1),
|
||||
c = "选择" + a;
|
||||
if ("供应商" === a || "购货单位" === a) var d = "url:../settings/select_customer?type=10";
|
||||
else var d = "url:../settings/select_customer";
|
||||
b.customerDialog = $.dialog({
|
||||
width: 775,
|
||||
height: 510,
|
||||
title: c,
|
||||
content: d,
|
||||
data: {
|
||||
isDelete: 2
|
||||
},
|
||||
lock: !0,
|
||||
ok: function() {
|
||||
return this.content.callback(), this.hide(), !1
|
||||
},
|
||||
cancel: function() {
|
||||
return this.hide(), !1
|
||||
}
|
||||
}), $(this).data("hasInstance", !0)
|
||||
}
|
||||
}), Business.gridEvent()
|
||||
};
|
||||
return a.init = function() {
|
||||
$_fromDate.val(g.beginDate || ""), $_toDate.val(g.endDate || ""), $_match.cssCheckbox(), "true" == c.showDetail && ($_match.find("label").addClass("checked"), $_matchChk[0].checked = !0), g.beginDate && g.endDate && $("#selected-period").text(g.beginDate + "至" + g.endDate), b.customerCombo = Business.customerCombo($("#customer"), {
|
||||
defaultSelected: 0,
|
||||
addOptions: {
|
||||
text: "(请选择销货单位)",
|
||||
value: 0
|
||||
}
|
||||
}), c.customerId || ($(".grid-wrap").addClass("no-query"), $(".grid").remove()), b.$_customer.data("contactInfo", {
|
||||
id: Number(c.customerId) || 0,
|
||||
name: c.customerName || ""
|
||||
}), b.customerCombo.input.val(c.customerName || "(请选择销货单位)"), b.$_customerText.html("客户:" + b.$_customer.find("input").val()), h(), i(), k(), window.THISPAGE = b
|
||||
}, a
|
||||
}(a || {});
|
||||
a.init(), Public.initCustomGrid($("table.list"))
|
||||
});
|
||||
392
statics/js/dist/customersReconciliationNew.js
vendored
Executable file
392
statics/js/dist/customersReconciliationNew.js
vendored
Executable file
@@ -0,0 +1,392 @@
|
||||
define(["jquery", "print"], function(a, b, c) {
|
||||
function d() {
|
||||
q.cssCheckbox(), "true" == m.showDetail && (q.find("label").addClass("checked"), r[0].checked = !0), m.beginDate && m.endDate && k("div.grid-subtitle").text("日期: " + m.beginDate + "至" + m.endDate), k("#filter-fromDate").val(m.beginDate), k("#filter-toDate").val(m.endDate), k("#customer input").val(m.customerName), Business.customerCombo(k("#customer"), {
|
||||
defaultSelected: 0,
|
||||
addOptions: {
|
||||
text: t,
|
||||
value: 0
|
||||
}
|
||||
}), Public.dateCheck();
|
||||
var a = new Pikaday({
|
||||
field: k("#filter-fromDate")[0]
|
||||
}),
|
||||
b = new Pikaday({
|
||||
field: k("#filter-toDate")[0]
|
||||
});
|
||||
k("#filter-submit").on("click", function(c) {
|
||||
c.preventDefault();
|
||||
var d = k("#customer input").val();
|
||||
if (d === t || "" === d) return void parent.Public.tips({
|
||||
type: 1,
|
||||
content: t
|
||||
});
|
||||
var e = k("#filter-fromDate").val(),
|
||||
f = k("#filter-toDate").val(),
|
||||
g = a.getDate(),
|
||||
h = b.getDate(),
|
||||
i = window.THISPAGE.$_customer.data("contactInfo").id || "",
|
||||
l = window.THISPAGE.$_customer.data("contactInfo").name || "",
|
||||
n = r[0].checked ? "true" : "false",
|
||||
o = r[0].checked ? !0 : !1;
|
||||
return g.getTime() > h.getTime() ? void parent.Public.tips({
|
||||
type: 1,
|
||||
content: "开始日期不能大于结束日期"
|
||||
}) : (m = {
|
||||
beginDate: e,
|
||||
endDate: f,
|
||||
customerId: i,
|
||||
customerName: l,
|
||||
showDetail: n
|
||||
}, k("div.grid-subtitle").html("<p>客户:" + l + "</p><p>日期: " + e + " 至 " + f + "</p>"), void j(o))
|
||||
})
|
||||
}
|
||||
function e() {
|
||||
k("#btn-print").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("CUSTOMERBALANCE_PRINT") && k("div.ui-print").printTable()
|
||||
}), k("#btn-export").click(function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("CUSTOMERBALANCE_EXPORT")) {
|
||||
var b = {};
|
||||
for (var c in m) m[c] && (b[c] = m[c]);
|
||||
Business.getFile(n, b)
|
||||
}
|
||||
}), k("#customer").on("click", ".ui-icon-ellipsis", function(a) {
|
||||
if (k(this).data("hasInstance")) this.customerDialog.show().zindex();
|
||||
else {
|
||||
var b = k("#customer").prev().text().slice(0, -1),
|
||||
c = "选择" + b;
|
||||
if ("供应商" === b || "购货单位" === b) var d = "url:../settings/select_customer?type=10&multiselect=false";
|
||||
else var d = "url:../settings/select_customer?multiselect=false";
|
||||
this.customerDialog = k.dialog({
|
||||
width: 775,
|
||||
height: 510,
|
||||
title: c,
|
||||
content: d,
|
||||
data: {
|
||||
isDelete: 2
|
||||
},
|
||||
lock: !0,
|
||||
ok: function() {
|
||||
return this.content.callback(), this.hide(), !1
|
||||
},
|
||||
cancel: function() {
|
||||
return this.hide(), !1
|
||||
}
|
||||
}), k(this).data("hasInstance", !0)
|
||||
}
|
||||
}), k("#config").click(function(a) {
|
||||
u.config()
|
||||
})
|
||||
}
|
||||
function f() {
|
||||
var a = !1,
|
||||
b = !1,
|
||||
c = !1;
|
||||
l.isAdmin !== !1 || l.rights.AMOUNT_COSTAMOUNT || (a = !0), l.isAdmin !== !1 || l.rights.AMOUNT_OUTAMOUNT || (b = !0), l.isAdmin !== !1 || l.rights.AMOUNT_INAMOUNT || (c = !0);
|
||||
var d = [{
|
||||
name: "date",
|
||||
label: "单据日期",
|
||||
width: 80,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billNo",
|
||||
label: "单据编号",
|
||||
width: 200,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "transType",
|
||||
label: "业务类别",
|
||||
width: 60,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "invNo",
|
||||
label: "商品编号",
|
||||
width: 50,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "invName",
|
||||
label: "商品名称",
|
||||
width: 100,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "spec",
|
||||
label: "规格型号",
|
||||
width: 120,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "unit",
|
||||
label: "单位",
|
||||
width: 60,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "qty",
|
||||
label: "数量",
|
||||
width: 80,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.qtyPlaces)
|
||||
}
|
||||
}, {
|
||||
name: "price",
|
||||
label: "单价",
|
||||
width: 120,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.pricePlaces)
|
||||
}
|
||||
}, {
|
||||
name: "totalAmount",
|
||||
label: "销售金额",
|
||||
width: 120,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.amountPlaces)
|
||||
}
|
||||
}, {
|
||||
name: "disAmount",
|
||||
label: "整单折扣额",
|
||||
width: 80,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.amountPlaces)
|
||||
}
|
||||
}, {
|
||||
name: "amount",
|
||||
label: "应收金额",
|
||||
width: 120,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.amountPlaces)
|
||||
}
|
||||
}, {
|
||||
name: "rpAmount",
|
||||
label: "实际收款金额",
|
||||
width: 120,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.amountPlaces)
|
||||
}
|
||||
}, {
|
||||
name: "inAmount",
|
||||
label: "应收款余额",
|
||||
width: 120,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.amountPlaces)
|
||||
}
|
||||
}, {
|
||||
name: "billId",
|
||||
label: "",
|
||||
width: 0,
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "billType",
|
||||
label: "",
|
||||
width: 0,
|
||||
hidden: !0
|
||||
}],
|
||||
e = "local",
|
||||
f = "#";
|
||||
m.autoSearch && (e = "json", f = o), u.gridReg("grid", d), d = u.conf.grids.grid.colModel, k("#grid").jqGrid({
|
||||
url: f,
|
||||
postData: m,
|
||||
datatype: e,
|
||||
autowidth: !0,
|
||||
height: "auto",
|
||||
gridview: !0,
|
||||
colModel: d,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "date",
|
||||
sortorder: "desc",
|
||||
rowNum: 3e3,
|
||||
loadonce: !0,
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
forceFit: !0,
|
||||
footerrow: !0,
|
||||
userDataOnFooter: !0,
|
||||
jsonReader: {
|
||||
root: "data.list",
|
||||
userdata: "data.total",
|
||||
repeatitems: !1,
|
||||
id: "0"
|
||||
},
|
||||
onCellSelect: function(a) {
|
||||
var b = k("#grid").getRowData(a),
|
||||
c = b.billId,
|
||||
d = b.billType.toUpperCase();
|
||||
switch (d) {
|
||||
case "PUR":
|
||||
if (!Business.verifyRight("PU_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "purchase-purchase",
|
||||
text: "购货单",
|
||||
url: "../scm/invPu?action=editPur&id=" + c
|
||||
});
|
||||
break;
|
||||
case "SALE":
|
||||
if (!Business.verifyRight("SA_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "sales-sales",
|
||||
text: "销售单",
|
||||
url: "../scm/invSa?action=editSale&id=" + c
|
||||
});
|
||||
break;
|
||||
case "TRANSFER":
|
||||
if (!Business.verifyRight("TF_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-transfers",
|
||||
text: "调拨单",
|
||||
url: "../scm/invTf?action=editTf&id=" + c
|
||||
});
|
||||
break;
|
||||
case "OI":
|
||||
if (!Business.verifyRight("IO_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-otherWarehouse",
|
||||
text: "其他入库",
|
||||
url: "../scm/invOi?action=editOi&type=in&id=" + c
|
||||
});
|
||||
break;
|
||||
case "OO":
|
||||
if (!Business.verifyRight("OO_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-otherOutbound",
|
||||
text: "其他出库",
|
||||
url: "../scm/invOi?action=editOi&type=out&id=" + c
|
||||
});
|
||||
break;
|
||||
case "CADJ":
|
||||
if (!Business.verifyRight("CADJ_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-adjustment",
|
||||
text: "成本调整单",
|
||||
url: "../scm/invOi?action=editOi&type=cbtz&id=" + c
|
||||
});
|
||||
break;
|
||||
case "PAYMENT":
|
||||
if (!Business.verifyRight("PAYMENT_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-payment",
|
||||
text: "付款单",
|
||||
url: "../scm/payment?action=editPay&id=" + c
|
||||
});
|
||||
break;
|
||||
case "VERIFICA":
|
||||
if (!Business.verifyRight("VERIFICA_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-verifica",
|
||||
text: "核销单",
|
||||
url: "/money/verification.jsp?id=" + c
|
||||
});
|
||||
break;
|
||||
case "RECEIPT":
|
||||
if (!Business.verifyRight("RECEIPT_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-receipt",
|
||||
text: "收款单",
|
||||
url: "../scm/receipt?action=editReceipt&id=" + c
|
||||
});
|
||||
break;
|
||||
case "QTSR":
|
||||
if (!Business.verifyRight("QTSR_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-otherIncome",
|
||||
text: "其它收入单",
|
||||
url: "../scm/ori?action=editInc&id=" + c
|
||||
});
|
||||
break;
|
||||
case "QTZC":
|
||||
if (!Business.verifyRight("QTZC_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-otherExpense",
|
||||
text: "其它支出单",
|
||||
url: "../scm/ori?action=editExp&id=" + c
|
||||
})
|
||||
}
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
var b;
|
||||
if (a && a.data) {
|
||||
var c = a.data.list.length;
|
||||
b = c ? 31 * c : "auto"
|
||||
}
|
||||
g(b)
|
||||
},
|
||||
gridComplete: function() {
|
||||
k("#grid").footerData("set", {
|
||||
transType: "合计:"
|
||||
})
|
||||
},
|
||||
resizeStop: function(a, b) {
|
||||
u.setGridWidthByIndex(a, b + 1, "grid")
|
||||
}
|
||||
}), m.autoSearch ? (k(".no-query").remove(), k(".ui-print").show()) : k(".ui-print").hide()
|
||||
}
|
||||
function g(a) {
|
||||
a && (g.h = a);
|
||||
var b = h(),
|
||||
c = g.h,
|
||||
d = i(),
|
||||
e = k("#grid");
|
||||
c > d && (c = d), b < e.width() && (c += 17), e.jqGrid("setGridWidth", b, !1), e.jqGrid("setGridHeight", c), k("#grid-wrap").height(function() {
|
||||
return document.body.clientHeight - this.offsetTop - 36 - 5
|
||||
})
|
||||
}
|
||||
function h() {
|
||||
return k(window).width() - (h.offsetLeft || (h.offsetLeft = k("#grid-wrap").offset().left)) - 36 - 20
|
||||
}
|
||||
function i() {
|
||||
return k(window).height() - (i.offsetTop || (i.offsetTop = k("#grid").offset().top)) - 36 - 16 - 24
|
||||
}
|
||||
function j(a) {
|
||||
k(".no-query").remove(), k(".ui-print").show(), "undefined" != typeof a && (k("#grid").jqGrid(a ? "showCol" : "hideCol", ["invNo", "invName", "spec", "unit", "qty", "price"]), g()), k("#grid").clearGridData(!0), k("#grid").jqGrid("setGridParam", {
|
||||
datatype: "json",
|
||||
postData: m,
|
||||
url: o
|
||||
}).trigger("reloadGrid")
|
||||
}
|
||||
var k = a("jquery"),
|
||||
l = parent.SYSTEM,
|
||||
m = k.extend({
|
||||
beginDate: "",
|
||||
endDate: "",
|
||||
customerId: "",
|
||||
customerName: "",
|
||||
showDetail: ""
|
||||
}, Public.urlParam()),
|
||||
n = "../report/customerBalance_exporter?action=exporter",
|
||||
o = "../report/customerBalance_detail?action=detail",
|
||||
p = k("#customer"),
|
||||
q = k("#match"),
|
||||
r = k("#match").find("input"),
|
||||
s = s || {};
|
||||
s.$_customer = p, this.THISPAGE = s;
|
||||
var t = "(请选择销货单位)";
|
||||
a("print");
|
||||
var u = Public.mod_PageConfig.init("customersReconciliationNew");
|
||||
d(), e(), f();
|
||||
var v;
|
||||
k(window).on("resize", function(a) {
|
||||
v || (v = setTimeout(function() {
|
||||
g(), v = null
|
||||
}, 50))
|
||||
})
|
||||
});
|
||||
914
statics/js/dist/default.js
vendored
Executable file
914
statics/js/dist/default.js
vendored
Executable file
@@ -0,0 +1,914 @@
|
||||
function setTabHeight() {
|
||||
var a = $(window).height(),
|
||||
b = $("#main-bd"),
|
||||
c = a - b.offset().top;
|
||||
b.height(c)
|
||||
}
|
||||
function initDate() {
|
||||
var a = new Date,
|
||||
b = a.getFullYear(),
|
||||
c = ("0" + (a.getMonth() + 1)).slice(-2),
|
||||
d = ("0" + a.getDate()).slice(-2);
|
||||
SYSTEM.beginDate = b + "-" + c + "-01", SYSTEM.endDate = b + "-" + c + "-" + d
|
||||
}
|
||||
function addUrlParam() {
|
||||
var a = "beginDate=" + SYSTEM.beginDate + "&endDate=" + SYSTEM.endDate;
|
||||
$("#nav").find("li.item-report .nav-item a").each(function() {
|
||||
var b = this.href;
|
||||
b += -1 === this.href.lastIndexOf("?") ? "?" : "&", this.href = "商品库存余额表" === $(this).html() ? b + "beginDate=" + SYSTEM.startDate + "&endDate=" + SYSTEM.endDate : b + a
|
||||
})
|
||||
}
|
||||
function BBSPop() {
|
||||
var a = $("#yswb-tab"),
|
||||
b = ['<ul id="yswbPop">', '<li class="yswbPop-title">请选择您要进入的论坛</li>', '<li><strong>产品服务论坛</strong><p>在线会计,在线进销存操作问题咨询</p><a href="http://wpa.qq.com/msgrd?V=3&uin=209887082&Site=青城&Menu=yes" target="_blank">进入论坛>></a></li>', '<li><strong>会计交流论坛</strong><p>会计实操,会计学习,会计资讯</p><a href="http://wpa.qq.com/msgrd?V=3&uin=209887082&Site=青城&Menu=yes" target="_blank">进入论坛>></a></li>', "</ul>"].join("");
|
||||
a.find("a").click(function(a) {
|
||||
a.preventDefault();
|
||||
var c = $.cookie("yswbPop_scm");
|
||||
c ? window.open(c) : $.dialog({
|
||||
id: "",
|
||||
title: "",
|
||||
lock: !0,
|
||||
padding: 0,
|
||||
content: b,
|
||||
max: !1,
|
||||
min: !1,
|
||||
init: function() {
|
||||
var a = $("#yswbPop"),
|
||||
b = this;
|
||||
a.find("a").each(function() {
|
||||
$(this).on("click", function() {
|
||||
$.cookie("yswbPop_scm", this.href, {
|
||||
expires: 7
|
||||
}), b.close()
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
function getStores() {
|
||||
SYSTEM.isAdmin || SYSTEM.rights.CLOUDSTORE_QUERY ? Public.ajaxGet("http://wd.111222.com/bs/cloudStore.do?action=list", {}, function(a) {
|
||||
200 === a.status ? SYSTEM.storeInfo = a.data.items : 250 === a.status ? SYSTEM.storeInfo = [] : Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
}) : SYSTEM.storeInfo = []
|
||||
}
|
||||
function getLogistics() {
|
||||
SYSTEM.isAdmin || SYSTEM.rights.EXPRESS_QUERY ? Public.ajaxGet("http://wd.111222.com/bs/express.do?action=list", {}, function(a) {
|
||||
200 === a.status ? SYSTEM.logisticInfo = a.data.items : 250 === a.status ? SYSTEM.logisticInfo = [] : Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
}) : SYSTEM.logisticInfo = []
|
||||
}
|
||||
function setCurrentNav(a) {
|
||||
if (a) {
|
||||
var b = a.match(/([a-zA-Z]+)[-]?/)[1];
|
||||
$("#nav > li").removeClass("current"), $("#nav > li.item-" + b).addClass("current")
|
||||
}
|
||||
}
|
||||
var dataReflush, list = {
|
||||
onlineStoreMap: {
|
||||
name: "新手导航",
|
||||
href: WDURL + "/online-store/map.jsp?language=zh-CHS&site=SITE_MAIN&siId=" + SYSTEM.DBID + "&scheme=" + SCHEME + "&logonName=" + SYSTEM.userName,
|
||||
dataRight: "",
|
||||
target: "vip-onlineStore"
|
||||
},
|
||||
onlineStoreList: {
|
||||
name: "网店记录",
|
||||
href: WDURL + "/online-store/onlineStoreList.jsp?language=zh-CHS&site=SITE_MAIN&siId=" + SYSTEM.DBID + "&scheme=" + SCHEME + "&logonName=" + SYSTEM.userName,
|
||||
dataRight: "CLOUDSTORE_QUERY",
|
||||
target: "vip-onlineStore"
|
||||
},
|
||||
onlineStoreRelation: {
|
||||
name: "商品对应关系",
|
||||
href: WDURL + "/online-store/onlineStoreRelation.jsp?language=zh-CHS&site=SITE_MAIN&siId=" + SYSTEM.DBID + "&scheme=" + SCHEME + "&logonName=" + SYSTEM.userName,
|
||||
dataRight: "INVENTORYCLOUD_QUERY",
|
||||
target: "vip-onlineStore"
|
||||
},
|
||||
logisticsList: {
|
||||
name: "物流公司记录",
|
||||
href: WDURL + "/online-store/logisticsList.jsp?language=zh-CHS&site=SITE_MAIN&siId=" + SYSTEM.DBID + "&scheme=" + SCHEME + "&logonName=" + SYSTEM.userName,
|
||||
dataRight: "EXPRESS_QUERY",
|
||||
target: "vip-onlineStore"
|
||||
},
|
||||
orderHandle1: {
|
||||
name: "订单审核",
|
||||
href: WDURL + "/online-store/onlineOrderList.jsp?handle=1&language=zh-CHS&site=SITE_MAIN&siId=" + SYSTEM.DBID + "&scheme=" + SCHEME + "&logonName=" + SYSTEM.userName,
|
||||
dataRight: "ORDERCLOUD_QUERY",
|
||||
target: "vip-onlineStore"
|
||||
},
|
||||
orderHandle2: {
|
||||
name: "打单发货",
|
||||
href: WDURL + "/online-store/onlineOrderList.jsp?handle=2&language=zh-CHS&site=SITE_MAIN&siId=" + SYSTEM.DBID + "&scheme=" + SCHEME + "&logonName=" + SYSTEM.userName,
|
||||
dataRight: "ORDERCLOUD_QUERY",
|
||||
target: "vip-onlineStore"
|
||||
},
|
||||
orderHandle3: {
|
||||
name: "已发货",
|
||||
href: WDURL + "/online-store/onlineOrderList.jsp?handle=3&language=zh-CHS&site=SITE_MAIN&siId=" + SYSTEM.DBID + "&scheme=" + SCHEME + "&logonName=" + SYSTEM.userName,
|
||||
dataRight: "ORDERCLOUD_QUERY",
|
||||
target: "vip-onlineStore"
|
||||
},
|
||||
orderList: {
|
||||
name: "订单查询",
|
||||
href: WDURL + "/online-store/onlineOrderList.jsp?language=zh-CHS&site=SITE_MAIN&siId=" + SYSTEM.DBID + "&scheme=" + SCHEME + "&logonName=" + SYSTEM.userName,
|
||||
dataRight: "ORDERCLOUD_QUERY",
|
||||
target: "vip-onlineStore"
|
||||
},
|
||||
onlineSalesList: {
|
||||
name: "销货记录",
|
||||
href: "/scm/invSa.do?action=initSaleList",
|
||||
dataRight: "SA_QUERY",
|
||||
target: "vip-onlineStore"
|
||||
},
|
||||
JDStorageList: {
|
||||
name: "授权管理",
|
||||
href: "/JDStorage/JDStorageList.jsp",
|
||||
dataRight: "",
|
||||
target: "vip-JDStorage"
|
||||
},
|
||||
JDStorageGoodsList: {
|
||||
name: "商品上传管理",
|
||||
href: "/JDStorage/JDStorageGoodsList.jsp",
|
||||
dataRight: "",
|
||||
target: "vip-JDStorage"
|
||||
},
|
||||
JDStoragePurchaseOrderList: {
|
||||
name: "购货订单上传",
|
||||
href: "/JDStorage/JDStoragePurchaseOrderList.jsp",
|
||||
dataRight: "",
|
||||
target: "vip-JDStorage"
|
||||
},
|
||||
JDStorageSaleOrderList: {
|
||||
name: "销货订单上传",
|
||||
href: "/JDStorage/JDStorageSaleOrderList.jsp",
|
||||
dataRight: "",
|
||||
target: "vip-JDStorage"
|
||||
},
|
||||
JDStorageInvManage: {
|
||||
name: "京东库存",
|
||||
href: "/JDStorage/JDStorageInvManage.jsp",
|
||||
dataRight: "",
|
||||
target: "vip-JDStorage"
|
||||
},
|
||||
|
||||
purchase: {
|
||||
name: "购货单",
|
||||
href: "../scm/invPu?action=initPur",
|
||||
dataRight: "PU_ADD",
|
||||
target: "purchase",
|
||||
list: "../scm/invPu?action=initPurList"
|
||||
},
|
||||
purchaseBack: {
|
||||
name: "购货退货单",
|
||||
href: "../scm/invPu?action=initPur&transType=150502",
|
||||
dataRight: "PU_ADD",
|
||||
target: "purchase",
|
||||
list: "../scm/invPu?action=initPurList&transType=150502"
|
||||
},
|
||||
salesOrder: {
|
||||
name: "客户订单",
|
||||
href: "../scm/invSo?action=initSo",
|
||||
dataRight: "SO_ADD",
|
||||
target: "sales",
|
||||
list: "../scm/invSo?action=initSoList"
|
||||
},
|
||||
sales: {
|
||||
name: "销货单",
|
||||
href: "../scm/invSa?action=initSale",
|
||||
dataRight: "SA_ADD",
|
||||
target: "sales",
|
||||
list: "../scm/invSa?action=initSaleList"
|
||||
},
|
||||
salesBack: {
|
||||
name: "销货退货单",
|
||||
href: "../scm/invSa?action=initSale&transType=150602",
|
||||
dataRight: "SA_ADD",
|
||||
target: "sales",
|
||||
list: "../scm/invSa?action=initSaleList&transType=150602"
|
||||
},
|
||||
transfers: {
|
||||
name: "调拨单",
|
||||
href: "../scm/invTf?action=initTf",
|
||||
dataRight: "TF_ADD",
|
||||
target: "storage",
|
||||
list: "../scm/invTf?action=initTfList"
|
||||
},
|
||||
inventory: {
|
||||
name: "库存查询",
|
||||
href: "../storage/inventory",
|
||||
dataRight: "PD_GENPD",
|
||||
target: "storage"
|
||||
},
|
||||
otherWarehouse: {
|
||||
name: "其他入库单",
|
||||
href: "../scm/invOi?action=initOi&type=in",
|
||||
dataRight: "IO_ADD",
|
||||
target: "storage",
|
||||
list: "../scm/invOi?action=initOiList&type=in"
|
||||
},
|
||||
otherOutbound: {
|
||||
name: "其他出库单",
|
||||
href: "../scm/invOi?action=initOi&type=out",
|
||||
dataRight: "OO_ADD",
|
||||
target: "storage",
|
||||
list: "../scm/invOi?action=initOiList&type=out"
|
||||
},
|
||||
/*adjustment: {
|
||||
name: "成本调整单",
|
||||
href: "../scm/invOi?action=initOi&type=cbtz",
|
||||
dataRight: "CADJ_ADD",
|
||||
target: "storage",
|
||||
list: "../scm/invOi?action=initOiList&type=cbtz"
|
||||
},*/
|
||||
|
||||
|
||||
receipt: {
|
||||
name: "收款单",
|
||||
href: "../scm/receipt?action=initReceipt",
|
||||
dataRight: "RECEIPT_ADD",
|
||||
target: "money",
|
||||
list: "../scm/receipt?action=initReceiptList"
|
||||
},
|
||||
payment: {
|
||||
name: "付款单",
|
||||
href: "../scm/payment?action=initPay",
|
||||
dataRight: "PAYMENT_ADD",
|
||||
target: "money",
|
||||
list: "../scm/payment?action=initPayList"
|
||||
},
|
||||
//verification: {
|
||||
// name: "核销单",
|
||||
// href: "scm/verifica.do?action=initVerifica",
|
||||
// dataRight: "VERIFICA_ADD",
|
||||
// target: "money",
|
||||
// list: "../money/verification-list.jsp"
|
||||
// },
|
||||
otherIncome: {
|
||||
name: "其他收入单",
|
||||
href: "../scm/ori?action=initInc",
|
||||
dataRight: "QTSR_ADD",
|
||||
target: "money",
|
||||
list: "../scm/ori?action=initIncList"
|
||||
},
|
||||
otherExpense: {
|
||||
name: "其他支出单",
|
||||
href: "../scm/ori?action=initExp",
|
||||
dataRight: "QTZC_ADD",
|
||||
target: "money",
|
||||
list: "../scm/ori?action=initExpList"
|
||||
},
|
||||
|
||||
//puOrderTracking: {
|
||||
// name: "采购订单跟踪表",
|
||||
// href: "../report/pu_order_tracking",
|
||||
// dataRight: "PURCHASEORDER_QUERY",
|
||||
// target: "report-purchase"
|
||||
// },
|
||||
|
||||
|
||||
puDetail: {
|
||||
name: "采购明细表",
|
||||
href: "../report/pu_detail_new",
|
||||
dataRight: "PUREOORTDETAIL_QUERY",
|
||||
target: "report-purchase"
|
||||
},
|
||||
|
||||
//puDetail: {
|
||||
// name: "采购明细表",
|
||||
// href: "../report/puDetail_detail?action=detail",
|
||||
// dataRight: "PUREOORTDETAIL_QUERY",
|
||||
// target: "report-purchase"
|
||||
// },
|
||||
|
||||
puSummary: {
|
||||
name: "采购汇总表(按商品)",
|
||||
href: "../report/pu_summary_new",
|
||||
dataRight: "PUREPORTINV_QUERY",
|
||||
target: "report-purchase"
|
||||
},
|
||||
//puSummary: {
|
||||
// name: "采购汇总表(按商品)",
|
||||
// href: "../report/puDetail_inv?action=inv",
|
||||
// dataRight: "PUREPORTINV_QUERY",
|
||||
// target: "report-purchase"
|
||||
// },
|
||||
|
||||
|
||||
puSummarySupply: {
|
||||
name: "采购汇总表(按供应商)",
|
||||
href: "../report/pu_summary_supply_new",
|
||||
dataRight: "PUREPORTPUR_QUERY",
|
||||
target: "report-purchase"
|
||||
},
|
||||
//puSummarySupply: {
|
||||
// name: "采购汇总表(按供应商)",
|
||||
// href: "../report/puDetail_supply?action=supply",
|
||||
// dataRight: "PUREPORTPUR_QUERY",
|
||||
// target: "report-purchase"
|
||||
// },
|
||||
//salesOrderTracking: {
|
||||
// name: "销售订单跟踪表",
|
||||
// href: "../report/sales_order_tracking",
|
||||
// dataRight: "SALESORDER_QUERY",
|
||||
// target: "report-sales"
|
||||
// },
|
||||
salesDetail: {
|
||||
name: "销售明细表",
|
||||
href: "../report/sales_detail",
|
||||
dataRight: "SAREPORTDETAIL_QUERY",
|
||||
target: "report-sales"
|
||||
},
|
||||
salesSummary: {
|
||||
name: "销售汇总表(按商品)",
|
||||
href: "../report/sales_summary",
|
||||
dataRight: "SAREPORTINV_QUERY",
|
||||
target: "report-sales"
|
||||
},
|
||||
|
||||
salesSummaryCustomer: {
|
||||
name: "销售汇总表(按客户)",
|
||||
href: "../report/sales_summary_customer_new",
|
||||
dataRight: "SAREPORTBU_QUERY",
|
||||
target: "report-sales"
|
||||
},
|
||||
//salesSummaryCustomer: {
|
||||
// name: "销售汇总表(按客户)",
|
||||
// href: "../report/salesDetail_customer?action=customer",
|
||||
// dataRight: "SAREPORTBU_QUERY",
|
||||
// target: "report-sales"
|
||||
// },
|
||||
|
||||
contactDebt: {
|
||||
name: "往来单位欠款表",
|
||||
href: "../report/contact_debt_new",
|
||||
dataRight: "ContactDebtReport_QUERY",
|
||||
target: "report-sales"
|
||||
},
|
||||
salesProfit: {
|
||||
name: "销售利润表",
|
||||
href: "../report/sales_profit",
|
||||
dataRight: "SAREPORTINV_QUERY",
|
||||
target: "report-sales"
|
||||
},
|
||||
//contactDebt: {
|
||||
// name: "往来单位欠款表",
|
||||
// href: "../report/contactDebt_detail?action=detail",
|
||||
// dataRight: "ContactDebtReport_QUERY",
|
||||
// target: "report-sales"
|
||||
// },
|
||||
initialBalance: {
|
||||
name: "商品库存余额表",
|
||||
href: "../report/goods_balance",
|
||||
dataRight: "InvBalanceReport_QUERY",
|
||||
target: "report-storage"
|
||||
},
|
||||
goodsFlowDetail: {
|
||||
name: "商品收发明细表",
|
||||
href: "../report/goods_flow_detail",
|
||||
dataRight: "DeliverDetailReport_QUERY",
|
||||
target: "report-storage"
|
||||
},
|
||||
goodsFlowSummary: {
|
||||
name: "商品收发汇总表",
|
||||
href: "../report/goods_flow_summary",
|
||||
dataRight: "DeliverSummaryReport_QUERY",
|
||||
target: "report-storage"
|
||||
},
|
||||
serNumTracer: {
|
||||
name: "序列号跟踪表",
|
||||
href: WDURL + "/report/serNum-tracer.jsp",
|
||||
dataRight: "",
|
||||
target: "report-storage"
|
||||
},
|
||||
serNumStatus: {
|
||||
name: "序列号状态表",
|
||||
href: WDURL + "/report/serNum-status.jsp",
|
||||
dataRight: "",
|
||||
target: "report-storage"
|
||||
},
|
||||
cashBankJournal: {
|
||||
name: "现金银行报表",
|
||||
href: "../report/cash_bank_journal_new",
|
||||
dataRight: "SettAcctReport_QUERY",
|
||||
target: "report-money"
|
||||
},
|
||||
accountPayDetail: {
|
||||
name: "应付账款明细表",
|
||||
href: "../report/account_pay_detail_new?action=detailSupplier&type=10",
|
||||
dataRight: "PAYMENTDETAIL_QUERY",
|
||||
target: "report-money"
|
||||
},
|
||||
accountProceedsDetail: {
|
||||
name: "应收账款明细表",
|
||||
href: "../report/account_proceeds_detail_new?action=detail",
|
||||
dataRight: "RECEIPTDETAIL_QUERY",
|
||||
target: "report-money"
|
||||
},
|
||||
customersReconciliation: {
|
||||
name: "客户对账单",
|
||||
href: "../report/customers_reconciliation_new",
|
||||
dataRight: "CUSTOMERBALANCE_QUERY",
|
||||
target: "report-money"
|
||||
},
|
||||
suppliersReconciliation: {
|
||||
name: "供应商对账单",
|
||||
href: "../report/suppliers_reconciliation_new",
|
||||
dataRight: "SUPPLIERBALANCE_QUERY",
|
||||
target: "report-money"
|
||||
},
|
||||
|
||||
otherIncomeExpenseDetail: {
|
||||
name: "其他收支明细表",
|
||||
href: "../report/other_income_expense_detail",
|
||||
dataRight: "ORIDETAIL_QUERY",
|
||||
target: "report-money"
|
||||
},
|
||||
customerList: {
|
||||
name: "客户管理",
|
||||
href: "../settings/customer_list",
|
||||
dataRight: "BU_QUERY",
|
||||
target: "setting-base"
|
||||
},
|
||||
vendorList: {
|
||||
name: "供应商管理",
|
||||
href: "../settings/vendor_list",
|
||||
dataRight: "PUR_QUERY",
|
||||
target: "setting-base"
|
||||
},
|
||||
goodsList: {
|
||||
name: "商品管理",
|
||||
href: "../settings/goods_list",
|
||||
dataRight: "INVENTORY_QUERY",
|
||||
target: "setting-base"
|
||||
},
|
||||
storageList: {
|
||||
name: "仓库管理",
|
||||
href: "../settings/storage_list",
|
||||
dataRight: "INVLOCTION_QUERY",
|
||||
target: "setting-base"
|
||||
},
|
||||
staffList: {
|
||||
name: "职员管理",
|
||||
href: "../settings/staff_list",
|
||||
dataRight: "STAFF_QUERY",
|
||||
target: "setting-base"
|
||||
},
|
||||
settlementaccount: {
|
||||
name: "账户管理",
|
||||
href: "../settings/settlement_account",
|
||||
dataRight: "SettAcct_QUERY",
|
||||
target: "setting-base"
|
||||
},
|
||||
custLinkList: {
|
||||
name: "客户账号管理",
|
||||
href: "../settings/cst_list",
|
||||
dataRight: "STAFF_QUERY",
|
||||
target: "setting-base"
|
||||
},
|
||||
//shippingAddress: {
|
||||
// name: "发货地址管理",
|
||||
// href: "../settings/shippingaddress",
|
||||
// dataRight: "DELIVERYADDR_QUERY",
|
||||
// target: "setting-base"
|
||||
// },
|
||||
customerCategoryList: {
|
||||
name: "客户类别",
|
||||
href: "../settings/category_list?typeNumber=customertype",
|
||||
dataRight: "BUTYPE_QUERY",
|
||||
target: "setting-auxiliary"
|
||||
},
|
||||
vendorCategoryList: {
|
||||
name: "供应商类别",
|
||||
href: "../settings/category_list?typeNumber=supplytype",
|
||||
dataRight: "SUPPLYTYPE_QUERY",
|
||||
target: "setting-auxiliary"
|
||||
},
|
||||
goodsCategoryList: {
|
||||
name: "商品类别",
|
||||
href: "../settings/category_list?typeNumber=trade",
|
||||
dataRight: "TRADETYPE_QUERY",
|
||||
target: "setting-auxiliary"
|
||||
},
|
||||
|
||||
payCategoryList: {
|
||||
name: "支出类别",
|
||||
href: "../settings/category_list?typeNumber=paccttype",
|
||||
dataRight: "TRADETYPE_QUERY",
|
||||
target: "setting-auxiliary"
|
||||
},
|
||||
recCategoryList: {
|
||||
name: "收入类别",
|
||||
href: "../settings/category_list?typeNumber=raccttype",
|
||||
dataRight: "TRADETYPE_QUERY",
|
||||
target: "setting-auxiliary"
|
||||
},
|
||||
|
||||
unitList: {
|
||||
name: "计量单位",
|
||||
href: "../settings/unit_list",
|
||||
dataRight: "UNIT_QUERY",
|
||||
target: "setting-auxiliary"
|
||||
},
|
||||
settlementCL: {
|
||||
name: "结算方式",
|
||||
href: "../settings/settlement_category_list",
|
||||
dataRight: "Assist_QUERY",
|
||||
target: "setting-auxiliary"
|
||||
},
|
||||
assistingProp: {
|
||||
name: "辅助属性",
|
||||
href: "../settings/assistingprop",
|
||||
dataRight: "FZSX_QUERY",
|
||||
target: "setting-auxiliary"
|
||||
},
|
||||
parameter: {
|
||||
name: "系统参数",
|
||||
href: "../settings/system_parameter",
|
||||
dataRight: "PARAMETER",
|
||||
target: "setting-advancedSetting"
|
||||
},
|
||||
authority: {
|
||||
name: "权限设置",
|
||||
href: "../settings/authority",
|
||||
dataRight: "AUTHORITY",
|
||||
target: "setting-advancedSetting"
|
||||
},
|
||||
operationLog: {
|
||||
name: "操作日志",
|
||||
//href: WDURL + "/basedata/log/initloglist",
|
||||
href: "../settings/log",
|
||||
dataRight: "OPERATE_QUERY",
|
||||
target: "setting-advancedSetting"
|
||||
},
|
||||
//printTemplates: {
|
||||
// name: "套打模板",
|
||||
// href: "../settings/print_templates",
|
||||
// dataRight: "",
|
||||
// target: "setting-advancedSetting"
|
||||
// },
|
||||
backup: {
|
||||
name: "备份与恢复",
|
||||
href: "../settings/backup",
|
||||
dataRight: "",
|
||||
target: "setting-advancedSetting"
|
||||
}
|
||||
//backup: {
|
||||
// name: "备份与恢复",
|
||||
// href: "../settings/backup",
|
||||
// dataRight: "",
|
||||
// target: "setting-advancedSetting"
|
||||
// }
|
||||
//backup: {
|
||||
// name: "备份与恢复",
|
||||
// href: "../../ebak",
|
||||
// dataRight: "",
|
||||
// target: "setting-advancedSetting"
|
||||
// },
|
||||
//reInitial: {
|
||||
// name: "重新初始化",
|
||||
// href: "",
|
||||
// dataRight: "",
|
||||
// id: "reInitial",
|
||||
// target: "setting-advancedSetting-right"
|
||||
// },
|
||||
//addedServiceList: {
|
||||
// name: "增值服务",
|
||||
// href: "../settings/addedServiceList",
|
||||
// dataRight: "",
|
||||
// target: "setting-advancedSetting-right"
|
||||
// }
|
||||
},
|
||||
menu = {
|
||||
init: function(a, b) {
|
||||
var c = {
|
||||
callback: {}
|
||||
};
|
||||
this.obj = a, this.opts = $.extend(!0, {}, c, b), this.sublist = this.opts.sublist, this.sublist || this._getMenuData(), this._menuControl(), this._initDom(),$(".vip").length || $(".main-nav").css("margin", "5px 0")
|
||||
},
|
||||
_display: function(a, b) {
|
||||
for (var c = a.length - 1; c >= 0; c--) this.sublist[a[c]] && (this.sublist[a[c]].disable = !b);
|
||||
return this
|
||||
},
|
||||
_show: function(a) {
|
||||
return this._display(a, !0)
|
||||
},
|
||||
_hide: function(a) {
|
||||
return this._display(a, !1)
|
||||
},
|
||||
_getMenuData: function() {
|
||||
this.sublist = list
|
||||
},
|
||||
_menuControl: function() {
|
||||
var a = SYSTEM.siType,
|
||||
b = SYSTEM.isAdmin,
|
||||
c = SYSTEM.siVersion;
|
||||
switch (this._hide(["authority", "backup", "onlineStoreMap", "onlineStoreList", "onlineStoreRelation", "logisticsList", "orderHandle1", "orderHandle2", "orderHandle3", "orderList", "onlineSalesList", "JDStorageList", "JDStorageGoodsList", "JDStoragePurchaseOrderList", "JDStorageSaleOrderList", "JDStorageInvManage", "assistingProp", "serNumStatus", "serNumTracer"]), a) {
|
||||
//switch (this._hide(["authority", "reInitial", "backup", "onlineStoreMap", "onlineStoreList", "onlineStoreRelation", "logisticsList", "orderHandle1", "orderHandle2", "orderHandle3", "orderList", "onlineSalesList", "JDStorageList", "JDStorageGoodsList", "JDStoragePurchaseOrderList", "JDStorageSaleOrderList", "JDStorageInvManage", "assistingProp", "serNumStatus", "serNumTracer"]), a) {
|
||||
case 1:
|
||||
this._hide(["purchaseOrder", "purchaseOrderList", "salesOrder", "salesOrderList", "verification", "verificationList", "shippingAddress", "puOrderTracking", "salesOrderTracking", "assemble", "disassemble", "serNumStatus", "serNumTracer"]);
|
||||
break;
|
||||
case 2:
|
||||
}
|
||||
switch (c) {
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
this._hide(["backup"])
|
||||
}
|
||||
b && (3 == c && this._show(["reInitial"]), this._show(["authority"]), this._show(["backup"])), 2 == a && (1 == SYSTEM.hasOnlineStore ? this._show(["onlineStoreMap", "onlineStoreList", "onlineStoreRelation", "logisticsList", "orderHandle1", "orderHandle2", "orderHandle3", "orderList", "onlineSalesList"]) : 1 == SYSTEM.enableStorage && $(".vip-nav").width(125), 1 == SYSTEM.enableStorage ? this._show(["JDStorageList", "JDStorageGoodsList", "JDStoragePurchaseOrderList", "JDStorageSaleOrderList", "JDStorageInvManage"]) : 1 == SYSTEM.hasOnlineStore && $(".vip-nav").width(120), 1 == SYSTEM.enableAssistingProp && this._show(["assistingProp"])), 1 == SYSTEM.ISSERNUM && this._show(["serNumStatus", "serNumTracer"])
|
||||
},
|
||||
_getDom: function() {
|
||||
this.objCopy = this.obj.clone(!0), this.container = this.obj.closest("div")
|
||||
},
|
||||
_setDom: function() {
|
||||
this.obj.remove(), this.container.append(this.objCopy)
|
||||
},
|
||||
_initDom: function() {
|
||||
if (this.sublist && this.obj) {
|
||||
this.obj.find("li:not(.item)").remove(), this._getDom();
|
||||
var a = this.sublist,
|
||||
b = {};
|
||||
b.target = {};
|
||||
for (var c in a) if (!a[c].disable) {
|
||||
var d = a[c],
|
||||
e = b.target[d.target],
|
||||
f = d.id ? "id=" + d.id : "",
|
||||
g = d.id ? "" : "rel=pageTab",
|
||||
h = "";
|
||||
if (d.list) {
|
||||
var i = d.name + "记录";
|
||||
h = "<i " + f + ' tabTxt="' + i + '" tabid="' + d.target.split("-")[0] + "-" + c + 'List" ' + g + ' href="' + d.list + '" data-right="' + d.dataRight.split("_")[0] + '_QUERY">查询</i>'
|
||||
}
|
||||
if(d.name=="销售利润表"){
|
||||
var j = "<li><a " + f + ' tabTxt="' + d.name + '" tabid="' + d.target.split("-")[0] + "-" + c + '" ' + g + ' href="' + d.href + '" data-right="' + d.dataRight + '">' + d.name + h + "<span style='background:url(/statics/css/img/anew.gif) no-repeat 50%;display: inline-block;width: 30px;height: 16px;'></span></a></li>";
|
||||
e ? e.append(j) : (b.target[d.target] = this.objCopy.find("#" + d.target), b.target[d.target] && b.target[d.target].append(j))
|
||||
}else{
|
||||
var j = "<li><a " + f + ' tabTxt="' + d.name + '" tabid="' + d.target.split("-")[0] + "-" + c + '" ' + g + ' href="' + d.href + '" data-right="' + d.dataRight + '">' + d.name + h + "</a></li>";
|
||||
e ? e.append(j) : (b.target[d.target] = this.objCopy.find("#" + d.target), b.target[d.target] && b.target[d.target].append(j))
|
||||
}
|
||||
}
|
||||
this.objCopy.find("li.item").each(function() {
|
||||
var a = $(this);
|
||||
a.find("li").length || a.remove(), a.find(".nav-item").each(function() {
|
||||
var a = $(this);
|
||||
a.find("li").length || (a.hasClass("last") && a.prev().addClass("last"), a.remove())
|
||||
})
|
||||
}), this._setDom()
|
||||
}
|
||||
}
|
||||
};
|
||||
$(function() {
|
||||
$("#companyName").text(SYSTEM.companyName).prop("title", SYSTEM.companyName)
|
||||
}), setTabHeight(), $(window).bind("resize", function() {
|
||||
setTabHeight()
|
||||
}), function(a) {
|
||||
menu.init(a("#nav")), initDate(), addUrlParam(), BBSPop();
|
||||
var b = a("#nav"),
|
||||
c = a("#nav > li");
|
||||
a.each(c, function() {
|
||||
var c = a(this).find(".sub-nav-wrap");
|
||||
if (a(this).on("mouseenter", function() {
|
||||
b.removeClass("static"), a(this).addClass("on"), c.find("i:eq(0)").closest("li").addClass("on"), c.stop(!0, !0).fadeIn(250)
|
||||
}).on("mouseleave", function() {
|
||||
b.addClass("static"), a(this).removeClass("on"), c.stop(!0, !0).hide()
|
||||
}), 0 != c.length && "auto" == c.css("top") && "auto" == c.css("bottom")) {
|
||||
var d = (a(this).outerHeight() - c.outerHeight()) / 2;
|
||||
c.css({
|
||||
top: d
|
||||
})
|
||||
}
|
||||
}), a(".sub-nav-wrap a").bind("click", function() {
|
||||
a(this).parents(".sub-nav-wrap").hide()
|
||||
}), a(".sub-nav").each(function() {
|
||||
a(this).on("mouseover", "li", function() {
|
||||
var b = a(this);
|
||||
b.siblings().removeClass("on"), b.addClass("on")
|
||||
}).on("mouseleave", "li", function() {
|
||||
var b = a(this);
|
||||
b.removeClass("on")
|
||||
})
|
||||
})
|
||||
}(jQuery), $("#page-tab").ligerTab({
|
||||
height: "100%",
|
||||
changeHeightOnResize: !0,
|
||||
onBeforeAddTabItem: function(a) {
|
||||
setCurrentNav(a)
|
||||
},
|
||||
onAfterAddTabItem: function() {},
|
||||
onAfterSelectTabItem: function(a) {
|
||||
setCurrentNav(a)
|
||||
},
|
||||
onBeforeRemoveTabItem: function() {},
|
||||
onAfterLeaveTabItem: function(a) {
|
||||
switch (a) {
|
||||
case "setting-vendorList":
|
||||
getSupplier();
|
||||
break;
|
||||
case "setting-customerList":
|
||||
getCustomer();
|
||||
break;
|
||||
case "setting-storageList":
|
||||
getStorage();
|
||||
break;
|
||||
case "setting-goodsList":
|
||||
getGoods();
|
||||
break;
|
||||
case "setting-settlementaccount":
|
||||
getAccounts();
|
||||
break;
|
||||
case "setting-settlementCL":
|
||||
getPayments();
|
||||
break;
|
||||
case "onlineStore-onlineStoreList":
|
||||
break;
|
||||
case "onlineStore-logisticsList":
|
||||
break;
|
||||
case "setting-staffList":
|
||||
getStaff()
|
||||
}
|
||||
},
|
||||
onAfterSelectTabItem: function(a) {
|
||||
switch (a) {
|
||||
case "index":
|
||||
dataReflush && dataReflush()
|
||||
}
|
||||
}
|
||||
});
|
||||
var tab = $("#page-tab").ligerGetTabManager();
|
||||
$("#nav").on("click", "[rel=pageTab]", function(a) {
|
||||
a.preventDefault();
|
||||
var b = $(this).data("right");
|
||||
if (b && !Business.verifyRight(b)) return !1;
|
||||
var c = $(this).attr("tabid"),
|
||||
d = $(this).attr("href"),
|
||||
e = $(this).attr("showClose"),
|
||||
f = $(this).attr("tabTxt") || $(this).text().replace(">", ""),
|
||||
g = $(this).attr("parentOpen");
|
||||
return g ? parent.tab.addTabItem({
|
||||
tabid: c,
|
||||
text: f,
|
||||
url: d,
|
||||
showClose: e
|
||||
}) : tab.addTabItem({
|
||||
tabid: c,
|
||||
text: f,
|
||||
url: d,
|
||||
showClose: e
|
||||
}), !1
|
||||
}), tab.addTabItem({
|
||||
tabid: "index",
|
||||
text: "首页",
|
||||
url: "../home/main",
|
||||
showClose: !1
|
||||
}), function(a) {
|
||||
if (2 === SYSTEM.siVersion && SYSTEM.isOpen) {
|
||||
var b, c = location.protocol + "//" + location.host + "/update_info.jsp",
|
||||
d = '您的单据分录已经录入达到300条,继续使用选择<a href="http://wpa.qq.com/msgrd?V=3&uin=209887082&Site=青城&Menu=yes" target="_blank">购买产品</a>或者完善个人信息赠送1000条免费容量。';
|
||||
SYSTEM.isshortUser ? SYSTEM.isshortUser && (b = "http://wpa.qq.com/msgrd?V=3&uin=209887082&Site=青城&Menu=yes&updateUrl=" + encodeURIComponent(c) + "&warning=" + encodeURIComponent(d) + "&loginPage=http://wpa.qq.com/msgrd?V=3&uin=209887082&Site=青城&Menu=yes&", a.dialog({
|
||||
min: !1,
|
||||
max: !1,
|
||||
cancle: !1,
|
||||
lock: !0,
|
||||
width: 450,
|
||||
height: 490,
|
||||
title: "完善个人信息",
|
||||
content: "url:" + b
|
||||
})) : (b = "http://wpa.qq.com/msgrd?V=3&uin=209887082&Site=青城&Menu=yes&updateUrl=" + encodeURIComponent(c) + "&warning=" + encodeURIComponent(d), a.dialog({
|
||||
min: !1,
|
||||
max: !1,
|
||||
cancle: !1,
|
||||
lock: !0,
|
||||
width: 400,
|
||||
height: 280,
|
||||
title: "完善个人信息",
|
||||
content: "url:" + b
|
||||
}))
|
||||
}
|
||||
}(jQuery), $(window).load(function() {
|
||||
function a() {
|
||||
var a;
|
||||
switch (SYSTEM.siVersion) {
|
||||
case 3:
|
||||
a = "1";
|
||||
break;
|
||||
case 4:
|
||||
a = "3";
|
||||
break;
|
||||
default:
|
||||
a = "2"
|
||||
}
|
||||
$.getJSON("../home/Services?callback=?", {
|
||||
coid: SYSTEM.DBID,
|
||||
loginuserno: SYSTEM.UserName,
|
||||
version: a,
|
||||
type: "getallunreadcount" + SYSTEM.servicePro
|
||||
}, function(a) {
|
||||
if (0 != a.count) {
|
||||
{
|
||||
var b = $("#SysNews a");
|
||||
b.attr("href")
|
||||
}
|
||||
b.append("<span>" + a.count + "</span>"), 0 == a.syscount && b.data("tab", 2)
|
||||
}
|
||||
})
|
||||
}
|
||||
markupVension(), a(), $("#skin-" + SYSTEM.skin).addClass("select").append("<i></i>"), $("#sysSkin").powerFloat({
|
||||
eventType: "click",
|
||||
reverseSharp: !0,
|
||||
target: function() {
|
||||
return $("#selectSkin")
|
||||
},
|
||||
position: "5-7"
|
||||
}), $("#selectSkin li a").click(function() {
|
||||
var a = this.id.split("-")[1];
|
||||
Public.ajaxPost("../basedata/systemProfile/changeSysSkin?action=changeSysSkin", {
|
||||
skin: a
|
||||
}, function(a) {
|
||||
200 === a.status && window.location.reload()
|
||||
})
|
||||
});
|
||||
var b = $("#nav .item");
|
||||
if ($("#scollUp").click(function() {
|
||||
var a = b.filter(":visible");
|
||||
a.first().prev().length > 0 && (a.first().prev().show(500), a.last().hide())
|
||||
}), $("#scollDown").click(function() {
|
||||
var a = b.filter(":visible");
|
||||
a.last().next().length > 0 && (a.first().hide(), a.last().next().show(500))
|
||||
}), $(".service-tab").click(function() {
|
||||
var a = $(this).data("tab");
|
||||
tab.addTabItem({
|
||||
tabid: "myService",
|
||||
text: "服务支持",
|
||||
url: "../service",
|
||||
callback: function() {
|
||||
document.getElementById("myService").contentWindow.openTab(a)
|
||||
}
|
||||
})
|
||||
}), $.cookie("ReloadTips") && (Public.tips({
|
||||
content: $.cookie("ReloadTips")
|
||||
}), $.cookie("ReloadTips", null)), $("#nav").on("click", "#reInitial", function(a) {
|
||||
a.preventDefault(), $.dialog({
|
||||
lock: !0,
|
||||
width: 430,
|
||||
height: 180,
|
||||
title: "系统提示",
|
||||
content: '<div class="re-initialize"><h3>重新初始化系统将会清空你录入的所有数据,请慎重!</h3><ul><li>系统将删除您新增的所有商品、供应商、客户</li><li>系统将删除您录入的所有单据</li><li>系统将删除您录入的所有初始化数据</li></ul><p><input type="checkbox" id="understand" /><label for="understand">我已清楚了解将产生的后果</label></p><p class="check-confirm">(请先确认并勾选“我已清楚了解将产生的后果”)</p></div>',
|
||||
icon: "alert.gif",
|
||||
okVal: "重新初始化",
|
||||
ok: function() {
|
||||
if ($("#understand").is(":checked")) {
|
||||
this.close();
|
||||
var a = $.dialog.tips("正在重新初始化,请稍候...", 1e3, "loading.gif", !0).show();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "../service/recover?siId=" + SYSTEM.DBID + "&userName=" + SYSTEM.userName,
|
||||
cache: !1,
|
||||
async: !0,
|
||||
dataType: "json",
|
||||
success: function(b) {
|
||||
200 === b.status && ($("#container").html(""), a.close(), window.location.href = "../home/index?re-initial=true&serviceType=" + SYSTEM.serviceType)
|
||||
},
|
||||
error: function(a) {
|
||||
Public.tips({
|
||||
type: 1,
|
||||
content: "操作失败了哦!" + a
|
||||
})
|
||||
}
|
||||
})
|
||||
} else $(".check-confirm").css("visibility", "visible");
|
||||
return !1
|
||||
},
|
||||
cancelVal: "放弃",
|
||||
cancel: !0
|
||||
})
|
||||
}), SYSTEM.siExpired) {
|
||||
var c = [{
|
||||
name: "立即续费",
|
||||
focus: !0,
|
||||
callback: function() {
|
||||
window.open("http://wpa.qq.com/msgrd?V=3&uin=209887082&Site=青城&Menu=yes&zh-CHS&accIds=" + SYSTEM.DBID)
|
||||
}
|
||||
}, {
|
||||
name: "下次再说"
|
||||
}],
|
||||
d = ['<div class="ui-dialog-tips">', "<p>谢谢您使用本产品,您的当前服务已经到期,到期3个月后数据将被自动清除,如需继续使用请购买/续费!</p>", '<p style="color:#AAA; font-size:12px;">(续费后请刷新页面或重新登录。)</p>', "</div>"].join("");
|
||||
$.dialog({
|
||||
width: 400,
|
||||
min: !1,
|
||||
max: !1,
|
||||
title: "系统提示",
|
||||
fixed: !0,
|
||||
lock: !0,
|
||||
button: c,
|
||||
resize: !1,
|
||||
content: d
|
||||
})
|
||||
}
|
||||
});
|
||||
1315
statics/js/dist/disassemble.js
vendored
Executable file
1315
statics/js/dist/disassemble.js
vendored
Executable file
File diff suppressed because it is too large
Load Diff
251
statics/js/dist/disassembleList.js
vendored
Executable file
251
statics/js/dist/disassembleList.js
vendored
Executable file
@@ -0,0 +1,251 @@
|
||||
var queryConditions = {
|
||||
matchCon: ""
|
||||
},
|
||||
system = parent.SYSTEM,
|
||||
qtyPlaces = Number(parent.SYSTEM.qtyPlaces),
|
||||
pricePlaces = Number(parent.SYSTEM.pricePlaces),
|
||||
amountPlaces = Number(parent.SYSTEM.amountPlaces),
|
||||
hiddenAmount = !1;
|
||||
system.isAdmin !== !1 || system.rights.AMOUNT_COSTAMOUNT || (hiddenAmount = !0);
|
||||
var THISPAGE = {
|
||||
init: function() {
|
||||
this.initDom(), this.loadGrid(), this.addEvent()
|
||||
},
|
||||
initDom: function() {
|
||||
this.$_matchCon = $("#matchCon"), this.$_beginDate = $("#beginDate").val(system.beginDate), this.$_endDate = $("#endDate").val(system.endDate), this.$_matchCon.placeholder(), this.$_beginDate.datepicker(), this.$_endDate.datepicker()
|
||||
},
|
||||
loadGrid: function() {
|
||||
function a(a, b, c) {
|
||||
var d = '<div class="operating" data-id="' + c.id + '"><span class="ui-icon ui-icon-pencil" title="修改"></span><span class="ui-icon ui-icon-trash" title="删除"></span></div>';
|
||||
return d
|
||||
}
|
||||
function b(a, b) {
|
||||
var c;
|
||||
if (c = "unitCosts" === b.colModel.name && a ? $.map(a, function(a) {
|
||||
return Number(a).toFixed(pricePlaces)
|
||||
}) : "costs" === b.colModel.name && a ? $.map(a, function(a) {
|
||||
return Number(a).toFixed(amountPlaces)
|
||||
}) : a) var d = c.join('<p class="line" />');
|
||||
return d || " "
|
||||
}
|
||||
var c = Public.setGrid();
|
||||
queryConditions.beginDate = this.$_beginDate.val(), queryConditions.endDate = this.$_endDate.val(), $("#grid").jqGrid({
|
||||
url: "/scm/invOi.do?action=listCx&type=cx",
|
||||
postData: queryConditions,
|
||||
datatype: "json",
|
||||
autowidth: !0,
|
||||
height: c.h,
|
||||
altRows: !0,
|
||||
gridview: !0,
|
||||
multiselect: !0,
|
||||
multiboxonly: !0,
|
||||
colModel: [{
|
||||
name: "operating",
|
||||
label: "操作",
|
||||
width: 60,
|
||||
fixed: !0,
|
||||
formatter: a,
|
||||
align: "center",
|
||||
title: !1
|
||||
}, {
|
||||
name: "billDate",
|
||||
label: "单据日期",
|
||||
width: 80,
|
||||
align: "center",
|
||||
title: !1
|
||||
}, {
|
||||
name: "billNo",
|
||||
label: "单据编号",
|
||||
width: 120,
|
||||
align: "center",
|
||||
title: !1
|
||||
}, {
|
||||
name: "good",
|
||||
label: "组合件",
|
||||
width: 200,
|
||||
title: !0,
|
||||
classes: "ui-ellipsis"
|
||||
}, {
|
||||
name: "qty",
|
||||
label: "组合件数量",
|
||||
width: 80,
|
||||
title: !1
|
||||
}, {
|
||||
name: "mainUnit",
|
||||
label: "单位",
|
||||
width: 35,
|
||||
title: !1,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "unitCost",
|
||||
label: "组合件单位成本",
|
||||
width: 100,
|
||||
title: !1,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
showZero: !0,
|
||||
decimalPlaces: pricePlaces
|
||||
},
|
||||
hidden: hiddenAmount
|
||||
}, {
|
||||
name: "cost",
|
||||
label: "组合件成本",
|
||||
width: 80,
|
||||
title: !1,
|
||||
align: "right",
|
||||
hidden: hiddenAmount
|
||||
}, {
|
||||
name: "goods",
|
||||
label: "子件",
|
||||
index: "userName",
|
||||
formatter: b,
|
||||
width: 200,
|
||||
fixed: !0,
|
||||
title: !0,
|
||||
classes: "ui-ellipsis"
|
||||
}, {
|
||||
name: "qtys",
|
||||
label: "子件数量",
|
||||
width: 80,
|
||||
formatter: b,
|
||||
classes: "ui-ellipsis"
|
||||
}, {
|
||||
name: "mainUnits",
|
||||
label: "单位",
|
||||
width: 35,
|
||||
formatter: b,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "unitCosts",
|
||||
label: "子件单位成本",
|
||||
width: 100,
|
||||
formatter: b,
|
||||
classes: "ui-ellipsis",
|
||||
align: "right",
|
||||
hidden: hiddenAmount
|
||||
}, {
|
||||
name: "costs",
|
||||
label: "子件成本",
|
||||
width: 80,
|
||||
formatter: b,
|
||||
classes: "ui-ellipsis",
|
||||
align: "right",
|
||||
hidden: hiddenAmount
|
||||
}, {
|
||||
name: "description",
|
||||
label: "备注",
|
||||
width: 200,
|
||||
classes: "ui-ellipsis"
|
||||
}],
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "number",
|
||||
sortorder: "desc",
|
||||
pager: "#page",
|
||||
rowNum: 100,
|
||||
rowList: [100, 200, 500],
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
forceFit: !1,
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
records: "data.records",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
loadError: function() {},
|
||||
ondblClickRow: function(a) {
|
||||
$("#" + a).find(".ui-icon-pencil").trigger("click")
|
||||
}
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
$("#grid").jqGrid("setGridParam", {
|
||||
url: "/scm/invOi.do?action=listCx&type=cx",
|
||||
datatype: "json",
|
||||
postData: a
|
||||
}).trigger("reloadGrid")
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
$(".grid-wrap").on("click", ".ui-icon-pencil", function(a) {
|
||||
a.preventDefault();
|
||||
var b = $(this).parent().data("id");
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-disassemble",
|
||||
text: "拆卸单",
|
||||
url: "/storage/disassemble.jsp?id=" + b
|
||||
});
|
||||
$("#grid").jqGrid("getDataIDs");
|
||||
parent.salesListIds = $("#grid").jqGrid("getDataIDs")
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-trash", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("CXD_DELETE")) {
|
||||
var b = $(this).parent().data("id");
|
||||
$.dialog.confirm("您确定要删除该拆卸记录吗?", function() {
|
||||
Public.ajaxGet("/scm/invOi.do?action=deleteCx", {
|
||||
id: b
|
||||
}, function(a) {
|
||||
200 === a.status ? ($("#grid").jqGrid("delRowData", b), parent.Public.tips({
|
||||
content: "删除成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}), $("#search").click(function() {
|
||||
queryConditions.matchCon = "请输入单据号或备注" === a.$_matchCon.val() ? "" : a.$_matchCon.val(), queryConditions.beginDate = a.$_beginDate.val(), queryConditions.endDate = a.$_endDate.val(), THISPAGE.reloadData(queryConditions)
|
||||
}), $("#moreCon").click(function() {
|
||||
queryConditions.matchCon = a.$_matchCon.val(), queryConditions.beginDate = a.$_beginDate.val(), queryConditions.endDate = a.$_endDate.val(), $.dialog({
|
||||
id: "moreCon",
|
||||
width: 480,
|
||||
height: 330,
|
||||
min: !1,
|
||||
max: !1,
|
||||
title: "高级搜索",
|
||||
button: [{
|
||||
name: "确定",
|
||||
focus: !0,
|
||||
callback: function() {
|
||||
queryConditions = this.content.handle(queryConditions), THISPAGE.reloadData(queryConditions), a.$_matchCon.val("" !== queryConditions.matchCon ? queryConditions.matchCon : "请输入单据号或备注"), a.$_beginDate.val(queryConditions.beginDate), a.$_endDate.val(queryConditions.endDate)
|
||||
}
|
||||
}, {
|
||||
name: "取消"
|
||||
}],
|
||||
resize: !1,
|
||||
content: "url:/storage/assemble-search.jsp?type=transfers",
|
||||
data: queryConditions
|
||||
})
|
||||
}), $(".wrapper").on("click", "#print", function(a) {
|
||||
a.preventDefault(), Business.verifyRight("CXD_PRINT") && Public.print({
|
||||
title: "拆卸单列表",
|
||||
$grid: $("#grid"),
|
||||
pdf: "/scm/invOi.do?action=toCxdPdf",
|
||||
billType: 10429,
|
||||
filterConditions: queryConditions
|
||||
})
|
||||
}), $("#add").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("CXD_ADD") && parent.tab.addTabItem({
|
||||
tabid: "storage-disassemble",
|
||||
text: "拆卸单",
|
||||
url: "/scm/invOi.do?action=initOi&type=cx"
|
||||
})
|
||||
}), $(window).resize(function() {
|
||||
Public.resizeGrid()
|
||||
}), $(".wrapper").on("click", "#export", function(a) {
|
||||
if (!Business.verifyRight("CXD_EXPORT")) return void a.preventDefault();
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow"),
|
||||
c = b.join(),
|
||||
d = c ? "&id=" + c : "";
|
||||
for (var e in queryConditions) queryConditions[e] && (d += "&" + e + "=" + queryConditions[e]);
|
||||
var f = "/scm/invOi.do?action=exportInvCxd" + d;
|
||||
$(this).attr("href", f)
|
||||
})
|
||||
}
|
||||
};
|
||||
THISPAGE.init();
|
||||
150
statics/js/dist/fileUpload.js
vendored
Executable file
150
statics/js/dist/fileUpload.js
vendored
Executable file
@@ -0,0 +1,150 @@
|
||||
//调试 打印对象
|
||||
function dump_obj(myObject) {
|
||||
var s = "";
|
||||
for (var property in myObject) {
|
||||
s = s + "\n "+property +": " + myObject[property] ;
|
||||
}
|
||||
alert(s);
|
||||
}
|
||||
$(function() {
|
||||
var a = {
|
||||
fileList: {},
|
||||
api: frameElement.api,
|
||||
page: {
|
||||
$container: $(".container"),
|
||||
$upfile: $("#upfile"),
|
||||
$content: $(".content"),
|
||||
$progress: $("#progress"),
|
||||
$fileinputButton: $("#fileinput-button"),
|
||||
uploadLock: !1
|
||||
},
|
||||
init: function() {
|
||||
try {
|
||||
document.domain = thisDomain
|
||||
} catch (a) {}
|
||||
this.initUpload(), this.initPopBtns(), this.initEvent(), this.initDom()
|
||||
},
|
||||
initDom: function() {
|
||||
var b = a.api.data || {};
|
||||
b.id && Public.ajaxPost("../basedata/inventory/getImagesById", {
|
||||
id: b.id
|
||||
}, function(b) {
|
||||
200 == b.status ? a.addImgDiv(b.files) : parent.parent.Public.tips({
|
||||
type: 1,
|
||||
content: "获取商品图片失败!"
|
||||
})
|
||||
})
|
||||
},
|
||||
initPopBtns: function() {
|
||||
var b = ["保存", "关闭"];
|
||||
this.api.button({
|
||||
id: "ok",
|
||||
name: b[0],
|
||||
focus: !0,
|
||||
callback: function() {
|
||||
return a.postData(), !1
|
||||
}
|
||||
}, {
|
||||
id: "cancel",
|
||||
name: b[1]
|
||||
})
|
||||
},
|
||||
postData: function() {
|
||||
var b = a.api.data || {},
|
||||
c = (b.callback, a.getCurrentFiles()),
|
||||
d = [];
|
||||
for (var e in c) d.push(c[e]);
|
||||
if (b.id) {
|
||||
var f = {
|
||||
id: b.id,
|
||||
files: d
|
||||
};
|
||||
Public.ajaxPost("../basedata/inventory/addImagesToInv?action=addImagesToInv", {
|
||||
postData: JSON.stringify(f)
|
||||
}, function(a) {
|
||||
parent.parent.Public.tips(200 == a.status ? {
|
||||
content: "保存商品图片成功!"
|
||||
} : {
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
initEvent: function() {
|
||||
var b = this.page;
|
||||
b.$container.on("click", ".uploading", function() {
|
||||
parent.parent.Public.tips({
|
||||
type: 2,
|
||||
content: "正在上传,请稍等!"
|
||||
})
|
||||
}), b.$container.on("mouseenter", ".imgDiv", function() {
|
||||
$(this).addClass("hover")
|
||||
}), b.$container.on("mouseleave", ".imgDiv", function() {
|
||||
$(this).removeClass("hover")
|
||||
}), b.$container.on("click", ".del", function(b) {
|
||||
b.stopPropagation();
|
||||
var c = $(this).closest(".imgDiv").hide().data("pid");
|
||||
a.fileList[c].status = 0
|
||||
}), b.$container.on("click", "img", function() {
|
||||
var a = $(this),
|
||||
b = a.prop("src");
|
||||
window.open(b)
|
||||
})
|
||||
},
|
||||
initUpload: function() {
|
||||
var b = this.page;
|
||||
b.liList = b.$content.find("li");
|
||||
b.$upfile.fileupload({
|
||||
url: "../basedata/inventory/uploadImages",
|
||||
maxFileSize: 5e6,
|
||||
sequentialUploads: !0,
|
||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|png|bmp)$/i,
|
||||
dataType: "json",
|
||||
done: function(b, c) {
|
||||
200 != c.result.status ? parent.parent.Public.tips({
|
||||
type: 2,
|
||||
content: c.result.msg || "上传失败!"
|
||||
}) : a.addImgDiv(c.result.files)
|
||||
},
|
||||
add: function(a, c) {
|
||||
$.each(c.files, function() {
|
||||
b.$fileinputButton.addClass("uploading"), c.submit()
|
||||
})
|
||||
},
|
||||
beforeSend: function() {
|
||||
"775px" === $("#progress .bar").css("width") && $("#progress .bar").css("width", "0")
|
||||
},
|
||||
progressall: function(a, c) {
|
||||
var d = parseInt(c.loaded / c.total * 100, 10);
|
||||
$("#progress .bar").stop().animate({
|
||||
width: d + "%"
|
||||
}, 1e3), 100 == d && b.$fileinputButton.removeClass("uploading")
|
||||
}
|
||||
})
|
||||
},
|
||||
addImgDiv: function(b) {
|
||||
$.each(b, function(b, c) {
|
||||
a.fileList[c.pid] = c;
|
||||
var d = a.getHeightMinLi();
|
||||
if (d) {
|
||||
var e = $('<div class="imgDiv" data-pid="' + c.pid + '"><p class="imgControl"><span class="del">X</span></p><img src="' + c.url + '" alt="' + c.name + '"/></div>');
|
||||
d.append(e)
|
||||
}
|
||||
}), $(".img-warp").animate({
|
||||
scrollTop: $("body")[0].scrollHeight
|
||||
}, 500)
|
||||
},
|
||||
getHeightMinLi: function() {
|
||||
var a, b = this.page;
|
||||
return b.liList.each(function() {
|
||||
var b = $(this);
|
||||
a ? b.height() < a.height() && (a = b) : a = b
|
||||
}), a
|
||||
},
|
||||
getCurrentFiles: function() {
|
||||
return this.fileList
|
||||
}
|
||||
};
|
||||
a.init()
|
||||
});
|
||||
168
statics/js/dist/goodsBalance.js
vendored
Executable file
168
statics/js/dist/goodsBalance.js
vendored
Executable file
@@ -0,0 +1,168 @@
|
||||
define(["jquery", "print"], function(a) {
|
||||
function b() {
|
||||
Business.filterGoods(), Business.filterStorage(), h("#filter-fromDate").attr("disabled", "disabled"), h("#filter-toDate").datepicker();
|
||||
var a = Public.urlParam();
|
||||
chkboxes = h("#chk-wrap").cssCheckbox(), i.enableAssistingProp || h("#chk-wrap").hide(), a = {
|
||||
beginDate: j.startDate || a.beginDate,
|
||||
endDate: a.endDate,
|
||||
goods: a.goods || "",
|
||||
goodsNo: a.goodsNo || "",
|
||||
storage: a.storage || "",
|
||||
storageNo: a.storageNo || ""
|
||||
}, "1" === a.showSku && h('#chk-wrap input[name="showSku"]').attr("checked", !0), h("#filter-fromDate").val(a.beginDate || ""), h("#filter-toDate").val(a.endDate || ""), l = Public.categoryTree(h("#filterCat"), {
|
||||
width: 200
|
||||
})
|
||||
}
|
||||
function c() {
|
||||
h("#refresh").click(function(a) {
|
||||
a.preventDefault();
|
||||
var b = h("#filter-fromDate").val(),
|
||||
c = h("#filter-toDate").val();
|
||||
if (b && c && new Date(b).getTime() > new Date(c).getTime()) return parent.Public.tips({
|
||||
type: 1,
|
||||
content: "开始日期不能大于结束日期"
|
||||
}), !1;
|
||||
k = {
|
||||
beginDate: b,
|
||||
endDate: c,
|
||||
goods: h("#filter-goods input").data("ids") || "",
|
||||
goodsNo: h("#filter-goods input").val() || "",
|
||||
storage: h("#filter-storage input").data("ids") || "",
|
||||
storageNo: h("#filter-storage input").val() || "",
|
||||
catId: l.getValue(),
|
||||
catName: l.getText()
|
||||
}, chkVals = chkboxes.chkVal();
|
||||
for (var e = 0, f = chkVals.length; f > e; e++) k[chkVals[e]] = 1;
|
||||
var g = h.dialog.tips("正在查询,请稍候...", 1e3, "loading.gif", !0);
|
||||
Public.ajaxGet("../report/invBalance?action=detail", k, function(a) {
|
||||
200 === a.status ? (h(".no-query").remove(), h(".ui-print").show(), d(a.data), g.close(), h(".grid-subtitle").text(k.beginDate + "至" + c)) : (g.close(), parent.Public.tips({
|
||||
type: 1,
|
||||
content: msg
|
||||
}))
|
||||
})
|
||||
}), k.search && h("#refresh").trigger("click"), h("#btn-print").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("InvBalanceReport_PRINT") && window.print()
|
||||
}), h("#btn-export").click(function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("InvBalanceReport_EXPORT")) {
|
||||
var b = {};
|
||||
for (var c in k) k[c] && (b[c] = k[c]);
|
||||
Business.getFile("../report/invBalance_exporter?action=exporter", b)
|
||||
}
|
||||
})
|
||||
}
|
||||
function d(a) {
|
||||
h("#grid").jqGrid("GridUnload");
|
||||
for (var b = "auto", c = [{
|
||||
name: "invNo",
|
||||
label: "商品编号",
|
||||
width: 80
|
||||
}, {
|
||||
name: "invName",
|
||||
label: "商品名称",
|
||||
width: 200,
|
||||
classes: "ui-ellipsis",
|
||||
title: !0
|
||||
}, {
|
||||
name: "spec",
|
||||
label: "规格型号",
|
||||
width: 60,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "unit",
|
||||
label: "单位",
|
||||
width: 40,
|
||||
align: "center"
|
||||
}], d = a.colIndex, e = a.colNames, i = a.stoNames, j = [], k = "", l = 0, n = 4, o = d.length; o > n; n++) {
|
||||
var p = null;
|
||||
p = {
|
||||
name: d[n],
|
||||
label: e[n],
|
||||
width: 80,
|
||||
align: "right"
|
||||
}, c.push(p), d[n].split("_")[1] === k ? (j.pop(), j.push({
|
||||
startColumnName: d[n - 1],
|
||||
numberOfColumns: 2,
|
||||
titleText: i[l - 1]
|
||||
})) : (j.push({
|
||||
startColumnName: d[n],
|
||||
numberOfColumns: 1,
|
||||
titleText: i[l]
|
||||
}), l++), k = d[n].split("_")[1]
|
||||
}
|
||||
h("#grid").jqGrid({
|
||||
ajaxGridOptions: {
|
||||
complete: function() {}
|
||||
},
|
||||
data: a.rows,
|
||||
datatype: "local",
|
||||
autowidth: !0,
|
||||
height: b,
|
||||
gridview: !0,
|
||||
colModel: c,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "date",
|
||||
sortorder: "desc",
|
||||
rowNum: 3e3,
|
||||
loadonce: !0,
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
footerrow: !0,
|
||||
userData: a.userdata,
|
||||
userDataOnFooter: !0,
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
records: "data.records",
|
||||
total: "data.total",
|
||||
userdata: "data.userdata",
|
||||
repeatitems: !1,
|
||||
id: "0"
|
||||
},
|
||||
ondblClickRow: function() {},
|
||||
loadComplete: function(a) {
|
||||
var b = m = a.records,
|
||||
c = g();
|
||||
b > Math.floor(c / 31).toFixed(0) && (h("#grid").jqGrid("setGridHeight", c), h("#grid").jqGrid("setGridWidth", f(), !1))
|
||||
},
|
||||
gridComplete: function() {}
|
||||
|
||||
}).jqGrid("setGroupHeaders", {
|
||||
useColSpanStyle: !0,
|
||||
groupHeaders: j
|
||||
}).jqGrid("setFrozenColumns")
|
||||
}
|
||||
function e() {
|
||||
var a = f(),
|
||||
b = g(),
|
||||
c = h("#grid");
|
||||
m > Math.floor(b / 31).toFixed(0) ? c.jqGrid("setGridHeight", b) : c.jqGrid("setGridHeight", "auto"), c.jqGrid("setGridWidth", a, !1)
|
||||
}
|
||||
function f() {
|
||||
return h(window).width() - (f.offsetLeft || (f.offsetLeft = h("#grid-wrap").offset().left)) - 36 - 22
|
||||
}
|
||||
function g() {
|
||||
return h(window).height() - (g.offsetTop = h("#grid").offset().top) - 36 - 16
|
||||
}
|
||||
var h = a("jquery"),
|
||||
i = parent.SYSTEM,
|
||||
j = i,
|
||||
k = h.extend({
|
||||
beginDate: "",
|
||||
endDate: "",
|
||||
goodsNo: "",
|
||||
storageNo: "",
|
||||
showSku: "0"
|
||||
}, Public.urlParam()),
|
||||
l = null,
|
||||
m = 0;
|
||||
a("print"), b(), c();
|
||||
var n;
|
||||
h(window).on("resize", function() {
|
||||
n || (n = setTimeout(function() {
|
||||
e(), n = null
|
||||
}, 50))
|
||||
})
|
||||
});
|
||||
414
statics/js/dist/goodsBatch.js
vendored
Executable file
414
statics/js/dist/goodsBatch.js
vendored
Executable file
@@ -0,0 +1,414 @@
|
||||
function callbackSp() {
|
||||
var a = parent.THISPAGE || api.data.page,
|
||||
b = a.curID,
|
||||
c = (a.newId, "fix1"),
|
||||
d = (api.data.callback, $("#grid").jqGrid("getGridParam", "selarrrow")),
|
||||
e = d.length,
|
||||
f = oldRow = parent.curRow,
|
||||
g = parent.curCol;
|
||||
if (e > 0) {
|
||||
parent.$("#fixedGrid").jqGrid("restoreCell", f, g);
|
||||
var h = Public.getDefaultPage(),
|
||||
i = $("#grid").jqGrid("getRowData", d[0]);
|
||||
if (i.id = i.id.split("_")[0], h.SYSTEM.goodsInfo.push(i), "" === i.spec) var j = i.number + " " + i.name;
|
||||
else var j = i.number + " " + i.name + "_" + i.spec;
|
||||
var k = $.extend(!0, {}, i);
|
||||
if (k.goods = j, k.id = c, b) var l = parent.$("#fixedGrid").jqGrid("setRowData", b, {});
|
||||
l && parent.$("#" + b).data("goodsInfo", i).data("storageInfo", {
|
||||
id: i.locationId,
|
||||
name: i.locationName
|
||||
}).data("unitInfo", {
|
||||
unitId: i.unitId,
|
||||
name: i.unitName
|
||||
}), parent.$("#fixedGrid").jqGrid("setRowData", c, k)
|
||||
}
|
||||
return d
|
||||
}
|
||||
function callback() {
|
||||
var a = parent.THISPAGE || api.data.page,
|
||||
b = a.curID,
|
||||
c = a.newId,
|
||||
d = api.data.callback,
|
||||
e = $("#grid").jqGrid("getGridParam", "selarrrow"),
|
||||
f = e.length,
|
||||
g = oldRow = parent.curRow,
|
||||
h = parent.curCol;
|
||||
if (isSingle) {
|
||||
parent.$("#grid").jqGrid("restoreCell", g, h);
|
||||
var i = $("#grid").jqGrid("getRowData", $("#grid").jqGrid("getGridParam", "selrow"));
|
||||
if (i.id = i.id.split("_")[0], delete i.amount, defaultPage.SYSTEM.goodsInfo.push(i), "" === i.spec) var j = i.number + " " + i.name;
|
||||
else var j = i.number + " " + i.name + "_" + i.spec;
|
||||
if (g > 8 && g > oldRow) var k = g;
|
||||
else var k = b;
|
||||
var l = parent.$("#grid").jqGrid("getRowData", Number(b));
|
||||
l = $.extend({}, l, {
|
||||
id: i.id,
|
||||
goods: j,
|
||||
invNumber: i.number,
|
||||
invName: i.name,
|
||||
unitName: i.unitName,
|
||||
qty: 1,
|
||||
price: i.salePrice,
|
||||
spec: i.spec,
|
||||
skuId: i.skuId,
|
||||
skuName: i.skuName,
|
||||
isSerNum: i.isSerNum
|
||||
});
|
||||
var m = $.extend(!0, {}, l);
|
||||
parent.$("#" + k).data("goodsInfo", m).data("storageInfo", {
|
||||
id: i.locationId,
|
||||
name: i.locationName
|
||||
}).data("unitInfo", {
|
||||
unitId: i.unitId,
|
||||
name: i.unitName
|
||||
}), d(k, l)
|
||||
} else if (f > 0) {
|
||||
parent.$("#grid").jqGrid("restoreCell", g, h);
|
||||
for (rowid in addList) {
|
||||
var i = addList[rowid];
|
||||
if (i.id = i.id.split("_")[0], delete i.amount, defaultPage.SYSTEM.goodsInfo.push(i), "" === i.spec) var j = i.number + " " + i.name;
|
||||
else var j = i.number + " " + i.name + "_" + i.spec;
|
||||
if (b) var k = b;
|
||||
else var k = c;
|
||||
var n = $.extend(!0, {}, i);
|
||||
if (n.goods = j, n.id = k, n.qty = n.qty || 1, b) var o = parent.$("#grid").jqGrid("setRowData", Number(b), {});
|
||||
else {
|
||||
var o = parent.$("#grid").jqGrid("addRowData", Number(c), {}, "last");
|
||||
c++
|
||||
}
|
||||
o && parent.$("#"+ k).data("goodsInfo", i).data("storageInfo", {
|
||||
id: i.locationId,
|
||||
name: i.locationName
|
||||
}).data("unitInfo", {
|
||||
unitId: i.unitId,
|
||||
name: i.unitName
|
||||
}), parent.$("#grid").jqGrid("setRowData", k, n), g++;
|
||||
var p = parent.$("#" + b).next();
|
||||
b = p.length > 0 ? parent.$("#" + b).next().attr("id") : ""
|
||||
}
|
||||
d(c, b, g), $("#grid").jqGrid("resetSelection"), addList = {}
|
||||
}
|
||||
return e
|
||||
}
|
||||
//add by michen 20170717
|
||||
function callgoodback() {
|
||||
var b = parent.curSonId,
|
||||
c = parent.newSonId,
|
||||
d = api.data.callback,
|
||||
e = $("#grid").jqGrid("getGridParam", "selarrrow"),
|
||||
f = e.length,
|
||||
g = oldRow = parent.curRow,
|
||||
h = parent.curCol;
|
||||
if (isSingle) {
|
||||
parent.$("#gridCombination").jqGrid("restoreCell", g, h);
|
||||
var i = $("#grid").jqGrid("getRowData", $("#grid").jqGrid("getGridParam", "selrow"));
|
||||
if (i.id = i.id.split("_")[0], delete i.amount, defaultPage.SYSTEM.goodsInfo.push(i), "" === i.spec) var j = i.number + " " + i.name;
|
||||
else var j = i.number + " " + i.name + "_" + i.spec;
|
||||
if (g > 8 && g > oldRow) var k = g;
|
||||
else var k = b;
|
||||
var l = parent.$("#gridCombination").jqGrid("getRowData", Number(b));
|
||||
l = $.extend({}, l, {
|
||||
id: i.id,
|
||||
goods: j,
|
||||
invNumber: i.number,
|
||||
invName: i.name,
|
||||
unitName: i.unitName,
|
||||
qty: 1,
|
||||
price: i.salePrice,
|
||||
spec: i.spec,
|
||||
skuId: i.skuId,
|
||||
skuName: i.skuName,
|
||||
isSerNum: i.isSerNum
|
||||
});
|
||||
var m = $.extend(!0, {}, l);
|
||||
parent.$("#" + k).data("goodsInfo", m).data("storageInfo", {
|
||||
id: i.locationId,
|
||||
name: i.locationName
|
||||
}).data("unitInfo", {
|
||||
unitId: i.unitId,
|
||||
name: i.unitName
|
||||
}), d(k, l)
|
||||
} else if (f > 0) {
|
||||
parent.$("#gridCombination").jqGrid("restoreCell", g, h);
|
||||
for (rowid in addList) {
|
||||
var i = addList[rowid];
|
||||
if (i.id = i.id.split("_")[0],i.gid=i.id, delete i.amount, defaultPage.SYSTEM.goodsInfo.push(i), "" === i.spec) var j = i.number + " " + i.name;
|
||||
else var j = i.number + " " + i.name + "_" + i.spec;
|
||||
if (b) var k = b;
|
||||
else var k = c;
|
||||
var n = $.extend(!0, {}, i);
|
||||
if (n.goods = j, n.id = k, n.qty = n.qty || 1, b) var o = parent.$("#gridCombination").jqGrid("setRowData", Number(b), {});
|
||||
else {
|
||||
var o = parent.$("#gridCombination").jqGrid("addRowData", Number(c), {}, "last");
|
||||
c++
|
||||
}
|
||||
o && parent.$("#" + "sonnum_" + k).data("goodsInfo", i).data("storageInfo", {
|
||||
id: i.locationId,
|
||||
name: i.locationName
|
||||
}).data("unitInfo", {
|
||||
unitId: i.unitId,
|
||||
name: i.unitName
|
||||
}), parent.$("#gridCombination").jqGrid("setRowData", k, n), g++;
|
||||
var p = parent.$("#" + b).next();
|
||||
b = p.length > 0 ? parent.$("#" + b).next().attr("id") : ""
|
||||
}
|
||||
d(c, b, g), $("#gridCombination").jqGrid("resetSelection"), addList = {}
|
||||
}
|
||||
return e
|
||||
}
|
||||
var queryConditions = {
|
||||
skey: (frameElement.api.data ? frameElement.api.data.skey : "") || ""
|
||||
},
|
||||
$grid = $("#grid"),
|
||||
addList = {},
|
||||
urlParam = Public.urlParam(),
|
||||
zTree, defaultPage = Public.getDefaultPage(),
|
||||
SYSTEM = defaultPage.SYSTEM,
|
||||
taxRequiredCheck = SYSTEM.taxRequiredCheck;
|
||||
taxRequiredInput = SYSTEM.taxRequiredInput;
|
||||
var api = frameElement.api,
|
||||
data = api.data || {},
|
||||
isSingle = data.isSingle || 0,
|
||||
skuMult = data.skuMult,
|
||||
THISPAGE = {
|
||||
init: function() {
|
||||
this.initDom(), this.loadGrid(), this.initZtree(), this.addEvent()
|
||||
},
|
||||
initDom: function() {
|
||||
this.$_matchCon = $("#matchCon").val(queryConditions.skey || "请输入商品编号或名称或型号"), this.$_matchCon.placeholder()
|
||||
},
|
||||
initZtree: function() {
|
||||
zTree = Public.zTree.init($(".grid-wrap"), {
|
||||
defaultClass: "ztreeDefault",
|
||||
showRoot: !0
|
||||
}, {
|
||||
callback: {
|
||||
beforeClick: function(a, b) {
|
||||
queryConditions.assistId = b.id, $("#search").trigger("click")
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
loadGrid: function() {
|
||||
function a(a, b, c) {
|
||||
var d = '<div class="operating" data-id="' + c.id + '"><a class="ui-icon ui-icon-search" title="查询"></a><span class="ui-icon ui-icon-copy" title="商品图片"></span></div>';
|
||||
return d
|
||||
}
|
||||
$(window).height() - $(".grid-wrap").offset().top - 84;
|
||||
$("#grid").jqGrid({
|
||||
url: "../basedata/inventory?action=list",
|
||||
postData: queryConditions,
|
||||
datatype: "json",
|
||||
width: 578,
|
||||
height: 354,
|
||||
altRows: !0,
|
||||
gridview: !0,
|
||||
colModel: [{
|
||||
name: "id",
|
||||
label: "ID",
|
||||
width: 0,
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "operating",
|
||||
label: "操作",
|
||||
width: 60,
|
||||
fixed: !0,
|
||||
formatter: a,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "number",
|
||||
label: "商品编号",
|
||||
width: 100,
|
||||
title: !1
|
||||
}, {
|
||||
name: "name",
|
||||
label: "商品名称",
|
||||
width: 200,
|
||||
classes: "ui-ellipsis"
|
||||
}, {
|
||||
name: "skuClassId",
|
||||
label: "skuClassId",
|
||||
width: 0,
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "skuId",
|
||||
label: "skuId",
|
||||
width: 0,
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "skuName",
|
||||
label: "属性",
|
||||
width: 100,
|
||||
hidden: !skuMult,
|
||||
classes: "ui-ellipsis"
|
||||
}, {
|
||||
name: "qty",
|
||||
label: "数量",
|
||||
width: 60,
|
||||
hidden: !skuMult,
|
||||
formatter: function(a) {
|
||||
return a || " "
|
||||
}
|
||||
}, {
|
||||
name: "spec",
|
||||
label: "规格型号",
|
||||
width: 106,
|
||||
title: !1
|
||||
}, {
|
||||
name: "unitName",
|
||||
label: "单位",
|
||||
width: 60,
|
||||
title: !1
|
||||
}, {
|
||||
name: "unitId",
|
||||
label: "单位ID",
|
||||
width: 0,
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "salePrice",
|
||||
label: "销售单价",
|
||||
width: 0,
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "purPrice",
|
||||
label: "采购单价",
|
||||
width: 0,
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "locationId",
|
||||
label: "仓库ID",
|
||||
width: 0,
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "locationName",
|
||||
label: "仓库名称",
|
||||
width: 0,
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "isSerNum",
|
||||
label: "是否启用序列号",
|
||||
width: 0,
|
||||
hidden: !0
|
||||
}],
|
||||
cmTemplate: {
|
||||
sortable: !1
|
||||
},
|
||||
multiselect: isSingle ? !1 : !0,
|
||||
page: 1,
|
||||
sortname: "number",
|
||||
sortorder: "desc",
|
||||
pager: "#page",
|
||||
page: 1,
|
||||
rowNum: 100,
|
||||
rowList: [100, 200, 500],
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !0,
|
||||
forceFit: !1,
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
records: "data.records",
|
||||
total: "data.total",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
loadError: function() {},
|
||||
ondblClickRow: function() {
|
||||
isSingle && (callback(), frameElement.api.close())
|
||||
},
|
||||
onSelectRow: function(a, b) {
|
||||
if (b) {
|
||||
var c = $grid.jqGrid("getRowData", a);
|
||||
skuMult && c.skuClassId > 0 ? ($("#grid").jqGrid("setSelection", a, !1), $.dialog({
|
||||
width: 470,
|
||||
height: 400,
|
||||
title: "选择【" + c.number + " " + c.name + "】的属性",
|
||||
content: "url:http://" + defaultPage.location.hostname + "/settings/assistingProp-batch.jsp",
|
||||
data: {
|
||||
isSingle: isSingle,
|
||||
skey: "",
|
||||
skuClassId: c.skuClassId,
|
||||
callback: function(b, d) {
|
||||
for (var e = [], f = 0, g = b.length; g > f; f++) {
|
||||
var h = b[f],
|
||||
i = $.extend(!0, {}, c);
|
||||
if (i.skuName = h.skuName, i.skuId = h.skuId, i.qty = h.qty, 0 === f) $("#grid").jqGrid("setRowData", a, i);
|
||||
else {
|
||||
var j = f;
|
||||
!
|
||||
function l() {
|
||||
$("#" + a + "_" + j).length && (j++, l())
|
||||
}(), i.id = a + "_" + j, $("#grid").jqGrid("addRowData", i.id, i, "after", a)
|
||||
}
|
||||
addList[i.id] = i, e.push(i)
|
||||
}
|
||||
for (var f = 0; f < e.length; f++) {
|
||||
var k = $("#" + e[f].id).find("input:checkbox")[0];
|
||||
k && !k.checked && $("#grid").jqGrid("setSelection", e[f].id, !1)
|
||||
}
|
||||
d.close()
|
||||
}
|
||||
},
|
||||
init: function() {},
|
||||
lock: !0,
|
||||
ok: !1,
|
||||
cancle: !1
|
||||
})) : addList[a] = c
|
||||
} else addList[a] && delete addList[a]
|
||||
},
|
||||
onSelectAll: function(a, b) {
|
||||
for (var c = 0, d = a.length; d > c; c++) {
|
||||
var e = a[c];
|
||||
if (b) {
|
||||
var f = $grid.jqGrid("getRowData", e);
|
||||
addList[e] = f
|
||||
} else addList[e] && delete addList[e]
|
||||
}
|
||||
},
|
||||
gridComplete: function() {
|
||||
for (_item in addList) {
|
||||
var a = $("#" + addList[_item].id);
|
||||
!a.length && a.find("input:checkbox")[0].checked && $grid.jqGrid("setSelection", _item, !1)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
addList = {}, $("#grid").jqGrid("setGridParam", {
|
||||
url: "../basedata/inventory?action=list",
|
||||
datatype: "json",
|
||||
postData: a
|
||||
}).trigger("reloadGrid")
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
$(".grid-wrap").on("click", ".ui-icon-search", function(a) {
|
||||
a.preventDefault();
|
||||
var b = $(this).parent().data("id");
|
||||
Business.forSearch(b, "")
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-copy", function(a) {
|
||||
a.preventDefault();
|
||||
var b = $(this).parent().data("id"),
|
||||
c = "商品图片";
|
||||
parent.$.dialog({
|
||||
content: "url:../settings/fileUpload",
|
||||
data: {
|
||||
title: c,
|
||||
id: b,
|
||||
callback: function() {}
|
||||
},
|
||||
title: c,
|
||||
width: 775,
|
||||
height: 470,
|
||||
max: !1,
|
||||
min: !1,
|
||||
cache: !1,
|
||||
lock: !0
|
||||
})
|
||||
}), $("#search").click(function() {
|
||||
queryConditions.catId = a.catId, queryConditions.skey = "请输入商品编号或名称或型号" === a.$_matchCon.val() ? "" : a.$_matchCon.val(), a.reloadData(queryConditions)
|
||||
}), $("#refresh").click(function() {
|
||||
a.reloadData(queryConditions)
|
||||
})
|
||||
}
|
||||
};
|
||||
THISPAGE.init();
|
||||
361
statics/js/dist/goodsFlowDetail.js
vendored
Executable file
361
statics/js/dist/goodsFlowDetail.js
vendored
Executable file
@@ -0,0 +1,361 @@
|
||||
define(["jquery", "print"], function(a) {
|
||||
function b() {
|
||||
Business.filterGoods(), Business.filterStorage(), l.beginDate && l.endDate && j("div.grid-subtitle").text("日期: " + l.beginDate + "至" + l.endDate), j("#filter-fromDate").val(l.beginDate), j("#filter-toDate").val(l.endDate), j("#filter-goods input").val(l.goodsNo), j("#filter-storage input").val(l.storageNo), Public.dateCheck();
|
||||
var a = new Pikaday({
|
||||
field: j("#filter-fromDate")[0]
|
||||
}),
|
||||
b = new Pikaday({
|
||||
field: j("#filter-toDate")[0]
|
||||
});
|
||||
j("#filter-submit").on("click", function(c) {
|
||||
c.preventDefault();
|
||||
var d = j("#filter-fromDate").val(),
|
||||
e = j("#filter-toDate").val(),
|
||||
f = a.getDate(),
|
||||
g = b.getDate();
|
||||
return f.getTime() > g.getTime() ? void parent.Public.tips({
|
||||
type: 1,
|
||||
content: "开始日期不能大于结束日期"
|
||||
}) : (l = {
|
||||
beginDate: d,
|
||||
endDate: e,
|
||||
goodsNo: j("#filter-goods input").val() || "",
|
||||
storageNo: j("#filter-storage input").val() || ""
|
||||
}, j("#selected-period").text(d + "至" + e), j("div.grid-subtitle").text("日期: " + d + " 至 " + e), void i())
|
||||
}), j("#filter-reset").on("click", function(a) {
|
||||
a.preventDefault(), j("#filter-fromDate").val(""), j("#filter-toDate").val(""), j("#filter-goods input").val(""), j("#filter-storage input").val("")
|
||||
})
|
||||
}
|
||||
function c() {
|
||||
var a = l.storage ? l.storage.split(",") : "",
|
||||
b = l.goods ? l.goods.split(",") : "",
|
||||
c = "";
|
||||
a && b ? c = "「您已选择了<b>" + a.length + "</b>个仓库,<b>" + b.length + "</b>个商品进行查询」" : a ? c = "「您已选择了<b>" + customer.length + "</b>个仓库进行查询」" : b && (c = "「您已选择了<b>" + b.length + "</b>个商品进行查询」"), j("#cur-search-tip").html(c)
|
||||
}
|
||||
function d() {
|
||||
j("#refresh").on("click", function(a) {
|
||||
a.preventDefault(), i()
|
||||
}), j("#btn-print").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("DeliverDetailReport_PRINT") && j("div.ui-print").printTable()
|
||||
}), j("#btn-export").click(function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("DeliverDetailReport_EXPORT")) {
|
||||
var b = {};
|
||||
for (var c in l) l[c] && (b[c] = l[c]);
|
||||
Business.getFile("../report/deliverDetail_exporter?action=exporter", b)
|
||||
}
|
||||
})
|
||||
}
|
||||
function e() {
|
||||
var a = !1,
|
||||
b = !1,
|
||||
c = !1;
|
||||
k.isAdmin !== !1 || k.rights.AMOUNT_COSTAMOUNT || (a = !0), k.isAdmin !== !1 || k.rights.AMOUNT_OUTAMOUNT || (b = !0), k.isAdmin !== !1 || k.rights.AMOUNT_INAMOUNT || (c = !0);
|
||||
var d = [{
|
||||
name: "invNo",
|
||||
label: "商品编号",
|
||||
frozen: !0,
|
||||
width: 80
|
||||
}, {
|
||||
name: "invName",
|
||||
label: "商品名称",
|
||||
frozen: !0,
|
||||
width: 200,
|
||||
classes: "ui-ellipsis",
|
||||
title: !0
|
||||
}, {
|
||||
name: "spec",
|
||||
label: "规格型号",
|
||||
frozen: !0,
|
||||
width: 60,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "unit",
|
||||
label: "单位",
|
||||
frozen: !0,
|
||||
width: 50,
|
||||
fixed: !0,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "date",
|
||||
label: "日期",
|
||||
frozen: !0,
|
||||
width: 80,
|
||||
fixed: !0,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billNo",
|
||||
label: "单据号",
|
||||
frozen: !0,
|
||||
width: 120,
|
||||
fixed: !0,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billId",
|
||||
label: "销售ID",
|
||||
width: 0,
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "billType",
|
||||
label: "销售类型",
|
||||
width: 0,
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "transType",
|
||||
label: "业务类别",
|
||||
width: 60,
|
||||
fixed: !0,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "buName",
|
||||
label: "往来单位",
|
||||
width: 100,
|
||||
classes: "ui-ellipsis",
|
||||
title: !0
|
||||
}, {
|
||||
name: "location",
|
||||
label: "仓库",
|
||||
width: 60,
|
||||
classes: "ui-ellipsis",
|
||||
title: !0
|
||||
}, {
|
||||
name: "inqty",
|
||||
label: "数量",
|
||||
width: 80,
|
||||
fixed: !0,
|
||||
align: "right"
|
||||
},
|
||||
// {
|
||||
// name: "inunitCost",
|
||||
// label: "单位成本",
|
||||
// width: 80,
|
||||
// fixed: !0,
|
||||
// hidden: c,
|
||||
// align: "right"
|
||||
// },
|
||||
// {
|
||||
// name: "incost",
|
||||
// label: "成本",
|
||||
// width: 80,
|
||||
// fixed: !0,
|
||||
// hidden: c,
|
||||
// align: "right"
|
||||
// },
|
||||
|
||||
{
|
||||
name: "outqty",
|
||||
label: "数量",
|
||||
width: 80,
|
||||
fixed: !0,
|
||||
align: "right"
|
||||
},
|
||||
// {
|
||||
// name: "outunitCost",
|
||||
// label: "单位成本",
|
||||
// width: 80,
|
||||
// fixed: !0,
|
||||
// hidden: b,
|
||||
// align: "right"
|
||||
// },
|
||||
// {
|
||||
// name: "outcost",
|
||||
// label: "成本",
|
||||
// width: 80,
|
||||
// fixed: !0,
|
||||
// hidden: b,
|
||||
// align: "right"
|
||||
// },
|
||||
|
||||
{
|
||||
name: "totalqty",
|
||||
label: "数量",
|
||||
width: 80,
|
||||
fixed: !0,
|
||||
align: "right"
|
||||
}
|
||||
|
||||
// {
|
||||
// name: "totalunitCost",
|
||||
// label: "单位成本",
|
||||
// width: 80,
|
||||
// fixed: !0,
|
||||
// hidden: a,
|
||||
// align: "right"
|
||||
// }, {
|
||||
// name: "totalcost",
|
||||
// label: "成本",
|
||||
// width: 80,
|
||||
// fixed: !0,
|
||||
// hidden: a,
|
||||
// align: "right"
|
||||
// }
|
||||
],
|
||||
e = "local",
|
||||
g = "#";
|
||||
l.autoSearch && (e = "json", g = "../report/deliverDetail?action=detail"), j("#grid").jqGrid({
|
||||
url: g,
|
||||
postData: l,
|
||||
datatype: e,
|
||||
autowidth: !0,
|
||||
height: "auto",
|
||||
gridview: !0,
|
||||
colModel: d,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "date",
|
||||
sortorder: "desc",
|
||||
rowNum: 3e3,
|
||||
loadonce: !0,
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
footerrow: !0,
|
||||
userDataOnFooter: !0,
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
records: "data.records",
|
||||
total: "data.total",
|
||||
userdata: "data.userdata",
|
||||
repeatitems: !1,
|
||||
id: "0"
|
||||
},
|
||||
ondblClickRow: function(a) {
|
||||
var b = j("#grid").getRowData(a),
|
||||
c = b.billId,
|
||||
d = b.billType;
|
||||
switch (d) {
|
||||
case "PUR":
|
||||
if (!Business.verifyRight("PU_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "purchase-purchase",
|
||||
text: "购货单",
|
||||
url: "../scm/invPu?action=editPur&id="+ c
|
||||
});
|
||||
break;
|
||||
case "SALE":
|
||||
if (!Business.verifyRight("SA_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "sales-sales",
|
||||
text: "销售单",
|
||||
url: "../scm/invSa?action=editSale&id="+ c
|
||||
});
|
||||
break;
|
||||
case "TRANSFER":
|
||||
if (!Business.verifyRight("TF_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-transfers",
|
||||
text: "调拨单",
|
||||
url: "../scm/invTf?action=editTf&id=" + c
|
||||
});
|
||||
break;
|
||||
case "OI":
|
||||
if (!Business.verifyRight("IO_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-otherWarehouse",
|
||||
text: "其他入库",
|
||||
url: "../scm/invOi?action=editOi&type=in&id=" + c
|
||||
});
|
||||
break;
|
||||
case "OO":
|
||||
if (!Business.verifyRight("OO_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-otherOutbound",
|
||||
text: "其他出库",
|
||||
url: "../scm/invOi?action=editOi&type=out&id=" + c
|
||||
});
|
||||
break;
|
||||
case "CADJ":
|
||||
if (!Business.verifyRight("CADJ_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-adjustment",
|
||||
text: "成本调整单",
|
||||
url: "../scm/invOi?action=editOi&type=cbtz&id=" + c
|
||||
});
|
||||
break;
|
||||
case "ZZD":
|
||||
if (!Business.verifyRight("ZZD_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-assemble",
|
||||
text: "组装单",
|
||||
url: "/storage/assemble.jsp?id=" + c
|
||||
});
|
||||
break;
|
||||
case "CXD":
|
||||
if (!Business.verifyRight("CXD_QUERY")) return;
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-disassemble",
|
||||
text: "拆卸单",
|
||||
url: "/storage/disassemble.jsp?id=" + c
|
||||
})
|
||||
}
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
var b;
|
||||
if (a && a.data) {
|
||||
var c = a.data.rows.length;
|
||||
b = c ? 31 * c : "auto"
|
||||
}
|
||||
f(b)
|
||||
},
|
||||
gridComplete: function() {
|
||||
j("#grid").footerData("set", {
|
||||
location: "合计:"
|
||||
}), j("table.ui-jqgrid-ftable").find('td[aria-describedby="grid_location"]').prevUntil().css("border-right-color", "#fff")
|
||||
}
|
||||
}).jqGrid("setGroupHeaders", {
|
||||
useColSpanStyle: !0,
|
||||
groupHeaders: [{
|
||||
startColumnName: "inqty",
|
||||
numberOfColumns: 1,
|
||||
titleText: "入库"
|
||||
}, {
|
||||
startColumnName: "outqty",
|
||||
numberOfColumns: 1,
|
||||
titleText: "出库"
|
||||
}, {
|
||||
startColumnName: "totalqty",
|
||||
numberOfColumns: 1,
|
||||
titleText: "结存"
|
||||
}]
|
||||
}).jqGrid("setFrozenColumns"), l.autoSearch ? (j(".no-query").remove(), j(".ui-print").show()) : j(".ui-print").hide()
|
||||
}
|
||||
function f(a) {
|
||||
a && (f.h = a);
|
||||
var b = g(),
|
||||
c = f.h,
|
||||
d = h(),
|
||||
e = j("#grid");
|
||||
c > d && (c = d), b < e.width() && (c += 17), e.jqGrid("setGridWidth", b, !1), e.jqGrid("setGridHeight", c), j("#grid-wrap").height(function() {
|
||||
return document.body.clientHeight - this.offsetTop - 36 - 5
|
||||
})
|
||||
}
|
||||
function g() {
|
||||
return j(window).width() - (g.offsetLeft || (g.offsetLeft = j("#grid-wrap").offset().left)) - 36 - 20
|
||||
}
|
||||
function h() {
|
||||
return j(window).height() - (h.offsetTop || (h.offsetTop = j("#grid").offset().top)) - 36 - 16 - 24
|
||||
}
|
||||
function i() {
|
||||
j(".no-query").remove(), j(".ui-print").show(), j("#grid").jqGrid("setGridParam", {
|
||||
datatype: "json",
|
||||
postData: l,
|
||||
url: "../report/deliverDetail?action=detail"
|
||||
}).trigger("reloadGrid")
|
||||
}
|
||||
var j = a("jquery"),
|
||||
k = parent.SYSTEM,
|
||||
l = j.extend({
|
||||
beginDate: "",
|
||||
endDate: "",
|
||||
goodsNo: "",
|
||||
storageNo: ""
|
||||
}, Public.urlParam());
|
||||
a("print"), b(), c(), d(), e();
|
||||
var m;
|
||||
j(window).on("resize", function() {
|
||||
m || (m = setTimeout(function() {
|
||||
f(), m = null
|
||||
}, 50))
|
||||
})
|
||||
});
|
||||
185
statics/js/dist/goodsFlowSummary.js
vendored
Executable file
185
statics/js/dist/goodsFlowSummary.js
vendored
Executable file
@@ -0,0 +1,185 @@
|
||||
define(["jquery", "print"], function(a) {
|
||||
function b() {
|
||||
Business.filterGoods(), Business.filterStorage(), chkboxes = h("#chk-wrap").cssCheckbox(), j.beginDate && j.endDate && h(".grid-subtitle").text(j.beginDate + "至" + j.endDate), i.enableAssistingProp || h("#chk-wrap").hide(), "1" === j.showSku && h('#chk-wrap input[name="showSku"]').attr("checked", !0), h("#filter-fromDate").val(j.beginDate), h("#filter-toDate").val(j.endDate), h("#filter-goods input").val(j.goodsNo), h("#filter-storage input").val(j.storageNo), Public.dateCheck(), this.fDatePicker = new Pikaday({
|
||||
field: h("#filter-fromDate")[0]
|
||||
}), this.tDatePicker = new Pikaday({
|
||||
field: h("#filter-toDate")[0]
|
||||
}), k = Public.categoryTree(h("#filterCat"), {
|
||||
width: 200
|
||||
})
|
||||
}
|
||||
function c() {
|
||||
var a = this;
|
||||
h("#refresh").click(function(b) {
|
||||
b.preventDefault();
|
||||
var c = h("#filter-fromDate").val(),
|
||||
e = h("#filter-toDate").val(),
|
||||
f = a.fDatePicker.getDate(),
|
||||
g = a.tDatePicker.getDate();
|
||||
if (f.getTime() > g.getTime()) return void parent.Public.tips({
|
||||
type: 1,
|
||||
content: "开始日期不能大于结束日期"
|
||||
});
|
||||
j = {
|
||||
beginDate: c,
|
||||
endDate: e,
|
||||
goods: h("#filter-goods input").data("ids") || "",
|
||||
goodsNo: h("#filter-goods input").val() || "",
|
||||
storage: h("#filter-storage input").data("ids") || "",
|
||||
storageNo: h("#filter-storage input").val() || ""
|
||||
}, chkVals = chkboxes.chkVal();
|
||||
for (var i = 0, k = chkVals.length; k > i; i++) j[chkVals[i]] = 1;
|
||||
var l = h.dialog.tips("正在查询,请稍候...", 1e3, "loading.gif", !0);
|
||||
Public.ajaxGet("../report/deliverSummary?action=detail", j, function(a) {
|
||||
200 === a.status ? (h(".no-query").remove(), h(".ui-print").show(), h(".grid-subtitle").text(j.beginDate + "至" + j.endDate), d(a.data), l.close()) : (l.close(), parent.Public.tips({
|
||||
type: 1,
|
||||
content: msg
|
||||
}))
|
||||
})
|
||||
}), j.search && h("#refresh").trigger("click"), h("#btn-print").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("InvBalanceReport_PRINT") && window.print()
|
||||
}), h("#btn-export").click(function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("DeliverSummaryReport_EXPORT")) {
|
||||
var b = {};
|
||||
for (var c in j) j[c] && (b[c] = j[c]);
|
||||
Business.getFile("../report/deliverSummary_exporter?action=exporter", b)
|
||||
}
|
||||
})
|
||||
}
|
||||
function d(a) {
|
||||
h("#grid").jqGrid("GridUnload");
|
||||
for (var b = "auto", c = [{
|
||||
name: "invNo",
|
||||
label: "商品编号",
|
||||
frozen: !0,
|
||||
width: 80
|
||||
}, {
|
||||
name: "invName",
|
||||
label: "商品名称",
|
||||
frozen: !0,
|
||||
width: 200,
|
||||
classes: "ui-ellipsis",
|
||||
title: !0
|
||||
}, {
|
||||
name: "spec",
|
||||
label: "规格型号",
|
||||
frozen: !0,
|
||||
width: 60,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "unit",
|
||||
label: "单位",
|
||||
frozen: !0,
|
||||
width: 40,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "locationNo",
|
||||
label: "仓库编码",
|
||||
width: 0,
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "location",
|
||||
label: "仓库",
|
||||
frozen: !0,
|
||||
width: 100
|
||||
}], d = a.colIndex, e = a.colNames, i = a.stoNames, k = [], m = "", n = 0, o = 5, p = d.length; p > o; o++) {
|
||||
var q = null;
|
||||
q = {
|
||||
name: d[o],
|
||||
label: e[o],
|
||||
width: 80,
|
||||
align: "right"
|
||||
}, c.push(q), d[o].split("_")[1] === m ? (k.pop(), k.push({
|
||||
startColumnName: d[o - 1],
|
||||
numberOfColumns: 2,
|
||||
titleText: i[n - 1]
|
||||
})) : (k.push({
|
||||
startColumnName: d[o],
|
||||
numberOfColumns: 1,
|
||||
titleText: i[n]
|
||||
}), n++), m = d[o].split("_")[1]
|
||||
}
|
||||
h("#grid").jqGrid({
|
||||
ajaxGridOptions: {
|
||||
complete: function() {}
|
||||
},
|
||||
data: a.rows,
|
||||
datatype: "local",
|
||||
autowidth: !0,
|
||||
height: b,
|
||||
gridview: !0,
|
||||
colModel: c,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "date",
|
||||
sortorder: "desc",
|
||||
rowNum: 3e3,
|
||||
loadonce: !0,
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
footerrow: !0,
|
||||
userData: a.userdata,
|
||||
userDataOnFooter: !0,
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
records: "data.records",
|
||||
total: "data.total",
|
||||
userdata: "data.userdata",
|
||||
repeatitems: !1,
|
||||
id: "0"
|
||||
},
|
||||
ondblClickRow: function(a) {
|
||||
var b = h("#grid").getRowData(a),
|
||||
c = b.invNo,
|
||||
d = b.locationNo;
|
||||
Business.verifyRight("DeliverDetailReport_QUERY") && parent.tab.addTabItem({
|
||||
tabid: "report-goodsFlowDetail",
|
||||
text: "商品收发明细表",
|
||||
url: "../report/goods_flow_detail?autoSearch=true&beginDate=" + j.beginDate + "&endDate=" + j.endDate + "&goodsNo=" + c + "&storageNo=" + d
|
||||
})
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
var b = l = a.records,
|
||||
c = g();
|
||||
b > Math.floor(c / 31).toFixed(0) && (h("#grid").jqGrid("setGridHeight", c), h("#grid").jqGrid("setGridWidth", f(), !1))
|
||||
},
|
||||
gridComplete: function() {}
|
||||
}).jqGrid("setGroupHeaders", {
|
||||
useColSpanStyle: !0,
|
||||
groupHeaders: k
|
||||
}).jqGrid("setFrozenColumns")
|
||||
}
|
||||
function e() {
|
||||
var a = f(),
|
||||
b = g(),
|
||||
c = h("#grid");
|
||||
l > Math.floor(b / 31).toFixed(0) ? c.jqGrid("setGridHeight", b) : c.jqGrid("setGridHeight", "auto"), c.jqGrid("setGridWidth", a, !1)
|
||||
}
|
||||
function f() {
|
||||
return h(window).width() - (f.offsetLeft || (f.offsetLeft = h("#grid-wrap").offset().left)) - 36 - 22
|
||||
}
|
||||
function g() {
|
||||
return h(window).height() - (g.offsetTop = h("#grid").offset().top) - 36 - 16
|
||||
}
|
||||
var h = a("jquery"),
|
||||
i = parent.SYSTEM,
|
||||
j = h.extend({
|
||||
beginDate: "",
|
||||
endDate: "",
|
||||
goodsNo: "",
|
||||
storageNo: "",
|
||||
showSku: "0"
|
||||
}, Public.urlParam()),
|
||||
k = null,
|
||||
l = 0;
|
||||
a("print"), b(), c();
|
||||
var m;
|
||||
h(window).on("resize", function() {
|
||||
m || (m = setTimeout(function() {
|
||||
e(), m = null
|
||||
}, 50))
|
||||
})
|
||||
});
|
||||
102
statics/js/dist/goodsInventory.js
vendored
Executable file
102
statics/js/dist/goodsInventory.js
vendored
Executable file
@@ -0,0 +1,102 @@
|
||||
var api = frameElement.api,
|
||||
curId = api.data.id,
|
||||
THISPAGE = {
|
||||
init: function() {
|
||||
this.initDom(), this.loadGrid(), this.addEvent()
|
||||
},
|
||||
initDom: function() {
|
||||
this.$_matchCon = $("#matchCon"), api.data.text ? this.$_matchCon.val(api.data.text) : this.$_matchCon.placeholder(), this.goodsCombo = this.$_matchCon.combo({
|
||||
data: function() {
|
||||
var a = Public.getDefaultPage();
|
||||
return a.SYSTEM.goodsInfo
|
||||
},
|
||||
formatText: function(a) {
|
||||
return "" === a.spec ? a.number + " " + a.name : a.number + " " + a.name + "_" + a.spec
|
||||
},
|
||||
value: "id",
|
||||
defaultSelected: ["id", api.data.id],
|
||||
editable: !0,
|
||||
maxListWidth: 500,
|
||||
cache: !1,
|
||||
forceSelection: !0,
|
||||
maxFilter: 10,
|
||||
trigger: !1,
|
||||
listHeight: 182,
|
||||
listWrapCls: "ui-droplist-wrap",
|
||||
callback: {
|
||||
onChange: function(a) {
|
||||
a && a.id && (curId = a.id, THISPAGE.reloadData())
|
||||
}
|
||||
},
|
||||
queryDelay: 0,
|
||||
inputCls: "edit_subject",
|
||||
wrapCls: "edit_subject_wrap",
|
||||
focusCls: "",
|
||||
disabledCls: "",
|
||||
activeCls: ""
|
||||
}).getCombo()
|
||||
},
|
||||
loadGrid: function() {
|
||||
$(window).height() - $(".grid-wrap").offset().top - 84;
|
||||
$("#grid").jqGrid({
|
||||
url: "scm/invSa/justIntimeInv?action=justIntimeInv&invId=" + curId,
|
||||
datatype: "json",
|
||||
width: 430,
|
||||
height: 264,
|
||||
altRows: !0,
|
||||
gridview: !0,
|
||||
colModel: [{
|
||||
name: "locationName",
|
||||
label: "仓库名称",
|
||||
width: 100
|
||||
}, {
|
||||
name: "qty",
|
||||
label: "数量",
|
||||
width: 100,
|
||||
title: !1,
|
||||
align: "right"
|
||||
}],
|
||||
cmTemplate: {
|
||||
sortable: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "number",
|
||||
sortorder: "desc",
|
||||
pager: "#page",
|
||||
rowNum: 2e3,
|
||||
rowList: [300, 500, 1e3],
|
||||
scroll: 1,
|
||||
loadonce: !0,
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !0,
|
||||
forceFit: !1,
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
records: "data.total",
|
||||
repeatitems: !1,
|
||||
id: 0
|
||||
},
|
||||
loadError: function() {}
|
||||
})
|
||||
},
|
||||
reloadData: function() {
|
||||
$("#grid").jqGrid("setGridParam", {
|
||||
url: "scm/invSa/justIntimeInv?action=justIntimeInv&invId=" + curId,
|
||||
datatype: "json"
|
||||
}).trigger("reloadGrid")
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
$("#search").click(function() {
|
||||
curId = a.goodsCombo.getValue(), curId && THISPAGE.reloadData()
|
||||
}), $("#refresh").click(function() {
|
||||
THISPAGE.reloadData()
|
||||
}), this.$_matchCon.bind("focus", function() {
|
||||
var a = this;
|
||||
$(this).val() && setTimeout(function() {
|
||||
a.select()
|
||||
}, 10)
|
||||
})
|
||||
}
|
||||
};
|
||||
THISPAGE.init();
|
||||
421
statics/js/dist/goodsList.js
vendored
Executable file
421
statics/js/dist/goodsList.js
vendored
Executable file
@@ -0,0 +1,421 @@
|
||||
$(function() {
|
||||
function a() {
|
||||
Public.zTree.init($("#tree"), {
|
||||
defaultClass: "innerTree",
|
||||
showRoot: !0,
|
||||
rootTxt: "全部"
|
||||
}, {
|
||||
callback: {
|
||||
beforeClick: function(a, b) {
|
||||
$("#currentCategory").data("id", b.id).html(b.name), $("#search").trigger("click")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
function b() {
|
||||
var a = Public.setGrid(f, g),
|
||||
b = parent.SYSTEM.rights,
|
||||
c = !(parent.SYSTEM.isAdmin || b.AMOUNT_COSTAMOUNT),
|
||||
h = !(parent.SYSTEM.isAdmin || b.AMOUNT_INAMOUNT),
|
||||
k = !(parent.SYSTEM.isAdmin || b.AMOUNT_OUTAMOUNT),
|
||||
l = [{
|
||||
name: "operate",
|
||||
label: "操作",
|
||||
width: 90,
|
||||
fixed: !0,
|
||||
formatter: function(a, b, c) {
|
||||
var d = '<div class="operating" data-id="' + c.id + '"><span class="ui-icon ui-icon-pencil" title="修改"></span><span class="ui-icon ui-icon-trash" title="删除"></span><span class="ui-icon ui-icon-pic" title="商品图片"></span></div>';
|
||||
return d
|
||||
},
|
||||
title: !1
|
||||
}, {
|
||||
name: "categoryName",
|
||||
label: "商品类别",
|
||||
index: "categoryName",
|
||||
width: 100,
|
||||
title: !1
|
||||
}, {
|
||||
name: "number",
|
||||
label: "商品编号",
|
||||
index: "number",
|
||||
width: 100,
|
||||
title: !1
|
||||
}, {
|
||||
name: "name",
|
||||
label: "商品名称",
|
||||
index: "name",
|
||||
width: 200,
|
||||
classes: "ui-ellipsis"
|
||||
}, {
|
||||
name: "spec",
|
||||
label: "规格型号",
|
||||
index: "spec",
|
||||
width: 60,
|
||||
classes: "ui-ellipsis"
|
||||
}, {
|
||||
name: "unitName",
|
||||
label: "单位",
|
||||
index: "unitName",
|
||||
width: 40,
|
||||
align: "center",
|
||||
title: !1
|
||||
}, {
|
||||
name: "currentQty",
|
||||
label: "当前库存",
|
||||
index: "currentQty",
|
||||
width: 80,
|
||||
align: "right",
|
||||
title: !1,
|
||||
formatter: i.currentQty
|
||||
}, {
|
||||
name: "quantity",
|
||||
label: "期初数量",
|
||||
index: "quantity",
|
||||
width: 80,
|
||||
align: "right",
|
||||
title: !1,
|
||||
formatter: i.quantity
|
||||
}, {
|
||||
name: "unitCost",
|
||||
label: "单位成本",
|
||||
index: "unitCost",
|
||||
width: 100,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
showZero: !0,
|
||||
decimalPlaces: d
|
||||
},
|
||||
title: !1,
|
||||
hidden: c
|
||||
}, {
|
||||
name: "amount",
|
||||
label: "期初总价",
|
||||
index: "amount",
|
||||
width: 100,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
showZero: !0,
|
||||
decimalPlaces: e
|
||||
},
|
||||
title: !1,
|
||||
hidden: c
|
||||
}, {
|
||||
name: "purPrice",
|
||||
label: "预计采购价",
|
||||
index: "purPrice",
|
||||
width: 100,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
showZero: !0,
|
||||
decimalPlaces: d
|
||||
},
|
||||
title: !1,
|
||||
hidden: h
|
||||
}, {
|
||||
name: "salePrice",
|
||||
label: "零售价",
|
||||
index: "salePrice",
|
||||
width: 100,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
showZero: !0,
|
||||
decimalPlaces: d
|
||||
},
|
||||
title: !1,
|
||||
hidden: k
|
||||
}, {
|
||||
name: "remark",
|
||||
label: "备注",
|
||||
index: "remark",
|
||||
width: 100,
|
||||
title: !0
|
||||
}, {
|
||||
name: "delete",
|
||||
label: "状态",
|
||||
index: "delete",
|
||||
width: 80,
|
||||
align: "center",
|
||||
formatter: i.statusFmatter
|
||||
}];
|
||||
j.gridReg("grid", l), l = j.conf.grids.grid.colModel, $("#grid").jqGrid({
|
||||
url: "../basedata/inventory?action=list&isDelete=2",
|
||||
datatype: "json",
|
||||
width: a.w,
|
||||
height: a.h,
|
||||
altRows: !0,
|
||||
gridview: !0,
|
||||
onselectrow: !1,
|
||||
colModel: l,
|
||||
pager: "#page",
|
||||
viewrecords: !0,
|
||||
multiselect: !0,
|
||||
cmTemplate: {
|
||||
sortable: !1
|
||||
},
|
||||
rowNum: 100,
|
||||
rowList: [100, 200, 500],
|
||||
shrinkToFit: !1,
|
||||
forceFit: !0,
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
records: "data.records",
|
||||
total: "data.total",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
if (a && 200 == a.status) {
|
||||
var b = {};
|
||||
a = a.data;
|
||||
for (var c = 0; c < a.rows.length; c++) {
|
||||
var d = a.rows[c];
|
||||
b[d.id] = d
|
||||
}
|
||||
$("#grid").data("gridData", b)
|
||||
}
|
||||
},
|
||||
loadError: function(a, b, c) {
|
||||
parent.Public.tips({
|
||||
type: 1,
|
||||
content: "操作失败了哦,请检查您的网络链接!"
|
||||
})
|
||||
},
|
||||
resizeStop: function(a, b) {
|
||||
j.setGridWidthByIndex(a, b, "grid")
|
||||
}
|
||||
}).navGrid("#page", {
|
||||
edit: !1,
|
||||
add: !1,
|
||||
del: !1,
|
||||
search: !1,
|
||||
refresh: !1
|
||||
}).navButtonAdd("#page", {
|
||||
caption: "",
|
||||
buttonicon: "ui-icon-config",
|
||||
onClickButton: function() {
|
||||
j.config()
|
||||
},
|
||||
position: "last"
|
||||
})
|
||||
}
|
||||
function c() {
|
||||
$_matchCon = $("#matchCon"), $_matchCon.placeholder(), $("#search").on("click", function(a) {
|
||||
a.preventDefault();
|
||||
var b = "按商品编号,商品名称,规格型号等查询" === $_matchCon.val() ? "" : $.trim($_matchCon.val()),
|
||||
c = $("#currentCategory").data("id");
|
||||
$("#grid").jqGrid("setGridParam", {
|
||||
page: 1,
|
||||
postData: {
|
||||
skey: b,
|
||||
assistId: c
|
||||
}
|
||||
}).trigger("reloadGrid")
|
||||
}), $("#btn-add").on("click", function(a) {
|
||||
a.preventDefault(), Business.verifyRight("INVENTORY_ADD") && h.operate("add")
|
||||
}), $("#btn-print").on("click", function(a) {
|
||||
a.preventDefault()
|
||||
}), $("#btn-import").on("click", function(a) {
|
||||
a.preventDefault(), Business.verifyRight("BaseData_IMPORT") && parent.$.dialog({
|
||||
width: 560,
|
||||
height: 300,
|
||||
title: "批量导入",
|
||||
content: "url:../import",
|
||||
lock: !0,
|
||||
data:{
|
||||
callback: function() {
|
||||
$("#search").click();
|
||||
}
|
||||
}
|
||||
})
|
||||
}), $("#btn-export").on("click", function(a) {
|
||||
if (Business.verifyRight("INVENTORY_EXPORT")) {
|
||||
var b = "按商品编号,商品名称,规格型号等查询" === $_matchCon.val() ? "" : $.trim($_matchCon.val()),
|
||||
c = $("#currentCategory").data("id") || "";
|
||||
$(this).attr("href", "../basedata/inventory/exporter?action=exporter&isDelete=2&skey=" + b + "&assistId=" + c)
|
||||
}
|
||||
}), $("#grid").on("click", ".operating .ui-icon-pencil", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("INVENTORY_UPDATE")) {
|
||||
var b = $(this).parent().data("id");
|
||||
h.operate("edit", b)
|
||||
}
|
||||
}), $("#grid").on("click", ".operating .ui-icon-trash", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("INVENTORY_DELETE")) {
|
||||
var b = $(this).parent().data("id");
|
||||
h.del(b + "")
|
||||
}
|
||||
}), $("#grid").on("click", ".operating .ui-icon-pic", function(a) {
|
||||
a.preventDefault();
|
||||
var b = $(this).parent().data("id"),
|
||||
c = "商品图片";
|
||||
$.dialog({
|
||||
content: "url:../settings/fileUpload",
|
||||
data: {
|
||||
title: c,
|
||||
id: b,
|
||||
callback: function() {}
|
||||
},
|
||||
title: c,
|
||||
width: 775,
|
||||
height: 470,
|
||||
max: !1,
|
||||
min: !1,
|
||||
cache: !1,
|
||||
lock: !0
|
||||
})
|
||||
}), $("#btn-batchDel").click(function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("INVENTORY_DELETE")) {
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow");
|
||||
b.length ? h.del(b.join()) : parent.Public.tips({
|
||||
type: 2,
|
||||
content: "请选择需要删除的项"
|
||||
})
|
||||
}
|
||||
}), $("#btn-disable").click(function(a) {
|
||||
a.preventDefault();
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow").concat();
|
||||
return b && 0 != b.length ? void h.setStatuses(b, !0) : void parent.Public.tips({
|
||||
type: 1,
|
||||
content: " 请先选择要禁用的商品!"
|
||||
})
|
||||
}), $("#btn-enable").click(function(a) {
|
||||
a.preventDefault();
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow").concat();
|
||||
return b && 0 != b.length ? void h.setStatuses(b, !1) : void parent.Public.tips({
|
||||
type: 1,
|
||||
content: " 请先选择要启用的商品!"
|
||||
})
|
||||
}), $("#hideTree").click(function(a) {
|
||||
a.preventDefault();
|
||||
var b = $(this),
|
||||
c = b.html();
|
||||
">>" === c ? (b.html("<<"), g = 0, $("#tree").hide(), Public.resizeGrid(f, g)) : (b.html(">>"), g = 270, $("#tree").show(), Public.resizeGrid(f, g))
|
||||
}), $("#grid").on("click", ".set-status", function(a) {
|
||||
if (a.stopPropagation(), a.preventDefault(), Business.verifyRight("INVLOCTION_UPDATE")) {
|
||||
var b = $(this).data("id"),
|
||||
c = !$(this).data("delete");
|
||||
h.setStatus(b, c)
|
||||
}
|
||||
}), $(window).resize(function() {
|
||||
Public.resizeGrid(f, g), $(".innerTree").height($("#tree").height() - 95)
|
||||
}), Public.setAutoHeight($("#tree")), $(".innerTree").height($("#tree").height() - 95)
|
||||
}
|
||||
var d = (parent.SYSTEM, Number(parent.SYSTEM.qtyPlaces), Number(parent.SYSTEM.pricePlaces)),
|
||||
e = Number(parent.SYSTEM.amountPlaces),
|
||||
f = 95,
|
||||
g = 270,
|
||||
h = {
|
||||
operate: function(a, b) {
|
||||
if ("add" == a) var c = "新增商品",
|
||||
d = {
|
||||
oper: a,
|
||||
callback: this.callback
|
||||
};
|
||||
else var c = "修改商品",
|
||||
d = {
|
||||
oper: a,
|
||||
rowId: b,
|
||||
callback: this.callback
|
||||
};
|
||||
var e = 768;
|
||||
_h = 480, $.dialog({
|
||||
title: c,
|
||||
content: "url:goods_manage",
|
||||
data: d,
|
||||
width: e,
|
||||
height: 430,
|
||||
max: !1,
|
||||
min: !1,
|
||||
cache: !1,
|
||||
lock: !0
|
||||
})
|
||||
},
|
||||
del: function(a) {
|
||||
$.dialog.confirm("删除的商品将不能恢复,请确认是否删除?", function() {
|
||||
Public.ajaxPost("../basedata/inventory/delete?action=delete", {
|
||||
id: a
|
||||
}, function(b) {
|
||||
if (b && 200 == b.status) {
|
||||
var c = b.data.id || [];
|
||||
c = $.parseJSON(c);//add by michen 20170917 for
|
||||
a.split(",").length === c.length ? parent.Public.tips({
|
||||
content: "成功删除" + c.length + "个商品!"
|
||||
}) : parent.Public.tips({
|
||||
type: 2,
|
||||
content: b.data.msg
|
||||
});
|
||||
for (var d = 0, e = c.length; e > d; d++) $("#grid").jqGrid("setSelection", c[d]), $("#grid").jqGrid("delRowData", c[d])
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: "删除商品失败!" + b.msg
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
setStatus: function(a, b) {
|
||||
a && Public.ajaxPost("../basedata/inventory/disable?action=disable", {
|
||||
invIds: a,
|
||||
disable: Number(b)
|
||||
}, function(c) {
|
||||
c && 200 == c.status ? (parent.Public.tips({
|
||||
content: "商品状态修改成功!"
|
||||
}), $("#grid").jqGrid("setCell", a, "delete", b)) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: "商品状态修改失败!" + c.msg
|
||||
})
|
||||
})
|
||||
},
|
||||
setStatuses: function(a, b) {
|
||||
if (a && 0 != a.length) {
|
||||
var c = $("#grid").jqGrid("getGridParam", "selarrrow"),
|
||||
d = c.join();
|
||||
Public.ajaxPost("../basedata/inventory/disable?action=disable", {
|
||||
invIds: d,
|
||||
disable: Number(b)
|
||||
}, function(c) {
|
||||
if (c && 200 == c.status) {
|
||||
parent.Public.tips({
|
||||
content: "商品状态修改成功!"
|
||||
});
|
||||
for (var d = 0; d < a.length; d++) {
|
||||
var e = a[d];
|
||||
$("#grid").jqGrid("setCell", e, "delete", b)
|
||||
}
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: "商品状态修改失败!" + c.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
callback: function(a, b, c) {
|
||||
var d = $("#grid").data("gridData");
|
||||
d || (d = {}, $("#grid").data("gridData", d)), d[a.id] = a, "edit" == b ? ($("#grid").jqGrid("setRowData", a.id, a), c && c.api.close()) : ($("#grid").jqGrid("addRowData", a.id, a, "last"), c && c.resetForm(a))
|
||||
}
|
||||
},
|
||||
i = {
|
||||
money: function(a, b, c) {
|
||||
var a = Public.numToCurrency(a);
|
||||
return a || " "
|
||||
},
|
||||
currentQty: function(a, b, c) {
|
||||
if ("none" == a) return " ";
|
||||
var a = Public.numToCurrency(a);
|
||||
return a
|
||||
},
|
||||
quantity: function(a, b, c) {
|
||||
var a = Public.numToCurrency(a);
|
||||
return a || " "
|
||||
},
|
||||
statusFmatter: function(a, b, c) {
|
||||
var d = a === !0 ? "已禁用" : "已启用",
|
||||
e = a === !0 ? "ui-label-default" : "ui-label-success";
|
||||
return '<span class="set-status ui-label ' + e + '" data-delete="' + a + '" data-id="' + c.id + '">' + d + "</span>"
|
||||
}
|
||||
},
|
||||
j = Public.mod_PageConfig.init("goodsList");
|
||||
b(), a(), c()
|
||||
});
|
||||
1737
statics/js/dist/goodsManage.js
vendored
Executable file
1737
statics/js/dist/goodsManage.js
vendored
Executable file
File diff suppressed because it is too large
Load Diff
342
statics/js/dist/inventory.js
vendored
Executable file
342
statics/js/dist/inventory.js
vendored
Executable file
@@ -0,0 +1,342 @@
|
||||
var curRow, curCol, loading = null,
|
||||
import_dialog = null,
|
||||
SYSTEM = parent.SYSTEM,
|
||||
tempAssistPropGroupInfo = {},
|
||||
queryConditions = {
|
||||
goods: "",
|
||||
showZero: 0,
|
||||
isSerNum: 0
|
||||
},
|
||||
qtyPlaces = Number(parent.SYSTEM.qtyPlaces),
|
||||
pricePlaces = Number(parent.SYSTEM.pricePlaces),
|
||||
amountPlaces = Number(parent.SYSTEM.amountPlaces),
|
||||
THISPAGE = {
|
||||
init: function(a) {
|
||||
this.initDom(a), this.addEvent(), this.loadGrid([]), $(".ui-jqgrid-bdiv").addClass("no-query")
|
||||
},
|
||||
initDom: function() {
|
||||
this.$_storage = $("#storage"), this.$_category = $("#category"), this.$_goods = $("#goods"), this.$_note = $("#note"), this.chkField = $("#chkField").cssCheckbox(), this.storageCombo = $("#storage").combo({
|
||||
data: function() {
|
||||
return parent.SYSTEM.storageInfo
|
||||
},
|
||||
text: "name",
|
||||
value: "id",
|
||||
width: 120,
|
||||
defaultSelected: 0,
|
||||
addOptions: {
|
||||
text: "所有仓库",
|
||||
value: -1
|
||||
},
|
||||
cache: !1
|
||||
}).getCombo(), this.categoryTree = Public.categoryTree(this.$_category, {
|
||||
rootTxt: "所有类别",
|
||||
width: 200
|
||||
}), 1 != SYSTEM.ISSERNUM && $("#chkField").find("label:eq(1)").hide()
|
||||
},
|
||||
loadGrid: function(a) {
|
||||
$("#grid").jqGrid("GridUnload");
|
||||
var b = $(window).height() - $(".grid-wrap").offset().top - 124;
|
||||
$("#grid").jqGrid({
|
||||
data: a,
|
||||
mtype: "GET",
|
||||
autowidth: !0,
|
||||
height: b,
|
||||
rownumbers: !0,
|
||||
altRows: !0,
|
||||
gridview: !0,
|
||||
colModel: [{
|
||||
name: "locationId",
|
||||
label: "仓库ID",
|
||||
width: 0,
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "locationName",
|
||||
label: "仓库",
|
||||
width: 100
|
||||
}, {
|
||||
name: "assistName",
|
||||
label: "商品类别",
|
||||
width: 100
|
||||
}, {
|
||||
name: "invId",
|
||||
label: "商品ID",
|
||||
width: 0,
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "invNumber",
|
||||
label: "商品编号",
|
||||
width: 100
|
||||
}, {
|
||||
name: "invName",
|
||||
label: "商品名称",
|
||||
width: 200,
|
||||
classes: "ui-ellipsis"
|
||||
}, {
|
||||
name: "skuId",
|
||||
label: "属性ID",
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "skuName",
|
||||
label: "属性",
|
||||
width: 100,
|
||||
classes: "ui-ellipsis",
|
||||
hidden: !SYSTEM.enableAssistingProp,
|
||||
formatter: function(a, b, c) {
|
||||
if (!a && c.skuId) {
|
||||
if (tempAssistPropGroupInfo[c.skuId]) return tempAssistPropGroupInfo[c.skuId].skuName;
|
||||
for (var d = 0, e = parent.SYSTEM.assistPropGroupInfo.length; e > d; d++) {
|
||||
var f = SYSTEM.assistPropGroupInfo[d];
|
||||
if (tempAssistPropGroupInfo[f.skuId] = f, f.skuId == c.skuId) return f.skuName
|
||||
}
|
||||
}
|
||||
return a || " "
|
||||
}
|
||||
}, {
|
||||
name: "invSpec",
|
||||
label: "规格型号",
|
||||
width: 100
|
||||
}, {
|
||||
name: "unitId",
|
||||
label: "单位ID",
|
||||
width: 0,
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "unitName",
|
||||
label: "单位",
|
||||
width: 50
|
||||
}, {
|
||||
name: "qty",
|
||||
label: "系统库存",
|
||||
width: 100,
|
||||
align: "right",
|
||||
formatter: "number",
|
||||
formatoptions: {
|
||||
decimalPlaces: qtyPlaces
|
||||
}
|
||||
}, {
|
||||
name: "checkInventory",
|
||||
label: "盘点库存",
|
||||
width: 100,
|
||||
title: !1,
|
||||
align: "right",
|
||||
editable: !0,
|
||||
formatter: "number",
|
||||
formatoptions: {
|
||||
decimalPlaces: qtyPlaces
|
||||
}
|
||||
}, {
|
||||
name: "change",
|
||||
label: "盘盈盘亏",
|
||||
width: 100,
|
||||
align: "right",
|
||||
formatter: "number",
|
||||
formatoptions: {
|
||||
decimalPlaces: qtyPlaces
|
||||
}
|
||||
}],
|
||||
cmTemplate: {
|
||||
sortable: !1
|
||||
},
|
||||
sortname: "number",
|
||||
sortorder: "desc",
|
||||
pager: "#page",
|
||||
rowNum: 20,
|
||||
rowList: [100, 200, 500],
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
forceFit: !1,
|
||||
cellEdit: !0,
|
||||
triggerAdd: !1,
|
||||
cellsubmit: "clientArray",
|
||||
localReader: {
|
||||
root: "data.rows",
|
||||
records: "data.records",
|
||||
repeatitems: !1,
|
||||
total: "data.total",
|
||||
page: "data.page",
|
||||
id: "-1"
|
||||
},
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
records: "data.records",
|
||||
repeatitems: !1,
|
||||
total: "data.total",
|
||||
page: "data.page",
|
||||
id: "-1"
|
||||
},
|
||||
gridComplete: function() {
|
||||
$("tr#1").find("td:eq(11)").trigger("click")
|
||||
},
|
||||
afterSaveCell: function(a, b, c, d, e) {
|
||||
if ("checkInventory" == b) {
|
||||
var f = $("#grid").jqGrid("getCell", a, e - 1);
|
||||
if (!isNaN(parseFloat(f))) {
|
||||
$("#" + a).find("td:eq(-1)").removeClass("red");
|
||||
var g = parseFloat(c) - parseFloat(f);
|
||||
0 > g ? $("#grid").jqGrid("setCell", a, "change", g, "red") : $("#grid").jqGrid("setCell", a, "change", g)
|
||||
}
|
||||
}
|
||||
},
|
||||
loadError: function() {}
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
$("#grid").jqGrid("setGridParam", {
|
||||
url: "../scm/invOi/queryToPD?action=queryToPD",
|
||||
datatype: "json",
|
||||
postData: a,
|
||||
page: 1
|
||||
}).trigger("reloadGrid")
|
||||
},
|
||||
_getEntriesData: function() {
|
||||
null !== curRow && null !== curCol && ($("#grid").jqGrid("saveCell", curRow, curCol), curRow = null, curCol = null);
|
||||
for (var a = [], b = $("#grid").jqGrid("getDataIDs"), c = 0, d = b.length; d > c; c++) {
|
||||
var e, f = b[c],
|
||||
g = $("#grid").jqGrid("getRowData", f);
|
||||
e = {
|
||||
invId: g.invId,
|
||||
invNumber: g.invNumber,
|
||||
invName: g.invName,
|
||||
skuId: g.skuId || -1,
|
||||
skuName: g.skuName || "",
|
||||
invSpec: g.invSpec,
|
||||
locationId: g.locationId,
|
||||
locationName: g.locationName,
|
||||
unitId: g.unitId,
|
||||
mainUnit: g.unitName,
|
||||
invCost: g.invCost,
|
||||
qty: g.qty,
|
||||
checkInventory: g.checkInventory,
|
||||
change: g.change
|
||||
}, a.push(e)
|
||||
}
|
||||
return a
|
||||
},
|
||||
manager: {
|
||||
_makeOutBound: function(a) {
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-otherOutbound",
|
||||
text: "其他出库",
|
||||
url: "../scm/invOi?action=initOi&type=out&cacheId=" + a
|
||||
})
|
||||
},
|
||||
_makeWarehouse: function(a) {
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-otherWarehouse",
|
||||
text: "其他入库",
|
||||
url: "../scm/invOi?action=initOi&type=in&cacheId=" + a
|
||||
})
|
||||
},
|
||||
makeOrder: function(a) {
|
||||
var b = this,
|
||||
c = {},
|
||||
d = function(a) {
|
||||
var c = !0;
|
||||
"out" === a && b.$input_out.length ? b.$input_out.removeClass("ui-label-warning").addClass("ui-label-success") : b.$input_in.length && b.$input_in.removeClass("ui-label-warning").addClass("ui-label-success"), b.$input_in.length && !b.$input_in.hasClass("ui-label-success") && (c = !1), b.$input_out.length && !b.$input_out.hasClass("ui-label-success") && (c = !1), c && (b.pop.close(), $("#search").trigger("click"))
|
||||
};
|
||||
if (a.items && a.items.length) for (var e = a.items.length - 1; e >= 0; e--)"OO" === a.items[e].billType ? c.outboundData = a.items[e] : c.warehouseData = a.items[e];
|
||||
var f = (new Date).getTime() + "";
|
||||
parent.Cache = parent.Cache || {}, parent.Cache[f] = {
|
||||
data: c,
|
||||
callback: d
|
||||
};
|
||||
var g = "",
|
||||
h = "";
|
||||
c.outboundData && (g = '<li><span class="ui-label ui-label-warning" id="out">盘亏单</span></li>'), c.warehouseData && (h = '<li><span class="ui-label ui-label-warning" id="in">盘盈单</span></li>');
|
||||
var i = ['<div id="manager">', "<ul>", g, h, "</ul>", "</div>"];
|
||||
b.pop = $.dialog({
|
||||
title: "打开盘点单据确认后保存",
|
||||
content: i.join(""),
|
||||
width: 150,
|
||||
height: 100,
|
||||
lock: !0,
|
||||
ok: !1,
|
||||
init: function() {
|
||||
b.$input_out = $("#out").click(function() {
|
||||
b._makeOutBound(f)
|
||||
}), b.$input_in = $("#in").click(function() {
|
||||
b._makeWarehouse(f)
|
||||
})
|
||||
},
|
||||
cancel: function() {
|
||||
return $.dialog.confirm("未完善相关出入库单据会影响本次盘点数据,确定要取消吗?", function() {
|
||||
parent.Cache[f] = null, $("#search").trigger("click"), b.pop.close()
|
||||
}), !1
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
$("#search").click(function() {
|
||||
queryConditions = {
|
||||
locationId: a.storageCombo.getValue(),
|
||||
categoryId: a.categoryTree.getValue(),
|
||||
goods: a.$_goods.val(),
|
||||
showZero: 0,
|
||||
isSerNum: 0
|
||||
};
|
||||
var b = a.chkField.chkVal();
|
||||
if (b.length) for (var c = b.length - 1; c >= 0; c--) queryConditions[b[c]] = 1;
|
||||
a.reloadData(queryConditions), a.loaded || ($(".ui-jqgrid-bdiv").removeClass("no-query"), a.loaded = !0, $("#handleDom").show(), $(".mod-search .fr").show())
|
||||
}), $("#save").click(function() {
|
||||
var b = a._getEntriesData();
|
||||
if (!(b.length > 0)) return parent.Public.tips({
|
||||
type: 2,
|
||||
content: "商品信息不能为空!"
|
||||
}), $("#grid").jqGrid("editCell", 1, 2, !0), !1;
|
||||
var c = new Date,
|
||||
d = {
|
||||
entries: b,
|
||||
description: $.trim(a.$_note.val()),
|
||||
date: c.format("yyyy-MM-dd")
|
||||
};
|
||||
Public.ajaxPost("../scm/invOi/generatorPD?action=generatorPD", {
|
||||
postData: JSON.stringify(d)
|
||||
}, function(b) {
|
||||
200 === b.status ? a.manager.makeOrder(b.data) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
})
|
||||
}), $("#export").click(function(a) {
|
||||
return Business.verifyRight("PD_EXPORT") ? void $(this).attr("href", "../scm/invOi/exportToPD?action=exportToPD&locationId=" + queryConditions.locationId + "&categoryId=" + queryConditions.categoryId + "&goods=" + queryConditions.goods + "&showZero=" + queryConditions.showZero + "&isSerNum=" + queryConditions.isSerNum) : void a.preventDefault()
|
||||
}), $("#import").click(function() {
|
||||
if (!Business.verifyRight("PD_IMPORT")) return void e.preventDefault();
|
||||
var b, c = this;
|
||||
c.import_dialog = $.dialog({
|
||||
width: 520,
|
||||
height: 150,
|
||||
title: "批量导入",
|
||||
content: "url:../storage/import",
|
||||
data: {
|
||||
curID: a.curID,
|
||||
callback: function(b) {
|
||||
var d = "上传失败!";
|
||||
if (b && b.msg) {
|
||||
if ("success" === b.msg) return c.loading.close(), c.import_dialog.close(), void a.manager.makeOrder(b.data);
|
||||
d = b.msg
|
||||
}
|
||||
parent.Public.tips({
|
||||
type: 1,
|
||||
content: d
|
||||
}), c.loading.close()
|
||||
}
|
||||
},
|
||||
lock: !0,
|
||||
ok: function() {
|
||||
return b = this.content.$("#file-path"), "" === b.val() ? (parent.Public.tips({
|
||||
type: 2,
|
||||
content: "请先选择导入的文件!"
|
||||
}), !1) : (c.loading = $.dialog.tips("正在导入数据,请稍候...", 1e3, "loading.gif", !0), this.content.callback(), !1)
|
||||
},
|
||||
cancel: !0
|
||||
})
|
||||
}), $(document).bind("click.cancel", function(a) {
|
||||
!$(a.target).closest(".ui-jqgrid-btable").length > 0 && null !== curRow && null !== curCol && ($("#grid").jqGrid("saveCell", curRow, curCol), curRow = null, curCol = null)
|
||||
}), $(window).resize(function() {
|
||||
Public.resizeGrid(94)
|
||||
})
|
||||
}
|
||||
};
|
||||
THISPAGE.init();
|
||||
144
statics/js/dist/operationLog.js
vendored
Executable file
144
statics/js/dist/operationLog.js
vendored
Executable file
@@ -0,0 +1,144 @@
|
||||
var queryConditions = {
|
||||
fromDate: "",
|
||||
toDate: "",
|
||||
type: "",
|
||||
user: ""
|
||||
},
|
||||
SYSTEM = parent.SYSTEM,
|
||||
THISPAGE = {
|
||||
init: function() {
|
||||
this.initDom(), this.loadGrid(), this.addEvent()
|
||||
},
|
||||
initDom: function() {
|
||||
this.$_beginDate = $("#beginDate").val(SYSTEM.beginDate), this.$_endDate = $("#endDate").val(SYSTEM.endDate), this.$_beginDate.datepicker(), this.$_endDate.datepicker(), queryConditions.fromDate = this.$_beginDate.val(), queryConditions.toDate = this.$_endDate.val(), this.initFilter(queryConditions)
|
||||
},
|
||||
initFilter: function(a) {
|
||||
function b(a, b) {
|
||||
var c = "<strong>" + a + "</strong>";
|
||||
a != b && (c += " 至 <strong>" + b + "</strong>"), $("#selected-date").html(c)
|
||||
}
|
||||
var c = this;
|
||||
c.userCombo = $("#user").combo({
|
||||
text: "name",
|
||||
value: "userid",
|
||||
width: 240,
|
||||
data: "../basedata/log/queryAllUser?action=queryAllUser",
|
||||
ajaxOptions: {
|
||||
formatData: function(a) {
|
||||
return a.data.items.unshift({
|
||||
userid: "",
|
||||
name: "所有用户"
|
||||
}), a.data.items
|
||||
}
|
||||
}
|
||||
}).getCombo(), c.typeCombo = $("#type").combo({
|
||||
text: "operateTypeName",
|
||||
value: "indexid",
|
||||
width: 240,
|
||||
data: "../basedata/log/queryAllOperateType?action=queryAllOperateType",
|
||||
ajaxOptions: {
|
||||
formatData: function(a) {
|
||||
return a.data.items.unshift({
|
||||
operateTypeName: "所有操作",
|
||||
indexid: ""
|
||||
}), a.data.items
|
||||
}
|
||||
}
|
||||
}).getCombo(), b(a.fromDate, a.toDate), Business.moreFilterEvent(), $("#conditions-trigger").trigger("click"), $("#filter-submit").on("click", function(a) {
|
||||
a.preventDefault();
|
||||
var d = c.$_beginDate.val(),
|
||||
e = c.$_endDate.val();
|
||||
if (new Date(d).getTime() > new Date(e).getTime()) return void parent.Public.tips({
|
||||
type: 2,
|
||||
content: "开始日期不能大于结束日期!"
|
||||
});
|
||||
var f = c.userCombo.getText();
|
||||
queryConditions = {
|
||||
fromDate: d,
|
||||
toDate: e,
|
||||
user: "所有用户" === f ? "" : f
|
||||
//user: "所有用户" === f ? "" : f,
|
||||
//type: c.typeCombo.getValue()
|
||||
}, $("#grid").jqGrid("setGridParam", {
|
||||
url: "../basedata/log?action=list",
|
||||
page: 1,
|
||||
postData: queryConditions,
|
||||
datatype: "json"
|
||||
}).trigger("reloadGrid"), $("#filter-menu").removeClass("ui-btn-menu-cur"), b(d, e)
|
||||
}), $("#filter-reset").on("click", function(a) {
|
||||
a.preventDefault(), c.$_beginDate.val(""), c.$_endDate.val(""), c.userCombo.selectByIndex(0), c.typeCombo.selectByIndex(0)
|
||||
})
|
||||
},
|
||||
loadGrid: function() {
|
||||
var a = Public.setGrid();
|
||||
$("#grid").jqGrid({
|
||||
url: "../basedata/log?action=list",
|
||||
postData: queryConditions,
|
||||
datatype: "json",
|
||||
autowidth: !0,
|
||||
height: a.h,
|
||||
altRows: !0,
|
||||
gridview: !0,
|
||||
colModel: [{
|
||||
name: "modifyTime",
|
||||
label: "日期",
|
||||
width: 150,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "loginName",
|
||||
label: "用户名",
|
||||
width: 150
|
||||
}, {
|
||||
name: "name",
|
||||
label: "姓名",
|
||||
width: 150
|
||||
},
|
||||
//{
|
||||
// name: "operateTypeName",
|
||||
// label: "操作类型",
|
||||
// width: 200
|
||||
// },
|
||||
{
|
||||
name: "log",
|
||||
label: "日志",
|
||||
width: 450
|
||||
}],
|
||||
cmTemplate: {
|
||||
sortable: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "number",
|
||||
sortorder: "desc",
|
||||
pager: "#page",
|
||||
rowNum: 100,
|
||||
rowList: [100, 200, 500],
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
forceFit: !1,
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
records: "data.records",
|
||||
total: "data.total",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
loadError: function() {}
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
$("#grid").jqGrid("setGridParam", {
|
||||
url: "../basedata/log?action=list",
|
||||
page: 1,
|
||||
datatype: "json",
|
||||
postData: a
|
||||
}).trigger("reloadGrid")
|
||||
},
|
||||
addEvent: function() {
|
||||
$("#refresh").click(function() {
|
||||
THISPAGE.reloadData(queryConditions)
|
||||
}), $(window).resize(function() {
|
||||
Public.resizeGrid()
|
||||
})
|
||||
}
|
||||
};
|
||||
THISPAGE.init();
|
||||
176
statics/js/dist/other-expense-list.js
vendored
Executable file
176
statics/js/dist/other-expense-list.js
vendored
Executable file
@@ -0,0 +1,176 @@
|
||||
var queryConditions = {
|
||||
matchCon: ""
|
||||
},
|
||||
hiddenAmount = !1,
|
||||
SYSTEM = system = parent.SYSTEM,
|
||||
THISPAGE = {
|
||||
init: function(a) {
|
||||
SYSTEM.isAdmin !== !1 || SYSTEM.rights.AMOUNT_COSTAMOUNT || (hiddenAmount = !0), this.mod_PageConfig = Public.mod_PageConfig.init("other-expense-list"), this.initDom(), this.loadGrid(), this.addEvent()
|
||||
},
|
||||
initDom: function() {
|
||||
this.$_matchCon = $("#matchCon"), this.$_beginDate = $("#beginDate").val(system.beginDate), this.$_endDate = $("#endDate").val(system.endDate), this.$_matchCon.placeholder(), this.$_beginDate.datepicker(), this.$_endDate.datepicker()
|
||||
},
|
||||
loadGrid: function() {
|
||||
function a(a, b, c) {
|
||||
var d = '<div class="operating" data-id="' + c.id + '"><span class="ui-icon ui-icon-pencil" title="修改"></span><span class="ui-icon ui-icon-trash" title="删除"></span></div>';
|
||||
return d
|
||||
}
|
||||
var b = Public.setGrid();
|
||||
queryConditions.beginDate = this.$_beginDate.val(), queryConditions.endDate = this.$_endDate.val();
|
||||
var c = [{
|
||||
name: "operating",
|
||||
label: "操作",
|
||||
width: 60,
|
||||
fixed: !0,
|
||||
formatter: a,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billDate",
|
||||
label: "单据日期",
|
||||
width: 100,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billNo",
|
||||
label: "单据编号",
|
||||
width: 120,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "contactName",
|
||||
label: "供应商名称",
|
||||
width: 150
|
||||
}, {
|
||||
name: "amount",
|
||||
label: "金额",
|
||||
hidden: hiddenAmount,
|
||||
width: 100,
|
||||
align: "right",
|
||||
formatter: "currency"
|
||||
}, {
|
||||
name: "userName",
|
||||
label: "制单人",
|
||||
width: 80,
|
||||
fixed: !0,
|
||||
align: "center",
|
||||
title: !0,
|
||||
classes: "ui-ellipsis"
|
||||
}];
|
||||
this.mod_PageConfig.gridReg("grid", c), c = this.mod_PageConfig.conf.grids.grid.colModel, $("#grid").jqGrid({
|
||||
url: "../scm/ori?action=listExp",
|
||||
postData: queryConditions,
|
||||
datatype: "json",
|
||||
autowidth: !0,
|
||||
height: b.h,
|
||||
altRows: !0,
|
||||
gridview: !0,
|
||||
multiselect: !0,
|
||||
multiboxonly: !0,
|
||||
colModel: c,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "number",
|
||||
sortorder: "desc",
|
||||
pager: "#page",
|
||||
rowNum: 100,
|
||||
rowList: [100, 200, 500],
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
forceFit: !0,
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
records: "data.records",
|
||||
repeatitems: !1,
|
||||
total: "data.total",
|
||||
id: "id"
|
||||
},
|
||||
loadError: function(a, b, c) {},
|
||||
ondblClickRow: function(a, b, c, d) {
|
||||
$("#" + a).find(".ui-icon-pencil").trigger("click")
|
||||
},
|
||||
resizeStop: function(a, b) {
|
||||
THISPAGE.mod_PageConfig.setGridWidthByIndex(a, b, "grid")
|
||||
}
|
||||
}).navGrid("#page", {
|
||||
edit: !1,
|
||||
add: !1,
|
||||
del: !1,
|
||||
search: !1,
|
||||
refresh: !1
|
||||
}).navButtonAdd("#page", {
|
||||
caption: "",
|
||||
buttonicon: "ui-icon-config",
|
||||
onClickButton: function() {
|
||||
THISPAGE.mod_PageConfig.config()
|
||||
},
|
||||
position: "last"
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
$("#grid").jqGrid("setGridParam", {
|
||||
url: "../scm/ori/listExp?action=listExp",
|
||||
datatype: "json",
|
||||
postData: a
|
||||
}).trigger("reloadGrid")
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
$(".grid-wrap").on("click", ".ui-icon-pencil", function(a) {
|
||||
a.preventDefault();
|
||||
var b = $(this).parent().data("id");
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-otherExpense",
|
||||
text: "其他支出单",
|
||||
url: "../scm/ori?action=editExp&id=" + b
|
||||
});
|
||||
$("#grid").jqGrid("getDataIDs");
|
||||
parent.salesListIds = $("#grid").jqGrid("getDataIDs")
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-trash", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("QTZC_DELETE")) {
|
||||
var b = $(this).parent().data("id");
|
||||
$.dialog.confirm("您确定要删除该支出记录吗?", function() {
|
||||
Public.ajaxGet("../scm/ori/deleteExp?action=deleteExp", {
|
||||
id: b
|
||||
}, function(a) {
|
||||
200 === a.status ? ($("#grid").jqGrid("delRowData", b), parent.Public.tips({
|
||||
content: "删除成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}), $("#search").click(function() {
|
||||
queryConditions.matchCon = "请输入单据号或供应商名或备注" === a.$_matchCon.val() ? "" : a.$_matchCon.val(), queryConditions.beginDate = a.$_beginDate.val(), queryConditions.endDate = a.$_endDate.val(), THISPAGE.reloadData(queryConditions)
|
||||
}), $("#add").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("QTZC_ADD") && parent.tab.addTabItem({
|
||||
tabid: "money-otherExpense",
|
||||
text: "其他支出单",
|
||||
url: "../scm/ori?action=initExp"
|
||||
})
|
||||
}), $("#print").click(function(a) {
|
||||
if (!Business.verifyRight("QTZC_PRINT")) return void a.preventDefault();
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow"),
|
||||
c = b.join(),
|
||||
d = c ? "&id=" + c : "",
|
||||
e = "../scm/ori/toPdf?action=toPdf&transType=153402" + d;
|
||||
$(this).attr("href", e)
|
||||
}), $("#export").click(function(a) {
|
||||
if (!Business.verifyRight("QTZC_EXPORT")) return void a.preventDefault();
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow"),
|
||||
c = b.join(),
|
||||
d = c ? "&id=" + c : "";
|
||||
for (var e in queryConditions) queryConditions[e] && (d += "&" + e + "=" + queryConditions[e]);
|
||||
var f = "../scm/ori/exportExp?action=exportExp" + d;
|
||||
$(this).attr("href", f)
|
||||
}), $(window).resize(function() {
|
||||
Public.resizeGrid()
|
||||
})
|
||||
}
|
||||
};
|
||||
$(function() {
|
||||
THISPAGE.init()
|
||||
});
|
||||
|
||||
423
statics/js/dist/other-expense.js
vendored
Executable file
423
statics/js/dist/other-expense.js
vendored
Executable file
@@ -0,0 +1,423 @@
|
||||
var curRow, curCol, curArrears, loading, urlParam = Public.urlParam(),
|
||||
SYSTEM = parent.SYSTEM,
|
||||
hiddenAmount = !1,
|
||||
requiredMoney = SYSTEM.requiredMoney,
|
||||
qtyPlaces = Number(parent.SYSTEM.qtyPlaces),
|
||||
pricePlaces = Number(parent.SYSTEM.pricePlaces),
|
||||
amountPlaces = Number(parent.SYSTEM.amountPlaces),
|
||||
hasLoaded = !1,
|
||||
originalData, THISPAGE = {
|
||||
init: function(a) {
|
||||
this.mod_PageConfig = Public.mod_PageConfig.init("other-expense"), SYSTEM.isAdmin !== !1 || SYSTEM.rights.AMOUNT_COSTAMOUNT || (hiddenAmount = !0), this.loadGrid(a), this.initDom(a), this.initCombo(), this.addEvent(), THISPAGE.calTotal()
|
||||
},
|
||||
initDom: function(a) {
|
||||
this.$_customer = $("#customer"), this.$_date = $("#date").val(SYSTEM.endDate), this.$_number = $("#number"), this.$_note = $("#note"), this.$_toolTop = $("#toolTop"), this.$_toolBottom = $("#toolBottom"), this.$_amount = $("#amount").val(a.amount || 0), this.$_accountInfo = $("#accountInfo"), this.$_userName = $("#userName"), this.customerCombo = Business.billSupplierCombo($("#customer"), {
|
||||
defaultSelected: 0,
|
||||
emptyOptions: !0
|
||||
}), this.$_date.datepicker({
|
||||
onSelect: function(a) {
|
||||
if (!(originalData.id > 0)) {
|
||||
var b = a.format("yyyy-MM-dd");
|
||||
THISPAGE.$_number.text(""), Public.ajaxPost("../basedata/systemProfile/generateDocNo?action=generateDocNo", {
|
||||
billType: "QTZC",
|
||||
billDate: b
|
||||
}, function(a) {
|
||||
200 === a.status ? THISPAGE.$_number.text(a.data.billNo) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}), a.id > 0 ? (this.$_customer.data("contactInfo", {
|
||||
id: a.buId,
|
||||
name: a.contactName
|
||||
}), this.customerCombo.input.val(a.contactName), this.$_number.text(a.billNo), this.$_date.val(a.date), this.$_note.val(a.description), $("#grid").jqGrid("footerData", "set", {
|
||||
qty: a.totalQty,
|
||||
amount: a.totalAmount
|
||||
}), "edit" === a.status ? this.$_toolBottom.html('<a id="add" class="ui-btn ui-btn-sp mrb">新增</a><a href="../scm/ori/toPdf?action=toPdf&transType=153402" target="_blank" id="print" class="ui-btn mrb">打印</a><a id="edit" class="ui-btn mrb">保存</a>') : this.$_toolBottom.html('<a id="add" class="ui-btn ui-btn-sp mrb">新增</a><a href="../scm/ori/toPdf?action=toPdf&transType=153402" target="_blank" id="print" class="ui-btn mrb">打印</a><a class="ui-btn-prev mrb" id="prev" title="上一张"><b></b></a><a class="ui-btn-next" id="next" title="下一张"><b></b></a>'), this.salesListIds = parent.salesListIds || [], this.idPostion = $.inArray(String(a.id), this.salesListIds), this.idLength = this.salesListIds.length, 0 === this.idPostion && $("#prev").addClass("ui-btn-prev-dis"), this.idPostion === this.idLength - 1 && $("#next").addClass("ui-btn-next-dis"), this.$_userName.html(a.userName)) : (this.$_toolBottom.html('<a id="savaAndAdd" class="ui-btn ui-btn-sp mrb">保存并新增</a><a id="save" class="ui-btn">保存</a>'), this.$_userName.html(SYSTEM.realName || "")), requiredMoney && ($("#accountWrap").show(), SYSTEM.isAdmin !== !1 || SYSTEM.rights.SettAcct_QUERY ? this.accountCombo = Business.accountCombo($("#account"), {
|
||||
width: 200,
|
||||
height: 300,
|
||||
defaultSelected: a.accId ? ["id", a.accId] : 0,
|
||||
callback: {
|
||||
onChange: function(a) {
|
||||
if (-1 === this.getValue());
|
||||
else {
|
||||
var b = [];
|
||||
b.push({
|
||||
accId: this.getValue(),
|
||||
account: "",
|
||||
amount: THISPAGE.$_amount.val(),
|
||||
wayId: 0,
|
||||
way: "",
|
||||
settlement: ""
|
||||
}), THISPAGE.$_accountInfo.data("accountInfo", b).hide()
|
||||
}
|
||||
}
|
||||
}
|
||||
}) : this.accountCombo = Business.accountCombo($("#account"), {
|
||||
width: 200,
|
||||
height: 300,
|
||||
data: [],
|
||||
editable: !1,
|
||||
disabled: !0,
|
||||
addOptions: {
|
||||
text: "(没有账户管理权限)",
|
||||
value: 0
|
||||
}
|
||||
}))
|
||||
},
|
||||
loadGrid: function(a) {
|
||||
function b(a, b, c) {
|
||||
return a ? a : c.invNumber ? c.invSpec ? c.invNumber + " " + c.invName + "_" + c.invSpec : c.invNumber + " " + c.invName : " "
|
||||
}
|
||||
function c(a, b) {
|
||||
var c = $(".categoryAuto")[0];
|
||||
return c
|
||||
}
|
||||
function d(a, b, c) {
|
||||
if ("get" === b) {
|
||||
if ("" !== $(".categoryAuto").getCombo().getValue()) return $(a).val();
|
||||
var d = $(a).parents("tr");
|
||||
return d.removeData("categoryInfo"), ""
|
||||
}
|
||||
"set" === b && $("input", a).val(c)
|
||||
}
|
||||
function e() {
|
||||
$("#initCombo").append($(".categoryAuto").val("").unbind("focus.once"))
|
||||
}
|
||||
var f = this;
|
||||
if (a.id) {
|
||||
var g = 8 - a.entries.length;
|
||||
if (g > 0) for (var h = 0; g > h; h++) a.entries.push({})
|
||||
}
|
||||
f.newId = 9;
|
||||
var i = [{
|
||||
name: "operating",
|
||||
label: " ",
|
||||
width: 40,
|
||||
fixed: !0,
|
||||
formatter: Public.billsOper,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "categoryName",
|
||||
label: "支出类别",
|
||||
width: 200,
|
||||
title: !0,
|
||||
classes: "ui-ellipsis",
|
||||
formatter: b,
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: c,
|
||||
custom_value: d,
|
||||
handle: e,
|
||||
trigger: "ui-icon-triangle-1-s"
|
||||
}
|
||||
}, {
|
||||
name: "categoryId",
|
||||
label: "支出类别ID",
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "amount",
|
||||
label: "金额",
|
||||
width: 120,
|
||||
align: "right",
|
||||
formatter: "number",
|
||||
formatoptions: {
|
||||
decimalPlaces: amountPlaces
|
||||
},
|
||||
editable: !0
|
||||
}, {
|
||||
name: "description",
|
||||
label: "备注",
|
||||
width: 500,
|
||||
title: !0,
|
||||
editable: !0
|
||||
}];
|
||||
f.mod_PageConfig.gridReg("grid", i), i = f.mod_PageConfig.conf.grids.grid.colModel, $("#grid").jqGrid({
|
||||
data: a.entries,
|
||||
datatype: "clientSide",
|
||||
autowidth: !0,
|
||||
height: "100%",
|
||||
rownumbers: !0,
|
||||
gridview: !0,
|
||||
onselectrow: !1,
|
||||
colModel: i,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
shrinkToFit: !1,
|
||||
forceFit: !0,
|
||||
rowNum: 1e3,
|
||||
cellEdit: !1,
|
||||
cellsubmit: "clientArray",
|
||||
localReader: {
|
||||
root: "rows",
|
||||
records: "records",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
jsonReader: {
|
||||
root: "data.entries",
|
||||
records: "records",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
if (urlParam.id > 0) {
|
||||
var b = a.rows,
|
||||
c = b.length;
|
||||
f.newId = c + 1;
|
||||
for (var d = 0; c > d; d++) {
|
||||
var e = d + 1,
|
||||
g = b[d];
|
||||
if ($.isEmptyObject(b[d])) break;
|
||||
$("#" + e).data("categoryInfo", {
|
||||
id: g.categoryId,
|
||||
name: g.categoryName
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
gridComplete: function() {},
|
||||
afterEditCell: function(a, b, c, d, e) {
|
||||
"categoryName" === b && ($("#" + d + "_categoryName", "#grid").val(c), THISPAGE.categoryCombo.selectByText(c), THISPAGE.curID = a)
|
||||
},
|
||||
formatCell: function(a, b, c, d, e) {},
|
||||
beforeSubmitCell: function(a, b, c, d, e) {},
|
||||
afterSaveCell: function(a, b, c, d, e) {
|
||||
"amount" == b && THISPAGE.calTotal()
|
||||
},
|
||||
resizeStop: function(a, b) {
|
||||
f.mod_PageConfig.setGridWidthByIndex(a, b, "grid")
|
||||
},
|
||||
loadonce: !0,
|
||||
footerrow: !0,
|
||||
userData: {
|
||||
categoryName: "合计:",
|
||||
amount: a.totalAmount
|
||||
},
|
||||
userDataOnFooter: !0,
|
||||
loadError: function(a, b, c) {
|
||||
Public.tips({
|
||||
type: 1,
|
||||
content: "Type: " + b + "; Response: " + a.status + " " + a.statusText
|
||||
})
|
||||
}
|
||||
}), $("#grid").jqGrid("setGridParam", {
|
||||
cellEdit: !0
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
$("#grid").clearGridData();
|
||||
var b = 8 - a.entries.length;
|
||||
if (b > 0) for (var c = 0; b > c; c++) a.entries.push({})
|
||||
},
|
||||
initCombo: function() {
|
||||
var a = "paccttype";
|
||||
this.categoryCombo = Business.categoryCombo($(".categoryAuto"), a)
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
this.customerCombo.input.enterKey(), this.$_date.bind("keydown", function(a) {
|
||||
13 === a.which && $("#grid").jqGrid("editCell", 1, 2, !0)
|
||||
}).bind("focus", function(b) {
|
||||
a.dateValue = $(this).val()
|
||||
}).bind("blur", function(b) {
|
||||
var c = /((^((1[8-9]\d{2})|([2-9]\d{3}))(-)(10|12|0?[13578])(-)(3[01]|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))(-)(11|0?[469])(-)(30|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))(-)(0?2)(-)(2[0-8]|1[0-9]|0?[1-9])$)|(^([2468][048]00)(-)(0?2)(-)(29)$)|(^([3579][26]00)(-)(0?2)(-)(29)$)|(^([1][89][0][48])(-)(0?2)(-)(29)$)|(^([2-9][0-9][0][48])(-)(0?2)(-)(29)$)|(^([1][89][2468][048])(-)(0?2)(-)(29)$)|(^([2-9][0-9][2468][048])(-)(0?2)(-)(29)$)|(^([1][89][13579][26])(-)(0?2)(-)(29)$)|(^([2-9][0-9][13579][26])(-)(0?2)(-)(29)$))/;
|
||||
c.test($(this).val()) || (parent.Public.tips({
|
||||
type: 2,
|
||||
content: "日期格式有误!如:2012-08-08。"
|
||||
}), $(this).val(a.dateValue))
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-triangle-1-s", function(b) {
|
||||
b.stopPropagation(), a.categoryCombo.doQuery()
|
||||
}), Business.billsEvent(a, "other-expense"), $(".wrapper").on("click", "#save", function(b) {
|
||||
b.preventDefault();
|
||||
var c = THISPAGE.getPostData();
|
||||
c && ("edit" === originalData.stata && (c.id = originalData.id, c.stata = "edit"), Public.ajaxPost("../scm/ori/addExp?action=addExp", {
|
||||
postData: JSON.stringify(c)
|
||||
}, function(b) {
|
||||
200 === b.status ? (originalData.id = b.data.id, urlParam.id = b.data.id, a.$_toolBottom.html('<a id="add" class="ui-btn ui-btn-sp mrb">新增</a><a href="../scm/ori/toPdf?action=toPdf&transType=153402" target="_blank" id="print" class="ui-btn mrb">打印</a><a id="edit" class="ui-btn mrb">保存</a>'), parent.Public.tips({
|
||||
content: "保存成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
}))
|
||||
}), $(".wrapper").on("click", "#edit", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("QTZC_UPDATE")) {
|
||||
var b = THISPAGE.getPostData();
|
||||
b && Public.ajaxPost("../scm/ori/updateExp?action=updateExp", {
|
||||
postData: JSON.stringify(b)
|
||||
}, function(a) {
|
||||
200 === a.status ? (originalData.id = a.data.id, urlParam.id = a.data.id, parent.Public.tips({
|
||||
content: "修改成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
}), $(".wrapper").on("click", "#savaAndAdd", function(b) {
|
||||
b.preventDefault();
|
||||
var c = THISPAGE.getPostData();
|
||||
c && Public.ajaxPost("../scm/ori/addNewExp?action=addNewExp", {
|
||||
postData: JSON.stringify(c)
|
||||
}, function(b) {
|
||||
if (200 === b.status) {
|
||||
a.$_number.text(b.data.billNo), $("#grid").clearGridData(), $("#grid").clearGridData(!0);
|
||||
for (var c = 1; 8 >= c; c++) $("#grid").jqGrid("addRowData", c, {});
|
||||
a.newId = 9, a.$_note.val(""), parent.Public.tips({
|
||||
content: "保存成功!"
|
||||
})
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
})
|
||||
}), $(".wrapper").on("click", "#add", function(a) {
|
||||
a.preventDefault(), Business.verifyRight("QTZC_ADD") && parent.tab.overrideSelectedTabItem({
|
||||
tabid: "money-otherExpense",
|
||||
text: "其他支出单",
|
||||
url: "../scm/ori/initExp?action=initExp"
|
||||
})
|
||||
}), $(".wrapper").on("click", "#print", function(a) {
|
||||
return Business.verifyRight("QTZC_PRINT") ? void(this.href += "&id=" + originalData.id) : void a.preventDefault()
|
||||
}), $("#prev").click(function(b) {
|
||||
return b.preventDefault(), $(this).hasClass("ui-btn-prev-dis") ? (parent.Public.tips({
|
||||
type: 2,
|
||||
content: "已经没有上一张了!"
|
||||
}), !1) : (a.idPostion = a.idPostion - 1, 0 === a.idPostion && $(this).addClass("ui-btn-prev-dis"), loading = $.dialog.tips("数据加载中...", 1e3, "loading.gif", !0), Public.ajaxGet("../scm/ori/updateExp?action=updateExp", {
|
||||
id: a.salesListIds[a.idPostion]
|
||||
}, function(a) {
|
||||
THISPAGE.reloadData(a.data), $("#next").removeClass("ui-btn-next-dis"), loading && loading.close()
|
||||
}), void 0)
|
||||
}), $("#next").click(function(b) {
|
||||
return b.preventDefault(), $(this).hasClass("ui-btn-next-dis") ? (parent.Public.tips({
|
||||
type: 2,
|
||||
content: "已经没有下一张了!"
|
||||
}), !1) : (a.idPostion = a.idPostion + 1, a.idLength === a.idPostion + 1 && $(this).addClass("ui-btn-next-dis"), loading = $.dialog.tips("数据加载中...", 1e3, "loading.gif", !0), Public.ajaxGet("../scm/ori/updateExp?action=updateExp", {
|
||||
id: a.salesListIds[a.idPostion]
|
||||
}, function(a) {
|
||||
THISPAGE.reloadData(a.data), $("#prev").removeClass("ui-btn-prev-dis"), loading && loading.close()
|
||||
}), void 0)
|
||||
}), $("#config").click(function(b) {
|
||||
a.mod_PageConfig.config()
|
||||
}), $(window).resize(function(a) {
|
||||
Public.autoGrid($("#grid"))
|
||||
})
|
||||
},
|
||||
resetData: function() {
|
||||
var a = this;
|
||||
$("#grid").clearGridData();
|
||||
for (var b = 1; 8 >= b; b++) $("#grid").jqGrid("addRowData", b, {}), $("#grid").jqGrid("footerData", "set", {
|
||||
qty: 0,
|
||||
amount: 0
|
||||
});
|
||||
a.$_amount.val(0)
|
||||
},
|
||||
calTotal: function() {
|
||||
for (var a = $("#grid").jqGrid("getDataIDs"), b = 0, c = 0, d = a.length; d > c; c++) {
|
||||
var e = a[c],
|
||||
f = $("#grid").jqGrid("getRowData", e);
|
||||
f.amount && (b += parseFloat(f.amount))
|
||||
}
|
||||
$("#grid").jqGrid("footerData", "set", {
|
||||
amount: b
|
||||
}), THISPAGE.$_amount.val(b)
|
||||
},
|
||||
_getEntriesData: function() {
|
||||
for (var a = [], b = $("#grid").jqGrid("getDataIDs"), c = 0, d = b.length; d > c; c++) {
|
||||
var e, f = b[c],
|
||||
g = $("#grid").jqGrid("getRowData", f);
|
||||
if ("" !== g.categoryName && "" !== g.amount) {
|
||||
var h = $("#" + f).data("categoryInfo");
|
||||
e = {
|
||||
categoryId: h.id,
|
||||
amount: g.amount,
|
||||
description: g.description
|
||||
}, a.push(e)
|
||||
}
|
||||
}
|
||||
return a
|
||||
},
|
||||
getPostData: function() {
|
||||
var a = this,
|
||||
b = this;
|
||||
null !== curRow && null !== curCol && ($("#grid").jqGrid("saveCell", curRow, curCol), curRow = null, curCol = null);
|
||||
var c = b.$_customer.find("input");
|
||||
if ("" === c.val() || "(空)" === c.val()) {
|
||||
var d = {};
|
||||
d.id = 0, d.name = "(空)", b.$_customer.removeData("contactInfo")
|
||||
} else {
|
||||
var d = b.$_customer.data("contactInfo");
|
||||
if (null === d) return setTimeout(function() {
|
||||
c.focus().select()
|
||||
}, 15), parent.Public.tips({
|
||||
type: 2,
|
||||
content: "当前客户不存在!"
|
||||
}), !1
|
||||
}
|
||||
var e = this._getEntriesData();
|
||||
if (e.length > 0) {
|
||||
a.calTotal();
|
||||
var f = {
|
||||
id: originalData.id,
|
||||
buId: d.id,
|
||||
contactName: d.name,
|
||||
date: $.trim(a.$_date.val()),
|
||||
billNo: $.trim(a.$_number.text()),
|
||||
entries: e,
|
||||
totalAmount: $("#grid").jqGrid("footerData", "get").amount.replace(/,/g, "")
|
||||
};
|
||||
return requiredMoney && (f.accId = a.accountCombo.getValue(), f.accId <= 0) ? (parent.Public.tips({
|
||||
type: 2,
|
||||
content: "请检查账户信息是否正确!"
|
||||
}), !1) : f
|
||||
}
|
||||
return parent.Public.tips({
|
||||
type: 2,
|
||||
content: "至少保存一条有效分录数据!"
|
||||
}), $("#grid").jqGrid("editCell", 1, 2, !0), !1
|
||||
}
|
||||
};
|
||||
$(function() {
|
||||
urlParam.id ? hasLoaded || Public.ajaxGet("../scm/ori/getExpDetail?action=getExpDetail", {
|
||||
id: urlParam.id
|
||||
}, function(a) {
|
||||
200 === a.status ? (originalData = a.data, THISPAGE.init(a.data), hasLoaded = !0) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: msg
|
||||
})
|
||||
}) : (originalData = {
|
||||
id: -1,
|
||||
status: "add",
|
||||
customer: 0,
|
||||
entries: [{
|
||||
id: "1"
|
||||
}, {
|
||||
id: "2"
|
||||
}, {
|
||||
id: "3"
|
||||
}, {
|
||||
id: "4"
|
||||
}, {
|
||||
id: "5"
|
||||
}, {
|
||||
id: "6"
|
||||
}, {
|
||||
id: "7"
|
||||
}, {
|
||||
id: "8"
|
||||
}],
|
||||
totalQty: 0,
|
||||
totalAmount: 0,
|
||||
disRate: 0,
|
||||
disAmount: 0,
|
||||
amount: "0.00",
|
||||
rpAmount: "0.00",
|
||||
arrears: "0.00"
|
||||
}, THISPAGE.init(originalData))
|
||||
});
|
||||
179
statics/js/dist/other-income-list.js
vendored
Executable file
179
statics/js/dist/other-income-list.js
vendored
Executable file
@@ -0,0 +1,179 @@
|
||||
var queryConditions = {
|
||||
matchCon: ""
|
||||
},
|
||||
hiddenAmount = !1,
|
||||
SYSTEM = system = parent.SYSTEM,
|
||||
THISPAGE = {
|
||||
init: function(a) {
|
||||
SYSTEM.isAdmin !== !1 || SYSTEM.rights.AMOUNT_COSTAMOUNT || (hiddenAmount = !0), this.mod_PageConfig = Public.mod_PageConfig.init("other-income-list"), this.initDom(), this.loadGrid(), this.addEvent()
|
||||
},
|
||||
initDom: function() {
|
||||
this.$_matchCon = $("#matchCon"), this.$_beginDate = $("#beginDate").val(system.beginDate), this.$_endDate = $("#endDate").val(system.endDate), this.$_matchCon.placeholder(), this.$_beginDate.datepicker(), this.$_endDate.datepicker()
|
||||
},
|
||||
loadGrid: function() {
|
||||
function a(a, b, c) {
|
||||
var d = '<div class="operating" data-id="' + c.id + '"><span class="ui-icon ui-icon-pencil" title="修改"></span><span class="ui-icon ui-icon-trash" title="删除"></span></div>';
|
||||
return d
|
||||
}
|
||||
var b = Public.setGrid();
|
||||
queryConditions.beginDate = this.$_beginDate.val(), queryConditions.endDate = this.$_endDate.val();
|
||||
var c = [{
|
||||
name: "operating",
|
||||
label: "操作",
|
||||
width: 60,
|
||||
fixed: !0,
|
||||
formatter: a,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billDate",
|
||||
label: "单据日期",
|
||||
width: 100,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billNo",
|
||||
label: "单据编号",
|
||||
width: 120,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "contactName",
|
||||
label: "客户名称",
|
||||
width: 150
|
||||
}, {
|
||||
name: "amount",
|
||||
label: "金额",
|
||||
hidden: hiddenAmount,
|
||||
width: 100,
|
||||
align: "right",
|
||||
formatter: "currency"
|
||||
}, {
|
||||
name: "userName",
|
||||
label: "制单人",
|
||||
width: 80,
|
||||
fixed: !0,
|
||||
align: "center",
|
||||
title: !0,
|
||||
classes: "ui-ellipsis"
|
||||
}];
|
||||
this.mod_PageConfig.gridReg("grid", c), c = this.mod_PageConfig.conf.grids.grid.colModel, $("#grid").jqGrid({
|
||||
url: "../scm/ori/listInc?action=listInc",
|
||||
postData: queryConditions,
|
||||
datatype: "json",
|
||||
autowidth: !0,
|
||||
height: b.h,
|
||||
altRows: !0,
|
||||
gridview: !0,
|
||||
multiselect: !0,
|
||||
multiboxonly: !0,
|
||||
colModel: c,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "number",
|
||||
sortorder: "desc",
|
||||
pager: "#page",
|
||||
rowNum: 100,
|
||||
rowList: [100, 200, 500],
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
forceFit: !0,
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
records: "data.records",
|
||||
repeatitems: !1,
|
||||
total: "data.total",
|
||||
id: "id"
|
||||
},
|
||||
loadError: function(a, b, c) {},
|
||||
ondblClickRow: function(a, b, c, d) {
|
||||
$("#" + a).find(".ui-icon-pencil").trigger("click")
|
||||
},
|
||||
resizeStop: function(a, b) {
|
||||
THISPAGE.mod_PageConfig.setGridWidthByIndex(a, b, "grid")
|
||||
}
|
||||
}).navGrid("#page", {
|
||||
edit: !1,
|
||||
add: !1,
|
||||
del: !1,
|
||||
search: !1,
|
||||
refresh: !1
|
||||
}).navButtonAdd("#page", {
|
||||
caption: "",
|
||||
buttonicon: "ui-icon-config",
|
||||
onClickButton: function() {
|
||||
THISPAGE.mod_PageConfig.config()
|
||||
},
|
||||
position: "last"
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
$("#grid").jqGrid("setGridParam", {
|
||||
url: "../scm/ori/listInc?action=listInc",
|
||||
datatype: "json",
|
||||
postData: a
|
||||
}).trigger("reloadGrid")
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
$(".grid-wrap").on("click", ".ui-icon-pencil", function(a) {
|
||||
a.preventDefault();
|
||||
var b = $(this).parent().data("id");
|
||||
parent.tab.addTabItem({
|
||||
tabid: "money-otherIncome",
|
||||
text: "其他收入单",
|
||||
url: "../scm/ori?action=editInc&id=" + b
|
||||
});
|
||||
$("#grid").jqGrid("getDataIDs");
|
||||
parent.salesListIds = $("#grid").jqGrid("getDataIDs")
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-trash", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("QTSR_DELETE")) {
|
||||
var b = $(this).parent().data("id");
|
||||
$.dialog.confirm("您确定要删除该收入记录吗?", function() {
|
||||
Public.ajaxGet("../scm/ori/deleteInc?action=deleteInc", {
|
||||
id: b
|
||||
}, function(a) {
|
||||
200 === a.status ? ($("#grid").jqGrid("delRowData", b), parent.Public.tips({
|
||||
content: "删除成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}), $("#search").click(function() {
|
||||
queryConditions.matchCon = "请输入单据号或客户名或备注" === a.$_matchCon.val() ? "" : a.$_matchCon.val(), queryConditions.beginDate = a.$_beginDate.val(), queryConditions.endDate = a.$_endDate.val(), THISPAGE.reloadData(queryConditions)
|
||||
}), $("#add").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("QTSR_ADD") && parent.tab.addTabItem({
|
||||
tabid: "money-otherIncome",
|
||||
text: "其他收入单",
|
||||
url: "../scm/ori?action=initInc"
|
||||
})
|
||||
}), $("#print").click(function(a) {
|
||||
if (!Business.verifyRight("QTSR_PRINT")) return void a.preventDefault();
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow"),
|
||||
c = b.join(),
|
||||
d = c ? "&id=" + c : "",
|
||||
e = "../scm/ori/toPdf?action=toPdf&transType=153401" + d;
|
||||
$(this).attr("href", e)
|
||||
}), $("#export").click(function(a) {
|
||||
if (!Business.verifyRight("QTSR_EXPORT")) return void a.preventDefault();
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow"),
|
||||
c = b.join(),
|
||||
d = c ? "&id=" + c : "";
|
||||
for (var e in queryConditions) queryConditions[e] && (d += "&" + e + "=" + queryConditions[e]);
|
||||
var f = "../scm/ori/exportInc?action=exportInc" + d;
|
||||
$(this).attr("href", f)
|
||||
}), $(window).resize(function() {
|
||||
Public.resizeGrid()
|
||||
})
|
||||
}
|
||||
};
|
||||
$(function() {
|
||||
THISPAGE.init()
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
430
statics/js/dist/other-income.js
vendored
Executable file
430
statics/js/dist/other-income.js
vendored
Executable file
@@ -0,0 +1,430 @@
|
||||
var curRow, curCol, curArrears, loading, urlParam = Public.urlParam(),
|
||||
SYSTEM = parent.SYSTEM,
|
||||
hiddenAmount = !1,
|
||||
requiredMoney = SYSTEM.requiredMoney,
|
||||
qtyPlaces = Number(parent.SYSTEM.qtyPlaces),
|
||||
pricePlaces = Number(parent.SYSTEM.pricePlaces),
|
||||
amountPlaces = Number(parent.SYSTEM.amountPlaces),
|
||||
hasLoaded = !1,
|
||||
originalData, THISPAGE = {
|
||||
init: function(a) {
|
||||
this.mod_PageConfig = Public.mod_PageConfig.init("other-income"), SYSTEM.isAdmin !== !1 || SYSTEM.rights.AMOUNT_COSTAMOUNT || (hiddenAmount = !0), this.loadGrid(a), this.initDom(a), this.initCombo(), this.addEvent(), THISPAGE.calTotal()
|
||||
},
|
||||
initDom: function(a) {
|
||||
this.$_customer = $("#customer"), this.$_date = $("#date").val(SYSTEM.endDate), this.$_number = $("#number"), this.$_note = $("#note"), this.$_toolTop = $("#toolTop"), this.$_toolBottom = $("#toolBottom"), this.$_amount = $("#amount").val(a.amount || 0), this.$_accountInfo = $("#accountInfo"), this.$_userName = $("#userName"), this.customerCombo = Business.billCustomerCombo($("#customer"), {
|
||||
defaultSelected: 0,
|
||||
emptyOptions: !0
|
||||
}), this.$_date.datepicker({
|
||||
onSelect: function(a) {
|
||||
if (!(originalData.id > 0)) {
|
||||
var b = a.format("yyyy-MM-dd");
|
||||
THISPAGE.$_number.text(""), Public.ajaxPost("../basedata/systemProfile/generateDocNo?action=generateDocNo", {
|
||||
billType: "QTSR",
|
||||
billDate: b
|
||||
}, function(a) {
|
||||
200 === a.status ? THISPAGE.$_number.text(a.data.billNo) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}), a.id > 0 ? (this.$_customer.data("contactInfo", {
|
||||
id: a.buId,
|
||||
name: a.contactName
|
||||
}), this.customerCombo.input.val(a.contactName), this.$_number.text(a.billNo), this.$_date.val(a.date), this.$_note.val(a.description), $("#grid").jqGrid("footerData", "set", {
|
||||
qty: a.totalQty,
|
||||
amount: a.totalAmount
|
||||
}), "edit" === a.status ? this.$_toolBottom.html('<a id="add" class="ui-btn ui-btn-sp mrb">新增</a><a href="../scm/ori/toPdf?action=toPdf&transType=153401" target="_blank" id="print" class="ui-btn mrb">打印</a><a id="edit" class="ui-btn mrb">保存</a>') : this.$_toolBottom.html('<a id="add" class="ui-btn ui-btn-sp mrb">新增</a><a href="../scm/ori/toPdf?action=toPdf&transType=153401" target="_blank" id="print" class="ui-btn mrb">打印</a><a class="ui-btn-prev mrb" id="prev" title="上一张"><b></b></a><a class="ui-btn-next" id="next" title="下一张"><b></b></a>'), this.salesListIds = parent.salesListIds || [], this.idPostion = $.inArray(String(a.id), this.salesListIds), this.idLength = this.salesListIds.length, 0 === this.idPostion && $("#prev").addClass("ui-btn-prev-dis"), this.idPostion === this.idLength - 1 && $("#next").addClass("ui-btn-next-dis"), this.$_userName.html(a.userName)) : (this.$_toolBottom.html('<a id="savaAndAdd" class="ui-btn ui-btn-sp mrb">保存并新增</a><a id="save" class="ui-btn">保存</a>'), this.$_userName.html(SYSTEM.realName || "")), requiredMoney && ($("#accountWrap").show(), SYSTEM.isAdmin !== !1 || SYSTEM.rights.SettAcct_QUERY ? this.accountCombo = Business.accountCombo($("#account"), {
|
||||
width: 200,
|
||||
height: 300,
|
||||
defaultSelected: a.accId ? ["id", a.accId] : 0,
|
||||
callback: {
|
||||
onChange: function(a) {
|
||||
if (-1 === this.getValue());
|
||||
else {
|
||||
var b = [];
|
||||
b.push({
|
||||
accId: this.getValue(),
|
||||
account: "",
|
||||
amount: THISPAGE.$_amount.val(),
|
||||
wayId: 0,
|
||||
way: "",
|
||||
settlement: ""
|
||||
}), THISPAGE.$_accountInfo.data("accountInfo", b).hide()
|
||||
}
|
||||
}
|
||||
}
|
||||
}) : this.accountCombo = Business.accountCombo($("#account"), {
|
||||
width: 200,
|
||||
height: 300,
|
||||
data: [],
|
||||
editable: !1,
|
||||
disabled: !0,
|
||||
addOptions: {
|
||||
text: "(没有账户管理权限)",
|
||||
value: 0
|
||||
}
|
||||
}))
|
||||
},
|
||||
loadGrid: function(a) {
|
||||
function b(a, b, c) {
|
||||
return a ? a : c.invNumber ? c.invSpec ? c.invNumber + " " + c.invName + "_" + c.invSpec : c.invNumber + " " + c.invName : " "
|
||||
}
|
||||
function c(a, b) {
|
||||
var c = $(".categoryAuto")[0];
|
||||
return c
|
||||
}
|
||||
function d(a, b, c) {
|
||||
if ("get" === b) {
|
||||
if ("" !== $(".categoryAuto").getCombo().getValue()) return $(a).val();
|
||||
var d = $(a).parents("tr");
|
||||
return d.removeData("categoryInfo"), ""
|
||||
}
|
||||
"set" === b && $("input", a).val(c)
|
||||
}
|
||||
function e() {
|
||||
$("#initCombo").append($(".categoryAuto").val("").unbind("focus.once"))
|
||||
}
|
||||
var f = this;
|
||||
if (a.id) {
|
||||
var g = 8 - a.entries.length;
|
||||
if (g > 0) for (var h = 0; g > h; h++) a.entries.push({})
|
||||
}
|
||||
f.newId = 9;
|
||||
var i = [{
|
||||
name: "operating",
|
||||
label: " ",
|
||||
width: 40,
|
||||
fixed: !0,
|
||||
formatter: Public.billsOper,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "categoryName",
|
||||
label: "收入类别",
|
||||
width: 200,
|
||||
title: !0,
|
||||
classes: "ui-ellipsis",
|
||||
formatter: b,
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: c,
|
||||
custom_value: d,
|
||||
handle: e,
|
||||
trigger: "ui-icon-triangle-1-s"
|
||||
}
|
||||
}, {
|
||||
name: "categoryId",
|
||||
label: "收入类别ID",
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "amount",
|
||||
label: "金额",
|
||||
width: 120,
|
||||
align: "right",
|
||||
formatter: "number",
|
||||
formatoptions: {
|
||||
decimalPlaces: amountPlaces
|
||||
},
|
||||
editable: !0
|
||||
}, {
|
||||
name: "description",
|
||||
label: "备注",
|
||||
width: 500,
|
||||
title: !0,
|
||||
editable: !0
|
||||
}];
|
||||
f.mod_PageConfig.gridReg("grid", i), i = f.mod_PageConfig.conf.grids.grid.colModel, $("#grid").jqGrid({
|
||||
data: a.entries,
|
||||
datatype: "clientSide",
|
||||
autowidth: !0,
|
||||
height: "100%",
|
||||
rownumbers: !0,
|
||||
gridview: !0,
|
||||
onselectrow: !1,
|
||||
colModel: i,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
shrinkToFit: !1,
|
||||
forceFit: !0,
|
||||
rowNum: 1e3,
|
||||
cellEdit: !1,
|
||||
cellsubmit: "clientArray",
|
||||
localReader: {
|
||||
root: "rows",
|
||||
records: "records",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
jsonReader: {
|
||||
root: "data.entries",
|
||||
records: "records",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
if (urlParam.id > 0) {
|
||||
var b = a.rows,
|
||||
c = b.length;
|
||||
f.newId = c + 1;
|
||||
for (var d = 0; c > d; d++) {
|
||||
var e = d + 1,
|
||||
g = b[d];
|
||||
if ($.isEmptyObject(b[d])) break;
|
||||
$("#" + e).data("categoryInfo", {
|
||||
id: g.categoryId,
|
||||
name: g.categoryName
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
gridComplete: function() {},
|
||||
afterEditCell: function(a, b, c, d, e) {
|
||||
"categoryName" === b && ($("#" + d + "_categoryName", "#grid").val(c), THISPAGE.categoryCombo.selectByText(c), THISPAGE.curID = a)
|
||||
},
|
||||
formatCell: function(a, b, c, d, e) {},
|
||||
beforeSubmitCell: function(a, b, c, d, e) {},
|
||||
afterSaveCell: function(a, b, c, d, e) {
|
||||
"amount" == b && THISPAGE.calTotal()
|
||||
},
|
||||
resizeStop: function(a, b) {
|
||||
f.mod_PageConfig.setGridWidthByIndex(a, b, "grid")
|
||||
},
|
||||
loadonce: !0,
|
||||
footerrow: !0,
|
||||
userData: {
|
||||
categoryName: "合计:",
|
||||
amount: a.totalAmount
|
||||
},
|
||||
userDataOnFooter: !0,
|
||||
loadError: function(a, b, c) {
|
||||
Public.tips({
|
||||
type: 1,
|
||||
content: "Type: " + b + "; Response: " + a.status + " " + a.statusText
|
||||
})
|
||||
}
|
||||
}), $("#grid").jqGrid("setGridParam", {
|
||||
cellEdit: !0
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
$("#grid").clearGridData();
|
||||
var b = 8 - a.entries.length;
|
||||
if (b > 0) for (var c = 0; b > c; c++) a.entries.push({})
|
||||
},
|
||||
initCombo: function() {
|
||||
var a = "raccttype";
|
||||
this.categoryCombo = Business.categoryCombo($(".categoryAuto"), a)
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
this.customerCombo.input.enterKey(), this.$_date.bind("keydown", function(a) {
|
||||
13 === a.which && $("#grid").jqGrid("editCell", 1, 2, !0)
|
||||
}).bind("focus", function(b) {
|
||||
a.dateValue = $(this).val()
|
||||
}).bind("blur", function(b) {
|
||||
var c = /((^((1[8-9]\d{2})|([2-9]\d{3}))(-)(10|12|0?[13578])(-)(3[01]|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))(-)(11|0?[469])(-)(30|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))(-)(0?2)(-)(2[0-8]|1[0-9]|0?[1-9])$)|(^([2468][048]00)(-)(0?2)(-)(29)$)|(^([3579][26]00)(-)(0?2)(-)(29)$)|(^([1][89][0][48])(-)(0?2)(-)(29)$)|(^([2-9][0-9][0][48])(-)(0?2)(-)(29)$)|(^([1][89][2468][048])(-)(0?2)(-)(29)$)|(^([2-9][0-9][2468][048])(-)(0?2)(-)(29)$)|(^([1][89][13579][26])(-)(0?2)(-)(29)$)|(^([2-9][0-9][13579][26])(-)(0?2)(-)(29)$))/;
|
||||
c.test($(this).val()) || (parent.Public.tips({
|
||||
type: 2,
|
||||
content: "日期格式有误!如:2012-08-08。"
|
||||
}), $(this).val(a.dateValue))
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-triangle-1-s", function(b) {
|
||||
b.stopPropagation(), a.categoryCombo.doQuery()
|
||||
}), Business.billsEvent(a, "other-income"), $(".wrapper").on("click", "#save", function(b) {
|
||||
b.preventDefault();
|
||||
var c = $(this);
|
||||
if (c.hasClass("ui-btn-dis")) return void parent.Public.tips({
|
||||
type: 2,
|
||||
content: "正在保存,请稍后..."
|
||||
});
|
||||
var d = THISPAGE.getPostData();
|
||||
d && ("edit" === originalData.stata && (d.id = originalData.id, d.stata = "edit"), c.addClass("ui-btn-dis"), Public.ajaxPost("../scm/ori/addInc?action=addInc", {
|
||||
postData: JSON.stringify(d)
|
||||
}, function(b) {
|
||||
c.removeClass("ui-btn-dis"), 200 === b.status ? (originalData.id = b.data.id, urlParam.id = b.data.id, a.$_toolBottom.html('<a id="add" class="ui-btn ui-btn-sp mrb">新增</a><a href="../scm/ori/toPdf?action=toPdf&transType=153401" target="_blank" id="print" class="ui-btn mrb">打印</a><a id="edit" class="ui-btn mrb">保存</a>'), parent.Public.tips({
|
||||
content: "保存成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
}))
|
||||
}), $(".wrapper").on("click", "#edit", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("QTSR_UPDATE")) {
|
||||
var b = THISPAGE.getPostData();
|
||||
b && Public.ajaxPost("../scm/ori/updateInc?action=updateInc", {
|
||||
postData: JSON.stringify(b)
|
||||
}, function(a) {
|
||||
200 === a.status ? (originalData.id = a.data.id, urlParam.id = a.data.id, parent.Public.tips({
|
||||
content: "修改成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
}), $(".wrapper").on("click", "#savaAndAdd", function(b) {
|
||||
b.preventDefault();
|
||||
var c = $(this);
|
||||
if (c.hasClass("ui-btn-dis")) return void parent.Public.tips({
|
||||
type: 2,
|
||||
content: "正在保存,请稍后..."
|
||||
});
|
||||
var d = THISPAGE.getPostData();
|
||||
d && (c.addClass("ui-btn-dis"), Public.ajaxPost("../scm/ori/addNewInc?action=addNewInc", {
|
||||
postData: JSON.stringify(d)
|
||||
}, function(b) {
|
||||
if (c.removeClass("ui-btn-dis"), 200 === b.status) {
|
||||
a.$_number.text(b.data.billNo), $("#grid").clearGridData(), $("#grid").clearGridData(!0);
|
||||
for (var d = 1; 8 >= d; d++) $("#grid").jqGrid("addRowData", d, {});
|
||||
a.newId = 9, a.$_note.val(""), parent.Public.tips({
|
||||
content: "保存成功!"
|
||||
})
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
}))
|
||||
}), $(".wrapper").on("click", "#add", function(a) {
|
||||
a.preventDefault(), Business.verifyRight("QTSR_ADD") && parent.tab.overrideSelectedTabItem({
|
||||
tabid: "money-otherIncome",
|
||||
text: "其他收入单",
|
||||
url: "../scm/ori/initInc?action=initInc"
|
||||
})
|
||||
}), $(".wrapper").on("click", "#print", function(a) {
|
||||
return Business.verifyRight("QTSR_PRINT") ? void(this.href += "&id=" + originalData.id) : void a.preventDefault()
|
||||
}), $("#prev").click(function(b) {
|
||||
return b.preventDefault(), $(this).hasClass("ui-btn-prev-dis") ? (parent.Public.tips({
|
||||
type: 2,
|
||||
content: "已经没有上一张了!"
|
||||
}), !1) : (a.idPostion = a.idPostion - 1, 0 === a.idPostion && $(this).addClass("ui-btn-prev-dis"), loading = $.dialog.tips("数据加载中...", 1e3, "loading.gif", !0), Public.ajaxGet("../scm/ori/updateInc?action=updateInc", {
|
||||
id: a.salesListIds[a.idPostion]
|
||||
}, function(a) {
|
||||
THISPAGE.reloadData(a.data), $("#next").removeClass("ui-btn-next-dis"), loading && loading.close()
|
||||
}), void 0)
|
||||
}), $("#next").click(function(b) {
|
||||
return b.preventDefault(), $(this).hasClass("ui-btn-next-dis") ? (parent.Public.tips({
|
||||
type: 2,
|
||||
content: "已经没有下一张了!"
|
||||
}), !1) : (a.idPostion = a.idPostion + 1, a.idLength === a.idPostion + 1 && $(this).addClass("ui-btn-next-dis"), loading = $.dialog.tips("数据加载中...", 1e3, "loading.gif", !0), Public.ajaxGet("../scm/ori/updateInc?action=updateInc", {
|
||||
id: a.salesListIds[a.idPostion]
|
||||
}, function(a) {
|
||||
THISPAGE.reloadData(a.data), $("#prev").removeClass("ui-btn-prev-dis"), loading && loading.close()
|
||||
}), void 0)
|
||||
}), $("#config").click(function(b) {
|
||||
a.mod_PageConfig.config()
|
||||
}), $(window).resize(function(a) {
|
||||
Public.autoGrid($("#grid"))
|
||||
})
|
||||
},
|
||||
resetData: function() {
|
||||
var a = this;
|
||||
$("#grid").clearGridData();
|
||||
for (var b = 1; 8 >= b; b++) $("#grid").jqGrid("addRowData", b, {}), $("#grid").jqGrid("footerData", "set", {
|
||||
qty: 0,
|
||||
amount: 0
|
||||
});
|
||||
a.$_amount.val(0)
|
||||
},
|
||||
calTotal: function() {
|
||||
for (var a = $("#grid").jqGrid("getDataIDs"), b = 0, c = 0, d = a.length; d > c; c++) {
|
||||
var e = a[c],
|
||||
f = $("#grid").jqGrid("getRowData", e);
|
||||
f.amount && (b += parseFloat(f.amount))
|
||||
}
|
||||
$("#grid").jqGrid("footerData", "set", {
|
||||
amount: b
|
||||
}), THISPAGE.$_amount.val(b)
|
||||
},
|
||||
_getEntriesData: function() {
|
||||
for (var a = [], b = $("#grid").jqGrid("getDataIDs"), c = 0, d = b.length; d > c; c++) {
|
||||
var e, f = b[c],
|
||||
g = $("#grid").jqGrid("getRowData", f);
|
||||
if ("" !== g.categoryName && "" !== g.amount) {
|
||||
var h = $("#" + f).data("categoryInfo");
|
||||
e = {
|
||||
categoryId: h.id,
|
||||
amount: g.amount,
|
||||
description: g.description
|
||||
}, a.push(e)
|
||||
}
|
||||
}
|
||||
return a
|
||||
},
|
||||
getPostData: function() {
|
||||
var a = this,
|
||||
b = this;
|
||||
null !== curRow && null !== curCol && ($("#grid").jqGrid("saveCell", curRow, curCol), curRow = null, curCol = null);
|
||||
var c = b.$_customer.find("input");
|
||||
if ("" === c.val() || "(空)" === c.val()) {
|
||||
var d = {};
|
||||
d.id = 0, d.name = "(空)", b.$_customer.removeData("contactInfo")
|
||||
} else {
|
||||
var d = b.$_customer.data("contactInfo");
|
||||
if (null === d) return setTimeout(function() {
|
||||
c.focus().select()
|
||||
}, 15), parent.Public.tips({
|
||||
type: 2,
|
||||
content: "当前客户不存在!"
|
||||
}), !1
|
||||
}
|
||||
var e = this._getEntriesData();
|
||||
if (e.length > 0) {
|
||||
a.calTotal();
|
||||
var f = {
|
||||
id: originalData.id,
|
||||
buId: d.id,
|
||||
contactName: d.name,
|
||||
date: $.trim(a.$_date.val()),
|
||||
billNo: $.trim(a.$_number.text()),
|
||||
entries: e,
|
||||
totalAmount: $("#grid").jqGrid("footerData", "get").amount.replace(/,/g, "")
|
||||
};
|
||||
return requiredMoney && (f.accId = a.accountCombo.getValue()), f
|
||||
}
|
||||
return parent.Public.tips({
|
||||
type: 2,
|
||||
content: "至少保存一条有效分录数据!"
|
||||
}), $("#grid").jqGrid("editCell", 1, 2, !0), !1
|
||||
}
|
||||
};
|
||||
$(function() {
|
||||
urlParam.id ? hasLoaded || Public.ajaxGet("../scm/ori/getIncDetail?action=getIncDetail", {
|
||||
id: urlParam.id
|
||||
}, function(a) {
|
||||
200 === a.status ? (originalData = a.data, THISPAGE.init(a.data), hasLoaded = !0) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: msg
|
||||
})
|
||||
}) : (originalData = {
|
||||
id: -1,
|
||||
status: "add",
|
||||
customer: 0,
|
||||
entries: [{
|
||||
id: "1"
|
||||
}, {
|
||||
id: "2"
|
||||
}, {
|
||||
id: "3"
|
||||
}, {
|
||||
id: "4"
|
||||
}, {
|
||||
id: "5"
|
||||
}, {
|
||||
id: "6"
|
||||
}, {
|
||||
id: "7"
|
||||
}, {
|
||||
id: "8"
|
||||
}],
|
||||
totalQty: 0,
|
||||
totalAmount: 0,
|
||||
disRate: 0,
|
||||
disAmount: 0,
|
||||
amount: "0.00",
|
||||
rpAmount: "0.00",
|
||||
arrears: "0.00"
|
||||
}, THISPAGE.init(originalData))
|
||||
});
|
||||
242
statics/js/dist/otherIncomeExpenseDetail.js
vendored
Executable file
242
statics/js/dist/otherIncomeExpenseDetail.js
vendored
Executable file
@@ -0,0 +1,242 @@
|
||||
define(["jquery", "print"], function(a, b, c) {
|
||||
function d() {
|
||||
k("#filter-fromDate").val(m.beginDate || ""), k("#filter-toDate").val(m.endDate || ""), m.beginDate && m.endDate && k("div.grid-subtitle").text("日期: " + m.beginDate + " 至 " + m.endDate), k("#filter-fromDate, #filter-toDate").datepicker(), Public.dateCheck();
|
||||
var a = {
|
||||
data: [{
|
||||
transType: "",
|
||||
transTypeName: "所有类别"
|
||||
}, {
|
||||
transType: "153401",
|
||||
transTypeName: "其它收入"
|
||||
}, {
|
||||
transType: "153402",
|
||||
transTypeName: "其它支出"
|
||||
}],
|
||||
text: "transTypeName",
|
||||
value: "transType",
|
||||
defaultSelected: 0,
|
||||
editable: !1,
|
||||
trigger: !0,
|
||||
extraListHtml: "",
|
||||
callback: {
|
||||
onChange: function(a) {
|
||||
switch (m.transType = a.transType, m.typeName = "", a.transType) {
|
||||
case "153401":
|
||||
k("#incomeName").removeClass("dn"), k("#expenseName").addClass("dn");
|
||||
break;
|
||||
case "153402":
|
||||
k("#incomeName").addClass("dn"), k("#expenseName").removeClass("dn")
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Business.categoryCombo(k("#incomeExpenseType"), a, !0);
|
||||
var b = {
|
||||
data: "../basedata/assist?action=list&isDelete=2&typeNumber=raccttype",
|
||||
text: "name",
|
||||
value: "id",
|
||||
addOptions: {
|
||||
value: "",
|
||||
text: "所有收入项目"
|
||||
},
|
||||
defaultSelected: 0,
|
||||
editable: !0,
|
||||
trigger: !0,
|
||||
cache: !1,
|
||||
extraListHtml: "",
|
||||
callback: {
|
||||
onChange: function(a) {
|
||||
return "undefined" == typeof a ? void(m.typeName = "") : void(m.typeName = a.name)
|
||||
}
|
||||
}
|
||||
};
|
||||
Business.categoryCombo(k("#incomeName"), b, !0);
|
||||
var c = {
|
||||
data: "../basedata/assist?action=list&isDelete=2&typeNumber=paccttype",
|
||||
text: "name",
|
||||
value: "id",
|
||||
addOptions: {
|
||||
value: "",
|
||||
text: "所有支出项目"
|
||||
},
|
||||
defaultSelected: 0,
|
||||
editable: !0,
|
||||
trigger: !0,
|
||||
cache: !1,
|
||||
extraListHtml: "",
|
||||
callback: {
|
||||
onChange: function(a) {
|
||||
return "undefined" == typeof a ? void(m.typeName = "") : void(m.typeName = a.name)
|
||||
}
|
||||
}
|
||||
};
|
||||
Business.categoryCombo(k("#expenseName"), c, !0), k("#filter-submit").on("click", function(a) {
|
||||
a.preventDefault();
|
||||
var b = k("#filter-fromDate").val(),
|
||||
c = k("#filter-toDate").val();
|
||||
return b && c && new Date(b).getTime() > new Date(c).getTime() ? void parent.Public.tips({
|
||||
type: 1,
|
||||
content: "开始日期不能大于结束日期"
|
||||
}) : (m.beginDate = b, paramsendDate = c, k("div.grid-subtitle").text("日期: " + b + " 至 " + c), void j())
|
||||
})
|
||||
}
|
||||
function e() {
|
||||
k("#btn-print").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("ORIDETAIL_PRINT") && k("div.ui-print").printTable()
|
||||
}), k("#btn-export").click(function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("ORIDETAIL_EXPORT")) {
|
||||
var b = {};
|
||||
for (var c in m) m[c] && (b[c] = m[c]);
|
||||
Business.getFile(n, b)
|
||||
}
|
||||
}), k("#config").click(function(a) {
|
||||
p.config()
|
||||
})
|
||||
}
|
||||
function f() {
|
||||
var a = !1,
|
||||
b = !1,
|
||||
c = !1;
|
||||
l.isAdmin !== !1 || l.rights.AMOUNT_COSTAMOUNT || (a = !0), l.isAdmin !== !1 || l.rights.AMOUNT_OUTAMOUNT || (b = !0), l.isAdmin !== !1 || l.rights.AMOUNT_INAMOUNT || (c = !0);
|
||||
var d = [{
|
||||
name: "date",
|
||||
label: "日期",
|
||||
width: 150,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billNo",
|
||||
label: "单据编号",
|
||||
width: 110,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "transTypeName",
|
||||
label: "收支类别",
|
||||
width: 110,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "typeName",
|
||||
label: "收支项目",
|
||||
width: 110,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "amountIn",
|
||||
label: "收入",
|
||||
align: "right",
|
||||
width: 120,
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.amountPlaces)
|
||||
}
|
||||
}, {
|
||||
name: "amountOut",
|
||||
label: "支出",
|
||||
width: 120,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
thousandsSeparator: ",",
|
||||
decimalPlaces: Number(l.amountPlaces)
|
||||
}
|
||||
}, {
|
||||
name: "contactName",
|
||||
label: "往来单位",
|
||||
width: 110,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "desc",
|
||||
label: "摘要",
|
||||
width: 110,
|
||||
align: "center"
|
||||
}],
|
||||
e = "local",
|
||||
f = "#";
|
||||
m.autoSearch && (e = "json", f = o), p.gridReg("grid", d), d = p.conf.grids.grid.colModel, k("#grid").jqGrid({
|
||||
url: f,
|
||||
postData: m,
|
||||
datatype: e,
|
||||
autowidth: !0,
|
||||
gridview: !0,
|
||||
colModel: d,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "date",
|
||||
sortorder: "desc",
|
||||
rowNum: 3e3,
|
||||
loadonce: !0,
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
forceFit: !0,
|
||||
footerrow: !0,
|
||||
userDataOnFooter: !0,
|
||||
cellLayout: 0,
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
userdata: "data.userdata",
|
||||
repeatitems: !1,
|
||||
id: "0"
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
var b;
|
||||
if (a && a.data) {
|
||||
var c = a.data.rows.length;
|
||||
b = c ? 31 * c : 1
|
||||
}
|
||||
g(b)
|
||||
},
|
||||
gridComplete: function() {
|
||||
k("#grid").footerData("set", {
|
||||
typeName: "合计:"
|
||||
})
|
||||
},
|
||||
resizeStop: function(a, b) {
|
||||
p.setGridWidthByIndex(a, b + 1, "grid")
|
||||
}
|
||||
}), m.autoSearch ? (k(".no-query").remove(), k(".ui-print").show()) : k(".ui-print").hide()
|
||||
}
|
||||
function g(a) {
|
||||
a && (g.h = a);
|
||||
var b = h(),
|
||||
c = g.h,
|
||||
d = i(),
|
||||
e = k("#grid");
|
||||
c > d && (c = d), b < e.width() && (c += 17), k("#grid-wrap").height(function() {
|
||||
return document.body.clientHeight - this.offsetTop - 36 - 5
|
||||
}), e.jqGrid("setGridHeight", c), e.jqGrid("setGridWidth", b, !1)
|
||||
}
|
||||
function h() {
|
||||
return k(window).width() - k("#grid-wrap").offset().left - 36 - 20
|
||||
}
|
||||
function i() {
|
||||
return k(window).height() - k("#grid").offset().top - 36 - 16
|
||||
}
|
||||
function j() {
|
||||
k(".no-query").remove(), k(".ui-print").show(), k("#grid").clearGridData(!0), k("#grid").jqGrid("setGridParam", {
|
||||
datatype: "json",
|
||||
postData: m,
|
||||
url: o
|
||||
}).trigger("reloadGrid")
|
||||
}
|
||||
var k = a("jquery"),
|
||||
l = parent.SYSTEM,
|
||||
m = k.extend({
|
||||
beginDate: "",
|
||||
endDate: "",
|
||||
transType: "",
|
||||
typeName: ""
|
||||
}, Public.urlParam()),
|
||||
n = "../report/oriDetail_export?action=export",
|
||||
o = "../report/oriDetail_detail?action=detail";
|
||||
a("print");
|
||||
var p = Public.mod_PageConfig.init("otherIncomeExpenseDetail");
|
||||
d(), e(), f();
|
||||
var q;
|
||||
k(window).on("resize", function(a) {
|
||||
q || (q = setTimeout(function() {
|
||||
g(), q = null
|
||||
}, 50))
|
||||
})
|
||||
});
|
||||
949
statics/js/dist/otherOutbound.js
vendored
Executable file
949
statics/js/dist/otherOutbound.js
vendored
Executable file
@@ -0,0 +1,949 @@
|
||||
var curRow, curCol, curArrears, loading, urlParam = Public.urlParam(),
|
||||
SYSTEM = parent.SYSTEM,
|
||||
hiddenAmount = !1,
|
||||
billRequiredCheck = 0,
|
||||
//billRequiredCheck = system.billRequiredCheck,
|
||||
disEditable = urlParam.disEditable,
|
||||
qtyPlaces = Number(parent.SYSTEM.qtyPlaces),
|
||||
pricePlaces = Number(parent.SYSTEM.pricePlaces),
|
||||
amountPlaces = Number(parent.SYSTEM.amountPlaces),
|
||||
hasLoaded = !1,
|
||||
originalData, defaultPage = Public.getDefaultPage(),
|
||||
THISPAGE = {
|
||||
init: function(a) {
|
||||
this.mod_PageConfig = Public.mod_PageConfig.init("otherOutbound"), SYSTEM.isAdmin !== !1 || SYSTEM.rights.AMOUNT_COSTAMOUNT || (hiddenAmount = !0), this.loadGrid(a), this.initDom(a), this.initCombo(), this.addEvent()
|
||||
},
|
||||
initDom: function(a) {
|
||||
this.$_customer = $("#customer"), this.$_date = $("#date").val(SYSTEM.endDate), this.$_number = $("#number"), this.$_transType = $("#transType"), this.$_note = $("#note"), this.$_toolTop = $("#toolTop"), this.$_toolBottom = $("#toolBottom"), this.$_userName = $("#userName"), this.$_modifyTime = $("#modifyTime"), this.$_createTime = $("#createTime"), this.customerArrears = 0;
|
||||
var b = ["id", a.transType || 150806];
|
||||
this.customerCombo = Business.billCustomerCombo($("#customer"), {
|
||||
defaultSelected: 0,
|
||||
emptyOptions: !0
|
||||
}), this.$_note.placeholder(), this.transTypeCombo = this.$_transType.combo({
|
||||
data: "../scm/invOi/queryTransType?action=queryTransType&type=out",
|
||||
ajaxOptions: {
|
||||
formatData: function(a) {
|
||||
return a.data.items
|
||||
}
|
||||
},
|
||||
width: 80,
|
||||
height: 300,
|
||||
text: "name",
|
||||
value: "id",
|
||||
defaultSelected: b,
|
||||
cache: !1,
|
||||
defaultFlag: !1
|
||||
}).getCombo(), this.$_date.datepicker({
|
||||
onSelect: function(a) {
|
||||
if (!(originalData.id > 0)) {
|
||||
var b = a.format("yyyy-MM-dd");
|
||||
THISPAGE.$_number.text(""), Public.ajaxPost("../basedata/systemProfile/generateDocNo?action=generateDocNo", {
|
||||
billType: "OO",
|
||||
billDate: b
|
||||
}, function(a) {
|
||||
200 === a.status ? THISPAGE.$_number.text(a.data.billNo) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
var c = "",
|
||||
d = "",
|
||||
e = "";
|
||||
if (billRequiredCheck && (c = '<a class="ui-btn" id="audit">审核</a>', d = '<a class="ui-btn" id="reAudit">反审核</a>'), this.btn_audit = c, this.btn_reaudit = d, this.btn_tempSave = e, this.btn_add = '<a id="savaAndAdd" class="ui-btn ui-btn-sp mrb">保存并新增</a><a id="save" class="ui-btn">保存</a>' + e, this.btn_edit = '<a id="add" class="ui-btn ui-btn-sp mrb">新增</a><a href="../scm/invOi/toOoPdf?action=toOoPdf&billType=OO" target="_blank" id="print" class="ui-btn mrb">打印</a><a id="edit" class="ui-btn">保存</a>', this.btn_view = '<a id="add" class="ui-btn ui-btn-sp mrb">新增</a><a href="../scm/invOi/toOoPdf?action=toOoPdf&billType=OO" target="_blank" id="print" class="ui-btn mrb">打印</a>', this.btn_p_n = '<a class="ui-btn-prev mrb" id="prev" title="上一张"><b></b></a><a class="ui-btn-next" id="next" title="下一张"><b></b></a>', a.id > 0) {
|
||||
if (this.$_customer.data("contactInfo", {
|
||||
id: a.buId,
|
||||
name: a.contactName
|
||||
}), this.customerCombo.input.val(a.contactName), this.$_number.text(a.billNo), this.$_date.val(a.date), a.description && this.$_note.val(a.description), $("#grid").jqGrid("footerData", "set", {
|
||||
qty: a.totalQty,
|
||||
amount: a.totalAmount
|
||||
}), "edit" === a.status) {
|
||||
var f = this.btn_edit + this.btn_audit;
|
||||
a.temp || (f += e), this.$_toolBottom.html(f), !a.temp
|
||||
} else a.checked ? ($("#mark").addClass("has-audit"), this.$_toolBottom.html(this.btn_view + this.btn_reaudit + this.btn_p_n)) : this.$_toolBottom.html(this.btn_view + this.btn_p_n);
|
||||
this.salesListIds = parent.salesListIds || [], this.idPostion = $.inArray(String(a.id), this.salesListIds), this.idLength = this.salesListIds.length, 0 === this.idPostion && $("#prev").addClass("ui-btn-prev-dis"), this.idPostion === this.idLength - 1 && $("#next").addClass("ui-btn-next-dis"), this.$_userName.html(a.userName), this.$_modifyTime.html(a.modifyTime), this.$_createTime.html(a.createTime)
|
||||
} else billRequiredCheck ? this.$_toolBottom.html(this.btn_add + this.btn_audit) : this.$_toolBottom.html(this.btn_add), this.$_userName.html(SYSTEM.realName || ""), this.$_modifyTime.parent().hide(), this.$_createTime.parent().hide()
|
||||
},
|
||||
disableEdit: function() {
|
||||
this.customerCombo.disable(), this.$_date.attr("disabled", "disabled").addClass("ui-input-dis"), this.$_note.attr("disabled", "disabled").addClass("ui-input-dis"), $("#grid").jqGrid("setGridParam", {
|
||||
cellEdit: !1
|
||||
}), this.editable = !1
|
||||
},
|
||||
enableEdit: function() {
|
||||
disEditable || (this.customerCombo.enable(), this.$_date.removeAttr("disabled").removeClass("ui-input-dis"), this.$_note.removeAttr("disabled").removeClass("ui-input-dis"), $("#grid").jqGrid("setGridParam", {
|
||||
cellEdit: !0
|
||||
}), this.editable = !0)
|
||||
},
|
||||
loadGrid: function(a) {
|
||||
function b(a, b, c) {
|
||||
return u(b.rowId), a ? a : c.invNumber ? c.invSpec ? c.invNumber + " " + c.invName + "_" + c.invSpec : c.invNumber + " " + c.invName : " "
|
||||
}
|
||||
function c(a, b) {
|
||||
var c = $(".goodsAuto")[0];
|
||||
return c
|
||||
}
|
||||
function d(a, b, c) {
|
||||
if ("get" === b) {
|
||||
if ("" !== $(".goodsAuto").getCombo().getValue()) return $(a).val();
|
||||
var d = $(a).parents("tr");
|
||||
return d.removeData("goodsInfo"), ""
|
||||
}
|
||||
"set" === b && $("input", a).val(c)
|
||||
}
|
||||
function e() {
|
||||
$("#initCombo").append($(".goodsAuto").val("").unbind("focus.once"))
|
||||
}
|
||||
function f(a, b) {
|
||||
var c = $(".skuAuto")[0];
|
||||
return c
|
||||
}
|
||||
function g(a, b, c) {
|
||||
if ("get" === b) {
|
||||
if ("" !== $(".skuAuto").getCombo().getValue()) return $(a).val();
|
||||
var d = $(a).parents("tr");
|
||||
return d.removeData("skuInfo"), ""
|
||||
}
|
||||
"set" === b && $("input", a).val(c)
|
||||
}
|
||||
function h() {
|
||||
$("#initCombo").append($(".skuAuto").val(""))
|
||||
}
|
||||
function i(a, b) {
|
||||
var c = $(".storageAuto")[0];
|
||||
return c
|
||||
}
|
||||
function j(a, b, c) {
|
||||
if ("get" === b) {
|
||||
if ("" !== $(".storageAuto").getCombo().getValue()) return $(a).val();
|
||||
var d = $(a).parents("tr");
|
||||
return d.removeData("storageInfo"), ""
|
||||
}
|
||||
"set" === b && $("input", a).val(c)
|
||||
}
|
||||
function k() {
|
||||
$("#initCombo").append($(".storageAuto").val(""))
|
||||
}
|
||||
function l(a, b) {
|
||||
var c = $(".unitAuto")[0];
|
||||
return c
|
||||
}
|
||||
function m(a, b, c) {
|
||||
if ("get" === b) {
|
||||
if ("" !== $(".unitAuto").getCombo().getValue()) return $(a).val();
|
||||
var d = $(a).parents("tr"),
|
||||
e = d.data("unitInfo") || {};
|
||||
return THISPAGE.unitCombo.selectByIndex(e.unitId || e.id), e.name || ""
|
||||
}
|
||||
"set" === b && $("input", a).val(c)
|
||||
}
|
||||
function n() {
|
||||
$("#initCombo").append($(".unitAuto").val(""))
|
||||
}
|
||||
function o(a, b) {
|
||||
var c = $(".dateAuto")[0];
|
||||
return c
|
||||
}
|
||||
function p(a, b, c) {
|
||||
return "get" === b ? a.val() : void("set" === b && $("input", a).val(c))
|
||||
}
|
||||
function q() {
|
||||
$("#initCombo").append($(".dateAuto"))
|
||||
}
|
||||
function r(a, b) {
|
||||
var c = $(".batchAuto")[0];
|
||||
return c
|
||||
}
|
||||
function s(a, b, c) {
|
||||
return "get" === b ? a.val() : void("set" === b && $("input", a).val(c))
|
||||
}
|
||||
function t() {
|
||||
$("#initCombo").append($(".batchAuto").val(""))
|
||||
}
|
||||
function u(a) {
|
||||
var b = $("#" + a).data("goodsInfo");
|
||||
if (b) {
|
||||
b.batch || $("#grid").jqGrid("setCell", a, "batch", " "), b.safeDays || ($("#grid").jqGrid("setCell", a, "prodDate", " "), $("#grid").jqGrid("setCell", a, "safeDays", " "), $("#grid").jqGrid("setCell", a, "validDate", " ")), 1 == b.isWarranty && $("#grid").jqGrid("showCol", "batch"), b.safeDays > 0 && ($("#grid").jqGrid("showCol", "prodDate"), $("#grid").jqGrid("showCol", "safeDays"), $("#grid").jqGrid("showCol", "validDate"));
|
||||
var c = {
|
||||
skuName: b.skuName || "",
|
||||
mainUnit: b.mainUnit || b.unitName,
|
||||
unitId: b.unitId,
|
||||
qty: b.qty || 1,
|
||||
price: b.price || 0,
|
||||
amount: b.amount,
|
||||
locationName: b.locationName,
|
||||
locationId: b.locationId,
|
||||
serNumList: b.serNumList,
|
||||
safeDays: b.safeDays
|
||||
};
|
||||
SYSTEM.ISSERNUM && b.isSerNum && (c.qty = c.serNumList ? c.serNumList.length : 0), c.amount = c.amount ? c.amount : c.price * c.qty;
|
||||
var d = (Number(c.amount), $("#grid").jqGrid("setRowData", a, c));
|
||||
d && THISPAGE.calTotal()
|
||||
}
|
||||
}
|
||||
var v = this,
|
||||
w = (new Date).format();
|
||||
if (a.id) {
|
||||
for (var x = 0; x < a.entries.length; x++) a.entries[x].id = x + 1;
|
||||
var y = 8 - a.entries.length;
|
||||
if (y > 0) for (var x = 0; y > x; x++) a.entries.push({})
|
||||
}
|
||||
v.newId = 9;
|
||||
var z = "grid",
|
||||
A = [{
|
||||
name: "operating",
|
||||
label: " ",
|
||||
width: 40,
|
||||
fixed: !0,
|
||||
formatter: Public.billsOper,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "goods",
|
||||
label: "商品",
|
||||
width: 320,
|
||||
title: !0,
|
||||
classes: "goods",
|
||||
formatter: b,
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: c,
|
||||
custom_value: d,
|
||||
handle: e,
|
||||
trigger: "ui-icon-ellipsis"
|
||||
}
|
||||
}, {
|
||||
name: "skuId",
|
||||
label: "属性ID",
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "skuName",
|
||||
label: "属性",
|
||||
width: 100,
|
||||
classes: "ui-ellipsis skuInfo",
|
||||
hidden: !SYSTEM.enableAssistingProp,
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: f,
|
||||
custom_value: g,
|
||||
handle: h,
|
||||
trigger: "ui-icon-ellipsis"
|
||||
}
|
||||
}, {
|
||||
name: "mainUnit",
|
||||
label: "单位",
|
||||
width: 80,
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: l,
|
||||
custom_value: m,
|
||||
handle: n,
|
||||
trigger: "ui-icon-triangle-1-s"
|
||||
}
|
||||
}, {
|
||||
name: "unitId",
|
||||
label: "单位Id",
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "locationName",
|
||||
label: "仓库",
|
||||
nameExt: '<small id="batchStorage">(批量)</small>',
|
||||
width: 100,
|
||||
title: !0,
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: i,
|
||||
custom_value: j,
|
||||
handle: k,
|
||||
trigger: "ui-icon-triangle-1-s"
|
||||
}
|
||||
}, {
|
||||
name: "batch",
|
||||
label: "批次",
|
||||
width: 90,
|
||||
classes: "ui-ellipsis batch",
|
||||
hidden: !0,
|
||||
title: !1,
|
||||
editable: !0,
|
||||
align: "left",
|
||||
edittype: "custom",
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: r,
|
||||
custom_value: s,
|
||||
handle: t,
|
||||
trigger: "ui-icon-ellipsis"
|
||||
}
|
||||
}, {
|
||||
name: "prodDate",
|
||||
label: "生产日期",
|
||||
width: 90,
|
||||
hidden: !0,
|
||||
title: !1,
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: o,
|
||||
custom_value: p,
|
||||
handle: q
|
||||
}
|
||||
}, {
|
||||
name: "safeDays",
|
||||
label: "保质期(天)",
|
||||
width: 90,
|
||||
hidden: !0,
|
||||
title: !1,
|
||||
align: "left"
|
||||
}, {
|
||||
name: "validDate",
|
||||
label: "有效期至",
|
||||
width: 90,
|
||||
hidden: !0,
|
||||
title: !1,
|
||||
align: "left"
|
||||
}, {
|
||||
name: "qty",
|
||||
label: "数量",
|
||||
width: 80,
|
||||
align: "right",
|
||||
formatter: "number",
|
||||
formatoptions: {
|
||||
decimalPlaces: qtyPlaces
|
||||
},
|
||||
editable: !0
|
||||
}, {
|
||||
name: "price",
|
||||
label: "出库单位成本",
|
||||
hidden: hiddenAmount,
|
||||
width: 100,
|
||||
fixed: !0,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
showZero: !0,
|
||||
decimalPlaces: pricePlaces
|
||||
}
|
||||
}, {
|
||||
name: "amount",
|
||||
label: "出库成本",
|
||||
hidden: hiddenAmount,
|
||||
width: 100,
|
||||
fixed: !0,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
showZero: !0,
|
||||
decimalPlaces: amountPlaces
|
||||
}
|
||||
}, {
|
||||
name: "description",
|
||||
label: "备注",
|
||||
width: 150,
|
||||
title: !0,
|
||||
editable: !0
|
||||
}];
|
||||
v.mod_PageConfig.gridReg(z, A), A = v.mod_PageConfig.conf.grids[z].colModel, $("#grid").jqGrid({
|
||||
data: a.entries,
|
||||
datatype: "clientSide",
|
||||
autowidth: !0,
|
||||
height: "100%",
|
||||
rownumbers: !0,
|
||||
gridview: !0,
|
||||
onselectrow: !1,
|
||||
colModel: A,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
shrinkToFit: !1,
|
||||
forceFit: !0,
|
||||
rowNum: 1e3,
|
||||
cellEdit: !1,
|
||||
cellsubmit: "clientArray",
|
||||
localReader: {
|
||||
root: "rows",
|
||||
records: "records",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
jsonReader: {
|
||||
root: "data.entries",
|
||||
records: "records",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
if (urlParam.id > 0 || urlParam.cacheId) {
|
||||
var b = a.rows,
|
||||
c = b.length;
|
||||
v.newId = c + 1;
|
||||
for (var d = 0; c > d; d++) {
|
||||
var e = d + 1,
|
||||
f = b[d];
|
||||
if ($.isEmptyObject(b[d])) break;
|
||||
var g = $.extend(!0, {
|
||||
id: f.invId,
|
||||
number: f.invNumber,
|
||||
name: f.invName,
|
||||
spec: f.invSpec,
|
||||
unitId: f.unitId,
|
||||
unitName: f.mainUnit,
|
||||
isSerNum: f.isSerNum,
|
||||
serNumList: f.serNumList || f.invSerNumList
|
||||
}, f);
|
||||
Business.cacheManage.getGoodsInfoByNumber(g.number, function(a) {
|
||||
g.isSerNum = a.isSerNum, g.isWarranty = f.isWarranty = a.isWarranty, g.safeDays = f.safeDays = a.safeDays, g.invSkus = a.invSkus, g.id = f.invId, $("#" + e).data("goodsInfo", g).data("storageInfo", {
|
||||
id: f.locationId,
|
||||
name: f.locationName
|
||||
}).data("unitInfo", {
|
||||
unitId: f.unitId,
|
||||
name: f.mainUnit
|
||||
}).data("skuInfo", {
|
||||
name: f.skuName,
|
||||
id: f.skuId
|
||||
})
|
||||
}), 1 == f.isWarranty && $("#grid").jqGrid("showCol", "batch"), f.safeDays > 0 && ($("#grid").jqGrid("showCol", "prodDate"), $("#grid").jqGrid("showCol", "safeDays"), $("#grid").jqGrid("showCol", "validDate"))
|
||||
}
|
||||
}
|
||||
},
|
||||
gridComplete: function() {
|
||||
setTimeout(function() {
|
||||
Public.autoGrid($("#grid"))
|
||||
}, 10)
|
||||
},
|
||||
afterEditCell: function(a, b, c, d, e) {
|
||||
function f() {
|
||||
var b = $("#" + a).data("goodsInfo");
|
||||
if (b) {
|
||||
var c = $("#grid").jqGrid("getRowData", a);
|
||||
b = $.extend(!0, {}, b), b.skuName = c.skuName, b.mainUnit = c.mainUnit, b.unitId = c.unitId, b.qty = c.qty, b.price = c.price, b.discountRate = c.discountRate, b.deduction = c.deduction, b.amount = c.amount, b.taxRate = c.taxRate, b.tax = c.tax, b.taxAmount = c.taxAmount, b.locationName = c.locationName, $("#" + a).data("goodsInfo", b)
|
||||
}
|
||||
}
|
||||
if (THISPAGE.curID = a, "goods" === b && (f(), $("#" + d + "_goods", "#grid").val(c), THISPAGE.goodsCombo.selectByText(c)), "skuName" === b) {
|
||||
f();
|
||||
var g = $("#" + a).data("goodsInfo");
|
||||
if (!g || !g.invSkus || !g.invSkus.length) return $("#grid").jqGrid("restoreCell", d, e), curCol = e + 1, $("#grid").jqGrid("nextCell", d, e + 1), void THISPAGE.skuCombo.loadData([]);
|
||||
if ("string" == typeof g.invSkus && (g.invSkus = $.parseJSON(g.invSkus)), $("#" + d + "_skuName", "#grid").val(c), THISPAGE.skuCombo.loadData(g.invSkus || [], 1, !1), THISPAGE.skuCombo.selectByText(c), !g) return;
|
||||
SYSTEM.ISSERNUM && 1 == g.isSerNum && Business.serNumManage({
|
||||
row: $("#" + a),
|
||||
enableStorage: !0,
|
||||
enableSku: !0
|
||||
})
|
||||
}
|
||||
if ("qty" === b) {
|
||||
f();
|
||||
var g = $("#" + a).data("goodsInfo");
|
||||
if (!g) return;
|
||||
SYSTEM.ISSERNUM && 1 == g.isSerNum && Business.serNumManage({
|
||||
row: $("#" + a),
|
||||
enableStorage: 0 == c,
|
||||
enableSku: 0 == c
|
||||
})
|
||||
}
|
||||
if ("locationName" === b) {
|
||||
$("#" + d + "_locationName", "#grid").val(c), THISPAGE.storageCombo.selectByText(c);
|
||||
var g = $("#" + a).data("goodsInfo");
|
||||
$("#" + a).data("storageInfo") || {};
|
||||
if (!g) return;
|
||||
SYSTEM.ISSERNUM && 1 == g.isSerNum && Business.serNumManage({
|
||||
row: $("#" + a),
|
||||
enableStorage: !0,
|
||||
enableSku: !0
|
||||
})
|
||||
}
|
||||
if ("batch" === b) {
|
||||
var g = $("#" + a).data("goodsInfo");
|
||||
if (!g) return $("#grid").jqGrid("restoreCell", d, e), curCol = e + 1, void $("#grid").jqGrid("nextCell", d, e + 1);
|
||||
$("#" + d + "_batch", "#grid").val(c), THISPAGE.batchCombo.selectByText(c)
|
||||
}
|
||||
if ("prodDate" === b) {
|
||||
var g = $("#" + a).data("goodsInfo");
|
||||
if (!g) return $("#grid").jqGrid("restoreCell", d, e), curCol = e + 1, void $("#grid").jqGrid("nextCell", d, e + 1);
|
||||
if (!g.safeDays) return $("#grid").jqGrid("restoreCell", d, e), curCol = e + 1, void $("#grid").jqGrid("nextCell", d, e + 1);
|
||||
c ? THISPAGE.cellPikaday.setDate(c) : THISPAGE.cellPikaday.setDate(THISPAGE.cellPikaday.getDate() || new Date)
|
||||
}
|
||||
if ("mainUnit" === b) {
|
||||
$("#" + d + "_mainUnit", "#grid").val(c);
|
||||
var h = $("#" + a).data("unitInfo") || {};
|
||||
if (!h.unitId || "0" === h.unitId) return void $("#grid").jqGrid("saveCell", d, e);
|
||||
THISPAGE.unitCombo.enable(), THISPAGE.unitCombo.loadData(function() {
|
||||
for (var a = {}, b = 0; b < SYSTEM.unitInfo.length; b++) {
|
||||
var c = SYSTEM.unitInfo[b],
|
||||
d = h.unitId;
|
||||
h.unitId == c.id && (h = c), h.unitId = d;
|
||||
var e = c.unitTypeId || b;
|
||||
a[e] || (a[e] = []), a[e].push(c)
|
||||
}
|
||||
return h.unitTypeId ? a[h.unitTypeId] : [h]
|
||||
}), THISPAGE.unitCombo.selectByText(c)
|
||||
}
|
||||
},
|
||||
formatCell: function(a, b, c, d, e) {},
|
||||
beforeSubmitCell: function(a, b, c, d, e) {},
|
||||
beforeSaveCell: function(a, b, c, d, e) {
|
||||
if ("goods" === b) {
|
||||
var f = $("#" + a).data("goodsInfo");
|
||||
if (!f) {
|
||||
v.skey = c;
|
||||
var g, h = function(b) {
|
||||
$("#" + a).data("goodsInfo", b).data("storageInfo", {
|
||||
id: b.locationId,
|
||||
name: b.locationName
|
||||
}).data("unitInfo", {
|
||||
unitId: b.unitId,
|
||||
name: b.unitName
|
||||
}), g = Business.formatGoodsName(b)
|
||||
};
|
||||
return THISPAGE.$_barCodeInsert && THISPAGE.$_barCodeInsert.hasClass("active") ? Business.cacheManage.getGoodsInfoByBarCode(c, h, !0) : Business.cacheManage.getGoodsInfoByNumber(c, h, !0), g ? g : ($.dialog({
|
||||
width: 775,
|
||||
height: 510,
|
||||
title: "选择商品",
|
||||
content: "url:../settings/goods_batch",
|
||||
data: {
|
||||
skuMult: SYSTEM.enableAssistingProp,
|
||||
skey: v.skey,
|
||||
callback: function(a, b, c) {
|
||||
"" === b && ($("#grid").jqGrid("addRowData", a, {}, "last"), v.newId = a + 1), setTimeout(function() {
|
||||
$("#grid").jqGrid("editCell", c, 2, !0)
|
||||
}, 10), v.calTotal()
|
||||
}
|
||||
},
|
||||
init: function() {
|
||||
v.skey = ""
|
||||
},
|
||||
lock: !0,
|
||||
button: [{
|
||||
name: "选中",
|
||||
defClass: "ui_state_highlight fl",
|
||||
focus: !0,
|
||||
callback: function() {
|
||||
return this.content.callback && this.content.callback(), !1
|
||||
}
|
||||
}, {
|
||||
name: "选中并关闭",
|
||||
defClass: "ui_state_highlight",
|
||||
callback: function() {
|
||||
return this.content.callback(), this.close(), !1
|
||||
}
|
||||
}, {
|
||||
name: "关闭",
|
||||
callback: function() {
|
||||
return !0
|
||||
}
|
||||
}]
|
||||
}), setTimeout(function() {
|
||||
$("#grid").jqGrid("editCell", curRow, 2, !0), $("#grid").jqGrid("setCell", curRow, 2, "")
|
||||
}, 10), " ")
|
||||
}
|
||||
}
|
||||
return c
|
||||
},
|
||||
afterSaveCell: function(a, b, c, d, e) {
|
||||
switch (b) {
|
||||
case "goods":
|
||||
break;
|
||||
case "qty":
|
||||
THISPAGE.calTotal();
|
||||
break;
|
||||
case "batch":
|
||||
var f = $("#grid").jqGrid("getRowData", a),
|
||||
g = $("#" + a).data("goodsInfo") || {};
|
||||
if (g.safeDays) {
|
||||
var h = {};
|
||||
if ($.trim(f.prodDate) || (h.prodDate = w), $.trim(f.safeDays) || (h.safeDays = g.safeDays), !$.trim(f.validDate)) {
|
||||
var i = f.prodDate || h.prodDate,
|
||||
j = i.split("-");
|
||||
if (i = new Date(j[0], j[1] - 1, j[2]), "Invalid Date" === i.toString()) return defaultPage.Public.tips({
|
||||
type: 2,
|
||||
content: "日期格式错误!"
|
||||
}), void setTimeout(function() {
|
||||
$("#grid").jqGrid("editCellByColName", a, "prodDate")
|
||||
}, 10);
|
||||
i && (i.addDays(Number(f.safeDays || h.safeDays)), h.validDate = i.format())
|
||||
}
|
||||
$.isEmptyObject(h) || $("#grid").jqGrid("setRowData", a, h)
|
||||
}
|
||||
break;
|
||||
case "prodDate":
|
||||
var f = $("#grid").jqGrid("getRowData", a),
|
||||
g = $("#" + a).data("goodsInfo") || {},
|
||||
h = {};
|
||||
$.trim(f.safeDays) || (h.safeDays = g.safeDays || 30), $.trim(c) || (h.prodDate = w);
|
||||
var i = c || h.prodDate,
|
||||
j = i.split("-");
|
||||
if (i = new Date(j[0], j[1] - 1, j[2]), "Invalid Date" === i.toString()) return defaultPage.Public.tips({
|
||||
type: 2,
|
||||
content: "日期格式错误!"
|
||||
}), void setTimeout(function() {
|
||||
$("#grid").jqGrid("editCellByColName", a, "prodDate")
|
||||
}, 10);
|
||||
i && (i.addDays(Number(f.safeDays || h.safeDays)), h.validDate = i.format()), $("#grid").jqGrid("setRowData", a, h)
|
||||
}
|
||||
},
|
||||
loadonce: !0,
|
||||
resizeStop: function(a, b) {
|
||||
v.mod_PageConfig.setGridWidthByIndex(a, b, "grid")
|
||||
},
|
||||
footerrow: !0,
|
||||
userData: {
|
||||
goods: "合计:",
|
||||
qty: a.totalQty,
|
||||
amount: a.totalAmount
|
||||
},
|
||||
userDataOnFooter: !0,
|
||||
loadError: function(a, b, c) {
|
||||
Public.tips({
|
||||
type: 1,
|
||||
content: "Type: " + b + "; Response: " + a.status + " " + a.statusText
|
||||
})
|
||||
}
|
||||
}), $("#grid").jqGrid("setGridParam", {
|
||||
cellEdit: !0
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
function b() {
|
||||
c.$_customer.data("contactInfo", {
|
||||
id: a.buId,
|
||||
name: a.contactName
|
||||
}), c.customerCombo.input.val(a.contactName), c.$_date.val(a.date), c.$_number.text(a.billNo), c.$_note.val(a.description), c.$_userName.html(a.userName), c.$_modifyTime.html(a.modifyTime), c.$_createTime.html(a.createTime)
|
||||
}
|
||||
$("#grid").clearGridData();
|
||||
var c = this,
|
||||
d = 8 - a.entries.length;
|
||||
if (d > 0) for (var e = 0; d > e; e++) a.entries.push({});
|
||||
$("#grid").jqGrid("setGridParam", {
|
||||
data: a.entries,
|
||||
userData: {
|
||||
qty: a.totalQty,
|
||||
amount: a.totalAmount
|
||||
},
|
||||
cellEdit: !0,
|
||||
datatype: "clientSide"
|
||||
}).trigger("reloadGrid"), b(), "edit" === a.status ? this.editable || (this.customerCombo.enable(), this.$_date.removeAttr("disabled"), this.editable = !0, this.$_toolBottom.html(c.btn_edit + c.btn_audit), $("#mark").removeClass("has-audit")) : this.editable && (this.customerCombo.disable(), this.$_date.attr("disabled", "disabled"), this.editable = !1, $("#groupBtn").html(c.btn_view + c.btn_reaudit), $("#mark").addClass("has-audit"))
|
||||
},
|
||||
initCombo: function() {
|
||||
this.goodsCombo = Business.billGoodsCombo($(".goodsAuto")), this.skuCombo = Business.billskuCombo($(".skuAuto"), {
|
||||
data: []
|
||||
}), this.storageCombo = Business.billStorageCombo($(".storageAuto")), this.unitCombo = Business.unitCombo($(".unitAuto"), {
|
||||
defaultSelected: -1,
|
||||
forceSelection: !1
|
||||
}), this.cellPikaday = new Pikaday({
|
||||
field: $(".dateAuto")[0],
|
||||
editable: !1
|
||||
}), this.batchCombo = Business.batchCombo($(".batchAuto"))
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
this.customerCombo.input.enterKey(), this.$_date.bind("keydown", function(a) {
|
||||
13 === a.which && $("#grid").jqGrid("editCell", 1, 2, !0)
|
||||
}).bind("focus", function(b) {
|
||||
a.dateValue = $(this).val()
|
||||
}).bind("blur", function(b) {
|
||||
var c = /((^((1[8-9]\d{2})|([2-9]\d{3}))(-)(10|12|0?[13578])(-)(3[01]|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))(-)(11|0?[469])(-)(30|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))(-)(0?2)(-)(2[0-8]|1[0-9]|0?[1-9])$)|(^([2468][048]00)(-)(0?2)(-)(29)$)|(^([3579][26]00)(-)(0?2)(-)(29)$)|(^([1][89][0][48])(-)(0?2)(-)(29)$)|(^([2-9][0-9][0][48])(-)(0?2)(-)(29)$)|(^([1][89][2468][048])(-)(0?2)(-)(29)$)|(^([2-9][0-9][2468][048])(-)(0?2)(-)(29)$)|(^([1][89][13579][26])(-)(0?2)(-)(29)$)|(^([2-9][0-9][13579][26])(-)(0?2)(-)(29)$))/;
|
||||
c.test($(this).val()) || (parent.Public.tips({
|
||||
type: 2,
|
||||
content: "日期格式有误!如:2012-08-08。"
|
||||
}), $(this).val(a.dateValue))
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-triangle-1-s", function(a) {
|
||||
var b = $(this).siblings(),
|
||||
c = b.getCombo();
|
||||
setTimeout(function() {
|
||||
c.active = !0, c.doQuery()
|
||||
}, 10)
|
||||
}), Business.billsEvent(a, "otherOutbound"), $(".wrapper").on("click", "#save", function(b) {
|
||||
b.preventDefault();
|
||||
var c = $(this);
|
||||
if (c.hasClass("ui-btn-dis")) return void parent.Public.tips({
|
||||
type: 2,
|
||||
content: "正在保存,请稍后..."
|
||||
});
|
||||
var d = THISPAGE.getPostData();
|
||||
d && ("edit" === originalData.stata && (d.id = originalData.id, d.stata = "edit"), c.addClass("ui-btn-dis"), Public.ajaxPost("../scm/invOi/addOo?action=addOo&type=out", {
|
||||
postData: JSON.stringify(d)
|
||||
}, function(b) {
|
||||
c.removeClass("ui-btn-dis"), 200 === b.status ? (a.$_modifyTime.html((new Date).format("yyyy-MM-dd hh:mm:ss")).parent().show(), a.$_createTime.html((new Date).format("yyyy-MM-dd hh:mm:ss")).parent().show(), originalData.id = b.data.id, urlParam.id = b.data.id, THISPAGE.reloadData(b.data), billRequiredCheck ? a.$_toolBottom.html(a.btn_edit + a.btn_audit) : a.$_toolBottom.html(a.btn_edit), parent.Public.tips({
|
||||
content: "保存成功!"
|
||||
}), originalData.callback && originalData.callback("out")) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
}))
|
||||
}), $(".wrapper").on("click", "#edit", function(b) {
|
||||
if (b.preventDefault(), Business.verifyRight("OO_UPDATE")) {
|
||||
var c = THISPAGE.getPostData();
|
||||
c && Public.ajaxPost("../scm/invOi/updateOo?action=updateOo&type=out", {
|
||||
postData: JSON.stringify(c)
|
||||
}, function(b) {
|
||||
200 === b.status ? (a.$_modifyTime.html((new Date).format("yyyy-MM-dd hh:mm:ss")).parent().show(), originalData.id = b.data.id, urlParam.id = b.data.id, THISPAGE.reloadData(b.data), parent.Public.tips({
|
||||
content: "修改成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
}), $(".wrapper").on("click", "#audit", function(b) {
|
||||
if (b.preventDefault(), Business.verifyRight("OO_CHECK")) {
|
||||
var c = THISPAGE.getPostData();
|
||||
c && Public.ajaxPost("../scm/invOi/checkInvOo?action=checkInvOo", {
|
||||
postData: JSON.stringify(c)
|
||||
}, function(b) {
|
||||
200 === b.status ? (originalData.id = b.data.id, urlParam.id = b.data.id, THISPAGE.reloadData(b.data), $("#mark").addClass("has-audit"), $("#edit").hide(), a.disableEdit(), a.$_toolBottom.html(a.btn_view + a.btn_reaudit), parent.Public.tips({
|
||||
content: "审核成功!"
|
||||
}), originalData.callback && originalData.callback("out")) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
}), $(".wrapper").on("click", "#reAudit", function(b) {
|
||||
if (b.preventDefault(), Business.verifyRight("OO_UNCHECK")) {
|
||||
var c = $(this);
|
||||
c.ajaxPost("../scm/invOi/rsBatchCheckInvOo?action=rsBatchCheckInvOo", {
|
||||
id: originalData.id
|
||||
}, function(b) {
|
||||
200 === b.status ? ($("#mark").removeClass(), $("#edit").show(), a.enableEdit(), a.$_toolBottom.html(a.btn_edit + a.btn_audit), parent.Public.tips({
|
||||
content: "反审核成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
}), $(".wrapper").on("click", "#savaAndAdd", function(b) {
|
||||
b.preventDefault();
|
||||
var c = $(this);
|
||||
if (c.hasClass("ui-btn-dis")) return void parent.Public.tips({
|
||||
type: 2,
|
||||
content: "正在保存,请稍后..."
|
||||
});
|
||||
var d = THISPAGE.getPostData();
|
||||
d && (c.addClass("ui-btn-dis"), Public.ajaxPost("../scm/invOi/addNewOo?action=addNewOo&type=out", {
|
||||
postData: JSON.stringify(d)
|
||||
}, function(b) {
|
||||
if (c.removeClass("ui-btn-dis"), 200 === b.status) {
|
||||
a.$_number.text(b.data.billNo), $("#grid").clearGridData(), $("#grid").clearGridData(!0);
|
||||
for (var d = 1; 8 >= d; d++) $("#grid").jqGrid("addRowData", d, {});
|
||||
a.newId = 9, a.$_note.val(""), parent.Public.tips({
|
||||
content: "保存成功!"
|
||||
})
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
}))
|
||||
}), $(".wrapper").on("click", "#add", function(a) {
|
||||
a.preventDefault(), Business.verifyRight("OO_ADD") && parent.tab.overrideSelectedTabItem({
|
||||
tabid: "storage-otherOutbound",
|
||||
text: "其他出库",
|
||||
url: "../scm/invOi?action=initOi&type=out"
|
||||
})
|
||||
}), $(".wrapper").on("click", "#print", function(a) {
|
||||
return Business.verifyRight("OO_PRINT") ? void(this.href += "&id=" + originalData.id) : void a.preventDefault()
|
||||
}), $("#prev").click(function(b) {
|
||||
return b.preventDefault(), $(this).hasClass("ui-btn-prev-dis") ? (parent.Public.tips({
|
||||
type: 2,
|
||||
content: "已经没有上一张了!"
|
||||
}), !1) : (a.idPostion = a.idPostion - 1, 0 === a.idPostion && $(this).addClass("ui-btn-prev-dis"), loading = $.dialog.tips("数据加载中...", 1e3, "loading.gif", !0), Public.ajaxGet("../scm/invOi/updateOut?action=updateOut&type=out", {
|
||||
id: a.salesListIds[a.idPostion]
|
||||
}, function(a) {
|
||||
THISPAGE.reloadData(a.data), $("#next").removeClass("ui-btn-next-dis"), loading && loading.close()
|
||||
}), void 0)
|
||||
}), $("#next").click(function(b) {
|
||||
return b.preventDefault(), $(this).hasClass("ui-btn-next-dis") ? (parent.Public.tips({
|
||||
type: 2,
|
||||
content: "已经没有下一张了!"
|
||||
}), !1) : (a.idPostion = a.idPostion + 1, a.idLength === a.idPostion + 1 && $(this).addClass("ui-btn-next-dis"), loading = $.dialog.tips("数据加载中...", 1e3, "loading.gif", !0), Public.ajaxGet("../scm/invOi/updateOut?action=updateOut&type=out", {
|
||||
id: a.salesListIds[a.idPostion]
|
||||
}, function(a) {
|
||||
THISPAGE.reloadData(a.data), $("#prev").removeClass("ui-btn-prev-dis"), loading && loading.close()
|
||||
}), void 0)
|
||||
}), $("#grid").on("click", 'tr[role="row"]', function(a) {
|
||||
if ($("#mark").hasClass("has-audit")) {
|
||||
var b = $(this),
|
||||
c = (b.prop("id"), b.data("goodsInfo"));
|
||||
if (!c) return;
|
||||
SYSTEM.ISSERNUM && 1 == c.isSerNum && Business.serNumManage({
|
||||
row: b,
|
||||
view: !0
|
||||
})
|
||||
}
|
||||
}), $("#config").show().click(function(b) {
|
||||
a.mod_PageConfig.config()
|
||||
}), $(window).resize(function(a) {
|
||||
Public.autoGrid($("#grid"))
|
||||
})
|
||||
},
|
||||
resetData: function() {
|
||||
var a = this;
|
||||
$("#grid").clearGridData();
|
||||
for (var b = 1; 8 >= b; b++) $("#grid").jqGrid("addRowData", b, {}), $("#grid").jqGrid("footerData", "set", {
|
||||
qty: 0,
|
||||
amount: 0
|
||||
});
|
||||
a.$_note.val(""), a.$_discountRate.val(originalData.disRate), a.$_deduction.val(originalData.disAmount), a.$_discount.val(originalData.amount), a.$_payment.val(originalData.rpAmount), a.$_arrears.val(originalData.arrears)
|
||||
},
|
||||
calTotal: function() {
|
||||
for (var a = $("#grid").jqGrid("getDataIDs"), b = 0, c = 0, d = 0, e = a.length; e > d; d++) {
|
||||
var f = a[d],
|
||||
g = $("#grid").jqGrid("getRowData", f);
|
||||
g.qty && (b += parseFloat(g.qty)), g.amount && (c += parseFloat(g.amount))
|
||||
}
|
||||
$("#grid").jqGrid("footerData", "set", {
|
||||
qty: b,
|
||||
amount: c
|
||||
})
|
||||
},
|
||||
_getEntriesData: function(a) {
|
||||
a = a || {};
|
||||
for (var b = [], c = $("#grid").jqGrid("getDataIDs"), d = 0, e = c.length; e > d; d++) {
|
||||
var f, g = c[d],
|
||||
h = $("#grid").jqGrid("getRowData", g);
|
||||
if ("" !== h.goods) {
|
||||
var i = $("#" + g).data("goodsInfo"),
|
||||
j = $("#" + g).data("skuInfo") || {};
|
||||
if (i.invSkus && i.invSkus.length > 0 && !j.id) return parent.Public.tips({
|
||||
type: 2,
|
||||
content: "请选择相应的属性!"
|
||||
}), $("#grid").jqGrid("editCellByColName", g, "skuName"), !1;
|
||||
var k = $("#" + g).data("storageInfo");
|
||||
if (!k || !k.id) return parent.Public.tips({
|
||||
type: 2,
|
||||
content: "请选择相应的仓库!"
|
||||
}), $("#grid").jqGrid("editCellByColName", g, "locationName"), !1;
|
||||
var l = $("#" + g).data("unitInfo") || {};
|
||||
if (SYSTEM.ISSERNUM) {
|
||||
var m = i.serNumList;
|
||||
if (m && m.length == Number(h.qty));
|
||||
else {
|
||||
var n = !1,
|
||||
o = "点击";
|
||||
if (1 == i.isSerNum && (n = !0, a.checkSerNum && (n = !0)), n) return parent.Public.tips({
|
||||
type: 2,
|
||||
content: "请" + o + "数量设置【" + i.name + "】的序列号"
|
||||
}), $("#grid").jqGrid("editCellByColName", g, "qty"), !1
|
||||
}
|
||||
}
|
||||
f = {
|
||||
invId: i.id,
|
||||
invNumber: i.number,
|
||||
invName: i.name,
|
||||
invSpec: i.spec || "",
|
||||
skuId: j.id || -1,
|
||||
skuName: j.name || "",
|
||||
unitId: l.unitId || -1,
|
||||
mainUnit: l.name || "",
|
||||
qty: h.qty,
|
||||
price: h.price,
|
||||
amount: h.amount,
|
||||
description: h.description,
|
||||
locationId: k.id,
|
||||
locationName: k.name,
|
||||
serNumList: m
|
||||
}, SYSTEM.ISWARRANTY && $.extend(!0, f, {
|
||||
batch: h.batch || "",
|
||||
prodDate: h.prodDate || "",
|
||||
safeDays: h.safeDays || "",
|
||||
validDate: h.validDate || ""
|
||||
}), b.push(f)
|
||||
}
|
||||
}
|
||||
return b
|
||||
},
|
||||
getPostData: function(a) {
|
||||
var b = this,
|
||||
c = this;
|
||||
null !== curRow && null !== curCol && ($("#grid").jqGrid("saveCell", curRow, curCol), curRow = null, curCol = null);
|
||||
var d = c.$_customer.find("input");
|
||||
if ("" === d.val() || "(空)" === d.val()) {
|
||||
var e = {};
|
||||
e.id = 0, e.name = "(空)", c.$_customer.removeData("contactInfo")
|
||||
} else {
|
||||
var e = c.$_customer.data("contactInfo");
|
||||
if (null === e) return setTimeout(function() {
|
||||
d.focus().select()
|
||||
}, 15), parent.Public.tips({
|
||||
type: 2,
|
||||
content: "当前客户不存在!"
|
||||
}), !1
|
||||
}
|
||||
var f = this._getEntriesData(a);
|
||||
if (!f) return !1;
|
||||
if (f.length > 0) {
|
||||
var g = $.trim(b.$_note.val());
|
||||
b.calTotal();
|
||||
var h = {
|
||||
id: originalData.id,
|
||||
buId: e.id,
|
||||
contactName: e.name,
|
||||
date: $.trim(b.$_date.val()),
|
||||
billNo: $.trim(b.$_number.text()),
|
||||
transTypeId: b.transTypeCombo.getValue(),
|
||||
transTypeName: b.transTypeCombo.getText(),
|
||||
entries: f,
|
||||
totalQty: $("#grid").jqGrid("footerData", "get").qty.replace(/,/g, ""),
|
||||
totalAmount: $("#grid").jqGrid("footerData", "get").amount.replace(/,/g, ""),
|
||||
description: g === b.$_note[0].defaultValue ? "" : g
|
||||
};
|
||||
return h
|
||||
}
|
||||
return parent.Public.tips({
|
||||
type: 2,
|
||||
content: "商品信息不能为空!"
|
||||
}), $("#grid").jqGrid("editCell", 1, 2, !0), !1
|
||||
}
|
||||
};
|
||||
$(function() {
|
||||
if (urlParam.id) hasLoaded || Public.ajaxGet("../scm/invOi/updateOut?action=updateOut&type=out", {
|
||||
id: urlParam.id
|
||||
}, function(a) {
|
||||
200 === a.status ? (originalData = a.data, THISPAGE.init(a.data), hasLoaded = !0) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
});
|
||||
else {
|
||||
if (originalData = {
|
||||
id: -1,
|
||||
status: "add",
|
||||
customer: 0,
|
||||
entries: [{
|
||||
id: "1"
|
||||
}, {
|
||||
id: "2"
|
||||
}, {
|
||||
id: "3"
|
||||
}, {
|
||||
id: "4"
|
||||
}, {
|
||||
id: "5"
|
||||
}, {
|
||||
id: "6"
|
||||
}, {
|
||||
id: "7"
|
||||
}, {
|
||||
id: "8"
|
||||
}],
|
||||
totalQty: 0,
|
||||
totalAmount: 0,
|
||||
disRate: 0,
|
||||
disAmount: 0,
|
||||
amount: "0.00",
|
||||
rpAmount: "0.00",
|
||||
arrears: "0.00"
|
||||
}, urlParam.cacheId) {
|
||||
var a = parent.Cache[urlParam.cacheId];
|
||||
originalData.transType = a.data.outboundData.transType, originalData.entries = a.data.outboundData.entries, originalData.callback = a.callback
|
||||
}
|
||||
THISPAGE.init(originalData)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
239
statics/js/dist/otherOutboundList.js
vendored
Executable file
239
statics/js/dist/otherOutboundList.js
vendored
Executable file
@@ -0,0 +1,239 @@
|
||||
var queryConditions = {
|
||||
matchCon: "",
|
||||
locationId: -1,
|
||||
transTypeId: -1
|
||||
},
|
||||
hiddenAmount = !1,
|
||||
SYSTEM = system = parent.SYSTEM,
|
||||
billRequiredCheck = 0,
|
||||
//billRequiredCheck = system.billRequiredCheck,
|
||||
THISPAGE = {
|
||||
init: function() {
|
||||
SYSTEM.isAdmin !== !1 || SYSTEM.rights.AMOUNT_COSTAMOUNT || (hiddenAmount = !0), this.initDom(), this.loadGrid(), this.addEvent()
|
||||
},
|
||||
initDom: function() {
|
||||
this.$_matchCon = $("#matchCon"), this.$_beginDate = $("#beginDate").val(system.beginDate), this.$_endDate = $("#endDate").val(system.endDate), this.$_matchCon.placeholder(), this.$_beginDate.datepicker(), this.$_endDate.datepicker()
|
||||
},
|
||||
loadGrid: function() {
|
||||
function a(a, b, c) {
|
||||
var d = '<div class="operating" data-id="' + c.id + '"><span class="ui-icon ui-icon-pencil" title="修改"></span><span class="ui-icon ui-icon-trash" title="删除"></span></div>';
|
||||
return d
|
||||
}
|
||||
var b = Public.setGrid();
|
||||
queryConditions.beginDate = this.$_beginDate.val(), queryConditions.endDate = this.$_endDate.val(), $("#grid").jqGrid({
|
||||
url: "../scm/invOi/listOut?action=listOut&type=out",
|
||||
postData: queryConditions,
|
||||
datatype: "json",
|
||||
autowidth: !0,
|
||||
height: b.h,
|
||||
altRows: !0,
|
||||
gridview: !0,
|
||||
multiselect: !0,
|
||||
multiboxonly: !0,
|
||||
colModel: [{
|
||||
name: "operating",
|
||||
label: "操作",
|
||||
width: 60,
|
||||
fixed: !0,
|
||||
formatter: a,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billDate",
|
||||
label: "单据日期",
|
||||
width: 100,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billNo",
|
||||
label: "单据编号",
|
||||
width: 120,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "transTypeName",
|
||||
label: "业务类别",
|
||||
width: 150
|
||||
}, {
|
||||
name: "amount",
|
||||
label: "金额",
|
||||
hidden: hiddenAmount,
|
||||
width: 100,
|
||||
align: "right",
|
||||
formatter: "currency"
|
||||
}, {
|
||||
name: "contactName",
|
||||
label: "客户",
|
||||
width: 200
|
||||
}, {
|
||||
name: "userName",
|
||||
label: "制单人",
|
||||
index: "userName",
|
||||
width: 80,
|
||||
fixed: !0,
|
||||
align: "center",
|
||||
title: !1
|
||||
}, {
|
||||
name: "checkName",
|
||||
label: "审核人",
|
||||
width: 80,
|
||||
hidden: billRequiredCheck ? !1 : !0,
|
||||
fixed: !0,
|
||||
align: "center",
|
||||
title: !0,
|
||||
classes: "ui-ellipsis"
|
||||
}, {
|
||||
name: "description",
|
||||
label: "备注",
|
||||
width: 200,
|
||||
classes: "ui-ellipsis"
|
||||
}],
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "number",
|
||||
sortorder: "desc",
|
||||
pager: "#page",
|
||||
rowNum: 100,
|
||||
rowList: [100, 200, 500],
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
forceFit: !1,
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
records: "data.records",
|
||||
repeatitems: !1,
|
||||
total: "data.total",
|
||||
id: "id"
|
||||
},
|
||||
loadError: function() {},
|
||||
ondblClickRow: function(a) {
|
||||
$("#" + a).find(".ui-icon-pencil").trigger("click")
|
||||
}
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
$("#grid").jqGrid("setGridParam", {
|
||||
url: "../scm/invOi/listOut?action=listOut&type=out",
|
||||
datatype: "json",
|
||||
postData: a
|
||||
}).trigger("reloadGrid")
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
if ($(".grid-wrap").on("click", ".ui-icon-pencil", function(a) {
|
||||
a.preventDefault();
|
||||
var b = $(this).parent().data("id");
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-otherOutbound",
|
||||
text: "其他出库",
|
||||
url: "../scm/invOi?action=editOi&type=out&id=" + b
|
||||
});
|
||||
$("#grid").jqGrid("getDataIDs");
|
||||
parent.salesListIds = $("#grid").jqGrid("getDataIDs")
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-trash", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("OO_DELETE")) {
|
||||
var b = $(this).parent().data("id");
|
||||
$.dialog.confirm("您确定要删除该出库记录吗?", function() {
|
||||
Public.ajaxGet("../scm/invOi/deleteOut?action=deleteOut", {
|
||||
id: b
|
||||
}, function(a) {
|
||||
200 === a.status ? ($("#grid").jqGrid("delRowData", b), parent.Public.tips({
|
||||
content: "删除成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}), billRequiredCheck) {
|
||||
{
|
||||
$("#audit").css("display", "inline-block"), $("#reAudit").css("display", "inline-block")
|
||||
}
|
||||
$(".wrapper").on("click", "#audit", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("OO_CHECK")) {
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow"),
|
||||
c = b.join();
|
||||
return c ? void Public.ajaxPost("../scm/invOi/batchCheckInvOo?action=batchCheckInvOo", {
|
||||
id: c
|
||||
}, function(a) {
|
||||
if (200 === a.status) {
|
||||
for (var c = 0, d = b.length; d > c; c++) $("#grid").setCell(b[c], "checkName", system.realName);
|
||||
parent.Public.tips({
|
||||
content: "审核成功!"
|
||||
})
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
}) : void parent.Public.tips({
|
||||
type: 2,
|
||||
content: "请先选择需要审核的项!"
|
||||
})
|
||||
}
|
||||
}), $(".wrapper").on("click", "#reAudit", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("OO_UNCHECK")) {
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow"),
|
||||
c = b.join();
|
||||
return c ? void Public.ajaxPost("../scm/invOi/rsBatchCheckInvOo?action=rsBatchCheckInvOo", {
|
||||
id: c
|
||||
}, function(a) {
|
||||
if (200 === a.status) {
|
||||
for (var c = 0, d = b.length; d > c; c++) $("#grid").setCell(b[c], "checkName", " ");
|
||||
parent.Public.tips({
|
||||
content: "反审核成功!"
|
||||
})
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
}) : void parent.Public.tips({
|
||||
type: 2,
|
||||
content: "请先选择需要反审核的项!"
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
$("#search").click(function() {
|
||||
queryConditions.matchCon = "请输入单据号或客户名或备注" === a.$_matchCon.val() ? "" : a.$_matchCon.val(), queryConditions.beginDate = a.$_beginDate.val(), queryConditions.endDate = a.$_endDate.val(), queryConditions.locationId = -1, queryConditions.transTypeId = -1, THISPAGE.reloadData(queryConditions)
|
||||
}), $("#moreCon").click(function() {
|
||||
queryConditions.matchCon = "请输入单据号或客户名或备注" === a.$_matchCon.val() ? "" : a.$_matchCon.val(), queryConditions.beginDate = a.$_beginDate.val(), queryConditions.endDate = a.$_endDate.val(), $.dialog({
|
||||
id: "moreCon",
|
||||
width: 480,
|
||||
height: 330,
|
||||
min: !1,
|
||||
max: !1,
|
||||
title: "高级搜索",
|
||||
button: [{
|
||||
name: "确定",
|
||||
focus: !0,
|
||||
callback: function() {
|
||||
queryConditions = this.content.handle(queryConditions), THISPAGE.reloadData(queryConditions), "" !== queryConditions.matchCon && a.$_matchCon.val(queryConditions.matchCon), a.$_beginDate.val(queryConditions.beginDate), a.$_endDate.val(queryConditions.endDate)
|
||||
}
|
||||
}, {
|
||||
name: "取消"
|
||||
}],
|
||||
resize: !1,
|
||||
content: "url:../storage/other_search?type=other&diff=outbound",
|
||||
data: queryConditions
|
||||
})
|
||||
}), $("#add").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("OO_ADD") && parent.tab.addTabItem({
|
||||
tabid: "storage-otherOutbound",
|
||||
text: "其他出库",
|
||||
url: "../scm/invOi?action=initOi&type=out"
|
||||
})
|
||||
}), $(window).resize(function() {
|
||||
Public.resizeGrid()
|
||||
}), $(".wrapper").on("click", "#export", function(a) {
|
||||
if (!Business.verifyRight("OO_EXPORT")) return void a.preventDefault();
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow"),
|
||||
c = b.join(),
|
||||
d = c ? "&id=" + c : "";
|
||||
for (var e in queryConditions) queryConditions[e] && (d += "&" + e + "=" + queryConditions[e]);
|
||||
var f = "../scm/invOi/exportInvOo?action=exportInvOo" + d;
|
||||
$(this).attr("href", f)
|
||||
})
|
||||
}
|
||||
};
|
||||
THISPAGE.init();
|
||||
951
statics/js/dist/otherWarehouse.js
vendored
Executable file
951
statics/js/dist/otherWarehouse.js
vendored
Executable file
@@ -0,0 +1,951 @@
|
||||
var curRow, curCol, loading, urlParam = Public.urlParam(),
|
||||
SYSTEM = parent.SYSTEM,
|
||||
hiddenAmount = !1,
|
||||
billRequiredCheck = 0,
|
||||
//billRequiredCheck = system.billRequiredCheck,
|
||||
disEditable = urlParam.disEditable,
|
||||
qtyPlaces = Number(parent.SYSTEM.qtyPlaces),
|
||||
pricePlaces = Number(parent.SYSTEM.pricePlaces),
|
||||
amountPlaces = Number(parent.SYSTEM.amountPlaces),
|
||||
defaultPage = Public.getDefaultPage(),
|
||||
THISPAGE = {
|
||||
init: function(a) {
|
||||
this.mod_PageConfig = Public.mod_PageConfig.init("otherWarehouse"), SYSTEM.isAdmin !== !1 || SYSTEM.rights.AMOUNT_INAMOUNT || (hiddenAmount = !0), this.loadGrid(a), this.initDom(a), this.initCombo(), this.addEvent()
|
||||
},
|
||||
initDom: function(a) {
|
||||
this.$_customer = $("#customer"), this.$_date = $("#date").val(SYSTEM.endDate), this.$_number = $("#number"), this.$_transType = $("#transType"), this.$_note = $("#note"), this.$_toolTop = $("#toolTop"), this.$_toolBottom = $("#toolBottom"), this.$_userName = $("#userName"), this.$_modifyTime = $("#modifyTime"), this.$_createTime = $("#createTime"), this.customerArrears = 0;
|
||||
var b = ["id", a.transType || 150706];
|
||||
this.customerCombo = Business.billSupplierCombo($("#customer"), {
|
||||
defaultSelected: 0,
|
||||
emptyOptions: !0
|
||||
}), this.$_note.placeholder(), this.transTypeCombo = this.$_transType.combo({
|
||||
data: "../scm/invOi/queryTransType?action=queryTransType&type=in",
|
||||
ajaxOptions: {
|
||||
formatData: function(a) {
|
||||
return a.data.items
|
||||
}
|
||||
},
|
||||
width: 80,
|
||||
height: 300,
|
||||
text: "name",
|
||||
value: "id",
|
||||
defaultSelected: b,
|
||||
cache: !1,
|
||||
defaultFlag: !1
|
||||
}).getCombo(), this.$_date.datepicker({
|
||||
onSelect: function(a) {
|
||||
var b = a.format("yyyy-MM-dd");
|
||||
THISPAGE.$_number.text(""), Public.ajaxPost("../basedata/systemProfile/generateDocNo?action=generateDocNo", {
|
||||
billType: "OI",
|
||||
billDate: b
|
||||
}, function(a) {
|
||||
200 === a.status ? THISPAGE.$_number.text(a.data.billNo) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
});
|
||||
var c = "",
|
||||
d = "";
|
||||
billRequiredCheck && (c = '<a class="ui-btn" id="audit">审核</a>', d = '<a class="ui-btn" id="reAudit">反审核</a>'), this.btn_audit = c, this.btn_reaudit = d, this.btn_add = '<a id="savaAndAdd" class="ui-btn ui-btn-sp mrb">保存并新增</a><a id="save" class="ui-btn">保存</a>', this.btn_edit = '<a id="add" class="ui-btn ui-btn-sp mrb">新增</a><a href="../scm/invOi/toOiPdf?action=toOiPdf&billType=IO" target="_blank" id="print" class="ui-btn mrb">打印</a><a id="edit" class="ui-btn">保存</a>', this.btn_view = '<a id="add" class="ui-btn ui-btn-sp mrb">新增</a><a href="../scm/invOi/toOiPdf?action=toOiPdf&billType=IO" target="_blank" id="print" class="ui-btn mrb">打印</a>', this.btn_p_n = '<a class="ui-btn-prev mrb" id="prev" title="上一张"><b></b></a><a class="ui-btn-next" id="next" title="下一张"><b></b></a>', a.id > 0 ? (this.$_customer.data("contactInfo", {
|
||||
id: a.buId,
|
||||
name: a.contactName
|
||||
}), this.customerCombo.input.val(a.contactName), this.$_number.text(a.billNo), this.$_date.val(a.date), a.description && this.$_note.val(a.description), $("#grid").jqGrid("footerData", "set", {
|
||||
qty: a.totalQty,
|
||||
amount: a.totalAmount
|
||||
}), "edit" === a.status ? this.$_toolBottom.html(this.btn_edit + this.btn_audit) : a.checked ? ($("#mark").addClass("has-audit"), this.$_toolBottom.html(this.btn_view + this.btn_reaudit + this.btn_p_n)) : this.$_toolBottom.html(this.btn_view + this.btn_p_n), this.salesListIds = parent.salesListIds || [], this.idPostion = $.inArray(String(a.id), this.salesListIds), this.idLength = this.salesListIds.length, 0 === this.idPostion && $("#prev").addClass("ui-btn-prev-dis"), this.idPostion === this.idLength - 1 && $("#next").addClass("ui-btn-next-dis"), this.$_userName.html(a.userName), this.$_modifyTime.html(a.modifyTime), this.$_createTime.html(a.createTime)) : (billRequiredCheck ? this.$_toolBottom.html(this.btn_add + this.btn_audit) : this.$_toolBottom.html(this.btn_add), this.$_userName.html(SYSTEM.realName || ""), this.$_modifyTime.parent().hide(), this.$_createTime.parent().hide())
|
||||
},
|
||||
disableEdit: function() {
|
||||
this.customerCombo.disable(), this.$_date.attr("disabled", "disabled").addClass("ui-input-dis"), this.$_note.attr("disabled", "disabled").addClass("ui-input-dis"), $("#grid").jqGrid("setGridParam", {
|
||||
cellEdit: !1
|
||||
}), this.editable = !1
|
||||
},
|
||||
enableEdit: function() {
|
||||
disEditable || (this.customerCombo.enable(), this.$_date.removeAttr("disabled").removeClass("ui-input-dis"), this.$_note.removeAttr("disabled").removeClass("ui-input-dis"), $("#grid").jqGrid("setGridParam", {
|
||||
cellEdit: !0
|
||||
}), this.editable = !0)
|
||||
},
|
||||
loadGrid: function(a) {
|
||||
function b(a, b, c) {
|
||||
return a ? (u(b.rowId), a) : c.invNumber ? c.invSpec ? c.invNumber + " " + c.invName + "_" + c.invSpec : c.invNumber + " " + c.invName : " "
|
||||
}
|
||||
function c(a, b) {
|
||||
var c = $(".goodsAuto")[0];
|
||||
return c
|
||||
}
|
||||
function d(a, b, c) {
|
||||
if ("get" === b) {
|
||||
if ("" !== $(".goodsAuto").getCombo().getValue()) return $(a).val();
|
||||
var d = $(a).parents("tr");
|
||||
return d.removeData("goodsInfo"), ""
|
||||
}
|
||||
"set" === b && $("input", a).val(c)
|
||||
}
|
||||
function e() {
|
||||
$("#initCombo").append($(".goodsAuto").val("").unbind("focus.once"))
|
||||
}
|
||||
function f(a, b) {
|
||||
var c = $(".skuAuto")[0];
|
||||
return c
|
||||
}
|
||||
function g(a, b, c) {
|
||||
if ("get" === b) {
|
||||
if ("" !== $(".skuAuto").getCombo().getValue()) return $(a).val();
|
||||
var d = $(a).parents("tr");
|
||||
return d.removeData("skuInfo"), ""
|
||||
}
|
||||
"set" === b && $("input", a).val(c)
|
||||
}
|
||||
function h() {
|
||||
$("#initCombo").append($(".skuAuto").val(""))
|
||||
}
|
||||
function i(a, b) {
|
||||
var c = $(".storageAuto")[0];
|
||||
return c
|
||||
}
|
||||
function j(a, b, c) {
|
||||
if ("get" === b) {
|
||||
if ("" !== $(".storageAuto").getCombo().getValue()) return $(a).val();
|
||||
var d = $(a).parents("tr");
|
||||
return d.removeData("storageInfo"), ""
|
||||
}
|
||||
"set" === b && $("input", a).val(c)
|
||||
}
|
||||
function k() {
|
||||
$("#initCombo").append($(".storageAuto").val(""))
|
||||
}
|
||||
function l(a, b) {
|
||||
var c = $(".unitAuto")[0];
|
||||
return c
|
||||
}
|
||||
function m(a, b, c) {
|
||||
if ("get" === b) {
|
||||
if ("" !== $(".unitAuto").getCombo().getValue()) return $(a).val();
|
||||
var d = $(a).parents("tr"),
|
||||
e = d.data("unitInfo") || {};
|
||||
return THISPAGE.unitCombo.selectByIndex(e.unitId || e.id), e.name || ""
|
||||
}
|
||||
"set" === b && $("input", a).val(c)
|
||||
}
|
||||
function n() {
|
||||
$("#initCombo").append($(".unitAuto").val(""))
|
||||
}
|
||||
function o(a, b) {
|
||||
var c = $(".dateAuto")[0];
|
||||
return c
|
||||
}
|
||||
function p(a, b, c) {
|
||||
return "get" === b ? a.val() : void("set" === b && $("input", a).val(c))
|
||||
}
|
||||
function q() {
|
||||
$("#initCombo").append($(".dateAuto"))
|
||||
}
|
||||
function r(a, b) {
|
||||
var c = $(".batchAuto")[0];
|
||||
return c
|
||||
}
|
||||
function s(a, b, c) {
|
||||
return "get" === b ? a.val() : void("set" === b && $("input", a).val(c))
|
||||
}
|
||||
function t() {
|
||||
$("#initCombo").append($(".batchAuto").val(""))
|
||||
}
|
||||
function u(a) {
|
||||
var b = $("#" + a).data("goodsInfo");
|
||||
if (b) {
|
||||
b.batch || $("#grid").jqGrid("setCell", a, "batch", " "), b.safeDays || ($("#grid").jqGrid("setCell", a, "prodDate", " "), $("#grid").jqGrid("setCell", a, "safeDays", " "), $("#grid").jqGrid("setCell", a, "validDate", " ")), 1 == b.isWarranty && $("#grid").jqGrid("showCol", "batch"), b.safeDays > 0 && ($("#grid").jqGrid("showCol", "prodDate"), $("#grid").jqGrid("showCol", "safeDays"), $("#grid").jqGrid("showCol", "validDate"));
|
||||
var c = {
|
||||
skuName: b.skuName || "",
|
||||
mainUnit: b.mainUnit || b.unitName,
|
||||
unitId: b.unitId,
|
||||
qty: b.qty || 1,
|
||||
price: b.price || b.purPrice,
|
||||
discountRate: b.discountRate || 0,
|
||||
deduction: b.deduction || 0,
|
||||
amount: b.amount,
|
||||
locationName: b.locationName,
|
||||
locationId: b.locationId,
|
||||
serNumList: b.serNumList,
|
||||
safeDays: b.safeDays
|
||||
};
|
||||
SYSTEM.ISSERNUM && b.isSerNum && (c.qty = c.serNumList ? c.serNumList.length : 0), c.amount = c.amount ? c.amount : c.price * c.qty;
|
||||
var d = (Number(c.amount), $("#grid").jqGrid("setRowData", a, c));
|
||||
d && THISPAGE.calTotal()
|
||||
}
|
||||
}
|
||||
var v = this,
|
||||
w = (new Date).format();
|
||||
if (a.id) {
|
||||
for (var x = 0; x < a.entries.length; x++) a.entries[x].id = x + 1;
|
||||
var y = 8 - a.entries.length;
|
||||
if (y > 0) for (var x = 0; y > x; x++) a.entries.push({})
|
||||
}
|
||||
v.newId = 9;
|
||||
var z = "grid",
|
||||
A = [{
|
||||
name: "operating",
|
||||
label: " ",
|
||||
width: 40,
|
||||
fixed: !0,
|
||||
formatter: Public.billsOper,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "goods",
|
||||
label: "商品",
|
||||
width: 320,
|
||||
title: !0,
|
||||
classes: "goods",
|
||||
formatter: b,
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: c,
|
||||
custom_value: d,
|
||||
handle: e,
|
||||
trigger: "ui-icon-ellipsis"
|
||||
}
|
||||
}, {
|
||||
name: "skuId",
|
||||
label: "属性ID",
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "skuName",
|
||||
label: "属性",
|
||||
width: 100,
|
||||
classes: "ui-ellipsis skuInfo",
|
||||
hidden: !SYSTEM.enableAssistingProp,
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: f,
|
||||
custom_value: g,
|
||||
handle: h,
|
||||
trigger: "ui-icon-ellipsis"
|
||||
}
|
||||
}, {
|
||||
name: "mainUnit",
|
||||
label: "单位",
|
||||
width: 80,
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: l,
|
||||
custom_value: m,
|
||||
handle: n,
|
||||
trigger: "ui-icon-triangle-1-s"
|
||||
}
|
||||
}, {
|
||||
name: "unitId",
|
||||
label: "单位Id",
|
||||
hidden: !0
|
||||
}, {
|
||||
name: "locationName",
|
||||
label: "仓库",
|
||||
nameExt: '<small id="batchStorage">(批量)</small>',
|
||||
width: 100,
|
||||
title: !0,
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: i,
|
||||
custom_value: j,
|
||||
handle: k,
|
||||
trigger: "ui-icon-triangle-1-s"
|
||||
}
|
||||
}, {
|
||||
name: "batch",
|
||||
label: "批次",
|
||||
width: 90,
|
||||
classes: "ui-ellipsis batch",
|
||||
hidden: !0,
|
||||
title: !1,
|
||||
editable: !0,
|
||||
align: "left",
|
||||
edittype: "custom",
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: r,
|
||||
custom_value: s,
|
||||
handle: t,
|
||||
trigger: "ui-icon-ellipsis"
|
||||
}
|
||||
}, {
|
||||
name: "prodDate",
|
||||
label: "生产日期",
|
||||
width: 90,
|
||||
hidden: !0,
|
||||
title: !1,
|
||||
editable: !0,
|
||||
edittype: "custom",
|
||||
edittype: "custom",
|
||||
editoptions: {
|
||||
custom_element: o,
|
||||
custom_value: p,
|
||||
handle: q
|
||||
}
|
||||
}, {
|
||||
name: "safeDays",
|
||||
label: "保质期(天)",
|
||||
width: 90,
|
||||
hidden: !0,
|
||||
title: !1,
|
||||
align: "left"
|
||||
}, {
|
||||
name: "validDate",
|
||||
label: "有效期至",
|
||||
width: 90,
|
||||
hidden: !0,
|
||||
title: !1,
|
||||
align: "left"
|
||||
}, {
|
||||
name: "qty",
|
||||
label: "数量",
|
||||
width: 80,
|
||||
align: "right",
|
||||
formatter: "number",
|
||||
formatoptions: {
|
||||
decimalPlaces: qtyPlaces
|
||||
},
|
||||
editable: !0
|
||||
}, {
|
||||
name: "price",
|
||||
label: "入库单价",
|
||||
hidden: hiddenAmount,
|
||||
width: 100,
|
||||
fixed: !0,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
showZero: !0,
|
||||
decimalPlaces: pricePlaces
|
||||
},
|
||||
editable: !0
|
||||
}, {
|
||||
name: "amount",
|
||||
label: "入库金额",
|
||||
hidden: hiddenAmount,
|
||||
width: 100,
|
||||
fixed: !0,
|
||||
align: "right",
|
||||
formatter: "currency",
|
||||
formatoptions: {
|
||||
showZero: !0,
|
||||
decimalPlaces: amountPlaces
|
||||
},
|
||||
editable: !0
|
||||
}, {
|
||||
name: "description",
|
||||
label: "备注",
|
||||
width: 150,
|
||||
title: !0,
|
||||
editable: !0
|
||||
}];
|
||||
v.mod_PageConfig.gridReg(z, A), A = v.mod_PageConfig.conf.grids[z].colModel, $("#grid").jqGrid({
|
||||
data: a.entries,
|
||||
datatype: "clientSide",
|
||||
autowidth: !0,
|
||||
height: "100%",
|
||||
rownumbers: !0,
|
||||
gridview: !0,
|
||||
onselectrow: !1,
|
||||
colModel: A,
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
shrinkToFit: !1,
|
||||
forceFit: !0,
|
||||
rowNum: 1e3,
|
||||
cellEdit: !1,
|
||||
cellsubmit: "clientArray",
|
||||
localReader: {
|
||||
root: "rows",
|
||||
records: "records",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
jsonReader: {
|
||||
root: "data.entries",
|
||||
records: "records",
|
||||
repeatitems: !1,
|
||||
id: "id"
|
||||
},
|
||||
loadComplete: function(a) {
|
||||
if (urlParam.id > 0 || urlParam.cacheId) {
|
||||
var b = a.rows,
|
||||
c = b.length;
|
||||
v.newId = c + 1;
|
||||
for (var d = 0; c > d; d++) {
|
||||
var e = d + 1,
|
||||
f = b[d];
|
||||
if ($.isEmptyObject(b[d])) break;
|
||||
var g = $.extend(!0, {
|
||||
id: f.invId,
|
||||
number: f.invNumber,
|
||||
name: f.invName,
|
||||
spec: f.invSpec,
|
||||
unitId: f.unitId,
|
||||
unitName: f.mainUnit,
|
||||
isSerNum: f.isSerNum,
|
||||
serNumList: f.serNumList || f.invSerNumList
|
||||
}, f);
|
||||
Business.cacheManage.getGoodsInfoByNumber(g.number, function(a) {
|
||||
g.isSerNum = a.isSerNum, g.isWarranty = f.isWarranty = a.isWarranty, g.safeDays = f.safeDays = a.safeDays, g.invSkus = a.invSkus, g.id = f.invId, $("#" + e).data("goodsInfo", g).data("storageInfo", {
|
||||
id: f.locationId,
|
||||
name: f.locationName
|
||||
}).data("unitInfo", {
|
||||
unitId: f.unitId,
|
||||
name: f.mainUnit
|
||||
}).data("skuInfo", {
|
||||
name: f.skuName,
|
||||
id: f.skuId
|
||||
})
|
||||
}), 1 == f.isWarranty && $("#grid").jqGrid("showCol", "batch"), f.safeDays > 0 && ($("#grid").jqGrid("showCol", "prodDate"), $("#grid").jqGrid("showCol", "safeDays"), $("#grid").jqGrid("showCol", "validDate"))
|
||||
}
|
||||
}
|
||||
},
|
||||
gridComplete: function() {
|
||||
setTimeout(function() {
|
||||
Public.autoGrid($("#grid"))
|
||||
}, 10)
|
||||
},
|
||||
afterEditCell: function(a, b, c, d, e) {
|
||||
function f() {
|
||||
var b = $("#" + a).data("goodsInfo");
|
||||
if (b) {
|
||||
var c = $("#grid").jqGrid("getRowData", a);
|
||||
b = $.extend(!0, {}, b), b.skuName = c.skuName, b.mainUnit = c.mainUnit, b.unitId = c.unitId, b.qty = c.qty, b.price = c.price, b.discountRate = c.discountRate, b.deduction = c.deduction, b.amount = c.amount, b.taxRate = c.taxRate, b.tax = c.tax, b.taxAmount = c.taxAmount, b.locationName = c.locationName, $("#" + a).data("goodsInfo", b)
|
||||
}
|
||||
}
|
||||
if (THISPAGE.curID = a, "goods" === b && (f(), $("#" + d + "_goods", "#grid").val(c), THISPAGE.goodsCombo.selectByText(c)), "skuName" === b) {
|
||||
f();
|
||||
var g = $("#" + a).data("goodsInfo");
|
||||
if (!g || !g.invSkus || !g.invSkus.length) return $("#grid").jqGrid("restoreCell", d, e), curCol = e + 1, $("#grid").jqGrid("nextCell", d, e + 1), void THISPAGE.skuCombo.loadData([]);
|
||||
"string" == typeof g.invSkus && (g.invSkus = $.parseJSON(g.invSkus)), $("#" + d + "_skuName", "#grid").val(c), THISPAGE.skuCombo.loadData(g.invSkus || [], 1, !1), THISPAGE.skuCombo.selectByText(c)
|
||||
}
|
||||
if ("qty" === b) {
|
||||
f();
|
||||
var g = $("#" + a).data("goodsInfo");
|
||||
if (!g) return;
|
||||
SYSTEM.ISSERNUM && g.isSerNum && Business.serNumManage({
|
||||
row: $("#" + a),
|
||||
isCreate: !0
|
||||
})
|
||||
}
|
||||
if ("locationName" === b && ($("#" + d + "_locationName", "#grid").val(c), THISPAGE.storageCombo.selectByText(c)), "batch" === b) {
|
||||
var g = $("#" + a).data("goodsInfo");
|
||||
if (!g) return $("#grid").jqGrid("restoreCell", d, e), curCol = e + 1, void $("#grid").jqGrid("nextCell", d, e + 1);
|
||||
$("#" + d + "_batch", "#grid").val(c), THISPAGE.batchCombo.selectByText(c)
|
||||
}
|
||||
if ("prodDate" === b) {
|
||||
var g = $("#" + a).data("goodsInfo");
|
||||
if (!g) return $("#grid").jqGrid("restoreCell", d, e), curCol = e + 1, void $("#grid").jqGrid("nextCell", d, e + 1);
|
||||
if (!g.safeDays) return $("#grid").jqGrid("restoreCell", d, e), curCol = e + 1, void $("#grid").jqGrid("nextCell", d, e + 1);
|
||||
c ? THISPAGE.cellPikaday.setDate(c) : THISPAGE.cellPikaday.setDate(THISPAGE.cellPikaday.getDate() || new Date)
|
||||
}
|
||||
if ("mainUnit" === b) {
|
||||
$("#" + d + "_mainUnit", "#grid").val(c);
|
||||
var h = $("#" + a).data("unitInfo") || {};
|
||||
if (!h.unitId || "0" === h.unitId) return void $("#grid").jqGrid("saveCell", d, e);
|
||||
THISPAGE.unitCombo.enable(), THISPAGE.unitCombo.loadData(function() {
|
||||
for (var a = {}, b = 0; b < SYSTEM.unitInfo.length; b++) {
|
||||
var c = SYSTEM.unitInfo[b],
|
||||
d = h.unitId;
|
||||
h.unitId == c.id && (h = c), h.unitId = d;
|
||||
var e = c.unitTypeId || b;
|
||||
a[e] || (a[e] = []), a[e].push(c)
|
||||
}
|
||||
return h.unitTypeId ? a[h.unitTypeId] : [h]
|
||||
}), THISPAGE.unitCombo.selectByText(c)
|
||||
}
|
||||
},
|
||||
formatCell: function(a, b, c, d, e) {},
|
||||
beforeSubmitCell: function(a, b, c, d, e) {},
|
||||
beforeSaveCell: function(a, b, c, d, e) {
|
||||
if ("goods" === b) {
|
||||
var f = $("#" + a).data("goodsInfo");
|
||||
if (!f) {
|
||||
v.skey = c;
|
||||
var g, h = function(b) {
|
||||
$("#" + a).data("goodsInfo", b).data("storageInfo", {
|
||||
id: b.locationId,
|
||||
name: b.locationName
|
||||
}).data("unitInfo", {
|
||||
unitId: b.unitId,
|
||||
name: b.unitName
|
||||
}), g = Business.formatGoodsName(b)
|
||||
};
|
||||
return THISPAGE.$_barCodeInsert && THISPAGE.$_barCodeInsert.hasClass("active") ? Business.cacheManage.getGoodsInfoByBarCode(c, h, !0) : Business.cacheManage.getGoodsInfoByNumber(c, h, !0), g ? g : ($.dialog({
|
||||
width: 775,
|
||||
height: 510,
|
||||
title: "选择商品",
|
||||
content: "url:../settings/goods_batch",
|
||||
data: {
|
||||
skuMult: SYSTEM.enableAssistingProp,
|
||||
skey: v.skey,
|
||||
callback: function(a, b, c) {
|
||||
"" === b && ($("#grid").jqGrid("addRowData", a, {}, "last"), v.newId = a + 1), setTimeout(function() {
|
||||
$("#grid").jqGrid("editCell", c, 2, !0)
|
||||
}, 10), v.calTotal()
|
||||
}
|
||||
},
|
||||
init: function() {
|
||||
v.skey = ""
|
||||
},
|
||||
lock: !0,
|
||||
button: [{
|
||||
name: "选中",
|
||||
defClass: "ui_state_highlight fl",
|
||||
focus: !0,
|
||||
callback: function() {
|
||||
return this.content.callback && this.content.callback(), !1
|
||||
}
|
||||
}, {
|
||||
name: "选中并关闭",
|
||||
defClass: "ui_state_highlight",
|
||||
callback: function() {
|
||||
return this.content.callback(), this.close(), !1
|
||||
}
|
||||
}, {
|
||||
name: "关闭",
|
||||
callback: function() {
|
||||
return !0
|
||||
}
|
||||
}]
|
||||
}), setTimeout(function() {
|
||||
$("#grid").jqGrid("editCell", curRow, 2, !0), $("#grid").jqGrid("setCell", curRow, 2, "")
|
||||
}, 10), " ")
|
||||
}
|
||||
}
|
||||
return c
|
||||
},
|
||||
afterSaveCell: function(a, b, c, d, e) {
|
||||
switch (b) {
|
||||
case "goods":
|
||||
break;
|
||||
case "qty":
|
||||
var f = $("#grid").jqGrid("getCell", a, e + 1);
|
||||
if (!isNaN(parseFloat(f))) {
|
||||
var g = $("#grid").jqGrid("setRowData", a, {
|
||||
amount: parseFloat(c) * parseFloat(f)
|
||||
});
|
||||
g && THISPAGE.calTotal()
|
||||
}
|
||||
break;
|
||||
case "price":
|
||||
var h = $("#grid").jqGrid("getCell", a, e - 1);
|
||||
if (!isNaN(parseFloat(h))) {
|
||||
var g = $("#grid").jqGrid("setRowData", a, {
|
||||
amount: parseFloat(c) * parseFloat(h)
|
||||
});
|
||||
g && THISPAGE.calTotal()
|
||||
}
|
||||
break;
|
||||
case "amount":
|
||||
var h = $("#grid").jqGrid("getCell", a, e - 2);
|
||||
if (!isNaN(parseFloat(h))) {
|
||||
var f = parseFloat(c) / parseFloat(h);
|
||||
$("#grid").jqGrid("setRowData", a, {
|
||||
price: f
|
||||
})
|
||||
}
|
||||
THISPAGE.calTotal();
|
||||
break;
|
||||
case "batch":
|
||||
var i = $("#grid").jqGrid("getRowData", a),
|
||||
j = $("#" + a).data("goodsInfo") || {};
|
||||
if (j.safeDays) {
|
||||
var k = {};
|
||||
if ($.trim(i.prodDate) || (k.prodDate = w), $.trim(i.safeDays) || (k.safeDays = j.safeDays), !$.trim(i.validDate)) {
|
||||
var l = i.prodDate || k.prodDate,
|
||||
m = l.split("-");
|
||||
if (l = new Date(m[0], m[1] - 1, m[2]), "Invalid Date" === l.toString()) return defaultPage.Public.tips({
|
||||
type: 2,
|
||||
content: "日期格式错误!"
|
||||
}), void setTimeout(function() {
|
||||
$("#grid").jqGrid("editCellByColName", a, "prodDate")
|
||||
}, 10);
|
||||
l && (l.addDays(Number(i.safeDays || k.safeDays)), k.validDate = l.format())
|
||||
}
|
||||
$.isEmptyObject(k) || $("#grid").jqGrid("setRowData", a, k)
|
||||
}
|
||||
break;
|
||||
case "prodDate":
|
||||
var i = $("#grid").jqGrid("getRowData", a),
|
||||
j = $("#" + a).data("goodsInfo") || {},
|
||||
k = {};
|
||||
$.trim(i.safeDays) || (k.safeDays = j.safeDays), $.trim(c) || (k.prodDate = w);
|
||||
var l = c || k.prodDate,
|
||||
m = l.split("-");
|
||||
if (l = new Date(m[0], m[1] - 1, m[2]), "Invalid Date" === l.toString()) return defaultPage.Public.tips({
|
||||
type: 2,
|
||||
content: "日期格式错误!"
|
||||
}), void setTimeout(function() {
|
||||
$("#grid").jqGrid("editCellByColName", a, "prodDate")
|
||||
}, 10);
|
||||
l && (l.addDays(Number(i.safeDays || k.safeDays)), k.validDate = l.format()), $("#grid").jqGrid("setRowData", a, k)
|
||||
}
|
||||
},
|
||||
loadonce: !0,
|
||||
resizeStop: function(a, b) {
|
||||
v.mod_PageConfig.setGridWidthByIndex(a, b, "grid")
|
||||
},
|
||||
footerrow: !0,
|
||||
userData: {
|
||||
goods: "合计:",
|
||||
qty: a.totalQty,
|
||||
amount: a.totalAmount
|
||||
},
|
||||
userDataOnFooter: !0,
|
||||
loadError: function(a, b, c) {
|
||||
Public.tips({
|
||||
type: 1,
|
||||
content: "Type: " + b + "; Response: " + a.status + " " + a.statusText
|
||||
})
|
||||
}
|
||||
}), $("#grid").jqGrid("setGridParam", {
|
||||
cellEdit: !0
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
function b() {
|
||||
c.$_customer.data("contactInfo", {
|
||||
id: a.buId,
|
||||
name: a.contactName
|
||||
}), c.customerCombo.input.val(a.contactName), c.$_date.val(a.date), c.$_number.text(a.billNo), c.$_note.val(a.description), c.$_userName.html(a.userName), c.$_modifyTime.html(a.modifyTime), c.$_createTime.html(a.createTime)
|
||||
}
|
||||
$("#grid").clearGridData();
|
||||
var c = this,
|
||||
d = 8 - a.entries.length;
|
||||
if (d > 0) for (var e = 0; d > e; e++) a.entries.push({});
|
||||
"edit" === a.status ? ($("#grid").jqGrid("setGridParam", {
|
||||
data: a.entries,
|
||||
userData: {
|
||||
qty: a.totalQty,
|
||||
amount: a.totalAmount
|
||||
},
|
||||
cellEdit: !0,
|
||||
datatype: "clientSide"
|
||||
}).trigger("reloadGrid"), b(), this.editable || (this.customerCombo.enable(), this.$_date.removeAttr("disabled"), this.editable = !0, this.$_toolBottom.html(c.btn_edit + c.btn_audit), $("#mark").removeClass("has-audit"))) : ($("#grid").jqGrid("setGridParam", {
|
||||
url: "",
|
||||
datatype: "json",
|
||||
cellEdit: !1
|
||||
}).trigger("reloadGrid"), b(), this.editable && (this.customerCombo.disable(), this.$_date.attr("disabled", "disabled"), this.editable = !1, $("#groupBtn").html(c.btn_view + c.btn_reaudit), $("#mark").addClass("has-audit")))
|
||||
},
|
||||
initCombo: function() {
|
||||
this.goodsCombo = Business.billGoodsCombo($(".goodsAuto"), {
|
||||
userData: {
|
||||
isCreate: !0
|
||||
}
|
||||
}), this.skuCombo = Business.billskuCombo($(".skuAuto"), {
|
||||
data: []
|
||||
}), this.storageCombo = Business.billStorageCombo($(".storageAuto")), this.unitCombo = Business.unitCombo($(".unitAuto"), {
|
||||
defaultSelected: -1,
|
||||
forceSelection: !1
|
||||
}), this.cellPikaday = new Pikaday({
|
||||
field: $(".dateAuto")[0],
|
||||
editable: !1
|
||||
}), this.batchCombo = Business.batchCombo($(".batchAuto"))
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
this.customerCombo.input.enterKey(), this.$_date.bind("keydown", function(a) {
|
||||
13 === a.which && $("#grid").jqGrid("editCell", 1, 2, !0)
|
||||
}).bind("focus", function(b) {
|
||||
a.dateValue = $(this).val()
|
||||
}).bind("blur", function(b) {
|
||||
var c = /((^((1[8-9]\d{2})|([2-9]\d{3}))(-)(10|12|0?[13578])(-)(3[01]|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))(-)(11|0?[469])(-)(30|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))(-)(0?2)(-)(2[0-8]|1[0-9]|0?[1-9])$)|(^([2468][048]00)(-)(0?2)(-)(29)$)|(^([3579][26]00)(-)(0?2)(-)(29)$)|(^([1][89][0][48])(-)(0?2)(-)(29)$)|(^([2-9][0-9][0][48])(-)(0?2)(-)(29)$)|(^([1][89][2468][048])(-)(0?2)(-)(29)$)|(^([2-9][0-9][2468][048])(-)(0?2)(-)(29)$)|(^([1][89][13579][26])(-)(0?2)(-)(29)$)|(^([2-9][0-9][13579][26])(-)(0?2)(-)(29)$))/;
|
||||
c.test($(this).val()) || (parent.Public.tips({
|
||||
type: 2,
|
||||
content: "日期格式有误!如:2012-08-08。"
|
||||
}), $(this).val(a.dateValue))
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-triangle-1-s", function(a) {
|
||||
var b = $(this).siblings(),
|
||||
c = b.getCombo();
|
||||
setTimeout(function() {
|
||||
c.active = !0, c.doQuery()
|
||||
}, 10)
|
||||
}), Business.billsEvent(a, "otherWarehouse"), $(".wrapper").on("click", "#save", function(b) {
|
||||
b.preventDefault();
|
||||
var c = THISPAGE.getPostData();
|
||||
c && ("edit" === originalData.stata && (c.id = originalData.id, c.stata = "edit"), Public.ajaxPost("../scm/invOi/add?action=add&type=in", {
|
||||
postData: JSON.stringify(c)
|
||||
}, function(b) {
|
||||
200 === b.status ? (a.$_modifyTime.html((new Date).format("yyyy-MM-dd hh:mm:ss")).parent().show(), a.$_createTime.html((new Date).format("yyyy-MM-dd hh:mm:ss")).parent().show(), originalData.id = b.data.id, billRequiredCheck ? a.$_toolBottom.html(a.btn_edit + a.btn_audit) : a.$_toolBottom.html(a.btn_edit), parent.Public.tips({
|
||||
content: "保存成功!"
|
||||
}), originalData.callback && originalData.callback("in")) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
}))
|
||||
}), $(".wrapper").on("click", "#edit", function(b) {
|
||||
if (b.preventDefault(), Business.verifyRight("IO_UPDATE")) {
|
||||
var c = THISPAGE.getPostData();
|
||||
c && Public.ajaxPost("../scm/invOi/updateOi?action=updateOi&type=in", {
|
||||
postData: JSON.stringify(c)
|
||||
}, function(b) {
|
||||
200 === b.status ? (a.$_modifyTime.html((new Date).format("yyyy-MM-dd hh:mm:ss")).parent().show(), originalData.id = b.data.id, parent.Public.tips({
|
||||
content: "修改成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
}), $(".wrapper").on("click", "#audit", function(b) {
|
||||
if (b.preventDefault(), Business.verifyRight("IO_CHECK")) {
|
||||
var c = THISPAGE.getPostData();
|
||||
c && Public.ajaxPost("../scm/invOi/checkInvOi?action=checkInvOi", {
|
||||
postData: JSON.stringify(c)
|
||||
}, function(b) {
|
||||
200 === b.status ? (originalData.id = b.data.id, $("#mark").addClass("has-audit"), $("#edit").hide(), a.disableEdit(), a.$_toolBottom.html(a.btn_view + a.btn_reaudit), parent.Public.tips({
|
||||
content: "审核成功!"
|
||||
}), originalData.callback && originalData.callback("in")) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
}), $(".wrapper").on("click", "#reAudit", function(b) {
|
||||
if (b.preventDefault(), Business.verifyRight("IO_UNCHECK")) {
|
||||
var c = $(this);
|
||||
c.ajaxPost("../scm/invOi/rsBatchCheckInvOi?action=rsBatchCheckInvOi", {
|
||||
id: originalData.id
|
||||
}, function(b) {
|
||||
200 === b.status ? ($("#mark").removeClass(), $("#edit").show(), a.enableEdit(), a.$_toolBottom.html(a.btn_edit + a.btn_audit), parent.Public.tips({
|
||||
content: "反审核成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
})
|
||||
}
|
||||
}), $(".wrapper").on("click", "#savaAndAdd", function(b) {
|
||||
b.preventDefault();
|
||||
var c = THISPAGE.getPostData();
|
||||
c && Public.ajaxPost("../scm/invOi/addNew?action=addNew&type=in", {
|
||||
postData: JSON.stringify(c)
|
||||
}, function(b) {
|
||||
if (200 === b.status) {
|
||||
a.$_number.text(b.data.billNo), $("#grid").clearGridData(), $("#grid").clearGridData(!0);
|
||||
for (var c = 1; 8 >= c; c++) $("#grid").jqGrid("addRowData", c, {});
|
||||
a.newId = 9, a.$_note.val(""), parent.Public.tips({
|
||||
content: "保存成功!"
|
||||
})
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: b.msg
|
||||
})
|
||||
})
|
||||
}), $(".wrapper").on("click", "#add", function(a) {
|
||||
a.preventDefault(), Business.verifyRight("IO_ADD") && parent.tab.overrideSelectedTabItem({
|
||||
tabid: "storage-otherWarehouse",
|
||||
text: "其他入库",
|
||||
url: "../scm/invOi?action=initOi&type=in"
|
||||
})
|
||||
}), $(".wrapper").on("click", "#print", function(a) {
|
||||
return Business.verifyRight("IO_PRINT") ? void(this.href += "&id=" + originalData.id) : void a.preventDefault()
|
||||
}), $("#prev").click(function(b) {
|
||||
return b.preventDefault(), $(this).hasClass("ui-btn-prev-dis") ? (parent.Public.tips({
|
||||
type: 2,
|
||||
content: "已经没有上一张了!"
|
||||
}), !1) : (a.idPostion = a.idPostion - 1, 0 === a.idPostion && $(this).addClass("ui-btn-prev-dis"), loading = $.dialog.tips("数据加载中...", 1e3, "loading.gif", !0), Public.ajaxGet("../scm/invOi/updateIn?action=updateIn&type=in", {
|
||||
id: a.salesListIds[a.idPostion]
|
||||
}, function(a) {
|
||||
THISPAGE.reloadData(a.data), $("#next").removeClass("ui-btn-next-dis"), loading && loading.close()
|
||||
}), void 0)
|
||||
}), $("#next").click(function(b) {
|
||||
return b.preventDefault(), $(this).hasClass("ui-btn-next-dis") ? (parent.Public.tips({
|
||||
type: 2,
|
||||
content: "已经没有下一张了!"
|
||||
}), !1) : (a.idPostion = a.idPostion + 1, a.idLength === a.idPostion + 1 && $(this).addClass("ui-btn-next-dis"), loading = $.dialog.tips("数据加载中...", 1e3, "loading.gif", !0), Public.ajaxGet("../scm/invOi/updateIn?action=updateIn&type=in", {
|
||||
id: a.salesListIds[a.idPostion]
|
||||
}, function(a) {
|
||||
THISPAGE.reloadData(a.data), $("#prev").removeClass("ui-btn-prev-dis"), loading && loading.close()
|
||||
}), void 0)
|
||||
}), $("#grid").on("click", 'tr[role="row"]', function(a) {
|
||||
if ($("#mark").hasClass("has-audit")) {
|
||||
var b = $(this),
|
||||
c = (b.prop("id"), b.data("goodsInfo"));
|
||||
if (!c) return;
|
||||
SYSTEM.ISSERNUM && 1 == c.isSerNum && Business.serNumManage({
|
||||
row: b,
|
||||
view: !0
|
||||
})
|
||||
}
|
||||
}), $("#config").show().click(function(b) {
|
||||
a.mod_PageConfig.config()
|
||||
}), $(window).resize(function(a) {
|
||||
Public.autoGrid($("#grid"))
|
||||
})
|
||||
},
|
||||
resetData: function() {
|
||||
var a = this;
|
||||
$("#grid").clearGridData();
|
||||
for (var b = 1; 8 >= b; b++) $("#grid").jqGrid("addRowData", b, {}), $("#grid").jqGrid("footerData", "set", {
|
||||
qty: 0,
|
||||
amount: 0
|
||||
});
|
||||
a.$_note.val(""), a.$_discountRate.val(originalData.disRate), a.$_deduction.val(originalData.disAmount), a.$_discount.val(originalData.amount), a.$_payment.val(originalData.rpAmount), a.$_arrears.val(originalData.arrears)
|
||||
},
|
||||
calTotal: function() {
|
||||
for (var a = $("#grid").jqGrid("getDataIDs"), b = 0, c = 0, d = 0, e = a.length; e > d; d++) {
|
||||
var f = a[d],
|
||||
g = $("#grid").jqGrid("getRowData", f);
|
||||
g.qty && (b += parseFloat(g.qty)), g.amount && (c += parseFloat(g.amount))
|
||||
}
|
||||
$("#grid").jqGrid("footerData", "set", {
|
||||
qty: b,
|
||||
amount: c
|
||||
})
|
||||
},
|
||||
_getEntriesData: function(a) {
|
||||
a = a || {};
|
||||
for (var b = [], c = $("#grid").jqGrid("getDataIDs"), d = 0, e = c.length; e > d; d++) {
|
||||
var f, g = c[d],
|
||||
h = $("#grid").jqGrid("getRowData", g);
|
||||
if ("" !== h.goods) {
|
||||
var i = $("#" + g).data("goodsInfo"),
|
||||
j = $("#" + g).data("skuInfo") || {};
|
||||
if (i.invSkus && i.invSkus.length > 0 && !j.id) return parent.Public.tips({
|
||||
type: 2,
|
||||
content: "请选择相应的属性!"
|
||||
}), $("#grid").jqGrid("editCellByColName", g, "skuName"), !1;
|
||||
var k = $("#" + g).data("storageInfo");
|
||||
if (!k || !k.id) return parent.Public.tips({
|
||||
type: 2,
|
||||
content: "请选择相应的仓库!"
|
||||
}), $("#grid").jqGrid("editCellByColName", g, "locationName"), !1;
|
||||
var l = $("#" + g).data("unitInfo") || {};
|
||||
if (SYSTEM.ISSERNUM) {
|
||||
var m = i.serNumList;
|
||||
if (m && m.length == Number(h.qty));
|
||||
else {
|
||||
var n = !1,
|
||||
o = "点击";
|
||||
if (1 == i.isSerNum && (n = !0, a.checkSerNum && (n = !0)), n) return parent.Public.tips({
|
||||
type: 2,
|
||||
content: "请" + o + "数量设置【" + i.name + "】的序列号"
|
||||
}), $("#grid").jqGrid("editCellByColName", g, "qty"), !1
|
||||
}
|
||||
}
|
||||
f = {
|
||||
invId: i.id,
|
||||
invNumber: i.number,
|
||||
invName: i.name,
|
||||
invSpec: i.spec || "",
|
||||
skuId: j.id || -1,
|
||||
skuName: j.name || "",
|
||||
unitId: l.unitId || -1,
|
||||
mainUnit: l.name || "",
|
||||
qty: h.qty,
|
||||
price: h.price,
|
||||
amount: h.amount,
|
||||
description: h.description,
|
||||
locationId: k.id,
|
||||
locationName: k.name,
|
||||
serNumList: m
|
||||
}, SYSTEM.ISWARRANTY && $.extend(!0, f, {
|
||||
batch: h.batch || "",
|
||||
prodDate: h.prodDate || "",
|
||||
safeDays: h.safeDays || "",
|
||||
validDate: h.validDate || ""
|
||||
}), b.push(f)
|
||||
}
|
||||
}
|
||||
return b
|
||||
},
|
||||
getPostData: function() {
|
||||
var a = this,
|
||||
b = this;
|
||||
null !== curRow && null !== curCol && ($("#grid").jqGrid("saveCell", curRow, curCol), curRow = null, curCol = null);
|
||||
var c = b.$_customer.find("input");
|
||||
if ("" === c.val() || "(空)" === c.val()) {
|
||||
var d = {};
|
||||
d.id = 0, d.name = "(空)", b.$_customer.removeData("contactInfo")
|
||||
} else {
|
||||
var d = b.$_customer.data("contactInfo");
|
||||
if (null === d) return setTimeout(function() {
|
||||
c.focus().select()
|
||||
}, 15), parent.Public.tips({
|
||||
type: 2,
|
||||
content: "当前客户不存在!"
|
||||
}), !1
|
||||
}
|
||||
var e = this._getEntriesData();
|
||||
if (!e) return !1;
|
||||
if (e.length > 0) {
|
||||
var f = $.trim(a.$_note.val());
|
||||
a.calTotal();
|
||||
var g = {
|
||||
id: originalData.id,
|
||||
buId: d.id,
|
||||
contactName: d.name,
|
||||
date: $.trim(a.$_date.val()),
|
||||
billNo: $.trim(a.$_number.text()),
|
||||
transTypeId: a.transTypeCombo.getValue(),
|
||||
transTypeName: a.transTypeCombo.getText(),
|
||||
entries: e,
|
||||
totalQty: $("#grid").jqGrid("footerData", "get").qty.replace(/,/g, ""),
|
||||
totalAmount: $("#grid").jqGrid("footerData", "get").amount.replace(/,/g, ""),
|
||||
description: f === a.$_note[0].defaultValue ? "" : f
|
||||
};
|
||||
return g
|
||||
}
|
||||
return parent.Public.tips({
|
||||
type: 2,
|
||||
content: "商品信息不能为空!"
|
||||
}), $("#grid").jqGrid("editCell", 1, 2, !0), !1
|
||||
}
|
||||
},
|
||||
hasLoaded = !1,
|
||||
originalData;
|
||||
$(function() {
|
||||
if (urlParam.id) hasLoaded || Public.ajaxGet("../scm/invOi/updateIn?action=updateIn&type=in", {
|
||||
id: urlParam.id
|
||||
}, function(a) {
|
||||
200 === a.status ? (originalData = a.data, THISPAGE.init(a.data), hasLoaded = !0) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
});
|
||||
else {
|
||||
if (originalData = {
|
||||
id: -1,
|
||||
status: "add",
|
||||
customer: 0,
|
||||
entries: [{
|
||||
id: "1"
|
||||
}, {
|
||||
id: "2"
|
||||
}, {
|
||||
id: "3"
|
||||
}, {
|
||||
id: "4"
|
||||
}, {
|
||||
id: "5"
|
||||
}, {
|
||||
id: "6"
|
||||
}, {
|
||||
id: "7"
|
||||
}, {
|
||||
id: "8"
|
||||
}],
|
||||
totalQty: 0,
|
||||
totalAmount: 0,
|
||||
disRate: 0,
|
||||
disAmount: 0,
|
||||
amount: "0.00",
|
||||
rpAmount: "0.00",
|
||||
arrears: "0.00"
|
||||
}, urlParam.cacheId) {
|
||||
var a = parent.Cache[urlParam.cacheId];
|
||||
originalData.transType = a.data.warehouseData.transType, originalData.entries = a.data.warehouseData.entries, originalData.callback = a.callback
|
||||
}
|
||||
THISPAGE.init(originalData)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
251
statics/js/dist/otherWarehouseList.js
vendored
Executable file
251
statics/js/dist/otherWarehouseList.js
vendored
Executable file
@@ -0,0 +1,251 @@
|
||||
var queryConditions = {
|
||||
matchCon: "",
|
||||
locationId: -1,
|
||||
transTypeId: -1
|
||||
},
|
||||
hiddenAmount = !1,
|
||||
SYSTEM = system = parent.SYSTEM,
|
||||
billRequiredCheck = 0,
|
||||
//billRequiredCheck = system.billRequiredCheck,
|
||||
THISPAGE = {
|
||||
init: function() {
|
||||
SYSTEM.isAdmin !== !1 || SYSTEM.rights.AMOUNT_INAMOUNT || (hiddenAmount = !0), this.initDom(), this.loadGrid(), this.addEvent()
|
||||
},
|
||||
initDom: function() {
|
||||
this.$_matchCon = $("#matchCon"), this.$_beginDate = $("#beginDate").val(system.beginDate), this.$_endDate = $("#endDate").val(system.endDate), this.$_matchCon.placeholder(), this.$_beginDate.datepicker(), this.$_endDate.datepicker()
|
||||
},
|
||||
loadGrid: function() {
|
||||
function a(a, b, c) {
|
||||
var d = '<div class="operating" data-id="' + c.id + '"><span class="ui-icon ui-icon-pencil" title="修改"></span><span class="ui-icon ui-icon-trash" title="删除"></span></div>';
|
||||
return d
|
||||
}
|
||||
function b(a) {
|
||||
var b;
|
||||
switch (a) {
|
||||
case 150701:
|
||||
b = "盘盈";
|
||||
break;
|
||||
case 150706:
|
||||
b = "其他入库"
|
||||
}
|
||||
return b
|
||||
}
|
||||
var c = Public.setGrid();
|
||||
queryConditions.beginDate = this.$_beginDate.val(), queryConditions.endDate = this.$_endDate.val(), $("#grid").jqGrid({
|
||||
url: "../scm/invOi/listIn?action=listIn&type=in",
|
||||
postData: queryConditions,
|
||||
datatype: "json",
|
||||
autowidth: !0,
|
||||
height: c.h,
|
||||
altRows: !0,
|
||||
gridview: !0,
|
||||
multiselect: !0,
|
||||
multiboxonly: !0,
|
||||
colModel: [{
|
||||
name: "operating",
|
||||
label: "操作",
|
||||
width: 60,
|
||||
fixed: !0,
|
||||
formatter: a,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billDate",
|
||||
label: "单据日期",
|
||||
width: 100,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "billNo",
|
||||
label: "单据编号",
|
||||
width: 150,
|
||||
align: "center"
|
||||
}, {
|
||||
name: "transType",
|
||||
label: "业务类别",
|
||||
width: 100,
|
||||
formatter: b
|
||||
}, {
|
||||
name: "amount",
|
||||
label: "金额",
|
||||
hidden: hiddenAmount,
|
||||
width: 100,
|
||||
align: "right",
|
||||
formatter: "currency"
|
||||
}, {
|
||||
name: "contactName",
|
||||
label: "供应商",
|
||||
width: 200
|
||||
}, {
|
||||
name: "userName",
|
||||
label: "制单人",
|
||||
index: "userName",
|
||||
width: 80,
|
||||
fixed: !0,
|
||||
align: "center",
|
||||
title: !1
|
||||
}, {
|
||||
name: "checkName",
|
||||
label: "审核人",
|
||||
width: 80,
|
||||
hidden: billRequiredCheck ? !1 : !0,
|
||||
fixed: !0,
|
||||
align: "center",
|
||||
title: !0,
|
||||
classes: "ui-ellipsis"
|
||||
}, {
|
||||
name: "description",
|
||||
label: "备注",
|
||||
width: 200,
|
||||
classes: "ui-ellipsis"
|
||||
}],
|
||||
cmTemplate: {
|
||||
sortable: !1,
|
||||
title: !1
|
||||
},
|
||||
page: 1,
|
||||
sortname: "number",
|
||||
sortorder: "desc",
|
||||
pager: "#page",
|
||||
rowNum: 100,
|
||||
rowList: [100, 200, 500],
|
||||
viewrecords: !0,
|
||||
shrinkToFit: !1,
|
||||
forceFit: !1,
|
||||
jsonReader: {
|
||||
root: "data.rows",
|
||||
records: "data.records",
|
||||
repeatitems: !1,
|
||||
total: "data.total",
|
||||
id: "id"
|
||||
},
|
||||
loadError: function() {},
|
||||
ondblClickRow: function(a) {
|
||||
$("#" + a).find(".ui-icon-pencil").trigger("click")
|
||||
}
|
||||
})
|
||||
},
|
||||
reloadData: function(a) {
|
||||
$("#grid").jqGrid("setGridParam", {
|
||||
url: "../scm/invOi/listIn?action=listIn&type=in",
|
||||
datatype: "json",
|
||||
postData: a
|
||||
}).trigger("reloadGrid")
|
||||
},
|
||||
addEvent: function() {
|
||||
var a = this;
|
||||
if ($(".grid-wrap").on("click", ".ui-icon-pencil", function(a) {
|
||||
a.preventDefault();
|
||||
var b = $(this).parent().data("id");
|
||||
parent.tab.addTabItem({
|
||||
tabid: "storage-otherWarehouse",
|
||||
text: "其他入库",
|
||||
url: "../scm/invOi?action=editOi&type=in&id=" + b
|
||||
});
|
||||
$("#grid").jqGrid("getDataIDs");
|
||||
parent.salesListIds = $("#grid").jqGrid("getDataIDs")
|
||||
}), $(".grid-wrap").on("click", ".ui-icon-trash", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("IO_DELETE")) {
|
||||
var b = $(this).parent().data("id");
|
||||
$.dialog.confirm("您确定要删除该入库记录吗?", function() {
|
||||
Public.ajaxGet("../scm/invOi/deleteIn?action=deleteIn", {
|
||||
id: b
|
||||
}, function(a) {
|
||||
200 === a.status ? ($("#grid").jqGrid("delRowData", b), parent.Public.tips({
|
||||
content: "删除成功!"
|
||||
})) : parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}), billRequiredCheck) {
|
||||
{
|
||||
$("#audit").css("display", "inline-block"), $("#reAudit").css("display", "inline-block")
|
||||
}
|
||||
$(".wrapper").on("click", "#audit", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("IO_CHECK")) {
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow"),
|
||||
c = b.join();
|
||||
return c ? void Public.ajaxPost("../scm/invOi/batchCheckInvOi?action=batchCheckInvOi", {
|
||||
id: c
|
||||
}, function(a) {
|
||||
if (200 === a.status) {
|
||||
for (var c = 0, d = b.length; d > c; c++) $("#grid").setCell(b[c], "checkName", system.realName);
|
||||
parent.Public.tips({
|
||||
content: "审核成功!"
|
||||
})
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
}) : void parent.Public.tips({
|
||||
type: 2,
|
||||
content: "请先选择需要审核的项!"
|
||||
})
|
||||
}
|
||||
}), $(".wrapper").on("click", "#reAudit", function(a) {
|
||||
if (a.preventDefault(), Business.verifyRight("IO_UNCHECK")) {
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow"),
|
||||
c = b.join();
|
||||
return c ? void Public.ajaxPost("../scm/invOi/rsBatchCheckInvOi?action=rsBatchCheckInvOi", {
|
||||
id: c
|
||||
}, function(a) {
|
||||
if (200 === a.status) {
|
||||
for (var c = 0, d = b.length; d > c; c++) $("#grid").setCell(b[c], "checkName", " ");
|
||||
parent.Public.tips({
|
||||
content: "反审核成功!"
|
||||
})
|
||||
} else parent.Public.tips({
|
||||
type: 1,
|
||||
content: a.msg
|
||||
})
|
||||
}) : void parent.Public.tips({
|
||||
type: 2,
|
||||
content: "请先选择需要反审核的项!"
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
$("#search").click(function() {
|
||||
queryConditions.matchCon = "请输入单据号或供应商或备注" === a.$_matchCon.val() ? "" : a.$_matchCon.val(), queryConditions.beginDate = a.$_beginDate.val(), queryConditions.endDate = a.$_endDate.val(), queryConditions.locationId = -1, queryConditions.transTypeId = -1, THISPAGE.reloadData(queryConditions)
|
||||
}), $("#moreCon").click(function() {
|
||||
queryConditions.matchCon = "请输入单据号或供应商或备注" === a.$_matchCon.val() ? "" : a.$_matchCon.val(), queryConditions.beginDate = a.$_beginDate.val(), queryConditions.endDate = a.$_endDate.val(), $.dialog({
|
||||
id: "moreCon",
|
||||
width: 480,
|
||||
height: 330,
|
||||
min: !1,
|
||||
max: !1,
|
||||
title: "高级搜索",
|
||||
button: [{
|
||||
name: "确定",
|
||||
focus: !0,
|
||||
callback: function() {
|
||||
queryConditions = this.content.handle(queryConditions), THISPAGE.reloadData(queryConditions), "" !== queryConditions.matchCon && a.$_matchCon.val(queryConditions.matchCon), a.$_beginDate.val(queryConditions.beginDate), a.$_endDate.val(queryConditions.endDate)
|
||||
}
|
||||
}, {
|
||||
name: "取消"
|
||||
}],
|
||||
resize: !1,
|
||||
content: "url:../storage/other_search?type=other",
|
||||
data: queryConditions
|
||||
})
|
||||
}), $("#add").click(function(a) {
|
||||
a.preventDefault(), Business.verifyRight("IO_ADD") && parent.tab.addTabItem({
|
||||
tabid: "storage-otherWarehouse",
|
||||
text: "其他入库",
|
||||
url: "../scm/invOi?action=initOi&type=in"
|
||||
})
|
||||
}), $(window).resize(function() {
|
||||
Public.resizeGrid()
|
||||
}), $(".wrapper").on("click", "#export", function(a) {
|
||||
if (!Business.verifyRight("IO_EXPORT")) return void a.preventDefault();
|
||||
var b = $("#grid").jqGrid("getGridParam", "selarrrow"),
|
||||
c = b.join(),
|
||||
d = c ? "&id=" + c : "";
|
||||
for (var e in queryConditions) queryConditions[e] && (d += "&" + e + "=" + queryConditions[e]);
|
||||
var f = "../scm/invOi/exportInvOi?action=exportInvOi" + d;
|
||||
$(this).attr("href", f)
|
||||
})
|
||||
}
|
||||
};
|
||||
THISPAGE.init();
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user