123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 |
- // 内转钢坯界面,留作备用
- <template>
- <div class="inwardRequirement">
- <div class="sache">
- <el-input placeholder="请输入内容" v-model="inputText" clearable>
- </el-input>
- <span>需求时间:</span>
- <el-date-picker
- v-model="startTime"
- type="datetime"
- placeholder="选择日期"
- style="width:220px"
- >
- </el-date-picker>
- <span>至</span>
- <el-date-picker
- v-model="endTime"
- type="datetime"
- placeholder="选择日期"
- style="width:220px"
- >
- </el-date-picker>
- <el-button type="primary" class="btn" @click="onclick">
- <i class="el-icon-search"></i>查询
- </el-button>
- <el-button
- type="primary"
- class="btn"
- @click="toInsert2"
- v-if="activeName == 'first'"
- >
- <i class="el-icon-plus"></i>新增
- </el-button>
- </div>
- <template>
- <div>
- <el-tabs v-model="activeName" @tab-click="handleClick">
- <el-tab-pane label="未下发" name="first">
- <mergeRowTable
- v-bind.sync="first"
- @selection-change="selectionChange"
- ref="table"
- >
- <el-table-column fixed="right" label="操作" width="80">
- <template slot-scope="scope">
- <el-button
- type="text"
- size="mini"
- @click="deleteRequirement(scope)"
- >
- 删除
- </el-button>
- </template>
- </el-table-column>
- </mergeRowTable>
- </el-tab-pane>
- <el-tab-pane label="已下发" name="second">
- <mergeRowTable
- v-bind.sync="second"
- ref="table1"
- :isPagination="false"
- :pageSize="2000"
- >
- <el-table-column fixed="right" label="操作" width="80">
- <template slot-scope="scope">
- <el-button
- type="text"
- size="mini"
- @click="getRequirementOrder(scope)"
- >运单</el-button
- >
- </template>
- </el-table-column>
- </mergeRowTable>
- </el-tab-pane>
- </el-tabs>
- </div>
- </template>
- </div>
- </template>
- <script>
- import { getCookie } from "@/utils/util.js";
- import { sjTime } from "@/utils/sharedJsFile";
- export default {
- data() {
- return {
- inputText: null,
- orgCode: "",
- startTime: null,
- endTime: null,
- first: {
- // first请求数据的地址
- requestUrl: "",
- selectionType: "select",
- columnIndexs:[0,1,2,6,7,8,9,22],
- comparison: "requirementNumber",
- mapList: []
- },
- second: {
- columnIndexs:[0,1,5,6,7,8,9,21],
- comparison: "requirementNumber",
- // second请求数据的地址
- requestUrl: ""
- },
- tableData: [],
- tableData1: [
- {
- materialCount: 100
- }
- ],
- activeName: "first"
- };
- },
- created() {
- if (
- getCookie("orgCode") == "dagangadmin" ||
- getCookie("orgCode") == "zidonghuabu"
- ) {
- this.first.requestUrl =
- "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=0";
- this.second.requestUrl =
- "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=1";
- } else {
- this.first.requestUrl =
- "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=0&orgCode=" +
- getCookie("orgCode");
- this.second.requestUrl =
- "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=1&orgCode=" +
- getCookie("orgCode");
- }
- },
- mounted() {},
- methods: {
- onclick() {
- let orgCode = null;
- let startTime = null;
- let endTime = null;
- if (this.startTime && this.endTime) {
- startTime = sjTime(this.startTime);
- endTime = sjTime(this.endTime);
- }
- if (
- getCookie("orgCode") != "dagangadmin" &&
- getCookie("orgCode") != "zidonghuabu"
- ) {
- orgCode = getCookie("orgCode");
- }
- if (this.activeName == "first") {
- this.first.requestUrl =
- "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=0&orgCode=" +
- orgCode +
- "&index=" +
- this.inputText +
- "&startTime=" +
- startTime +
- "&endTime=" +
- endTime +
- "&i=" +
- new Date();
- } else {
- this.second.requestUrl =
- "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=1&orgCode=" +
- orgCode +
- "&index=" +
- this.inputText +
- "&startTime=" +
- startTime +
- "&endTime=" +
- endTime +
- "&i=" +
- new Date();
- }
- },
- //查看需求下面的运单
- getRequirementOrder(scope) {
- this.$router.push("/getRequirementOrder/" + scope.row.requirementId);
- },
- handleClick(tab, event) {
- this.getRequestUrl();
- },
- getRequestUrl() {
- if (
- getCookie("orgCode") == "dagangadmin" ||
- getCookie("orgCode") == "zidonghuabu"
- ) {
- this.first.requestUrl =
- "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=0&i=" +
- new Date();
- this.second.requestUrl =
- "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=1&i=" +
- new Date();
- } else {
- this.first.requestUrl =
- "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=0&orgCode=" +
- getCookie("orgCode") +
- "&i=" +
- new Date();
- this.second.requestUrl =
- "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=1&orgCode=" +
- getCookie("orgCode") +
- "&i=" +
- new Date();
- }
- },
- selectionChange(selection) {
- this.first.mapList = selection;
- },
- toInsert2() {
- this.$router.push("/addInwardBillet");
- },
- updateRequirement(scope) {
- this.$router.push("/updateRequirement/" + scope.row.requirementId);
- },
- deleteRequirement(scope) {
- this.$confirm("是否删除", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- center: true
- })
- .then(() => {
- this.axios
- .post(
- "/api/v1/ams/deleteTruckRequirement/" + scope.row.requirementId
- )
- .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() {
- console.log(this.first.mapList);
- if (this.first.mapList.length == 0) {
- this.$message.warning("请选择需求");
- return;
- }
- // 权限控制,判断用户是否属于轧钢厂下面的车间
- this.$confirm("是否下发", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- center: true
- })
- .then(() => {
- this.axios
- .post("/api/v1/ams/downRequirement", this.first.mapList)
- .then(res => {
- if (res.data.code == 200) {
- this.$message({
- type: "success",
- message: "下发成功!"
- });
- this.getRequestUrl();
- this.activeName = "second";
- } else {
- this.$message({
- message: "下发失败",
- type: "warning"
- });
- }
- });
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: "取消下发!"
- });
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .inwardRequirement {
- margin-top: 20px;
- margin-left: 20px;
- .sache {
- margin-top: 30px;
- padding-bottom: 10px;
- .el-input {
- width: 20%;
- }
- }
- }
- </style>
|