123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536 |
- <template>
- <div>
- <basic-container v-show="!detailsOpen">
- <avue-crud :option="option" :search.sync="search" v-model="form" :table-loading="loading" :data="dataList"
- ref="crud" :key="key" @on-load="onLoad" @search-change="searchChange" @row-del="rowDel"
- @refresh-change="refreshChange" @expand-change="expandChange"
- @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 270)"
- @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 270)" :page.sync="page">
- <template slot-scope="{ row }" slot="expand">
- <avue-crud :data="row.itemData" :option="itemOption" :table-loading="row.itemLoading" :cell-style="cellStyle"
- class="itemTable"></avue-crud>
- </template>
- <template slot-scope="{type,size,row,index}" slot="menu">
- <!-- <el-button :size="size" :type="type" @click="check(row)">查看</el-button> -->
- <el-button :size="size" :type="type" :disabled="row.item >= 1"
- @click="$refs.crud.rowDel(row, index)">删除</el-button>
- </template>
- <!-- <template slot-scope="{type,size,row,$index}" slot="menuLeft"> -->
- <!-- <el-button icon="el-icon-plus" type="primary" :size="size" @click="detailsOpen = true">新采购单</el-button> -->
- <!--<el-button type="warning" icon="el-icon-download" size="small" @click="outExport">导出</el-button>-->
- <!-- </template> -->
- <template slot-scope="{row,index}" slot="stockClerkName">
- <el-select placeholder="请选择" v-if="row.$cellEdit" v-model="row.stockClerkName" size="small" filterable
- allow-create default-first-option clearable>
- <el-option v-for="item in stockClerkNameList" :key="item" :label="item.account"
- :value="item.account"></el-option>
- </el-select>
- <span v-else>{{ row.stockClerkName }}</span>
- </template>
- <template slot-scope="{type,size,row,$index}" slot="customerId">
- <span>{{ row.customerName }}</span>
- </template>
- <template slot-scope="{ row, index }" slot="billno">
- <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 1)">{{ row.billno }}
- </span>
- </template>
- <template slot-scope="{ row, index }" slot="ordNo">
- <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 2)">{{ row.ordNo }}
- </span>
- </template>
- </avue-crud>
- </basic-container>
- <detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>
- </div>
- </template>
- <script>
- import { customerListAll } from "@/api/tirePartsMall/basicData/warehouse"
- import { getList, remove, getWarehouseKeeper, getGoodsInfo } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
- import detailsPage from "./detailsPage.vue"
- import { dateFormat } from '@/util/date'
- import { getDetails } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
- import {corpsDescListAll} from "@/api/tirePartsMall/salesManagement/saleOrder";
- export default {
- name: "index",
- components: {
- detailsPage
- },
- data() {
- return {
- detailsOpen: false,
- salesCompanyId: '',
- storageNameList: [],
- stockClerkNameList: [],
- loading: false,
- search: {
- statusName:'待入库'
- },
- form: {},
- dataList: [],
- detailData: {},
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
- },
- key: 0,
- itemOption: {
- align: "center",
- header: false,
- border: true,
- menu: false,
- column: [
- {
- label: '商品名称',
- prop: 'goodsId',
- width: 200,
- overHidden: true,
- disabled: false,
- filterable: true,
- type: 'select',
- props: {
- label: 'cname',
- value: 'id'
- },
- dicUrl: '/api/blade-sales-part/goodsDesc/goodsListAll'
- },
- {
- label: "实际数量",
- prop: "sendNum",
- disabled: false,
- overHidden: true,
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- }, {
- label: "批次号",
- prop: "dot",
- type: "select",
- disabled: false,
- allowCreate: true,
- filterable: true,
- dicData: [],
- props: {
- label: "dot",
- value: "dot"
- },
- overHidden: true
- }, {
- label: '物料编码',
- prop: 'goodsNo',
- overHidden: true,
- disabled: false,
- width: 140
- }, {
- label: "品牌",
- prop: 'brandId',
- width: 100,
- overHidden: true,
- disabled: false,
- type: 'select',
- props: {
- label: 'cname',
- value: 'id'
- },
- dicUrl: '/api/blade-sales-part/brandDesc/listAll?type=PP&enableOrNot=1'
- }, {
- label: "规格型号",
- prop: "propertyName",
- overHidden: true,
- disabled: false,
- }, {
- label: "花纹",
- prop: "pattern",
- disabled: false,
- overHidden: true
- }, {
- label: "入库数量",
- prop: "goodsNum",
- disabled: true,
- ovrHidden: true,
- }, {
- label: "商品描述",
- prop: "goodsDescription",
- disabled: false,
- overHidden: true
- },
- ]
- },
- option: {},
- optionList: {
- viewBtn: false,
- editBtn: false,
- delBtn: false,
- addBtn: false,
- index: true,
- span: 8,
- border: true,
- height: "auto",
- searchMenuPosition: "right",
- align: "center",
- size: "small",
- menuWidth: 50,
- searchSpan: 8,
- searchIcon: true,
- searchIndex: 2,
- highlightCurrentRow: true,
- expand: true,
- expandWidth: 60,
- dialogWidth: "70%",
- summaryText: "合计",
- showSummary: true,
- sumColumnList: [{
- name: "goodsTotalNum",
- type: "sum",
- decimals: 0
- }],
- column: [{
- label: "入库单号",
- prop: "billno",
- // billno
- search: true,
- overHidden: true,
- // width: 120,
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ]
- }, {
- label: "来源单号",
- prop: "ordNo",
- search: true,
- overHidden: true,
- // width: 120,
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ]
- }, {
- label: "业务对象",
- prop: "customerId",
- search: true,
- overHidden: true,
- type: 'select',
- props: {
- label: 'cname',
- value: 'id'
- },
- dicData: [],
- // dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=GYS',
- }, {
- label: "仓库",
- prop: "storageName",
- // searchProp:"storageId",
- // searchProp: "createUser",
- search: true,
- overHidden: true,
- // width: 120,
- type: 'select',
- dicUrl: "/api/blade-sales-part/storageDesc/listAll",
- props: {
- label: 'cname',
- value: 'id'
- },
- // change:(data)=>{
- // console.log(this.$refs.crud.DIC.storageName[0].salesCompanyId);
- // }
- }, {
- label: "订单数量",
- prop: "goodsTotalNum",
- search: false,
- overHidden: true,
- // width: 120,
- }, {
- label: "实际数量",
- prop: "sendTotalNum",
- search: false,
- overHidden: true,
- // width: 120,
- }, {
- label: "状态",
- prop: "statusName",
- search: true,
- overHidden: true,
- type: "select",
- dicData: [{
- label: "待入库",
- value: "待入库"
- }, {
- label: "已入库",
- value: "已入库"
- }, {
- label: "已撤销",
- value: "已撤销"
- }],
- // width: 120,
- }, {
- label: '业务日期',
- prop: "businesDate",
- searchProp: "businesDateList",
- type: "date",
- overHidden: true,
- search: true,
- width: 100,
- searchRange: true,
- searchDefaultTime: ["00:00:00", "23:59:59"],
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss"
- }, {
- label: "库管",
- prop: "stockClerkName",
- search: true,
- overHidden: true,
- type: 'select',
- props: {
- label: 'realName',
- value: 'id'
- },
- dicUrl: '/api/blade-user/stockClerkList',
- // props: {
- // label: 'name',
- // value: 'id'
- // },
- // dicUrl: "/api/blade-user/getWarehouseKeeper?salesCompanyId=" + JSON.parse(localStorage.getItem("saber-userInfo")).content.dept_id,
- // width: 200
- }, {
- label: "制单人",
- prop: "createUserName",
- searchProp: "createUser",
- overHidden: true,
- width: 100,
- filterable: true,
- remote: true,
- type: "select",
- dicUrl: "/api/blade-user/page?size=20¤t=1&account={{key}}",
- props: {
- label: "account",
- value: "id",
- res: 'data.records'
- }
- }, {
- label: "制单日期",
- prop: "createTime",
- searchProp: "createTimeList",
- type: "date",
- overHidden: true,
- width: 100,
- searchRange: true,
- searchDefaultTime: ["00:00:00", "23:59:59"],
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss"
- }, {
- label: "更新人",
- prop: "updateUserName",
- searchProp: "updateUser",
- overHidden: true,
- width: 100,
- filterable: true,
- remote: true,
- type: "select",
- dicUrl: "/api/blade-user/page?size=20¤t=1&account={{key}}",
- props: {
- label: "account",
- value: "id",
- res: 'data.records'
- }
- }, {
- label: "更新日期",
- prop: "updateTime",
- searchProp: "updateTimeList",
- type: "date",
- overHidden: true,
- width: 100,
- searchRange: true,
- searchDefaultTime: ["00:00:00", "23:59:59"],
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss"
- }]
- }
- }
- },
- async created() {
- customerListAll().then((res) => {
- this.storageNameList = res.data.data
- this.salesCompanyId = this.storageNameList[0].salesCompanyId;
- // stockClerkNameList
- getWarehouseKeeper({ salesCompanyId: this.salesCompanyId }).then(res => {
- this.stockClerkNameList = res.data.data;
- })
- })
- this.option = await this.getColumnData(this.getColumnName(274), this.optionList);
- this.key++
- let i = 0;
- this.option.column.forEach(item => {
- if (item.search) i++
- })
- if (i % 3 !== 0) {
- const num = 3 - Number(i % 3)
- this.option.searchMenuSpan = num * 8;
- this.option.searchMenuPosition = "right";
- }
- if (this.$route.query.id) {
- this.detailData = {
- id: this.$route.query.id
- };
- this.detailsOpen = true;
- }
- this.corpsDescListAllfun()
- },
- activated(){
- // if (this.$route.query.id) {
- // this.detailData = {
- // id: this.$route.query.id
- // };
- // this.detailsOpen = true;
- // }
- },
- mounted() {
- // console.log(this.$refs.crud);
- },
- methods: {
- check(row) {
- this.form = row
- this.detailsOpen = true
- },
- backToList(type) {
- this.form = {}
- this.detailsOpen = false
- if (type === 0) {
- this.detailData = {}
- }
- this.onLoad(this.page, this.search)
- // this.$store.commit("DOMIO_OUT_DETAIL");
- },
- //刷新
- refreshChange() {
- this.onLoad(this.page, this.search)
- },
- rowDel(form, index) {
- this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- remove(form.id).then(res => {
- this.$message({
- type: 'success',
- message: '删除成功!'
- });
- this.dataList.splice(index, 1);
- this.onLoad(this.page)
- })
- }).catch(() => {
- });
- },
- searchChange(params, done) {
- this.page.currentPage = 1
- done();
- this.onLoad(this.page, params)
- },
- // 获取业务对象
- corpsDescListAllfun(){
- corpsDescListAll({corpType:'GYS,KH'}).then(res=>{
- this.findObject(this.option.column, "customerId").dicData = res.data.data
- })
- },
- onLoad(page, params = {}) {
- let storageId = this.search.storageName;
- let searchWithoutStorageName = { ...this.search };
- delete searchWithoutStorageName.storageName;
- var obj2 = this.deepClone(this.search)
- params = {
- ...params,
- current: page.currentPage,
- size: page.pageSize,
- bizTypeName: "SHGD,TKSHGD",
- ...Object.assign(params, searchWithoutStorageName),
- storageId: storageId,
- // statusName: this.search.$statusName,
- stockClerkName: this.search.$stockClerkName
- };
- delete params.storageName;
- // delete this.search.storageName
- this.loading = true
- this.dataList.forEach(item => {
- this.$refs.crud.toggleRowExpansion(item, false);
- });
- getList(params).then(res => {
- if (res.data.data.records) {
- res.data.data.records.forEach(e => {
- e.itemLoading = true;
- this.findObject(this.option.column, "customerId").dicData.map(item=>{
- if (e.customerId == item.id) {
- e.customerName = item.cname
- }
- })
- });
- }
- this.dataList = res.data.data.records
- this.page.total = res.data.data.total
- this.$nextTick(() => {
- this.$refs.crud.doLayout()
- })
- this.loading = false
- }).finally(() => {
- this.search=obj2
- this.loading = false
- })
- },
- editOpen(row, status) {
- this.form = row
- this.detailData = {
- id: row.id,
- status: status
- };
- this.detailsOpen = true;
- },
- expandChange(row) {
- if (!row.itemData) {
- getDetails({ id: row.id })
- .then(res => {
- this.dataList[row.$index].itemData = res.data.data.shipItemsList;
- })
- .finally(() => {
- this.dataList[row.$index].itemLoading = false;
- });
- }
- },
- //自定义列保存
- async saveColumnTwo(ref, option, optionBack, code) {
- /**
- * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
- * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
- * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
- */
- const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
- if (inSave) {
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- //自定义列重置
- async resetColumnTwo(ref, option, optionBack, code) {
- this[option] = this[optionBack];
- const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
- if (inSave) {
- this.$message.success("重置成功");
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- }
- }
- }
- </script>
- <style scoped></style>
|