|
@@ -0,0 +1,632 @@
|
|
|
+<template>
|
|
|
+ <el-dialog
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :close-on-press-escape="false"
|
|
|
+ :title="title"
|
|
|
+ :append-to-body="true"
|
|
|
+ :visible.sync="isVisible"
|
|
|
+ width="750px"
|
|
|
+ top="50px"
|
|
|
+ >
|
|
|
+ <el-form ref="form" :disabled="formDisabled" :model="customizeCuttingTool" :rules="rules" label-position="right" label-width="100px">
|
|
|
+ <!-- 刀具编号 -->
|
|
|
+ <!-- <el-form-item :label='$t("cuttingTool.form.customizeCuttingtool.cuttingToolNo")+":"' prop="cutterT">
|
|
|
+ <el-input v-model="customizeCuttingTool.cutterT" :disabled="true" style="width: 93%;" ></el-input>
|
|
|
+ </el-form-item> -->
|
|
|
+ <!-- 刀具名称-->
|
|
|
+ <!-- <el-form-item :label='$t("cuttingTool.form.customizeCuttingtool.cuttingToolName")+":"' prop="cutterName">
|
|
|
+ <el-input v-model.trim="customizeCuttingTool.cutterName" :label='$t("common.pleaseEnter")' maxlength="128" style="width: 93%;" :disabled="true"></el-input>
|
|
|
+ </el-form-item> -->
|
|
|
+ <!-- 当前设备 -->
|
|
|
+ <el-form-item :label='$t("cuttingTool.form.customizeCuttingtool.thisDeviceName")+":"' prop="thisDeviceName">
|
|
|
+ <el-input v-model.trim="customizeCuttingTool.thisDeviceName" :label='$t("common.pleaseEnter")' maxlength="128" style="width: 93%;" :disabled="true"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- 当前位置 -->
|
|
|
+ <!-- <el-form-item :label='$t("cuttingTool.form.customizeCuttingtool.thisPositionName")+":"' prop="thisPositionName">
|
|
|
+ <el-input v-model.trim="customizeCuttingTool.thisPositionName" :label='$t("common.pleaseEnter")' maxlength="128" style="width: 93%;" :disabled="true"></el-input>
|
|
|
+ </el-form-item> -->
|
|
|
+ <!-- 起始位置在机床 -->
|
|
|
+ <el-form-item v-if ="this.isjc" label="目的位置:" prop="doc">
|
|
|
+ <el-select v-model="customizeCuttingTool.doc" style="width: 93%;">
|
|
|
+ <el-option v-for="dosData in docDataList" :key="dosData.doc" :label="dosData.label" :value="dosData.doc"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- 起始位置不在机床 -->
|
|
|
+ <el-form-item v-if ="!this.isjc" :label='$t("cuttingTool.form.customizeCuttingtool.targetPosition")+":"' prop="targetPosition">
|
|
|
+ <el-select v-model="customizeCuttingTool.targetPosition" :placeholder='$t("common.pleaseSelect")' @change="choose" style="width: 93%;">
|
|
|
+ <el-option
|
|
|
+ v-for="item in cutToolDeviceList"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.code"
|
|
|
+ :key="item.code" >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- <el-form-item v-if ="!this.isjc" label="目的位:" prop="targetPointId">
|
|
|
+ <el-select v-model="customizeCuttingTool.targetPointId" style="width: 93%;">
|
|
|
+ <el-option v-for="position in cutToolStorgeList" :label="position.name" :value="position.pointId" :key="position.pointId"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if ="this.cutGoalNoIsShow && !this.isjc" label="目的刀位号:" prop="cutGoalNo">
|
|
|
+ <el-select v-model="customizeCuttingTool.cutGoalNo" style="width: 93%;">
|
|
|
+ <el-option v-for="cuttoolshelf in CutToolShelfList" :label="cuttoolshelf" :value="cuttoolshelf" :key="cuttoolshelf"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item> -->
|
|
|
+
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button plain type="warning" @click="isVisible = false">{{ $t('common.cancel') }}</el-button>
|
|
|
+ <el-button plain type="primary" :disabled="confirmDisabled" @click="submitForm">{{ $t('common.confirm') }}</el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+ // 【刀具管理】-API
|
|
|
+ import classScheduleMgrApi from "@/api/modelingCenter/cutterCategoriesGroup"
|
|
|
+ import equipmentMgrApi from "@/api/resourceProductMgr/equipmentMgr"
|
|
|
+ import toolbarApi from "@/api/systemMgr/toolbar"
|
|
|
+ import stationMgrApi from "@/api/machiningClient/stationMgr"
|
|
|
+ import db from "@/utils/localstorage";
|
|
|
+ import {Base64} from 'js-base64';
|
|
|
+ import qs from 'qs'
|
|
|
+ import {initQueryParams } from '@/utils/commons'
|
|
|
+export default {
|
|
|
+ name: 'CustomizeCuttingToolEdit',
|
|
|
+ components: {},
|
|
|
+ props: {
|
|
|
+ dialogVisible: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
+ title: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ type: 'add',
|
|
|
+ // 附件上传
|
|
|
+ action: `${process.env.VUE_APP_BASE_API}/file/attachment/upload`,
|
|
|
+ // 附件其它参数
|
|
|
+ cuttingToolPictureData: {
|
|
|
+ bizId: "",
|
|
|
+ bizType: "cuttingToolPictureData"
|
|
|
+ },
|
|
|
+ cuttingToolInstallPictureData: {
|
|
|
+ bizId: "",
|
|
|
+ bizType: "cuttingToolInstallPictureData"
|
|
|
+ },
|
|
|
+ // 附件的值
|
|
|
+ cuttingToolPictureFileList: [],
|
|
|
+ cuttingToolInstallPictureFileList: [],
|
|
|
+ customizeCuttingTool: this.initCustomizeCuttingTool(),
|
|
|
+ customizeCuttingToolMore: this.initCustomizeCuttingTool(),
|
|
|
+ queryMachineParams: initQueryParams({}),
|
|
|
+ screenWidth: 0,
|
|
|
+ width: this.initWidth(),
|
|
|
+ confirmDisabled: false,
|
|
|
+ deviceData: [],
|
|
|
+ cutToolDeviceList:[],
|
|
|
+ cutToolStorgeList: [{"name":"请选择","pointId":""}],
|
|
|
+ CutToolShelfList: [],
|
|
|
+ isjc: true,
|
|
|
+ cutGoalNoIsShow: false,
|
|
|
+ isMoreShow: false,
|
|
|
+ dialog: {
|
|
|
+ isVisible: false,
|
|
|
+ title: ""
|
|
|
+ },
|
|
|
+ dicts:{
|
|
|
+ CUTTING_TOOL_TYPE: {},
|
|
|
+ CUTTING_TOOL_CATEGORY: {},
|
|
|
+ },
|
|
|
+ dssd:{
|
|
|
+ CUTTING_TOOL_TYPE: {},
|
|
|
+ CUTTING_TOOL_CATEGORY: {},
|
|
|
+ },
|
|
|
+ roles: [],
|
|
|
+ rules: {
|
|
|
+ targetPosition: [
|
|
|
+ { required: true, message: this.$t("rules.require"), trigger: 'change' },
|
|
|
+ ],
|
|
|
+ // targetPointId: [
|
|
|
+ // { required: true, message: this.$t("rules.require"), trigger: 'change' },
|
|
|
+ // ],
|
|
|
+ // cutGoalNo: [
|
|
|
+ // { required: true, message: this.$t("rules.require"), trigger: 'change' },
|
|
|
+ // ],
|
|
|
+ doc: [
|
|
|
+ { required: true, message: this.$t("rules.require"), trigger: 'change' },
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ docDataList: [{
|
|
|
+ doc: 'HD',
|
|
|
+ label: '出库'
|
|
|
+ }, {
|
|
|
+ doc: 'FDJ',
|
|
|
+ label: '放刀库'
|
|
|
+ }],
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
|
|
|
+ created() {
|
|
|
+ console.log("edit")
|
|
|
+ this.findDeviceList();
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ headers() {
|
|
|
+ return {
|
|
|
+ token: 'Bearer ' + db.get("TOKEN", ""),
|
|
|
+ tenant: db.get("TENANT", "") || "",
|
|
|
+ Authorization: `Basic ${Base64.encode(`${process.env.VUE_APP_CLIENT_ID}:${process.env.VUE_APP_CLIENT_SECRET}`)}`
|
|
|
+ };
|
|
|
+ },
|
|
|
+ formDisabled(){
|
|
|
+ this.confirmDisabled = false
|
|
|
+ return false
|
|
|
+ },
|
|
|
+ isVisible: {
|
|
|
+ get () {
|
|
|
+ return this.dialogVisible
|
|
|
+ },
|
|
|
+ set () {
|
|
|
+ this.close()
|
|
|
+ this.reset()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ window.onresize = () => {
|
|
|
+ return (() => {
|
|
|
+ this.width = this.initWidth()
|
|
|
+ })()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ findDeviceList () {
|
|
|
+ equipmentMgrApi.getList({})
|
|
|
+ .then((response) => {
|
|
|
+ const res = response.data;
|
|
|
+ if (res.isSuccess) {
|
|
|
+ // 赋值
|
|
|
+ this.cutToolDeviceList = res.data.filter(item=> {
|
|
|
+ return item.modeSpecification!=null || item.name.indexOf("刀具") > -1
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .finally();
|
|
|
+ },
|
|
|
+ // 【新增-修改】弹出框,关闭
|
|
|
+ editClose () {
|
|
|
+ this.dialog.isVisible = false
|
|
|
+ },
|
|
|
+ add () {
|
|
|
+ this.$refs.edit.type = "add"
|
|
|
+ this.dialog.title = this.$t("prepare.common.selectEq")
|
|
|
+ this.dialog.isVisible = true
|
|
|
+ },
|
|
|
+ initCustomizeCuttingTool () {
|
|
|
+ return {
|
|
|
+ id: '',
|
|
|
+ specifications: '',
|
|
|
+ cuttingToolNo: 1,
|
|
|
+ cuttingToolName: '',
|
|
|
+ cuttingToolType: {
|
|
|
+ key: ""
|
|
|
+ },
|
|
|
+ cuttingToolCategory: {
|
|
|
+ key: ""
|
|
|
+ },
|
|
|
+ deviceId: '',
|
|
|
+ resourceIdList: [],
|
|
|
+ cutterNo: 0,
|
|
|
+ cuttingToolPicture: '',
|
|
|
+ cuttingToolInstallPicture: '',
|
|
|
+ remark: '',
|
|
|
+ status: '1',
|
|
|
+ cutterCode: '',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ initWidth () {
|
|
|
+ this.screenWidth = document.body.clientWidth
|
|
|
+ if (this.screenWidth < 991) {
|
|
|
+ return '90%'
|
|
|
+ } else if (this.screenWidth < 1400) {
|
|
|
+ return '45%'
|
|
|
+ } else {
|
|
|
+ return '800px'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setTenant (val, dicts) {
|
|
|
+ console.log("弹框写入val"+ val +"dicts:"+ dicts);
|
|
|
+ if(val){
|
|
|
+ this.customizeCuttingTool = { ...val }
|
|
|
+ this.$set(this.customizeCuttingTool, 'cutGoalNo', null);
|
|
|
+ this.$set(this.customizeCuttingTool, 'doc', null);
|
|
|
+ if(val.dkPointId!=null ){
|
|
|
+ this.isjc = false
|
|
|
+ this.$set(this.customizeCuttingTool, 'start', val.dkPointId);
|
|
|
+ this.$set(this.customizeCuttingTool, 'thisDeviceCode', val.dkDeviceCode);
|
|
|
+ this.$set(this.customizeCuttingTool, 'thisDeviceName', val.dkDeviceName);
|
|
|
+ this.$set(this.customizeCuttingTool, 'thisPositionName', val.dkStorgeName);
|
|
|
+ }else if (val.jcPointId) {
|
|
|
+ this.isjc = true
|
|
|
+ this.$set(this.customizeCuttingTool, 'start', val.jcPointId);
|
|
|
+ this.$set(this.customizeCuttingTool, 'thisDeviceCode', val.jcDeviceCode);
|
|
|
+ this.$set(this.customizeCuttingTool, 'thisDeviceName', val.jcDeviceName);
|
|
|
+ this.$set(this.customizeCuttingTool, 'thisPositionName', val.jcPointName);
|
|
|
+ }else {
|
|
|
+ this.isjc = false
|
|
|
+ this.$set(this.customizeCuttingTool, 'start', null);
|
|
|
+ this.$set(this.customizeCuttingTool, 'thisPositionName', '线外');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 字典表
|
|
|
+ this.dicts = dicts
|
|
|
+ },
|
|
|
+ setTenantMore (vals, dicts) {
|
|
|
+ this.customizeCuttingToolMore = vals
|
|
|
+ let val = vals[0]
|
|
|
+ console.log("弹框写入val"+ val +"dicts:"+ dicts);
|
|
|
+ if(val){
|
|
|
+ this.customizeCuttingTool = { ...val }
|
|
|
+ this.$set(this.customizeCuttingTool, 'cutGoalNo', null);
|
|
|
+ this.$set(this.customizeCuttingTool, 'doc', null);
|
|
|
+ if(val.dkPointId!=null ){
|
|
|
+ this.isjc = false
|
|
|
+ this.$set(this.customizeCuttingTool, 'start', val.dkPointId);
|
|
|
+ this.$set(this.customizeCuttingTool, 'thisDeviceCode', val.dkDeviceCode);
|
|
|
+ this.$set(this.customizeCuttingTool, 'thisDeviceName', val.dkDeviceName);
|
|
|
+ this.$set(this.customizeCuttingTool, 'thisPositionName', val.dkStorgeName);
|
|
|
+ }else if (val.jcPointId) {
|
|
|
+ this.isjc = true
|
|
|
+ this.$set(this.customizeCuttingTool, 'start', val.jcPointId);
|
|
|
+ this.$set(this.customizeCuttingTool, 'thisDeviceCode', val.jcDeviceCode);
|
|
|
+ this.$set(this.customizeCuttingTool, 'thisDeviceName', val.jcDeviceName);
|
|
|
+ this.$set(this.customizeCuttingTool, 'thisPositionName', val.jcPointName);
|
|
|
+ }else {
|
|
|
+ this.isjc = false
|
|
|
+ this.$set(this.customizeCuttingTool, 'start', null);
|
|
|
+ this.$set(this.customizeCuttingTool, 'thisPositionName', '线外');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 字典表
|
|
|
+ this.dicts = dicts
|
|
|
+ },
|
|
|
+ close () {
|
|
|
+ this.$emit('close')
|
|
|
+ },
|
|
|
+ reset () {
|
|
|
+ // 先清除校验,再清除表单,不然有奇怪的bug
|
|
|
+ this.$refs.form.clearValidate()
|
|
|
+ this.$refs.form.resetFields()
|
|
|
+ this.customizeCuttingTool = this.initCustomizeCuttingTool()
|
|
|
+ // 清空上传附件
|
|
|
+ this.cuttingToolPictureFileList = []
|
|
|
+ this.cuttingToolInstallPictureFileList = []
|
|
|
+ },
|
|
|
+ submitForm () {
|
|
|
+ console.log("提交")
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+
|
|
|
+ // 判断多条数据是否满足任务创建条件
|
|
|
+ if(this.cutGoalNoIsShow){
|
|
|
+ if(this.CutToolShelfList.length < this.customizeCuttingToolMore.length){
|
|
|
+ this.$message({
|
|
|
+ message: "目的点位空位置不够存放",
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if(this.cutToolStorgeList.length < this.customizeCuttingToolMore.length){
|
|
|
+ this.$message({
|
|
|
+ message: "目的点位空位置不够存放",
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.confirmDisabled = true
|
|
|
+ if(this.isjc){
|
|
|
+ this.updateJc()
|
|
|
+ }else {
|
|
|
+ this.update()
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ save () {
|
|
|
+ console.log(this.customizeCuttingTool)
|
|
|
+ classScheduleMgrApi.partNeedCuttersave(this.customizeCuttingTool)
|
|
|
+ .then((response) => {
|
|
|
+ const res = response.data
|
|
|
+ if (res.isSuccess) {
|
|
|
+ this.isVisible = false
|
|
|
+ this.$message({
|
|
|
+ message: this.$t('tips.createSuccess'),
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ // 通知列表
|
|
|
+ this.$emit("success");
|
|
|
+ // 通知列表-并关闭弹出框
|
|
|
+ this.$emit("close");
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ this.confirmDisabled = false
|
|
|
+ return true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ updateJc () {
|
|
|
+ if(this.customizeCuttingTool.cutterNo>0 || this.customizeCuttingTool.storgeName !==null){
|
|
|
+ this.customizeCuttingToolMore.map(item =>{
|
|
|
+ item.doc = this.customizeCuttingTool.doc
|
|
|
+ })
|
|
|
+ stationMgrApi.setWriteTakeCutterMore(this.customizeCuttingToolMore).then((res) => {
|
|
|
+ res = res.data;
|
|
|
+ if (res.isSuccess) {
|
|
|
+ this.loading = false
|
|
|
+ this.$message({
|
|
|
+ message: res.data,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ //通知列表-并关闭弹出框
|
|
|
+ this.$emit("close");
|
|
|
+ }
|
|
|
+ }).catch((e)=>{
|
|
|
+ console.log("错误"+ e)
|
|
|
+ }).finally(()=>{
|
|
|
+ this.confirmDisabled = false
|
|
|
+ this.loading = false
|
|
|
+ });
|
|
|
+
|
|
|
+ }else {
|
|
|
+ this.confirmDisabled = false
|
|
|
+ this.loading = false
|
|
|
+ this.$message({
|
|
|
+ message: "起点为线外,请通过上下料站执行",
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ update () {
|
|
|
+ // 判断是否为线外,线外通过上下料站就可以了
|
|
|
+ if(this.customizeCuttingTool.cutterNo>0 || this.customizeCuttingTool.storgeName !==null){
|
|
|
+ this.customizeCuttingToolMore.map(item =>{
|
|
|
+ item.goalType = this.customizeCuttingTool.targetPosition,
|
|
|
+ item.start = item.dkPointId
|
|
|
+ })
|
|
|
+
|
|
|
+ stationMgrApi.addCutToolTaskMore(this.customizeCuttingToolMore).then((res) => {
|
|
|
+ res = res.data;
|
|
|
+ if (res.isSuccess) {
|
|
|
+ this.loading = false
|
|
|
+ this.$message({
|
|
|
+ message: "成功",
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.$emit("success");
|
|
|
+ //通知列表-并关闭弹出框
|
|
|
+ this.$emit("close");
|
|
|
+ }
|
|
|
+ }).catch((e)=>{
|
|
|
+ console.log("错误"+ e)
|
|
|
+ }).finally(()=>{
|
|
|
+ this.confirmDisabled = false
|
|
|
+ this.loading = false
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ this.confirmDisabled = false
|
|
|
+ this.$message({
|
|
|
+ message: "起点为线外,请通过上下料站执行",
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ // 文件列表移除文件时的钩子
|
|
|
+ handleCuttingToolPictureRemove(file, fileList) {
|
|
|
+ console.log("删除事件:", file, fileList);
|
|
|
+ // 还原数据
|
|
|
+ this.resetCuttingToolPictureFile()
|
|
|
+ },
|
|
|
+ // 点击文件列表中已上传的文件时的钩子
|
|
|
+ handleCuttingToolPicturePreview(file) {
|
|
|
+ console.log("上传之前事件:",file);
|
|
|
+ },
|
|
|
+ // 文件超出个数限制时的钩子
|
|
|
+ handleCuttingToolPictureExceed(files, fileList) {
|
|
|
+ this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
|
|
|
+ },
|
|
|
+ // 删除文件之前的钩子,参数为上传的文件和文件列表,若返回 false 或者返回 Promise 且被 reject,则停止删除。
|
|
|
+ beforeCuttingToolPictureRemove(file, fileList) {
|
|
|
+ return this.$confirm(`确定移除 ${ file.name }?`);
|
|
|
+ },
|
|
|
+ // 文件上传成功时的钩子
|
|
|
+ handleCuttingToolPictureSuccess(response, file, fileList){
|
|
|
+ console.log("文件上传成功!", response)
|
|
|
+ if(response.isSuccess){
|
|
|
+ // [上传程序]字段的值
|
|
|
+ this.customizeCuttingTool.cuttingToolPicture = response.data.url
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 文件上传失败时的钩子
|
|
|
+ handleCuttingToolPictureError(err, file, fileList){
|
|
|
+ console.log("文件上传失败~", err)
|
|
|
+ },
|
|
|
+ // 文件上传时的钩子
|
|
|
+ handleCuttingToolPicturePropress(event, file, fileList){
|
|
|
+ console.log("文件上传~", event)
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ // 文件列表移除文件时的钩子
|
|
|
+ handleCuttingToolInstallPictureRemove(file, fileList) {
|
|
|
+ console.log("删除事件:", file, fileList);
|
|
|
+ // 还原数据
|
|
|
+ this.resetCuttingToolInstallPictureFile()
|
|
|
+ },
|
|
|
+ // 点击文件列表中已上传的文件时的钩子
|
|
|
+ handleCuttingToolInstallPicturePreview(file) {
|
|
|
+ console.log("上传之前事件:",file);
|
|
|
+ },
|
|
|
+ // 文件超出个数限制时的钩子
|
|
|
+ handleCuttingToolInstallPictureExceed(files, fileList) {
|
|
|
+ this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
|
|
|
+ },
|
|
|
+ // 删除文件之前的钩子,参数为上传的文件和文件列表,若返回 false 或者返回 Promise 且被 reject,则停止删除。
|
|
|
+ beforeCuttingToolInstallPictureRemove(file, fileList) {
|
|
|
+ return this.$confirm(`确定移除 ${ file.name }?`);
|
|
|
+ },
|
|
|
+ // 文件上传成功时的钩子
|
|
|
+ handleCuttingToolInstallPictureSuccess(response, file, fileList){
|
|
|
+ console.log("文件上传成功!", response)
|
|
|
+ if(response.isSuccess){
|
|
|
+ // [上传程序]字段的值
|
|
|
+ this.customizeCuttingTool.cuttingToolInstallPicture = response.data.url
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 文件上传失败时的钩子
|
|
|
+ handleCuttingToolInstallPictureError(err, file, fileList){
|
|
|
+ console.log("文件上传失败~", err)
|
|
|
+ },
|
|
|
+ // 文件上传时的钩子
|
|
|
+ handleCuttingToolInstallPicturePropress(event, file, fileList){
|
|
|
+ console.log("文件上传~", event)
|
|
|
+ },
|
|
|
+ resetCuttingToolPictureFile(){
|
|
|
+ // [上传程序]字段的值
|
|
|
+ this.customizeCuttingTool.cuttingToolPicture = ''
|
|
|
+ },
|
|
|
+ resetCuttingToolInstallPictureFile(){
|
|
|
+ // [上传程序]字段的值
|
|
|
+ this.customizeCuttingTool.cuttingToolInstallPicture = ''
|
|
|
+ },
|
|
|
+ choose(val){
|
|
|
+ if(this.customizeCuttingTool.start!=null || this.customizeCuttingTool.start!=""){
|
|
|
+ //判断起始设备和目的设备是否一致 scope.row.cutterNo>0 ? scope.row.cutterNo: scope.row.storgeName
|
|
|
+ let params = {"pointId": this.customizeCuttingTool.start.replace("CT_","")}
|
|
|
+ toolbarApi.getCutToolDevice(qs.stringify(params)).then(response=>{
|
|
|
+ this.cutToolStorgeList = [{"name":"请选择","pointId":""}]
|
|
|
+ this.CutToolShelfList = []
|
|
|
+ this.$set(this.customizeCuttingTool, 'targetPointId', null);
|
|
|
+ this.$set(this.customizeCuttingTool, 'cutGoalNo', null);
|
|
|
+
|
|
|
+ const res = response.data
|
|
|
+ if(res.data == null){
|
|
|
+ this.$message({
|
|
|
+ message: "没有查询到设备",
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if(res.isSuccess){
|
|
|
+ let item = this.cutToolDeviceList.filter(item=>item.code==val);
|
|
|
+ let resourceId = res.data.resourceId
|
|
|
+ if(resourceId == item[0].id){
|
|
|
+
|
|
|
+ this.cutToolStorgeList = [];
|
|
|
+ this.$message({
|
|
|
+ message: "起始设备和目的设备不能一样",
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log("获取目的地所有可用的站点信息")
|
|
|
+ let params2 = {"code":val,"cutterNo":this.customizeCuttingTool.cutterT}
|
|
|
+ toolbarApi.cutToolPositionList(params2).then(response2=>{
|
|
|
+ const res2 = response2.data
|
|
|
+ if(res2.isSuccess){
|
|
|
+ let tempList = res2.data
|
|
|
+ if(tempList.length==0){
|
|
|
+ this.$message({
|
|
|
+ message: "目的点位不满足,确认目的点位是否为空",
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ this.cutToolStorgeList = tempList.map(item=>{
|
|
|
+ item.pointId = "CT_"+item.pointId
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ //console.log(this.cutToolStorgeList)
|
|
|
+ }
|
|
|
+ }).finally(()=>{
|
|
|
+ return true
|
|
|
+ })
|
|
|
+
|
|
|
+ console.log("查询刀架号")
|
|
|
+ toolbarApi.getCutToolShelfDevice(params2).then(response2=>{
|
|
|
+ const res3 = response2.data
|
|
|
+ if(res3.isSuccess){
|
|
|
+ if(res3.msg == "1000"){
|
|
|
+ this.cutGoalNoIsShow = false
|
|
|
+ }else {
|
|
|
+ this.cutGoalNoIsShow = true
|
|
|
+ this.CutToolShelfList = res3.data
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }).finally(()=>{
|
|
|
+ return true
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ }).finally(()=>{
|
|
|
+ return true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style lang="scss" >
|
|
|
+.avatar-uploader .el-upload {
|
|
|
+ border: 1px dashed #d9d9d9;
|
|
|
+ border-radius: 6px;
|
|
|
+ cursor: pointer;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+}
|
|
|
+.avatar-uploader .el-upload:hover {
|
|
|
+ border-color: #409eff;
|
|
|
+}
|
|
|
+.avatar-uploader-icon {
|
|
|
+ font-size: 28px;
|
|
|
+ color: #8c939d;
|
|
|
+ width: 100px;
|
|
|
+ height: 100px;
|
|
|
+ line-height: 100px;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+.avatar {
|
|
|
+ width: 100px;
|
|
|
+ height: 100px;
|
|
|
+ display: block;
|
|
|
+}
|
|
|
+.checkUsed{
|
|
|
+ display: inline-block;
|
|
|
+ margin-left: 10px;
|
|
|
+ color: #1890ff;
|
|
|
+}
|
|
|
+.custom-dropdown .el-select-dropdown__list {
|
|
|
+ display: flex; /* 或者使用 grid, table 等布局方式 */
|
|
|
+ flex-direction: column; /* 对于表格布局,可能需要调整 */
|
|
|
+}
|
|
|
+.custom-dropdown .el-select-dropdown__item {
|
|
|
+ display: flex; /* 或者使用 grid, table 等布局方式 */
|
|
|
+ justify-content: space-between; /* 确保内容均匀分布 */
|
|
|
+}
|
|
|
+</style>
|