| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575 |
- <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
- <%@include file="/context/mytags.jsp" %>
- <!DOCTYPE html>
- <html>
- <head>
- <title>物料出货编辑页面</title>
- <style>
- .ui-button {
- display: inline-block;
- padding: 2px 2px;
- margin-bottom: 0;
- font-size: 8px;
- font-weight: normal;
- line-height: 1.42857143;
- text-align: center;
- white-space: nowrap;
- vertical-align: middle;
- -ms-touch-action: manipulation;
- touch-action: manipulation;
- cursor: pointer;
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
- background-image: none;
- border: 1px solid transparent;
- border-radius: 4px;
- }
- .formtable tr:nth-child(1) {
- background: #CCCCCC;
- height: 2rem;
- }
- .inputxt {
- border: none !important;
- }
- .readInput {
- box-shadow: 0 0 1px 1px #CCC;
- height: 2rem;
- }
- .readInput:hover {
- border-color: #409EFF;
- }
- .inputActive {
- box-shadow: 0 0 2px 1px #409EFF;
- }
- .inputError {
- color: #F56C6C;
- }
- #receiverCarId {
- border: none;
- width: 100%;
- }
- .updateInfoBox {
- position: absolute;
- bottom: 10px;
- width: calc(100vw - 40px);
- height: auto;
- }
- .updateInfo {
- display: flex;
- }
- textarea {
- max-height: 100px;
- width: calc(100% - 50px);
- }
- formtable, td {
- border: 1px solid #CCCCCC;
- }
- /*禁用按钮样式*/
- .openReceiverCarBtu-S {
- background: linear-gradient(
- 90deg, #909399 0%, #90939964 150%);
- cursor: not-allowed;
- }
- /*按钮样式*/
- .openReceiverCarBtu-T {
- cursor: pointer;
- background: linear-gradient(
- 90deg, #67C23A 0%, #67C23A64 150%);
- }
- /*正常按钮的样式*/
- .openReceiverCarBtu {
- padding: 3px 5px;
- border-radius: 3px;
- color: #FFF;
- box-shadow: 1px 1px 3px 1px #999999;
- }
- .openReceiverCarBtu:hover {
- box-shadow: none;
- }
- .td_boxs {
- width: 100%;
- display: flex;
- align-items: center;
- align-content: center;
- justify-content: space-between;
- }
- .hiddenBox {
- display: none;
- }
- td {
- border: none !important;
- }
- .displayFlex {
- display: flex;
- justify-content: center;
- align-items: center;
- height: 30px;
- }
- .checkbox {
- transition: all 0.3s;
- color: #409EFF;
- cursor: pointer;
- padding: 5px;
- }
- .tab-wrapper-main * div {
- border: none;
- }
- </style>
- <t:base type="jquery,easyui,tools,DatePicker"></t:base>
- <script type="text/javascript">
- $(document).ready(function () {
- //计量单位禁止修改
- $("select").attr("disabled", "disabled");
- //下拉框禁止选择(主要针对货品的基本单位)
- if (${viewFlag == 1}) {
- $("input[name='outNum'],input[name='materialInfoRemarks']").focus(function () {
- $(this).addClass("inputActive");
- });
- $("input[name='outNum'],input[name='materialInfoRemarks']").blur(function () {
- $(this).removeClass("inputActive");
- });
- } else {
- $("#btu_span").hide();
- $("#btu_span2").hide();
- $(".jeecgDetail").hide();
- $("#sub_tr").addClass("hiddenBox");
- $("#TBMaterialStockOnHandListUpdate").find(":input").attr("disabled", "disabled");
- }
- });
- // 修改本次出货数量
- function changeoutNum(obj, trIndex) {
- var materialInfoNoNum = $("#stockOnHand" + trIndex).val();
- var $this = $(obj), value = obj.value;
- if (parseInt(value) >= 0) {
- if (materialInfoNoNum < parseInt(value)) {
- tip("本次出货数量不能大于现存量量,请重新输入!")
- if (!$this.hasClass("inputError")) {
- $this.addClass("inputError");
- }
- $this.val(0);
- } else {
- if ($this.hasClass("inputError")) {
- $this.removeClass("inputError");
- }
- $this.val(parseInt(value));
- }
- } else {
- tip("请输入正确的本次出货数量(整数类型)")
- $this.addClass("inputError");
- $this.val(0);
- }
- }
- //表单验证
- function beforeSubmit() {
- if (${viewFlag == 1}) {
- //出货时间
- var outTime = $('input[name=outTime]').val()
- if (outTime == null || outTime === "") {
- tip('请选择出库时间')
- return false
- }else{
- var $tbody = $("#tbMaterialDelivery");
- var submitStatus = true;
- $tbody.find('tr', this).each(function (i) {
- $(':input', this).each(function () {
- var $this = $(this), name = $this.attr('name'), id = $this.attr('id'), val = $this.val();
- if (name != null) {
- if (name.indexOf("receiverCarId") >= 0) {
- console.log(name,val);
- if(val == null || val === ""){
- submitStatus = false;
- tip('请选择领料车')
- }
- }
- if(name.indexOf("outNum") >= 0){
- if (val == null || val === "" || val == "0") {
- submitStatus = false;
- tip('请输入出货量')
- }
- }
- }
- });
- });
- return submitStatus
- }
- } else {
- tip('查看模式禁止提交')
- return false
- }
- }
- //打开弹窗选择领料车
- function openReceiverCarWindow(trIndex) {
- if (${viewFlag == 1}) {
- $.dialog({
- title: "选择领料车",
- content: "url:carController.do?nlist&viewFlag=1&materialDaptId=${materialDaptId}",
- zIndex: getzIndex(),
- lock: true, width: '80vw', height: '80vh',
- cache: false,
- button: [
- {
- name: '<t:mutiLang langKey="common.confirm"/>',
- callback: function () {
- var iframe = this.iframe.contentWindow;
- var selectRows = JSON.parse(iframe.getReason());
- var one = selectRows[0];
- changeReceiverCar(one, trIndex);
- },
- focus: true
- },
- {
- name: '<t:mutiLang langKey="common.cancel"/>',
- callback: function () {
- }
- }
- ]
- });
- } else {
- tip('查看模式禁止编辑')
- return false
- }
- }
- function changeReceiverCar(rowData, trIndex) {
- $('#receiverCarId' + trIndex).val(rowData.strId)
- $('#receiverCarName' + trIndex).val(rowData.strPlate)
- }
- function btn_ok() {
- $("#update_btnsub").click();
- }
- var checkIndex = []
- function clickCheck(index) {
- if (checkIndex.indexOf(index) >= 0) {
- // 已经存在的话,删除
- checkIndex.splice(checkIndex.indexOf(index));
- $("#checkbox" + index).removeClass("fa-check-square");
- $("#checkbox" + index).addClass("fa-square-o");
- } else {
- // 不存在的话就新增
- checkIndex.push(index);
- $("#checkbox" + index).removeClass("fa-square-o");
- $("#checkbox" + index).addClass("fa-check-square");
- }
- }
- function getUuid() {
- var s = []
- var hexDigits = '0123456789abcdef'
- for (var i = 0; i < 36; i++) {
- s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1)
- }
- s[14] = '4' // bits 12-15 of the time_hi_and_version field to 0010
- s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1) // bits 6-7 of the clock_seq_hi_and_reserved to 01
- s[8] = s[13] = s[18] = s[23] = '-'
- var uuid = s.join('')
- return uuid
- }
- //删除按钮
- function deleteByIndex() {
- if (checkIndex.length > 0) {
- checkIndex.forEach(item => {
- $("#trTag" + item).remove();
- })
- } else {
- tip("请先选中要删除的货品!")
- }
- resetTrNum()
- }
- function resetTrNum() {
- var $tbody = $("#tbMaterialDelivery");
- $tbody.find('tr', this).each(function (i) {
- var $trItemDom = $(this);
- var trIndex = $trItemDom.attr("id");
- if (trIndex != undefined && trIndex.indexOf("#index#") != -1) {
- $trItemDom.attr("id", trIndex.replace('#index#', i));
- }
- $(':input, select, i', this).each(function () {
- var $this = $(this), name = $this.attr('name'), id = $this.attr('id'), val = $this.val();
- if (id != null) {
- if (id.indexOf("#index#") >= 0) {
- $this.attr("id", id.replace('#index#', i));
- if (id.indexOf("checkbox") != -1) {
- $this.attr("onclick", "clickCheck(" + i + ")");
- } else if (id.indexOf("receiverCarName") != -1) {
- $this.attr("onclick", "openReceiverCarWindow(" + i + ")");
- } else if (id.indexOf("receiverCarNameBtu") != -1) {
- $this.attr("onclick", "openReceiverCarWindow(" + i + ")");
- } else if (id.indexOf("goodsName") != -1) {
- $this.attr("onclick", "openMaterialWindow(" + i + ")");
- } else if (id.indexOf("outNum") != -1) {
- $this.attr("onchange", "changeoutNum(this," + i + ")");
- }
- }
- }
- if (name != null) {
- if (name.indexOf("#index#") >= 0) {
- $this.attr("name", name.replace('#index#', i));
- if (name.indexOf("materialInfoGoodsname") != -1) {
- $this.attr("onclick", "showgoods(" + i + ")");
- }
- }
- }
- });
- $(this).find('input[name=\'xh\']').val(i);
- });
- }
- function goodsIdIsNotEmpty(goodsId) {
- var status = true;
- var $tbody = $("#tbMaterialDelivery");
- $tbody.find('tr', this).each(function (i) {
- $(':input', this).each(function () {
- var $this = $(this), id = $this.attr('id'), val = $this.val();
- if (id != null) {
- if (id.indexOf("goodsId") != -1 && val === goodsId) {
- tip('物料已存在,请选择别的现存物料!')
- status = false;
- return status;
- }
- }
- })
- })
- return status;
- }
- //添加按钮
- function addTr() {
- var trStr = `<tr id="trTag#index#">
- <input id="infoId#index#" name="infoId" type="hidden" value=""/>
- <input id="goodsId#index#" name="goodsId" type="hidden" value=""/>
- <c:if test="${viewFlag == 1}">
- <td class="displayFlex">
- <i class="fa fa-square-o checkbox" id="checkbox#index#" style="font-size: 16px;" onclick="clickCheck()"></i>
- </td>
- </c:if>
- <td>
- <input type="text" class="inputxt" readonly style="width:100%;" name="xh"
- value=""/>
- </td>
- <td>
- <input id="goodsName#index#" name="goodsName" readonly type="text" class="inputxt" style="width:100%;cursor: pointer;" placeholder="点击选择现存货品" onclick="openMaterialWindow()"
- value=""/>
- </td>
- <td>
- <t:dictSelect field="baseUnit" type="list"
- id="baseUnit#index#"
- typeGroupCode="metering_calcu_unit"
- defaultVal="" hasLabel="false"
- readonly="readonly"
- datatype="*" title="计量单位"></t:dictSelect>
- </td>
- <td>
- <input id="stockOnHand#index#" name="stockOnHand" type="text" readonly class="inputxt" style="width:100%;"
- value="0"/>
- </td>
- <td>
- <input id="outNum#index#" name="outNum" type="text" class="${viewFlag == 2 ? 'inputxt' : 'readInput'}"
- style="width:100%;"
- onchange="changeoutNum(this)"
- value=""/>
- </td>
- <td>
- <div class="td_boxs">
- <input id="receiverCarId#index#" name="receiverCarId" type="hidden" readonly
- class="${viewFlag == 2 ? 'inputxt' : 'readInput'}"
- value=""/>
- <input id="receiverCarName#index#" name="receiverCarName" type="text" class="${viewFlag == 2 ? 'inputxt' : 'readInput'}"
- style="width:calc(100% - 100px);"
- readonly openReceiverCarWindow()
- value=""/><span id="receiverCarNameBtu#index#"
- class="openReceiverCarBtu ${viewFlag == 2 ? 'openReceiverCarBtu-S' : 'openReceiverCarBtu-T'}"><i class="fa fa-send-o" style="padding-right:5px" openReceiverCarWindow()></i>选择领料车</span>
- </div>
- </td>
- <td>
- <input name="materialInfoRemarks" type="text" class="${viewFlag == 2 ? 'inputxt' : 'readInput'}"
- style="width:100%;"
- value=""/>
- </td>
- </tr>`;
- $("#tbMaterialDelivery").append(trStr);
- resetTrNum();
- }
- function openMaterialWindow(trIndex) {
- $.dialog({
- title: "录入:选择现存物料",
- content: "url:tBMaterialController.do?goAddDelivery&viewFlag=1",
- zIndex: getzIndex(),
- lock: true, width: '60vw', height: '60vh',
- cache: false,
- button: [
- {
- name: '<t:mutiLang langKey="common.confirm"/>',
- callback: function () {
- var iframe = this.iframe.contentWindow;
- var selectRows = JSON.parse(iframe.getSelectRowsOnAdd());
- var one = selectRows[0];
- //首先判断选中的货品是否已经存在于form表单
- var status = goodsIdIsNotEmpty(one.goodsId);
- //将选中的货品信息写入到form表单
- if(status){
- //货品id
- $("#goodsId" + trIndex).val(one.goodsId);
- //货品名称
- $("#goodsName" + trIndex).val(one.goodsName);
- //货品基本单位
- $("#baseUnit" + trIndex).val(one.baseUnit);
- //货品现存量
- $("#stockOnHand" + trIndex).val(one.stockOnHand);
- }
- },
- focus: true
- },
- {
- name: '<t:mutiLang langKey="common.cancel"/>',
- callback: function () {
- }
- }
- ]
- });
- }
- </script>
- </head>
- <body style="overflow-x: hidden;">
- <t:formvalid formid="TBMaterialStockOnHandListUpdate" dialog="true" usePlugin="password" layout="false" tiptype="1"
- action="tBMaterialController.do?doUpdateDelivery" beforeSubmit="beforeSubmit">
- <div style="display:none"><input type="submit" id="update_btnsub" value=""/></div>
- <span id="btu_span" type="button" class="btu_element btu_success_def" style="cursor: pointer;" onclick="addTr()"><i
- class="fa fa-plus"></i>添加</span><span id="btu_span2" type="button" class="btu_element btu_danger"
- style="cursor: pointer;margin-left: 15px;"
- onclick="deleteByIndex()"><i
- class="fa fa-trash-o"></i>删除</span>
- <table id="tbMaterialDelivery" cellpadding="0" cellspacing="1" class="formtable" style="width: calc(100vw - 10px);">
- <tr>
- <c:if test="${viewFlag == 1}">
- <th>选择</th>
- </c:if>
- <th>序号</th>
- <th>货品名称</th>
- <th>计量单位</th>
- <th>现存量</th>
- <th>出货数量</th>
- <th>领料车号</th>
- <th>备注</th>
- </tr>
- <c:if test="${TBMaterialStockOnHandList != null && TBMaterialStockOnHandList.size() > 0}">
- <c:forEach items="${TBMaterialStockOnHandList}" var="item" varStatus="itemStatus">
- <tr id="trTag${itemStatus.index}">
- <input id="infoId${itemStatus.index}" name="infoId" type="hidden"
- value="${item.id != null ? item.id : ''}"/>
- <input id="goodsId${itemStatus.index}" name="goodsId" type="hidden" value="${item.goodsId}"/>
- <c:if test="${viewFlag == 1}">
- <td class="displayFlex">
- <i class="fa fa-square-o checkbox" id="checkbox${itemStatus.index}" style="font-size: 16px;"
- onclick="clickCheck(${itemStatus.index})"></i>
- </td>
- </c:if>
- <td>
- <input type="text" class="inputxt" readonly style="width:100%;" name="xh"
- value="${itemStatus.index + 1 }"/>
- </td>
- <td>
- <input name="goodsName" readonly type="text" class="inputxt" style="width:100%;cursor: pointer;"
- placeholder="点击选择现存货品" onclick="openMaterialWindow(${itemStatus.index})"
- value="${item.goodsName}"/>
- </td>
- <td>
- <t:dictSelect field="baseUnit" type="list"
- id="baseUnit${itemStatus.index}"
- typeGroupCode="metering_calcu_unit"
- defaultVal="${item.baseUnit != null ? item.baseUnit : ''}" hasLabel="false"
- datatype="*" title="计量单位"></t:dictSelect>
- </td>
- <td>
- <input id="stockOnHand${itemStatus.index}" name="stockOnHand" type="text" readonly
- class="inputxt" style="width:100%;"
- value="${item.stockOnHand != null ? item.stockOnHand : '0' }"/>
- </td>
- <td>
- <input id="outNum${itemStatus.index}" name="outNum" type="text"
- class="${viewFlag == 2 ? 'inputxt' : 'readInput'}"
- style="width:100%;"
- onchange="changeoutNum(this,${itemStatus.index})"
- value="${item.outNum != null ? item.outNum : '0' }"/>
- </td>
- <td>
- <div class="td_boxs">
- <input id="receiverCarId${itemStatus.index}" name="receiverCarId" type="hidden" readonly
- class="${viewFlag == 2 ? 'inputxt' : 'readInput'}"
- value="${item.receiverCarId != null ? item.receiverCarId : '' }"/>
- <input id="receiverCarName${itemStatus.index}" name="receiverCarName" type="text"
- class="${viewFlag == 2 ? 'inputxt' : 'readInput'}"
- style="width:calc(100% - 100px);"
- readonly onclick="openReceiverCarWindow(${itemStatus.index})"
- value="${item.receiverCarName != null ? item.receiverCarName : '' }"/><span
- class="openReceiverCarBtu ${viewFlag == 2 ? 'openReceiverCarBtu-S' : 'openReceiverCarBtu-T'}"
- onclick="openReceiverCarWindow(${itemStatus.index})"><i class="fa fa-send-o"
- style="padding-right:5px"></i>选择领料车</span>
- </div>
- </td>
- <td>
- <input name="materialInfoRemarks" type="text" class="${viewFlag == 2 ? 'inputxt' : 'readInput'}"
- style="width:100%;"
- value="${item.materialInfoRemarks != null ? item.materialInfoRemarks : '' }"/>
- </td>
- </tr>
- </c:forEach>
- </c:if>
- </table>
- <div class="updateInfoBox tab-wrapper-main">
- <%--出货详情id--%>
- <input name="id" type="hidden" readonly value="${id}">
- <%--入库时间--%>
- <input name="putTime" readonly type="hidden" value="${putTime}">
- <%--请购科室id--%>
- <input name="materialDaptId" readonly type="hidden" value="${materialDaptId}">
- <div class="updateInfo">
- <div style="width: 50%;">仓库:<span style="color: #909399;font-weight: bold;"><input
- name="materialWarehouseId" type="hidden" readonly value="${materialWarehouseId}" class="inputxt"
- style="width:200px"/>${materialWarehouseName}
- </div>
- <div style="width: 50%;">
- <span style="color: #F56C6C;" class="requiredIcon">*</span>出库时间:
- <input id="outTime" name="outTime" type="text" class="form-control"
- style="width: 200px;cursor: pointer;"
- placeholder="点击选择时间" autocomplete="off" value="${empty outTime ? '' : outTime.substring(0,10)}"
- onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" ignore="ignore">
- <span class="Validform_checktip" style="float:left;height:0px;"></span>
- </div>
- </div>
- <div style="display: flex;padding-top: 10px;"><div>备注:</div><textarea name="remake" type="text" cols="100"
- rows="10">${remake != null ? remake : ''}</textarea></div>
- </div>
- </t:formvalid>
- </body>
|