zss
2024-04-12 82a0439f46b893e008ce9156ab172fb3de7f1060
src/views/plan/customerorder/index.vue
@@ -11,6 +11,7 @@
        :toolbarMaxLength="4"
        :paramArr="type"
        ref="customerOrderTable"
        :expandRowKeys="expandRowKeys"
      >
        <template #toolbar>
          <el-dropdown
@@ -57,6 +58,12 @@
            @click="() => (exportDialogVisible = true)"
            >导出台账</el-button
          >
          <!-- <el-button
            style="margin-left: 10px"
            type="primary"
            @click="() => ($refs.technology.init())"
            >编写技术交底单</el-button
          > -->
        </template>
      </ttable>
      <!-- 弹窗, 日期选择 -->
@@ -347,6 +354,7 @@
        ></el-table-column>
      </el-table>
    </el-dialog>
    <technology-form ref="technology"></technology-form>
  </div>
</template>
@@ -358,6 +366,7 @@
} from '@/api/plan/customerOrderInterrelated'
import ConfirmPullCustomerorder from './confirm-pull-customerorder'
import TableForm from './customerorder-form'
import TechnologyForm from './technology-form.vue'
import TableFormDEesc from './customerorder-form-desc'
import SampleTableForm from './sample-customerorder-form'
import { mapGetters } from 'vuex'
@@ -384,7 +393,8 @@
  exportCustomerOrderSplit,
  syncOrder,
  dropByContractNo,
  downloadWordFile,
  downloadProduct,
  downloadWordFile
} from '../../../api/plan/customerorder'
import DocumentTable from '@/views/common/document.vue'
import { remote } from '@/api/admin/dict'
@@ -399,11 +409,13 @@
      interrelatedOrderId: null,
      interrelatedOrderData: [],
      showInterrelatedOrderDialog: false,
      technologyDialog:true,
      uniqueStateArr: [],
      dataForm: {
        selectTime: null,
        exportTime: null,
      },
      expandRowKeys: [],
      dataRule: {
        exportTime: [
          { required: true, message: '导出日期不能为空', trigger: 'change' },
@@ -585,7 +597,7 @@
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text',
            searchInfoType: 'date',
            formatter: this.formatDutyDate,
          },
          {
@@ -962,6 +974,7 @@
    SalesPartBatchDialog,
    TableFormDEesc,
    CustomerorderReturnDialog,
    TechnologyForm,
  },
  computed: {
    ...mapGetters(['permissions']),
@@ -1000,6 +1013,7 @@
  created() {
    // this.getManufactureAttrs()
    this.getTitles()
    if (this.permissions.plan_customerorder_add) {
    this.table.toolbar.push({
      text: '新增销售订单',
      type: 'primary',
@@ -1007,6 +1021,7 @@
      disabled: false,
      permitArr: [],
    })
    }
    if (this.permissions.customerorder_from_otc) {
      this.table.toolbar.push({
        text: '获取销售订单',
@@ -1035,13 +1050,25 @@
        permitArr: [],
      })
    }
    this.table.toolbar.push({
      text: '下载Word',
      disabled: false,
      type: 'primary',
      fun: this.downloadWord,
      permitArr: ['03plan', '04planed'],
    })
    if(this.permissions.plan_download_process_file){
        this.table.toolbar.push({
            text: '下载工艺文件',
            disabled: false,
            type: 'primary',
            fun: this.downloadWord,
            permitArr: ['03plan','04planed'],
        })
    }
    if(this.permissions.plan_download_product_file){
        this.table.toolbar.push({
            text: '下载排产单',
            disabled: false,
            type: 'primary',
            permitArr: [],
            fun: this.downloadProductionScheduling,
        })
    }
    if(this.permissions.plan_relevance_order){
    this.table.toolbar.push({
      text: '关联订单',
      disabled: false,
@@ -1049,6 +1076,7 @@
      fun: this.interrelatedOrderFun,
      permitArr: [],
    })
    }
    if (this.permissions.customerorder_create_masterplan) {
      this.table.toolbar.push({
        text: '主生产计划',
@@ -1115,16 +1143,29 @@
      this.interrelatedOrderId = currentOrder.id
      this.showInterrelatedOrderDialog = true
    },
    //下载word
    downloadWord() {
      let ids = this.multipleSelection.map((ele) => ele.id)
      if (ids.length < 1) {
        this.$message.error('请选择一条数据')
        return
      }
      downloadWordFile(ids)
        .then((response) => {
    //下载排产通知单
    downloadProductionScheduling(){
        let ids = this.multipleSelection.map(obj => obj.id)
        if(ids.length<1){
            this.$message.error("请选择一条数据")
            return
        }
        downloadProduct(ids).then(res=>{
            if(res.status===200){
                transform(res)
            }
        }).catch(error=>{
            console.error(error)
        })
    },
    //下载工艺文件
    downloadWord(){
        let ids = this.multipleSelection.map(ele=>ele.id)
        if(ids.length<1){
            this.$message.error("请选择一条数据")
            return
        }
        downloadWordFile(ids).then(response=>{
          // 处理返回的文件流
          const blob = response.data
          const link = document.createElement('a')
@@ -1241,6 +1282,7 @@
          this.$refs.addSampleForm.init(row ? row.contractNo : null)
        })
      }
      this.expandRowKeys=[row.id]
    },
    // 新增样品订单
    addSampleCustomerOrder() {