From 418a2d2f1271f2fa05a8560ac497203f0be1d64e Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期五, 10 二月 2023 14:25:38 +0800
Subject: [PATCH] 1.采购订单接口接入

---
 src/views/cggl/cgdd.vue |  387 ++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 313 insertions(+), 74 deletions(-)

diff --git a/src/views/cggl/cgdd.vue b/src/views/cggl/cgdd.vue
index 5e68959..fd42e9d 100644
--- a/src/views/cggl/cgdd.vue
+++ b/src/views/cggl/cgdd.vue
@@ -41,36 +41,53 @@
               <el-input v-model="form.mesordercode" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
             <el-form-item label="閲囪喘渚涙柟" style=" display:flex;">
-              <el-input v-model="form.OrgName" placeholder="璇疯緭鍏�" style="width: 200px" />
+              <el-select
+                v-model="form.customercode"
+                :popper-append-to-body="false"
+                filterable
+                style="width: 200px"
+                placeholder="璇烽�夋嫨"
+              >
+                <el-option
+                  v-for="item in customercodeArr"
+                  :key="item.code"
+                  :label="item.name"
+                  :value="item.code"
+                />
+              </el-select>
+
             </el-form-item>
             <el-form-item label="鍗曟嵁鏃ユ湡" style="display: flex;">
-              <!--              <el-select v-model="form.orderdate" style="width: 200px" placeholder="璇烽�夋嫨">-->
-              <!--                <el-date-picker-->
-              <!--                  v-model="form.orderdate"-->
-              <!--                  style="width: 200px"-->
-              <!--                  type="date"-->
-              <!--                  placeholder="閫夋嫨鏃ユ湡"-->
-              <!--                />-->
-              <!--              </el-select>-->
               <el-date-picker
                 v-model="form.orderdate"
-                style="width: 200px"
-                type="date"
-                placeholder="閫夋嫨鏃ユ湡"
+                type="daterange"
+                :clearable="false"
+                class="timeMini"
+                range-separator="~"
+                start-placeholder="寮�濮嬫棩鏈�"
+                style="width: 200px;display: flex;line-height: 34px ;height: 34px ;"
+                end-placeholder="缁撴潫鏃ユ湡"
+                size="mini"
               />
             </el-form-item>
             <el-form-item v-show="isExpandForm" label="婧愬崟鍗曞彿" style="display: flex;">
               <el-input v-model="form.sourceorder" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
             <el-form-item v-show="isExpandForm" label="閮ㄩ棬淇℃伅" style="display: flex;">
-              <el-cascader
-                ref="cascader"
+              <el-select
+                v-model="form.deptcode"
+                :popper-append-to-body="false"
                 filterable
-                popper-class="elCascader"
-                :options="deptcodeArr"
-                :props="defaultProps"
-                @change="cascaderChange"
-              />
+                style="width: 200px"
+                placeholder="璇烽�夋嫨"
+              >
+                <el-option
+                  v-for="item in deptcodeArr"
+                  :key="item.code"
+                  :label="item.name"
+                  :value="item.code"
+                />
+              </el-select>
             </el-form-item>
             <el-form-item v-show="isExpandForm" label="鍒涘缓浜哄憳" style="display: flex;">
               <el-input v-model="form.creatuser" placeholder="璇疯緭鍏�" style="width: 200px" />
@@ -78,13 +95,21 @@
             <el-form-item v-show="isExpandForm" label="鍒涘缓鏃堕棿" style="display: flex;">
               <el-date-picker
                 v-model="form.createdate"
-                style="width: 200px"
-                type="date"
-                placeholder="閫夋嫨鏃ユ湡"
+                type="daterange"
+                :clearable="false"
+                class="timeMini"
+                range-separator="~"
+                start-placeholder="寮�濮嬫棩鏈�"
+                style="width: 200px;display: flex;line-height: 34px ;height: 34px ;"
+                end-placeholder="缁撴潫鏃ユ湡"
+                size="mini"
               />
             </el-form-item>
           </div>
-          <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}">
+          <div
+            class="bodySearchReset"
+            :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
+          >
             <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button>
             <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>
           </div>
@@ -113,15 +138,28 @@
           ref="tableDataRef"
           class="tableFixed"
           :data="tableData"
-          :height="isExpandForm?tableHeight:(tableHeight+40)+'px'"
+          :height="isExpandForm?(tableHeight+40):(tableHeight+80)+'px'"
           border
           :row-class-name="tableRowClassName"
-          :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}"
+          :style="{width: 100+'%',height:isExpandForm?(tableHeight+40):(tableHeight+80)+'px'}"
           highlight-current-row
           :header-cell-style="this.$headerCellStyle"
           :cell-style="this.$cellStyle"
           @sort-change="sortChange"
+          @row-click="rowClick"
         >
+          <el-table-column
+            width="50"
+            fixed
+          >
+            <template slot-scope="{row}">
+              <el-radio
+                v-model="radioSelected"
+                :label="row.ordercode"
+                style="color: transparent;padding-left: 10px;"
+              />
+            </template>
+          </el-table-column>
           <el-table-column
             prop="RowNum"
             width="50"
@@ -158,21 +196,36 @@
             width="130"
             show-tooltip-when-overflow
             sortable="custom"
-          />
+          >
+            <template slot-scope="{row}">
+              <div v-if="row.deptname">{{ row.deptname }}</div>
+              <div v-else>/</div>
+            </template>
+          </el-table-column>
           <el-table-column
             prop="customername"
-            label="寰�鏉ュ崟浣�"
+            label="閲囪喘渚涙柟"
             sortable="custom"
             min-width="180"
             show-tooltip-when-overflow
-          />
+          >
+            <template slot-scope="{row}">
+              <div v-if="row.customername">{{ row.customername }}</div>
+              <div v-else>/</div>
+            </template>
+          </el-table-column>
           <el-table-column
             prop="saleorderCode"
             label="婧愬崟鍗曞彿"
             sortable="custom"
             width="160"
             show-tooltip-when-overflow
-          />
+          >
+            <template slot-scope="{row}">
+              <div v-if="row.saleorderCode">{{ row.saleorderCode }}</div>
+              <div v-else>/</div>
+            </template>
+          </el-table-column>
           <el-table-column
             prop="acceptdate"
             label="棰勮鍒拌揣鏃ユ湡"
@@ -230,8 +283,13 @@
           >
             <template slot-scope="{row}">
               <div class="operationClass">
-                <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">
-                  <i class="el-icon-edit-outline" @click="edit('edit',row)" />
+                <el-tooltip class="item" effect="dark" content="鍏冲崟" placement="top">
+                  <i
+                    class="el-icon-switch-button"
+                    :style="{color:$store.state.settings.theme}"
+                    style="margin-right: 15px;cursor: pointer"
+                    @click="switchButton(row)"
+                  />
                 </el-tooltip>
                 <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
                   <i class="el-icon-delete" @click="del(row)" />
@@ -251,6 +309,130 @@
         popper-class="select_bottom"
         @pagination="getPurchaseOrderSearch"
       />
+
+      <div class="elTableDiv">
+        <el-table
+          :data="tableDataDetail"
+          border
+          height="210px"
+          :row-class-name="tableRowClassName"
+          highlight-current-row
+          :header-cell-style="this.$headerCellStyle"
+          :cell-style="this.$cellStyle"
+        >
+          <el-table-column
+            width="50"
+            type="index"
+            label="搴忓彿"
+            fixed
+          />
+          <el-table-column
+            prop="partcode"
+            label="浜у搧缂栫爜"
+            width="160"
+            show-tooltip-when-overflow
+          />
+          <el-table-column
+            prop="partname"
+            label="浜у搧鍚嶇О"
+            width="200"
+            show-tooltip-when-overflow
+          />
+
+          <el-table-column
+            label="浜у搧瑙勬牸"
+            prop="partspec"
+            show-tooltip-when-overflow
+            width="150"
+          >
+            <template slot-scope="{row}">
+              <div v-if="row.partspec">{{ row.partspec }}</div>
+              <div v-else>/</div>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="鍗曚綅"
+            show-tooltip-when-overflow
+            prop="uomname"
+            width="100"
+          />
+          <el-table-column
+            label="鏁伴噺"
+            show-tooltip-when-overflow
+            prop="quantity"
+          />
+          <el-table-column
+            label="绱Н鍒拌揣鏁伴噺"
+            show-tooltip-when-overflow
+            prop="countarrivalquantity"
+          />
+          <el-table-column
+            label="绱鍏ュ簱鏁伴噺"
+            show-tooltip-when-overflow
+            prop="countInquantity"
+          >
+            <template slot-scope="{row}">
+              <div v-if="row.countInquantity">{{ row.countInquantity }}</div>
+              <div v-else>/</div>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="棰勮鍒拌揣鏃ユ湡"
+            show-tooltip-when-overflow
+            prop="acceptdate"
+          >
+            <template slot-scope="{row}">
+              <div v-if="row.acceptdate">{{ row.acceptdate.substring(0, 11) }}</div>
+              <div v-else>/</div>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="浠撳簱"
+            show-tooltip-when-overflow
+            prop="housename"
+          >
+            <template slot-scope="{row}">
+              <div v-if="row.housename">{{ row.housename }}</div>
+              <div v-else>/</div>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="鏄惁妫�楠�"
+            show-tooltip-when-overflow
+            prop="is_incheck"
+          >
+            <template slot-scope="{row}">
+              <div v-if="row.is_incheck==='Y'">
+                <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />
+                鏄�
+              </div>
+              <div v-if="row.is_incheck==='N'">
+                <i class="el-icon-info" style="margin-right: 2px" />
+                鍚�
+              </div>
+            </template>
+          </el-table-column>
+          <!--          <el-table-column-->
+          <!--            label="鎿嶄綔"-->
+          <!--            width="120"-->
+          <!--            fixed="right"-->
+          <!--          >-->
+          <!--            <template slot-scope="{row}">-->
+          <!--              <div class="operationClass">-->
+          <!--                <el-tooltip class="item" effect="dark" content="鎵撳嵃宸ュ簭" placement="top">-->
+          <!--                  <i-->
+          <!--                    class="el-icon-printer"-->
+          <!--                    :style="{color:$store.state.settings.theme}"-->
+          <!--                    style="cursor: pointer;margin-right: 15px"-->
+          <!--                    @click="supplementSmallClick(row)"-->
+          <!--                  />-->
+          <!--                </el-tooltip>-->
+          <!--              </div>-->
+          <!--            </template>-->
+          <!--          </el-table-column>-->
+        </el-table>
+      </div>
+
     </div>
 
   </div>
@@ -258,17 +440,11 @@
 
 <script>
 import Pagination from '@/components/Pagination'
-import {
-  AddUpdateOrganization,
-  DeleteOrganization,
-  OrganizationSearch,
-  PrentOrganization,
-  UserOrganization
-} from '@/api/jcsz'
-import clearAllChildren, { validateCode } from '@/utils/global'
+import { handleDatetime } from '@/utils/global'
 import waves from '@/directive/waves'
-import { SeaveSearchErpOrder, SeaveSearchErpPurchaseOrder } from '@/api/ErpSyncMes'
-import { PurchaseOrderSearch } from '@/api/cggl'
+import { SeaveSearchErpPurchaseOrder } from '@/api/ErpSyncMes'
+import { ClosedPurchaseOrder, DeletePurchaseOrder, PurchaseOrderSearch, PurchaseOrderSubSearch } from '@/api/cggl'
+import { DepartMentSelect, PurchSupplierSelect } from '@/api/jbzl'
 
 export default {
   name: 'Zzjg',
@@ -306,31 +482,76 @@
       ],
       total: 10,
       tableData: [],
-      defaultProps: {
-        checkStrictly: true,
-        value: 'code',
-        label: 'name',
-        children: 'children'
-      },
-      deptcodeArr: [] // 閮ㄩ棬淇℃伅
+      radioSelected: '',
+      deptcodeArr: [], // 閮ㄩ棬淇℃伅鏁扮粍
+      customercodeArr: [], // 閲囪喘渚涙柟鏁扮粍
+      tableDataDetail: []
 
     }
   },
 
   created() {
-    this.getPurchaseOrderSearch()
-    this.getUserOrganization()
+    this.handleRequest()
   },
   mounted() {
     window.addEventListener('resize', this.getHeight)
     this.getHeight()
   },
   methods: {
+    handleRequest() {
+      this.getPurchaseOrderSearch().then(res => {
+        if (res.code === '200') {
+          this.getDepartMentSelect()
+          this.getPurchSupplierSelect()
+        }
+      })
+    },
+
     async getPurchaseOrderSearch() {
-      const res = await PurchaseOrderSearch(this.form)
+      let tempDate2 = this.form.orderdate
+      if (tempDate2.length > 0) {
+        tempDate2 = handleDatetime(tempDate2[0]) + '~' + handleDatetime(tempDate2[1])
+      }
+
+      let tempDate = this.form.createdate
+      if (tempDate.length > 0) {
+        tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])
+      }
+
+      const data = {
+        mesorderstus: this.form.mesorderstus,
+        mesordercode: this.form.mesordercode,
+        customercode: this.form.customercode,
+        orderdate: tempDate2,
+        sourceorder: this.form.sourceorder,
+        deptcode: this.form.deptcode,
+        creatuser: this.form.creatuser,
+        createdate: tempDate,
+
+        prop: this.form.prop, // 鎺掑簭瀛楁
+        order: this.form.order, // 鎺掑簭瀛楁
+        page: this.form.page, // 绗嚑椤�
+        rows: this.form.rows // 姣忛〉澶氬皯鏉�
+      }
+
+      const res = await PurchaseOrderSearch(data)
       this.tableData = res.data
       this.total = res.count
+
+      return { code: res.code }
     },
+    // 鑾峰彇閮ㄩ棬淇℃伅
+    async getDepartMentSelect() {
+      const { data: res } = await DepartMentSelect()
+      // this.deptcodeArr = clearAllChildren(res)
+      this.deptcodeArr = res
+    },
+    // 閲囪喘渚涙柟淇℃伅鏌ヨ
+    async   getPurchSupplierSelect() {
+      const { data: res } = await PurchSupplierSelect()
+      this.customercodeArr = res
+    },
+
     // 鎺掑簭鏀瑰彉鏃�
     sortChange({ column, prop, order }) {
       if (order === 'descending') {
@@ -358,19 +579,16 @@
       this.form.deptcode = ''
       this.form.creatuser = ''
       this.form.createdate = ''
-      this.$refs.cascader.checkedValue = ''// 绾ц仈閫夋嫨鍣ㄧ殑娓呯┖
       this.getPurchaseOrderSearch()
     },
-    // 鑾峰彇閮ㄩ棬淇℃伅
-    async getUserOrganization() {
-      const { data: res } = await UserOrganization()
-      this.deptcodeArr = clearAllChildren(res)
 
-      console.log(this.deptcodeArr, 888)
-    },
-    // 绾ц仈閫夋嫨鍣ㄦ敼鍙樹簨浠�
-    cascaderChange(val) {
-      this.form.deptcode = val[val.length - 1]
+    async switchButton(row) {
+      ClosedPurchaseOrder({ po: row.ordercode }).then(res => {
+        if (res.code === '200') {
+          this.$message.success('鍏冲崟鎴愬姛锛�')
+          this.getPurchaseOrderSearch()
+        }
+      })
     },
     // 鍒犻櫎鎸夐挳
     async del(row) {
@@ -379,7 +597,7 @@
         cancelButtonText: '鍙栨秷',
         type: 'warning'
       }).then(() => {
-        DeleteOrganization({ orgid: row.code }).then(res => {
+        DeletePurchaseOrder({ po: row.ordercode }).then(res => {
           if (res.code === '200') {
             this.$message.success('鍒犻櫎鎴愬姛!')
             if (this.form.page > 1 && this.tableData.length === 1) {
@@ -419,11 +637,24 @@
         // }
       })
     },
+    //  琛岀偣鍑讳簨浠�
+    async rowClick(row, event, column) {
+      this.radioSelected = row.ordercode
+
+      const { data: res } = await PurchaseOrderSubSearch({ purodercode: this.radioSelected })
+
+      this.tableDataDetail = res
+    },
     // 鑾峰彇椤甸潰楂樺害
     getHeight() {
       this.$nextTick(() => {
         this.mainHeight = window.innerHeight - 85
-        this.tableHeight = this.mainHeight - 255
+        // this.tableHeight = this.mainHeight - 250
+        this.tableHeight = this.mainHeight - 515
+        if (window.innerHeight < 769) {
+          this.tableHeight = this.tableHeight - 20
+        }
+        this.isIpad = window.innerHeight < 769 && window.innerWidth < 1367
         this.$refs.tableDataRef.doLayout()
       })
     },
@@ -437,15 +668,22 @@
 <!--鍏叡椤甸潰鏍峰紡-->
 <style lang="scss" scoped>
 $main_color: #42b983;
-::v-deep .el-button--text{
-  font-size: 14px ;
-  cursor: pointer ;
+
+::v-deep .el-radio__label {
+  display: none !important;
 }
-.el-icon-share ,.el-icon-delete,.el-icon-edit-outline{
+
+::v-deep .el-button--text {
+  font-size: 14px;
+  cursor: pointer;
+}
+
+.el-icon-share, .el-icon-delete, .el-icon-edit-outline {
   color: $main_color;
   cursor: pointer;
 }
-.el-icon-edit-outline{
+
+.el-icon-edit-outline {
   margin-right: 15px;
 }
 
@@ -506,8 +744,8 @@
   background-color: #f8f8fa;
 }
 
-::v-deep .el-table__body .el-table__row.hover-row td{
-  background-color: #eaecef ;
+::v-deep .el-table__body .el-table__row.hover-row td {
+  background-color: #eaecef;
 }
 
 ::v-deep .el-form--inline .el-form-item__label {
@@ -528,17 +766,18 @@
   margin-bottom: 0;
 }
 
-::v-deep .el-select__caret{
+::v-deep .el-select__caret {
   display: flex;
   align-items: center;
   justify-content: center;
 }
 
-.tableFixed{
-  ::v-deep .el-table__fixed-right{
+.tableFixed {
+  ::v-deep .el-table__fixed-right {
     height: 100% !important;
   }
-  ::v-deep .el-table__fixed{
+
+  ::v-deep .el-table__fixed {
     height: 100% !important;
   }
 }

--
Gitblit v1.9.3