_ProductionOrderEx.cshtml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. @using ShwasherSys
  2. @using ShwasherSys.Models.Modal
  3. <!-- 千件重编辑模态框 -->
  4. <div class="modal fade" id="kgWeightModal" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" >
  5. <div class="modal-dialog modal-dialog-centered" role="document">
  6. <div class="modal-content" style="min-width: 850px;">
  7. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("修改千件重", ""))
  8. @{
  9. var inputsKg = new List<InputViewModel>
  10. {
  11. new InputViewModel("kgWight", displayName:"千件重",@class:"number",other:"min=0.001"),
  12. new InputViewModel("kg_productionOrderId", hide:true,name:"id")
  13. };
  14. }
  15. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputsKg))
  16. @Html.Partial("Modals/_SwModalFooter", new ModelFooterModel("kgWeightModal", "saveKgWeight()"))
  17. </div>
  18. </div>
  19. </div>
  20. @using (Html.BeginScripts())
  21. {
  22. <style>
  23. .kg-weight-editable {
  24. color: #007bff;
  25. cursor: pointer;
  26. text-decoration: underline;
  27. }
  28. .kg-weight-editable:hover {
  29. color: #0056b3;
  30. }
  31. </style>
  32. <script type="text/javascript">
  33. $(function() {
  34. //todo
  35. });
  36. function f_modifyKgWeight(id, oldVal) {
  37. $('#kg_productionOrderId').val(id);
  38. $('#kgWight').val(oldVal);
  39. $('#kgWeightModal').modal('show');
  40. }
  41. function saveKgWeight() {
  42. var id = $('#kg_productionOrderId').val();
  43. var kgWeight = $('#kgWight').val();
  44. if (!kgWeight || kgWeight <= 0) {
  45. abp.message.error('请输入有效的千件重值');
  46. return;
  47. }
  48. var data = {
  49. id: parseInt(id),
  50. kgWeight: parseFloat(kgWeight)
  51. };
  52. SaveAjax({
  53. url: window.appUrl + 'ProductionOrders/UpdateKgWeight',
  54. data,
  55. isAlert: false,
  56. isValidate: false,
  57. success: function (res) {
  58. if (res || res.length > 0) {
  59. RefreshTable();
  60. $('#kgWeightModal').modal('hide');
  61. } else {
  62. abp.message.error(result.error || '更新失败');
  63. }
  64. }
  65. });
  66. }
  67. // 千件重格式化器
  68. function KgWeightFormatter(value, row) {
  69. if (!value && value !== 0) {
  70. return '-';
  71. }
  72. // 检查是否可编辑(排产单状态小于等于2:排产中、已审核)
  73. var noEdit = row.productionOrderStatus > 2 && row.productionOrderStatus !=7;
  74. if (!noEdit) {
  75. return `<span class="table-action" onclick="f_modifyKgWeight(${row.id},${value})">${value}</span>`
  76. } else {
  77. return value;
  78. }
  79. }
  80. </script>
  81. }