|
@@ -16,6 +16,16 @@
|
|
|
@current-change="dataList"
|
|
|
@selection-change="selectionChange"
|
|
|
>
|
|
|
+ <template #menu="{size,row,index}">
|
|
|
+ <el-button
|
|
|
+ v-hasPerm="[buttonPermission.DEVICE.BTNS.maintenance_edit]"
|
|
|
+ type="primary"
|
|
|
+ link
|
|
|
+ size="small"
|
|
|
+ @click="showParamsPage(row)"
|
|
|
+ ><i-ep-edit />参数
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
<template #menu-left="{ size }">
|
|
|
<el-button
|
|
|
:disabled="toDeleteIds.length < 1"
|
|
@@ -50,14 +60,65 @@
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</avue-crud>
|
|
|
+ <el-dialog
|
|
|
+ v-model="dialog.visible"
|
|
|
+ :title="dialog.title"
|
|
|
+ width="30%"
|
|
|
+ @close="dialog.visible = false"
|
|
|
+ >
|
|
|
+ <el-button type="primary" @click="addItem" icon="el-icon-plus" style="margin-left:15px;width:25px;height:25px;" circle />
|
|
|
+ <el-table
|
|
|
+ v-loading="loading"
|
|
|
+ ref="ruleListRef"
|
|
|
+ :data="pageData"
|
|
|
+ style="height: 280px"
|
|
|
+ >
|
|
|
+ <el-table-column
|
|
|
+ label="参数"
|
|
|
+ prop="fieldCode"
|
|
|
+ >
|
|
|
+ <template v-slot="{ row}">
|
|
|
+ <el-input v-model="row.fieldCode"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="参数名称"
|
|
|
+ prop="fieldLabel"
|
|
|
+ >
|
|
|
+ <template v-slot="{ row}">
|
|
|
+ <el-input v-model="row.fieldLabel"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="参数值"
|
|
|
+ prop="fieldValue"
|
|
|
+ >
|
|
|
+ <template v-slot="{ row}">
|
|
|
+ <el-input v-model="row.fieldValue"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="操作"
|
|
|
+ align="center"
|
|
|
+ >
|
|
|
+ <template v-slot="{ row}">
|
|
|
+ <el-button type="danger" @click="minusItem(row)" icon="el-icon-minus" style="margin-left:15px;width:25px;height:25px;" circle />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div class="dialog-footer" style="margin-top:20px" align="center">
|
|
|
+ <el-button type="primary" v-if="pageData.length>0" @click="handleSubmit">保 存</el-button>
|
|
|
+ <el-button @click="dialog.visible = false">取消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
<ExcelUpload ref="uploadRef" @finished="uploadFinished" />
|
|
|
</div>
|
|
|
</template>
|
|
|
<script setup>
|
|
|
import { ref, getCurrentInstance } from "vue";
|
|
|
import { useCrud } from "@/hooks/userCrud";
|
|
|
-import ButtonPermKeys from "@/common/configs/buttonPermission";
|
|
|
-
|
|
|
+import buttonPermission from "@/common/configs/buttonPermission";
|
|
|
+import {configSave,configList} from "@/api/device";
|
|
|
import { useCommonStoreHook } from "@/store";
|
|
|
import dictDataUtil from "@/common/configs/dictDataUtil";
|
|
|
const { isShowTable, tableType } = toRefs(useCommonStoreHook());
|
|
@@ -65,7 +126,51 @@ const test = () => {
|
|
|
isShowTable.value = true;
|
|
|
tableType.value = tableType.value == 1 ? 2 : 1;
|
|
|
};
|
|
|
-
|
|
|
+const pageData = ref([]);
|
|
|
+const loading = ref(false); // 加载状态
|
|
|
+const addItem = () =>{
|
|
|
+ pageData.value.push({deviceType: clickRow.value.deviceType,deviceNo: clickRow.value.deviceNo,type: 1})
|
|
|
+}
|
|
|
+const minusItem = (row) =>{
|
|
|
+ pageData.value = pageData.value.filter(item=>item.fieldCode !== row.fieldCode)
|
|
|
+}
|
|
|
+const clickRow = ref(null)
|
|
|
+const showParamsPage = (row)=>{
|
|
|
+ clickRow.value = row
|
|
|
+ configList({deviceNo: row.deviceNo}).then((data)=>{
|
|
|
+ pageData.value = data.data
|
|
|
+ dialog.visible = true
|
|
|
+ })
|
|
|
+}
|
|
|
+const dialog = reactive({
|
|
|
+ title: "参数设置",
|
|
|
+ visible: false,
|
|
|
+});
|
|
|
+const handleSubmit = () => {
|
|
|
+ //判断参数
|
|
|
+ let errorData = pageData.value.filter(item=>!item.fieldCode)
|
|
|
+ if(errorData.length > 0){
|
|
|
+ ElMessage.warning("请填写参数");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ errorData = pageData.value.filter(item=>!item.fieldLabel)
|
|
|
+ if(errorData.length > 0){
|
|
|
+ ElMessage.warning("请填写参数名");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ errorData = pageData.value.filter(item=>!item.fieldValue)
|
|
|
+ if(errorData.length > 0){
|
|
|
+ ElMessage.warning("请填写参数值");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ configSave(pageData.value).then((data)=>{
|
|
|
+ if(data.code === '200'){
|
|
|
+ ElMessage.success(data.msg);
|
|
|
+ }else{
|
|
|
+ ElMessage.error(data.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+};
|
|
|
// 传入一个url,后面不带/
|
|
|
const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
|
|
|
useCrud({
|
|
@@ -74,7 +179,6 @@ const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
|
|
|
const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } = Methords; //增删改查
|
|
|
const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
|
|
|
const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
|
|
|
-
|
|
|
const crudRef = ref(null); //crudRef.value 获取avue-crud对象
|
|
|
|
|
|
// 设置表格列或者其他自定义的option
|
|
@@ -86,6 +190,8 @@ option.value = Object.assign(option.value, {
|
|
|
label: "设备编号",
|
|
|
prop: "deviceNo",
|
|
|
search: true,
|
|
|
+ width: 160,
|
|
|
+ overHidden: true,
|
|
|
rules: [
|
|
|
{
|
|
|
required: true,
|
|
@@ -98,6 +204,8 @@ option.value = Object.assign(option.value, {
|
|
|
label: "设备名称",
|
|
|
prop: "deviceName",
|
|
|
search: true,
|
|
|
+ width: 160,
|
|
|
+ overHidden: true,
|
|
|
rules: [
|
|
|
{
|
|
|
required: true,
|
|
@@ -110,6 +218,8 @@ option.value = Object.assign(option.value, {
|
|
|
label: "设备类型",
|
|
|
prop: "deviceType",
|
|
|
type: "select",
|
|
|
+ width: 130,
|
|
|
+ overHidden: true,
|
|
|
search: true,
|
|
|
dicUrl:
|
|
|
dictDataUtil.request_url +
|
|
@@ -130,6 +240,8 @@ option.value = Object.assign(option.value, {
|
|
|
label: "设备状态",
|
|
|
prop: "state",
|
|
|
type: "select",
|
|
|
+ width: 160,
|
|
|
+ overHidden: true,
|
|
|
search: true,
|
|
|
dicUrl:
|
|
|
dictDataUtil.request_url +
|
|
@@ -149,6 +261,8 @@ option.value = Object.assign(option.value, {
|
|
|
{
|
|
|
label: "负责人",
|
|
|
prop: "head",
|
|
|
+ width: 160,
|
|
|
+ overHidden: true,
|
|
|
rules: [
|
|
|
{
|
|
|
required: true,
|
|
@@ -158,12 +272,29 @@ option.value = Object.assign(option.value, {
|
|
|
],
|
|
|
},
|
|
|
{
|
|
|
+ label: "所属PAC",
|
|
|
+ prop: "terminal",
|
|
|
+ type: "select",
|
|
|
+ width: 160,
|
|
|
+ overHidden: true,
|
|
|
+ search: true,
|
|
|
+ dicUrl:import.meta.env.VITE_APP_BASE_API + "/api/v1/device/pacList",
|
|
|
+ props: {
|
|
|
+ label: "deviceName",
|
|
|
+ value: "deviceNo",
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
label: "供应厂商",
|
|
|
prop: "manufacturer",
|
|
|
+ width: 160,
|
|
|
+ overHidden: true,
|
|
|
},
|
|
|
{
|
|
|
label: "所属部门",
|
|
|
prop: "deptId",
|
|
|
+ width: 160,
|
|
|
+ overHidden: true,
|
|
|
type: "tree",
|
|
|
dicUrl: dictDataUtil.dept_tree_url,
|
|
|
props: {
|
|
@@ -174,21 +305,31 @@ option.value = Object.assign(option.value, {
|
|
|
{
|
|
|
label: "所在车间",
|
|
|
prop: "workshop",
|
|
|
+ width: 160,
|
|
|
+ overHidden: true,
|
|
|
},
|
|
|
{
|
|
|
label: "所在工位",
|
|
|
prop: "station",
|
|
|
+ width: 160,
|
|
|
+ overHidden: true,
|
|
|
},
|
|
|
{
|
|
|
label: "设备位置",
|
|
|
prop: "devicePosition",
|
|
|
+ width: 160,
|
|
|
+ overHidden: true,
|
|
|
},
|
|
|
{
|
|
|
label: "规格",
|
|
|
prop: "specifications",
|
|
|
+ width: 160,
|
|
|
+ overHidden: true,
|
|
|
},
|
|
|
{
|
|
|
label: "品牌",
|
|
|
+ width: 160,
|
|
|
+ overHidden: true,
|
|
|
prop: "brand",
|
|
|
},
|
|
|
],
|