Commit c53b13f9 authored by 仇晓婷's avatar 仇晓婷

制造资源

parent 8d90a966
......@@ -54,6 +54,7 @@
@on-drag-drop="onDragDrop"
@on-selection-change="selectionChange"
@on-select="onSelect"
@on-select-all="allChange"
:row-key="rowKey"
></Table>
</div>
......@@ -488,6 +489,9 @@ export default {
onSelect(rows, row) {
this.$emit("on-change", rows, row);
},
allChange(items) {
this.$emit("all-change", items);
},
intY() {
if (this.$refs.table != undefined) {
this.firstY = this.$refs.table.$el.getBoundingClientRect().top;
......
......@@ -30,7 +30,7 @@
</div>
<div class="fg">
<dl>
<dd v-for="(li,i) in checkedItems">
<dd v-for="(li,i) in checkedItems" :key="i">
<div class="flex">
<span class="fg">{{li.userName}}</span>
<a @click="removeItem(li)">
......@@ -73,14 +73,14 @@
export default {
model: {
prop: "value",
event: "on-change"
event: "on-change",
},
data() {
return {
name: this.value,
data: [],
departId: "",
group: []
group: [],
};
},
created() {
......@@ -94,38 +94,43 @@ export default {
value: [String, Number, Array],
placeholder: {
type: String,
default: "请选择人员"
default: "请选择人员",
},
multiple: {
type: Boolean,
default: false
default: false,
},
theme: {
type: String,
default: "select"
default: "select",
},
type: {
type: Number,
default: 0
default: 0,
},
departmentId: {
type: Number,
default: 0
default: 0,
},
roleTitle: {
type: String,
default: ""
default: "",
},
datas: {
//自定义用户数据
type: Array,
default: null
}
default: null,
},
},
methods: {
change(event) {
// console.log(event)
this.$emit("on-change", event);
let name = "";
this.data.forEach((e) => {
if (e.id == event) {
name = e.label;
}
});
this.$emit("on-change", event, name);
},
// 加载人员
getselectuser(id) {
......@@ -135,10 +140,10 @@ export default {
// pageIndex: 1,
departmentId: id,
type: this.type,
roleTitle: this.roleTitle
roleTitle: this.roleTitle,
// pageSize: 0
})
.then(r => {
.then((r) => {
this.data = r.result;
if (this.theme == "list") {
this.departmentGroup();
......@@ -149,11 +154,11 @@ export default {
var group = [];
var users = this.$u.clone(this.data);
if (this.name && this.name.length > 0) {
users.map(u => {
users.map((u) => {
u.checked = this.name.indexOf(u.id) > -1;
});
}
group = this.$u.group(users, u => {
group = this.$u.group(users, (u) => {
return u.departmentId;
});
var deps = [];
......@@ -163,7 +168,7 @@ export default {
departmentId: u[0].departmentId,
children: u,
opened: (i = 0),
checked: false
checked: false,
});
});
this.group = deps;
......@@ -181,7 +186,7 @@ export default {
removeItem(item) {
this.group.map((u, i) => {
if (u.departmentId == item.departmentId) {
u.children.map(p => {
u.children.map((p) => {
if (p.id == item.id) {
p.checked = false;
}
......@@ -194,13 +199,13 @@ export default {
//list 时,设置值。
listSetValue() {
var ids = [];
this.checkedItems.map(u => {
this.checkedItems.map((u) => {
ids.push(u.id);
});
this.$emit("on-change", ids);
},
checkAll(item, i) {
item.children.map(u => {
item.children.map((u) => {
u.checked = item.checked;
});
this.$set(this.group, i, this.group[i]);
......@@ -210,19 +215,19 @@ export default {
getSelectItems() {
var items = [];
if (this.theme == "list") {
this.checkedItems.map(u => {
this.checkedItems.map((u) => {
items.push(u);
});
} else {
if (!this.multiple) {
//单选时返回信息
if (this.datas && this.datas.length > 0) {
var item2 = this.datas.filter(u => u.value == this.value);
var item2 = this.datas.filter((u) => u.value == this.value);
if (item2 && item2[0]) {
items.push(item2[0]);
}
} else {
var item1 = this.dic.filter(u => u.value == this.value);
var item1 = this.dic.filter((u) => u.value == this.value);
if (item1 && item1[0]) {
items.push(item1[0]);
}
......@@ -230,15 +235,15 @@ export default {
} else {
//复选时返回
if (this.datas && this.datas.length > 0) {
this.value.forEach(v => {
var item3 = this.dic.filter(u => u.value == v);
this.value.forEach((v) => {
var item3 = this.dic.filter((u) => u.value == v);
if (item3 && item3[0]) {
items.push(item3[0]);
}
});
} else {
this.value.forEach(v => {
var item = this.dic.filter(u => u.value == v);
this.value.forEach((v) => {
var item = this.dic.filter((u) => u.value == v);
if (item && item[0]) {
items.push(item[0]);
}
......@@ -253,21 +258,21 @@ export default {
getSelectNames() {
var names = [];
if (this.theme == "list") {
this.checkedItems.map(u => {
this.checkedItems.map((u) => {
items.push(u.userName);
});
} else {
this.getSelectItems().forEach(v => {
this.getSelectItems().forEach((v) => {
names.push(v.label);
});
}
return names;
}
},
},
computed: {
dic() {
let result = [];
this.data.forEach(u => {
this.data.forEach((u) => {
// result.push({
// value: u.id,
// label: u.userName
......@@ -279,43 +284,43 @@ export default {
},
checkedItems() {
var items = [];
this.group.map(u => {
u.children.map(l => {
this.group.map((u) => {
u.children.map((l) => {
if (l.checked) {
items.push(l);
}
});
});
return items;
}
},
},
filters: {
vvv: lis => {
vvv: (lis) => {
return 3;
// return lis.filter(u=>{
// return u.checked==true
// }).lenght;
}
},
},
watch: {
value: {
handler(v, o) {
this.name = v;
},
deep: true
deep: true,
},
departmentId: {
handler(v, o) {
this.getselectuser(v);
},
deep: true
deep: true,
},
datas(v) {
if (v) {
//alert(JSON.stringify(v))
}
}
}
},
},
};
</script>
<style lang="less">
......
......@@ -42,7 +42,7 @@
</Col>
<Row>
<Col v-for="li in fileds" :key="li.field" :span="li.span">
<FormItem :label="li.title" :prop="li.name" v-if="li.title!='资源名称'&&li.title!='资源编'">
<FormItem :label="li.title" :prop="li.name" v-if="li.title!='资源名称'&&li.title!='资源编'">
<Input v-if="li.dataType==0" v-model="entity.json[li.field]"></Input>
<InputNumber
v-if="li.dataType==1||li.dataType==2"
......
......@@ -2,8 +2,9 @@ import Api from '@/plugins/request'
export default {
// index: `${resourceUrl}/resource/paged`,
index: `${resourceUrl}/resourcenew/paged`,
paged(params) {
return Api.post(`${resourceUrl}/resource/paged`, params);
index1: `${resourceUrl}/trolley/paged`, //借出记录
paged(params) { //借出记录查询明细
return Api.post(`${resourceUrl}/trolleyitem/paged`, params);
},
get(params) {
return Api.get(`${resourceUrl}/resourcenew/get`, params);
......
......@@ -20,7 +20,12 @@
</Col>
<Col span="7">
<FormItem label="领料人" style="width:100%" prop="customerId">
<UserSelect ref="userSelected" v-model="resource.customerId" :type="0" />
<UserSelect
ref="userSelected"
v-model="resource.customerId"
:type="0"
@on-change="change"
/>
</FormItem>
</Col>
</Row>
......@@ -35,159 +40,210 @@
</div>
</template>
<script>
import Api from './api'
import Api from "./api";
export default {
name: 'Add',
name: "Add",
data() {
let userInfo=this.$store.state.admin.user.info;
let userInfo = this.$store.state.admin.user.info;
return {
columns: [
{
key: 'resourceId',
title: this.l('resourceId'),
width: 180
},
key: "resourceCode",
title: this.l("resourceId"),
align: "left",
easy: true,
render: (h, params) => {
return h(
"a",
{
title: this.l('nameOfResource'),
key: 'nameOfResource'
props: {},
style: {},
on: { click: () => this.detail(params.row.id) },
},
params.row.resourceCode
);
},
{
title: this.l('specifications'),
key: 'specifications',
width: 100
},
{
title: this.l('measuringUnit'),
key: 'measuringUnit',
width: 100
key: "nameOfResource",
title: this.l("nameOfResource"),
align: "left",
easy: true,
tooltip: true,
},
{
title: this.l('qualityCharacteristics'),
key: 'qualityCharacteristics',
width: 100
key: "code",
title: "编码",
align: "left",
width: 150,
},
// {
// key: "creatorUserId",
// title: this.l("creatorUserId"),
// hide: false,
// type: "user",
// align: "left",
// },
{
key: "totalNum",
title: this.l("totalNum"),
align: "left",
easy: true,
},
{
title: this.l('batchNo'),
key: 'batchNo',
width: 100
key: "numberAvailable",
title: "借出数",
align: "left",
easy: true,
},
// {
// key: "storeId",
// title: this.l("storeId"),
// align: "left",
// high: true,
// hide: true,
// },
{
key: "storeTitle",
title: this.l("storeTitle"),
align: "left",
},
{
title: this.l('storeTitle'),
key: 'storeTitle',
width: 100
key: "state",
title: this.l("state"),
align: "left",
render: (h, params) => {
return h("state", {
props: {
code: "mes_xingchi_resource.resource.state",
type: "text",
value: params.row.state + "",
},
});
},
},
{
title: this.l('numberAvailable'),
key: 'numberAvailable',
width: 120,
slot: 'numberAvailable'
title: this.l("numberAvailable"),
key: "numberAvailable",
width: 100,
slot: "numberAvailable",
},
{
title: this.l('action'),
key: 'action',
title: this.l("action"),
key: "action",
width: 100,
align: 'center',
align: "center",
render: (h, params) => {
return h('div', { class: 'action' }, [
return h("div", { class: "action" }, [
h(
'a',
"a",
{
class: 'remove',
on: { click: () => this.remove(params.row.id) }
class: "remove",
on: { click: () => this.remove(params.row.id) },
},
"删除"
),
]);
},
},
'删除'
)
])
}
}
],
resource: {
libraryTube: userInfo.userName, //库管员
libraryTubeId: userInfo.userId, //库管员ID
customer: '', //领料人
customer: "", //领料人
customerId: null, //领料人ID
category: 0, //类别
state: 2, //状态
item: []
item: [],
},
rules: {
customerId: [
{ required: true, message: '请选择', trigger: 'blur', type: 'number' }
]
}
}
{
required: true,
message: "请选择",
trigger: "blur",
type: "number",
},
],
},
};
},
props: {
cartList: {
type: [Array],
default: ()=>{
return []
}
}
default: () => {
return [];
},
},
},
methods: {
change(val, name) {
this.resource.customer = name;
},
handleSubmit() {
var items = []
let count = 0
var items = [];
let count = 0;
this.cartList.forEach((data) => {
let objList = Object.assign({}, this.resource)
delete objList.item
objList.resourceId = data.id
objList.count = data.numberAvailable
items.push(objList)
count += 1
})
this.resource.item = items
let objList = Object.assign({}, this.resource);
delete objList.item;
console.log(data);
objList.resourceId = data.resourceId;
objList.resourceCode = data.resourceCode;
objList.resourceMainId = data.id;
objList.count = data.numberAvailable;
items.push(objList);
count += 1;
});
this.resource.item = items;
if (this.resource.customerId == 0) {
}
this.$refs.form.validate((v) => {
if (v) {
Api.cartCreate(this.resource).then((r) => {
if (r.success) {
this.$Message.success('保存成功')
this.$emit('substr', count, -1)
this.$emit('on-ok')
this.$Message.success("保存成功");
this.$emit("substr", count, -1);
this.$emit("on-ok");
}
})
});
}
})
});
},
handleClose() {
this.$emit('on-close')
this.$emit("on-close");
},
remove(id) {
const index = this.cartList.findIndex(function(item) {
return item.id === id
})
this.cartList.splice(index, 1)
this.$emit('substr', 1, index)
const index = this.cartList.findIndex(function (item) {
return item.id === id;
});
this.cartList.splice(index, 1);
this.$emit("substr", 1, index);
},
l(key) {
let vkey = 'resource' + '.' + key
return this.$t(vkey) || key
let vkey = "resource" + "." + key;
return this.$t(vkey) || key;
},
changeCustom(val) {
this.resource.customerId = val + ''
this.resource.customerId = val + "";
//this.resource.customer = this.arry2Name(this.userList1, val)
},
arry2Name(arryList, values) {
//类别转换
var codes = arryList
var name = ''
var codes = arryList;
var name = "";
for (let i in codes) {
if (values == codes[i].value) {
name = codes[i].name
name = codes[i].name;
}
}
return name
return name;
},
inputOrderCat(row, index) {
this.cartList[index].numberAvailable = row.numberAvailable
}
this.cartList[index].numberAvailable = row.numberAvailable;
},
},
watch: {}
}
watch: {},
};
</script>
<style>
</style>
\ No newline at end of file
<template>
<div class="addform">
<Form ref="form" :model="entity" :rules="rules" :label-width="100">
<Row class="rowTitle100">
<Col :span="12">
<FormItem :label="l('resourceId')" prop="resourceId">
<Input v-model="entity.resourceId" disabled></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('nameOfResource')" prop="nameOfResource">
<Input v-model="entity.nameOfResource"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('specifications')" >
<Input v-model="entity.specifications"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('totalNum')" prop="totalNum">
<InputNumber v-model="entity.totalNum" :disabled="numdisabled"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('measuringUnit')" >
<Input v-model="entity.measuringUnit"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('qualityCharacteristics')" >
<Input v-model="entity.qualityCharacteristics"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('batchNo')" >
<Input v-model="entity.batchNo"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('storeTitle')" prop="storeTitle">
<Input
v-model="entity.storeTitle"
readonly
clearable
@on-clear="clear"
placeholder="请选择..."
style="width:274px"
>
<Button slot="append" @click="selectStoreHouse">选择</Button>
</Input>
<label slot="append" v-if="false">{{entity.storeId}}</label>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('resourceType')" >
<Dictionary
code="mes_xingchi_resource.resource.resource_type"
v-model="entity.resourceType"
style="width:274px"
></Dictionary>
</FormItem>
</Col>
</Row>
<Row>
<Col span="16">&nbsp;</Col>
<Col span="8">
<FormItem>
<Button @click="handleClose" class="ml20">取消</Button>
<Button type="primary" @click="handleSubmit">保存</Button>
</FormItem>
</Col>
</Row>
</Form>
<StoreHouse
:show.sync="showStoreHouseTree"
:value.sync="entity.storeId"
:text.sync="entity.storeTitle"
:type='4'
/>
</div>
</template>
<script>
import Api from './api'
import StoreHouse from '@/components/modalTree/storeHouse.vue'
export default {
name: 'Edit',
components: {
StoreHouse
},
data() {
return {
entity: {
color: ''
},
rules: {
nameOfResource: [{ required: true, message: '必填', trigger: 'blur' }],
specifications: [{ required: true, message: '必填', trigger: 'blur' }],
totalNum: [
{ required: true, message: '必填', trigger: 'blur', type: 'number' }
],
measuringUnit: [{ required: true, message: '必填', trigger: 'blur' }],
qualityCharacteristics: [
{ required: true, message: '必填', trigger: 'blur' }
],
batchNo: [{ required: true, message: '必填', trigger: 'blur' }],
storeTitle: [{ required: true, message: '必填', trigger: 'blur' }],
resourceType: [{ required: true, message: '必填', trigger: 'blur', type: 'number' }]
},
showStoreHouseTree: false,
numdisabled: false
}
},
props: {
eid: Number
},
methods: {
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result
this.entity.resourceType = r.result.resourceType + ''
if (r.result.totalNum != r.result.numberAvailable) {
this.numdisabled = true
} else {
this.numdisabled = false
}
this.entity.resourceType=parseInt(r.result.resourceType)
this.$emit('on-load')
})
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.entity.state = '1'
if (!this.numdisabled) {
this.entity.numberAvailable = this.entity.totalNum
}
Api.update(this.entity).then((r) => {
if (r.success) {
this.$Message.success('保存成功')
this.$emit('on-ok')
}
})
}
})
},
//清空库房库位控件信息
clear() {
this.entity.storeId = null
this.entity.storeTitle = ''
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = 'resource' + '.' + key
return this.$t(key)
},
selectStoreHouse() {
this.showStoreHouseTree = true
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v)
}
}
}
}
</script>
......@@ -8,7 +8,6 @@
<Icon type="ios-arrow-forward" size="24" />
</a>
</div>
{{this.$store.state.count}}
<Content class="content" :class="!showMenu?'con_bord':''">
<DataGrid
:columns="columns"
......@@ -17,7 +16,7 @@
:conditions="easySearch"
:batch="true"
:format="checkData"
@on-change="onChange"
@all-change="allchange"
@on-selection-change="onSelect"
>
<template slot="easySearch">
......@@ -28,6 +27,9 @@
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
<FormItem>
<a href="#" @click="lendingRecord" class="ml20">借出记录</a>
</FormItem>
</Form>
</template>
<template slot="buttons">
......@@ -38,7 +40,7 @@
</Badge>
</template>
<template slot="batch">
<Button type="primary" class="mr10 ml10" @click="removeOk">加入借出车</Button>
<Button type="primary" class="mr10 ml10" @click="addCart">加入借出车</Button>
</template>
</DataGrid>
<Modal v-model="modal" :title="title" width="1200" footer-hide :fullscreen="fscreeen">
......@@ -67,11 +69,11 @@ export default {
components: {
Search,
},
head: {
title: "库存表",
author: "henq",
description: "stock 7/13/2020 11:48:09 AM",
},
// head: {
// title: "库存表",
// author: "henq",
// description: "stock 7/13/2020 11:48:09 AM",
// },
data() {
return {
action: Api.index,
......@@ -273,17 +275,6 @@ export default {
hide: false,
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{
attrs: {
oprate: "detail",
title: "修改",
},
on: { click: () => this.edit(params.row.id) },
},
"修改"
),
h(
"op",
{
......@@ -321,14 +312,13 @@ export default {
list: [],
cartList: [],
cartListCount: 0,
arrPartPkId: [],
selectRows: [],
};
},
created() {
this.treeHeight = window.innerHeight - 150;
},
mounted() {
this.initTree();
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
......@@ -342,67 +332,38 @@ export default {
},
computed: {},
methods: {
onChange(a, b) {
console.log(a);
console.log(b);
if (b.numberAvailable == 0) {
this.$Message.error("资源无库存");
}
},
checkData(items) {
console.warn("items", items);
return items.map((u) => {
u._disabled = u.numberAvailable <= 0;
u._checked = false;
return u;
});
},
onSelect(a) {
//批量选择
console.log(a);
// console.log(b);
let selectRows = a;
// this.arrPartPkId = [];
// selectRows.forEach((e) => {
// this.arrPartPkId.push(e.part_task_pk);
// });
// let id = arr.id;
// this.cartListCount = this.$store.state.count;
// this.cartList = this.$store.state.cart;
// console.log(this.cartList);
// if (arr.numberAvailable > 0) {
// const index = this.$store.state.cart.findIndex(function (item) {
// return item.id === id;
// });
// console.log(index);
// if (index == -1) {
// arr.numberAvailable1 = arr.numberAvailable; //用于最大借出数量
// this.cartList.push(arr);
// this.cartListCount += 1;
// this.$store.commit("setCart", this.cartList);
// this.$store.commit("setCartCount", this.cartListCount);
// this.$Message.success("加入借出车成功");
// } else {
// this.$Message.error("已加入借出车");
// }
// } else {
// this.$Message.error("资源无库存");
// }
},
removeOk() {
//批量选择移出排产池
this.remove(this.arrPartPkId);
allchange(item) {
this.selectRows = [];
this.selectRows = item;
},
onSelect(item) {
this.selectRows = [];
this.selectRows = item;
},
//加入借出车
addCart(arr) {
let id = arr.id;
this.cartListCount = this.$store.state.count;
this.cartList = this.$store.state.cart;
// console.log(this.cartListCount);
// console.log(this.cartList);
// console.log(this.selectRows);
if (arr.id) {
let id = arr.id;
if (arr.numberAvailable > 0) {
const index = this.$store.state.cart.findIndex(function (item) {
return item.id === id;
});
console.log(index);
// console.log(index);
if (index == -1) {
arr.numberAvailable1 = arr.numberAvailable; //用于最大借出数量
this.cartList.push(arr);
......@@ -416,20 +377,48 @@ export default {
} else {
this.$Message.error("资源无库存");
}
} else {
this.$Message.success("已加入借出车,请在借出车查看");
let a = [];
let n = []; //一个新的临时数组
a = this.selectRows.concat(this.cartList);
//遍历当前数组
for (var i = 0; i < a.length; i++) {
//如果当前数组的第i已经保存进了临时数组,那么跳过,
//否则把当前项push到临时数组里面
if (n.indexOf(a[i]) == -1) n.push(a[i]);
}
console.log(n);
this.cartList = n;
this.cartListCount = n.length;
this.$store.commit("setCart", this.cartList);
this.$store.commit("setCartCount", this.cartListCount);
this.$refs.grid.load();
}
},
//移除借出车
substr(value, index) {
console.log(value);
console.log(index);
if (index > -1) {
this.cartListCount -= value;
this.cartList.splice(index, 1);
if (value == 0) {
this.cartListCount = 0;
}
this.$store.commit("setCart", this.cartList);
this.$store.commit("setCartCount", this.cartListCount);
} else {
console.log(this.$store.state.count);
console.log(this.$store.state.cart);
this.cartListCount = 0;
this.cartList = [];
this.$store.commit("setCart", this.cartList);
this.$store.commit("setCartCount", this.cartListCount);
}
console.log(this.$store.state.count);
console.log(this.$store.state.cart);
},
showCart() {
if (this.$store.state.count > 0) {
......@@ -441,6 +430,9 @@ export default {
this.$Message.error("请将资源加入借出车");
}
},
lendingRecord() {
window.open("/resource/resource/record", "_blank");
},
ok() {
this.$refs.grid.load();
this.modal = false;
......@@ -467,29 +459,30 @@ export default {
this.detail = () => import("./add");
this.modal = true;
},
view(row) {
this.curId = row.id;
this.storeId = row.storeId;
this.mCode = row.materialCode;
this.title = "详情";
this.detail = () => import("./detail");
this.fscreeen = true;
this.modal = true;
},
// edit(id) {
// this.curId = id;
// this.title = "编辑";
// this.detail = () => import("./edit");
// view(row) {
// this.curId = row.id;
// this.storeId = row.storeId;
// this.mCode = row.materialCode;
// this.title = "详情";
// this.detail = () => import("./detail");
// this.fscreeen = true;
// this.modal = true;
// },
// remove(id) {
// Api.delete(id).then((r) => {
// if (r.success) {
// this.$refs.grid.load();
// this.$Message.success("删除成功");
// }
// });
// },
remove(id) {
Api.delete(id).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success("删除成功");
}
});
},
logDetail(id) {
this.curId = id;
this.title = "查看日志";
this.detail = () => import("./log");
this.fscreeen = false;
this.modal = true;
},
cancel() {
this.curId = 0;
this.modal = false;
......@@ -522,21 +515,6 @@ export default {
let vkey = "resource" + "." + key;
return this.$t(vkey) || key;
},
//new tree start
initTree() {
var sumData = [];
this.$http.order.getallselecttree().then((res) => {
//alert(JSON.stringify(res))
if (res.result) {
for (var i = 0; i < res.result.length; i++) {
sumData = sumData.concat(res.result[i]);
}
this.data1 = JSON.parse(JSON.stringify(sumData));
} else {
this.$Message.error("加载产品树失败!");
}
});
},
},
};
</script>
......
......@@ -4,80 +4,76 @@
</div>
</template>
<script>
import Api from './api'
import Api from "./api";
export default {
name: 'log',
name: "log",
data() {
return {
data: [],
columns: [
{
title: this.l('action'),
key: 'action',
title: this.l("action"),
key: "action",
width: 120,
align:"center",
align: "center",
render: (h, params) => {
return h('state', {
return h("state", {
props: {
code: 'mes_xingchi_resource.resource.life_state',
type: 'text',
value: params.row.action + ''
}
})
}
code: "mes_xingchi_resource.resource.life_state",
type: "text",
value: params.row.action + "",
},
});
},
},
{
title: this.l('count'),
key: 'count',
width: 120,
align: 'right'
title: this.l("count"),
key: "count",
align: "right",
},
{
title: this.l('numberAvailable'),
key: 'numberAvailable',
width: 120,
align: 'right'
title: this.l("numberAvailable"),
key: "numberAvailable",
align: "right",
},
{
title: this.l('creationTime'),
key: 'creationTime',
width: 200,
align:"center"
title: this.l("creationTime"),
key: "creationTime",
align: "center",
},
{
title: this.l('libraryTube'),
key: 'libraryTube',
align:"center",
}
]
}
title: this.l("libraryTube"),
key: "libraryTube",
align: "center",
},
],
};
},
props: { eid: Number },
methods: {
//数据初始化
load(v) {
Api.getHistory({ id: v }).then((r) => {
load() {
Api.getHistory({ id: this.eid }).then((r) => {
if (r.success) {
this.data = r.result
this.data = r.result;
}
})
});
},
handleClose() {
this.$emit('on-close')
this.$emit("on-close");
},
l(key) {
let vkey = 'resource' + '.' + key
return this.$t(vkey) || key
}
let vkey = "resource" + "." + key;
return this.$t(vkey) || key;
},
watch: {
eid(v) {
if (v != 0) {
this.load(v)
}
}
}
}
},
mounted() {
this.load();
},
};
</script>
<style>
</style>
\ No newline at end of file
<template>
<div>
<DataGrid :columns="columns" ref="grid" :action="action" :conditions="easySearch">
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input placeholder="请输入领料人名称/记录编号" v-model="easySearch.keys.value" v-width="260" />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
</DataGrid>
<Modal v-model="modal" :title="title" width="1200" footer-hide>
<component
:is="detail"
:eid="curId"
:cartList="this.$u.clone(this.$store.state.cart)"
@on-close="cancel"
@on-ok="ok"
/>
</Modal>
</div>
</template>
<script>
import Api from "./api";
export default {
name: "Add",
data() {
return {
action: Api.index1,
easySearch: {
keys: { op: "serialNumber,customer", value: null },
},
detail: null,
dataList: [],
curId: 0,
modal: false,
title: "详情",
columns: [
{
type: "index",
width: 70,
align: "center",
},
{
title: "借出记录编号",
key: "serialNumber",
},
{
key: "creationTime",
title: "借出时间",
},
{
title: this.l("libraryTube"),
key: "libraryTube",
},
{
title: "领料人",
key: "customer",
},
{
title: this.l("action"),
key: "action",
width: 150,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"a",
{
class: "details",
on: { click: () => this.details(params.row.id) },
},
"查看"
),
]);
},
},
],
name: "",
resource: [],
selectList: [],
libraryTube: this.$store.state.userInfo.userName, //库管员
};
},
props: {},
mounted() {},
methods: {
details(id) {
this.curId = id;
this.detail = () => import("./return");
this.modal = true;
},
handleClose() {
this.$emit("on-close");
},
selectInfo(value) {
this.selectList = [];
this.selectList = value;
},
l(key) {
let vkey = "resource" + "." + key;
return this.$t(vkey) || key;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = 0;
},
cancel() {
this.curId = 0;
this.modal = false;
},
},
watch: {},
};
</script>
<style>
</style>
\ No newline at end of file
......@@ -15,16 +15,7 @@
class="tableCommon"
@on-selection-change="selectInfo"
height="300"
>
<template slot-scope="{ row, index }" slot="count">
<InputNumber
:max="row.count1"
:min="1"
v-model="row.count"
@on-change="inputOrderCat(row,index)"
></InputNumber>
</template>
</Table>
></Table>
<Form :label-width="110" class="mt20 mb20">
<Row>
<Col span="15">&nbsp;</Col>
......@@ -47,119 +38,123 @@
</div>
</template>
<script>
import Api from './api'
import Api from "./api";
export default {
name: 'Add',
name: "Add",
data() {
return {
dataList: [],
columns: [
{
type: 'selection',
type: "selection",
width: 70,
align: 'center'
align: "center",
},
// {
// type: "index",
// width: 70,
// align: "center",
// },
{
key: 'resourceCode',
title: this.l('resourceCode'),
width: 180
title: this.l("nameOfResource"),
key: "nameOfResource",
},
{
title: this.l('nameOfResource'),
key: 'nameOfResource'
key: "resourceCode",
title: this.l("resourceCode"),
width: 180,
},
{
title: this.l('specifications'),
key: 'specifications',
width: 100
title: this.l("libraryTube"),
key: "libraryTube",
},
{
title: this.l('measuringUnit'),
key: 'measuringUnit',
width: 100
title: "领料人",
key: "customer",
},
{
title: this.l('qualityCharacteristics'),
key: 'qualityCharacteristics',
width: 100
},
{
title: this.l('batchNo'),
key: 'batchNo',
width: 100
},
key: "creationTime",
title: "借出时间",
},
// {
// title: this.l("resourceMainId"),
// key: "resourceMainId",
// width: 100,
// },
{
title: this.l('storeTitle'),
key: 'storeTitle',
width: 100
title: this.l("storeTitle"),
key: "storeTitle",
width: 100,
},
{
title: this.l('count'),
key: 'count',
title: this.l("count"),
key: "count",
width: 120,
slot: 'count'
}
},
],
search: {
name: '',
pageSize: 0,
pageIndex: 0
name: "",
// pageSize: 0,
// pageIndex: 0,
},
resource: [],
selectList: [],
libraryTube: this.$store.state.userInfo.userName //库管员
}
libraryTube: this.$store.state.userInfo.userName, //库管员
};
},
props: {
eid: Number,
},
mounted() {
this.get();
},
props: {},
methods: {
get() {
Api.paged({ trollerId: this.eid }).then((r) => {
if (r.success) {
this.dataList = r.result.items;
}
});
},
handleSubmit() {
if (JSON.stringify(this.selectList) != '[]') {
this.resource = this.selectList
if (JSON.stringify(this.selectList) != "[]") {
this.resource = this.selectList;
Api.cartGiveBack(this.resource).then((r) => {
if (r.success) {
this.$Message.success('归还成功')
this.$emit('on-ok')
this.$Message.success("归还成功");
this.$emit("on-ok");
}
})
});
} else {
this.$Message.error('请选择归还的资源')
this.$Message.error("请选择归还的资源");
}
},
handleClose() {
this.$emit('on-close')
this.$emit("on-close");
},
selectInfo(value) {
this.selectList = []
this.selectList = value
this.selectList = [];
this.selectList = value;
},
l(key) {
let vkey = 'resource' + '.' + key
return this.$t(vkey) || key
let vkey = "resource" + "." + key;
return this.$t(vkey) || key;
},
easySearch() {
this.dataList = []
Api.cartGetList(this.search).then((r) => {
Api.paged({ trollerId: this.eid, name: $.trim(this.search.name) }).then(
(r) => {
if (r.success) {
let items = []
let dataList1 = []
dataList1 = r.result.items
dataList1.forEach((data) => {
let objList = data
objList.count1 = parseFloat(data.count)
objList.count = parseFloat(data.count)
objList.state = '3'
items.push(objList)
})
this.dataList = items
this.dataList = r.result.items;
}
})
},
inputOrderCat(row, index) {
this.dataList[index].count = row.count
}
);
},
},
watch: {}
}
watch: {},
};
</script>
<style>
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment