Răsfoiți Sursa

优化资产单据页面新增流程展示步骤

LinWuTai 1 an în urmă
părinte
comite
3ded531661

+ 6 - 1
ruoyi-admin/src/main/java/com/ruoyi/order/controller/TbOrderController.java

@@ -191,7 +191,12 @@ public class TbOrderController extends BaseController
         }
         tbOrder.setCorporation(deptId);
 
-        return toAjax(tbOrderService.insertTbOrder(tbOrder));
+        int flag = tbOrderService.insertTbOrder(tbOrder);
+        if (flag > 0) {
+            return success(tbOrder);
+        }
+
+        return error();
     }
 
     /**

+ 36 - 23
ruoyi-admin/src/main/java/com/ruoyi/order/domain/TbOrder.java

@@ -1,6 +1,7 @@
 package com.ruoyi.order.domain;
 
 import java.util.Date;
+import java.util.List;
 
 import cn.hutool.core.util.StrUtil;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -105,6 +106,9 @@ public class TbOrder extends BaseEntity
     @Excel(name = "记录状态")
     private Long recordStatus;
 
+    /** 单据详细列表 */
+    private List<TbOrderDetail> orderDetails;
+
     /** 获取资产调整单据 */
     public static void adjustmentOrder(TbOrder tbOrder) {
         if (tbOrder.getAdjustmentAssetNumber() == null || StrUtil.isBlank(tbOrder.getAdjustmentAssetNumber())) {
@@ -343,30 +347,39 @@ public class TbOrder extends BaseEntity
         return recordStatus;
     }
 
+    public List<TbOrderDetail> getOrderDetails() {
+        return orderDetails;
+    }
+
+    public void setOrderDetails(List<TbOrderDetail> orderDetails) {
+        this.orderDetails = orderDetails;
+    }
+
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("orderNumber", getOrderNumber())
-            .append("orderType", getOrderType())
-            .append("applicationDate", getApplicationDate())
-            .append("applicationDepartment", getApplicationDepartment())
-            .append("adjustmentAssetNumber", getAdjustmentAssetNumber())
-            .append("adjustmentOriginalAssetInfo", getAdjustmentOriginalAssetInfo())
-            .append("allocationCallOutDepartment", getAllocationCallOutDepartment())
-            .append("allocationCallOutBy", getAllocationCallOutBy())
-            .append("allocationCallOutDate", getAllocationCallOutDate())
-            .append("allocationCallInDepartment", getAllocationCallInDepartment())
-            .append("allocationCallInBy", getAllocationCallInBy())
-            .append("allocationCallInDate", getAllocationCallInDate())
-            .append("lendDepartment", getLendDepartment())
-            .append("lendBySponsor", getLendBySponsor())
-            .append("lendPassingUnit", getLendPassingUnit())
-            .append("reason", getReason())
-            .append("preparedBy", getPreparedBy())
-            .append("preparedDepartment", getPreparedDepartment())
-            .append("corporation", getCorporation())
-            .append("recordStatus", getRecordStatus())
-            .toString();
+        return "TbOrder{" +
+                "id=" + id +
+                ", orderNumber='" + orderNumber + '\'' +
+                ", orderType=" + orderType +
+                ", applicationDate=" + applicationDate +
+                ", applicationDepartment='" + applicationDepartment + '\'' +
+                ", adjustmentAssetNumber='" + adjustmentAssetNumber + '\'' +
+                ", adjustmentOriginalAssetInfo='" + adjustmentOriginalAssetInfo + '\'' +
+                ", allocationCallOutDepartment='" + allocationCallOutDepartment + '\'' +
+                ", allocationCallOutBy='" + allocationCallOutBy + '\'' +
+                ", allocationCallOutDate=" + allocationCallOutDate +
+                ", allocationCallInDepartment='" + allocationCallInDepartment + '\'' +
+                ", allocationCallInBy='" + allocationCallInBy + '\'' +
+                ", allocationCallInDate=" + allocationCallInDate +
+                ", lendDepartment='" + lendDepartment + '\'' +
+                ", lendBySponsor='" + lendBySponsor + '\'' +
+                ", lendPassingUnit='" + lendPassingUnit + '\'' +
+                ", reason='" + reason + '\'' +
+                ", preparedBy='" + preparedBy + '\'' +
+                ", preparedDepartment='" + preparedDepartment + '\'' +
+                ", corporation='" + corporation + '\'' +
+                ", recordStatus=" + recordStatus +
+                ", orderDetails=" + orderDetails +
+                '}';
     }
 }

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/order/mapper/TbOrderDetailMapper.java

@@ -63,7 +63,7 @@ public interface TbOrderDetailMapper
      */
     public int deleteTbOrderDetailByIds(Long[] ids);
 
-    int deleteTbOrderDetailByOrderNumbers(List<String> orderNumbers);
+    int deleteTbOrderDetailByOrderNumbers(@Param("numbers") List<String> orderNumbers);
 
     /**
      * 获取单据详细信息

+ 2 - 1
ruoyi-admin/src/main/java/com/ruoyi/order/mapper/TbOrderMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.order.mapper;
 
 import java.util.List;
 import com.ruoyi.order.domain.TbOrder;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 /**
@@ -10,7 +11,7 @@ import org.apache.ibatis.annotations.Select;
  * @author 原动力
  * @date 2023-05-24
  */
-public interface TbOrderMapper 
+public interface TbOrderMapper
 {
     /**
      * 查询资产单据

+ 5 - 3
ruoyi-admin/src/main/java/com/ruoyi/order/service/impl/TbOrderServiceImpl.java

@@ -108,9 +108,11 @@ public class TbOrderServiceImpl implements ITbOrderService
     public int deleteTbOrderByIds(Long[] ids)
     {
         List<TbOrder> tbOrders = selectTbOrderByIds(ids);
-        ids = tbOrders.stream().filter(tbOrder -> tbOrder.getRecordStatus() < 0).map(TbOrder::getId).toArray(Long[]::new);
-        List<String> orderNumbers = tbOrders.stream().filter(tbOrder -> tbOrder.getRecordStatus() < 0).map(TbOrder::getOrderNumber).collect(Collectors.toList());
-        tbOrderDetailMapper.deleteTbOrderDetailByOrderNumbers(orderNumbers);
+        ids = tbOrders.stream().filter(tbOrder -> tbOrder.getRecordStatus() == 0).map(TbOrder::getId).toArray(Long[]::new);
+        List<String> orderNumbers = tbOrders.stream().filter(tbOrder -> tbOrder.getRecordStatus() == 0).map(TbOrder::getOrderNumber).collect(Collectors.toList());
+        if (!orderNumbers.isEmpty()) {
+            tbOrderDetailMapper.deleteTbOrderDetailByOrderNumbers(orderNumbers);
+        }
         return tbOrderMapper.deleteTbOrderByIds(ids);
     }
 

+ 1 - 1
ruoyi-admin/src/main/resources/banner.txt

@@ -20,5 +20,5 @@ Spring Boot Version: ${spring-boot.version}
 //      ========`-.____`-.___\_____/___.-`____.-'========         //
 //                           `=---='                              //
 //      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        //
-//             佛祖保佑       永不宕机      永无BUG               //
+//             佛祖保佑       永不宕机      永无BUG                   //
 ////////////////////////////////////////////////////////////////////

+ 1 - 1
ruoyi-admin/src/main/resources/mapper/order/TbOrderDetailMapper.xml

@@ -109,7 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <delete id="deleteTbOrderDetailByOrderNumbers" parameterType="String">
         delete from tb_order_detail where order_number in
-        <foreach item="number" collection="array" open="(" separator="," close=")">
+        <foreach item="number" collection="numbers" open="(" separator="," close=")">
             #{number}
         </foreach>
     </delete>

+ 1 - 1
ruoyi-admin/src/main/resources/mapper/order/TbOrderMapper.xml

@@ -154,7 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteTbOrderByIds" parameterType="String">
-        delete from tb_order where id in 
+        delete from tb_order where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>

+ 8 - 0
ruoyi-ui/src/api/asset/information.js

@@ -9,6 +9,14 @@ export function listInformation(query) {
   })
 }
 
+// 查询资产信息列表
+export function listInformation2() {
+  return request({
+    url: '/visitor/asset/list',
+    method: 'get'
+  })
+}
+
 // 查询资产信息详细
 export function getInformation(id) {
   return request({

+ 15 - 9
ruoyi-ui/src/views/index.vue

@@ -342,15 +342,21 @@ export default {
       this.openDetail = true
     },
     handleAudit(row, recordStatus) {
-      this.reset();
-      this.form.id = row.id;
-      this.form.orderNumber = row.orderNumber;
-      this.form.orderType = row.orderType;
-      this.form.recordStatus = recordStatus;
-      auditOrder(this.form).then((response) => {
-        this.$modal.msgSuccess("操作成功");
-        this.getList();
-      });
+      let title = `是否${recordStatus > 0 ? '通过审核' : '确认撤销'} ${row.orderNumber}单据?`
+      this.$modal
+        .confirm(title)
+        .then(() => {
+          this.reset();
+          this.form.id = row.id;
+          this.form.orderNumber = row.orderNumber;
+          this.form.orderType = row.orderType;
+          this.form.recordStatus = recordStatus;
+          auditOrder(this.form).then((response) => {
+            this.$modal.msgSuccess("操作成功");
+            this.getList();
+          });
+        })
+        .catch(() => {})
     },
   },
 };

+ 54 - 16
ruoyi-ui/src/views/order/detail/index.vue

@@ -7,16 +7,20 @@
       size="small"
       :inline="true"
       v-show="showSearch"
-      label-width="170px"
     >
-      <!-- <el-form-item label="单据编号" prop="orderNumber">
-        <el-input
-          v-model="queryParams.orderNumber"
-          placeholder="请输入单据编号"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item> -->
+      <el-row>
+        <el-col :span="24">
+          <el-form-item label="单据编号" prop="orderNumber">
+            <el-input
+              v-model="queryParams.orderNumber"
+              placeholder="请输入单据编号"
+              clearable
+              @keyup.enter.native="handleQuery"
+              disabled
+            />
+          </el-form-item>
+        </el-col>
+      </el-row>
       <el-form-item label="资产编号" prop="assetNumber">
         <template>
             <el-select
@@ -30,6 +34,8 @@
                 :label="item.name"
                 :value="item.number"
               >
+                <span style="float: left">{{ item.name }}</span>
+                <span style="float: right; color: #8492a6; font-size: 13px">{{ item.number }}</span>
               </el-option>
             </el-select>
           </template>
@@ -57,7 +63,7 @@
           clearable
           @keyup.enter.native="handleQuery"
         /> -->
-         <treeselect v-model="queryParams.allocationOldLocationNumber" :options="locationList" :normalizer="tenantIdnormalizer" placeholder="【调拨】旧功能位置" />
+        <treeselect v-model="queryParams.allocationOldLocationNumber" :options="locationList" :normalizer="tenantIdnormalizer" placeholder="【调拨】旧功能位置" />
       </el-form-item>
       <el-form-item
         v-if="orderInfo.orderType === 2"
@@ -318,6 +324,12 @@
       @pagination="getList"
     />
 
+    <div class="btns">
+      <el-button v-if="(orderInfo.orderType === 1 || orderInfo.existDetail || detailList.length > 0) && orderInfo.recordStatus === 0" type="warning" @click="submitFormByOrder(1)">提 交</el-button>
+      <el-button v-if="orderInfo.recordStatus === 0" type="primary" @click="submitFormByOrder(0)">保 存</el-button>
+      <el-button v-if="orderInfo.recordStatus === 0" @click="cancelByOrder">取 消</el-button>
+    </div>
+
     <!-- 添加或修改单据明细对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="170px">
@@ -342,6 +354,8 @@
                 :label="item.name"
                 :value="item.number"
               >
+                <span style="float: left">{{ item.name }}</span>
+                <span style="float: right; color: #8492a6; font-size: 13px">{{ item.number }}</span>
               </el-option>
             </el-select>
           </template>
@@ -469,8 +483,9 @@ import {
   addDetail,
   updateDetail,
 } from "@/api/order/detail";
+import { updateOrder } from '@/api/order/order'
 import { treeSelect } from "@/api/asset/location";
-import { listInformation } from "@/api/asset/information";
+import { listInformation2 } from "@/api/asset/information";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 export default {
@@ -559,7 +574,6 @@ export default {
     };
   },
   created() {
-    console.log("单据明细-单据信息:", this.orderInfo);
     this.getLocation();
     this.getList();
   },
@@ -567,8 +581,8 @@ export default {
     /** 查询单据明细列表 */
     getList() {
       this.loading = true;
-      listInformation().then((response) => {
-        this.informationList = response.rows;
+      listInformation2().then((response) => {
+        this.informationList = response.data;
       });
       listDetail(this.queryParams).then((response) => {
         this.detailList = response.rows;
@@ -591,14 +605,19 @@ export default {
     },
     getAssetName(val){
       let arr = this.informationList.filter(item => item.number===val);
-      console.log('arr', arr)
-       return arr[0].name
+      if (arr.length === 0) {
+        return ''
+      }
+      return arr[0].name
     },
     // 取消按钮
     cancel() {
       this.open = false;
       this.reset();
     },
+    cancelByOrder() {
+      this.$emit('cancelByOrder', 1)
+    },
     // 表单重置
     reset() {
       this.form = {
@@ -678,6 +697,19 @@ export default {
         }
       });
     },
+    /** 提交按钮 */
+    submitFormByOrder(recordStatus) {
+      let form = this.orderInfo
+      form.recordStatus = recordStatus
+      updateOrder(form).then((response) => {
+        if (recordStatus === 0) {
+          this.$modal.msgSuccess('保存成功')
+        } else {
+          this.$modal.msgSuccess('提交成功')
+        }
+        this.cancelByOrder()
+      })
+    },
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;
@@ -710,6 +742,12 @@ export default {
 /deep/ .vue-treeselect {
   display: inline-block;
 }
+
+.btns{
+  margin-top: 50px;
+  text-align: center;
+}
+
 .queryForm {
   /deep/ .vue-treeselect {
     width: 205px;

+ 132 - 76
ruoyi-ui/src/views/order/order/index.vue

@@ -18,7 +18,10 @@
       <el-form-item v-if="queryParams.orderType === '1'" label="【调整】资产编号" prop="adjustmentAssetNumber">
         <template>
           <el-select v-model="queryParams.adjustmentAssetNumber" filterable placeholder="请输入资产编号">
-            <el-option v-for="item in informationList" :key="item.number" :label="item.name" :value="item.number"> </el-option>
+            <el-option v-for="item in informationList" :key="item.number" :label="item.name" :value="item.number">
+              <span style="float: left">{{ item.name }}</span>
+              <span style="float: right; color: #8492a6; font-size: 13px">{{ item.number }}</span>
+            </el-option>
           </el-select>
         </template>
       </el-form-item>
@@ -175,67 +178,112 @@
     <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
 
     <!-- 添加或修改资产单据对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="140px">
-        <el-form-item label="单据编号" prop="orderNumber">
-          <el-input v-model="form.orderNumber" placeholder="单据编号(系统自动生成)" disabled />
-        </el-form-item>
-        <el-form-item label="单据类型" prop="orderType">
-          <el-select v-model="form.orderType" placeholder="请选择单据类型" @change="onFormTypeChange">
-            <el-option v-for="dict in dict.type.asset_order_type" :key="dict.value" :label="dict.label" :value="parseInt(dict.value)"></el-option>
-          </el-select>
-        </el-form-item>
+    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="150px">
+        <el-row :gutter="10">
+          <el-col :span="12">
+            <el-form-item label="单据编号" prop="orderNumber">
+              <el-input v-model="form.orderNumber" placeholder="单据编号(系统自动生成)" disabled />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="单据类型" prop="orderType">
+              <el-select v-model="form.orderType" placeholder="请选择单据类型" @change="onFormTypeChange">
+                <el-option v-for="dict in dict.type.asset_order_type" :key="dict.value" :label="dict.label" :value="parseInt(dict.value)"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="申请日期" prop="applicationDate">
+              <el-date-picker clearable v-model="form.applicationDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择申请日期"> </el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="申请部门" prop="applicationDepartment">
+              <treeselect v-model="form.applicationDepartment" :options="deptOptions" placeholder="请选择申请部门" @keyup.enter.native="handleQuery" />
+            </el-form-item>
+          </el-col>
+        </el-row>
         <!-- <el-form-item v-if="form.orderType !== 1" label="资产总原值" prop="assetTotalOriginalValue">
           <el-input v-model="form.assetTotalOriginalValue" placeholder="资产总原值(系统自动补充)" disabled/>
         </el-form-item>
         <el-form-item v-if="form.orderType !== 1" label="资产总净值" prop="assetTotalNetValue">
           <el-input v-model="form.assetTotalNetValue" placeholder="资产总净值(系统自动补充)" disabled/>
         </el-form-item> -->
-        <el-form-item label="申请日期" prop="applicationDate">
-          <el-date-picker clearable v-model="form.applicationDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择申请日期"> </el-date-picker>
-        </el-form-item>
-        <el-form-item label="申请部门" prop="applicationDepartment">
-          <treeselect v-model="form.applicationDepartment" :options="deptOptions" placeholder="请选择申请部门" @keyup.enter.native="handleQuery" />
-        </el-form-item>
         <el-form-item v-if="form.orderType === 1" label="【调整】资产编号" prop="adjustmentAssetNumber">
           <template>
             <el-select v-model="form.adjustmentAssetNumber" filterable placeholder="请输入资产编号">
-              <el-option v-for="item in informationList" :key="item.number" :label="item.name" :value="item.number"> </el-option>
+              <el-option v-for="item in informationList" :key="item.number" :label="item.name" :value="item.number">
+                <span style="float: left">{{ item.name }}</span>
+                <span style="float: right; color: #8492a6; font-size: 13px">{{ item.number }}</span>
+              </el-option>
             </el-select>
           </template>
         </el-form-item>
-        <el-form-item v-if="form.orderType === 1" label="【调整】资产原信息" prop="adjustmentOriginalAssetInfo">
+        <el-row :gutter="10">
+          <el-col :span="12">
+            <el-form-item v-if="form.orderType === 2" label="【调拨】调出部门" prop="allocationCallOutDepartment">
+              <treeselect v-model="form.allocationCallOutDepartment" :options="deptOptions" placeholder="请选择【调拨】调出部门" @keyup.enter.native="handleQuery" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item v-if="form.orderType === 2" label="【调拨】调出日期" prop="allocationCallOutDate">
+              <el-date-picker clearable v-model="form.allocationCallOutDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择【调拨】调出日期"> </el-date-picker>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="10">
+          <el-col :span="12">
+            <el-form-item v-if="form.orderType === 2" label="【调拨】调出经办人" prop="allocationCallOutBy">
+              <el-input v-model="form.allocationCallOutBy" placeholder="请输入【调拨】调出经办人" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <!-- <el-form-item v-if="form.orderType === 1" label="【调整】资产原信息" prop="adjustmentOriginalAssetInfo">
           <el-input v-model="form.adjustmentOriginalAssetInfo" type="textarea" placeholder="系统自动补充" disabled />
-        </el-form-item>
-        <el-form-item v-if="form.orderType === 2" label="【调拨】调出部门" prop="allocationCallOutDepartment">
-          <treeselect v-model="form.allocationCallOutDepartment" :options="deptOptions" placeholder="请选择【调拨】调出部门" @keyup.enter.native="handleQuery" />
-        </el-form-item>
-        <el-form-item v-if="form.orderType === 2" label="【调拨】调出经办人" prop="allocationCallOutBy">
-          <el-input v-model="form.allocationCallOutBy" placeholder="请输入【调拨】调出经办人" />
-        </el-form-item>
-        <el-form-item v-if="form.orderType === 2" label="【调拨】调出日期" prop="allocationCallOutDate">
-          <el-date-picker clearable v-model="form.allocationCallOutDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择【调拨】调出日期"> </el-date-picker>
-        </el-form-item>
-        <el-form-item v-if="form.orderType === 2" label="【调拨】调入部门" prop="allocationCallInDepartment">
-          <treeselect v-model="form.allocationCallInDepartment" :options="deptOptions" placeholder="请选择【调拨】调入部门" @keyup.enter.native="handleQuery" />
-        </el-form-item>
-        <el-form-item v-if="form.orderType === 2" label="【调拨】调入经办人" prop="allocationCallInBy">
-          <el-input v-model="form.allocationCallInBy" placeholder="请输入【调拨】调入经办人" />
-        </el-form-item>
-        <el-form-item v-if="form.orderType === 2" label="【调拨】调入日期" prop="allocationCallInDate">
-          <el-date-picker clearable v-model="form.allocationCallInDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择【调拨】调入日期"> </el-date-picker>
-        </el-form-item>
-        <el-form-item v-if="form.orderType === 3" label="【借出】借出部门" prop="lendDepartment">
-          <treeselect v-model="form.lendDepartment" :options="deptOptions" placeholder="请选择【借出】借出部门" @keyup.enter.native="handleQuery" />
-        </el-form-item>
-        <el-form-item v-if="form.orderType === 3" label="【借出】经手人" prop="lendBySponsor">
-          <el-input v-model="form.lendBySponsor" placeholder="请输入【借出】经手人" />
-        </el-form-item>
-        <el-form-item v-if="form.orderType === 3" label="【借出】往来单位" prop="lendPassingUnit">
-          <treeselect v-model="form.lendPassingUnit" :options="deptOptions" placeholder="请选择【调拨】调入部门" @keyup.enter.native="handleQuery" />
-        </el-form-item>
+        </el-form-item> -->
+        <el-row :gutter="10">
+          <el-col :span="12">
+            <el-form-item v-if="form.orderType === 2" label="【调拨】调入部门" prop="allocationCallInDepartment">
+              <treeselect v-model="form.allocationCallInDepartment" :options="deptOptions" placeholder="请选择【调拨】调入部门" @keyup.enter.native="handleQuery" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item v-if="form.orderType === 2" label="【调拨】调入日期" prop="allocationCallInDate">
+              <el-date-picker clearable v-model="form.allocationCallInDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择【调拨】调入日期"> </el-date-picker>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="10">
+          <el-col :span="12">
+            <el-form-item v-if="form.orderType === 2" label="【调拨】调入经办人" prop="allocationCallInBy">
+              <el-input v-model="form.allocationCallInBy" placeholder="请输入【调拨】调入经办人" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        
+        <el-row :gutter="10">
+          <el-col :span="12">
+            <el-form-item v-if="form.orderType === 3" label="【借出】借出部门" prop="lendDepartment">
+              <treeselect v-model="form.lendDepartment" :options="deptOptions" placeholder="请选择【借出】借出部门" @keyup.enter.native="handleQuery" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item v-if="form.orderType === 3" label="【借出】往来单位" prop="lendPassingUnit">
+              <treeselect v-model="form.lendPassingUnit" :options="deptOptions" placeholder="请选择【调拨】调入部门" @keyup.enter.native="handleQuery" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="10">
+          <el-col :span="12">
+            <el-form-item v-if="form.orderType === 3" label="【借出】经手人" prop="lendBySponsor">
+              <el-input v-model="form.lendBySponsor" placeholder="请输入【借出】经手人" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        
         <el-form-item label="原因说明" prop="reason">
-          <el-input v-model="form.reason" placeholder="请输入原因说明" />
+          <el-input type="textarea" v-model="form.reason" placeholder="请输入原因说明" />
         </el-form-item>
         <!-- <el-form-item label="制单人" prop="preparedBy">
           <el-input v-model="form.preparedBy" placeholder="系统自动补充" disabled />
@@ -273,7 +321,7 @@
     </el-dialog>
 
     <el-dialog title="单据详细信息" :visible.sync="openDetail" width="1300px" append-to-body>
-      <OrderDetail v-if="openDetail" :orderInfo="orderInfo" />
+      <OrderDetail v-if="openDetail" :orderInfo="orderInfo" @cancelByOrder="cancelByOrder"/>
     </el-dialog>
   </div>
 </template>
@@ -284,7 +332,7 @@ import { deptTreeSelect } from '@/api/system/user'
 import Treeselect from '@riophae/vue-treeselect'
 import '@riophae/vue-treeselect/dist/vue-treeselect.css'
 import { auditOrder } from '@/api/order/order'
-import { listInformation } from '@/api/asset/information'
+import { listInformation2 } from '@/api/asset/information'
 export default {
   name: 'Order',
   dicts: ['asset_order_type', 'asset_record_status'],
@@ -354,27 +402,20 @@ export default {
       form: {},
       // 表单校验
       rules: {
-        // orderNumber: [
-        //   { required: true, message: "单据编号不能为空", trigger: "blur" }
-        // ],
         orderType: [{ required: true, message: '单据类型不能为空', trigger: 'change' }],
-        // assetTotalOriginalValue: [
-        //   { required: true, message: "资产总原值不能为空", trigger: "blur" }
-        // ],
-        // assetTotalNetValue: [
-        //   { required: true, message: "资产总净值不能为空", trigger: "blur" }
-        // ],
-        // preparedBy: [
-        //   { required: true, message: "制单人不能为空", trigger: "blur" }
-        // ],
-        // preparedDepartment: [
-        //   { required: true, message: "制单部门不能为空", trigger: "blur" }
-        // ],
-        // corporation: [
-        //   { required: true, message: "所属公司不能为空", trigger: "blur" }
-        // ],
+        applicationDate: [{ required: true, message: '申请日期不能为空', trigger: 'change' }],
+        applicationDepartment: [{ required: true, message: '申请部门不能为空', trigger: 'change' }],
+        adjustmentAssetNumber: [{ required: true, message: '【调整】资产编号不能为空', trigger: 'change' }],
+        allocationCallOutDepartment: [{ required: true, message: '【调拨】调出部门不能为空', trigger: 'change' }],
+        allocationCallOutBy: [{ required: true, message: '【调拨】调出经办人不能为空', trigger: 'blur' }],
+        allocationCallOutDate: [{ required: true, message: '【调拨】调出日期不能为空', trigger: 'change' }],
+        allocationCallInDepartment: [{ required: true, message: '【调拨】调入部门不能为空', trigger: 'change' }],
+        allocationCallInBy: [{ required: true, message: '【调拨】调入经办人不能为空', trigger: 'blur' }],
+        allocationCallInDate: [{ required: true, message: '【调拨】调入日期不能为空', trigger: 'change' }],
+        lendDepartment: [{ required: true, message: '【借出】借出部门不能为空', trigger: 'change' }],
+        lendBySponsor: [{ required: true, message: '【借出】经手人不能为空', trigger: 'blur' }],
+        lendPassingUnit: [{ required: true, message: '【借出】往来单位不能为空', trigger: 'change' }],
         reason: [{ required: true, message: '原因说明不能为空', trigger: 'blur' }],
-        recordStatus: [{ required: true, message: '记录状态不能为空', trigger: 'change' }],
       },
     }
   },
@@ -383,12 +424,15 @@ export default {
     this.getDeptTree()
     this.getList()
   },
+  beforeDestroy() {
+    this.$off('cancelByOrder')
+  },
   methods: {
     /** 查询资产单据列表 */
     getList() {
       this.loading = true
-      listInformation().then((response) => {
-        this.informationList = response.rows
+      listInformation2().then((response) => {
+        this.informationList = response.data
       })
       listOrder(this.queryParams).then((response) => {
         this.orderList = response.rows
@@ -416,11 +460,9 @@ export default {
       const json = JSON.parse(row.adjustmentOriginalAssetInfo)
       this.adjustmentOriginalAssetInfo = json
       this.openAdjustment = true
-      console.log('资产原信息:', json)
     },
     onSelectopenDetail(order) {
       this.orderInfo = order
-      console.log('单据信息:', order)
       this.openDetail = true
     },
     onQueryTypeChange() {
@@ -575,16 +617,27 @@ export default {
           if (this.form.id != null) {
             this.form.recordStatus = recordStatus
             updateOrder(this.form).then((response) => {
-              this.$modal.msgSuccess('修改成功')
+              if (recordStatus === 0) {
+                this.$modal.msgSuccess('保存成功')
+              } else {
+                this.$modal.msgSuccess('提交成功')
+              } 
               this.open = false
               this.getList()
             })
           } else {
             this.form.recordStatus = recordStatus
-            addOrder(this.form).then((response) => {
-              this.$modal.msgSuccess('新增成功')
+            addOrder(this.form).then((response) => {            
               this.open = false
               this.getList()
+              if (response.data.orderType !== 1) {
+                this.onSelectopenDetail(response.data)
+                if (recordStatus === 0) {
+                  this.$modal.msgSuccess('保存成功')
+                } else {
+                  this.$modal.msgSuccess('提交成功')
+                }  
+              }
             })
           }
         }
@@ -614,6 +667,9 @@ export default {
         `order_${new Date().getTime()}.xlsx`
       )
     },
+    cancelByOrder(value) {
+      this.openDetail = false
+    }
   },
 }
 </script>