|
|
@@ -107,9 +107,27 @@
|
|
|
icon="el-icon-download"
|
|
|
size="mini"
|
|
|
@click="handleExport"
|
|
|
+ >导出</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ plain
|
|
|
+ icon="el-icon-download"
|
|
|
+ size="mini"
|
|
|
+ :disabled="single"
|
|
|
+ @click="handleSaleorder"
|
|
|
>转销售订单</el-button>
|
|
|
</el-col>
|
|
|
-
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ plain
|
|
|
+ icon="el-icon-download"
|
|
|
+ size="mini"
|
|
|
+ @click="handleAllSaleorder"
|
|
|
+ >一次性转销售订单</el-button>
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
|
|
|
|
<el-table v-loading="loading" :data="salesorderList" @selection-change="handleSelectionChange">
|
|
|
@@ -310,10 +328,10 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { importFile, listSalesorder, getSalesorder, delSalesorder, addSalesorder, updateSalesorder,listSalesorderExpect,occupyRes,listSalesorderOccupyRes,listSalesorderExpectAll,occupyAllRes} from "@/api/aps/presalesorder";
|
|
|
+import {createAll,createOrUpdate ,exportFile, importFile, listSalesorder, getSalesorder, delSalesorder, addSalesorder, updateSalesorder,listSalesorderExpect,occupyRes,listSalesorderOccupyRes,listSalesorderExpectAll,occupyAllRes} from "@/api/aps/presalesorder";
|
|
|
import { API_BASE_URL, TOKEN_HEADER_NAME, LAYOUT_PATH } from '@/config/setting';
|
|
|
import { getToken, setToken } from '@/utils/token-util';
|
|
|
-
|
|
|
+import { download } from '@/utils/request';
|
|
|
export default {
|
|
|
name: "PreSalesorder",
|
|
|
data() {
|
|
|
@@ -433,10 +451,10 @@ export default {
|
|
|
},
|
|
|
/** 查询销售订单列表 */
|
|
|
getList() {
|
|
|
- console.log("getList")
|
|
|
+ // console.log("getList")
|
|
|
this.loading = true;
|
|
|
listSalesorder(this.queryParams).then(response => {
|
|
|
- console.log(response)
|
|
|
+ // console.log(response)
|
|
|
this.salesorderList = response;
|
|
|
this.total = response.total;
|
|
|
this.loading = false;
|
|
|
@@ -543,7 +561,7 @@ export default {
|
|
|
getSalesorder(id).then(response => {
|
|
|
// console.log(response);
|
|
|
let saleorder = response.data;
|
|
|
- if (saleorder.status=="1") {
|
|
|
+ if (saleorder.status=="1"||saleorder.status=="2") {
|
|
|
this.$message.success("已经分配过资源");
|
|
|
return;
|
|
|
}
|
|
|
@@ -636,10 +654,50 @@ export default {
|
|
|
},
|
|
|
/** 导出按钮操作 */
|
|
|
handleExport() {
|
|
|
- this.download('aps/salesorder/export', {
|
|
|
- ...this.queryParams
|
|
|
- }, `salesorder_${new Date().getTime()}.xlsx`)
|
|
|
+ this.loading = true;
|
|
|
+ exportFile(this.queryParams).then(res => {
|
|
|
+ this.loading = false;
|
|
|
+
|
|
|
+ });
|
|
|
},
|
|
|
+
|
|
|
+
|
|
|
+/** 转销售单按钮操作 */
|
|
|
+ handleAllSaleorder() {
|
|
|
+
|
|
|
+ this.loading = true;
|
|
|
+ let saleorder = {};
|
|
|
+ //如果是已经占用资源,则显示已经占用的资源,不能重复
|
|
|
+ createAll(saleorder).then(response => {
|
|
|
+ this.$message.success("转换成功");
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 转销售单按钮操作 */
|
|
|
+ handleSaleorder(row) {
|
|
|
+ const id = row.id || this.ids
|
|
|
+ getSalesorder(id).then(response => {
|
|
|
+ let saleorder = response.data;
|
|
|
+ this.form = response.data;
|
|
|
+ console.log(saleorder);
|
|
|
+ //如果是已经占用资源,则显示已经占用的资源,不能重复
|
|
|
+ if (saleorder.status=="1"){
|
|
|
+ createOrUpdate(saleorder).then(response => {
|
|
|
+ this.$message.success("转换成功");
|
|
|
+ });
|
|
|
+ return;
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (saleorder.status=="0"){
|
|
|
+ //如果没有
|
|
|
+ this.$message.success("没有交期预估");
|
|
|
+ } else if (saleorder.status=="2") {
|
|
|
+ //如果没有
|
|
|
+ this.$message.success("已经转换过了");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
/*销售单交期预估*/
|
|
|
handleExpect(row){
|
|
|
const id = row.id || this.ids
|
|
|
@@ -649,7 +707,7 @@ export default {
|
|
|
this.form = response.data;
|
|
|
console.log(saleorder);
|
|
|
//如果是已经占用资源,则显示已经占用的资源,不能重复
|
|
|
- if (saleorder.status=="1"){
|
|
|
+ if (saleorder.status=="1"||saleorder.status=="2"){
|
|
|
|
|
|
listSalesorderOccupyRes(saleorder).then(response => {
|
|
|
this.salesorderExpectList = response;
|
|
|
@@ -659,7 +717,7 @@ export default {
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
- else{
|
|
|
+ else if (saleorder.status=="0"){
|
|
|
|
|
|
listSalesorderExpect(saleorder).then(response => {
|
|
|
this.salesorderExpectList = response;
|
|
|
@@ -681,9 +739,6 @@ export default {
|
|
|
this.single = true;
|
|
|
this.multiple = false;
|
|
|
});
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
/** 下载模板操作 */
|
|
|
importTemplate() {
|