From 237f9af69f9bf1a9ef8cd46e60ec368caa549ae7 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期二, 28 十一月 2023 14:17:08 +0800
Subject: [PATCH] #
---
src/main/webapp/static/js/priQuote/priQuote.js | 339 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 309 insertions(+), 30 deletions(-)
diff --git a/src/main/webapp/static/js/priQuote/priQuote.js b/src/main/webapp/static/js/priQuote/priQuote.js
index 1b0e9ea..7343138 100644
--- a/src/main/webapp/static/js/priQuote/priQuote.js
+++ b/src/main/webapp/static/js/priQuote/priQuote.js
@@ -3,8 +3,9 @@
layui.config({
base: baseUrl + "/static/layui/lay/modules/"
}).extend({
+ steps: 'steps/steps',
cascader: 'cascader/cascader',
-}).use(['table','laydate', 'form', 'admin', 'xmSelect', 'element', 'cascader', 'tree', 'dropdown','layer','upload', 'cascader'], function(){
+}).use(['table','laydate', 'form', 'admin', 'xmSelect', 'element', 'cascader', 'steps', 'tree', 'dropdown','layer','upload', 'cascader'], function(){
var table = layui.table;
var $ = layui.jquery;
var layer = layui.layer;
@@ -12,6 +13,7 @@
var form = layui.form;
admin = layui.admin;
var tree = layui.tree;
+ var steps = layui.steps;
var element = layui.element;
var upload = layui.upload;
var xmSelect = layui.xmSelect;
@@ -86,17 +88,42 @@
cellMinWidth: 150,
cols: [[
{type: 'checkbox', fixed: 'left'}
- ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
- ,{field: 'templateName', align: 'center',title: '妯℃澘鍚�', width: 220, style: 'color: #1890ff;cursor:pointer', event: 'more',hide: false}
- ,{field: 'orderNum', align: 'center',title: '鎶ヤ环棰勭畻鍗曞彿'}
- ,{field: 'inOrderNum', align: 'center',title: '鎶ヤ环缂栧彿'}
- ,{field: 'planId$', align: 'center',title: '瑙勫垝鍗曞彿'}
- ,{field: 'createTime$', align: 'center',title: '鍒涘缓鏃堕棿'}
- ,{field: 'updateTime$', align: 'center',title: '鏇存柊鏃堕棿'}
- ,{field: 'memberId$', align: 'center',title: '涓氬姟鍛�'}
- ,{field: 'userId$', align: 'center',title: '鍒涘缓浜哄憳'}
- ,{field: 'updateUserId$', align: 'center',title: '鏇存柊浜哄憳'}
- ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:200}
+ ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80,hide : true, sort:true}
+ ,{
+ field: 'templateName',
+ align: 'center',
+ title: '瀹㈡埛鍚嶇О',
+ style: 'color: #1890ff;cursor:pointer',
+ event: 'moreCstmr',
+ width: 350,
+ hide: false, sort:true
+ }
+ ,{field: 'cstmrId$', align: 'center',title: '瀹㈡埛id',hide: true}
+ ,{field: 'inOrderNum', align: 'center',title: '鎶ヤ环缂栧彿',hide: false, sort:true}
+ // ,{field: 'orderNum', align: 'center',title: '鎶ヤ环棰勭畻鍗曞彿',hide: false}
+ ,{
+ field: 'planId$',
+ align: 'center',
+ title: '瑙勫垝鍗曞彿',
+ style: 'color: #1890ff;cursor:pointer',
+ event: 'morePlan'}
+ ,{field: 'itemId', align: 'center',title: '瑙勫垝鍗旾D', hide: true, sort:true}
+ ,{field: 'planName$', align: 'center',title: '瑙勫垝鍗曞悕绉�',hide: false}
+ ,{
+ field: 'settle$',
+ align: 'center',
+ title: '杩涘害',
+ style: 'color: #1890ff;cursor:pointer',
+ event: 'more',
+ width: 150,
+ hide: false
+ }
+ ,{field: 'createTime$', align: 'center',title: '鍒涘缓鏃堕棿',hide: false}
+ ,{field: 'updateTime$', align: 'center',title: '鏇存柊鏃堕棿',hide: false}
+ // ,{field: 'memberId$', align: 'center',title: '涓氬姟鍛�',hide: false}
+ ,{field: 'userId$', align: 'center',title: '涓氬姟鍛�',hide: true}
+ ,{field: 'updateUserId$', align: 'center',title: '鏇存柊浜哄憳',hide: false}
+ ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:280}
]],
request: {
pageName: 'curr',
@@ -117,9 +144,104 @@
if (res.code === 403) {
top.location.href = baseUrl+"/";
}
- pageCurr=curr;
+ pageCurr=curr;pageCount=count;
limit();
}
+ });
+
+ $("#data-btn-file2").on("click", (e) => {
+ $("#data-btn-upload").click()
+ });
+
+ var _uploadFile = null
+ //鍝嶅簲涓婁紶
+ $("#data-btn-upload").on("change",(evt) => {
+ var files = evt.target.files;
+ if(files==null || files.length==0){
+ alert("No files wait for import");
+ return;
+ }
+
+ var file = files[0]
+
+ var tr = $(['<tr id="upload-">'
+ ,'<td id="upload-filename-id-'+ file.lastModified + '">' + file.name +'</td>'
+ ,'<td>'+ (file.size/1014).toFixed(1) +'kb</td>'
+ ,'<td id="upload-filename-userName-'+ '">' +'</td>'
+ ,'<td id="upload-file-id-' + file.lastModified + '"><div class="layui-progress layui-progress-big" lay-showPercent="true" lay-filter="progress-demo-'+ file.lastModified +'"><div class="layui-progress-bar" lay-percent=""></div></div></td>'
+ ,'<td>'
+ ,'<button class="layui-btn layui-btn-xs demo-reload layui-hide">閲嶄紶</button>'
+ ,'<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">鍒犻櫎</button>'
+ ,'<button id="file-download" class="layui-btn layui-btn-xs demo-reload layui-hide">涓嬭浇</button>'
+ ,'</td>'
+ ,'</tr>'].join(''));
+
+ //鍒犻櫎
+ tr.find('.demo-delete').on('click', function(){
+ tr.remove();
+ $("#data-btn-upload").val("")
+ _uploadFile = null
+ });
+
+ $('#data-btn-file3').append(tr)
+
+ element.progress('progress-demo-'+ file.lastModified, '0%'); //鎵ц杩涘害鏉°��
+ element.init();
+
+ _uploadFile = file
+ })
+
+ //寮�濮嬩笂浼�
+ $("#testListAction").on("click", async (e) => {
+ if (_uploadFile == null) {
+ return false;
+ }
+
+ var index = layer.load(1, {
+ shadeClose: false,
+ title: '涓婁紶涓�..',
+ shade: [0.5,'#000']
+ });
+
+ var file = _uploadFile
+
+ putObject(file,(p) => {
+ element.progress('progress-demo-'+ file.lastModified, (Math.round(p * 100)) + "%"); //鎵ц杩涘害鏉°��
+ }).then((result) => {
+ var filename = result.name
+ layer.msg('涓婁紶鎴愬姛', {icon: 1});
+ $("#upload-file-id-" + file.lastModified).html("涓婁紶鎴愬姛")
+ $("#upload-filename-id-" + file.lastModified).html(filename)
+ let token = localStorage.getItem("token");
+ $.ajax({
+ url: baseUrl+"/pri/quote/url/insert/file/auth",
+ headers: {'token': localStorage.getItem('token')},
+ data: {
+ 'planId': $('.layui-layer-title').text(),
+ 'filename': filename,
+ 'filesize': file.size
+ },
+ method: 'POST',
+ success: function (res) {
+ if (res.code === 200){
+ layer.close(index)
+ console.log(res)
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ } else {
+ layer.msg(res.msg)
+ }
+ }
+ });
+ }).catch((e) => {
+ console.log(e)
+ layer.msg('涓婁紶澶辫触', {icon: 2});
+ $("#upload-file-id-" + file.lastModified).html("涓婁紶澶辫触")
+ })
+
+ //娓呯┖file
+ $("#data-btn-upload").val("")
+ _uploadFile = null
});
// 鐩戝惉鎺掑簭浜嬩欢
@@ -150,20 +272,6 @@
var checkStatus = table.checkStatus(obj.config.id);
console.log(checkStatus)
switch(obj.event) {
- case 'more':
- top.priQuoteByMore = obj.data.id;
- console.log(top.priQuoteByMore)
-
- admin.popupRight({
- type: 1,
- window: "top",
- area: "1250px",
- url: "priQuote_more.html",
- end: function () {
- // $(".layui-laypage-btn")[0].click();
- }
- })
- break;
case 'addBlank':
showEditModel();
break;
@@ -250,14 +358,75 @@
table.on('tool(priQuote)', function(obj){
var data = obj.data;
switch (obj.event) {
+ case 'moreCstmr':
+ top.cstmrByMore = data.cstmrId$;
+ admin.popupRight({
+ type: 1,
+ window: "top",
+ area: "1250px",
+ url: "../cstmr/cstmr_more.html",
+ end: function () {
+ // $(".layui-laypage-btn")[0].click();
+ }
+ })
+ break;
+ case 'morePlan':
+ top.planByMore = data.itemId;
+ admin.popupRight({
+ type: 1,
+ window: "top",
+ area: "1250px",
+ url: "../plan/plan_more_other.html",
+ end: function () {
+ // $(".layui-laypage-btn")[0].click();
+ }
+ })
+ break;
+ case 'approval':
+ layer.confirm('瀹℃壒閫氳繃锛�', {
+ skin: 'layui-layer-admin',
+ shade: .1,
+ offset: '200px',
+ title: data.name
+ }, function (i) {
+ layer.close(i);
+ approval(data.id);
+ });
+ break;
+ case 'refuse':
+ layer.confirm('鎷掔粷锛�', {
+ skin: 'layui-layer-admin',
+ shade: .1,
+ offset: '200px',
+ title: data.name
+ }, function (i) {
+ layer.close(i);
+ refuse(data.id);
+ });
+ break;
+ case 'more':
+ top.priQuoteByMore = data.id;
+ console.log(top.priQuoteByMore)
+
+ admin.popupRight({
+ type: 1,
+ window: "top",
+ area: "1250px",
+ url: "priQuote_more.html",
+ end: function () {
+ // $(".layui-laypage-btn")[0].click();
+ }
+ })
+ break;
case "quote":
+ console.log(data)
layer.open({
type: 2,
title: '鎶ヤ环鍗曠紪杈�',
maxmin: true,
area: [top.detailWidth, top.detailHeight],
shadeClose: false,
- content: 'priQuote_detail.html?id=' + data.id,
+ content: 'priQuote_detail.html?id=' + data.id + "&template=" + data.template,
success: function(layero, index){
// layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
}
@@ -288,7 +457,64 @@
})
});
break;
+ case "uploadLink":
+ // 鎵撳紑寮圭獥
+ // 鏋勫缓甯﹀弬鏁扮殑鍐呭
+ console.log(data)
+ layer.open({
+ type: 1,
+ title: '涓婁紶鏂囦欢-'+data.itemId+'-'+data.id,
+ content: $('#myModal')
+ });
+ // 鑾峰彇璺緞涓嬬殑鏂囦欢鍒楄〃锛屼娇鐢� jQuery 鐨� ajax 鏂规硶
+ $.ajax({
+ url: '/pri/quote/url/view/file/auth',
+ headers: {'token': localStorage.getItem('token')},
+ data:{
+ planId:data.itemId
+ },
+ success: function(response) {
+ if (response.code==200){
+ var targetTable = document.getElementById("data-btn-file3");
+ targetTable.innerHTML = '';
+ // 灏嗚幏鍙栧埌鐨勬枃浠跺垪琛ㄦ坊鍔犲埌鏂囦欢闃熷垪涓繘琛屾樉绀�
+ response.data.forEach(function(file,index) {
+ // 鍒涘缓tr鍏冪礌
+ var tr = document.createElement("tr");
+ tr.id = "upload-"+index;
+ tr.innerHTML = '<td>' + file.name + '</td>'
+ + '<td>' + (file.size / 1024).toFixed(1) + 'kb</td>'
+ + '<td>' + file.userName + '</td>'
+ // + '<td><div class="layui-progress" lay-filter="progress-demo-' + index ,100 + '%'+ '"><div class="layui-progress-bar" lay-percent=""></div></div></td>'
+ + '<td>'+'宸插畬鎴�'+'</td>'
+ + '<td>'
+ + '<button class="layui-btn layui-btn-xs demo-reload layui-hide">閲嶄紶</button>'
+ // + '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">鍒犻櫎</button>'
+ + '<a href="' + file.path + '" download class="layui-btn layui-btn-xs layui-btn-primary">涓嬭浇</a>'
+ + '</td>';
+ // 灏唗r鍏冪礌娣诲姞鍒扮洰鏍噒able涓�
+ targetTable.appendChild(tr);
+ });
+ }else {
+ console.log('Failed to get file list error.');
+ }
+ },
+ error: function() {
+ console.log('Failed to get file list.');
+ }
+ });
+ break;
}
+ });
+
+ // 鐐瑰嚮涓嬭浇鎸夐挳鏃惰Е鍙戞枃浠朵笅杞�
+ $('#data-btn-file3').on('click', 'a', function() {
+ console.log(this)
+ var downloadUrl = $(this).attr('href');
+ let url = getObjectUrl(downloadUrl)
+ layer.msg("鍑嗗涓嬭浇涓�", {icon: 1});
+ location.href = url
+ return false; // 闃绘榛樿鐨勯摼鎺ヨ烦杞涓�
});
// 鎼滅储
@@ -320,7 +546,7 @@
maxmin: true,
area: [top.detailWidth, top.detailHeight],
shadeClose: false,
- content: 'priQuote_detail.html?priQuoteBudgetId=' + data.field.id,
+ content: 'priQuote_detail.html?priQuoteBudgetId=' + data.field.id + "&template=" + data.field.template,
success: function(layero, index){
clearFormVal(layer.getChildFrame('#detail', index));
// layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
@@ -332,6 +558,59 @@
layui.form.render('select');
}
});
+ }
+
+ function refuse(planId, plannerId, dIdx) {
+ let loadIndex = layer.load(2);
+ $.ajax({
+ url: baseUrl+"/priQuote/refuse/auth",
+ headers: {'token': localStorage.getItem('token')},
+ data: {
+ planId: planId,
+ plannerId: plannerId
+ },
+ method: 'POST',
+ success: function (res) {
+ if (dIdx) {
+ layer.close(dIdx);
+ }
+ layer.close(loadIndex);
+ if (res.code === 200){
+ layer.msg(res.msg, {icon: 1});
+ tableReload();
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ } else {
+ layer.msg(res.msg, {icon: 2});
+ }
+ }
+ })
+ }
+ function approval(planId, plannerId, dIdx) {
+ let loadIndex = layer.load(2);
+ $.ajax({
+ url: baseUrl+"/priQuote/approval/auth",
+ headers: {'token': localStorage.getItem('token')},
+ data: {
+ planId: planId,
+ plannerId: plannerId
+ },
+ method: 'POST',
+ success: function (res) {
+ if (dIdx) {
+ layer.close(dIdx);
+ }
+ layer.close(loadIndex);
+ if (res.code === 200){
+ layer.msg(res.msg, {icon: 1});
+ tableReload();
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ } else {
+ layer.msg(res.msg, {icon: 2});
+ }
+ }
+ })
}
//鏇存柊form
@@ -454,7 +733,7 @@
function getItemInfo(val) {
$.ajax({
- url: baseUrl+"/priQuoteBudget/" + val + "/auth",
+ url: baseUrl+"/priOnline2/" + val + "/auth",
headers: {'token': localStorage.getItem('token')},
method: 'GET',
traditional:true,
--
Gitblit v1.9.1