123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461 |
- // 制定计划
- <template>
- <div class="steel_inbound">
- <div class="sache">
- <el-input placeholder="请输入内容" v-model="inputText" clearable>
- </el-input>
- <el-button type="primary" class="btn">
- <i class="el-icon-search"></i>查询
- </el-button>
- <el-button
- type="primary"
- class="btn"
- @click="toInsert"
- v-if="activeName == 'second'"
- >
- <i class="el-icon-plus"></i>制定计划
- </el-button>
- <el-button
- type="primary"
- class="btn"
- @click="Issue"
- v-if="activeName == 'second'"
- >
- <i class="el-icon-download"></i>下发
- </el-button>
- </div>
- <template>
- <div>
- <el-tabs v-model="activeName" @tab-click="handleClick">
- <el-tab-pane label="未下发" name="second">
- <dilTable v-bind.sync="second" @selection-change="selectionChange" ref="table1">
- <el-table-column fixed="right" label="操作" width="180">
- <template slot-scope="scope">
- <el-button type="text" size="mini" @click="getRequirementMaterial1(scope.row)">
- 物资详情
- </el-button>
- <el-button type="text" size="mini" @click="updatePlan(scope)">
- 修改
- </el-button>
- <el-button type="text" size="mini" @click="deletePlan(scope)">
- 删除
- </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="third">
- <dilTable v-bind.sync="third" ref="table2">
- <el-table-column
- fixed="right"
- align="center"
- label="操作"
- width="180"
- >
- <template slot-scope="scope">
- <el-button type="text" size="mini" @click="getRequirementMaterial2(scope.row)">
- 物资详情
- </el-button>
- <el-button type="text" size="mini" @click="finishPlan(scope)">
- 确认完成
- </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="fourth">
- <dilTable v-bind.sync="fourth" @selection-change="selectionChange" ref="table3">
- <el-table-column
- fixed="right"
- align="center"
- label="操作"
- width="100"
- >
- <template slot-scope="scope">
- <el-button type="text" size="mini" @click="getRequirementMaterial3(scope.row)">
- 物资详情
- </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-tabs>
- </div>
- </template>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- inputText: "",
- first: {
- // first请求数据的地址
- requestUrl:"",
- },
- second: {
- // second请求数据的地址
- requestUrl: "",
- selectionType: "select",
- mapList: [],
- },
- third: {
- // second请求数据的地址
- requestUrl: "",
- },
- fourth: {
- requestUrl: "",
- },
- activeName: "second",
- //记录旧的row对象(未下发)
- oldRow: "",
- //记录上一个展开的点击次数,单数为展开状态,复数为闭合状态(未下发)
- oldRowCount: 1,
- //记录旧的row对象(已下发)
- oldRow1: "",
- //记录上一个展开的点击次数,单数为展开状态,复数为闭合状态(已下发)
- oldRowCount1: 1,
- oldRow2: "",
- //记录上一个展开的点击次数,单数为展开状态,复数为闭合状态(未下发)
- oldRowCount2: 1,
- oldRow3: "",
- //记录上一个展开的点击次数,单数为展开状态,复数为闭合状态(未下发)
- oldRowCount3: 1,
- tableHead: [
- {
- prop: "materialName",
- label: "物资名称",
- width: 150,
- },
- {
- prop:"loadName",
- label:"装货点",
- width:150
- },
- {
- prop:"unloadName",
- label:"卸货点",
- width:150
- },
- {
- prop:"loadSequence",
- label:"装卸货次序",
- width:150
- },
- {
- prop: "materialWeight",
- label: "物资重量",
- width: 150,
- },
- {
- prop: "materialCount",
- label: "物资数量",
- width: 150,
- },
- ],
- tableData: [],
- };
- },
- created(){
- this.first.requestUrl = "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=1",
- this.second.requestUrl = "/api/v1/ams/getTruckPlanList?apiId=257&planStatus=0",
- this.third.requestUrl = "/api/v1/ams/getTruckPlanList?apiId=258&planStatus=1",
- this.fourth.requestUrl = "/api/v1/ams/getTruckPlanList?apiId=258&planStatus=4"
- },
- methods: {
- getRequirementMaterial(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;
- this.getMaterial(row.requirementId);
- },
- getRequirementMaterial1(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;
- this.getMaterial(row.requirementId);
- },
- getRequirementMaterial2(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;
- this.getMaterial(row.requirementId);
- },
- getRequirementMaterial3(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.oldRow2);
- } else {
- this.oldRowCount3 = 1;
- }
- } else {
- this.oldRow3 = null;
- return;
- }
- }
- // 重置上一个点击对象
- this.oldRow3 = row;
- this.getMaterial(row.requirementId);
- },
- getMaterial(requirementId){
- console.log(requirementId)
- this.axios.post("/api/v1/ams/getRequirementMaterial/" + requirementId).then((res) => {
- this.tableData = res.data.data
- console.log(res.data.data)
- })
- },
- handleClick(tab, event) {
- this.getRequestUrl()
- this.getRequirementMaterial()
- },
- getRequestUrl(){
- this.first.requestUrl = "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=1&i=" + new Date(),
- this.second.requestUrl = "/api/v1/ams/getTruckPlanList?apiId=257&planStatus=0" + "&i=" + new Date(),
- this.third.requestUrl = "/api/v1/ams/getTruckPlanList?apiId=258&planStatus=1" + "&i=" + new Date(),
- this.fourth.requestUrl = "/api/v1/ams/getTruckPlanList?apiId=258&planStatus=4" + "&i=" + new Date()
- },
- selectionChange(selection) {
- this.second.mapList = selection;
- },
- toInsert() {
- console.log("---");
- this.$router.push("/addPlan");
- },
- updatePlan(scope) {
- this.$router.push("/updatePlan/" + scope.row.planId);
- },
- finishPlan(scope) {
- this.$confirm("是否完成该计划", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- center: true,
- })
- .then(() => {
- this.axios
- .post("/api/v1/ams/finishTruckPlan/" + scope.row.planId)
- .then((res) => {
- if (res.data.code == "200") {
- this.$message({
- type: "success",
- message: "已完成该计划!",
- });
- this.getRequestUrl()
- } else {
- this.$message({
- message: "操作失败",
- type: "warning",
- });
- }
- });
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: "操作已取消!",
- });
- });
- },
- deletePlan(scope) {
- this.$confirm("是否删除", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- center: true,
- })
- .then(() => {
- this.axios
- .post("/api/v1/ams/deleteTruckPlan/" + scope.row.planId)
- .then((res) => {
- if (res.data.code == 200) {
- this.$message({
- type: "success",
- message: "删除成功!",
- });
- this.getRequestUrl()
- } else {
- this.$message({
- message: "删除失败",
- type: "warning",
- });
- }
- });
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: "删除操作已取消!",
- });
- });
- },
- Issue() {
- if(this.second.mapList.length == 0){
- this.$message.error("选择计划后才能下发")
- return
- }
- console.log(this.second.mapList);
- this.$confirm("是否下发", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- center: true,
- })
- .then(() => {
- this.axios
- .post("/api/v1/ams/downTruckPlan", this.second.mapList)
- .then((res) => {
- if (res.data.code == 200) {
- this.$message({
- type: "success",
- message: "下发成功!",
- });
- this.getRequestUrl()
- this.activeName = 'third'
- } else {
- this.$message({
- message: "下发失败",
- type: "warning",
- });
- }
- });
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: "取消下发!",
- });
- });
- },
- },
- };
- </script>
- <style lang="scss">
- .steel_inbound{
- .sache{
- padding: 1.25rem 0.375rem;
- .el-input {
- width: 20%;
- margin-right: 1.25rem;
- }
- }
- }
- </style>
|