var pfcomponent = { template: `
搜索 删除
取 消 确认入库
`, data() { // 获取当前屏幕的分辨率 let screenW = window.screen.width; let screenH = window.innerHeight; console.log("screen width:", screenW); console.log("screen height:", screenH); return { tHeight: screenH - 40 - 232, tableData: [], tableData1: [], currentPage: 1, pagesize: 50, recordTotal: 0, applicant_v: '', dialogVisible: false, multipleSelection: [], disabled: true, if_show_process: false, percent_len: 0, interval: '', if_show_process1: false, update_visible: false, form: { id: '', p_id: '', process_name: '', process_t: '', }, rules: { p_id: [ { required: true, message: '产品编号不可为空', trigger: 'blur' } ], process_name: [ { required: true, message: '工序不可为空', trigger: 'blur' } ], process_t: [ { required: true, message: '工时不可为空', trigger: 'blur' } ], }, id: 0, state: '', } }, mounted() { this.get_approve(); }, methods: { celldblclick_1(row, column, cell, event) { this.$data.tableData1 = JSON.parse(row.data); this.$data.id = row.id, this.$data.state = row.state, this.$data.update_visible = true; }, post_process() { this.$data.update_visible = false; var _this = this; console.log(_this.$data.form); var objs; axios.post('/pp/approve_ok', { opuser: localStorage.getItem("online_user"), opuser_uuid: localStorage.getItem("uuid"), id: _this.$data.id, data: _this.$data.tableData1, }) .then(function (response) { let r = response.data.r; let s = "" let errType = "" if (r == 0) { errType = "success" // 操作日志 _this.add_operation_log("导入物料编号:" + _this.$data.id + "确认入库"); } else { errType = "error" } if (r == 0) { s = "入库成功!"; } else { s = "入库失败!"; } _this.$message({ message: s, type: errType, duration: 1500 }); //更新页面 _this.get_approve(); }) .catch(function (error) { console.log(error); }); }, update_process(row) { this.$data.form = { id: row.id, p_id: row.p_id, process_name: row.process_name, process_t: row.process_t }; this.$nextTick(() => { this.$refs['form_p'].clearValidate() }); this.$data.update_visible = true; }, input_change(value) { console.log(value); this.get_approve(); }, importDialog_close(done) { done(); }, handleSelectionChange(val) { console.log("已选择"); console.log(val); this.multipleSelection = val; }, del_approve() { var _this = this; axios.post('/pp/del_approve', { opuser: localStorage.getItem("online_user"), opuser_uuid: localStorage.getItem("uuid"), ids: _this.$data.multipleSelection, }) .then(function (response) { let r = response.data.r; let s = "" let errType = "" if (r == 0) { s = "删除成功!"; errType = "success" // 操作日志 // var list = []; // _this.$data.multipleSelection.forEach(element => { // list.push(element.id); // }); // _this.add_operation_log("删除序号:" + list.toString() + "物料审批"); } else { s = "删除失败!"; errType = "error" } _this.$message({ message: s, type: errType, duration: 1500 }); if (r == 0) { _this.get_approve();//更新页面 } }) .catch(function (error) { console.log(error); }); }, get_approve() { document.getElementById("bt_search").blur(); var _this = this; var objs; axios.post('/pp/get_approve_m', { opuser: localStorage.getItem("online_user"), opuser_uuid: localStorage.getItem("uuid"), index: this.$data.currentPage, count: this.$data.pagesize, applicant: this.$data.applicant_v, }) .then(function (response) { console.log(response.data); objs = response.data.data; rcnt = response.data.total; _this.$data.tableData = objs; _this.$data.recordTotal = rcnt; }) .catch(function (error) { console.log(error); }); }, handleSizeChange(val) { this.$data.pagesize = val; this.get_approve(); }, handleCurrentChange(val) { this.$data.currentPage = val; this.get_approve(); }, // 根据内容设置列表宽度 flexColumnWidth(str, arr1, fontNum = 4, flag = 'max') { return window.flexColumnWidth(str, arr1, fontNum, flag); }, // 操作日志 add_operation_log(operation) { axios.post('/pp/add_operation_log', { opuser: localStorage.getItem("online_user"), opuser_uuid: localStorage.getItem("uuid"), operation: operation, }).then(function (response) { console.log(response); }).catch(function (error) { console.log(error); }) } } }