fix:返工物料名称标注
This commit is contained in:
parent
ed4cc66303
commit
896cba6bc9
|
@ -3,8 +3,18 @@
|
||||||
<div v-if="initloading" class="sc-select-loading">
|
<div v-if="initloading" class="sc-select-loading">
|
||||||
<el-icon class="is-loading"><el-icon-loading /></el-icon>
|
<el-icon class="is-loading"><el-icon-loading /></el-icon>
|
||||||
</div>
|
</div>
|
||||||
<el-select v-bind="$attrs" :loading="loading" @visible-change="visibleChange" :value-on-clear="null">
|
<el-select
|
||||||
<el-option v-for="item in options" :key="item[id]" :label="item[name]" :value="objValueType ? item : item[id]">
|
v-bind="$attrs"
|
||||||
|
:loading="loading"
|
||||||
|
@visible-change="visibleChange"
|
||||||
|
:value-on-clear="null"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in options"
|
||||||
|
:key="item[id]"
|
||||||
|
:label="item[name]"
|
||||||
|
:value="objValueType ? item : item[id]"
|
||||||
|
>
|
||||||
<slot name="option" :data="item"></slot>
|
<slot name="option" :data="item"></slot>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
@ -12,67 +22,103 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
apiObj: { type: Object, default: () => {} },
|
apiObj: { type: Object, default: () => {} },
|
||||||
objValueType: { type: Boolean, default: false },
|
objValueType: { type: Boolean, default: false },
|
||||||
params: { type: Object, default: () => ({}) },
|
params: { type: Object, default: () => ({}) },
|
||||||
id: {type: String, default: 'id'},
|
id: { type: String, default: "id" },
|
||||||
name: {type: String, default: 'name'},
|
name: { type: String, default: "name" },
|
||||||
showName: {type: String, default: null},
|
showName: { type: String, default: null },
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
options: [],
|
options: [],
|
||||||
initloading: false
|
initloading: false,
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
//如果有默认值就去请求接口获取options
|
//如果有默认值就去请求接口获取options
|
||||||
if(this.hasValue()){
|
if (this.hasValue()) {
|
||||||
this.initloading = true
|
this.initloading = true;
|
||||||
this.getRemoteData()
|
this.getRemoteData();
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
//选项显示隐藏事件
|
|
||||||
visibleChange(ispoen){
|
|
||||||
if(ispoen && this.options.length==0 && this.apiObj){
|
|
||||||
this.getRemoteData()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//获取数据
|
|
||||||
async getRemoteData(){
|
|
||||||
this.loading = true
|
|
||||||
var query = Object.assign({page:0}, this.params)
|
|
||||||
var res = await this.apiObj.req(query)
|
|
||||||
this.loading = false
|
|
||||||
this.initloading = false
|
|
||||||
if (this.$attrs.modelValue !== null && !res.some(option => option[this.id] === this.$attrs.modelValue)) {
|
|
||||||
this.options = [{ [this.id]: this.$attrs.modelValue, [this.name]: this.showName }, ...res];
|
|
||||||
}else{
|
|
||||||
this.options = res
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//判断是否有回显默认值
|
|
||||||
hasValue(){
|
|
||||||
if(Array.isArray(this.$attrs.modelValue) && this.$attrs.modelValue.length <= 0){
|
|
||||||
return false
|
|
||||||
}else if(this.$attrs.modelValue){
|
|
||||||
return true
|
|
||||||
}else{
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
methods: {
|
||||||
|
//选项显示隐藏事件
|
||||||
|
visibleChange(ispoen) {
|
||||||
|
if (ispoen && this.options.length == 0 && this.apiObj) {
|
||||||
|
this.getRemoteData();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//获取数据
|
||||||
|
async getRemoteData() {
|
||||||
|
this.loading = true;
|
||||||
|
var query = Object.assign({ page: 0 }, this.params);
|
||||||
|
var res = await this.apiObj.req(query);
|
||||||
|
this.loading = false;
|
||||||
|
this.initloading = false;
|
||||||
|
if (
|
||||||
|
this.$attrs.modelValue !== null &&
|
||||||
|
!res.some(
|
||||||
|
(option) => option[this.id] === this.$attrs.modelValue
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
this.options = [
|
||||||
|
{
|
||||||
|
[this.id]: this.$attrs.modelValue,
|
||||||
|
[this.name]: this.showName,
|
||||||
|
},
|
||||||
|
...res,
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
this.options = res;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//判断是否有回显默认值
|
||||||
|
hasValue() {
|
||||||
|
if (
|
||||||
|
Array.isArray(this.$attrs.modelValue) &&
|
||||||
|
this.$attrs.modelValue.length <= 0
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
} else if (this.$attrs.modelValue) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.sc-select {display: inline-block;position: relative;min-width: 120px;}
|
.sc-select {
|
||||||
.sc-select-loading {position: absolute;top:0;left:0;right:0;bottom:0;background: #fff;z-index: 100;border-radius: 5px;border: 1px solid #EBEEF5;display: flex;align-items: center;padding-left:10px;}
|
display: inline-block;
|
||||||
.sc-select-loading i {font-size: 14px;}
|
position: relative;
|
||||||
|
min-width: 120px;
|
||||||
|
}
|
||||||
|
.sc-select-loading {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: #fff;
|
||||||
|
z-index: 100;
|
||||||
|
border-radius: 5px;
|
||||||
|
border: 1px solid #ebeef5;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding-left: 10px;
|
||||||
|
}
|
||||||
|
.sc-select-loading i {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
.dark .sc-select-loading {background: var(--el-bg-color-overlay);border-color: var(--el-border-color-light);}
|
.dark .sc-select-loading {
|
||||||
|
background: var(--el-bg-color-overlay);
|
||||||
|
border-color: var(--el-border-color-light);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -13,14 +13,14 @@
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
@click="table_add(10)"
|
@click="table_add(10)"
|
||||||
v-auth="'mgroup.create'"
|
v-auth="'mllog.create'"
|
||||||
>新增</el-button
|
>新增</el-button
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
@click="table_add(20)"
|
@click="table_add(20)"
|
||||||
v-auth="'mgroup.create'"
|
v-auth="'mlog.submit'"
|
||||||
>返工</el-button
|
>返工</el-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
@ -76,9 +76,9 @@
|
||||||
<el-table-column label="数量" prop="count"></el-table-column>
|
<el-table-column label="数量" prop="count"></el-table-column>
|
||||||
<el-table-column label="类型" prop="type">
|
<el-table-column label="类型" prop="type">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag v-if="scope.row.type == 10">交送</el-tag>
|
<el-tag v-if="scope.row.type == 10">正常</el-tag>
|
||||||
<el-tag v-if="scope.row.type == 20" type="success"
|
<el-tag v-if="scope.row.type == 20" type="danger"
|
||||||
>接收</el-tag
|
>返工</el-tag
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
link
|
link
|
||||||
size="small"
|
size="small"
|
||||||
@click="table_edit(scope.row)"
|
@click="table_edit(scope.row)"
|
||||||
v-auth="'mgroup.update'"
|
v-auth="'mlog.update'"
|
||||||
type="primary"
|
type="primary"
|
||||||
v-if="
|
v-if="
|
||||||
scope.row.send_mgroup == mgroupId &&
|
scope.row.send_mgroup == mgroupId &&
|
||||||
|
@ -145,7 +145,7 @@
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
size="small"
|
size="small"
|
||||||
v-auth="'mgroup.delete'"
|
v-auth="'mlog.delete'"
|
||||||
type="danger"
|
type="danger"
|
||||||
>删除</el-button
|
>删除</el-button
|
||||||
>
|
>
|
||||||
|
|
|
@ -42,8 +42,15 @@
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="物料名称"
|
label="物料名称"
|
||||||
prop="material_name"
|
prop="material_name"
|
||||||
min-width="120"
|
min-width="150"
|
||||||
></el-table-column>
|
>
|
||||||
|
<template #default="scope">
|
||||||
|
{{ scope.row.material_name }}
|
||||||
|
<span v-if="scope.row.material_origin != null"
|
||||||
|
>({{ scope.row.material_origin_name }})</span
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="批次号"
|
label="批次号"
|
||||||
prop="batch"
|
prop="batch"
|
||||||
|
|
|
@ -112,7 +112,6 @@
|
||||||
type="datetime"
|
type="datetime"
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:disabledDate="disabledDateFn"
|
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -130,7 +129,13 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :md="12" :sm="24">
|
<el-col :md="12" :sm="24">
|
||||||
<el-form-item label="操作人">
|
<el-form-item label="操作人">
|
||||||
<el-select
|
<ehsSelect
|
||||||
|
v-model="form.handle_user"
|
||||||
|
:showName="form.handle_user_name"
|
||||||
|
:apiObj="this.$API.system.user.list"
|
||||||
|
:params="{ depts: dept }"
|
||||||
|
></ehsSelect>
|
||||||
|
<!-- <el-select
|
||||||
v-model="form.handle_user"
|
v-model="form.handle_user"
|
||||||
placeholder="操作人"
|
placeholder="操作人"
|
||||||
clearable
|
clearable
|
||||||
|
@ -142,7 +147,7 @@
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :md="12" :sm="24">
|
<el-col :md="12" :sm="24">
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
@click="table_add"
|
@click="table_add"
|
||||||
v-auth="'mgroup.create'"
|
v-auth="'mlog.create'"
|
||||||
>新增</el-button
|
>新增</el-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
label="操作"
|
label="操作"
|
||||||
fixed="right"
|
fixed="right"
|
||||||
align="center"
|
align="center"
|
||||||
width="180"
|
width="150"
|
||||||
>
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
|
@ -94,10 +94,6 @@
|
||||||
@click.stop="table_edit(scope.row)"
|
@click.stop="table_edit(scope.row)"
|
||||||
>编辑</el-button
|
>编辑</el-button
|
||||||
>
|
>
|
||||||
<el-divider
|
|
||||||
direction="vertical"
|
|
||||||
v-if="scope.row.submit_time == null"
|
|
||||||
></el-divider>
|
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
size="small"
|
size="small"
|
||||||
|
@ -105,16 +101,23 @@
|
||||||
type="primary"
|
type="primary"
|
||||||
>详情</el-button
|
>详情</el-button
|
||||||
>
|
>
|
||||||
<el-divider direction="vertical"></el-divider>
|
|
||||||
|
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
size="small"
|
size="small"
|
||||||
v-auth="'mgroup.delete'"
|
v-auth="'mlog.delete'"
|
||||||
type="danger"
|
type="danger"
|
||||||
|
v-if="scope.row.submit_time == null"
|
||||||
@click.stop="table_del(scope.row, scope.$index)"
|
@click.stop="table_del(scope.row, scope.$index)"
|
||||||
>删除</el-button
|
>删除</el-button
|
||||||
>
|
>
|
||||||
|
<!-- <el-button
|
||||||
|
link
|
||||||
|
v-else
|
||||||
|
size="small"
|
||||||
|
type="danger"
|
||||||
|
@click.stop="mlogRevert(scope.row)"
|
||||||
|
>撤回</el-button
|
||||||
|
> -->
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</scTable>
|
</scTable>
|
||||||
|
@ -178,7 +181,7 @@ export default {
|
||||||
that.$API.mtm.mgroup.list
|
that.$API.mtm.mgroup.list
|
||||||
.req({ page: 0, search: that.mgroupName })
|
.req({ page: 0, search: that.mgroupName })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if(res.length != 1){
|
if (res.length != 1) {
|
||||||
that.$message.error("获取工段错误");
|
that.$message.error("获取工段错误");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -191,20 +194,21 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//添加
|
//添加日志
|
||||||
table_add() {
|
table_add() {
|
||||||
this.dialog.save = true;
|
this.dialog.save = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.saveDialog.open("add");
|
this.$refs.saveDialog.open("add");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//编辑
|
//编辑日志
|
||||||
table_edit(row) {
|
table_edit(row) {
|
||||||
this.dialog.save = true;
|
this.dialog.save = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.saveDialog.open("edit").setData(row);
|
this.$refs.saveDialog.open("edit").setData(row);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
//日志详情
|
||||||
table_detail(row) {
|
table_detail(row) {
|
||||||
this.mlogId = row.id;
|
this.mlogId = row.id;
|
||||||
this.dialog.detail = true;
|
this.dialog.detail = true;
|
||||||
|
@ -212,7 +216,7 @@ export default {
|
||||||
this.$refs.detailDialog.open();
|
this.$refs.detailDialog.open();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//删除
|
//日志删除
|
||||||
table_del(row) {
|
table_del(row) {
|
||||||
this.$confirm(`确定删除吗?`, "提示", {
|
this.$confirm(`确定删除吗?`, "提示", {
|
||||||
type: "warning",
|
type: "warning",
|
||||||
|
@ -228,6 +232,23 @@ export default {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
//日志撤回
|
||||||
|
mlogRevert(row) {
|
||||||
|
this.$confirm(`确定撤回该日志吗?`, "提示", {
|
||||||
|
type: "warning",
|
||||||
|
}).then(() => {
|
||||||
|
var id = row.id;
|
||||||
|
this.$API.wpm.mlog.revert.req(id).then((res) => {
|
||||||
|
if (res.err_msg) {
|
||||||
|
this.$message.error(res.err_msg);
|
||||||
|
} else {
|
||||||
|
this.$refs.table.refresh();
|
||||||
|
this.$message.success("撤回成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
//表格选择后回调事件
|
//表格选择后回调事件
|
||||||
selectionChange(selection) {
|
selectionChange(selection) {
|
||||||
this.selection = selection;
|
this.selection = selection;
|
||||||
|
|
Loading…
Reference in New Issue