| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525 |
- <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
- <%@ page import="javassist.expr.NewArray" %>
- <%@include file="/context/mytags.jsp" %>
- <!DOCTYPE html>
- <html>
- <head>
- <title>请款申请单</title>
- <t:base type="jquery,easyui,tools,DatePicker,autocomplete"></t:base>
- <script src="webpage/cn/com/lzt/useractiviti/select_user_tools.js"></script>
- <script src="webpage/cn/com/lzt/cost/cost_tools.js"></script>
- <script type="text/javascript">
- //编写自定义JS代码
- var sourceIds = '${sourceIds}';
- var pageType = '${pageType}';
- var fileListInfo = []
- function openCostRequest(sourceType) {
- //获取主键id
- var id = $('#id').val();
- var params = {};
- params.id = id;
- $('#sourceType').val(sourceType);
- setBySourceType();
- if (sourceType == 'cost_request') {
- selectCostRequest(params, function (selectRows) {
- var one = selectRows[0];
- var summary = one.summary;
- var requestId = one.id;
- $('#sourceType').val(one.sourceType);
- $('#requestSummary').val(summary);
- $('#requestSummaryTxt').html(summary);
- $('#requestId').val(requestId);
- $('#expectMoney').val(one.expectMoney);
- $('#expectMoneyTxt').html(one.expectMoney);
- $('#payMoney').val(one.expectMoney);
- $('#costTypeId').val(one.costType);
- $('#showMeasureName').val(one.measureName);
- $('#showDep').val(one.depName);
- $('#showDepTxt').html(one.depName);
- });
- } else {
- // var ids = $('#sourceIds').val();
- var id = $('#id').val();
- selectCompanyProducts(id, function (selectRows) {
- $('#requestSummary').html('采购单报销');
- var infoArray = new Array();
- var idArray = new Array();
- var departNameObj = {};
- var money = 0;
- for (var i = 0; i < selectRows.length; i++) {
- var one = selectRows[i];
- infoArray.push(one.id + "#" + one.sourceType);
- idArray.push(one.id);
- departNameObj[one.departName] = '1';
- money += parseFloat(one.money);
- }
- money = money.toFixed(2);
- $('#requestId').val(infoArray.join(','));
- $('#sourceIds').val(idArray.join(','));
- $('#payMoney').val(money);
- $('#expectMoney').val(money);
- $('#expectMoneyTxt').html(money);
- var summary = '采购单报销';
- $('#requestSummary').val(summary);
- $('#requestSummaryTxt').html(summary);
- var departNameArray = [];
- var oriDepartName = $('#depName').val();
- for (var k in departNameObj) {
- departNameArray.push(k);
- }
- $('#showDep').val(departNameArray.join(','));
- $('#showDepTxt').html(departNameArray.join(','));
- var supplierId = selectRows[0].supplierId;
- getRelatedUnitInfo(supplierId);
- }, '100%', '100%');
- }
- }
- // add-刘梦祥-2021年11月9日15:25:07-数据渲染逻辑优化,文件渲染获取逻辑
- $(() => {
- if (pageType === 'Update' || pageType === 'Detail') {
- fileListInfo = JSON.parse(JSON.stringify(${entity.attachment}))
- changeFileListDom()
- }
- })
- // add-刘梦祥-2021年11月5日14:39:52-自定义上传文件回调函数
- function uploadSuccess(response) {
- if (response.success) {
- var fileList = $('#attachment')
- var fileListVar = fileList.val()
- //去重
- if (fileListVar.indexOf(response.attributes.name) !== -1) {
- //重复的话直接return
- return;
- } else {
- //得到返回的文件名和请求路径
- var fileInfo = {name: response.attributes.name, url: response.attributes.url}
- //总集合加入元素
- fileListInfo.push(fileInfo)
- //更新提示文件列表
- changeFileListDom()
- }
- }
- }
- //add-刘梦祥-2021年11月5日15:07:06-根据fileListInfo对象更新input绑定框中的值
- function changeAttachment() {
- $('#attachment').val(JSON.stringify(fileListInfo))
- }
- //add-刘梦祥-2021年11月5日14:43:33-更新提示文件列表
- function changeFileListDom() {
- //首先清空提示文件列表
- $('#fileListInfoDom').empty();
- //值不为空的话
- if (fileListInfo.length > 0) {
- fileListInfo.forEach((item, index) => {
- //生成临时标签
- var jspDomStr = `<div class="fileInfoItemBox"><div class="fileName">` + item.name + `</div>--文件上传成功--`
- if (pageType === 'Detail') {
- jspDomStr += `<a class="down" href="${webRoot}/` + item.url + `" download="` + item.name + `">下载</a>`;
- } else {
- jspDomStr += `<span class="del" onclick="deleteFile(` + index + `)">删除</span>`;
- }
- jspDomStr += `</div>`;
- //追加到显示的dom元素中
- $('#fileListInfoDom').append(jspDomStr)
- })
- }
- // 根据fileListInfo对象更新input绑定框中的值
- changeAttachment()
- }
- //add-刘梦祥-2021年11月5日15:03:17-删除文件操作
- function deleteFile(index) {
- fileListInfo.splice(index, 1)
- changeFileListDom()
- }
- function beforeSubmit() {
- return true;
- }
- $(function () {
- $('#amount').bind('change', changeAmount);
- $('#tax').bind('change', changeTax);
- $('#invoicetype').bind('change', changeInvoicetype);
- $('#invoicetype').change();
- $.Datatype.checkMoney = function (val, obj, frm) {
- var select = $('#invoicetype');
- var invoicetype = select.val();
- var money = parseFloat($('#payMoney').val()).toFixed(2);
- if (invoicetype == 'special') {//专票验证金额+税额
- var amount = $('#amount').val();
- var tax = $('#tax').val()
- if (money != parseFloat(parseFloat(amount) + parseFloat(tax)).toFixed(2)) {
- return "价税合计与金额+税额不符";
- }
- }
- var expectMoney = $('#expectMoney').val();
- if (parseFloat(expectMoney) < parseFloat(money)) {
- return '当前报销额度超过费用申请额度,请重新提交费用申请';
- }
- return true;
- }
- $('#costTypeSelect4fixasset').bind('change', function () {
- $('#costTypeId').val($(this).val());
- })
- setBySourceType();
- $('#relatedUnitsId').bind('change', function () {//收款人自动补全后,补全其他银行信息
- var t = $(this);
- getRelatedUnitInfo(t.val());
- });
- });
- function changeAmount() {
- var t = $(this);
- var tax = $('#tax');
- var taxVal = tax.val();
- var payMoney = $('#payMoney');
- var payMoneyVal = payMoney.val();
- var amountVal = t.val();
- if (taxVal && parseFloat(taxVal) != 0) {
- payMoney.val((parseFloat(taxVal) + parseFloat(amountVal)).toFixed(2));
- } else if (payMoneyVal) {
- tax.val((parseFloat(payMoneyVal) - parseFloat(amountVal)).toFixed(2));
- }
- //金额小写转大写
- var amountA = $('#amountA')
- amountA.val(chineseNumber($('#amount').val()))
- }
- //金额小写转大写
- function chineseNumber(num) {
- if (isNaN(num) || num > Math.pow(10, 12))
- return ""
- var cn = "零壹贰叁肆伍陆柒捌玖"
- var unit = new Array("拾百千", "分角")
- var unit1 = new Array("万亿", "")
- var numArray = num.toString().split(".")
- var start = new Array(numArray[0].length - 1, 2)
- function toChinese(num, index) {
- var num = num.replace(/\d/g, function ($1) {
- return cn.charAt($1) + unit[index].charAt(start-- % 4 ? start % 4 : -1)
- })
- return num
- }
- for (var i = 0; i < numArray.length; i++) {
- var tmp = ""
- for (var j = 0; j * 4 < numArray[i].length; j++) {
- var strIndex = numArray[i].length - (j + 1) * 4
- var str = numArray[i].substring(strIndex, strIndex + 4)
- var start = i ? 2 : str.length - 1
- var tmp1 = toChinese(str, i)
- tmp1 = tmp1.replace(/(零.)+/g, "零").replace(/零+$/, "")
- tmp1 = tmp1.replace(/^壹拾/, "拾")
- tmp = (tmp1 + unit1[i].charAt(j - 1)) + tmp
- }
- numArray[i] = tmp
- }
- numArray[1] = numArray[1] ? numArray[1] : ""
- numArray[0] = numArray[0] ? numArray[0] + "元" : numArray[0], numArray[1] = numArray[1].replace(/^零+/, "")
- numArray[1] = numArray[1].match(/分/) ? numArray[1] : numArray[1]
- return numArray[0] + numArray[1]
- }
- function changeTax() {
- var t = $(this);
- var amount = $('#amount');
- var amountVal = amount.val();
- var payMoney = $('#payMoney');
- var payMoneyVal = payMoney.val();
- var taxVal = t.val();
- if (amountVal && parseFloat(amountVal) != 0) {
- payMoney.val((parseFloat(taxVal) + parseFloat(amountVal)).toFixed(2));
- } else if (payMoneyVal) {
- amount.val((parseFloat(payMoneyVal) - parseFloat(taxVal)).toFixed(2));
- }
- }
- function changeInvoicetype() {
- var t = $(this);
- var val = t.val();
- var amount = $('#amount');
- var tax = $('#tax');
- if (val == 'special') {//专票
- amount.removeAttr('readonly');
- tax.removeAttr('readonly');
- } else {// 普票、定额、其他
- amount.val(0);
- tax.val(0);
- amount.attr('readonly', 'readonly');
- tax.attr('readonly', 'readonly');
- }
- }
- function setBySourceType() {
- var sourceType = $('#sourceType').val();
- if (sourceType.indexOf('cost_request') != -1) {
- $('#costTypeTr').show();
- } else {
- $('#costTypeTr').hide();
- }
- }
- function getRelatedUnitInfo(relatedUnitsId) {
- $.post("relatedUnitsController.do?relatedUnitsExtrainfo", {relatedUnitsId: relatedUnitsId}, function (data) {
- $('#bankName').val(data.depositBank);
- $('#bankUser').val(data.unitname);
- $('#bankNum').val(data.account);
- $('#contactUser').val(data.contactName);
- $('#contactWay').val(data.telPhone);
- }, 'json');
- }
- </script>
- </head>
- <body>
- <%--处理回调--%>
- <c:set var="_callback">
- <c:choose>
- <c:when test="${in_process}">@Overridecallback</c:when>
- <c:otherwise>callback</c:otherwise>
- </c:choose>
- </c:set>
- <t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table"
- action="tBActivitiCostPayTmpCompanyController.do?doAdd"
- callback="${_callback}" beforeSubmit="beforeSubmit">
- <input id="id" name="id" type="hidden" value="${entity.id }"/>
- <%-- 费用类型--%>
- <input id="sourceType" name="sourceType" type="hidden" value="${entity.sourceType }"/>
- <%-- add-刘梦祥-2021年11月4日16:56:18-(在该页面指定单据类型值)--%>
- <input id="documentsType" name="documentsType" field="documentsType" type="hidden" value="pleass_type"/>
- <table style="width: 600px;" cellpadding="0" cellspacing="1" class="formtable">
- <input id="finCode" name="finCode" type="hidden" value="${empty entity.finCode?param.finCode:entity.finCode}"/>
- <c:if test="${in_process && param.flag!=1}">
- <tr>
- <td align="right">
- <label class="Validform_label">
- 申请人:
- </label>
- </td>
- <td class="value">
- ${entity.realName}
- </td>
- </tr>
- </c:if>
- <%-- 刘梦祥:这个科室的选择应该用一个下拉框,由于数据是动态的,所以不能用字典表。但是没有找到更好的方法,所以需要将字典表中的部门id和name与当前使用的字典表对应一下--%>
- <tr>
- <td align="right">
- <label class="Validform_label">
- 科室:
- </label>
- </td>
- <td class="value">
- <t:dictSelect field="sysOrgCode" id="sysOrgCode" type="list" dictTable="t_s_depart" dictField="id" dictText="departname" dictCondition=" where org_type != '1' "
- datatype="*" defaultVal="${entity.sysOrgCode}"
- hasLabel="false" title="科室"></t:dictSelect>
- </td>
- </tr>
- <tr>
- <td align="right">
- <label class="Validform_label">
- <span color="red" class="requiredIcon">*</span>事由:
- </label>
- </td>
- <td class="value">
- <input id="reason" name="reason" type="text" style="width: 150px" class="inputxt" datatype="*"
- value="${entity.reason}"/>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">事由</label>
- </td>
- </tr>
- <tr>
- <td align="right">
- <label class="Validform_label">
- <span color="red" class="requiredIcon">*</span>发票类型:
- </label>
- </td>
- <td class="value">
- <t:dictSelect field="invoicetype" id="invoicetype" type="list" typeGroupCode="invoicetype" datatype="*"
- defaultVal="${entity.invoicetype}"
- hasLabel="false" title="发票类型"></t:dictSelect>
- </td>
- </tr>
- <tr>
- <td align="right">
- <label class="Validform_label">
- <span color="red" class="requiredIcon">*</span>收款方:
- </label>
- </td>
- <td class="value">
- <input id="bankUser" name="bankUser" type="text" class="inputxt" datatype="*"
- value="${entity.bankUser}"/>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">收款方</label>
- </td>
- </tr>
- <tr>
- <td align="right">
- <label class="Validform_label">
- <span color="red" class="requiredIcon">*</span>银行账户:
- </label>
- </td>
- <td class="value">
- <input id="bankNum" name="bankNum" type="text" style="width: 150px" class="inputxt" datatype="*"
- value="${entity.bankNum}"/>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">银行账户</label>
- </td>
- </tr>
- <tr>
- <td align="right">
- <label class="Validform_label">
- <span color="red" class="requiredIcon">*</span>付款方式:
- </label>
- </td>
- <td class="value">
- <t:dictSelect field="paytype" id="paytype" type="list" typeGroupCode="paytype" datatype="*"
- defaultVal="${entity.paytype}"
- hasLabel="false" title="付款方式"></t:dictSelect>
- </td>
- </tr>
- <tr>
- <td align="right">
- <label class="Validform_label">
- <span color="red" class="requiredIcon">*</span>金额合计:
- </label>
- </td>
- <td class="value">
- <input name="amount" id="amount" maxlength="10" type="text" class="inputxt" style="width:150px;"
- datatype="d,fix2" value="${entity.amount}"/>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">金额合计</label>
- </td>
- </tr>
- <tr>
- <td align="right">
- <label class="Validform_label">
- 金额(大写):
- </label>
- </td>
- <td class="value">
- <input name="amountA" id="amountA" type="text" class="inputxt" readonly style="width:150px;border:none;"
- value="${entity.amountA}"/>
- </td>
- </tr>
- <tr id="costTypeTr" style="display: none;">
- <td align="right">
- <label class="Validform_label">
- 发票张数:
- </label>
- </td>
- <td class="value">
- <input type="hidden" name="costTypeId" id="costTypeId" value="${entity.costTypeId}"/>
- <input name="showMeasureName" id="showMeasureName" type="text" class="inputxt" style="width:150px;"
- readonly="readonly" value="${entity.showMeasureName}"/>
- </td>
- </tr>
- <tr>
- <td align="right">
- <label class="Validform_label">
- 备注:
- </label>
- </td>
- <td class="value">
- <textarea name="remark" id="remark" style="width:200px;height: 70px"
- class="inputxt">${entity.remark}</textarea>
- </td>
- </tr>
- <tr>
- <td align="right">
- <label class="Validform_label">
- 附件:
- </label>
- </td>
- <td class="value">
- <%-- 暂存文件信息--%>
- <textarea name="attachment" id="attachment" style="width:200px;height: 70px;display: none;"
- class="inputxt">${entity.attachment}</textarea>
- <%-- 上传按钮--%>
- <t:webUploader auto="true"
- url="cgUploadController.do?ajaxSaveFile"
- busiTable="t_b_activiti_cost_pay_tmp_company"
- extensions="xls,xlsx,doc,docx,png,jpg,jpeg,pdf"
- duplicate="true"
- name="requestSummary"
- callback="uploadSuccess"
- showHis="false"
- fileNumLimit="10"
- displayTxt="false"
- nullMsg="附件不可为空"></t:webUploader>
- <%--自定义显示文件列表--%>
- <div id="fileListInfoDom">
- <p>支持xls,xlsx,doc,docx,png,jpg,jpeg,pdf格式的文件,文件不超过10Mb!</p>
- </div>
- </td>
- </tr>
- </table>
- <table style="width: 100%">
- <tr>
- <td style="text-align:center;">
- <%@include file="/webpage/cn/com/lzt/useractiviti/view_submit_buttons.jsp" %>
- </td>
- </tr>
- </table>
- </t:formvalid>
- </body>
- <script src="webpage/cn/com/lzt/cost/activiti/tmpcompany/tBActivitiCostPayTmpCompany.js"></script>
- <style>
- /*文件列表文字样式*/
- .fileInfoItemBox {
- display: flex;
- align-items: center;
- width: 300px;
- color: #67C23A;
- }
- /*文件列表文字样式*/
- .fileName {
- width: 100px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- color: #999;
- text-decoration: underline;
- }
- /*文件列表下载按钮样式*/
- .down {
- cursor: pointer;
- color: #67C23A;
- }
- .down:hover {
- cursor: pointer;
- color: #67C23A;
- }
- .down:active {
- cursor: pointer;
- color: #67C23A;
- }
- /*文件列表删除按钮样式*/
- .del {
- cursor: pointer;
- color: #F56C6C;
- }
- .del:hover {
- cursor: pointer;
- color: #F56C6C;
- }
- .del:active {
- cursor: pointer;
- color: #F56C6C;
- }
- </style>
|