王震
2023-09-24 941fff624eddc4b9f369f1b91f65fdb50309851d
src/components/view/sale.vue
@@ -118,7 +118,6 @@
               <el-button type="success" @click="syncOrder"
                  :icon="isSync ? 'el-icon-loading' : 'el-icon-refresh'">同步</el-button>
               <el-button type="primary" icon="el-icon-plus" @click="openAddDia">新增</el-button>
               <!-- <el-button icon="el-icon-edit-outline">修改</el-button> -->
               <el-button icon="el-icon-delete" @click="delSales">删除</el-button>
               <el-button icon="el-icon-download">导出</el-button>
            </el-col>
@@ -156,29 +155,35 @@
            </el-table-column>
            <el-table-column prop="order_number" label="订单编号" width="150">
            </el-table-column>
            <el-table-column label="订单类型" width="100">
               <template slot-scope="scope">
                  <el-tag effect="dark" size="mini" style="font-size: 8px;">{{ scope.row.order_type }}</el-tag>
               </template>
            </el-table-column>
            <el-table-column prop="code" label="合同编号" width="220">
            </el-table-column>
            <el-table-column prop="name" label="工程名称">
            <el-table-column prop="name" label="工程名称" width="120">
            </el-table-column>
            <el-table-column prop="proname" label="客户名称">
            <el-table-column prop="proname" label="客户名称" width="120">
            </el-table-column>
            <el-table-column prop="交货日期" label="交货日期" width="150">
            </el-table-column>
            <el-table-column prop="note" label="备注" width="150">
            <el-table-column prop="note" label="备注" width="150" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="type" label="状态" width="100">
               <template slot-scope="scope">
                  <span style="color: #34BD66;" v-if="scope.row.type == 1">通过</span>
                  <span style="color: #E84738;" v-else-if="scope.row.type == 0">不通过</span>
                  <span v-else>未审核</span>
                  <span v-else>{{ null }}</span>
               </template>
            </el-table-column>
            <el-table-column label="操作" width="220">
               <template slot-scope="scope">
                  <span class="table_do" @click="changeShowDetail(scope.row)">&nbsp;查看详情&nbsp;</span>
                  <span class="table_do" v-if="scope.row.type == null" @click="saleCheck(scope)">&nbsp;审核&nbsp;</span>
                  <span class="table_do" @click="downloadFile(scope.row)">&nbsp;下载附件&nbsp;</span>
                  <span class="table_do" v-if="scope.row.type == 2" @click="saleCheck(scope)">&nbsp;审核&nbsp;</span>
                  <span class="table_do" v-else>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                  <span class="table_do" v-if="scope.row.type == null"
                  <span class="table_do" v-if="scope.row.type == 2"
                     @click="openUpDia(scope.row.id)">&nbsp;编辑&nbsp;</span>
                  <span class="table_do" v-else>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                  <span class="table_do" @click="delSale(scope.$index)">&nbsp;删除&nbsp;</span>
@@ -284,7 +289,7 @@
         </el-dialog>
      </div>
      <div class="select-model">
         <el-dialog :title="`销售${upDia == true ? '修改' : '新增'}`" :visible.sync="addDia" width="850px"
         <el-dialog :title="`销售${upDia == true ? '修改' : '新增'}`" :visible.sync="addDia" width="900px"
            @close="closeDialog">
            <div class="body">
               <div class="head">基本信息</div>
@@ -304,6 +309,10 @@
                     <el-col :span="3">工程名称</el-col>
                     <el-col :span="8">
                        <el-input v-model="addData.name" size="small" placeholder="请输入工程名称" clearable></el-input>
                     </el-col>
                     <el-col :span="3" :offset="2">备注</el-col>
                     <el-col :span="8">
                        <el-input v-model="addData.note" size="small" placeholder="请输入备注" clearable></el-input>
                     </el-col>
                  </el-row>
               </div>
@@ -349,35 +358,35 @@
                              placeholder="请输入规格型号"></el-input>
                        </template>
                     </el-table-column>
                     <el-table-column prop="unit" label="单位">
                     <el-table-column prop="unit" label="单位" width="100">
                        <template slot-scope="scope">
                           <el-input v-model="scope.row.unit" size="small" clearable placeholder="请输入"></el-input>
                        </template>
                     </el-table-column>
                     <el-table-column prop="number" label="数量">
                     <el-table-column prop="number" label="数量" width="100">
                        <template slot-scope="scope">
                           <el-input v-model.number="scope.row.number" size="small"
                              @change="(val) => scope.row.number = isNaN(val) ? null : val" clearable
                              placeholder="请输入"></el-input>
                        </template>
                     </el-table-column>
                     <el-table-column prop="price" label="单价">
                     <el-table-column prop="price" label="单价" width="100">
                        <template slot-scope="scope">
                           <el-input v-model="scope.row.price" size="small" clearable placeholder="请输入"></el-input>
                        </template>
                     </el-table-column>
                     <el-table-column prop="username" label="联系人">
                     <el-table-column prop="username" label="联系人" width="150">
                        <template slot-scope="scope">
                           <el-input v-model="scope.row.username" size="small" clearable
                              placeholder="请输入"></el-input>
                        </template>
                     </el-table-column>
                     <el-table-column prop="phone" label="电话">
                     <el-table-column prop="phone" label="电话" width="200">
                        <template slot-scope="scope">
                           <el-input v-model="scope.row.phone" size="small" clearable placeholder="请输入"></el-input>
                        </template>
                     </el-table-column>
                     <el-table-column prop="address" label="地址">
                     <el-table-column prop="address" label="地址" width="200">
                        <template slot-scope="scope">
                           <el-input v-model="scope.row.address" size="small" clearable
                              placeholder="请输入"></el-input>
@@ -424,6 +433,7 @@
            orderNumber: null,
            code: null,
            name: null,
            note: null,
            proname: null,
            adress: null,
            username: null,
@@ -441,11 +451,38 @@
      this.selectRawInspectsList()
   },
   methods: {
      downloadFile(row) {
         let baseIp = "http://192.168.18.16:9999"
         this.axios.post(this.$api.url.saleDownload, {
            id: row.id
         }).then(res => {
            // console.log(res.data);
            // 循环遍历每个文件并创建下载链接
            for (let index = 0; index < 2; index++) {
               const element = res.data[0];
               // 创建一个链接元素
               var a = document.createElement('a');
               // 设置链接元素的href属性为文件的URL
               a.href = baseIp+element;
               // // 设置链接元素的download属性为文件名
               a.download = row.name+"附件"+(index+1);
               // 模拟点击链接以触发下载
               a.click();
               //
               a.remove()
            }
         })
      },
      closeDialog() {
         this.addData = {
            orderNumber: null,
            code: null,
            name: null,
            note: null,
            proname: null,
            adress: null,
            username: null,
@@ -475,7 +512,7 @@
               message: '同步假成功(◕ᴗ◕)!',
               type: 'success'
            });
            this.isSync=false
            this.isSync = false
         }, 2000);
         return
         //调用同步接口
@@ -627,7 +664,7 @@
            } else {
               for (var c in this.addData.saleMaterialList[b]) {
                  if (this.addData.saleMaterialList[b][c] == null || this.addData.saleMaterialList[b][c] == '' || Object
                     .keys(this.addData.saleMaterialList[b]).length != 6) {
                     .keys(this.addData.saleMaterialList[b]).length != 9) {
                     this.$message.error('产品信息有必填项未填写')
                     return
                  }