jbb 2 年之前
父節點
當前提交
50dd9bd46e

+ 67 - 3
src/views/oa/SyCottonYarnList.vue

@@ -66,7 +66,7 @@
         @change="handleTableChange">
 
         <span slot="action" slot-scope="text, record">
-          <a @click="handleEdit(record)">编辑</a>
+          <a @click="handleEdit(record,'0')">编辑</a>
 
           <a-divider type="vertical" />
           <a-dropdown>
@@ -76,6 +76,7 @@
                 <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                   <a>删除</a>
                 </a-popconfirm>
+                 <a @click="handleEdit(record,'1')">详情</a>
               </a-menu-item>
             </a-menu>
           </a-dropdown>
@@ -86,7 +87,8 @@
     <!-- table区域-end -->
 
     <!-- 表单区域 -->
-    <syCottonYarn-modal ref="modalForm" @ok="modalFormOk"/>
+    <syCottonYarn-modal ref="modalForm" @ok="modalFormOk"  @close="getList"/>
+    <sy-cotton-yarn-detail-modal ref="syCottonYarnDetailModal"></sy-cotton-yarn-detail-modal>
 
   </a-card>
 </template>
@@ -95,12 +97,17 @@
 
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   import SyCottonYarnModal from './modules/SyCottonYarnModal'
+   import SyCottonYarnDetailModal from './modules/SyCottonYarnDetailModal'
+    import { getAction } from '@/api/manage'
+  import moment from 'moment'
 
   export default {
     name: "SyCottonYarnList",
     mixins: [JeecgListMixin],
     components: {
-      SyCottonYarnModal
+      SyCottonYarnModal,
+      SyCottonYarnDetailModal,
+      moment
     },
     data () {
       return {
@@ -146,6 +153,7 @@
               deleteBatch: "/oa/syCottonYarn/deleteBatch",
               exportXlsUrl: "oa/syCottonYarn/exportXls",
               importExcelUrl: "oa/syCottonYarn/importExcel",
+              editListUrl: '/oa/syCottonYarn/querySyCottonYarnBByMainId'
            },
         }
       },
@@ -157,6 +165,62 @@
 
 
     methods: {
+       getList(){
+        getAction(this.url.list, this.queryParam).then((res) => {
+          if(res.success){
+            this.dataSource=res.result.records
+          }else{
+            this.$message.warning(res.message)
+          }
+        })
+      },
+      searchQuery(){
+        this.getList()
+      },
+      searchReset(){
+       this.queryParam={}
+       this.getList()
+      },
+      async handleEdit(record,data){
+        var zhuId = ''
+        await getAction('/oa/syCottonYarn/queryById', {id:record.id}).then((res) => {
+          if(res.success){
+             if(data == '0'){
+               this.$refs.modalForm.formState=res.result //编辑
+             }else{
+               this.$refs.syCottonYarnDetailModal.formState=res.result //详情
+             }
+            zhuId = res.result.id
+          }else{
+            this.$message.warning(res.message)
+          }
+        })
+        getAction(this.url.editListUrl, {id:zhuId}).then((res) => {
+          if(res.success){
+            if(data == '0'){
+              this.$refs.modalForm.visible = true
+              this.$refs.modalForm.defultMethods = 'edit'
+              res.result.map(item =>{
+              if(item.orderDate !==''&& item.orderDate){
+                item.orderDate = moment(item.orderDate)
+              }
+            })
+            this.$refs.modalForm.syCottonYarnBTable.dataSource = res.result
+          }else{
+            this.$refs.syCottonYarnDetailModal.visible = true
+              res.result.map(item =>{
+              if(item.orderDate !==''&& item.orderDate){
+                item.orderDate = moment(item.orderDate)
+              }
+            })
+            this.$refs.syCottonYarnDetailModal.syCottonYarnBTable.dataSource = res.result
+          }
+          }else{
+            this.$message.warning(res.message)
+          }
+        })
+      },
+
 
       initDictConfig() {
       }

+ 223 - 0
src/views/oa/modules/SyCottonYarnDetailModal.vue

@@ -0,0 +1,223 @@
+<template>
+<div class="reply" ref = "replyModal">
+  <a-modal
+    title="详情"
+    width="85%"
+    :visible="visible"
+    :maskClosable="false"
+    :confirmLoading="confirmLoading"
+    :getContainer ='()=>$refs.replyModal'
+    @ok="handleOk"
+    @cancel="handleCancel">
+    <template slot="footer">
+      <a-button @click="handleCancel">关闭</a-button>
+    </template>
+     <div class="table-page-search-wrapper">
+      <!-- 主表单区域 -->
+       <a-form-model layout="inline" ref="form" :model="formState" :rules="validatorRules">
+          <a-row :gutter="24">
+            <a-col :md="8" :sm="8">
+              <a-form-model-item label="编号" prop="code">
+                <a-input   placeholder="请输入"  v-model="formState.code" readOnly/>
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="8" :sm="8">
+              <a-form-model-item label="名称"  prop="userId">
+                <a-input placeholder="请输入名称" v-model="formState.name" readOnly/>
+              </a-form-model-item>
+           </a-col>
+            <a-col :md="8" :sm="8">
+              <a-form-model-item label="合计"  prop="code">
+                 <a-input placeholder="请输入" v-model="formState.totalNum" readOnly/>
+               </a-form-model-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter="24">
+              <a-col :md="24" :sm="8"> 
+               <a-form-model-item label="备注信息"  class="nresume" style="height:100px !important">
+                 <a-input type="textarea" placeholder="请输入" v-model="formState.demo" readOnly/>
+               </a-form-model-item>
+              </a-col>
+            </a-row>
+      </a-form-model>
+
+      <!-- 子表单区域 -->
+      <a-tabs v-model="activeKey" @change="handleChangeTabs">
+        <a-tab-pane tab="棉纱" :key="refKeys[0]" :forceRender="true">
+          <a-table
+           bordered
+           :columns="syCottonYarnBTable.columns"
+           :data-source="syCottonYarnBTable.dataSource"
+           :loading="syCottonYarnBTable.loading"
+           :scroll="{x: 1800,y:300 }"
+           :pagination="false"
+          >
+         <!-- 操作 -->
+          <span slot="option" slot-scope="text, record, index">
+            <a-popconfirm title="确定放弃新增?" @confirm="handelAutograph(record)" okText="确定" cancelText="取消" >
+              <a href="">签名</a>
+           </a-popconfirm>
+          </span>
+          </a-table>
+          <!-- <j-editable-table
+            :ref="refKeys[0]"
+            :loading="syCottonYarnBTable.loading"
+            :columns="syCottonYarnBTable.columns"
+            :dataSource="syCottonYarnBTable.dataSource"
+            :maxHeight="300"
+            :rowNumber="true"
+            :rowSelection="true"
+            :actionButton="true"/> -->
+        </a-tab-pane>
+      </a-tabs>
+
+     </div>
+  </a-modal>
+</div>
+</template>
+
+<script>
+
+  import moment from 'moment'
+  import pick from 'lodash.pick'
+  import { FormTypes } from '@/utils/JEditableTableUtil'
+  import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
+  import { putAction,postAction } from '@/api/manage'
+
+  export default {
+    name: 'SyCottonYarnDetailModal',
+    mixins: [JEditableTableMixin],
+    data() {
+      return {
+        // 新增时子表默认添加几行空数据
+        addDefaultRowNum: 1,
+        validatorRules: {
+        },
+        refKeys: ['syCottonYarnB', ],
+        activeKey: 'syCottonYarnB',
+        formState:{},
+        // 搬运装卸费用-棉纱-子表
+        syCottonYarnBTable: {
+          loading: false,
+          dataSource: [],
+          columns: [
+            {
+            title: '日期',
+            align: "center",
+            dataIndex: 'orderDate',
+            width: '9%',
+            // scopedSlots: { customRender: 'orderDate' },
+          },
+          {
+            title: '入库单号',
+            align: "center",
+            dataIndex: 'receiptNo',
+            width: '9%',
+            // scopedSlots: { customRender: 'receiptNo' },
+          },
+          {
+            title: '吨数',
+            align: "center",
+            dataIndex: 'tonnage',
+            width: '9%',
+            // scopedSlots: { customRender: 'tonnage' },
+          },
+          {
+            title: '柜子数量',
+            align: "center",
+            dataIndex: 'cabinets',
+            width: '9%',
+            // scopedSlots: { customRender: 'cabinets' },
+          },
+          {
+            title: '每吨纱价格',
+            align: "center",
+            dataIndex: 'price',
+            width: '9%',
+            // scopedSlots: { customRender: 'price' },
+          },
+           {
+            title: '集装箱号',
+            align: "center",
+            dataIndex: 'containerNo',
+            width: '9%',
+            // scopedSlots: { customRender: 'containerNo' },
+          },
+          {
+            title: '原因',
+            align: "center",
+            dataIndex: 'reason',
+            width: '9%',
+            // scopedSlots: { customRender: 'reason' },
+          },
+          {
+            title: '总价',
+            align: "center",
+            dataIndex: 'totalPrice',
+            width: '9%',
+            // scopedSlots: { customRender: 'totalPrice' },
+          },
+          {
+            title: '签字',
+            align: "center",
+            dataIndex: 'jhyName',
+            width: '9%',
+            // scopedSlots: { customRender: 'jhyName' },
+          },
+          {
+            title: '备注',
+            align: "center",
+            dataIndex: 'demo',
+            width: '9%',
+            // scopedSlots: { customRender: 'demo' },
+          },
+           {
+            title: '操作',
+            dataIndex: 'option',
+             width: '9%',
+             ellipsis: true,
+             scopedSlots: { customRender: 'option' },
+             className: 'replacecolor'
+           }   
+          ]
+        },
+        url: {
+          add: "/oa/syCottonYarn/add",
+          edit: "/oa/syCottonYarn/edit",
+          syCottonYarnB: {
+            list: '/oa/syCottonYarn/querySyCottonYarnBByMainId'
+          },
+        }
+      }
+    },
+    methods: {
+      handelAutograph(record){
+          record.jhyName = this.$store.getters.nickname
+        
+      },
+        //关闭
+      handleCancel(){
+        this.syCottonYarnBTable.dataSource=[]
+        this.formState = {}
+        this.visible = false
+      },
+    }
+  }
+</script>
+
+<style scoped lang="less">
+/deep/ .nresume .ant-input{
+  height: 100px !important;
+}
+/deep/ .td{
+  text-align:center;
+}
+/deep/ .ant-table-thead > tr > th {
+  text-align: center;
+  // font-weight: 700;
+}
+/deep/ .ant-table-tbody {
+  text-align: center;
+}
+
+</style>

+ 24 - 10
src/views/oa/modules/SyCottonYarnModal.vue

@@ -1,7 +1,7 @@
 <template>
 <div class="reply" ref = "replyModal">
   <a-modal
-    :title="title"
+    :title="(defultMethods == 'add')?'新增':'编辑'"
     width="85%"
     :visible="visible"
     :maskClosable="false"
@@ -41,7 +41,7 @@
       <!-- 子表单区域 -->
       <a-tabs v-model="activeKey" @change="handleChangeTabs">
         <a-tab-pane tab="棉纱" :key="refKeys[0]" :forceRender="true">
-          <a-button type="primary"  @click="addList">增行</a-button>
+          <a-button type="primary"  @click="addList" style="margin-bottom: 1%;">增行</a-button>
           <a-table
            bordered
            :columns="syCottonYarnBTable.columns"
@@ -83,7 +83,7 @@
           </span>
           <!-- 总价 -->
           <span slot="totalPrice" slot-scope="text, record, index">
-                  <a-input placeholder="请输入" v-model="record.totalPrice" />
+                  <a-input placeholder="请输入" v-model="record.totalPrice" @change="changeTotalPrice"/>
           </span>
           <!-- 备注 -->
           <span slot="demo" slot-scope="text, record, index">
@@ -218,6 +218,15 @@
       addList(){
         this.syCottonYarnBTable.dataSource.push({})
       },
+      //总价改变
+      changeTotalPrice(){
+        var Hj = 0
+       this.syCottonYarnBTable.dataSource.map(item=>{
+         Hj+= Number(item.totalPrice)
+       })
+       this.formState.totalNum = Hj
+       this.$forceUpdate()
+      },
  
       /** 调用完edit()方法之后会自动调用此方法 */
       // editAfter() {
@@ -255,15 +264,13 @@
              item.orderDate = moment(item.orderDate).format('YYYY-MM-DD HH:mm:ss');
           }
         })
-        obj.syCottonYarnBTable = this.syCottonYarnBTable.dataSource
+        obj.syCottonYarnBList = this.syCottonYarnBTable.dataSource
         if(this.defultMethods == 'add'){
          postAction(this.url.add, obj).then(res => {
-           debugger
                     if (res.success) {
-                      debugger
                       this.$message.success('新增成功')
-                      // this.handleCancel()
-                      // this.$emit('close')
+                      this.handleCancel()
+                      this.$emit('close')
                     }else{
                        this.$message.error(res.message);
                     }
@@ -272,14 +279,21 @@
           putAction(this.url.edit, obj).then((res) => {
           if(res.success){
             this.$message.success('编辑成功')
-            // this.handleCancel()
-            // this.$emit('close')
+            this.handleCancel()
+            this.$emit('close')
           }else{
             this.$message.warning(res.message)
           }
         })
         }
         
+      },
+        //关闭
+      handleCancel(){
+        this.syCottonYarnBTable.dataSource=[]
+        this.formState = {}
+        this.visible = false
+        this.defultMethods='add'
       },
     }
   }