瀏覽代碼

更新发送NC判断

002390 2 年之前
父節點
當前提交
8e95e367c9

+ 10 - 0
src/api/business/purchase/purchase-order.js

@@ -89,6 +89,15 @@ const close = (data) => {
   });
 }
 
+// 采购订单发送NC
+const toNc = (data) => {
+  return request({
+    url: `/pu/order/toNc`,
+    method: "post",
+    data,
+  });
+}
+
 export default {
   list,
   details,
@@ -100,5 +109,6 @@ export default {
   getPrice,
   documentsReturn,
   close,
+  toNc,
 
 }

+ 1 - 1
src/views/purchase/purchase-order/add/column.js

@@ -153,7 +153,7 @@ export const Columns = [
     key: "status",
     title: "单据状态",
     inputType: "Select",
-    referName: "sys_status", // 字典名
+    referName: "documents_status", // 字典名
     disabled: true,
     isShow:true,
   },

+ 93 - 37
src/views/purchase/purchase-order/index.vue

@@ -136,7 +136,6 @@ export default {
     },
     // 获取子表信息
     async handleDetailsData(row) {
-      console.log(row, '获取详情信息');
       try {
         const { code, msg, data } = await orderApi.details(row.id);
         if (code === 200) {
@@ -262,15 +261,16 @@ export default {
       console.log(this.checkedList, 'this.checkedList');
 
     },
-
-
-
   },
 };
 </script>
 
 <template>
-  <el-card v-loading="loading" style="width: calc(100% - 24px); height: 100%; margin: 10px" :body-style="{ padding: 0 }">
+  <el-card 
+    v-loading="loading" 
+    style="width: calc(100% - 24px); height: 100%; margin: 10px" 
+    :body-style="{ padding: 0 }"
+  >
     <SeeDrawer ref="seeDrawerFef"></SeeDrawer>
     <AddDrawer ref="addDrawerFef" @close="handleRefreshList"></AddDrawer>
     <EditDrawer ref="editDrawerFef" @close="handleRefreshList"></EditDrawer>
@@ -285,7 +285,11 @@ export default {
       <el-row :gutter="24" style="display:flex; flex-wrap: wrap;">
         <el-col :span="20">
           <el-row :gutter="20">
-            <el-col v-for="column in showSearchColumns" :key="column.title" :xl="6" :lg="6" :md="8" :sm="12" :xs="24">
+            <el-col 
+              v-for="column in showSearchColumns" 
+              :key="column.title" 
+              :xl="6" :lg="6" :md="8" :sm="12" :xs="24"
+            >
               <el-form-item :prop="column.key" :label="column.title">
                 <el-input v-model="params[column.key]" :placeholder="column.placeholder"></el-input>
               </el-form-item>
@@ -300,10 +304,10 @@ export default {
       </el-row>
     </el-form>
 
-    <el-divider>
+    <!-- <el-divider>
       <i :class="isSimpleSearch ? 'el-icon-arrow-down' : 'el-icon-arrow-up'" style="cursor: pointer"
         @click="handleSearchChange"></i>
-    </el-divider>
+    </el-divider> -->
 
     <!-- 操作 -->
     <el-row :gutter="24" style="padding: 0 20px">
@@ -333,20 +337,40 @@ export default {
       </el-col>
     </el-row>
 
-    <el-table @row-dblclick="handleOpenSeeDrawer" @row-click="handleDetailsData" :data="tableData" size="mini"
-      highlight-current-row style="width: 100%; margin: 20px 0 0 0" @select="handleSelect" height="450">
+    <el-table 
+      @row-dblclick="handleOpenSeeDrawer" 
+      @row-click="handleDetailsData" 
+      :data="tableData" 
+      size="mini"
+      highlight-current-row
+      @select="handleSelect"
+      height="450"
+      style="width: 100%; margin: 20px 0 0 0"
+    >
       <el-table-column type="selection" width="45"></el-table-column>
       <el-table-column type="index" width="50" label="序号"></el-table-column>
-      <el-table-column v-for="(column, index) in tableColumns" :key="index" :prop="column.key" :label="column.title"
-        :width="column.width || 180" :show-overflow-tooltip="column.showOverflowTooltip || true">
+      <el-table-column 
+        v-for="(column, index) in tableColumns" 
+        :key="index" 
+        :prop="column.key" 
+        :label="column.title"
+        :width="column.width || 180" 
+        :show-overflow-tooltip="column.showOverflowTooltip || true"
+      >
 
         <template slot-scope="scope">
-          <dict-tag v-if="column.referName" size="small" :value="scope.row[column.key]"
-            :options="dict.type[column.referName]" />
-
-          <el-checkbox v-else-if="column.inputType === 'Checkbox'" v-model="scope.row[column.key]" disabled true-label="Y"
-            false-label="N">
-          </el-checkbox>
+          <dict-tag v-if="column.referName" 
+            size="small" 
+            :value="scope.row[column.key]"
+            :options="dict.type[column.referName]"
+           />
+
+          <el-checkbox v-else-if="column.inputType === 'Checkbox'"
+            v-model="scope.row[column.key]" 
+            disabled 
+            true-label="Y"
+            false-label="N"
+          > </el-checkbox>
           <span v-else>{{ scope.row[column.key] }}</span>
         </template>
       </el-table-column>
@@ -356,35 +380,67 @@ export default {
           <el-button type="text" size="small" @click.stop="handleOpenEditDrawer(scope.row)"
             v-hasPermi="['material:order:edit']">
             {{ scope.row.status == '2' ? '修订' : '编辑' }}</el-button>
-          <!-- 0=自由态,1=审批中,2=已审核,3=已驳回 -->
-          <el-button type="text" size="small" @click.stop="handleDeleteList(scope.row)"
-            v-hasPermi="['material:order:remove']">删除</el-button>
-          <el-button v-if="scope.row.status == '0' || scope.row.status == '3'" type="text" size="mini"
-            v-hasPermi="['material:order:toOa']" @click.stop="handleSubmit(scope.row)">提交</el-button>
+          <!-- 0=自由态,1=审批中,2=已审核,3=已驳回 4=提交中-->
+          <el-button 
+            v-if="(scope.row.status == '0' || scope.row.status == '3') && scope.row.source == '3'" 
+            type="text" 
+            size="small" 
+            @click.stop="handleDeleteList(scope.row)"
+            v-hasPermi="['material:order:remove']"
+          >删除</el-button>
+          <el-button 
+            v-if="scope.row.status == '0' || scope.row.status == '3'" 
+            type="text" 
+            size="mini"
+            v-hasPermi="['material:order:toOa']" 
+            @click.stop="handleSubmit(scope.row)"
+          >提交</el-button>
         </template>
       </el-table-column>
 
     </el-table>
-    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :total="page.total"
-      :page-sizes="pageSizes" :page-size="page.pageSize" :current-page="page.pageNum" hide-on-single-page :layout="layout"
-      style="text-align: right;margin-top: 10px;">
-    </el-pagination>
+    <el-pagination 
+      @size-change="handleSizeChange" 
+      @current-change="handleCurrentChange" 
+      :total="page.total"
+      :page-sizes="pageSizes" 
+      :page-size="page.pageSize" 
+      :current-page="page.pageNum" 
+      hide-on-single-page 
+      :layout="layout"
+      style="text-align: right;margin-top: 10px;"
+    ></el-pagination>
 
     <el-tabs v-model="tabName" @tab-click="handleTabClick" style="width: 100%;padding: 20px 10px">
-      <el-tab-pane v-for="(column, index) in tabColumns" :key="index" :label="column.title" :name="column.key">
-
+      <el-tab-pane 
+        v-for="(column, index) in tabColumns" 
+        :key="index" 
+        :label="column.title" 
+        :name="column.key"
+      >
         <el-table :data="tabTableDatas[column.key]" style="width: 100%" highlight-current-row
           :height="tabTableDatas[column.key].length ? 300 : 100">
           <el-table-column type="index" width="50" label="序号"></el-table-column>
-          <el-table-column v-for="(cColumn, cIndex)  in column.tableColumns" :key="cIndex" :prop="cColumn.key"
-            :label="cColumn.title" :width="cColumn.width || 180"
-            :show-overflow-tooltip="cColumn.showOverflowTooltip || true">
+          <el-table-column 
+            v-for="(cColumn, cIndex)  in column.tableColumns" 
+            :key="cIndex" 
+            :prop="cColumn.key"
+            :label="cColumn.title" 
+            :width="cColumn.width || 180"
+            :show-overflow-tooltip="cColumn.showOverflowTooltip || true"
+          >
             <template slot-scope="scope">
-              <dict-tag v-if="cColumn.referName" size="small" :value="scope.row[cColumn.key]"
-                :options="dict.type[cColumn.referName]" />
-              <el-checkbox v-else-if="cColumn.inputType === 'Checkbox'" v-model="scope.row[cColumn.key]" disabled
-                true-label="Y" false-label="N">
-              </el-checkbox>
+              <dict-tag v-if="cColumn.referName" 
+                size="small" 
+                :value="scope.row[cColumn.key]"
+                :options="dict.type[cColumn.referName]"
+               />
+              <el-checkbox v-else-if="cColumn.inputType === 'Checkbox'" 
+                v-model="scope.row[cColumn.key]"
+                disabled
+                true-label="Y" 
+                false-label="N"
+              ></el-checkbox>
               <span v-else>{{ scope.row[cColumn.key] }}</span>
             </template>
           </el-table-column>

+ 55 - 0
src/views/purchase/purchase-order/see/index.vue

@@ -68,6 +68,45 @@ export default {
       this.setVisible(false);
       this.params = initParams(Columns);
     },
+    // 发送NC
+    async handleSendNC(){
+      console.log('发送NC');
+
+      try {
+        let {code,deliveryMsg} = await orderApi.toNc({
+          puOrderId:this.params.id
+        });
+
+        if(code == 200){
+
+        }
+      } catch (error) {
+        
+      }finally{
+
+      }
+    },
+    // 判断是否能发送NC
+    judgeIsToNC(){
+
+      let {source,status,deliveryStatus} = this.params;
+
+      console.log('deliveryStatus' in  this.params,'deliveryStatus');
+      // 自制 & 状态为:自由态、驳回
+      if(source === '3' &&(status === '0' || status === '3')){
+
+        // 发送NC之后展示 SUCCESS("0","成功"),SEND_IN("1","发送中"),FAILURE("2","失败");
+        //    未发送                发送过但未成功
+        if(!deliveryStatus || (deliveryStatus && deliveryStatus !== '0')){
+
+          return true;
+        }
+
+        return false;
+      }
+
+      return false;
+    },
     beforeOpen() { },
   },
   created() { },
@@ -95,6 +134,22 @@ export default {
           <h3>查看</h3>
           <div style="text-align: right">
             <el-button size="mini" @click="handleCancel">取 消</el-button>
+            <el-tooltip
+              v-if="judgeIsToNC()"
+              class="box-item"
+              effect="dark"
+              :content="params.deliveryMsg"
+              placement="bottom-end"
+            >
+              <el-button 
+                :key="params.deliveryStatus"
+                size="mini" 
+                type="primary"
+                @click="handleSendNC"
+              >{{  params.deliveryStatus === '1' ? '发送中' :
+                  (params.deliveryStatus === '2'? '重新发送' : '发送NC')
+               }}</el-button>
+            </el-tooltip>
           </div>
         </div>
         <el-row style="display:flex; flex-wrap: wrap;">