123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554 |
- <template>
- <!-- 销售订单页面 -->
- <div class="salePlan">
- <div class="top">
- <el-input placeholder="请输入内容" v-model="input" clearable> </el-input>
- <el-button type="primary" class="btn" @click="onclick">
- <i class="el-icon-search"></i>查询
- </el-button>
- <el-button type="primary" @click="btnclick(0)">
- <i class="el-icon-plus"></i>钢材订单新增
- </el-button>
- <el-button type="primary" @click="refresh">
- <i class="el-icon-refresh"></i>刷新
- </el-button>
- <el-button type="primary" @click="batchReport">
- <i class="upload2"></i>批量上传
- </el-button>
- </div>
- <el-tabs v-model="activeName" @tab-click="handleClick">
- <!-- 未上报 -->
- <el-tab-pane label="未上报" name="first">
- <dilTable
- v-bind.sync="option"
- ref="table3"
- @selection-change="selectionChange"
- >
- <el-table-column
- fixed="right"
- label="操作"
- align="center"
- width="200"
- >
- <template slot-scope="scope">
- <el-button
- @click="uploadclick(scope.row.saleOrderId)"
- type="text"
- size="small"
- >上传</el-button
- >
- <el-button
- @click="click(scope.row.saleOrderId)"
- type="text"
- size="small"
- >修改</el-button
- >
- <el-button
- type="text"
- size="small"
- @click="deleteclick(scope.row.saleOrderId)"
- >删除</el-button
- >
- <el-button
- @click="detailclick3(scope.row)"
- type="text"
- size="small"
- >物资详情</el-button
- >
- </template>
- </el-table-column>
- <!-- 物资详情抽屉 -->
- <el-table-column type="expand" width="1">
- <template slot-scope="props">
- <el-form label-position="center" inline class="demo-table-expand">
- <div v-if="false">{{ props }}</div>
- <div>
- <el-table :data="tableData3" border>
- <el-table-column
- v-for="(item, i) in tableHead"
- :key="i"
- :prop="item.prop"
- :label="item.label"
- :width="item.width"
- ></el-table-column>
- </el-table>
- </div>
- </el-form>
- </template>
- </el-table-column>
- </dilTable>
- </el-tab-pane>
- <!-- 已审批 -->
- <el-tab-pane label="已审批" name="four">
- <dilTable v-bind.sync="option4" ref="table">
- <el-table-column fixed="right" label="操作" width="80">
- <template slot-scope="scope">
- <el-button
- @click="detailclick(scope.row)"
- type="text"
- size="small"
- >物资详情</el-button
- >
- </template>
- </el-table-column>
- <!-- 物资详情抽屉 -->
- <el-table-column type="expand" width="1">
- <template slot-scope="props">
- <el-form label-position="center" inline class="demo-table-expand">
- <div v-if="false">{{ props }}</div>
- <div>
- <el-table :data="tableData" border>
- <el-table-column
- v-for="(item, i) in tableHead"
- :key="i"
- :prop="item.prop"
- :label="item.label"
- :width="item.width"
- ></el-table-column>
- </el-table>
- </div>
- </el-form>
- </template>
- </el-table-column>
- </dilTable>
- </el-tab-pane>
- <!-- 已上报 -->
- <el-tab-pane label="已上报" name="second">
- <dilTable v-bind.sync="option2" ref="table2">
- <el-table-column fixed="right" label="操作" width="70">
- <template slot-scope="scope">
- <el-button
- @click="detailclick2(scope.row)"
- type="text"
- size="small"
- >物资详情</el-button
- >
- </template>
- </el-table-column>
- <!-- 物资详情抽屉 -->
- <el-table-column type="expand" width="1">
- <template slot-scope="props">
- <el-form label-position="center" inline class="demo-table-expand">
- <div v-if="false">{{ props }}</div>
- <div>
- <el-table :data="tableData2" border>
- <el-table-column
- v-for="(item, i) in tableHead"
- :key="i"
- :prop="item.prop"
- :label="item.label"
- :width="item.width"
- ></el-table-column>
- </el-table>
- </div>
- </el-form>
- </template>
- </el-table-column>
- </dilTable>
- </el-tab-pane>
- </el-tabs>
- </div>
- </template>
- <script>
- import { getCookie } from "@/utils/util.js";
- export default {
- name: "saleOrder",
- data() {
- return {
- batchReportList: [],
- activeName: "first",
- drawer: false,
- input: "",
- index: "",
- carrierId: null,
- carrierName: null,
- option: {
- // 表格请求数据的地址
- requestUrl: "/api/v1/ams/getSaleOrderInfoes?apiId=408",
- selectionType: "select"
- },
- option2: {
- // 表格请求数据的地址
- requestUrl: "/api/v1/ams/getSaleOrderReportedes?apiId=408"
- },
- option4: {
- // 表格请求数据的地址
- requestUrl:
- "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1"
- },
- mapList: [],
- mapItemList: [],
- //记录旧的row对象 (销售公司已审批)
- oldRow: "",
- //记录上一个展开的点击次数,单数为展开状态,复数为闭合状态 (销售公司已审批)
- oldRowCount: 1,
- //记录旧的row对象 (财务已审批)
- oldRow1: "",
- //记录上一个展开的点击次数,单数为展开状态,复数为闭合状态 (财务已审批)
- oldRowCount1: 1,
- //记录旧的row对象 (已上报)
- oldRow2: "",
- //记录上一个展开的点击次数,单数为展开状态,复数为闭合状态 (已上报)
- oldRowCount2: 1,
- //记录旧的row对象 (未上报)
- oldRow3: "",
- //记录上一个展开的点击次数,单数为展开状态,复数为闭合状态 (未上报)
- oldRowCount3: 1,
- tableHead: [
- {
- prop: "materialName",
- label: "物资名称",
- width: 150
- },
- {
- prop: "specificationModel",
- label: "规格型号",
- width: 150
- },
- {
- prop: "materialNumber",
- label: "物资件数",
- width: 100
- },
- {
- prop: "materialWeight",
- label: "物资重量",
- width: 100
- }
- ],
- //(销售公司已审批)
- tableData: [],
- //(财务已审批)
- tableData1: [],
- //(已上报)
- tableData2: [],
- //(未上报)
- tableData3: []
- };
- },
- created() {
- if (getCookie("orgCode") == "shouhuokehu") {
- this.option.requestUrl =
- "/api/v1/ams/getSaleOrderInfoes?apiId=408&consigneeSsoId=" +
- getCookie("userId");
- this.option2.requestUrl =
- "/api/v1/ams/getSaleOrderReportedes?apiId=408&consigneeSsoId=" +
- getCookie("userId");
- this.option4.requestUrl =
- "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1&consigneeSsoId=" +
- getCookie("userId");
- } else {
- this.option.requestUrl =
- "/api/v1/ams/getSaleOrderInfoes?apiId=408&consigneeSsoId=" + null;
- this.option2.requestUrl =
- "/api/v1/ams/getSaleOrderReportedes?apiId=408&consigneeSsoId=" + null;
- this.option4.requestUrl =
- "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1&consigneeSsoId=" +
- null;
- }
- },
- methods: {
- getRequestUrl() {
- if (getCookie("orgCode") == "shouhuokehu") {
- this.option.requestUrl =
- "/api/v1/ams/getSaleOrderInfoes?apiId=408&consigneeSsoId=" +
- getCookie("userId") +
- "&i=" +
- new Date();
- this.option2.requestUrl =
- "/api/v1/ams/getSaleOrderReportedes?apiId=408&consigneeSsoId=" +
- getCookie("userId") +
- "&i=" +
- new Date();
- this.option4.requestUrl =
- "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1&consigneeSsoId=" +
- getCookie("userId") +
- "&i=" +
- new Date();
- } else {
- this.option.requestUrl =
- "/api/v1/ams/getSaleOrderInfoes?apiId=408&consigneeSsoId=" +
- null +
- "&i=" +
- new Date();
- this.option2.requestUrl =
- "/api/v1/ams/getSaleOrderReportedes?apiId=408&consigneeSsoId=" +
- null +
- "&i=" +
- new Date();
- this.option4.requestUrl =
- "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1&consigneeSsoId=" +
- null +
- "&i=" +
- new Date();
- }
- },
- batchReport() {
- if (this.batchReportList.length === 0) {
- this.$message.error("请先选择需要批量上传的销售订单");
- return;
- }
- this.axios
- .post("/api/v1/ams/uploadSaleOrderList", this.batchReportList)
- .then(res => {
- if (res.data.code == "200") {
- this.$message.success("上传成功");
- this.getRequestUrl();
- } else {
- this.$message.error("上传失败");
- }
- });
- },
- selectionChange(selection) {
- console.log(selection);
- this.batchReportList = [];
- this.batchReportList = selection;
- },
- refresh() {
- this.$router.go(0);
- },
- handleClick(tab, event) {
- console.log(tab, event);
- },
- onclick() {
- if (getCookie("orgCode") == "shouhuokehu") {
- if (this.activeName == "first") {
- this.option.requestUrl =
- "/api/v1/ams/getSaleOrderInfoes?apiId=408&con=" +
- this.input +
- "&consigneeSsoId=" +
- getCookie("userId");
- } else if (this.activeName == "second") {
- this.option2.requestUrl =
- "/api/v1/ams/getSaleOrderReportedes?apiId=408&con=" +
- this.input +
- "&consigneeSsoId=" +
- getCookie("userId");
- } else if (this.activeName == "four") {
- this.option4.requestUrl =
- "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&con=" +
- this.input +
- "&consigneeSsoId=" +
- getCookie("userId");
- }
- } else {
- if (this.activeName == "first") {
- this.option.requestUrl =
- "/api/v1/ams/getSaleOrderInfoes?apiId=408&con=" + this.input;
- } else if (this.activeName == "second") {
- this.option2.requestUrl =
- "/api/v1/ams/getSaleOrderReportedes?apiId=408&con=" + this.input;
- } else if (this.activeName == "four") {
- this.option4.requestUrl =
- "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&con=" +
- this.input;
- }
- }
- },
- seeclick(saleOrderId) {
- this.$router.push("/saleOrderDetail/" + saleOrderId);
- },
- btnclick() {
- this.$router.push("/addSaleOrder");
- },
- click(saleOrderId) {
- this.$router.push("/editSaleOrder/" + saleOrderId);
- },
- // -------查看物资详情 (已审批)
- detailclick(row) {
- // 记录重复点击次数
- if (this.oldRow === row) {
- this.oldRowCount += 1;
- }
- // 切换当前详情表
- this.$refs.table.toggleRowExpansion(row);
- // 打开前关闭上一个详情表
- if (this.oldRow != "") {
- if (this.oldRow != row) {
- if (this.oldRowCount % 2 === 1) {
- this.$refs.table.toggleRowExpansion(this.oldRow);
- } else {
- this.oldRowCount = 1;
- }
- } else {
- this.oldRow = null;
- return;
- }
- }
- // 重置上一个点击对象
- this.oldRow = row;
- // 根据销售订单id查询物资信息
- this.axios
- .post("/api/v1/ams/getSaleMaterialList?saleOrderId=" + row.saleOrderId)
- .then(res => {
- this.tableData = res.data.data;
- });
- },
- // -------查看物资详情 (财务已审批)
- detailclick1(row) {
- // 记录重复点击次数
- if (this.oldRow1 === row) {
- this.oldRowCount1 += 1;
- }
- // 切换当前详情表
- this.$refs.table1.toggleRowExpansion(row);
- // 打开前关闭上一个详情表
- if (this.oldRow1 != "") {
- if (this.oldRow1 != row) {
- if (this.oldRowCount1 % 2 === 1) {
- this.$refs.table1.toggleRowExpansion(this.oldRow1);
- } else {
- this.oldRowCount1 = 1;
- }
- } else {
- this.oldRow1 = null;
- return;
- }
- }
- // 重置上一个点击对象
- this.oldRow1 = row;
- // 根据销售订单id查询物资信息
- this.axios
- .post("/api/v1/ams/getSaleMaterialList?saleOrderId=" + row.saleOrderId)
- .then(res => {
- this.tableData1 = res.data.data;
- });
- },
- // -------查看物资详情 (已上报)
- detailclick2(row) {
- // 记录重复点击次数
- if (this.oldRow2 === row) {
- this.oldRowCount2 += 1;
- }
- // 切换当前详情表
- this.$refs.table2.toggleRowExpansion(row);
- // 打开前关闭上一个详情表
- if (this.oldRow2 != "") {
- if (this.oldRow2 != row) {
- if (this.oldRowCount2 % 2 === 1) {
- this.$refs.table2.toggleRowExpansion(this.oldRow2);
- } else {
- this.oldRowCount2 = 1;
- }
- } else {
- this.oldRow2 = null;
- return;
- }
- }
- // 重置上一个点击对象
- this.oldRow2 = row;
- // 根据销售订单id查询物资信息
- this.axios
- .post("/api/v1/ams/getSaleMaterialList?saleOrderId=" + row.saleOrderId)
- .then(res => {
- this.tableData2 = res.data.data;
- });
- },
- // -------查看物资详情 (未上报)
- detailclick3(row) {
- // 记录重复点击次数
- if (this.oldRow3 === row) {
- this.oldRowCount3 += 1;
- }
- // 切换当前详情表
- this.$refs.table3.toggleRowExpansion(row);
- // 打开前关闭上一个详情表
- if (this.oldRow3 != "") {
- if (this.oldRow3 != row) {
- if (this.oldRowCount3 % 2 === 1) {
- this.$refs.table3.toggleRowExpansion(this.oldRow3);
- } else {
- this.oldRowCount3 = 1;
- }
- } else {
- this.oldRow3 = null;
- return;
- }
- }
- // 重置上一个点击对象
- this.oldRow3 = row;
- // 根据销售订单id查询物资信息
- this.axios
- .post("/api/v1/ams/getSaleMaterialList?saleOrderId=" + row.saleOrderId)
- .then(res => {
- this.tableData3 = res.data.data;
- });
- },
- // 上传
- uploadclick(saleOrderId) {
- this.$confirm("是否上传", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- center: true
- })
- .then(() => {
- this.axios
- .post("/api/v1/ams/uploadSaleOrder?saleOrderId=" + saleOrderId)
- .then(res => {
- if (res.data.code == "200") {
- this.$message.success("上传成功!");
- this.getRequestUrl();
- } else {
- this.$message.success("上传失败!");
- this.getRequestUrl();
- }
- });
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: "取消上传!"
- });
- });
- },
- //删除
- deleteclick(scope) {
- let saleOrderId = scope;
- this.$confirm("是否删除", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- center: true
- })
- .then(() => {
- this.axios
- .post(
- "/api/v1/ams/deleteAmsSaleOrderBySaleOrderId?saleOrderId=" +
- saleOrderId
- )
- .then(res => {
- if (res.data.code == "200") {
- this.$message.success("删除成功");
- this.getRequestUrl();
- } else {
- this.$message.success("删除失败");
- this.getRequestUrl();
- }
- });
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: "取消删除!"
- });
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .salePlan {
- .top {
- padding: 1.25rem 0.375rem;
- .el-input {
- width: 20%;
- margin-right: 1.25rem;
- }
- }
- }
- </style>
|