Compare commits

...

4 Commits

Author SHA1 Message Date
669345c983 merge test 2023-11-27 16:43:15 +08:00
888b5aa91f Merge pull request 'projects/mes-dy' (#115) from projects/mes-dy into projects/mes-test
Reviewed-on: #115
2023-11-27 09:42:54 +08:00
helloDy
a7f1087775 Merge branch 'projects/mes-test' into projects/mes-dy 2023-11-27 09:39:01 +08:00
helloDy
b0efd66a75 bug ui 2023-11-27 09:38:31 +08:00
16 changed files with 392 additions and 144 deletions

View File

@ -1,7 +1,7 @@
/* /*
* @Author: Do not edit * @Author: Do not edit
* @Date: 2023-11-08 15:56:52 * @Date: 2023-11-08 15:56:52
* @LastEditTime: 2023-11-20 16:38:18 * @LastEditTime: 2023-11-25 16:22:49
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
*/ */
@ -74,3 +74,29 @@ export function deleteCheck(id) {
method: 'delete' method: 'delete'
}) })
} }
// 获得设备巡检设置code
export function getCode() {
return request({
url: '/base/equipment-check-config/getCode',
method: 'get'
})
}
// 创建巡检配置
export function createCheckConfig(data) {
return request({
url: '/base/equipment-check-config/create',
method: 'post',
data: data
})
}
// 更新巡检配置
export function updateCheckConfig(data) {
return request({
url: '/base/equipment-check-config/update',
method: 'put',
data: data
})
}

View File

@ -29,10 +29,10 @@
<transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul"> <transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
<li :key="file.url" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList"> <li :key="file.url" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
<el-link :href="`${file.url}`" :underline="false" target="_blank"> <el-link :href="`${file.url}`" :underline="false" target="_blank">
<span class="el-icon-document"> {{ getFileName(file.name) }} </span> <span class="el-icon-document"> {{ fileName }} </span>
</el-link> </el-link>
<div class="ele-upload-list__item-content-action"> <div class="ele-upload-list__item-content-action">
<el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link> <el-link :underline="false" @click="handleDelete(index)" :disabled="disabled" type="danger">删除</el-link>
</div> </div>
</li> </li>
</transition-group> </transition-group>
@ -71,6 +71,11 @@ export default {
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false
},
//
fName: {
type: String,
default: ''
} }
}, },
data() { data() {
@ -81,6 +86,7 @@ export default {
uploadFileUrl: process.env.VUE_APP_BASE_API + "/admin-api/infra/file/upload", // uploadFileUrl: process.env.VUE_APP_BASE_API + "/admin-api/infra/file/upload", //
headers: { Authorization: "Bearer " + getAccessToken() }, // headers: { Authorization: "Bearer " + getAccessToken() }, //
fileList: [], fileList: [],
fileName: ''
}; };
}, },
watch: { watch: {
@ -105,6 +111,14 @@ export default {
}, },
deep: true, deep: true,
immediate: true immediate: true
},
fName: {
handler(val) {
if (val) {
console.log('11', val)
this.fileName = val
}
}
} }
}, },
computed: { computed: {
@ -117,6 +131,7 @@ export default {
// //
handleBeforeUpload(file) { handleBeforeUpload(file) {
// //
this.fileName = file.name
if (this.fileType) { if (this.fileType) {
let fileExtension = ""; let fileExtension = "";
if (file.name.lastIndexOf(".") > -1) { if (file.name.lastIndexOf(".") > -1) {
@ -150,7 +165,7 @@ export default {
}, },
// //
handleUploadError(err) { handleUploadError(err) {
this.$modal.msgError("上传图片失败,请重试"); this.$modal.msgError("上传文件失败,请重试");
this.$modal.closeLoading() this.$modal.closeLoading()
}, },
// //
@ -180,8 +195,12 @@ export default {
this.number = 0; this.number = 0;
this.$emit("input", this.listToString(this.fileList)); this.$emit("input", this.listToString(this.fileList));
this.$modal.closeLoading(); this.$modal.closeLoading();
this.returnFileName()
} }
}, },
returnFileName() {
this.$emit('name', this.fileName)
},
// //
getFileName(name) { getFileName(name) {
console.log('你好', name) console.log('你好', name)

View File

@ -2,43 +2,45 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2023-11-22 10:32:10 * @LastEditTime: 2023-11-25 18:09:05
* @Description: * @Description:
--> -->
<template> <template>
<el-form <div class="dialog">
:model="dataForm" <el-form
:rules="dataRule" :model="dataForm"
ref="dataForm" :rules="dataRule"
@keyup.enter.native="dataFormSubmit()" ref="dataForm"
label-width="80px"> @keyup.enter.native="dataFormSubmit()"
<el-row :gutter="20"> label-width="80px">
<el-col :span="12"> <el-row :gutter="20">
<el-form-item label="部门名称" prop="name"> <el-col :span="12">
<el-input v-model="dataForm.name" clearable placeholder="请输入部门名称" /> <el-form-item label="部门名称" prop="name">
</el-form-item> <el-input v-model="dataForm.name" clearable placeholder="请输入部门名称" />
</el-col> </el-form-item>
<el-col :span="12"> </el-col>
<el-form-item label="部门编码" prop="code"> <el-col :span="12">
<el-input v-model="dataForm.code" clearable placeholder="请输入部门编码" /> <el-form-item label="部门编码" prop="code">
</el-form-item> <el-input v-model="dataForm.code" clearable placeholder="请输入部门编码" />
</el-col> </el-form-item>
</el-row> </el-col>
<el-row :gutter="20"> </el-row>
<el-col :span="12"> <el-row :gutter="20">
<el-form-item label="上级部门" prop="parentId"> <el-col :span="12">
<treeselect v-model="dataForm.parentId" :options="menuOptions" :normalizer="normalizer" :show-count="true" placeholder="选择上级部门"/> <el-form-item label="上级部门" prop="parentId">
</el-form-item> <treeselect v-model="dataForm.parentId" :options="menuOptions" :normalizer="normalizer" :show-count="true" placeholder="选择上级部门" />
</el-col> </el-form-item>
<el-col :span="12"> </el-col>
<el-form-item label="备注" prop="remark"> <el-col :span="12">
<el-input <el-form-item label="备注" prop="remark">
v-model="dataForm.remark" <el-input
placeholder="请输入备注" /> v-model="dataForm.remark"
</el-form-item> placeholder="请输入备注" />
</el-col> </el-form-item>
</el-row> </el-col>
</el-form> </el-row>
</el-form>
</div>
</template> </template>
<script> <script>
@ -68,6 +70,7 @@ export default {
}, },
departmentlList: [], departmentlList: [],
menuOptions: [], menuOptions: [],
isChoosed: false,
dataRule: { dataRule: {
code: [{ required: true, message: "部门编码不能为空", trigger: "blur" }], code: [{ required: true, message: "部门编码不能为空", trigger: "blur" }],
name: [{ required: true, message: "部门名称不能为空", trigger: "blur" }], name: [{ required: true, message: "部门名称不能为空", trigger: "blur" }],
@ -104,3 +107,9 @@ export default {
}, },
}; };
</script> </script>
<style scoped>
.dialog {
min-height: 180px;
}
</style>

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2023-11-15 16:23:49 * @LastEditTime: 2023-11-25 11:25:23
* @Description: * @Description:
--> -->
<template> <template>
@ -46,6 +46,9 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" clearable placeholder="请输入备注" />
</el-form-item>
</el-form> </el-form>
</template> </template>
@ -70,7 +73,8 @@ export default {
code: undefined, code: undefined,
name: undefined, name: undefined,
unit: undefined, unit: undefined,
dailyCost: undefined dailyCost: undefined,
remark: undefined
}, },
departmentlList: [], departmentlList: [],
menuOptions: [], menuOptions: [],

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2023-11-15 15:41:44 * @LastEditTime: 2023-11-27 09:23:56
* @Description: * @Description:
--> -->
<template> <template>
@ -253,8 +253,8 @@ export default {
isdetail: false, isdetail: false,
idAttrShow: false, idAttrShow: false,
dataRule: { dataRule: {
code: [{ required: true, message: "物料编码不能为空", trigger: "blur" }], code: [{ required: true, message: "产品编码不能为空", trigger: "blur" }],
name: [{ required: true, message: "物料名称不能为空", trigger: "blur" }], name: [{ required: true, message: "产品名称不能为空", trigger: "blur" }],
materialType: [{ required: true, message: "物料类型不能为空", trigger: "change" }], materialType: [{ required: true, message: "物料类型不能为空", trigger: "change" }],
productType: [{ required: true, message: "产品类型不能为空", trigger: "change" }], productType: [{ required: true, message: "产品类型不能为空", trigger: "change" }],
processTime: [{ required: true, message: "产线生产单位用时不能为空", trigger: "blur" }] processTime: [{ required: true, message: "产线生产单位用时不能为空", trigger: "blur" }]

View File

@ -143,12 +143,6 @@ export default {
} }
} }
: undefined, : undefined,
this.$auth.hasPermi(`base:core-work-order:material`)
? {
type: 'material',
btnName: '预使用原料信息',
}
: undefined,
this.$auth.hasPermi(`base:core-work-order:detail`) this.$auth.hasPermi(`base:core-work-order:detail`)
? { ? {
type: 'detail', type: 'detail',
@ -171,6 +165,12 @@ export default {
} }
} }
: undefined, : undefined,
this.$auth.hasPermi(`base:core-work-order:material`)
? {
type: 'material',
btnName: '预使用原料信息',
}
: undefined,
{ {
type: 'active', type: 'active',
btnName: '激活', btnName: '激活',

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2023-11-22 08:55:37 * @LastEditTime: 2023-11-27 09:21:48
* @Description: * @Description:
--> -->
<template> <template>
@ -43,7 +43,9 @@
<el-form-item label="排序" prop="sort"> <el-form-item label="排序" prop="sort">
<el-input-number <el-input-number
v-model="dataForm.sort" v-model="dataForm.sort"
placeholder="排序" /> controls-position="right"
placeholder="排序"
style="width: 100%" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>

View File

@ -29,7 +29,7 @@
@cancel="handleCancel" @cancel="handleCancel"
@confirm="handleConfirm" @confirm="handleConfirm"
:before-close="handleCancel" :before-close="handleCancel"
width="50%"> width="40%">
<add-or-update <add-or-update
ref="addOrUpdate" ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update> @refreshDataList="successSubmit"></add-or-update>

View File

@ -2,14 +2,14 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2023-11-22 11:22:38 * @LastEditTime: 2023-11-27 09:36:44
* @Description: * @Description:
--> -->
<template> <template>
<el-drawer <el-drawer
:visible.sync="visible" :visible.sync="visible"
:show-close="false" :show-close="false"
:wrapper-closable="false" :wrapper-closable="isdetail"
class="drawer" class="drawer"
size="60%"> size="60%">
<small-title slot="title" :no-padding="true"> <small-title slot="title" :no-padding="true">
@ -156,12 +156,12 @@
@pagination="getList" /> @pagination="getList" />
</div> </div>
<div class="drawer-body__footer"> <div v-if="!isdetail" class="drawer-body__footer">
<el-button style="" @click="goback()">{{ isdetail ? '关闭' : '取消' }}</el-button> <el-button style="" @click="goback()">取消</el-button>
<!-- <el-button v-if="isdetail" type="primary" @click="goEdit()"> <!-- <el-button v-if="isdetail" type="primary" @click="goEdit()">
编辑 编辑
</el-button> --> </el-button> -->
<el-button v-if="!isdetail" type="primary" @click="dataFormSubmit()">确定</el-button> <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</div> </div>
</div> </div>
@ -432,7 +432,7 @@ export default {
} }
.action_btn { .action_btn {
float: right; float: right;
margin: -35px 15px; margin: -40px 15px;
font-size: 14px; font-size: 14px;
} }
.add { .add {

View File

@ -13,7 +13,7 @@
<method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
:width="220" :width="120"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleClick" /> @clickBtn="handleClick" />
@ -85,25 +85,25 @@ export default {
}, },
tableProps, tableProps,
tableBtn: [ tableBtn: [
this.$auth.hasPermi(`base:material:queryAttr`)
? {
type: 'detail',
btnName: '查看属性',
}
: undefined,
this.$auth.hasPermi(`base:material:update`) this.$auth.hasPermi(`base:material:update`)
? { ? {
type: 'edit', type: 'edit',
btnName: '编辑', btnName: '编辑',
} }
: undefined, : undefined,
this.$auth.hasPermi(`base:material:queryAttr`) // this.$auth.hasPermi(`base:material:editAttr`)
? { // ? {
type: 'search', // type: 'editAttr',
btnName: '查看属性', // btnName: '',
} // }
: undefined, // : undefined,
this.$auth.hasPermi(`base:material:editAttr`) this.$auth.hasPermi(`base:material:delete`)
? {
type: 'editAttr',
btnName: '编辑属性',
}
: undefined,
this.$auth.hasPermi(`base:material:delete`)
? { ? {
type: 'delete', type: 'delete',
btnName: '删除', btnName: '删除',
@ -136,7 +136,7 @@ export default {
}, },
{ {
type: this.$auth.hasPermi('base:material:create') ? 'button' : '', type: this.$auth.hasPermi('base:material:create') ? 'button' : '',
btnName: '新增物料', btnName: '新增',
name: 'add', name: 'add',
color: 'success', color: 'success',
plain: true plain: true
@ -166,7 +166,7 @@ export default {
}); });
}, },
otherMethods(val) { otherMethods(val) {
if (val.type === 'search') { if (val.type === 'detail') {
this.addOrUpdateVisible = true; this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情'; this.addOrEditTitle = '详情';
this.$nextTick(() => { this.$nextTick(() => {

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2023-11-23 15:00:00 * @LastEditTime: 2023-11-25 19:10:12
* @Description: * @Description:
--> -->
<template> <template>
@ -85,28 +85,30 @@
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="materialId" label="物料名称"> <el-table-column prop="materialId" label="物料名称*">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select <el-select
v-model="scope.row.materialId" v-model="scope.row.materialId"
filterable filterable
clearable clearable
:disabled="!scope.row.isEdit" :disabled="!scope.row.isEdit"
placeholder="请选择物料" placeholder="请选择物料"
@change="setCode(scope.row)"> @change="setCode(scope.row)">
<el-option <el-option
v-for="dict in materialList" v-for="dict in materialList"
:key="dict.id" :key="dict.id"
:label="dict.name" :label="dict.name"
:value="dict.id" /> :value="dict.id" />
</el-select> </el-select>
<span v-if="scope.row.isShow" style="color: red">物料不可为空</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="materialCode" label="物料编码" /> <el-table-column prop="materialCode" label="物料编码" />
<el-table-column prop="mUnit" label="单位" /> <el-table-column prop="mUnit" label="单位" />
<el-table-column prop="num" label="数量"> <el-table-column prop="num" label="数量*">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.num" :disabled="!scope.row.isEdit"></el-input> <el-input v-model.number="scope.row.num" :disabled="!scope.row.isEdit" @input="changeNum(scope.row)"></el-input>
<span v-if="scope.row.isNum" style="color: red">数量不可为空</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="remark" label="备注"> <el-table-column prop="remark" label="备注">
@ -297,21 +299,35 @@ export default {
}) })
.catch(() => {}); .catch(() => {});
}, },
setCode(row) { changeNum(row) {
const tempM = this.materialList.filter(item => { if (row.num !== '') {
if (row.materialId === item.id) { row.isNum = false
row.materialCode = item.code
}
return row.materialId === item.id
})
if (tempM[0].unit) {
this.unitList.filter(u => {
if (tempM[0].unit === u.value) {
row.unit = u.value
row.mUnit = u.label
}
})
} else { } else {
row.isNum = true
}
},
setCode(row) {
if (row.materialId) {
row.isShow = false
const tempM = this.materialList.filter(item => {
if (row.materialId === item.id) {
row.materialCode = item.code
}
return row.materialId === item.id
})
if (tempM[0].unit) {
this.unitList.filter(u => {
if (tempM[0].unit === u.value) {
row.unit = u.value
row.mUnit = u.label
}
})
} else {
row.unit = null
row.mUnit = ''
}
} else {
row.isShow = true
row.unit = null row.unit = null
row.mUnit = '' row.mUnit = ''
} }
@ -322,6 +338,7 @@ export default {
row.isEdit = true row.isEdit = true
}, },
saveData(row) { saveData(row) {
if (row.materialId) {
// this.$refs['dataForm'].validate((valid) => { // this.$refs['dataForm'].validate((valid) => {
// if (valid) { // if (valid) {
// //
@ -336,13 +353,16 @@ export default {
return; return;
} }
// //
createMaterialPBDet({ createMaterialPBDet({
...row ...row
}).then((response) => { }).then((response) => {
this.$modal.msgSuccess('新增成功'); this.$modal.msgSuccess('新增成功');
// this.visible = false; // this.visible = false;
this.getList(); this.getList();
}); });
} else {
this.$message.warning('请选择物料!')
}
// } // }
// }); // });
}, },

View File

@ -110,7 +110,7 @@ export default {
}, },
{ {
type: 'button', type: 'button',
btnName: '搜索', btnName: '查询',
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
@ -149,6 +149,27 @@ export default {
}, },
created() {}, created() {},
methods: { methods: {
//
deleteHandle(id, name, index) {
this.$confirm(`确定确认删除工厂名称为"${name}"的数据项?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.urlOptions.deleteURL(id).then(({ data }) => {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
},
});
});
})
.catch(() => { });
},
buttonClick(val) { buttonClick(val) {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':

View File

@ -7,13 +7,14 @@
<template> <template>
<el-drawer <el-drawer
ref="drawer"
:visible.sync="visible" :visible.sync="visible"
:show-close="false" :show-close="false"
:wrapper-closable="false" :wrapper-closable="false"
class="drawer" class="drawer"
size="60%"> size="60%">
<small-title slot="title" :no-padding="true"> <small-title slot="title" :no-padding="true">
{{ isdetail ? '查看详情' : '新增' }} {{ isdetail ? '查看详情' : !dataForm.id ? '新增' : '编辑' }}
</small-title> </small-title>
<el-form <el-form
ref="dataForm" ref="dataForm"
@ -93,20 +94,20 @@
:table-data="list" /> :table-data="list" />
</el-form-item> </el-form-item>
<el-form-item label="巡检详情" prop="description"> <el-form-item label="巡检详情" prop="description">
<editor v-model="dataForm.description" :read-only="isdetail" :min-height="380"/> <editor v-model="dataForm.description" :read-only="isdetail" :min-height="150"/>
</el-form-item> </el-form-item>
<el-form-item label="附件"> <el-form-item label="附件">
<FileUpload v-model="file" :disabled="isdetail" /> <FileUpload v-model="file" :limit="1" :f-name="fileName" :disabled="isdetail" @name="setFileName" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="drawer-body__footer"> <div class="drawer-body__footer">
<el-button type="primary" @click="goback()">取消</el-button> <el-button type="primary" @click="goback()">{{ isdetail ? '关闭' : '取消' }}</el-button>
<el-button v-if="isdetail" type="primary" @click="goEdit()"> <!-- <el-button v-if="isdetail" type="primary" @click="goEdit()">
编辑 编辑
</el-button> </el-button> -->
<el-button v-else type="primary" @click="dataFormSubmit()">确定</el-button> <el-button v-if="!isdetail" type="primary" @click="dataFormSubmit()">确定</el-button>
</div> </div>
</el-drawer> </el-drawer>
</template> </template>
@ -184,6 +185,7 @@ export default {
total: 0, total: 0,
}, },
file: '', file: '',
fileName: '',
dataRule: { dataRule: {
responsible: [{ required: true, message: "巡检人不能为空", trigger: "blur" }], responsible: [{ required: true, message: "巡检人不能为空", trigger: "blur" }],
actualTime: [{ required: true, message: "巡检时间不能为空", trigger: "blur" }] actualTime: [{ required: true, message: "巡检时间不能为空", trigger: "blur" }]
@ -194,6 +196,9 @@ export default {
this.getDict() this.getDict()
}, },
methods: { methods: {
setFileName(val) {
this.fileName = val
},
async getDict() { async getDict() {
const res = await getEquipmentAll() const res = await getEquipmentAll()
this.eqList = res.data this.eqList = res.data
@ -232,6 +237,8 @@ export default {
files: [] files: []
} }
this.list = [] this.list = []
this.file = ''
this.fileName = ''
}, },
init(id, isdetail) { init(id, isdetail) {
this.initData(); this.initData();
@ -239,6 +246,10 @@ export default {
this.dataForm.id = id || undefined; this.dataForm.id = id || undefined;
this.visible = true; this.visible = true;
// const scrollContainer = this.$refs.dataForm;
// const scrollPosition = scrollContainer.scrollTop;
// console.log('12', scrollPosition);
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields(); this.$refs['dataForm'].resetFields();
@ -247,6 +258,11 @@ export default {
getEqCheckLog(this.dataForm.id).then(response => { getEqCheckLog(this.dataForm.id).then(response => {
this.formLoading = false this.formLoading = false
this.dataForm = response.data; this.dataForm = response.data;
if (this.dataForm.files.length > 0) {
this.file = this.dataForm.files[0].fileUrl
this.fileName = this.dataForm.files[0].fileName
}
this.setConfig()
}); });
} else { } else {
// if (this.urlOptions.isGetCode) { // if (this.urlOptions.isGetCode) {
@ -283,8 +299,9 @@ export default {
if (this.file) { if (this.file) {
const temp = this.file.split(',') // const temp = this.file.split(',') //
let arry = [] let arry = []
temp.forEach(item => { temp.forEach((item, index) => {
arry.push({ arry.push({
fileName: this.fileName,
fileType: 2, fileType: 2,
fileUrl: item fileUrl: item
}) })

View File

@ -0,0 +1,105 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2023-11-25 16:23:13
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="配置名称" prop="name">
<el-input
v-model="dataForm.name"
placeholder="请输入配置名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="配置编码" prop="code">
<el-input
v-model="dataForm.code"
placeholder="请输入配置编码" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="设备名称" prop="equipmentId">
<el-select
v-model="dataForm.equipmentId"
filterable
style="width: 100%"
placeholder="请选择设备名称"
@change="setCode">
<el-option
v-for="dict in eqList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备编码" prop="equipmentCode">
<el-input v-model="dataForm.equipmentCode" disabled placeholder="请输入设备编码" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '../../../../core/mixins/basic-add';
import { getEqCheck, getCode, createCheckConfig, updateCheckConfig } from "@/api/equipment/base/inspection/settings";
import { getEquipmentAll } from '@/api/base/equipment'
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: true,
codeURL: getCode,
createURL: createCheckConfig,
updateURL: updateCheckConfig,
infoURL: getEqCheck,
},
dataForm: {
id: undefined,
code: undefined,
name: undefined,
equipmentId: undefined,
equipmentCode: undefined
},
eqList: [],
dataRule: {
equipmentId: [{ required: true, message: "设备不能为空", trigger: "blur" }],
code: [{ required: true, message: "配置编码不能为空", trigger: "blur" }],
name: [{ required: true, message: "配置名称不能为空", trigger: "blur" }],
}
};
},
mounted() {
this.getDict()
},
methods: {
async getDict() {
//
const res = await getEquipmentAll()
this.eqList = res.data
},
setCode() {
const chooseM = this.eqList.filter(item => {
return item.id === this.dataForm.equipmentId
})
this.dataForm.equipmentCode = chooseM[0].code
}
},
};
</script>

View File

@ -36,14 +36,10 @@
:dialogVisible="open" :dialogVisible="open"
@close="cancel" @close="cancel"
@cancel="cancel" @cancel="cancel"
@confirm="submitForm"> @confirm="handleConfirm">
<DialogForm <add
v-if="open" ref="add"
ref="form" @refreshDataList="successSubmit" />
v-model="form"
:disabled="mode == 'detail'"
:has-files="false"
:rows="rows" />
</base-dialog> </base-dialog>
<!-- 添加巡检查看详情 --> <!-- 添加巡检查看详情 -->
<addOrUpdata <addOrUpdata
@ -56,12 +52,13 @@
<script> <script>
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import addOrUpdata from './add-or-updata.vue'; import addOrUpdata from './add-or-updata.vue';
import add from './add.vue'
// import { publicFormatter } from '@/utils/dict'; // import { publicFormatter } from '@/utils/dict';
// const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'); // const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
export default { export default {
name: 'EquipmentCheckSetting', name: 'EquipmentCheckSetting',
components: { addOrUpdata }, components: { addOrUpdata, add },
mixins: [basicPageMixin], mixins: [basicPageMixin],
data() { data() {
return { return {
@ -206,6 +203,13 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
handleConfirm() {
this.$refs.add.dataFormSubmit()
},
successSubmit() {
this.cancel()
this.getList()
},
initSearchBar() { initSearchBar() {
this.http('/base/core-equipment/listAll', 'get').then(({ data }) => { this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
this.$set( this.$set(
@ -230,9 +234,10 @@ export default {
}, },
/** 取消按钮 */ /** 取消按钮 */
cancel() { cancel() {
this.$refs.add.formClear()
this.open = false; this.open = false;
this.mode = null; this.title = ''
this.reset(); // this.reset();
}, },
/** 表单重置 */ /** 表单重置 */
reset() { reset() {
@ -257,18 +262,26 @@ export default {
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); // this.reset();
this.open = true; this.open = true;
this.title = '添加巡检设置'; this.title = '添加巡检设置';
this.$nextTick(() => {
this.$refs.add.init();
});
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); // this.reset();
const id = row.id; // const id = row.id;
this.info({ id }).then((response) => { // this.info({ id }).then((response) => {
this.form = response.data; // this.form = response.data;
this.open = true; // this.open = true;
this.title = '修改巡检设置'; // this.title = '';
// });
this.open = true;
this.title = '修改巡检设置';
this.$nextTick(() => {
this.$refs.add.init(row.id);
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
@ -298,7 +311,7 @@ export default {
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
this.$modal this.$modal
.confirm('是否确认删除该巡检记录?') .confirm('是否确认删除配置名为"' + row.name + '"的数据项?')
.then(() => { .then(() => {
return this.del({ id }); return this.del({ id });
}) })

View File

@ -146,7 +146,7 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col> <el-col>
<el-form-item label="维修附件" prop="file"> <el-form-item label="维修附件" prop="file">
<FileUpload v-model="file" :disabled="disabled" /> <FileUpload v-model="file" :limit="1" :f-name="fileName" :disabled="disabled" @name="setFileName" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -206,11 +206,15 @@ export default {
visible: false, visible: false,
disabled: false, disabled: false,
dataForm: {}, dataForm: {},
file: '' file: '',
fileName: ''
}; };
}, },
mounted() {}, mounted() {},
methods: { methods: {
setFileName(val) {
this.fileName = val
},
goback() { goback() {
this.$emit('refreshDataList'); this.$emit('refreshDataList');
this.visible = false; this.visible = false;
@ -225,12 +229,15 @@ export default {
resetFields(args) { resetFields(args) {
return this.$refs.form.resetFields(args); return this.$refs.form.resetFields(args);
}, },
initData() {
this.file = ''
this.fileName = ''
},
init(row, isdetail) { init(row, isdetail) {
// this.initData(); this.initData();
this.disabled = isdetail || false; this.disabled = isdetail || false;
this.dataForm.id = row.id || undefined; this.dataForm.id = row.id || undefined;
this.visible = true; this.visible = true;
console.log('111', this.dataForm, row)
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['form'].resetFields(); this.$refs['form'].resetFields();
@ -241,6 +248,10 @@ export default {
this.formLoading = false this.formLoading = false
this.dataForm = response.data; this.dataForm = response.data;
this.dataForm.maintenanceStatus = row.maintenanceStatus || 0 this.dataForm.maintenanceStatus = row.maintenanceStatus || 0
if (this.dataForm.files.length > 0) {
this.file = this.dataForm.files[0].fileUrl
this.fileName = this.dataForm.files[0].fileName
}
}); });
} else { } else {
// if (this.urlOptions.isGetCode) { // if (this.urlOptions.isGetCode) {
@ -261,6 +272,7 @@ export default {
let arry = [] let arry = []
temp.forEach(item => { temp.forEach(item => {
arry.push({ arry.push({
fileName: this.fileName,
fileType: 2, fileType: 2,
fileUrl: item fileUrl: item
}) })