12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019 |
- <template>
- <div>
- <by-bill ref="bill" :propConfig="config" @search="search" @onAdd="onAdd" @onDelete="onDelete" @onRefresh="resert"
- @resert="resert" @detail="openEdit" @onSave="onSave" @clickTab="clickTab" @onChangeRow="onChangeRow"
- @pagination="pagination" @getSupplierModal="getSupplierModal" @getbusinessType="getbusinessType">
- </by-bill>
- <!-- 选择物料 -->
- <productModal ref="product" :mulit="true" @confirm="confirmProduct" />
- </div>
- </template>
- <script lang="ts">
- import { Component, Prop, Vue, Watch } from "vue-property-decorator";
- import api from "@/api/order";
- import productModal from "../orderTask/components/productModal.vue";
- import Focus from "../orderTask/components/focus.vue";
- import towInOne from "./components/towInOne.vue";
- import BusinessType from "./components/businessType.vue";
- @Component({ components: { productModal } })
- export default class OrderTask extends Vue {
- // 左边
- tabType : any = 'all';
- isAdd : any = false
- // 右边
- supplierInfo : any = {} // 机构信息
- businessType : any = '' // 业务类型
- tableData : any = []
- mergeObj : any = []
- setStatusData : any = ''
- timeNum = 0;
- timer : any = null
- config : any = {
- attr: {
- activeName: 'all'
- },
- // 单据
- bill: {
- tool: {
- tools: {
- save: true,
- }
- },
- form: {
- attr: {
- size: 'small',
- readonly: false,
- },
- columns: [
- [
- {
- span: 8,
- label: '单据编号',
- prop: 'orderNumber',
- component: 'by-input',
- compConfig: {
- attr: {
- readonly: true
- },
- }
- },
- {
- span: 8,
- label: '机构名称',
- prop: 'organizationName',
- component: Focus,
- },
- {
- span: 8,
- label: '经办人',
- prop: 'operator',
- component: 'by-input',
- },
- {
- span: 8,
- label: '业务类型',
- prop: 'businessType',
- component: BusinessType,
- },
- {
- span: 8,
- label: '财务系统单据',
- prop: 'financeOrderId',
- component: 'by-input',
- },
- {
- span: 8,
- label: 'WMS编码',
- prop: 'wmsId',
- component: 'by-input',
- },
- ],
- [
- {
- span: 28,
- label: '备注',
- slot: true,
- prop: 'remark',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: '请输入备注',
- type: 'textarea'
- },
- }
- },
- ]
- ]
- },
- tableConfig: [
- {
- tool: {
- tools: {
- add: true
- }
- },
- table: {
- attr: {
- size: 'mini',
- height: 500,
- align: 'center',
- readonly: true
- },
- columns:
- [
- {
- width: 300,
- title: '物料名称',
- field: 'materialName',
- },
- {
- width: 200,
- title: '仓库,仓位',
- field: 'towInOne',
- component: towInOne,
- compConfig: {
- isSelect: true
- }
- },
- {
- width: 110,
- title: '单位',
- field: 'unit',
- },
- {
- width: 110,
- title: '数量',
- field: 'number',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- type: 'integer',
- defaultValue: 1,
- },
- }
- },
- {
- width: 110,
- title: '已交付数量',
- field: 'deliveryNumber',
- },
- {
- width: 110,
- title: '单价',
- field: 'unitPrice',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- type: 'number',
- },
- }
- },
- {
- width: 110,
- title: '合计金额',
- field: 'totalPrice',
- },
- {
- width: 90,
- title: '操作',
- action: true,
- plugins: [{
- icon: 'el-icon-delete',
- name: '删除',
- audit: '',
- event: {
- click: (item : any) => {
- (this as any).changeTable(item)
- }
- }
- }]
- },
- ]
- }
- }
- ]
- },
- // 已提交
- smt: {
- search: {
- attr: {
- size: 'mini',
- },
- columns: [
- [
- {
- span: 6,
- label: '单据编号',
- prop: 'orderNumber',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入单据编号',
- clearable: true
- }
- }
- },
- {
- span: 6,
- label: '机构名称',
- prop: 'organizationName',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入机构名称',
- clearable: true
- },
- },
- },
- {
- span: 6,
- label: '财务系统单据',
- prop: 'financeOrderId',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入财务系统单据',
- clearable: true
- },
- },
- },
- ],
- ]
- },
- tool: {
- tools: {
- delete: true,
- search: true,
- refresh: true
- }
- },
- table: {
- attr: {
- height: 620,
- size: 'mini',
- seq: true,
- align: 'left',
- checkbox: true
- },
- columns: [
- {
- width: 200,
- title: '单据编号',
- field: 'orderNumber',
- isDetail: true,
- fixed: 'left'
- },
- {
- width: 200,
- title: '机构名称',
- field: 'organizationName',
- },
- {
- width: 200,
- title: '财务系统单据',
- field: 'financeOrderId',
- },
- {
- width: 200,
- title: 'WMS编号',
- field: 'wmsId',
- },
- {
- width: 120,
- title: '经办人',
- field: 'operator',
- },
- {
- width: 250,
- title: '备注',
- field: 'remark',
- },
- {
- width: 110,
- title: '操作',
- action: true,
- plugins: [{
- icon: 'el-icon-edit',
- name: '编辑',
- audit: '',
- event: {
- click: (e : any) => {
- (this as any).setReadonly(e)
- }
- }
- }, {
- name: '删除',
- event: {
- click: (item : any) => (this as any).doDelete2(item)
- }
- }]
- }
- ]
- }
- },
- // 草稿箱
- draftsBox: {
- search: {
- attr: {
- size: 'mini',
- },
- columns: [
- [
- {
- span: 6,
- label: '单据编号',
- prop: 'orderNumber',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入单据编号',
- clearable: true
- }
- }
- },
- {
- span: 6,
- label: '机构名称',
- prop: 'organizationName',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入机构名称',
- clearable: true
- },
- },
- },
- {
- span: 6,
- label: '财务系统单据',
- prop: 'financeOrderId',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入财务系统单据',
- clearable: true
- },
- },
- },
- ],
- ]
- },
- tool: {
- tools: {
- smt: true,
- delete: true,
- search: true,
- refresh: true
- }
- },
- table: {
- attr: {
- height: 620,
- size: 'mini',
- seq: true,
- align: 'left',
- checkbox: true
- },
- columns: [
- {
- width: 200,
- title: '单据编号',
- field: 'orderNumber',
- isDetail: true,
- fixed: 'left'
- },
- {
- width: 200,
- title: '机构名称',
- field: 'organizationName',
- },
- {
- width: 200,
- title: '财务系统单据',
- field: 'financeOrderId',
- },
- {
- width: 200,
- title: 'WMS编号',
- field: 'wmsId',
- },
- {
- width: 120,
- title: '经办人',
- field: 'operator',
- },
- {
- width: 250,
- title: '备注',
- field: 'remark',
- },
- {
- width: 110,
- title: '操作',
- action: true,
- plugins: [{
- icon: 'el-icon-edit',
- name: '编辑',
- audit: '',
- event: {
- click: (e : any) => {
- (this as any).openEdit(e)
- }
- }
- }, {
- name: '删除',
- event: {
- click: (item : any) => (this as any).doDelete2(item)
- }
- }]
- }
- ]
- }
- },
- // 综合
- all: {
- search: {
- attr: {
- size: 'mini',
- },
- columns: [
- [
- {
- span: 6,
- label: '单据编号',
- prop: 'orderNumber',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入单据编号',
- clearable: true
- }
- }
- },
- {
- span: 6,
- label: '机构名称',
- prop: 'organizationName',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入机构名称',
- clearable: true
- },
- },
- },
- {
- span: 6,
- label: '财务系统单据',
- prop: 'financeOrderId',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入财务系统单据',
- clearable: true
- },
- },
- },
- ],
- ]
- },
- tool: {
- tools: {
- add: true,
- delete: true,
- search: true,
- refresh: true
- }
- },
- table: {
- attr: {
- height: 620,
- size: 'mini',
- seq: true,
- align: 'left',
- checkbox: true
- },
- columns: [
- {
- width: 200,
- title: '单据编号',
- field: 'orderNumber',
- isDetail: true,
- fixed: 'left'
- },
- {
- width: 200,
- title: '机构名称',
- field: 'organizationName',
- },
- {
- width: 200,
- title: '财务系统单据',
- field: 'financeOrderId',
- },
- {
- width: 200,
- title: 'WMS编号',
- field: 'wmsId',
- },
- {
- width: 120,
- title: '经办人',
- field: 'operator',
- },
- {
- width: 250,
- title: '备注',
- field: 'remark',
- },
- {
- width: 120,
- title: '操作',
- action: true,
- plugins: [{
- icon: 'el-icon-edit',
- name: '编辑',
- audit: '',
- event: {
- click: (e : any) => {
- (this as any).openEdit(e)
- }
- }
- }, {
- name: '删除',
- event: {
- click: (item : any) => (this as any).doDelete2(item)
- }
- }]
- }
- ]
- }
- },
- // 回收站
- recycleBin: {
- search: {
- attr: {
- size: 'mini',
- },
- columns: [
- [
- {
- span: 6,
- label: '单据编号',
- prop: 'orderNumber',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入单据编号',
- clearable: true
- }
- }
- },
- {
- span: 6,
- label: '机构名称',
- prop: 'organizationName',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入机构名称',
- clearable: true
- },
- },
- },
- {
- span: 6,
- label: '财务系统单据',
- prop: 'financeOrderId',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入财务系统单据',
- clearable: true
- },
- },
- },
- ],
- ]
- },
- tool: {
- tools: {
- search: true,
- refresh: true
- }
- },
- table: {
- attr: {
- height: 620,
- size: 'mini',
- seq: true,
- align: 'left',
- checkbox: true
- },
- columns: [
- {
- width: 200,
- title: '单据编号',
- field: 'orderNumber',
- isDetail: true,
- fixed: 'left'
- },
- {
- width: 200,
- title: '机构名称',
- field: 'organizationName',
- },
- {
- width: 200,
- title: '财务系统单据',
- field: 'financeOrderId',
- },
- {
- width: 200,
- title: 'WMS编号',
- field: 'wmsId',
- },
- {
- width: 120,
- title: '经办人',
- field: 'operator',
- },
- {
- width: 250,
- title: '备注',
- field: 'remark',
- },
- {
- width: 110,
- title: '操作',
- action: true,
- plugins: [{
- // icon: 'el-icon-edit',
- name: '查看',
- audit: '',
- event: {
- click: (e : any) => {
- (this as any).setReadonly(e)
- }
- }
- }]
- }
- ]
- }
- }
- }
- created() {
- this.timer = setInterval(() => {
- this.getDataList()
- }, 500)
- }
- // 获取机构数据
- getSupplierModal(e : any) {
- this.supplierInfo = e;
- }
- // 获取业务类型
- getbusinessType(e : any) {
- console.log(e);
- this.businessType = e;
- }
- // 监听表格数据变化
- onChangeRow(e : any) {
- e.totalPrice = parseFloat((e.number * e.unitPrice).toFixed(2));
- }
- // 确定商品新增
- confirmProduct(e : any) {
- let contents : any = [], goodsData = e, newArr : any = [], obj : any = {};
- goodsData = goodsData.map((item : any) => {
- item.materialName = item.skuTitle
- item.prePrice = 0
- // item.materialId = item.materialId
- item.unitPrice = item.price
- item.materialSku = item.id
- const { id, ...newData } = item
- // const { skuTitle, price, id, materialId, ...newData } = item
- return newData
- })
- this.tableData = this.tableData.concat(goodsData);
- newArr = this.tableData.reduce((prev : any, current : any) => {
- // console.log('prev ==> ', prev);
- // console.log('current ==> ', current);
- obj[current.materialSku] ? contents.push(current.materialName) : (obj[current.materialSku] = true && prev.push(current))
- return prev
- }, []);
- this.tableData = newArr;
- this.tableData.map((v : any, i : any) => {
- v.dataIndex = i
- if (!v.prePrice) v.prePrice = '0';
- });
- if (contents.length > 0) {
- this.$alert('商品 “' + contents + '” 已存在!', '提示', {
- confirmButtonText: '确定',
- });
- };
- (this.$refs.bill as any).setBillTableValue(this.tableData, 0);// 设置第1张单据表格数据
- }
- // 保存
- onSave(e : any) {
- // console.log('保存 ==>', this.tabType);
- (this as any).$refs.bill.$refs.billForm.validate().then(() => {
- let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
- // 供应商数据
- if (!query.organizationName) query.organizationName = this.supplierInfo.name;
- if (!query.organizationId) query.organizationId = this.supplierInfo.id;
- if (!query.businessType) query.businessType = this.businessType;
- if (!query.organizationName) return this.$message.warning('请选择机构名称');
- if (!query.businessType) return this.$message.warning('请选择业务类型');
- // 子表数据
- query.suborderList = this.tableData;
- if (query.suborderList.length > 0) {
- for (let v of query.suborderList) {
- if (!v.number || v.number <= 0) return this.$message.warning('请输入正确物料数量');
- if (!v.unitPrice || v.unitPrice <= 0) return this.$message.warning('请输入正确物料单价');
- if (v.prePrice.length <= 0 || v.prePrice < 0) return this.$message.warning('请输入正确优惠金额');
- if (query.id) v.taskOrderId = query.id;
- v.storehouseName = '我是仓库';
- v.storehouseId = 2;
- v.storingLocationName = '我是仓位';
- v.storingLocationId = 4;
- }
- };
- // 表格删除
- query.suborderList.map((v : any, i : any) => {
- if (v.isDeleted === 1 && !v.id) {
- query.suborderList.splice(i, 1)
- }
- });
- console.log('保存参数query ==> ', query);
- if (this.isAdd) {
- api.saveList(query, 'supplyEntryOrder').then((res : any) => {
- if (res.code === 200) {
- this.$message.success(res.msg);
- this.getDataList();
- (this.$refs.bill as any).showTab = 'all';
- (this.$refs.bill as any).setBillFormValue({});
- } else this.$message.error(res.msg);
- })
- } else if (this.tabType === 'all' || this.tabType === 'draftsBox') {
- if (this.tabType === 'draftsBox') query.submitState = 0;
- console.log('保存 ==>', query);
- api.updateList(query, 'supplyEntryOrder').then((res : any) => {
- if (res.code === 200) {
- this.$message.success(res.msg);
- this.getDataList();
- (this.$refs.bill as any).showTab = 'all';
- (this.$refs.bill as any).setBillFormValue({});
- } else this.$message.error(res.msg);
- })
- };
- })
- }
- // 打开新增
- onAdd(e : any) {
- console.log('新增 ==>', e);
- if (e === 'billTable_0') {
- (this.$refs.product as any).setShow(true); // 打开sku弹窗
- let obj = (this.$refs.bill as any).getBillFormValue();
- if (!this.tableData) this.tableData = obj.suborderList;
- console.log('this.tableData ==> ', this.tableData);
- (this.$refs.bill as any).setBillTableValue(this.tableData, 0);// 设置第1张单据表格数据
- } else {
- let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
- billConfig.form.attr.readonly = false; // 设置只读
- billConfig.tool.tools = { save: true, };
- if (e === 'all') {
- billConfig.tool.tools = { save: true, smt: true };
- this.tableData = [];
- (this.$refs.bill as any).setBillTableValue(this.tableData, 0);// 设置第1张单据表格数据
- }
- billConfig.tableConfig[0].tool.tools = { add: true };
- this.isAdd = true;
- (this.$refs.bill as any).setBillConfig(billConfig);
- (this.$refs.bill as any).setBillFormValue({}); // 设置单据表单数据
- };
- (this.$refs.bill as any).showTab = 'bill';
- }
- // 打开编辑
- openEdit(e : any) {
- console.log('编辑this.tabType ==>', this.tabType);
- if (this.tabType === 'all' || this.tabType === 'draftsBox') {
- e = e.row ? e.row : e;
- console.log('编辑 ==>', e);
- if (this.tabType === 'all' && e.submitState === 1) return this.setReadonly(e);
- let data = e.suborderList
- data.map((v : any, i : any) => {
- v.dataIndex = i;
- if (!v.prePrice) v.prePrice = '0';
- v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
- });
- let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
- if (billConfig.tableConfig[0].table.columns.at(-1).title != '操作') {
- billConfig.tableConfig[0].table.columns.push({
- width: 90,
- title: '操作',
- action: true,
- plugins: [{
- icon: 'el-icon-delete',
- name: '删除',
- audit: '',
- event: {
- click: (item : any) => {
- (this as any).changeTable(item)
- }
- }
- }]
- })
- };
- billConfig.form.attr.readonly = false; // 设置只读
- billConfig.tool.tools = { save: true, };
- if (this.tabType === 'draftsBox' || e.submitState === 0) billConfig.tool.tools = { save: true, smt: true };
- billConfig.tableConfig[0].tool.tools = { add: true };
- this.tableData = data;
- (this.$refs.bill as any).setBillConfig(billConfig);
- (this.$refs.bill as any).setBillFormValue(e);// 设置单据表单数据
- (this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
- this.isAdd = false;
- (this.$refs.bill as any).showTab = 'bill';
- } else {
- this.setReadonly(e.row ? e.row : e);
- };
- }
- // 设置只读
- setReadonly(e : any) {
- let readonly = (this as any).$lodash.cloneDeep(this.config.bill);
- readonly.form.attr.readonly = true; // 设置只读
- readonly.tool.tools = {};
- readonly.tableConfig[0].table.columns = readonly.tableConfig[0].table.columns.filter((v : any) => v.title != '操作');
- readonly.tableConfig[0].tool.tools = {};
- console.log(readonly.tableConfig[0].table.columns.slice(0, -1));
- let data = e.suborderList;
- (this.$refs.bill as any).setBillConfig(readonly);
- (this.$refs.bill as any).setBillFormValue(e);// 设置单据表单数据
- (this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
- this.isAdd = false;
- (this.$refs.bill as any).showTab = 'bill';
- }
- // 切换tab栏
- clickTab(e : any) {
- console.log('切换tab ==> ', e);
- this.tabType = e;
- // submitState: 提交状态
- if (e === 'all') this.getPageList({ pageSize: 10, pageNo: 1 }, 'all'); // 草稿箱数据
- if (e === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
- if (e === 'smt') this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
- if (e === 'recycleBin') this.getSelectDeleteList({ pageNo: 1, pageSize: 10 }); // 回收站数据
- }
- // 初始化
- getDataList() {
- if (!this.$refs.bill) {
- if (this.timeNum > 5) {
- clearInterval(this.timer)
- }
- this.timeNum++;
- return
- }
- clearInterval(this.timer)
- this.getPageList({ pageSize: 10, pageNo: 1 }, 'all'); // 综合数据
- }
- // 分页
- pagination(e : any) {
- console.log('分页 ==> ', e);
- let query : any = (this as any).$refs.bill.getSearchValue(e.type);
- query.pageNo = e.page.pageNum;
- query.pageSize = e.page.pageSize;
- let loading = this.$loading({ target: '.main-container' });
- if (e.type === 'recycleBin') {
- api.selectDeleteList(query, 'supplyEntryOrder').then((res : any) => {
- if (res.code === 200) {
- (this.$refs.bill as any).setTabTableValue('recycleBin', res.data.records);
- loading.close()
- } else this.failHandle(res)
- });
- } else {
- api.pageList(query, 'supplyEntryOrder').then((res : any) => {
- if (res.code === 200) {
- (this.$refs.bill as any).setTabTableValue(e.type, res.data.records);
- loading.close()
- } else this.failHandle(res)
- })
- }
- }
- // 获取分页数据
- getPageList(query : any, type : any) {
- api.pageList(query, 'supplyEntryOrder').then((res : any) => {
- if (res.code === 200) {
- (this.$refs.bill as any).setTabTableValue(type, res.data.records);
- let page = {
- pageNo: res.data.current, //当前页
- pageSize: res.data.size, //每页条数
- total: res.data.total //总条数
- };
- (this.$refs.bill as any).setTablePage(type, page)
- } else this.failHandle(res)
- })
- }
- // 回收站数据
- getSelectDeleteList(query : any) {
- api.selectDeleteList(query, 'supplyEntryOrder').then((res : any) => {
- if (res.code === 200) {
- (this.$refs.bill as any).setTabTableValue('recycleBin', res.data.records);
- let page = {
- pageNo: res.data.current, //当前页
- pageSize: res.data.size, //每页条数
- total: res.data.total //总条数
- };
- (this.$refs.bill as any).setTablePage('recycleBin', page)
- } else this.failHandle(res)
- });
- }
- // 搜索
- search(parames : any) {
- let query = parames.value
- if (parames.type === 'draftsBox') query.submitState = 0 // 草稿箱数据
- if (parames.type === 'smt') query.submitState = 1 // 已提交数据
- console.log('搜索 ==> ', query);
- this.getPageList(query, parames.type) // 获取分页数据
- }
- // 刷新/重置
- resert(e : any) {
- let data:any = e.type ? e.type : e;
- (this as any).$refs.bill.$refs[data].clearSearch();
- if (data === 'all') this.getPageList({}, 'all'); // 综合数据
- if (data === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
- if (data === 'smt') this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
- if (data === 'recycleBin') this.getSelectDeleteList({}) // 回收站数据
- }
- // 单据表格删除
- changeTable(item : any) {
- this.$confirm('确定删除吗!', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- this.tableData[item.dataIndex].isDeleted = 1;
- let newData = this.tableData.filter((res : any) => res.isDeleted === 0);
- console.log('原表格数据 ==> ', this.tableData);
- console.log('新表格数据 ==> ', newData);
- (this.$refs.bill as any).setBillTableValue(newData, 0);// 设置第1张单据表格数据
- this.$message.success('删除成功');
- }).catch(() => this.$message.info('已取消删除'));
- }
- // 工具栏删除
- onDelete(e : any) {
- console.log('工具栏删除 ==> ', e);
- let selectData = (this.$refs.bill as any).getTableSelectData(e)
- let ids = '';
- if (selectData.length > 0) {
- selectData.map((v : any) => {
- ids += v.id + ','
- })
- } else return this.$message({ type: 'warning', message: '请选择删除数据' })
- ids = ids.slice(0, ids.length - 1);
- this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- api.deleteList({ ids: ids }, 'supplyEntryOrder').then((res : any) => {
- if (res.code === 200) {
- this.clickTab(this.tabType);
- this.$message.success('删除成功!');
- } else this.failHandle(res)
- })
- }).catch(() => this.$message.info('已取消删除'));
- }
- // 操作删除
- doDelete2(item : any) {
- this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- api.deleteList({ ids: item.id }, 'supplyEntryOrder').then((res : any) => {
- if (res.code === 200) {
- this.clickTab(this.tabType);
- this.$message.success('删除成功!');
- } else this.failHandle(res)
- })
- }).catch(() => this.$message.info('已取消删除'));
- }
- // 运行错误
- failHandle(err : any) {
- let msg = err.msg ? err.msg : '运行错误!';
- this.$message.error(msg)
- }
- }
- </script>
|