Bläddra i källkod

Merge branch 'purchaseDev' into 'dev'

Purchase dev

See merge request new-business/drp-web!71
黄梓星 2 år sedan
förälder
incheckning
e5e1e85b10

+ 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 - 11
src/utils/init/index.js

@@ -33,14 +33,4 @@ export const initRules = (prop) => {
   return rules;
 };
 
-const pageSizes = [25, 50, 100];
-
-const layout = "total, prev, pager, next, sizes, jumper";
-
-const page = { pageNum: 1, pageSize: 25, total: 0 };
-
-export const initPageSizes = () => pageSizes;
-
-export const initLayout = () => layout;
-
-export const initPage = () => ({ pageNum: 1, pageSize: 25, total: 0 });
+export const initPage = () => ({ pageNum: 1, pageSize: 10, total: 0 });

+ 11 - 10
src/views/material/requisition/add.vue

@@ -158,8 +158,11 @@
                 </el-form-item>
               </el-col>
               <el-col :span="8">
-                <el-form-item label="税类编码" prop="rateCode">
-                  <el-input :disabled="disable" v-model="basicForm.rateCode"></el-input>
+                <el-form-item label="运输条件" prop="transportationCondition">
+                  <el-select v-model="basicForm.transportationCondition" placeholder="请选择" clearable :disabled="disable">
+                    <el-option v-for="item in dict.type.sys_conditions_carriage" :key="item.value" :label="item.label"
+                      :value="item.value" />
+                  </el-select>
                 </el-form-item>
               </el-col>
               <el-col :span="8">
@@ -233,14 +236,6 @@
                 </el-form-item>
               </el-col>
               <el-col :span="8">
-                <el-form-item label="运输条件" prop="transportationCondition">
-                  <el-select v-model="basicForm.transportationCondition" placeholder="请选择" clearable :disabled="disable">
-                    <el-option v-for="item in dict.type.sys_conditions_carriage" :key="item.value" :label="item.label"
-                      :value="item.value" />
-                  </el-select>
-                </el-form-item>
-              </el-col>
-              <el-col :span="8">
                 <el-form-item label="物料税类" prop="materialRate">
                   <el-select ref="taxs" v-model="basicForm.materialRate" placeholder="请选择" clearable :disabled="disable"
                     @focus="chooseTax">
@@ -248,6 +243,11 @@
                   </el-select>
                 </el-form-item>
               </el-col>
+              <el-col :span="8">
+                <el-form-item label="税类编码" prop="rateCode">
+                  <el-input disabled v-model="basicForm.rateCode"></el-input>
+                </el-form-item>
+              </el-col>
             </el-row>
             <el-row :gutter="20">
               <el-col :span="8">
@@ -1396,6 +1396,7 @@ export default {
     acceptTax(selections) {
       this.taxOptions = selections
       this.basicForm.materialRate = selections[0].id
+      this.basicForm.rateCode = selections[0].code
       this.getTaxDetails(selections[0].id)
     },
     // 物料税类显示列表

+ 7 - 1
src/views/purchase/PurchaseDemandList/add.vue

@@ -387,7 +387,7 @@
           <el-table-column label="补单供应商编码" align="center"  prop="additionalSupplier" width="200px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-input clearable :disabled="sonDisable || BDZT" size="small" v-model="scope.row.additionalSupplier" @focus="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')">
+                <el-input clearable :disabled="sonDisable || BDZT" size="small" v-model="scope.row.additionalSupplier" @clear="clearHang(scope.$index, '选择补单供应商')" @focus="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')">
                   <el-button size="small" :disabled="sonDisable || BDZT" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')"></el-button>
                 </el-input>
               </el-form-item>
@@ -789,6 +789,8 @@ export default {
               if(this.basicForm.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal) }
               if(this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
               // 详情时将收货仓库id赋值给stordocId
+              // 如果业务类型为补单需求,则明细内补单供应商编码可以编辑
+              if(this.basicForm.billType == 'BDXQ') { this.BDZT = false } else { this.BDZT = true }
             }
           })
         }
@@ -984,6 +986,10 @@ export default {
         this.basicForm.puDemandItemList[index].contactsPhone = null
         this.basicForm.puDemandItemList[index].address = null
       }
+      if (title == '选择补单供应商') {
+        this.basicForm.puDemandItemList[index].additionalSupplierName = null
+        this.basicForm.puDemandItemList[index].additionalSupplier = null
+      }
     },
   }
 }

+ 27 - 6
src/views/purchase/contract/column.js

@@ -130,7 +130,7 @@ export const Columns = [
     inputType: "PopoverSelect",
     referName: "TAX_RATE_PARAM",
     dataMapping: {
-      invoiceTax: "name",
+      invoiceTax: "ntaxrate",
     },
     require: true,
   },
@@ -356,9 +356,8 @@ export const TabColumns = [
         inputType: "PopoverSelect",
         referName: "TAX_RATE_PARAM",
         dataMapping: {
-          tax: "name",
+          tax: "ntaxrate",
         },
-
         width: 200,
       },
       {
@@ -380,11 +379,33 @@ export const TabColumns = [
         width: 200,
         computed: (prop) => {
           const { qty, taxPrice } = prop;
-          return qty && taxPrice ? qty * taxPrice : null;
+          const taxMoney = (qty * taxPrice).toFixed(8);
+          return taxMoney === "NaN" ? null : taxMoney;
+        },
+      },
+      {
+        title: "无税单价",
+        key: "taxFreePrice",
+        inputType: "ComputedInput",
+        width: 200,
+        computed: (prop) => {
+          const { tax, taxPrice } = prop;
+          const newTax = tax === "0E-8" ? 0 : Number(tax) / 100;
+          const taxFreePrice = (taxPrice / (1 + newTax)).toFixed(8);
+          return taxFreePrice === "NaN" ? null : taxFreePrice;
+        },
+      },
+      {
+        title: "无税金额合计",
+        key: "taxFreeMoney",
+        inputType: "ComputedInput",
+        width: 200,
+        computed: (prop) => {
+          const { qty, taxFreePrice } = prop;
+          const taxFreeMoney = (qty * taxFreePrice).toFixed(8);
+          return taxFreeMoney === "NaN" ? null : taxFreeMoney;
         },
       },
-      { title: "无税单价", key: "taxFreePrice" },
-      { title: "无税金额合计", key: "taxFreeMoney", width: 200 },
       {
         title: "注册证号及备案凭证号",
         key: "registration",

+ 2 - 5
src/views/purchase/contract/delete/index.vue

@@ -15,14 +15,11 @@ export default {
         cancelButtonText: "取消",
         type: "info",
       })
-        .then(() => {
+        .then(async () => {
           try {
-            const { code, msg } = REMOVE(prop);
+            const { code } = await REMOVE(prop);
             if (code === 200) {
               this.$emit("success");
-              this.$notify.success({ title: msg });
-            } else {
-              this.$notify.warning({ title: msg });
             }
           } catch (err) {
             // catch

+ 25 - 26
src/views/purchase/contract/edit/index.vue

@@ -39,11 +39,19 @@ export default {
   },
   computed: {},
   watch: {
-    "params.contractType": function (newProp) {
-      this.tabColumns = TabColumns.filter((element) =>
-        newProp === "1" ? element.key !== "contractItemList" : element
-      );
-      this.tabName = this.tabColumns[0].key;
+    "params.contractType": {
+      handler: function (newProp) {
+        if (newProp === "1") {
+          this.params.contractItemList = [];
+          this.tabColumns = TabColumns.filter(
+            (element) => element.key !== "contractItemList"
+          );
+        } else {
+          this.tabColumns = TabColumns;
+        }
+        this.tabName = this.tabColumns[0].key;
+      },
+      immediate: true,
     },
   },
   methods: {
@@ -62,18 +70,16 @@ export default {
     async fetchItem(prop) {
       try {
         this.loading = true;
-        const { code, msg, data } = await ITEM(prop);
+        const { code, data } = await ITEM(prop);
         if (code === 200) {
           this.params = data;
-          this.$notify.success({ title: msg });
           this.tabName = this.tabColumns[0].key;
           this.fetchTable(this.params.code, this.tabName);
-        } else {
-          this.$notify.warning({ title: msg });
         }
       } catch (err) {
-        //
+        // catch
       } finally {
+        // finally
         this.loading = false;
       }
     },
@@ -81,16 +87,14 @@ export default {
     async fetchTable(prop, name) {
       try {
         this.loading = true;
-        const { code, msg, rows } = await TABLELIST({ contractId: prop }, name);
+        const { code, rows } = await TABLELIST({ contractId: prop }, name);
         if (code === 200) {
           this.params[name] = rows;
-          this.$notify.success({ title: msg });
-        } else {
-          this.$notify.warning({ title: msg });
         }
       } catch (err) {
-        //
+        // catch
       } finally {
+        // finally
         this.loading = false;
       }
     },
@@ -103,16 +107,14 @@ export default {
     async rowDelete(prop, { row: { id }, $index }) {
       try {
         this.loading = true;
-        const { code, msg } = await TABLEROMOVE(id, prop);
+        const { code } = await TABLEROMOVE(id, prop);
         if (code === 200) {
           this.params[prop].splice($index, 1);
-          this.$notify.success({ title: msg });
-        } else {
-          this.$notify.warning({ title: msg });
         }
       } catch (err) {
-        //
+        // catch
       } finally {
+        // finally
         this.loading = false;
       }
     },
@@ -125,7 +127,7 @@ export default {
             const createByName = this.params.buyerName;
             const updateById = this.$store.state.user.id;
             const updateByName = this.$store.state.user.name;
-            const { code, msg } = await EDIT({
+            const { code } = await EDIT({
               createById,
               createByName,
               updateById,
@@ -135,14 +137,11 @@ export default {
             if (code === 200) {
               this.hide();
               this.$emit("success");
-              this.$notify.success({ title: msg });
-            } else {
-              this.$notify.warning({ title: msg });
             }
           } catch (err) {
-            //
+            // catch
           } finally {
-            //
+            // finally
           }
         } else {
           return false;

+ 42 - 57
src/views/purchase/contract/index.vue

@@ -1,7 +1,7 @@
 <script>
 import { LIST } from "@/api/business/purchase/contract";
-import { Columns as TableColumns, SearchColumns } from "./column";
 import { initPage, initDicts, initParams } from "@/utils/init";
+import { Columns as TableColumns, SearchColumns } from "./column";
 export default {
   name: "PuchaseContract",
   dicts: initDicts(TableColumns),
@@ -21,12 +21,12 @@ export default {
       params: initParams(SearchColumns),
       tableData: [],
       tableColumns: TableColumns,
-      page: initPage(),
+      page: { pageNum: 1, pageSize: 10, total: 0 },
     };
   },
   computed: {},
   created() {
-    this.queryList(this.params, this.page);
+    this.useQuery(this.params, this.page);
   },
   methods: {
     //
@@ -43,69 +43,58 @@ export default {
           this.tableData = rows;
           this.page.total = total;
           this.$notify.success({ title: msg });
-        } else {
-          this.$notify.warning({ title: msg });
         }
       } catch (err) {
-        //
+        // catch
       } finally {
+        // finally
         this.loading = false;
       }
     },
-    // 查询操作
-    queryList(prop, page) {
+    // 查 
+    useQuery(prop, page) {
       this.fetchList(prop, page);
     },
-    // 重置操作
-    resetList() {
+    // 重 
+    useReset() {
       this.page = initPage();
       this.params = initParams(SearchColumns);
-      this.queryList(this.params, this.page);
-    },
-    // 页大小变
-    sizeChange(prop) {
-      this.page.pageSize = prop;
-      this.queryList(this.params, this.page);
+      this.useQuery(this.params, this.page);
     },
-    // 当前页变
-    currentChange(prop) {
-      this.page.pageNum = prop;
-      this.queryList(this.params, this.page);
-    },
-    //
+    // 新 增
     async useAdd() {
       const { open } = this.$refs.AddModel;
       await open();
     },
-    //
-    async useSee(prop) {
+    // 删 除
+    async useDelete(prop) {
       const { id } = prop;
-      const { open } = this.$refs.SeeModel;
+      const { open } = this.$refs.DeleteModel;
       await open(id);
     },
-    //
+    // 编 辑
     async useEdit(prop) {
       const { id } = prop;
       const { open } = this.$refs.EditModel;
       await open(id);
     },
-    //
+    // 明 细
+    async useSee(prop) {
+      const { id } = prop;
+      const { open } = this.$refs.SeeModel;
+      await open(id);
+    },
+    // 导 出
     async useExport(prop) {
       const { pageNum, pageSize } = this.page;
       const { open } = this.$refs.ExportModel;
       await open({ ...prop, pageNum, pageSize });
     },
-    //
+    // 导 入
     async useImport() {
       const { open } = this.$refs.ImportModel;
       await open();
     },
-    //
-    async useDelete(prop) {
-      const { id } = prop;
-      const { open } = this.$refs.DeleteModel;
-      await open(id);
-    },
   },
 };
 </script>
@@ -122,13 +111,13 @@ export default {
     :body-style="{ padding: 0 }"
   >
     <see-model ref="SeeModel"></see-model>
-    <add-model ref="AddModel" @success="resetList"></add-model>
-    <edit-model ref="EditModel" @success="queryList(params, page)"></edit-model>
+    <add-model ref="AddModel" @success="useReset"></add-model>
+    <edit-model ref="EditModel" @success="useQuery(params, page)"></edit-model>
     <export-model ref="ExportModel"></export-model>
     <import-model ref="ImportModel"></import-model>
     <delete-model
       ref="DeleteModel"
-      @success="queryList(params, page)"
+      @success="useQuery(params, page)"
     ></delete-model>
     <el-form
       :size="size"
@@ -148,29 +137,17 @@ export default {
             <el-input
               v-model="params[column.key]"
               :placeholder="column.placeholder"
-              @change="queryList(params, page)"
+              @change="useQuery(params, page)"
             ></el-input>
           </el-form-item>
         </el-col>
-        <el-col :span="6">
-          <el-form-item label-width="0">
-            <el-button
-              circle
-              :size="size"
-              icon="el-icon-search"
-              @click="queryList(params, page)"
-            ></el-button>
-            <el-button
-              circle
-              :size="size"
-              icon="el-icon-refresh"
-              @click="resetList"
-            ></el-button>
-          </el-form-item>
-        </el-col>
       </el-row>
     </el-form>
     <el-row style="padding: 0 20px">
+      <el-button :size="size" @click="useQuery(params, page)">
+        查 询
+      </el-button>
+      <el-button :size="size" @click="useReset"> 重 置 </el-button>
       <el-button :size="size" @click="useAdd"> 新 增 </el-button>
       <el-button :size="size" @click="useExport(params)"> 导 出 </el-button>
       <el-button :size="size" @click="useImport"> 导 入 </el-button>
@@ -196,22 +173,30 @@ export default {
             :value="scope.row[column.key]"
             :options="dict.type[column.referName]"
           />
+          <el-button
+            v-else-if="column.inputType === 'Upload'"
+            type="text"
+            size="small"
+            @click.native.prevent="useEdit(scope.row)"
+          >
+            点击查看
+          </el-button>
           <span v-else>{{ scope.row[column.key] }}</span>
         </template>
       </el-table-column>
       <el-table-column fixed="right" label="操作" width="120">
         <template slot-scope="scope">
           <el-button
-            @click.native.prevent="useEdit(scope.row)"
             type="text"
             size="small"
+            @click.native.prevent="useEdit(scope.row)"
           >
             编 辑
           </el-button>
           <el-button
-            @click.native.prevent="useDelete(scope.row)"
             type="text"
             size="small"
+            @click.native.prevent="useDelete(scope.row)"
           >
             删 除
           </el-button>
@@ -222,7 +207,7 @@ export default {
       :total="page.total"
       :page.sync="page.pageNum"
       :limit.sync="page.pageSize"
-      @pagination="queryList(params, page)"
+      @pagination="useQuery(params, page)"
     />
   </el-card>
 </template>

+ 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;">