123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354 |
- <template>
- <div class="newApply pagePadding">
- <div
- v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
- >
- <div class="box">
- <CompanySearch @searchCard="handClick"></CompanySearch>
- <StockSearch :companyName="company"></StockSearch>
- </div>
- <NewApply :myType="type"></NewApply>
- <InStock :myType="type" v-if="type != 1"></InStock>
- <GoStock :myType="type" v-if="type != 1 && type != 2"></GoStock>
- <InStockCheck
- :myType="type"
- v-if="type != 1 && type != 2 && type != 3"
- ></InStockCheck>
- <CheckStock :myType="type" v-if="type === 5"></CheckStock>
- <!-- <el-col :span="24" style="text-align: right; margin-top: 10px">
- <el-button type="primary" @click="save">保 存 </el-button>
- <el-button type="warning" @click="submitForm"
- >保 存 并 发 起 流 程
- </el-button>
- </el-col> -->
- <add-edit
- :id="modelId"
- :sitem="sitem"
- :show-model="showModel"
- :is-detail="isDetail"
- @refresh="searchList"
- @cancel="showModel = false"
- />
- </div>
- <div v-else>
- <no-auth></no-auth>
- </div>
- </div>
- </template>
- <script>
- import mixinPage from "@/mixins/elPaginationHandle";
- import resToken from "@/mixins/resToken";
- import ExTable from "@/components/ExTableNew.vue";
- import statusList from "@/assets/js/statusList";
- // import asyncRequest from "@/apis/service/stock/newApply";
- import asyncRequest from "@/mock/service/stock/newApply";
- import addEdit from "./addEdit";
- import { mapGetters } from "vuex";
- import NewApply from "./components/newApply"; //新建申请页面
- import InStock from "./components/inStock-audit.vue"; //入库方审核界面
- import GoStock from "./components//goStock-audit.vue"; //出库方发货
- import InStockCheck from "./components/inStock-check.vue"; //入库方验货
- import CheckStock from "./components/checkStock.vue"; //验货审核
- import StockSearch from "./components/stockSearch.vue";
- import CompanySearch from "./components/companySearch.vue";
- export default {
- name: "newApply",
- mixins: [mixinPage, resToken],
- components: {
- addEdit,
- ExTable,
- NewApply,
- InStock,
- GoStock,
- InStockCheck,
- CheckStock,
- StockSearch,
- CompanySearch,
- },
- computed: {
- ...mapGetters(["tablebtnSize", "searchSize", "size"]),
- powers() {
- let tran =
- this.$store.getters.btnList.find(
- (item) => item.menu_route == "allotFlow"
- ) || {};
- if (tran && tran.action && tran.action.length > 0) {
- return tran.action;
- } else {
- return [];
- }
- },
- },
- data() {
- return {
- company: "",
- type: 1, //假数据,用于表示后台的操作流程节点
- /**
- * type=1,那么表示当前是新建申请流程,只显示新建申请组件。newApply
- * type=2,入库方审核流程 inStock-audit
- * type=3,出库方发货流程 goStock-audit
- * type=4,入库方验货流程 inStock-check
- * type=5,验货审核流程 checkStock
- *
- */
- selectStock_in: "", //选择的入库仓库名称
- selectStock_go: "", //选择的出库仓库名称
- stock_go: "", //出库仓库name
- stock_in: "", //入库仓库name
- options: [], //用于渲染二级仓库名
- ruleForm: {},
- rules: {
- //出入库规则
- stock_go_rule: [
- {
- required: true,
- message: "请选择出库仓库",
- trigger: "blur",
- },
- ],
- stock_in_rule: [
- {
- required: true,
- message: "请选择入库仓库",
- trigger: "blur",
- },
- ],
- },
- loading: true,
- showModel: false,
- isDetail: false,
- modelId: 0,
- tableData: [], //渲染表格
- //
- // 表格 - 数据
- tableData: [],
- // 表格 - 参数
- table: {
- stripe: true,
- border: true,
- _defaultHeader_: ["setcol"],
- },
- // 表格 - 分页
- pageInfo: {
- size: 15,
- curr: 1,
- total: 0,
- },
- // 表格 - 列参数
- columns: [
- {
- prop: "nickname",
- label: "商品编号",
- },
- {
- prop: "role_name",
- label: "商品名称",
- },
- {
- prop: "mobile",
- label: "数量",
- },
- {
- prop: "",
- label: "操作",
- fixed: "right",
- _noset_: true,
- _slot_: "operation",
- },
- ],
- // sitem: null,
- // // 状态
- // statusOptions: [
- // { id: "0", label: "禁用" },
- // { id: "1", label: "启用" },
- // ],
- parmValue: {
- //入参
- // name: "", // 业务员名字
- // username: "", // 账号
- // status: "", //
- // page: 1, // 页码
- // size: 15, // 每页显示条数
- },
- // passwordModel: false,
- // passwordModelId: 0,
- // isPasswordDetail: false,
- // statusList: statusList,
- };
- },
- mounted() {
- this.searchList();
- this.stockName(); //假数据,获取二级仓库名
- },
- methods: {
- handClick(value) {
- console.log("执行子组件事件", value);
- this.company = value;
- },
- restSearch() {
- //重置入参
- this.parmValue = {
- // name: "", // 业务员名字
- // username: "", // 账号
- // status: "", //
- // page: 1, // 页码
- // size: 10, // 每页显示条数
- };
- this.searchList();
- },
- openModal(id, isDetail, sitem) {
- this.showModel = true;
- this.modelId = id;
- this.isDetail = isDetail;
- this.sitem = sitem;
- },
- async deleteById(id, status) {
- // await this.$confirm("确定要删除?", {
- // confirmButtonText: "确定",
- // cancelButtonText: "取消",
- // type: "warning",
- // })
- // .then(async () => {
- // const model = {
- // id: id,
- // status: status === "1" ? "0" : "1",
- // };
- // const res = await asyncRequest.status(model);
- // if (res && res.code === 0) {
- // this.$notify.success({
- // title: "删除成功",
- // message: "",
- // });
- // this.searchList();
- // } else if (res && res.code >= 100 && res.code <= 104) {
- // await this.logout();
- // } else {
- // this.$message.warning(res.message);
- // }
- // })
- // .catch(() => {
- // console.log("取消");
- // });
- },
- async searchList() {
- // this.loading = true;
- // const res = await asyncRequest.list(this.parmValue);
- // if (res && res.code === 0 && res.data) {
- // this.tableData = res.data.list;
- // this.pageInfo.total = Number(res.data.count);
- // } else if (res && res.code >= 100 && res.code <= 104) {
- // await this.logout();
- // } else {
- // this.tableData = [];
- // this.pageInfo.total = 0;
- // }
- // this.loading = false;
- },
- async statusConfirm(id, status) {
- // let str = status === "1" ? "禁用" : "启用";
- // await this.$confirm("确定要改为" + str + "?", {
- // confirmButtonText: "确定",
- // cancelButtonText: "取消",
- // type: "warning",
- // })
- // .then(async () => {
- // this.loading = true;
- // const model = {
- // id: id,
- // status: status === "1" ? "0" : "1",
- // };
- // const res = await asyncRequest.status(model);
- // if (res && res.code === 0) {
- // this.loading = false;
- // this.$notify.success({
- // title: "状态修改成功!",
- // message: "",
- // });
- // await this.searchList();
- // } else if (res && res.code >= 100 && res.code <= 104) {
- // await this.logout();
- // } else {
- // this.$message.warning(res.message);
- // }
- // })
- // .catch(() => {
- // console.log("取消");
- // });
- },
- async stockName() {
- //获取多级仓库名称的方法
- const res = await asyncRequest.listAll(this.parmValue);
- // console.log(res.data);
- // this.openModal("005", true);
- // console.log(this.selectStock_go);
- // console.log(this.selectStock_in);
- // this.options = res.data;
- // console.log(this.options);
- let arr = res.data;
- // console.log(arr);
- arr.forEach((ele) => {
- //重新封装后台传递来的数据,转换格式
- let item = {
- value: ele.id,
- label: ele.name,
- children: [],
- };
- ele.child.forEach((elem) => {
- let model = {
- value: elem.id,
- label: elem.name,
- };
- item.children.push(model);
- });
- this.options.push(item);
- });
- this.options.forEach((ele) => {
- //从数据表中筛选出我们要用的数据
- if (ele.value === this.selectStock_go[0]) {
- ele.children.forEach((elem) => {
- if (elem.value === this.selectStock_go[1]) {
- this.stock_go = ele.label + "/" + elem.label;
- }
- });
- }
- if (ele.value === this.selectStock_in[0]) {
- ele.children.forEach((elem) => {
- if (elem.value === this.selectStock_in[1]) {
- this.stock_in = ele.label + "/" + elem.label;
- }
- });
- }
- });
- if (this.selectStock_in != "" || this.selectStock_go != "") {
- console.log("选择了一个项目");
- this.openModal("005", true);
- }
- // console.log(this.stock_go);
- // console.log(this.stock_in);
- // console.log(this.pageInfo.total);
- this.compareStock(); //比较出库仓库和入库仓库是否相同
- },
- compareStock() {
- // //比较出库仓库和入库仓库是否相同
- // if (
- // this.stock_go === this.stock_in &&
- // this.stock_go !== "" &&
- // this.stock_go != ""
- // ) {
- // console.log("出库仓库和入库仓库相同");
- // this.$message({
- // message: "出库仓库不能和入库仓库相同",
- // type: "error",
- // });
- // }
- },
- },
- };
- </script>
- <style lang="scss" >
- </style>
-
|