| | |
| | | <el-col :span="12" style="line-height: 32px;">éå®ç®¡ç</el-col> |
| | | <el-col :span="12" style="text-align: right;"> |
| | | <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">å é¤</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> |
| | | </el-row> |
| | |
| | | </el-button> |
| | | </div> |
| | | <div class="thing"> |
| | | <el-table :data="tableData" border style="width: 100%;overflow-y: auto;min-height: calc(100% - 50px)" |
| | | max-height="calc(100% - 50px)" @selection-change="handleSelectionChange" default-expand-all row-key="id"> |
| | | <el-table ref="tableData" :data="tableData" border |
| | | style="width: 100%;overflow-y: auto;min-height: calc(100% - 50px)" max-height="calc(100% - 50px)" |
| | | @selection-change="handleSelectionChange" default-expand-all row-key="id"> |
| | | <el-table-column type="selection" width="50"> |
| | | </el-table-column> |
| | | <el-table-column type="index" label="åºå·" width="65"> |
| | |
| | | <el-table-column label="æä½" width="220"> |
| | | <template slot-scope="scope"> |
| | | <span class="table_do" @click="changeShowDetail(scope.row)"> æ¥ç详æ
</span> |
| | | <span class="table_do" v-if="scope.row.type==null"> å®¡æ ¸ </span> |
| | | <span class="table_do" v-if="scope.row.type==null" @click="saleCheck(scope)"> å®¡æ ¸ </span> |
| | | <span class="table_do" v-else> </span> |
| | | <span class="table_do"> ç¼è¾ </span> |
| | | <span class="table_do"> å é¤ </span> |
| | | <span class="table_do" @click="openUpDia(scope.row.id)"> ç¼è¾ </span> |
| | | <span class="table_do" @click="delSale(scope.$index)"> å é¤ </span> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-col style="height: 50px;display: flex;align-items: center;justify-content: right;"> |
| | | <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" |
| | | :page-sizes="[1,10, 20, 30, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" |
| | | :page-sizes="[10, 20, 30, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" |
| | | :total="countSize"> |
| | | </el-pagination> |
| | | </el-col> |
| | |
| | | <el-col :span="3" :offset="2">ç¶æ</el-col> |
| | | <el-col :span="8"> |
| | | <div class="value" v-if="oneData.type == 1" style="color: #34BD66;">éè¿</div> |
| | | <div class="value" v-else-if="oneData.type == 2" style="color: #E84738;">ä¸éè¿</div> |
| | | <div class="value" v-else-if="oneData.type == 0" style="color: #E84738;">ä¸éè¿</div> |
| | | <div class="value" v-else> </div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-row style="line-height: 30px;margin: 15px 0;"> |
| | | <el-col :span="3">ä¸å¡å</el-col> |
| | | <el-col :span="8"> |
| | | <div class="value">{{JSON.parse(oneData.saleman)}}</div> |
| | | <div class="value">{{oneData.saleman}}</div> |
| | | </el-col> |
| | | <el-col :span="3" :offset="2">ä¸å人</el-col> |
| | | <el-col :span="8"> |
| | |
| | | </el-col> |
| | | <el-col :span="3" :offset="2">å®¡æ ¸äºº</el-col> |
| | | <el-col :span="8"> |
| | | <div class="value">{{JSON.parse(oneData.checkname)}}</div> |
| | | <div class="value">{{oneData.checkname==null?' ': oneData.checkname}}</div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="line-height: 30px;margin: 15px 0;"> |
| | | <el-col :span="3">å®¡æ ¸æ¥æ</el-col> |
| | | <el-col :span="8"> |
| | | <div class="value">{{oneData.checkTime}}</div> |
| | | <div class="value">{{oneData.checkTime==null?' ': oneData.checkTime}}</div> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | |
| | | </el-dialog> |
| | | </div> |
| | | <div class="select-model"> |
| | | <el-dialog title="é宿°å¢" :visible.sync="addDia" width="800px"> |
| | | <el-dialog :title="`éå®${upDia==true?'ä¿®æ¹':'æ°å¢'}`" :visible.sync="addDia" width="800px"> |
| | | <div class="body"> |
| | | <div class="head">åºæ¬ä¿¡æ¯</div> |
| | | <div class="content"> |
| | |
| | | <el-table :data="addData.saleMaterialList" border style="width: 100%"> |
| | | <el-table-column prop="name" label="产ååç§°" width="180"> |
| | | <template slot-scope="scope"> |
| | | <el-select v-model="scope.row.name" size="small" clearable placeholder="请è¾å
¥äº§ååç§°" |
| | | @change="((index)=>{upRepe(index, scope.$index)})"> |
| | | <el-option v-for="(a, ai) in repeList" :key="ai" :label="a.name" :value="ai"></el-option> |
| | | </el-select> |
| | | <el-input v-model="scope.row.name" size="small" clearable placeholder="请è¾å
¥äº§ååç§°"> |
| | | </el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="specifications" label="è§æ ¼åå·" width="200"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.specifications" size="small" readonly></el-input> |
| | | <el-input v-model="scope.row.specifications" size="small" clearable placeholder="请è¾å
¥è§æ ¼åå·"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="unit" label="åä½"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.unit" size="small" readonly></el-input> |
| | | <el-input v-model="scope.row.unit" size="small" clearable placeholder="请è¾å
¥"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="number" label="æ°é"> |
| | |
| | | <el-input v-model="scope.row.price" size="small" clearable placeholder="请è¾å
¥"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="price" label="æä½" width="65px"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="text" @click.native.prevent="deleteRow(scope.$index, addData.saleMaterialList)">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="addSale">ç¡® å®</el-button> |
| | | <el-button v-if="upDia==false" type="primary" @click="addSale">ç¡® å®</el-button> |
| | | <el-button v-else-if="upDia==true" type="primary" @click="upSale">ç¡® å®</el-button> |
| | | <el-button @click="addDia = false">å æ¶</el-button> |
| | | </span> |
| | | </el-dialog> |
| | |
| | | phone: null, |
| | | saleMaterialList: [] |
| | | }, |
| | | repeList: [] |
| | | repeList: [], |
| | | upDia: false |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | }, |
| | | methods: { |
| | | handleSelectionChange(val) { |
| | | this.selects = val; |
| | | this.selects = val.id; |
| | | }, |
| | | handleSizeChange(val) { |
| | | this.pageSize = val |
| | |
| | | this.addData.saleMaterialList.push({}) |
| | | }, |
| | | addSale() { |
| | | for (var b = 0; b < this.addData.saleMaterialList.length; b++) { |
| | | if (Object.keys(this.addData.saleMaterialList[b]).length == 0) { |
| | | this.addData.saleMaterialList.splice(b, 1) |
| | | b-- |
| | | } 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 != 5) { |
| | | this.$message.error('产åä¿¡æ¯æå¿
填项æªå¡«å') |
| | | return |
| | | } |
| | | } |
| | | } |
| | | } |
| | | for (var a in this.addData) { |
| | | if (this.addData[a] == null || this.addData[a] == '') { |
| | | if (a == 'saleMaterialList') { |
| | |
| | | return |
| | | } |
| | | } |
| | | for (var b = 0; b < this.addData.saleMaterialList.length; b++) { |
| | | console.log(this.addData.saleMaterialList[b]); |
| | | if (Object.getOwnPropertyNames(this.addData.saleMaterialList[b]).length==0) { |
| | | this.addData.saleMaterialList.splice(b, 1) |
| | | b-- |
| | | if (b < 0) { |
| | | this.$message.error('产åä¿¡æ¯ä¸è½ä¸ºç©º') |
| | | return |
| | | } |
| | | } else { |
| | | for (var c in this.addData.saleMaterialList[b]) { |
| | | if (this.addData.saleMaterialList[b][c] == null || this.addData.saleMaterialList[b][c] == {} || Object |
| | | .getOwnPropertyNames(this.addData.saleMaterialList[b]).length != 5) { |
| | | this.$message.error('产åä¿¡æ¯æå¿
填项æªå¡«å') |
| | | return |
| | | } |
| | | } |
| | | } |
| | | } |
| | | console.log(this.addData); |
| | | this.axios.post(this.$api.url.addSale, this.addData, { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }).then(res => { |
| | | console.log(res); |
| | | this.$message.success('æ·»å æå') |
| | | this.addDia = false |
| | | this.selectRawInspectsList() |
| | | }) |
| | | }, |
| | | openAddDia() { |
| | | this.addDia = !(this.addDia) |
| | | this.$axios.post(this.$api.url.seleRepe).then(res => { |
| | | this.repeList = res.data |
| | | }) |
| | | this.upDia = false |
| | | }, |
| | | upRepe(index, i) { |
| | | var data = this.repeList[index] |
| | |
| | | this.addData.saleMaterialList[i].unit = data.unit |
| | | this.addData.saleMaterialList[i].specifications = data.specifications |
| | | } |
| | | }, |
| | | saleCheck(ob) { |
| | | this.$confirm(`订å${ob.row.code}çä¿¡æ¯æ¯å¦éè¿`, 'éå®è®¢åå®¡æ ¸', { |
| | | distinguishCancelAndClose: true, |
| | | confirmButtonText: 'éè¿', |
| | | cancelButtonText: 'ä¸éè¿' |
| | | }).then(res => { |
| | | this.$axios.post(this.$api.url.saleCheck, { |
| | | id: ob.row.id, |
| | | type: 1 |
| | | }).then(res => { |
| | | this.selectRawInspectsList() |
| | | }) |
| | | }).catch(e => { |
| | | if (e == 'cancel') { |
| | | this.$axios.post(this.$api.url.saleCheck, { |
| | | id: ob.row.id, |
| | | type: 0 |
| | | }).then(res => { |
| | | this.selectRawInspectsList() |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | openUpDia(index) { |
| | | this.addDia = true |
| | | this.upDia = true |
| | | this.axios.get(this.$api.url.selectSaleDatilById, { |
| | | params: { |
| | | id: index |
| | | } |
| | | }).then(res => { |
| | | this.addData = res.data |
| | | this.addData.id = index |
| | | }) |
| | | }, |
| | | upSale() { |
| | | console.log(this.addData); |
| | | for (var b = 0; b < this.addData.saleMaterialList.length; b++) { |
| | | if (Object.keys(this.addData.saleMaterialList[b]).length == 0) { |
| | | this.addData.saleMaterialList.splice(b, 1) |
| | | b-- |
| | | } 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) { |
| | | this.$message.error('产åä¿¡æ¯æå¿
填项æªå¡«å') |
| | | return |
| | | } |
| | | } |
| | | } |
| | | } |
| | | for (var a in this.addData) { |
| | | if ((this.addData[a] == null || this.addData[a] == '') && a != 'type') { |
| | | if (a == 'saleMaterialList') { |
| | | this.$message.error('产åä¿¡æ¯ä¸è½ä¸ºç©º') |
| | | } else { |
| | | this.$message.error('éå®è®¢åæå¿
填项æªå¡«å') |
| | | } |
| | | return |
| | | } |
| | | } |
| | | this.axios.post(this.$api.url.updateSaleById, { |
| | | id: this.addData.id, |
| | | str: JSON.stringify(this.addData) |
| | | }).then(res => { |
| | | this.$message.success('ç¼è¾æå') |
| | | this.addDia = false |
| | | this.upDia = false |
| | | this.selectRawInspectsList() |
| | | }) |
| | | }, |
| | | deleteRow(index, rows) { |
| | | rows.splice(index, 1); |
| | | }, |
| | | delSale(index){ |
| | | this.axios.post(this.$api.url.delSale, { |
| | | id: this.tableData[index].id, |
| | | }).then(res => { |
| | | this.$message.success('å 餿å') |
| | | this.tableData.splice(index, 1) |
| | | }) |
| | | }, |
| | | delSales(){ |
| | | console.log(this.selects); |
| | | this.axios.post(this.$api.url.delAllSale,{ |
| | | ids: this.selects |
| | | }, { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }).then(res=>{ |
| | | this.$message.success('å 餿å') |
| | | this.selectRawInspectsList() |
| | | }) |
| | | } |
| | | } |
| | | } |