Sfoglia il codice sorgente

新增 任务单 字段

damon227 1 mese fa
parent
commit
4c6ab13bc1

+ 11 - 0
src/api/sale.js

@@ -232,3 +232,14 @@ export function revokeOutsource (data) {
     data
   })
 }
+
+// 根据订单编码获取下拉列表
+export function getOrderByCode (orderCode) {
+  return request({
+    url: request.adornUrl(`/biz-service/order/listOrder`),
+    method: 'get',
+    params: {
+      orderCode
+    }
+  })
+}

+ 170 - 60
src/views/modules/sale/add-material.vue

@@ -1,117 +1,227 @@
 <template>
   <div>
     <el-dialog
-      :title="!id ? '新增': display ? '详情' : '新增或修改'"
+      :title="!id ? '新增' : display ? '详情' : '新增或修改'"
       width="50%"
       :close-on-click-modal="false"
-      :visible.sync="visible">
-      <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="100px">
+      :visible.sync="visible"
+    >
+      <el-form
+        :model="dataForm"
+        :rules="dataRule"
+        ref="dataForm"
+        label-width="100px"
+      >
+        <el-form-item label="任务单" prop="orderId">
+          <el-select
+            v-model="dataForm.orderId"
+            :disabled="display"
+            filterable
+            remote
+            reserve-keyword
+            placeholder="请输入关键词"
+            :remote-method="debouncedSearch"
+            :loading="loading"
+            style="width:100%"
+          >
+            <el-option
+              v-for="item in orderOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item label="物品名称" prop="materialName">
-<!--          <material-component v-model="dataForm" :material-id="dataForm.materialId"/>-->
-          <el-input v-model="dataForm.materialName" :disabled="display" placeholder="物品名称"></el-input>
+          <!--          <material-component v-model="dataForm" :material-id="dataForm.materialId"/>-->
+          <el-input
+            v-model="dataForm.materialName"
+            :disabled="display"
+            placeholder="物品名称"
+          ></el-input>
         </el-form-item>
         <el-form-item label="型号及规格" prop="specification">
-          <el-input v-model="dataForm.specification" :disabled="display" placeholder="型号及规格"></el-input>
+          <el-input
+            v-model="dataForm.specification"
+            :disabled="display"
+            placeholder="型号及规格"
+          ></el-input>
         </el-form-item>
         <el-form-item label="采购类别" prop="purchaseType">
           <el-select
             v-model="dataForm.purchaseType"
             :disabled="display"
             remote
-            placeholder="请选择">
+            placeholder="请选择"
+          >
             <el-option
               v-for="item in optionsType"
               :key="item.code"
               :label="item.value"
-              :value="item.code">
+              :value="item.code"
+            >
             </el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="数量" prop="cnt">
-          <el-input-number v-model="dataForm.cnt" :disabled="display" :min="1"/>
+          <el-input-number
+            v-model="dataForm.cnt"
+            :disabled="display"
+            :min="1"
+          />
         </el-form-item>
         <el-form-item label="单位" prop="unitName">
-          <el-input v-model="dataForm.unitName" :disabled="display" placeholder="单位"></el-input>
+          <el-input
+            v-model="dataForm.unitName"
+            :disabled="display"
+            placeholder="单位"
+          ></el-input>
         </el-form-item>
         <el-form-item label="采购期限" prop="deadline">
           <el-date-picker
             v-model="dataForm.deadline"
             value-format="yyyy-MM-dd"
-            type="date">
+            type="date"
+          >
           </el-date-picker>
         </el-form-item>
         <el-form-item label="批次号" prop="batchNumber">
-          <el-input v-model="dataForm.batchNumber" :disabled="display" placeholder="批次号"></el-input>
+          <el-input
+            v-model="dataForm.batchNumber"
+            :disabled="display"
+            placeholder="批次号"
+          ></el-input>
         </el-form-item>
         <el-form-item label="用途" prop="purpose">
-          <el-input v-model="dataForm.purpose" :disabled="display" placeholder="用途"></el-input>
+          <el-input
+            v-model="dataForm.purpose"
+            :disabled="display"
+            placeholder="用途"
+          ></el-input>
         </el-form-item>
         <el-form-item label="备注" prop="notes">
-          <el-input type="textarea" v-model="dataForm.notes" :disabled="display" placeholder="备注"></el-input>
+          <el-input
+            type="textarea"
+            v-model="dataForm.notes"
+            :disabled="display"
+            placeholder="备注"
+          ></el-input>
         </el-form-item>
       </el-form>
       <span slot="footer">
         <el-button @click="visible = false">取消</el-button>
-        <el-button v-if="!display" type="primary" @click="dataFormSubmit()" v-reClick>确定</el-button>
+        <el-button
+          v-if="!display"
+          type="primary"
+          @click="dataFormSubmit()"
+          v-reClick
+          >确定</el-button
+        >
       </span>
     </el-dialog>
   </div>
 </template>
 
 <script>
-  import MaterialComponent from '@/views/modules/common/material-component'
-  export default {
-    name: 'add-material',
-    props: {
-      optionsType: {
-        type: Array,
-        default: () => []
+import MaterialComponent from '@/views/modules/common/material-component'
+import { getOrderByCode } from '@/api/sale'
+import _ from 'lodash'
+export default {
+  name: 'add-material',
+  props: {
+    optionsType: {
+      type: Array,
+      default: () => []
+    }
+  },
+  components: { MaterialComponent },
+  data () {
+    return {
+      visible: false,
+      display: false,
+      dataList: [],
+      transferData: {},
+      dataForm: {},
+      id: 0,
+      loading: false,
+      orderOptions: [],
+      dataRule: {
+        orderId: [
+          { required: true, message: '任务单不能为空', trigger: 'blur' }
+        ],
+        materialName: [
+          { required: true, message: '物品名称不能为空', trigger: 'blur' }
+        ],
+        specification: [
+          { required: true, message: '型号及规格不能为空', trigger: 'blur' }
+        ],
+        unitName: [
+          { required: true, message: '单位不能为空', trigger: 'blur' }
+        ],
+        purchaseType: [
+          { required: true, message: '请选择采购类别', trigger: 'change' }
+        ],
+        deadline: [
+          { required: true, message: '请选择采购期限', trigger: 'change' }
+        ]
+        // batchNumber: [{ required: true, message: '批次号不能为空', trigger: 'blur' }]
+      }
+    }
+  },
+  created () {
+    // 创建防抖函数(500ms延迟)
+    this.debouncedSearch = _.debounce(this.remoteMethod, 500)
+  },
+  mounted () {
+    this.remoteMethod('')
+  },
+  beforeDestroy () {
+    // 清除防抖定时器,避免内存泄漏
+    this.debouncedSearch.cancel()
+  },
+  methods: {
+    init (id, display, transferData) {
+      this.remoteMethod('')
+
+      this.dataForm = {
+        cnt: 1
       }
+      this.visible = true
+      this.id = id || Math.round(Math.random() * 1000000)
+      this.display = display
+      if (!id) return
+      this.dataForm = transferData
     },
-    components: {MaterialComponent},
-    data () {
-      return {
-        visible: false,
-        display: false,
-        dataList: [],
-        transferData: {},
-        dataForm: {},
-        id: 0,
-        dataRule: {
-          materialName: [{ required: true, message: '物品名称不能为空', trigger: 'blur' }],
-          specification: [{ required: true, message: '型号及规格不能为空', trigger: 'blur' }],
-          unitName: [{ required: true, message: '单位不能为空', trigger: 'blur' }],
-          purchaseType: [{ required: true, message: '请选择采购类别', trigger: 'change' }],
-          deadline: [{ required: true, message: '请选择采购期限', trigger: 'change' }]
-          // batchNumber: [{ required: true, message: '批次号不能为空', trigger: 'blur' }]
+    // 表单提交
+    dataFormSubmit () {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          this.dataForm.detailId = this.id
+          this.visible = false
+          this.$emit('addItem', this.dataForm)
         }
-      }
+      })
+    },
+    remoteMethod (query) {
+      this.loading = true
+      this.getOrderByCode(query)
     },
-    methods: {
-      init (id, display, transferData) {
-        this.dataForm = {
-          cnt: 1
+    getOrderByCode (orderCode) {
+      getOrderByCode(orderCode).then(({ data }) => {
+        this.loading = false
+
+        console.log(data)
+        if (data && data.code === '200' && data.data) {
+          this.orderOptions = data.data.map(item => {
+            return {label: item.orderCode, value: item.orderId}
+          })
         }
-        this.visible = true
-        this.id = id || Math.round(Math.random() * 1000000)
-        this.display = display
-        if (!id) return
-        this.dataForm = transferData
-      },
-      // 表单提交
-      dataFormSubmit () {
-        this.$refs['dataForm'].validate((valid) => {
-          if (valid) {
-            this.dataForm.detailId = this.id
-            this.visible = false
-            this.$emit('addItem', this.dataForm)
-          }
-        })
-      }
+      })
     }
   }
+}
 </script>
 
 <style scoped>
-
 </style>

+ 187 - 141
src/views/modules/sale/purchase-detail.vue

@@ -1,12 +1,21 @@
 <template>
   <div>
     <div class="my-title">查看</div>
-    <div style="margin-left: 20px;margin-right: 20px">
+    <div style="margin-left: 20px; margin-right: 20px">
       <!-- 工作流 -->
       <div v-show="dataForm.workFlowBusinessExt">
-        <el-steps :active="activeNo" finish-status="success" align-center style="margin-bottom: 20px">
+        <el-steps
+          :active="activeNo"
+          finish-status="success"
+          align-center
+          style="margin-bottom: 20px"
+        >
           <template v-for="(item, i) in stepList">
-            <el-step :icon="item.icon" :title="item.title" :description="item.description"></el-step>
+            <el-step
+              :icon="item.icon"
+              :title="item.title"
+              :description="item.description"
+            ></el-step>
           </template>
         </el-steps>
         <el-collapse style="margin-bottom: 20px">
@@ -15,40 +24,53 @@
               <span style="color: red">审批日志(展开查看更多):</span>
             </template>
             <template v-for="(item, i) in logList">
-              <div>{{++i}}:{{item.approverName}}  {{item.createTime}}  {{item.approvalValue}}</div>
+              <div>
+                {{ ++i }}:{{ item.approverName }} {{ item.createTime }}
+                {{ item.approvalValue }}
+              </div>
             </template>
           </el-collapse-item>
         </el-collapse>
       </div>
       <div v-if="isFlow">
-        <approve-component ref="approve" @approveFinished="approveFinished"/>
+        <approve-component ref="approve" @approveFinished="approveFinished" />
       </div>
       <e-desc title="基本信息" column="3">
-        <e-desc-item label="采购编码">{{dataForm.procurementCode}}</e-desc-item>
+        <e-desc-item label="采购编码">{{
+          dataForm.procurementCode
+        }}</e-desc-item>
         <e-desc-item label="付款方式" span="2">
           <el-checkbox-group v-model="idsPayType">
-            <el-checkbox disabled class="my-cb"  v-for="(item,i) in optionsPayType" :label="item.code" :key="item.code"><span>{{item.value}}</span></el-checkbox>
+            <el-checkbox
+              disabled
+              class="my-cb"
+              v-for="(item, i) in optionsPayType"
+              :label="item.code"
+              :key="item.code"
+              ><span>{{ item.value }}</span></el-checkbox
+            >
           </el-checkbox-group>
         </e-desc-item>
 
-        <e-desc-item label="申请人">{{dataForm.applier}}</e-desc-item>
-        <e-desc-item label="申请部门" span="2">{{dataForm.orgName}}</e-desc-item>
+        <e-desc-item label="申请人">{{ dataForm.applier }}</e-desc-item>
+        <e-desc-item label="申请部门" span="2">{{
+          dataForm.orgName
+        }}</e-desc-item>
       </e-desc>
       <e-desc title="采购物品明细">
-        <el-table
-          :data="dataForm.purchaseDetails"
-          border
-          style="width: 100%;">
-          <el-table-column
-            label="序号"
-            type="index"
-            width="50"
-            align="center">
+        <el-table :data="dataForm.purchaseDetails" border style="width: 100%">
+          <el-table-column label="序号" type="index" width="50" align="center">
+          </el-table-column>
+          <el-table-column prop="detailId" label="ID" v-if="false">
           </el-table-column>
           <el-table-column
-            prop="detailId"
-            label="ID"
-            v-if="false">
+            prop="orderName"
+            header-align="center"
+            align="center"
+            width="160"
+            :show-tooltip-when-overflow="true"
+            label="任务单"
+          >
           </el-table-column>
           <el-table-column
             prop="materialName"
@@ -56,7 +78,8 @@
             align="center"
             min-width="120"
             :show-tooltip-when-overflow="true"
-            label="物品名称">
+            label="物品名称"
+          >
           </el-table-column>
           <el-table-column
             prop="specification"
@@ -64,26 +87,30 @@
             align="center"
             min-width="120"
             :show-tooltip-when-overflow="true"
-            label="型号及规格">
+            label="型号及规格"
+          >
           </el-table-column>
           <el-table-column
             prop="purchaseType"
             header-align="center"
             align="center"
             :formatter="formatType"
-            label="采购类别">
+            label="采购类别"
+          >
           </el-table-column>
           <el-table-column
             prop="cnt"
             header-align="center"
             align="center"
-            label="数量">
+            label="数量"
+          >
           </el-table-column>
           <el-table-column
             prop="unitName"
             header-align="center"
             align="center"
-            label="单位">
+            label="单位"
+          >
           </el-table-column>
           <el-table-column
             prop="deadline"
@@ -91,7 +118,8 @@
             align="center"
             min-width="160"
             :show-tooltip-when-overflow="true"
-            label="采购期限">
+            label="采购期限"
+          >
           </el-table-column>
           <el-table-column
             prop="batchNumber"
@@ -99,47 +127,51 @@
             align="center"
             min-width="140"
             :show-tooltip-when-overflow="true"
-            label="批次号">
+            label="批次号"
+          >
           </el-table-column>
-           <el-table-column
+          <el-table-column
             prop="purpose"
             header-align="center"
             align="center"
             min-width="140"
             :show-tooltip-when-overflow="true"
-            label="用途">
+            label="用途"
+          >
           </el-table-column>
           <el-table-column
             prop="price"
             header-align="center"
             align="center"
             min-width="100"
-            label="不含税单价">
+            label="不含税单价"
+          >
           </el-table-column>
           <el-table-column
             prop="taxPrice"
             header-align="center"
             align="center"
-            label="含税单价">
+            label="含税单价"
+          >
           </el-table-column>
           <el-table-column
             prop="taxAmount"
             header-align="center"
             align="center"
-            label="含税总价">
+            label="含税总价"
+          >
             <template slot-scope="scope">
-              <span>{{ (scope.row.cnt*scope.row.taxPrice).toFixed(2) }}</span>
+              <span>{{ (scope.row.cnt * scope.row.taxPrice).toFixed(2) }}</span>
             </template>
           </el-table-column>
           <el-table-column
             prop="taxRate"
             header-align="center"
             align="center"
-            label="税率">
+            label="税率"
+          >
             <template slot-scope="scope">
-              <span>
-                {{scope.row.taxRate}} %
-              </span>
+              <span> {{ scope.row.taxRate }} % </span>
             </template>
           </el-table-column>
           <el-table-column
@@ -148,7 +180,8 @@
             align="center"
             min-width="160"
             :show-tooltip-when-overflow="true"
-            label="备注">
+            label="备注"
+          >
           </el-table-column>
         </el-table>
       </e-desc>
@@ -160,121 +193,134 @@
 </template>
 
 <script>
-  import EDesc from '../common/e-desc'
-  import EDescItem from '../common/e-desc-item'
-  import { dealStepData, dealStepLogs } from '@/api/util'
-  import { getPurchaseDetail } from '@/api/sale'
-  import ApproveComponent from '../common/approve-component'
-  import { getDictList } from '@/api/dict'
-  export default {
-    name: 'purchase-detail',
-    components: {
-      EDesc, EDescItem, ApproveComponent
+import EDesc from '../common/e-desc'
+import EDescItem from '../common/e-desc-item'
+import { dealStepData, dealStepLogs } from '@/api/util'
+import { getPurchaseDetail } from '@/api/sale'
+import ApproveComponent from '../common/approve-component'
+import { getDictList } from '@/api/dict'
+export default {
+  name: 'purchase-detail',
+  components: {
+    EDesc,
+    EDescItem,
+    ApproveComponent
+  },
+  data () {
+    return {
+      visible: false,
+      isFlow: false,
+      id: 0,
+      dataForm: {},
+      activeNo: 0,
+      stepList: [],
+      logList: [],
+      idsPayType: [],
+      optionsType: [],
+      optionsPayType: [
+        {
+          code: '0',
+          value: '对公转账'
+        },
+        {
+          code: '1',
+          value: '先行垫付'
+        },
+        {
+          code: '2',
+          value: '财务预支'
+        }
+      ]
+    }
+  },
+  methods: {
+    onChose () {
+      this.$emit('onChose')
     },
-    data () {
-      return {
-        visible: false,
-        isFlow: false,
-        id: 0,
-        dataForm: {},
-        activeNo: 0,
-        stepList: [],
-        logList: [],
-        idsPayType: [],
-        optionsType: [],
-        optionsPayType: [
-          {
-            code: '0', value: '对公转账'
-          },
-          {
-            code: '1', value: '先行垫付'
-          },
-          {
-            code: '2', value: '财务预支'
-          }
-        ]
-      }
+    // 获取采购类别字典
+    getTypeList () {
+      getDictList({ type: 'purchase_type' }).then(({ data }) => {
+        if (data) {
+          this.optionsType = data
+        }
+      })
     },
-    methods: {
-      onChose () {
-        this.$emit('onChose')
-      },
-      // 获取采购类别字典
-      getTypeList () {
-        getDictList({type: 'purchase_type'}).then(({data}) => {
-          if (data) {
-            this.optionsType = data
+    async init (id, businessType) {
+      this.visible = true
+      this.isFlow = !!(businessType && businessType !== '')
+      this.id = id || 0
+      this.dataForm = {}
+      this.stepList = []
+      this.logList = []
+      this.idsPayType = []
+      this.getTypeList()
+      this.getDetails(businessType)
+    },
+    getDetails (businessType) {
+      getPurchaseDetail(this.id).then(({ data }) => {
+        if (data && data.code === '200') {
+          this.dataForm = data.data
+          // 流程图展示
+          if (data.data.workFlowBusinessExt) {
+            dealStepData(
+              data.data.workFlowBusinessExt.workFlowProcessStepList,
+              this.stepList
+            )
+            dealStepLogs(
+              data.data.workFlowBusinessExt.processLogList,
+              this.logList
+            )
           }
-        })
-      },
-      async init (id, businessType) {
-        this.visible = true
-        this.isFlow = !!(businessType && businessType !== '')
-        this.id = id || 0
-        this.dataForm = {}
-        this.stepList = []
-        this.logList = []
-        this.idsPayType = []
-        this.getTypeList()
-        this.getDetails(businessType)
-      },
-      getDetails (businessType) {
-        getPurchaseDetail(this.id).then(({data}) => {
-          if (data && data.code === '200') {
-            this.dataForm = data.data
-            // 流程图展示
-            if (data.data.workFlowBusinessExt) {
-              dealStepData(data.data.workFlowBusinessExt.workFlowProcessStepList, this.stepList)
-              dealStepLogs(data.data.workFlowBusinessExt.processLogList, this.logList)
-            }
-            if (data.data.workFlowProcessStepList) {
-              this.activeNo = Number(data.data.workFlowProcessStepList.activeNo)
-            }
-            // 付款方式
-            if (data.data.payType) {
-              this.idsPayType.push(data.data.payType)
-            }
-            // 初始化审批Form
-            this.showApproveForm(businessType, this.id)
+          if (data.data.workFlowProcessStepList) {
+            this.activeNo = Number(data.data.workFlowProcessStepList.activeNo)
           }
-        })
-      },
-      // 百分比
-      formatPercent (row) {
-        if (!row.taxRate) return ''
-        let str = (Number(row.taxRate)).toFixed(0)
-        str += '%'
-        return str
-      },
-      // 初始化审批Form
-      showApproveForm (businessType, businessId) {
-        if (this.isFlow) {
-          this.$nextTick(() => {
-            this.$refs.approve.init(businessType, businessId)
-          })
+          // 付款方式
+          if (data.data.payType) {
+            this.idsPayType.push(data.data.payType)
+          }
+          // 初始化审批Form
+          this.showApproveForm(businessType, this.id)
         }
-      },
-      // 审批完成
-      approveFinished () {
-        this.onChose()
-        this.$emit('approveFinished')
-      },
-      // 采购类型
-      formatType (row) {
-        if (!row.purchaseType || !this.optionsType) return ''
-        const item1 = this.optionsType.find((item) => item.code === row.purchaseType.toString())
-        return item1 ? item1.value : ''
+      })
+    },
+    // 百分比
+    formatPercent (row) {
+      if (!row.taxRate) return ''
+      let str = Number(row.taxRate).toFixed(0)
+      str += '%'
+      return str
+    },
+    // 初始化审批Form
+    showApproveForm (businessType, businessId) {
+      if (this.isFlow) {
+        this.$nextTick(() => {
+          this.$refs.approve.init(businessType, businessId)
+        })
       }
+    },
+    // 审批完成
+    approveFinished () {
+      this.onChose()
+      this.$emit('approveFinished')
+    },
+    // 采购类型
+    formatType (row) {
+      if (!row.purchaseType || !this.optionsType) return ''
+      const item1 = this.optionsType.find(
+        (item) => item.code === row.purchaseType.toString()
+      )
+      return item1 ? item1.value : ''
     }
   }
+}
 </script>
 
 <style scoped>
-.my-line{
+.my-line {
   border-bottom: 1px solid #c0c4cc;
   margin-bottom: 10px;
 }
-.title{
-  padding: 10px 0 ;
+.title {
+  padding: 10px 0;
 }
 </style>

+ 518 - 322
src/views/modules/sale/purchase.vue

@@ -1,23 +1,38 @@
 <!-- 采购列表 -->
 <template>
   <div class="purchase">
-    <template v-if="!addOrUpdateVisible && !detailVisible && !operateVisible && !inboundVisible && !noticeChangeAttachVisible && !amountMaskSettingVisible">
+    <template
+      v-if="
+        !addOrUpdateVisible &&
+        !detailVisible &&
+        !operateVisible &&
+        !inboundVisible &&
+        !noticeChangeAttachVisible &&
+        !amountMaskSettingVisible
+      "
+    >
       <el-form :inline="true" :model="dataForm" @keyup.enter.native="search()">
         <el-form-item label="类别">
           <el-select
             v-model="dataForm.purchaseType"
             remote
-            placeholder="请选择">
+            placeholder="请选择"
+          >
             <el-option
               v-for="item in optionsType"
               :key="item.code"
               :label="item.value"
-              :value="item.code">
+              :value="item.code"
+            >
             </el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="物品名称">
-          <el-input v-model="dataForm.materialName" placeholder="物品名称" clearable/>
+          <el-input
+            v-model="dataForm.materialName"
+            placeholder="物品名称"
+            clearable
+          />
         </el-form-item>
         <el-form-item label="申请时间">
           <el-date-picker
@@ -26,29 +41,59 @@
             type="datetimerange"
             range-separator="至"
             start-placeholder="开始日期"
-            end-placeholder="结束日期">
+            end-placeholder="结束日期"
+          >
           </el-date-picker>
         </el-form-item>
         <el-form-item label="状态">
           <el-select
             v-model="dataForm.purchaseState"
             remote
-            placeholder="请选择">
+            placeholder="请选择"
+          >
             <el-option
               v-for="item in optionsState"
               :key="item.code"
               :label="item.value"
-              :value="item.code">
+              :value="item.code"
+            >
             </el-option>
           </el-select>
         </el-form-item>
         <el-form-item>
           <el-button @click="search()">查询</el-button>
-          <el-button v-if="isAuth('purchase:detail:save')" type="primary" @click="addOrUpdateHandle(0)">新建采购申请</el-button>
-          <el-button v-if="isAuth('purchase:detail:noteChangeConfig')" type="primary" @click="setNoticeChangeHandel()">工作提示通知设置</el-button>
-          <el-button v-if="isAuth('purchase:detail:priceConfig')" type="primary" @click="setAmountMaskHandel()">采购金额屏蔽设置</el-button>
-          <el-button v-if="isAuth('purchase:detail:updatePurchaseDetail')" type="primary" @click="batchBuyHandel()" :disabled="batchBuyBtnDisabled">批量采购</el-button>
-          <el-button v-if="isAuth('purchase:detail:infoPutIn')" type="primary" @click="batchIncomeHandel()" :disabled="batchIncomeBtnDisabled">批量入库</el-button>
+          <el-button
+            v-if="isAuth('purchase:detail:save')"
+            type="primary"
+            @click="addOrUpdateHandle(0)"
+            >新建采购申请</el-button
+          >
+          <el-button
+            v-if="isAuth('purchase:detail:noteChangeConfig')"
+            type="primary"
+            @click="setNoticeChangeHandel()"
+            >工作提示通知设置</el-button
+          >
+          <el-button
+            v-if="isAuth('purchase:detail:priceConfig')"
+            type="primary"
+            @click="setAmountMaskHandel()"
+            >采购金额屏蔽设置</el-button
+          >
+          <el-button
+            v-if="isAuth('purchase:detail:updatePurchaseDetail')"
+            type="primary"
+            @click="batchBuyHandel()"
+            :disabled="batchBuyBtnDisabled"
+            >批量采购</el-button
+          >
+          <el-button
+            v-if="isAuth('purchase:detail:infoPutIn')"
+            type="primary"
+            @click="batchIncomeHandel()"
+            :disabled="batchIncomeBtnDisabled"
+            >批量入库</el-button
+          >
         </el-form-item>
       </el-form>
       <el-table
@@ -56,16 +101,10 @@
         :data="dataList"
         border
         v-loading="dataListLoading"
-        style="width: 100%;">
-        <el-table-column
-          type="selection"
-          width="55">
-        </el-table-column>
-        <el-table-column
-          label="序号"
-          type="index"
-          width="50"
-          align="center">
+        style="width: 100%"
+      >
+        <el-table-column type="selection" width="55"> </el-table-column>
+        <el-table-column label="序号" type="index" width="50" align="center">
         </el-table-column>
         <el-table-column
           prop="procurementCode"
@@ -73,7 +112,17 @@
           align="center"
           min-width="180"
           :show-tooltip-when-overflow="true"
-          label="采购编码">
+          label="采购编码"
+        >
+        </el-table-column>
+        <el-table-column
+          prop="orderName"
+          header-align="center"
+          align="center"
+          width="160"
+          :show-tooltip-when-overflow="true"
+          label="任务单"
+        >
         </el-table-column>
         <el-table-column
           prop="materialName"
@@ -81,14 +130,16 @@
           align="center"
           width="160"
           :show-tooltip-when-overflow="true"
-          label="物品名称">
+          label="物品名称"
+        >
         </el-table-column>
         <el-table-column
           prop="purchaseType"
           header-align="center"
           align="center"
           :formatter="formatType"
-          label="采购类别">
+          label="采购类别"
+        >
         </el-table-column>
         <el-table-column
           prop="specification"
@@ -96,19 +147,22 @@
           align="center"
           width="120"
           :show-tooltip-when-overflow="true"
-          label="型号及规格">
+          label="型号及规格"
+        >
         </el-table-column>
         <el-table-column
           prop="cnt"
           header-align="center"
           align="center"
-          label="数量">
+          label="数量"
+        >
         </el-table-column>
         <el-table-column
           prop="qualifiedCnt"
           header-align="center"
           align="center"
-          label="合格数量">
+          label="合格数量"
+        >
         </el-table-column>
         <el-table-column
           prop="unitName"
@@ -116,7 +170,8 @@
           align="center"
           min-width="100"
           :show-tooltip-when-overflow="true"
-          label="单位">
+          label="单位"
+        >
         </el-table-column>
         <el-table-column
           prop="deadline"
@@ -124,7 +179,8 @@
           align="center"
           min-width="160"
           :show-tooltip-when-overflow="true"
-          label="采购期限">
+          label="采购期限"
+        >
         </el-table-column>
         <el-table-column
           prop="arrivedTime"
@@ -132,7 +188,8 @@
           align="center"
           min-width="160"
           :show-tooltip-when-overflow="true"
-          label="到料时间">
+          label="到料时间"
+        >
         </el-table-column>
         <el-table-column
           prop="batchNumber"
@@ -140,7 +197,8 @@
           align="center"
           min-width="160"
           :show-tooltip-when-overflow="true"
-          label="批次号">
+          label="批次号"
+        >
         </el-table-column>
         <el-table-column
           prop="purpose"
@@ -148,7 +206,8 @@
           align="center"
           min-width="160"
           :show-tooltip-when-overflow="true"
-          label="用途">
+          label="用途"
+        >
         </el-table-column>
         <el-table-column
           prop="procurementBasis"
@@ -156,9 +215,16 @@
           align="center"
           min-width="120"
           :show-tooltip-when-overflow="true"
-          label="采购依据">
+          label="采购依据"
+        >
           <template slot-scope="scope">
-            <span>{{scope.row.procurementBasis?(Number(scope.row.procurementBasis) === 1?'合同采购':'计划采购'):''}}</span>
+            <span>{{
+              scope.row.procurementBasis
+                ? Number(scope.row.procurementBasis) === 1
+                  ? "合同采购"
+                  : "计划采购"
+                : ""
+            }}</span>
           </template>
         </el-table-column>
         <el-table-column
@@ -167,7 +233,8 @@
           align="center"
           min-width="160"
           :show-tooltip-when-overflow="true"
-          label="供应商">
+          label="供应商"
+        >
         </el-table-column>
         <el-table-column
           prop="applyTime"
@@ -175,7 +242,8 @@
           align="center"
           min-width="160"
           :show-tooltip-when-overflow="true"
-          label="申请时间">
+          label="申请时间"
+        >
         </el-table-column>
         <el-table-column
           prop="applier"
@@ -183,7 +251,8 @@
           align="center"
           min-width="100"
           :show-tooltip-when-overflow="true"
-          label="申请人">
+          label="申请人"
+        >
         </el-table-column>
         <el-table-column
           prop="orgName"
@@ -191,7 +260,8 @@
           align="center"
           min-width="120"
           :show-tooltip-when-overflow="true"
-          label="申请部门">
+          label="申请部门"
+        >
         </el-table-column>
         <el-table-column
           fixed="right"
@@ -199,7 +269,8 @@
           header-align="center"
           align="center"
           :formatter="formatState"
-          label="审批状态">
+          label="审批状态"
+        >
         </el-table-column>
         <el-table-column
           fixed="right"
@@ -207,7 +278,8 @@
           header-align="center"
           align="center"
           :formatter="formatPurchaseState"
-          label="采购状态">
+          label="采购状态"
+        >
         </el-table-column>
         <el-table-column
           prop="notes"
@@ -215,23 +287,94 @@
           align="center"
           min-width="180"
           :show-overflow-tooltip="true"
-          label="备注">
+          label="备注"
+        >
         </el-table-column>
         <el-table-column
           fixed="right"
           header-align="center"
           align="center"
           width="150"
-          label="操作">
+          label="操作"
+        >
           <template slot-scope="scope">
-            <el-button v-if="isAuth('purchase:detail:info')" type="text" size="small" @click="detailHandle(scope.row.procurementId)">查看</el-button>
-            <el-button v-if="isAuth('purchase:detail:update') && (Number(scope.row.approvalState) === 0) && scope.row.creatorId === userId.toString()" type="text" size="small" @click="addOrUpdateHandle(scope.row.procurementId)">编辑</el-button>
-            <el-button v-if="isAuth('purchase:detail:updatePurchaseDetail')&& (Number(scope.row.approvalState) === 3) && (Number(scope.row.purchaseState) === 1)" type="text" size="small" @click="operateHandle(scope.row)">采购</el-button>
-            <el-button v-if="isAuth('purchase:detail:infoPutIn') && (Number(scope.row.approvalState) === 3  && (Number(scope.row.purchaseState) === 2 || Number(scope.row.purchaseState) === 5))" type="text" size="small" @click="inboundHandle(scope.row)">入库</el-button>
-            <el-button v-if="isAuth('purchase:detail:infoPutInAgain') && (Number(scope.row.purchaseState) === 5)" type="text" size="small" @click="inboundHandle(scope.row.procurementId)">再次入库</el-button>
-            <el-button type="text" size="small" @click="exportHandle(scope.row.procurementId)">导出</el-button>
-            <el-button v-if="isAuth('purchase:detail:update') && (Number(scope.row.approvalState) === 1)" type="text" size="small" @click="revokeHandle(scope.row.procurementId)">撤回</el-button>
-            <el-button v-if="isAuth('purchase:detail:update') && (Number(scope.row.approvalState) === 0)" type="text" size="small" @click="deleteHandle(scope.row.procurementId)">删除</el-button>
+            <el-button
+              v-if="isAuth('purchase:detail:info')"
+              type="text"
+              size="small"
+              @click="detailHandle(scope.row.procurementId)"
+              >查看</el-button
+            >
+            <el-button
+              v-if="
+                isAuth('purchase:detail:update') &&
+                Number(scope.row.approvalState) === 0 &&
+                scope.row.creatorId === userId.toString()
+              "
+              type="text"
+              size="small"
+              @click="addOrUpdateHandle(scope.row.procurementId)"
+              >编辑</el-button
+            >
+            <el-button
+              v-if="
+                isAuth('purchase:detail:updatePurchaseDetail') &&
+                Number(scope.row.approvalState) === 3 &&
+                Number(scope.row.purchaseState) === 1
+              "
+              type="text"
+              size="small"
+              @click="operateHandle(scope.row)"
+              >采购</el-button
+            >
+            <el-button
+              v-if="
+                isAuth('purchase:detail:infoPutIn') &&
+                Number(scope.row.approvalState) === 3 &&
+                (Number(scope.row.purchaseState) === 2 ||
+                  Number(scope.row.purchaseState) === 5)
+              "
+              type="text"
+              size="small"
+              @click="inboundHandle(scope.row)"
+              >入库</el-button
+            >
+            <el-button
+              v-if="
+                isAuth('purchase:detail:infoPutInAgain') &&
+                Number(scope.row.purchaseState) === 5
+              "
+              type="text"
+              size="small"
+              @click="inboundHandle(scope.row.procurementId)"
+              >再次入库</el-button
+            >
+            <el-button
+              type="text"
+              size="small"
+              @click="exportHandle(scope.row.procurementId)"
+              >导出</el-button
+            >
+            <el-button
+              v-if="
+                isAuth('purchase:detail:update') &&
+                Number(scope.row.approvalState) === 1
+              "
+              type="text"
+              size="small"
+              @click="revokeHandle(scope.row.procurementId)"
+              >撤回</el-button
+            >
+            <el-button
+              v-if="
+                isAuth('purchase:detail:update') &&
+                Number(scope.row.approvalState) === 0
+              "
+              type="text"
+              size="small"
+              @click="deleteHandle(scope.row.procurementId)"
+              >删除</el-button
+            >
           </template>
         </el-table-column>
       </el-table>
@@ -242,136 +385,173 @@
         :page-sizes="[10, 20, 50, 100]"
         :page-size="pageSize"
         :total="totalPage"
-        layout="total, sizes, prev, pager, next, jumper">
+        layout="total, sizes, prev, pager, next, jumper"
+      >
       </el-pagination>
     </template>
     <!-- 弹窗, 新增 / 修改 -->
-    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :options-type="optionsType" @refreshDataList="getDataList" @onChose="onChose"></add-or-update>
-    <detail v-if="detailVisible" ref="detail" @onChose="onChose"/>
+    <add-or-update
+      v-if="addOrUpdateVisible"
+      ref="addOrUpdate"
+      :options-type="optionsType"
+      @refreshDataList="getDataList"
+      @onChose="onChose"
+    ></add-or-update>
+    <detail v-if="detailVisible" ref="detail" @onChose="onChose" />
     <!-- 采购操作 -->
-    <operate v-if="operateVisible" ref="operate" @onChose="onChose" @refreshDataList="getDataList"/>
+    <operate
+      v-if="operateVisible"
+      ref="operate"
+      @onChose="onChose"
+      @refreshDataList="getDataList"
+    />
     <!-- 入库 -->
-    <inbound v-if="inboundVisible" ref="inbound" @onChose="onChose" @refreshDataList="getDataList"/>
-    <notice-change-setting v-if="noticeChangeAttachVisible" ref="noticeChangeSetting" @onChose="onChose"/>
-    <amount-mask-setting v-if="amountMaskSettingVisible" ref="amountMaskSetting" @onChose="onChose"/>
-<!--    <change-form v-if="changeFormVisible" ref="changeForm" @refreshDataList="getDataList" @onChose="onChose"/>-->
+    <inbound
+      v-if="inboundVisible"
+      ref="inbound"
+      @onChose="onChose"
+      @refreshDataList="getDataList"
+    />
+    <notice-change-setting
+      v-if="noticeChangeAttachVisible"
+      ref="noticeChangeSetting"
+      @onChose="onChose"
+    />
+    <amount-mask-setting
+      v-if="amountMaskSettingVisible"
+      ref="amountMaskSetting"
+      @onChose="onChose"
+    />
+    <!--    <change-form v-if="changeFormVisible" ref="changeForm" @refreshDataList="getDataList" @onChose="onChose"/>-->
   </div>
 </template>
 
 <script>
-  import AddOrUpdate from './purchase-add-or-update'
-  import Detail from './purchase-detail'
-  import Operate from './purchase-operate'
-  import Inbound from '../warehouse/stock-order-inbound'
-  import { getDictList } from '@/api/dict'
-  import { getPurchaseList, revokePurchase, del } from '@/api/sale'
-  import NoticeChangeSetting from './purchase-notice-change-setting'
-  import AmountMaskSetting from './purchase-amount-mask-setting'
-  import Vue from 'vue'
-  export default {
-    name: 'purchase',
-    components: {
-      AddOrUpdate, Detail, Operate, Inbound, NoticeChangeSetting, AmountMaskSetting
+import AddOrUpdate from './purchase-add-or-update'
+import Detail from './purchase-detail'
+import Operate from './purchase-operate'
+import Inbound from '../warehouse/stock-order-inbound'
+import { getDictList } from '@/api/dict'
+import { getPurchaseList, revokePurchase, del } from '@/api/sale'
+import NoticeChangeSetting from './purchase-notice-change-setting'
+import AmountMaskSetting from './purchase-amount-mask-setting'
+import Vue from 'vue'
+export default {
+  name: 'purchase',
+  components: {
+    AddOrUpdate,
+    Detail,
+    Operate,
+    Inbound,
+    NoticeChangeSetting,
+    AmountMaskSetting
+  },
+  data () {
+    return {
+      addOrUpdateVisible: false,
+      detailVisible: false,
+      operateVisible: false,
+      inboundVisible: false,
+      noticeChangeAttachVisible: false,
+      amountMaskSettingVisible: false,
+      dataForm: {},
+      userId: 0,
+      dataList: [],
+      pageIndex: 1,
+      pageSize: 10,
+      totalPage: 0,
+      dataListLoading: false,
+      dataListSelections: [],
+      optionsType: [],
+      // 审批状态:0 待提交 1 待审批 2 审批中 3 审批完成 4 审批不通过
+      optionsState: [],
+      // 采购状态:1 待采购 2 采购中 3 已入库 4 入库中 5 入库异常
+      optionsPurchaseState: [
+        { code: null, value: '全部' },
+        { code: '1', value: '待采购' },
+        { code: '2', value: '采购中' },
+        { code: '3', value: '已入库' },
+        { code: '4', value: '入库中' },
+        { code: '5', value: '入库异常' }
+      ],
+      batchIncomeBtnDisabled: false,
+      batchBuyBtnDisabled: false,
+      selectedRows: []
+    }
+  },
+  created () {
+    this.optionsState = this.$store.state.common.approveStates
+    this.userId = this.$store.state.user.id
+    this.getTypeList()
+    this.getDataList()
+  },
+  methods: {
+    onChose () {
+      this.addOrUpdateVisible = false
+      this.detailVisible = false
+      this.operateVisible = false
+      this.inboundVisible = false
+      this.noticeChangeAttachVisible = false
+      this.amountMaskSettingVisible = false
+      this.batchIncomeBtnDisabled = false
+      this.batchBuyBtnDisabled = false
+      this.selectedRows = []
     },
-    data () {
-      return {
-        addOrUpdateVisible: false,
-        detailVisible: false,
-        operateVisible: false,
-        inboundVisible: false,
-        noticeChangeAttachVisible: false,
-        amountMaskSettingVisible: false,
-        dataForm: {},
-        userId: 0,
-        dataList: [],
-        pageIndex: 1,
-        pageSize: 10,
-        totalPage: 0,
-        dataListLoading: false,
-        dataListSelections: [],
-        optionsType: [],
-        // 审批状态:0 待提交 1 待审批 2 审批中 3 审批完成 4 审批不通过
-        optionsState: [],
-        // 采购状态:1 待采购 2 采购中 3 已入库 4 入库中 5 入库异常
-        optionsPurchaseState: [
-          {code: null, value: '全部'},
-          {code: '1', value: '待采购'},
-          {code: '2', value: '采购中'},
-          {code: '3', value: '已入库'},
-          {code: '4', value: '入库中'},
-          {code: '5', value: '入库异常'}
-        ],
-        batchIncomeBtnDisabled: false,
-        batchBuyBtnDisabled: false,
-        selectedRows: []
-      }
+    // 获取采购类别字典
+    getTypeList () {
+      getDictList({ type: 'purchase_type' }).then(({ data }) => {
+        if (data) {
+          this.optionsType = data
+        }
+      })
     },
-    created () {
-      this.optionsState = this.$store.state.common.approveStates
-      this.userId = this.$store.state.user.id
-      this.getTypeList()
+    // 查询
+    search () {
+      this.pageIndex = 1
       this.getDataList()
     },
-    methods: {
-      onChose () {
-        this.addOrUpdateVisible = false
-        this.detailVisible = false
-        this.operateVisible = false
-        this.inboundVisible = false
-        this.noticeChangeAttachVisible = false
-        this.amountMaskSettingVisible = false
-        this.batchIncomeBtnDisabled = false
-        this.batchBuyBtnDisabled = false
-        this.selectedRows = []
-      },
-      // 获取采购类别字典
-      getTypeList () {
-        getDictList({type: 'purchase_type'}).then(({data}) => {
-          if (data) {
-            this.optionsType = data
-          }
-        })
-      },
-      // 查询
-      search () {
-        this.pageIndex = 1
-        this.getDataList()
-      },
-      // 获取数据列表
-      getDataList () {
-        this.selectedRows = []
+    // 获取数据列表
+    getDataList () {
+      this.selectedRows = []
 
-        this.dataListLoading = true
-        this.addOrUpdateVisible = false
-        let params = {
-          'current': this.pageIndex,
-          'size': this.pageSize,
-          'materialName': this.dataForm.materialName ? this.dataForm.materialName : null,
-          'purchaseState': this.dataForm.purchaseState ? this.dataForm.purchaseState : null,
-          'purchaseType': this.dataForm.purchaseType ? this.dataForm.purchaseType : null,
-          'beginTime': this.dataForm.date ? this.dataForm.date[0] : null,
-          'endTime': this.dataForm.date ? this.dataForm.date[1] : null
+      this.dataListLoading = true
+      this.addOrUpdateVisible = false
+      let params = {
+        current: this.pageIndex,
+        size: this.pageSize,
+        materialName: this.dataForm.materialName
+          ? this.dataForm.materialName
+          : null,
+        purchaseState: this.dataForm.purchaseState
+          ? this.dataForm.purchaseState
+          : null,
+        purchaseType: this.dataForm.purchaseType
+          ? this.dataForm.purchaseType
+          : null,
+        beginTime: this.dataForm.date ? this.dataForm.date[0] : null,
+        endTime: this.dataForm.date ? this.dataForm.date[1] : null
+      }
+      getPurchaseList(params).then(({ data }) => {
+        if (data && data.code === '200') {
+          this.dataList = data.data.records
+          this.totalPage = Number(data.data.total)
+        } else {
+          this.dataList = []
+          this.totalPage = 0
         }
-        getPurchaseList(params).then(({data}) => {
-          if (data && data.code === '200') {
-            this.dataList = data.data.records
-            this.totalPage = Number(data.data.total)
-          } else {
-            this.dataList = []
-            this.totalPage = 0
-          }
-          this.dataListLoading = false
-        })
-      },
-      revokeHandle (id) {
-        if (!id) return
-        let data = {id: id}
-        this.$confirm(`确定撤回?`, '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          revokePurchase(data).then(({data}) => {
+        this.dataListLoading = false
+      })
+    },
+    revokeHandle (id) {
+      if (!id) return
+      let data = { id: id }
+      this.$confirm(`确定撤回?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      })
+        .then(() => {
+          revokePurchase(data).then(({ data }) => {
             if (data && data.code === '200') {
               this.$message({
                 message: '操作成功',
@@ -385,88 +565,96 @@
               this.$message.error(data.msg)
             }
           })
-        }).catch(() => {})
-      },
-      // 每页数
-      sizeChangeHandle (val) {
-        this.pageSize = val
-        this.pageIndex = 1
-        this.getDataList()
-      },
-      // 当前页
-      currentChangeHandle (val) {
-        this.pageIndex = val
-        this.getDataList()
-      },
-      // 多选
-      selectionChangeHandle (val) {
-        this.dataListSelections = val
-      },
-      // 新增 / 修改
-      addOrUpdateHandle (id) {
-        this.addOrUpdateVisible = true
-        this.$nextTick(() => {
-          this.$refs.addOrUpdate.init(id)
         })
-      },
-      // 转换属性“类别”
-      formatType (row) {
-        if (this.optionsType && row.purchaseType) {
-          const item1 = this.optionsType.find((item) => item.code === row.purchaseType.toString())
-          return item1 ? item1.value : ''
-        }
-      },
-      // 转换属性“审批状态”
-      formatState (row) {
-        if (!row.approvalState) return ''
-        const item1 = this.optionsState.find((item) => item.code === row.approvalState.toString())
-        return item1 ? item1.value : ''
-      },
-      // 转换属性“采购状态”
-      formatPurchaseState (row) {
-        if (!row.purchaseState) return ''
-        const item1 = this.optionsPurchaseState.find((item) => item.code === row.purchaseState.toString())
+        .catch(() => {})
+    },
+    // 每页数
+    sizeChangeHandle (val) {
+      this.pageSize = val
+      this.pageIndex = 1
+      this.getDataList()
+    },
+    // 当前页
+    currentChangeHandle (val) {
+      this.pageIndex = val
+      this.getDataList()
+    },
+    // 多选
+    selectionChangeHandle (val) {
+      this.dataListSelections = val
+    },
+    // 新增 / 修改
+    addOrUpdateHandle (id) {
+      this.addOrUpdateVisible = true
+      this.$nextTick(() => {
+        this.$refs.addOrUpdate.init(id)
+      })
+    },
+    // 转换属性“类别”
+    formatType (row) {
+      if (this.optionsType && row.purchaseType) {
+        const item1 = this.optionsType.find(
+          (item) => item.code === row.purchaseType.toString()
+        )
         return item1 ? item1.value : ''
-      },
-      // 详情
-      detailHandle (id) {
-        this.detailVisible = true
-        this.$nextTick(() => {
-          this.$refs.detail.init(id)
-        })
-      },
-      // 采购操作
-      operateHandle (row) {
-        this.operateVisible = true
-        this.$nextTick(() => {
-          this.$refs.operate.init(row)
-        })
-      },
-      // 入库
-      inboundHandle (row) {
-        if (!row) return
-        let dataForm = {
-          ...row,
-          buttonType: '1',
-          sourceCategory: '1', // 入库依据类别
-          // materialTypeId: row.purchaseType, // 类别
-          source: row.supplierName, // 来源对应供应商
-          tableId: row.purchaseDetailId,
-          specifications: row.specification
-        }
-        this.inboundVisible = true
-        this.$nextTick(() => {
-          this.$refs.inbound.init(0, false, dataForm)
-        })
-      },
-      // 删除
-      deleteHandle (priceId) {
-        this.$confirm('是否确认要删除?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          del([priceId]).then(({data}) => {
+      }
+    },
+    // 转换属性“审批状态”
+    formatState (row) {
+      if (!row.approvalState) return ''
+      const item1 = this.optionsState.find(
+        (item) => item.code === row.approvalState.toString()
+      )
+      return item1 ? item1.value : ''
+    },
+    // 转换属性“采购状态”
+    formatPurchaseState (row) {
+      if (!row.purchaseState) return ''
+      const item1 = this.optionsPurchaseState.find(
+        (item) => item.code === row.purchaseState.toString()
+      )
+      return item1 ? item1.value : ''
+    },
+    // 详情
+    detailHandle (id) {
+      this.detailVisible = true
+      this.$nextTick(() => {
+        this.$refs.detail.init(id)
+      })
+    },
+    // 采购操作
+    operateHandle (row) {
+      this.operateVisible = true
+      this.$nextTick(() => {
+        this.$refs.operate.init(row)
+      })
+    },
+    // 入库
+    inboundHandle (row) {
+      if (!row) return
+      let dataForm = {
+        ...row,
+        buttonType: '1',
+        sourceCategory: '1', // 入库依据类别
+        // materialTypeId: row.purchaseType, // 类别
+        source: row.supplierName, // 来源对应供应商
+        tableId: row.purchaseDetailId,
+        specifications: row.specification
+      }
+      this.inboundVisible = true
+      this.$nextTick(() => {
+        this.$refs.inbound.init(0, false, dataForm)
+      })
+    },
+    // 删除
+    deleteHandle (priceId) {
+      this.$confirm('是否确认要删除?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      })
+        .then(() => {
+          del([priceId]).then(({ data }) => {
             if (data && data.code === '200') {
               this.$message({
                 type: 'success',
@@ -483,96 +671,104 @@
               })
             }
           })
-        }).catch(() => {
+        })
+        .catch(() => {
           this.$message({
             type: 'info',
             message: '已取消删除'
           })
         })
-      },
-      // 变更通知人设置
-      setNoticeChangeHandel () {
-        this.noticeChangeAttachVisible = true
-        this.$nextTick(() => {
-          this.$refs.noticeChangeSetting.init()
-        })
-      },
-      // 采购金额屏蔽设置
-      setAmountMaskHandel () {
-        this.amountMaskSettingVisible = true
-        this.$nextTick(() => {
-          this.$refs.amountMaskSetting.init()
-        })
-      },
-      exportHandle (procurementId) {
-        if (!procurementId) {
-          this.$message.error('参数不正确!')
-        }
-        location.href = this.$http.adornUrl(`/biz-service/purchaseDetail/exportExcel2/${procurementId}?_token=${Vue.cookie.get('token')}`)
-      },
-      // 监听批量选择的行
-      handleSelectionChange (rows) {
-        this.selectedRows = rows
-
-        // 控制批量操作按钮
-        this.batchIncomeBtnDisabled = false
-        this.batchBuyBtnDisabled = false
-        for (let index = 0; index < this.selectedRows.length; index++) {
-          let item = this.selectedRows[index]
-          if (Number(item.approvalState) === 3 && (Number(item.purchaseState) === 2 || Number(item.purchaseState) === 5)) {
-
-          } else {
-            this.batchIncomeBtnDisabled = true
-          }
-
-          if (Number(item.approvalState) === 3 && Number(item.purchaseState) === 1) {
+    },
+    // 变更通知人设置
+    setNoticeChangeHandel () {
+      this.noticeChangeAttachVisible = true
+      this.$nextTick(() => {
+        this.$refs.noticeChangeSetting.init()
+      })
+    },
+    // 采购金额屏蔽设置
+    setAmountMaskHandel () {
+      this.amountMaskSettingVisible = true
+      this.$nextTick(() => {
+        this.$refs.amountMaskSetting.init()
+      })
+    },
+    exportHandle (procurementId) {
+      if (!procurementId) {
+        this.$message.error('参数不正确!')
+      }
+      location.href = this.$http.adornUrl(
+        `/biz-service/purchaseDetail/exportExcel2/${procurementId}?_token=${Vue.cookie.get(
+          'token'
+        )}`
+      )
+    },
+    // 监听批量选择的行
+    handleSelectionChange (rows) {
+      this.selectedRows = rows
 
-          } else {
-            this.batchBuyBtnDisabled = true
-          }
-        }
-      },
-      // 批量采购
-      batchBuyHandel () {
-        if (this.selectedRows.length === 0) {
-          this.$message.error('请先勾选数据')
-          return
-        }
-        this.operateVisible = true
-        this.$nextTick(() => {
-          this.$refs.operate.init(this.selectedRows)
-        })
-      },
-      // 批量入库
-      batchIncomeHandel () {
-        if (this.selectedRows.length === 0) {
-          this.$message.error('请先勾选数据')
-          return
+      // 控制批量操作按钮
+      this.batchIncomeBtnDisabled = false
+      this.batchBuyBtnDisabled = false
+      for (let index = 0; index < this.selectedRows.length; index++) {
+        let item = this.selectedRows[index]
+        if (
+          Number(item.approvalState) === 3 &&
+          (Number(item.purchaseState) === 2 || Number(item.purchaseState) === 5)
+        ) {
+        } else {
+          this.batchIncomeBtnDisabled = true
         }
 
-        let list = []
-        for (let index = 0; index < this.selectedRows.length; index++) {
-          let item = this.selectedRows[index]
-          let dataForm = {
-            ...item,
-            buttonType: '1',
-            sourceCategory: '1', // 入库依据类别
-            source: item.supplierName, // 来源对应供应商
-            tableId: item.purchaseDetailId,
-            specifications: item.specification
-          }
-          list.push(dataForm)
+        if (
+          Number(item.approvalState) === 3 &&
+          Number(item.purchaseState) === 1
+        ) {
+        } else {
+          this.batchBuyBtnDisabled = true
         }
+      }
+    },
+    // 批量采购
+    batchBuyHandel () {
+      if (this.selectedRows.length === 0) {
+        this.$message.error('请先勾选数据')
+        return
+      }
+      this.operateVisible = true
+      this.$nextTick(() => {
+        this.$refs.operate.init(this.selectedRows)
+      })
+    },
+    // 批量入库
+    batchIncomeHandel () {
+      if (this.selectedRows.length === 0) {
+        this.$message.error('请先勾选数据')
+        return
+      }
 
-        this.inboundVisible = true
-        this.$nextTick(() => {
-          this.$refs.inbound.init(0, false, list)
-        })
+      let list = []
+      for (let index = 0; index < this.selectedRows.length; index++) {
+        let item = this.selectedRows[index]
+        let dataForm = {
+          ...item,
+          buttonType: '1',
+          sourceCategory: '1', // 入库依据类别
+          source: item.supplierName, // 来源对应供应商
+          tableId: item.purchaseDetailId,
+          specifications: item.specification
+        }
+        list.push(dataForm)
       }
+
+      this.inboundVisible = true
+      this.$nextTick(() => {
+        this.$refs.inbound.init(0, false, list)
+      })
     }
   }
+}
 </script>
 
 <style scoped>
-
 </style>