|
|
@@ -1,381 +1,381 @@
|
|
|
-<template>
|
|
|
- <div class="">
|
|
|
- <!-- 按钮功能 -->
|
|
|
- <div class="itemDiv">
|
|
|
- <span class="titleSmall">{{$t("prepare.common.program")}}</span>
|
|
|
- <el-radio-group :disabled="showRadio" v-model="radio" @change="radioChange" style="margin-right: 15px;">
|
|
|
- <el-radio label="1">{{$t("prepare.common.idNeed.unneed")}}</el-radio>
|
|
|
- <el-radio label="2">{{$t("prepare.common.idNeed.need")}}</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- <el-button :disabled="showButton" type="primary" icon="el-icon-plus" size="small" @click="addProgram" circle></el-button>
|
|
|
- </div>
|
|
|
- <!-- Table数据 -->
|
|
|
- <el-table
|
|
|
- v-if="radio != '1'"
|
|
|
- ref="table"
|
|
|
- v-loading="loading"
|
|
|
- :data="tableData"
|
|
|
- border
|
|
|
- fit
|
|
|
- style="width: 100%;"
|
|
|
- highlight-current-row
|
|
|
- header-row-class-name="technologTable"
|
|
|
- @current-change="handleCurrentChange"
|
|
|
- >
|
|
|
- <!-- 序号 -->
|
|
|
- <el-table-column :label='$t("common.serialNo")' width="55px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <div>
|
|
|
- {{scope.$index+(queryParams.current - 1) * queryParams.size + 1}}
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <!-- 设备 -->
|
|
|
- <el-table-column prop="name" :label='$t("prepare.table.program.name")' align="center" width="220px" :show-overflow-tooltip="true">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <div v-if="type == 'view'">{{row.name}}</div>
|
|
|
- <div v-else>
|
|
|
- <el-button type="text" @click="edit(row)">{{row.name}}</el-button>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <!-- 托盘夹具组 -->
|
|
|
- <!--<el-table-column prop="groupSort" :label='$t("prepare.table.program.groupSort")' align="center" width="120px"></el-table-column>-->
|
|
|
- <!-- 位置程序类型 -->
|
|
|
- <!--<el-table-column prop="programType" :label='$t("prepare.table.program.programType")' align="center" width="130px">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <span>{{row.programType == "1" ? $t("prepare.common.programType.type1") : (row.programType == "2" ? $t("prepare.common.programType.type2") : $t("prepare.common.programType.type3"))}}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>-->
|
|
|
- <!-- 程序加工位置 -->
|
|
|
- <!--<el-table-column prop="positions" :label='$t("prepare.table.program.positions")' width="160px"></el-table-column>-->
|
|
|
- <!-- 优先级 -->
|
|
|
- <!--<el-table-column prop="prority" :label='$t("prepare.table.program.prority")' width="70px"></el-table-column>-->
|
|
|
- <!-- 加工时间 -->
|
|
|
- <el-table-column prop="workTime" :label='$t("prepare.table.program.addTime")' width="180px" align="center"></el-table-column>
|
|
|
- <!-- 程序名称 -->
|
|
|
- <el-table-column prop="submittedFileName" :label='$t("prepare.table.program.submittedFileName")' align="center"></el-table-column>
|
|
|
- <!-- 操作 -->
|
|
|
- <el-table-column
|
|
|
- v-if="type == 'view' ? false : true"
|
|
|
- :label="$t('table.operation')"
|
|
|
- fixed="right"
|
|
|
- align="center"
|
|
|
- column-key="operation"
|
|
|
- width="60px"
|
|
|
- >
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <!--<el-tooltip class="item" :content='$t("common.edit")' effect="dark" placement="top-start">
|
|
|
- <i
|
|
|
- class="el-icon-edit table-operation"
|
|
|
- style="color: #2db7f5;"
|
|
|
- @click="edit(row)"
|
|
|
- />
|
|
|
- </el-tooltip>-->
|
|
|
- <el-tooltip class="item" :content='$t("common.delete")' effect="dark" placement="top-start">
|
|
|
- <i
|
|
|
- class="el-icon-delete table-operation"
|
|
|
- style="color: #f50;"
|
|
|
- @click="domDelete(row)"
|
|
|
- />
|
|
|
- </el-tooltip>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
-
|
|
|
- <pagination
|
|
|
- v-show="tableData.total > 0"
|
|
|
- :limit.sync="queryParams.size"
|
|
|
- :page.sync="queryParams.current"
|
|
|
- :total="Number(tableData.total)"
|
|
|
- @pagination="fetch"
|
|
|
- />
|
|
|
-
|
|
|
- <tenant-edit
|
|
|
- ref="edit"
|
|
|
- :dialog-visible="dialog.isVisible"
|
|
|
- :title="dialog.title"
|
|
|
- @close="editClose"
|
|
|
- @success="editSuccess"
|
|
|
- />
|
|
|
- <tenant-view
|
|
|
- ref="view"
|
|
|
- :dialog-visible="tenantViewVisible"
|
|
|
- @close="viewClose"
|
|
|
- />
|
|
|
-
|
|
|
- <programnc-mgr
|
|
|
- ref="programnc"
|
|
|
- :dialog-visible="dialogProg.isVisible"
|
|
|
- :title="dialogProg.title"
|
|
|
- @close="editProgClose"
|
|
|
- @success="editProgSuccess"
|
|
|
- ></programnc-mgr>
|
|
|
- <!--<el-dialog
|
|
|
- title="添加NC程序"
|
|
|
- :visible.sync="dialogProgram"
|
|
|
- width="750px"
|
|
|
- :append-to-body="true"
|
|
|
- >
|
|
|
-
|
|
|
- </el-dialog>-->
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
- import TenantEdit from "./components/Edit"
|
|
|
- import TenantView from "./components/View"
|
|
|
- import Pagination from "@/components/Pagination"
|
|
|
- // 【程序管理】组件
|
|
|
- import ProgramncMgr from "./components/ProgramncMgr"
|
|
|
- import { downloadFile, initEnums, initDicts, initQueryParams } from '@/utils/commons'
|
|
|
- export default {
|
|
|
- name: "ProgramForm",
|
|
|
- components: { Pagination, TenantEdit, TenantView, ProgramncMgr },
|
|
|
- props: {
|
|
|
- type: String
|
|
|
- },
|
|
|
- data () {
|
|
|
- return {
|
|
|
- dialogProgram: false,
|
|
|
- currentRow: null,
|
|
|
- radio: '2',
|
|
|
- audioStatus: [],
|
|
|
- dialog: {
|
|
|
- isVisible: false,
|
|
|
- title: ""
|
|
|
- },
|
|
|
- dialogProg: {
|
|
|
- isVisible: false,
|
|
|
- title: ""
|
|
|
- },
|
|
|
- preview: {
|
|
|
- isVisible: false,
|
|
|
- context: ''
|
|
|
- },
|
|
|
- tenantViewVisible: false,
|
|
|
- tableKey: 0,
|
|
|
- queryParams: initQueryParams({}),
|
|
|
- selection: [],
|
|
|
- loading: false,
|
|
|
- // 新增和修改的设备[设备]数据-来自·(可执行设备(位置))
|
|
|
- selectedEq: [],
|
|
|
- // 新增和修改的设备[夹具组]数据-来自·(托盘夹具组)
|
|
|
- selectedTray: [],
|
|
|
- tableData: [/*
|
|
|
- {id:"100", name: "1", name2: 'cs200', name3: '1', name4: '整体程序', name5: "1,2", name6: '30', name7: '60'},
|
|
|
- {id:"101", name: "2", name2: 'ct100', name3: '2', name4: '独立程序', name5: "1", name6: '20', name7: '80'},
|
|
|
- {id:"102", name: "3", name2: '西门子Z4', name3: '1', name4: '整体程序', name5: "2", name6: '10', name7: '55'},
|
|
|
- {id:"103", name: "4", name2: '西门子Z5', name3: '2', name4: '组合程序', name5: "2,3", name6: '3', name7: '230'}
|
|
|
- */]
|
|
|
- }
|
|
|
- },
|
|
|
- // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
|
|
|
- created() {
|
|
|
- },
|
|
|
- computed: {
|
|
|
- showRadio(){
|
|
|
- return this.type == "view" ? true : false
|
|
|
- },
|
|
|
- showButton(){
|
|
|
- let flag = false
|
|
|
- if(this.type == "view"){
|
|
|
- flag = true
|
|
|
- }else{
|
|
|
- flag = this.radio == '1' ? true : false
|
|
|
- }
|
|
|
- return flag
|
|
|
- }
|
|
|
- },
|
|
|
- mounted () {
|
|
|
-
|
|
|
- },
|
|
|
- methods: {
|
|
|
- // 【Radio】按钮值变化-事件
|
|
|
- radioChange(val){
|
|
|
- if(val == '1'){
|
|
|
- // 清除数据
|
|
|
- this.tableData = []
|
|
|
- }
|
|
|
- },
|
|
|
- // 【删除】按钮-事件
|
|
|
- domDelete(row){
|
|
|
- this.$confirm(this.$t("tips.comTips"), this.$t("common.tips"), {
|
|
|
- distinguishCancelAndClose: true,
|
|
|
- confirmButtonText: this.$t("common.confirm"),
|
|
|
- cancelButtonText: this.$t("common.cancel"),
|
|
|
- type: "warning"
|
|
|
- }).then(() => {
|
|
|
- // 过滤我们需要的数据
|
|
|
- let list = this.tableData.filter(item => {
|
|
|
- let f1 = item.keys || item.id;
|
|
|
- let f2 = row.keys || row.id;
|
|
|
- return f1 != f2
|
|
|
- });
|
|
|
- // 重新赋值
|
|
|
- this.tableData = list;
|
|
|
- }).catch(() => {})
|
|
|
- },
|
|
|
- // table的当前行,变化-事件
|
|
|
- handleCurrentChange(val) {
|
|
|
- this.currentRow = val;
|
|
|
- },
|
|
|
-
|
|
|
- // 【程序管理】按钮-事件
|
|
|
- addProgram(){
|
|
|
- this.dialogProg.title = this.$t("common.add");
|
|
|
- this.$refs.programnc.type = "add";
|
|
|
- this.$refs.programnc.setTenant(false, this.selectedEq);
|
|
|
- // 打开弹出框
|
|
|
- this.dialogProg.isVisible = true;
|
|
|
- },
|
|
|
-
|
|
|
- // 【程序管理-取消】按钮-事件
|
|
|
- editProgClose(){
|
|
|
- this.dialogProg.isVisible = false;
|
|
|
- },
|
|
|
-
|
|
|
- // 【程序管理-确定】按钮-事件
|
|
|
- editProgSuccess(obj, type){
|
|
|
- if(type == "add") {
|
|
|
- // 给选择的数据,赋值
|
|
|
- this.tableData.push(obj);
|
|
|
- } else {
|
|
|
- let arr = [];
|
|
|
- this.tableData.map(item => {
|
|
|
- let f1 = item.keys || item.id;
|
|
|
- let f2 = obj.keys || obj.id;
|
|
|
- if (f1 == f2){
|
|
|
- arr.push(obj);
|
|
|
- } else {
|
|
|
- arr.push(item);
|
|
|
- }
|
|
|
- });
|
|
|
- this.tableData = arr;
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- viewClose () {
|
|
|
- this.tenantViewVisible = false
|
|
|
- },
|
|
|
- editClose () {
|
|
|
- this.dialog.isVisible = false
|
|
|
- },
|
|
|
- editSuccess (obj, flag) {
|
|
|
- let objData = JSON.parse(obj)
|
|
|
- console.log("程序传的值:", objData)
|
|
|
- if(flag == "add"){
|
|
|
- // 新增时候,添加唯一值
|
|
|
- objData.key = ''+ Math.random()
|
|
|
- this.tableData.push(objData)
|
|
|
- }else{
|
|
|
- // console.log("in的值:", objData)
|
|
|
- // console.log("当前选择的数据:", this.currentRow)
|
|
|
- let list = []
|
|
|
- this.tableData.map(item => {
|
|
|
- // key是唯一的,
|
|
|
- if(item.key == this.currentRow.key){
|
|
|
- item.name = objData.name
|
|
|
- item.resourceId = objData.resourceId
|
|
|
- item.resourceIds = objData.resourceIds
|
|
|
- item.trayPositionId = objData.trayPositionId
|
|
|
- item.positions = objData.positions
|
|
|
- item.programGroupList = objData.programGroupList
|
|
|
- item.programType = objData.programType
|
|
|
- item.groupSort = objData.groupSort // 组序
|
|
|
- item.prority = objData.prority
|
|
|
- // 托盘的id
|
|
|
- item.procedureTrayGroupId = objData.procedureTrayGroupId
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- onSelectChange (selection) {
|
|
|
- this.selection = selection
|
|
|
- },
|
|
|
-
|
|
|
- search () {
|
|
|
- this.fetch({
|
|
|
- ...this.queryParams
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- reset () {
|
|
|
- this.queryParams = initQueryParams({})
|
|
|
- this.$refs.table.clearSort()
|
|
|
- this.$refs.table.clearFilter()
|
|
|
- this.search()
|
|
|
- },
|
|
|
-
|
|
|
- add () {
|
|
|
- this.$refs.edit.type = "add"
|
|
|
- this.$refs.edit.setTenant(false, this.selectedEq, this.selectedTray)
|
|
|
- this.dialog.title = this.$t("common.add")
|
|
|
- this.dialog.isVisible = true
|
|
|
- },
|
|
|
- clearSelections () {
|
|
|
- this.$refs.table.clearSelection()
|
|
|
- },
|
|
|
- delete (ids) {
|
|
|
-
|
|
|
- },
|
|
|
- view (row) {
|
|
|
- this.$refs.view.setTenant(row)
|
|
|
- this.tenantViewVisible = true
|
|
|
- },
|
|
|
- // 【修改】表头上Btn-事件
|
|
|
- editOne() {
|
|
|
- if (!this.selection.length) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("tips.noDataSelected"),
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- if (this.selection.length > 1) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("tips.mustOne"),
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- this.edit(this.selection[0]);
|
|
|
- },
|
|
|
-
|
|
|
- // [NC程序]修改-事件
|
|
|
- edit (row) {
|
|
|
- this.$refs.programnc.setTenant(row, this.selectedEq)
|
|
|
- this.$refs.programnc.type = "edit"
|
|
|
- this.dialogProg.title = this.$t("common.edit")
|
|
|
- // 打开弹出框
|
|
|
- this.dialogProg.isVisible = true;
|
|
|
- },
|
|
|
-
|
|
|
- fetch (params = {}) {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-</script>
|
|
|
-<style>
|
|
|
-</style>
|
|
|
-<style lang="scss" scoped>
|
|
|
- .titleSmall{
|
|
|
- position: relative;
|
|
|
- padding-left: 10px;
|
|
|
- margin-right: 15px;
|
|
|
- }
|
|
|
- .titleSmall:before{
|
|
|
- content: '';
|
|
|
- position: absolute;
|
|
|
- background: #1890ff;
|
|
|
- width: 5px;
|
|
|
- height: 90%;
|
|
|
- left: 0;
|
|
|
- top: 1px;
|
|
|
- }
|
|
|
- .itemDiv{
|
|
|
- margin: 10px 0;
|
|
|
- }
|
|
|
+<template>
|
|
|
+ <div class="">
|
|
|
+ <!-- 按钮功能 -->
|
|
|
+ <div class="itemDiv">
|
|
|
+ <span class="titleSmall">{{$t("prepare.common.program")}}</span>
|
|
|
+ <el-radio-group :disabled="showRadio" v-model="radio" @change="radioChange" style="margin-right: 15px;">
|
|
|
+ <el-radio label="1">{{$t("prepare.common.idNeed.unneed")}}</el-radio>
|
|
|
+ <el-radio label="2">{{$t("prepare.common.idNeed.need")}}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ <el-button :disabled="showButton" type="primary" icon="el-icon-plus" size="small" @click="addProgram" circle></el-button>
|
|
|
+ </div>
|
|
|
+ <!-- Table数据 -->
|
|
|
+ <el-table
|
|
|
+ v-if="radio != '1'"
|
|
|
+ ref="table"
|
|
|
+ v-loading="loading"
|
|
|
+ :data="tableData"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ style="width: 100%;"
|
|
|
+ highlight-current-row
|
|
|
+ header-row-class-name="technologTable"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ >
|
|
|
+ <!-- 序号 -->
|
|
|
+ <el-table-column :label='$t("common.serialNo")' width="55px" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ {{scope.$index+(queryParams.current - 1) * queryParams.size + 1}}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <!-- 设备 -->
|
|
|
+ <el-table-column prop="name" :label='$t("prepare.table.program.name")' align="center" width="220px" :show-overflow-tooltip="true">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <div v-if="type == 'view'">{{row.name}}</div>
|
|
|
+ <div v-else>
|
|
|
+ <el-button type="text" @click="edit(row)">{{row.name}}</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <!-- 托盘夹具组 -->
|
|
|
+ <!--<el-table-column prop="groupSort" :label='$t("prepare.table.program.groupSort")' align="center" width="120px"></el-table-column>-->
|
|
|
+ <!-- 位置程序类型 -->
|
|
|
+ <!--<el-table-column prop="programType" :label='$t("prepare.table.program.programType")' align="center" width="130px">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <span>{{row.programType == "1" ? $t("prepare.common.programType.type1") : (row.programType == "2" ? $t("prepare.common.programType.type2") : $t("prepare.common.programType.type3"))}}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>-->
|
|
|
+ <!-- 程序加工位置 -->
|
|
|
+ <!--<el-table-column prop="positions" :label='$t("prepare.table.program.positions")' width="160px"></el-table-column>-->
|
|
|
+ <!-- 优先级 -->
|
|
|
+ <!--<el-table-column prop="prority" :label='$t("prepare.table.program.prority")' width="70px"></el-table-column>-->
|
|
|
+ <!-- 加工时间 -->
|
|
|
+ <el-table-column prop="workTime" :label='$t("prepare.table.program.addTime")' width="180px" align="center"></el-table-column>
|
|
|
+ <!-- 程序名称 -->
|
|
|
+ <el-table-column prop="submittedFileName" :label='$t("prepare.table.program.submittedFileName")' align="center"></el-table-column>
|
|
|
+ <!-- 操作 -->
|
|
|
+ <el-table-column
|
|
|
+ v-if="type == 'view' ? false : true"
|
|
|
+ :label="$t('table.operation')"
|
|
|
+ fixed="right"
|
|
|
+ align="center"
|
|
|
+ column-key="operation"
|
|
|
+ width="60px"
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <!--<el-tooltip class="item" :content='$t("common.edit")' effect="dark" placement="top-start">
|
|
|
+ <i
|
|
|
+ class="el-icon-edit table-operation"
|
|
|
+ style="color: #2db7f5;"
|
|
|
+ @click="edit(row)"
|
|
|
+ />
|
|
|
+ </el-tooltip>-->
|
|
|
+ <el-tooltip class="item" :content='$t("common.delete")' effect="dark" placement="top-start">
|
|
|
+ <i
|
|
|
+ class="el-icon-delete table-operation"
|
|
|
+ style="color: #f50;"
|
|
|
+ @click="domDelete(row)"
|
|
|
+ />
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="tableData.total > 0"
|
|
|
+ :limit.sync="queryParams.size"
|
|
|
+ :page.sync="queryParams.current"
|
|
|
+ :total="Number(tableData.total)"
|
|
|
+ @pagination="fetch"
|
|
|
+ />
|
|
|
+
|
|
|
+ <tenant-edit
|
|
|
+ ref="edit"
|
|
|
+ :dialog-visible="dialog.isVisible"
|
|
|
+ :title="dialog.title"
|
|
|
+ @close="editClose"
|
|
|
+ @success="editSuccess"
|
|
|
+ />
|
|
|
+ <tenant-view
|
|
|
+ ref="view"
|
|
|
+ :dialog-visible="tenantViewVisible"
|
|
|
+ @close="viewClose"
|
|
|
+ />
|
|
|
+
|
|
|
+ <programnc-mgr
|
|
|
+ ref="programnc"
|
|
|
+ :dialog-visible="dialogProg.isVisible"
|
|
|
+ :title="dialogProg.title"
|
|
|
+ @close="editProgClose"
|
|
|
+ @success="editProgSuccess"
|
|
|
+ ></programnc-mgr>
|
|
|
+ <!--<el-dialog
|
|
|
+ title="添加NC程序"
|
|
|
+ :visible.sync="dialogProgram"
|
|
|
+ width="750px"
|
|
|
+ :append-to-body="true"
|
|
|
+ >
|
|
|
+
|
|
|
+ </el-dialog>-->
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import TenantEdit from "./components/Edit"
|
|
|
+ import TenantView from "./components/View"
|
|
|
+ import Pagination from "@/components/Pagination"
|
|
|
+ // 【程序管理】组件
|
|
|
+ import ProgramncMgr from "./components/ProgramncMgr"
|
|
|
+ import { downloadFile, initEnums, initDicts, initQueryParams } from '@/utils/commons'
|
|
|
+ export default {
|
|
|
+ name: "ProgramForm",
|
|
|
+ components: { Pagination, TenantEdit, TenantView, ProgramncMgr },
|
|
|
+ props: {
|
|
|
+ type: String
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ dialogProgram: false,
|
|
|
+ currentRow: null,
|
|
|
+ radio: '2',
|
|
|
+ audioStatus: [],
|
|
|
+ dialog: {
|
|
|
+ isVisible: false,
|
|
|
+ title: ""
|
|
|
+ },
|
|
|
+ dialogProg: {
|
|
|
+ isVisible: false,
|
|
|
+ title: ""
|
|
|
+ },
|
|
|
+ preview: {
|
|
|
+ isVisible: false,
|
|
|
+ context: ''
|
|
|
+ },
|
|
|
+ tenantViewVisible: false,
|
|
|
+ tableKey: 0,
|
|
|
+ queryParams: initQueryParams({}),
|
|
|
+ selection: [],
|
|
|
+ loading: false,
|
|
|
+ // 新增和修改的设备[设备]数据-来自·(可执行设备(位置))
|
|
|
+ selectedEq: [],
|
|
|
+ // 新增和修改的设备[夹具组]数据-来自·(托盘夹具组)
|
|
|
+ selectedTray: [],
|
|
|
+ tableData: [/*
|
|
|
+ {id:"100", name: "1", name2: 'cs200', name3: '1', name4: '整体程序', name5: "1,2", name6: '30', name7: '60'},
|
|
|
+ {id:"101", name: "2", name2: 'ct100', name3: '2', name4: '独立程序', name5: "1", name6: '20', name7: '80'},
|
|
|
+ {id:"102", name: "3", name2: '西门子Z4', name3: '1', name4: '整体程序', name5: "2", name6: '10', name7: '55'},
|
|
|
+ {id:"103", name: "4", name2: '西门子Z5', name3: '2', name4: '组合程序', name5: "2,3", name6: '3', name7: '230'}
|
|
|
+ */]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
|
|
|
+ created() {
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ showRadio(){
|
|
|
+ return this.type == "view" ? true : false
|
|
|
+ },
|
|
|
+ showButton(){
|
|
|
+ let flag = false
|
|
|
+ if(this.type == "view"){
|
|
|
+ flag = true
|
|
|
+ }else{
|
|
|
+ flag = this.radio == '1' ? true : false
|
|
|
+ }
|
|
|
+ return flag
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 【Radio】按钮值变化-事件
|
|
|
+ radioChange(val){
|
|
|
+ if(val == '1'){
|
|
|
+ // 清除数据
|
|
|
+ this.tableData = []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 【删除】按钮-事件
|
|
|
+ domDelete(row){
|
|
|
+ this.$confirm(this.$t("tips.comTips"), this.$t("common.tips"), {
|
|
|
+ distinguishCancelAndClose: true,
|
|
|
+ confirmButtonText: this.$t("common.confirm"),
|
|
|
+ cancelButtonText: this.$t("common.cancel"),
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ // 过滤我们需要的数据
|
|
|
+ let list = this.tableData.filter(item => {
|
|
|
+ let f1 = item.keys || item.id;
|
|
|
+ let f2 = row.keys || row.id;
|
|
|
+ return f1 != f2
|
|
|
+ });
|
|
|
+ // 重新赋值
|
|
|
+ this.tableData = list;
|
|
|
+ }).catch(() => {})
|
|
|
+ },
|
|
|
+ // table的当前行,变化-事件
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.currentRow = val;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 【程序管理】按钮-事件
|
|
|
+ addProgram(){
|
|
|
+ this.dialogProg.title = this.$t("prepare.common.addProgram"); // this.$t("common.add")
|
|
|
+ this.$refs.programnc.type = "add";
|
|
|
+ this.$refs.programnc.setTenant(false, this.selectedEq);
|
|
|
+ // 打开弹出框
|
|
|
+ this.dialogProg.isVisible = true;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 【程序管理-取消】按钮-事件
|
|
|
+ editProgClose(){
|
|
|
+ this.dialogProg.isVisible = false;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 【程序管理-确定】按钮-事件
|
|
|
+ editProgSuccess(obj, type){
|
|
|
+ if(type == "add") {
|
|
|
+ // 给选择的数据,赋值
|
|
|
+ this.tableData.push(obj);
|
|
|
+ } else {
|
|
|
+ let arr = [];
|
|
|
+ this.tableData.map(item => {
|
|
|
+ let f1 = item.keys || item.id;
|
|
|
+ let f2 = obj.keys || obj.id;
|
|
|
+ if (f1 == f2){
|
|
|
+ arr.push(obj);
|
|
|
+ } else {
|
|
|
+ arr.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.tableData = arr;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ viewClose () {
|
|
|
+ this.tenantViewVisible = false
|
|
|
+ },
|
|
|
+ editClose () {
|
|
|
+ this.dialog.isVisible = false
|
|
|
+ },
|
|
|
+ editSuccess (obj, flag) {
|
|
|
+ let objData = JSON.parse(obj)
|
|
|
+ console.log("程序传的值:", objData)
|
|
|
+ if(flag == "add"){
|
|
|
+ // 新增时候,添加唯一值
|
|
|
+ objData.key = ''+ Math.random()
|
|
|
+ this.tableData.push(objData)
|
|
|
+ }else{
|
|
|
+ // console.log("in的值:", objData)
|
|
|
+ // console.log("当前选择的数据:", this.currentRow)
|
|
|
+ let list = []
|
|
|
+ this.tableData.map(item => {
|
|
|
+ // key是唯一的,
|
|
|
+ if(item.key == this.currentRow.key){
|
|
|
+ item.name = objData.name
|
|
|
+ item.resourceId = objData.resourceId
|
|
|
+ item.resourceIds = objData.resourceIds
|
|
|
+ item.trayPositionId = objData.trayPositionId
|
|
|
+ item.positions = objData.positions
|
|
|
+ item.programGroupList = objData.programGroupList
|
|
|
+ item.programType = objData.programType
|
|
|
+ item.groupSort = objData.groupSort // 组序
|
|
|
+ item.prority = objData.prority
|
|
|
+ // 托盘的id
|
|
|
+ item.procedureTrayGroupId = objData.procedureTrayGroupId
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ onSelectChange (selection) {
|
|
|
+ this.selection = selection
|
|
|
+ },
|
|
|
+
|
|
|
+ search () {
|
|
|
+ this.fetch({
|
|
|
+ ...this.queryParams
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ reset () {
|
|
|
+ this.queryParams = initQueryParams({})
|
|
|
+ this.$refs.table.clearSort()
|
|
|
+ this.$refs.table.clearFilter()
|
|
|
+ this.search()
|
|
|
+ },
|
|
|
+
|
|
|
+ add () {
|
|
|
+ this.$refs.edit.type = "add"
|
|
|
+ this.$refs.edit.setTenant(false, this.selectedEq, this.selectedTray)
|
|
|
+ this.dialog.title = this.$t("common.add")
|
|
|
+ this.dialog.isVisible = true
|
|
|
+ },
|
|
|
+ clearSelections () {
|
|
|
+ this.$refs.table.clearSelection()
|
|
|
+ },
|
|
|
+ delete (ids) {
|
|
|
+
|
|
|
+ },
|
|
|
+ view (row) {
|
|
|
+ this.$refs.view.setTenant(row)
|
|
|
+ this.tenantViewVisible = true
|
|
|
+ },
|
|
|
+ // 【修改】表头上Btn-事件
|
|
|
+ editOne() {
|
|
|
+ if (!this.selection.length) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("tips.noDataSelected"),
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.selection.length > 1) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("tips.mustOne"),
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.edit(this.selection[0]);
|
|
|
+ },
|
|
|
+
|
|
|
+ // [NC程序]修改-事件
|
|
|
+ edit (row) {
|
|
|
+ this.$refs.programnc.setTenant(row, this.selectedEq)
|
|
|
+ this.$refs.programnc.type = "edit"
|
|
|
+ this.dialogProg.title = this.$t("common.edit")
|
|
|
+ // 打开弹出框
|
|
|
+ this.dialogProg.isVisible = true;
|
|
|
+ },
|
|
|
+
|
|
|
+ fetch (params = {}) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+<style>
|
|
|
+</style>
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .titleSmall{
|
|
|
+ position: relative;
|
|
|
+ padding-left: 10px;
|
|
|
+ margin-right: 15px;
|
|
|
+ }
|
|
|
+ .titleSmall:before{
|
|
|
+ content: '';
|
|
|
+ position: absolute;
|
|
|
+ background: #1890ff;
|
|
|
+ width: 5px;
|
|
|
+ height: 90%;
|
|
|
+ left: 0;
|
|
|
+ top: 1px;
|
|
|
+ }
|
|
|
+ .itemDiv{
|
|
|
+ margin: 10px 0;
|
|
|
+ }
|
|
|
</style>
|