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

制造资源

parent 8d90a966
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
@on-drag-drop="onDragDrop" @on-drag-drop="onDragDrop"
@on-selection-change="selectionChange" @on-selection-change="selectionChange"
@on-select="onSelect" @on-select="onSelect"
@on-select-all="allChange"
:row-key="rowKey" :row-key="rowKey"
></Table> ></Table>
</div> </div>
...@@ -313,7 +314,7 @@ export default { ...@@ -313,7 +314,7 @@ export default {
if (this.initsearch) { if (this.initsearch) {
this.initsearch(this.search); this.initsearch(this.search);
} }
this.$api.post(this.action, this.search).then((r) => { this.$api.post(this.action, this.search).then((r) => {
if (this.format) { if (this.format) {
this.list = this.format(r.result.items); this.list = this.format(r.result.items);
} else { } else {
...@@ -488,6 +489,9 @@ export default { ...@@ -488,6 +489,9 @@ export default {
onSelect(rows, row) { onSelect(rows, row) {
this.$emit("on-change", rows, row); this.$emit("on-change", rows, row);
}, },
allChange(items) {
this.$emit("all-change", items);
},
intY() { intY() {
if (this.$refs.table != undefined) { if (this.$refs.table != undefined) {
this.firstY = this.$refs.table.$el.getBoundingClientRect().top; this.firstY = this.$refs.table.$el.getBoundingClientRect().top;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</div> </div>
<div class="fg"> <div class="fg">
<dl> <dl>
<dd v-for="(li,i) in checkedItems"> <dd v-for="(li,i) in checkedItems" :key="i">
<div class="flex"> <div class="flex">
<span class="fg">{{li.userName}}</span> <span class="fg">{{li.userName}}</span>
<a @click="removeItem(li)"> <a @click="removeItem(li)">
...@@ -73,14 +73,14 @@ ...@@ -73,14 +73,14 @@
export default { export default {
model: { model: {
prop: "value", prop: "value",
event: "on-change" event: "on-change",
}, },
data() { data() {
return { return {
name: this.value, name: this.value,
data: [], data: [],
departId: "", departId: "",
group: [] group: [],
}; };
}, },
created() { created() {
...@@ -94,38 +94,43 @@ export default { ...@@ -94,38 +94,43 @@ export default {
value: [String, Number, Array], value: [String, Number, Array],
placeholder: { placeholder: {
type: String, type: String,
default: "请选择人员" default: "请选择人员",
}, },
multiple: { multiple: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
theme: { theme: {
type: String, type: String,
default: "select" default: "select",
}, },
type: { type: {
type: Number, type: Number,
default: 0 default: 0,
}, },
departmentId: { departmentId: {
type: Number, type: Number,
default: 0 default: 0,
}, },
roleTitle: { roleTitle: {
type: String, type: String,
default: "" default: "",
}, },
datas: { datas: {
//自定义用户数据 //自定义用户数据
type: Array, type: Array,
default: null default: null,
} },
}, },
methods: { methods: {
change(event) { change(event) {
// console.log(event) let name = "";
this.$emit("on-change", event); this.data.forEach((e) => {
if (e.id == event) {
name = e.label;
}
});
this.$emit("on-change", event, name);
}, },
// 加载人员 // 加载人员
getselectuser(id) { getselectuser(id) {
...@@ -135,10 +140,10 @@ export default { ...@@ -135,10 +140,10 @@ export default {
// pageIndex: 1, // pageIndex: 1,
departmentId: id, departmentId: id,
type: this.type, type: this.type,
roleTitle: this.roleTitle roleTitle: this.roleTitle,
// pageSize: 0 // pageSize: 0
}) })
.then(r => { .then((r) => {
this.data = r.result; this.data = r.result;
if (this.theme == "list") { if (this.theme == "list") {
this.departmentGroup(); this.departmentGroup();
...@@ -149,11 +154,11 @@ export default { ...@@ -149,11 +154,11 @@ export default {
var group = []; var group = [];
var users = this.$u.clone(this.data); var users = this.$u.clone(this.data);
if (this.name && this.name.length > 0) { if (this.name && this.name.length > 0) {
users.map(u => { users.map((u) => {
u.checked = this.name.indexOf(u.id) > -1; u.checked = this.name.indexOf(u.id) > -1;
}); });
} }
group = this.$u.group(users, u => { group = this.$u.group(users, (u) => {
return u.departmentId; return u.departmentId;
}); });
var deps = []; var deps = [];
...@@ -163,7 +168,7 @@ export default { ...@@ -163,7 +168,7 @@ export default {
departmentId: u[0].departmentId, departmentId: u[0].departmentId,
children: u, children: u,
opened: (i = 0), opened: (i = 0),
checked: false checked: false,
}); });
}); });
this.group = deps; this.group = deps;
...@@ -181,7 +186,7 @@ export default { ...@@ -181,7 +186,7 @@ export default {
removeItem(item) { removeItem(item) {
this.group.map((u, i) => { this.group.map((u, i) => {
if (u.departmentId == item.departmentId) { if (u.departmentId == item.departmentId) {
u.children.map(p => { u.children.map((p) => {
if (p.id == item.id) { if (p.id == item.id) {
p.checked = false; p.checked = false;
} }
...@@ -194,13 +199,13 @@ export default { ...@@ -194,13 +199,13 @@ export default {
//list 时,设置值。 //list 时,设置值。
listSetValue() { listSetValue() {
var ids = []; var ids = [];
this.checkedItems.map(u => { this.checkedItems.map((u) => {
ids.push(u.id); ids.push(u.id);
}); });
this.$emit("on-change", ids); this.$emit("on-change", ids);
}, },
checkAll(item, i) { checkAll(item, i) {
item.children.map(u => { item.children.map((u) => {
u.checked = item.checked; u.checked = item.checked;
}); });
this.$set(this.group, i, this.group[i]); this.$set(this.group, i, this.group[i]);
...@@ -210,19 +215,19 @@ export default { ...@@ -210,19 +215,19 @@ export default {
getSelectItems() { getSelectItems() {
var items = []; var items = [];
if (this.theme == "list") { if (this.theme == "list") {
this.checkedItems.map(u => { this.checkedItems.map((u) => {
items.push(u); items.push(u);
}); });
} else { } else {
if (!this.multiple) { if (!this.multiple) {
//单选时返回信息 //单选时返回信息
if (this.datas && this.datas.length > 0) { 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]) { if (item2 && item2[0]) {
items.push(item2[0]); items.push(item2[0]);
} }
} else { } 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]) { if (item1 && item1[0]) {
items.push(item1[0]); items.push(item1[0]);
} }
...@@ -230,15 +235,15 @@ export default { ...@@ -230,15 +235,15 @@ export default {
} else { } else {
//复选时返回 //复选时返回
if (this.datas && this.datas.length > 0) { if (this.datas && this.datas.length > 0) {
this.value.forEach(v => { this.value.forEach((v) => {
var item3 = this.dic.filter(u => u.value == v); var item3 = this.dic.filter((u) => u.value == v);
if (item3 && item3[0]) { if (item3 && item3[0]) {
items.push(item3[0]); items.push(item3[0]);
} }
}); });
} else { } else {
this.value.forEach(v => { this.value.forEach((v) => {
var item = this.dic.filter(u => u.value == v); var item = this.dic.filter((u) => u.value == v);
if (item && item[0]) { if (item && item[0]) {
items.push(item[0]); items.push(item[0]);
} }
...@@ -253,21 +258,21 @@ export default { ...@@ -253,21 +258,21 @@ export default {
getSelectNames() { getSelectNames() {
var names = []; var names = [];
if (this.theme == "list") { if (this.theme == "list") {
this.checkedItems.map(u => { this.checkedItems.map((u) => {
items.push(u.userName); items.push(u.userName);
}); });
} else { } else {
this.getSelectItems().forEach(v => { this.getSelectItems().forEach((v) => {
names.push(v.label); names.push(v.label);
}); });
} }
return names; return names;
} },
}, },
computed: { computed: {
dic() { dic() {
let result = []; let result = [];
this.data.forEach(u => { this.data.forEach((u) => {
// result.push({ // result.push({
// value: u.id, // value: u.id,
// label: u.userName // label: u.userName
...@@ -279,43 +284,43 @@ export default { ...@@ -279,43 +284,43 @@ export default {
}, },
checkedItems() { checkedItems() {
var items = []; var items = [];
this.group.map(u => { this.group.map((u) => {
u.children.map(l => { u.children.map((l) => {
if (l.checked) { if (l.checked) {
items.push(l); items.push(l);
} }
}); });
}); });
return items; return items;
} },
}, },
filters: { filters: {
vvv: lis => { vvv: (lis) => {
return 3; return 3;
// return lis.filter(u=>{ // return lis.filter(u=>{
// return u.checked==true // return u.checked==true
// }).lenght; // }).lenght;
} },
}, },
watch: { watch: {
value: { value: {
handler(v, o) { handler(v, o) {
this.name = v; this.name = v;
}, },
deep: true deep: true,
}, },
departmentId: { departmentId: {
handler(v, o) { handler(v, o) {
this.getselectuser(v); this.getselectuser(v);
}, },
deep: true deep: true,
}, },
datas(v) { datas(v) {
if (v) { if (v) {
//alert(JSON.stringify(v)) //alert(JSON.stringify(v))
} }
} },
} },
}; };
</script> </script>
<style lang="less"> <style lang="less">
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</Col> </Col>
<Row> <Row>
<Col v-for="li in fileds" :key="li.field" :span="li.span"> <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> <Input v-if="li.dataType==0" v-model="entity.json[li.field]"></Input>
<InputNumber <InputNumber
v-if="li.dataType==1||li.dataType==2" v-if="li.dataType==1||li.dataType==2"
......
...@@ -2,9 +2,10 @@ import Api from '@/plugins/request' ...@@ -2,9 +2,10 @@ import Api from '@/plugins/request'
export default { export default {
// index: `${resourceUrl}/resource/paged`, // index: `${resourceUrl}/resource/paged`,
index: `${resourceUrl}/resourcenew/paged`, index: `${resourceUrl}/resourcenew/paged`,
paged(params) { index1: `${resourceUrl}/trolley/paged`, //借出记录
return Api.post(`${resourceUrl}/resource/paged`, params); paged(params) { //借出记录查询明细
}, return Api.post(`${resourceUrl}/trolleyitem/paged`, params);
},
get(params) { get(params) {
return Api.get(`${resourceUrl}/resourcenew/get`, params); return Api.get(`${resourceUrl}/resourcenew/get`, params);
}, },
......
...@@ -20,7 +20,12 @@ ...@@ -20,7 +20,12 @@
</Col> </Col>
<Col span="7"> <Col span="7">
<FormItem label="领料人" style="width:100%" prop="customerId"> <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> </FormItem>
</Col> </Col>
</Row> </Row>
...@@ -35,159 +40,210 @@ ...@@ -35,159 +40,210 @@
</div> </div>
</template> </template>
<script> <script>
import Api from './api' import Api from "./api";
export default { export default {
name: 'Add', name: "Add",
data() { data() {
let userInfo=this.$store.state.admin.user.info; let userInfo = this.$store.state.admin.user.info;
return { return {
columns: [ columns: [
{ {
key: 'resourceId', key: "resourceCode",
title: this.l('resourceId'), title: this.l("resourceId"),
width: 180 align: "left",
easy: true,
render: (h, params) => {
return h(
"a",
{
props: {},
style: {},
on: { click: () => this.detail(params.row.id) },
},
params.row.resourceCode
);
},
}, },
{ {
title: this.l('nameOfResource'), key: "nameOfResource",
key: 'nameOfResource' title: this.l("nameOfResource"),
align: "left",
easy: true,
tooltip: true,
}, },
{ {
title: this.l('specifications'), key: "code",
key: 'specifications', title: "编码",
width: 100 align: "left",
width: 150,
}, },
// {
// key: "creatorUserId",
// title: this.l("creatorUserId"),
// hide: false,
// type: "user",
// align: "left",
// },
{ {
title: this.l('measuringUnit'), key: "totalNum",
key: 'measuringUnit', title: this.l("totalNum"),
width: 100 align: "left",
easy: true,
}, },
{ {
title: this.l('qualityCharacteristics'), key: "numberAvailable",
key: 'qualityCharacteristics', title: "借出数",
width: 100 align: "left",
easy: true,
}, },
// {
// key: "storeId",
// title: this.l("storeId"),
// align: "left",
// high: true,
// hide: true,
// },
{ {
title: this.l('batchNo'), key: "storeTitle",
key: 'batchNo', title: this.l("storeTitle"),
width: 100 align: "left",
}, },
{ {
title: this.l('storeTitle'), key: "state",
key: 'storeTitle', title: this.l("state"),
width: 100 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'), title: this.l("numberAvailable"),
key: 'numberAvailable', key: "numberAvailable",
width: 120, width: 100,
slot: 'numberAvailable' slot: "numberAvailable",
}, },
{ {
title: this.l('action'), title: this.l("action"),
key: 'action', key: "action",
width: 100, width: 100,
align: 'center', align: "center",
render: (h, params) => { render: (h, params) => {
return h('div', { class: 'action' }, [ return h("div", { class: "action" }, [
h( h(
'a', "a",
{ {
class: 'remove', class: "remove",
on: { click: () => this.remove(params.row.id) } on: { click: () => this.remove(params.row.id) },
}, },
'删除' "删除"
) ),
]) ]);
} },
} },
], ],
resource: { resource: {
libraryTube: userInfo.userName, //库管员 libraryTube: userInfo.userName, //库管员
libraryTubeId: userInfo.userId, //库管员ID libraryTubeId: userInfo.userId, //库管员ID
customer: '', //领料人 customer: "", //领料人
customerId: null, //领料人ID customerId: null, //领料人ID
category: 0, //类别 category: 0, //类别
state: 2, //状态 state: 2, //状态
item: [] item: [],
}, },
rules: { rules: {
customerId: [ customerId: [
{ required: true, message: '请选择', trigger: 'blur', type: 'number' } {
] required: true,
} message: "请选择",
} trigger: "blur",
type: "number",
},
],
},
};
}, },
props: { props: {
cartList: { cartList: {
type: [Array], type: [Array],
default: ()=>{ default: () => {
return [] return [];
} },
} },
}, },
methods: { methods: {
change(val, name) {
this.resource.customer = name;
},
handleSubmit() { handleSubmit() {
var items = [] var items = [];
let count = 0 let count = 0;
this.cartList.forEach((data) => { this.cartList.forEach((data) => {
let objList = Object.assign({}, this.resource) let objList = Object.assign({}, this.resource);
delete objList.item delete objList.item;
objList.resourceId = data.id console.log(data);
objList.count = data.numberAvailable objList.resourceId = data.resourceId;
items.push(objList) objList.resourceCode = data.resourceCode;
count += 1 objList.resourceMainId = data.id;
}) objList.count = data.numberAvailable;
items.push(objList);
this.resource.item = items count += 1;
});
this.resource.item = items;
if (this.resource.customerId == 0) { if (this.resource.customerId == 0) {
} }
this.$refs.form.validate((v) => { this.$refs.form.validate((v) => {
if (v) { if (v) {
Api.cartCreate(this.resource).then((r) => { Api.cartCreate(this.resource).then((r) => {
if (r.success) { if (r.success) {
this.$Message.success('保存成功') this.$Message.success("保存成功");
this.$emit('substr', count, -1) this.$emit("substr", count, -1);
this.$emit('on-ok') this.$emit("on-ok");
} }
}) });
} }
}) });
}, },
handleClose() { handleClose() {
this.$emit('on-close') this.$emit("on-close");
}, },
remove(id) { remove(id) {
const index = this.cartList.findIndex(function(item) { const index = this.cartList.findIndex(function (item) {
return item.id === id return item.id === id;
}) });
this.cartList.splice(index, 1) this.cartList.splice(index, 1);
this.$emit('substr', 1, index) this.$emit("substr", 1, index);
}, },
l(key) { l(key) {
let vkey = 'resource' + '.' + key let vkey = "resource" + "." + key;
return this.$t(vkey) || key return this.$t(vkey) || key;
}, },
changeCustom(val) { changeCustom(val) {
this.resource.customerId = val + '' this.resource.customerId = val + "";
//this.resource.customer = this.arry2Name(this.userList1, val) //this.resource.customer = this.arry2Name(this.userList1, val)
}, },
arry2Name(arryList, values) { arry2Name(arryList, values) {
//类别转换 //类别转换
var codes = arryList var codes = arryList;
var name = '' var name = "";
for (let i in codes) { for (let i in codes) {
if (values == codes[i].value) { if (values == codes[i].value) {
name = codes[i].name name = codes[i].name;
} }
} }
return name return name;
}, },
inputOrderCat(row, index) { inputOrderCat(row, index) {
this.cartList[index].numberAvailable = row.numberAvailable this.cartList[index].numberAvailable = row.numberAvailable;
} },
}, },
watch: {} watch: {},
} };
</script> </script>
<style> <style>
</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 @@ ...@@ -8,7 +8,6 @@
<Icon type="ios-arrow-forward" size="24" /> <Icon type="ios-arrow-forward" size="24" />
</a> </a>
</div> </div>
{{this.$store.state.count}}
<Content class="content" :class="!showMenu?'con_bord':''"> <Content class="content" :class="!showMenu?'con_bord':''">
<DataGrid <DataGrid
:columns="columns" :columns="columns"
...@@ -17,7 +16,7 @@ ...@@ -17,7 +16,7 @@
:conditions="easySearch" :conditions="easySearch"
:batch="true" :batch="true"
:format="checkData" :format="checkData"
@on-change="onChange" @all-change="allchange"
@on-selection-change="onSelect" @on-selection-change="onSelect"
> >
<template slot="easySearch"> <template slot="easySearch">
...@@ -28,6 +27,9 @@ ...@@ -28,6 +27,9 @@
<FormItem> <FormItem>
<Button type="primary" @click="search">查询</Button> <Button type="primary" @click="search">查询</Button>
</FormItem> </FormItem>
<FormItem>
<a href="#" @click="lendingRecord" class="ml20">借出记录</a>
</FormItem>
</Form> </Form>
</template> </template>
<template slot="buttons"> <template slot="buttons">
...@@ -38,7 +40,7 @@ ...@@ -38,7 +40,7 @@
</Badge> </Badge>
</template> </template>
<template slot="batch"> <template slot="batch">
<Button type="primary" class="mr10 ml10" @click="removeOk">加入借出车</Button> <Button type="primary" class="mr10 ml10" @click="addCart">加入借出车</Button>
</template> </template>
</DataGrid> </DataGrid>
<Modal v-model="modal" :title="title" width="1200" footer-hide :fullscreen="fscreeen"> <Modal v-model="modal" :title="title" width="1200" footer-hide :fullscreen="fscreeen">
...@@ -67,11 +69,11 @@ export default { ...@@ -67,11 +69,11 @@ export default {
components: { components: {
Search, Search,
}, },
head: { // head: {
title: "库存表", // title: "库存表",
author: "henq", // author: "henq",
description: "stock 7/13/2020 11:48:09 AM", // description: "stock 7/13/2020 11:48:09 AM",
}, // },
data() { data() {
return { return {
action: Api.index, action: Api.index,
...@@ -273,17 +275,6 @@ export default { ...@@ -273,17 +275,6 @@ export default {
hide: false, hide: false,
render: (h, params) => { render: (h, params) => {
return h("div", { class: "action" }, [ return h("div", { class: "action" }, [
h(
"op",
{
attrs: {
oprate: "detail",
title: "修改",
},
on: { click: () => this.edit(params.row.id) },
},
"修改"
),
h( h(
"op", "op",
{ {
...@@ -321,14 +312,13 @@ export default { ...@@ -321,14 +312,13 @@ export default {
list: [], list: [],
cartList: [], cartList: [],
cartListCount: 0, cartListCount: 0,
arrPartPkId: [], selectRows: [],
}; };
}, },
created() { created() {
this.treeHeight = window.innerHeight - 150; this.treeHeight = window.innerHeight - 150;
}, },
mounted() { mounted() {
this.initTree();
window.onresize = () => { window.onresize = () => {
///浏览器窗口大小变化 ///浏览器窗口大小变化
return (() => { return (() => {
...@@ -342,94 +332,93 @@ export default { ...@@ -342,94 +332,93 @@ export default {
}, },
computed: {}, computed: {},
methods: { methods: {
onChange(a, b) {
console.log(a);
console.log(b);
if (b.numberAvailable == 0) {
this.$Message.error("资源无库存");
}
},
checkData(items) { checkData(items) {
console.warn("items", items); console.warn("items", items);
return items.map((u) => { return items.map((u) => {
u._disabled = u.numberAvailable <= 0; u._disabled = u.numberAvailable <= 0;
u._checked = false;
return u; 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; allchange(item) {
// this.cartListCount = this.$store.state.count; this.selectRows = [];
// this.cartList = this.$store.state.cart; this.selectRows = item;
// 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() { onSelect(item) {
//批量选择移出排产池 this.selectRows = [];
this.remove(this.arrPartPkId); this.selectRows = item;
}, },
//加入借出车 //加入借出车
addCart(arr) { addCart(arr) {
let id = arr.id;
this.cartListCount = this.$store.state.count; this.cartListCount = this.$store.state.count;
this.cartList = this.$store.state.cart; this.cartList = this.$store.state.cart;
if (arr.numberAvailable > 0) { // console.log(this.cartListCount);
const index = this.$store.state.cart.findIndex(function (item) { // console.log(this.cartList);
return item.id === id; // console.log(this.selectRows);
}); if (arr.id) {
console.log(index); let id = arr.id;
if (index == -1) { if (arr.numberAvailable > 0) {
arr.numberAvailable1 = arr.numberAvailable; //用于最大借出数量 const index = this.$store.state.cart.findIndex(function (item) {
this.cartList.push(arr); return item.id === id;
this.cartListCount += 1; });
this.$store.commit("setCart", this.cartList); // console.log(index);
this.$store.commit("setCartCount", this.cartListCount); if (index == -1) {
this.$Message.success("加入借出车成功"); 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 { } else {
this.$Message.error("已加入借出车"); this.$Message.error("资源无库存");
} }
} else { } else {
this.$Message.error("资源无库存"); 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) { substr(value, index) {
console.log(value);
console.log(index);
if (index > -1) { if (index > -1) {
this.cartListCount -= value; this.cartListCount -= value;
this.cartList.splice(index, 1); this.cartList.splice(index, 1);
if (value == 0) {
this.cartListCount = 0;
}
this.$store.commit("setCart", this.cartList); this.$store.commit("setCart", this.cartList);
this.$store.commit("setCartCount", this.cartListCount); this.$store.commit("setCartCount", this.cartListCount);
} else { } else {
console.log(this.$store.state.count);
console.log(this.$store.state.cart);
this.cartListCount = 0; this.cartListCount = 0;
this.cartList = []; this.cartList = [];
this.$store.commit("setCart", this.cartList); this.$store.commit("setCart", this.cartList);
this.$store.commit("setCartCount", this.cartListCount); this.$store.commit("setCartCount", this.cartListCount);
} }
console.log(this.$store.state.count);
console.log(this.$store.state.cart);
}, },
showCart() { showCart() {
if (this.$store.state.count > 0) { if (this.$store.state.count > 0) {
...@@ -441,6 +430,9 @@ export default { ...@@ -441,6 +430,9 @@ export default {
this.$Message.error("请将资源加入借出车"); this.$Message.error("请将资源加入借出车");
} }
}, },
lendingRecord() {
window.open("/resource/resource/record", "_blank");
},
ok() { ok() {
this.$refs.grid.load(); this.$refs.grid.load();
this.modal = false; this.modal = false;
...@@ -467,29 +459,30 @@ export default { ...@@ -467,29 +459,30 @@ export default {
this.detail = () => import("./add"); this.detail = () => import("./add");
this.modal = true; this.modal = true;
}, },
view(row) { // view(row) {
this.curId = row.id; // this.curId = row.id;
this.storeId = row.storeId; // this.storeId = row.storeId;
this.mCode = row.materialCode; // this.mCode = row.materialCode;
this.title = "详情"; // this.title = "详情";
this.detail = () => import("./detail"); // this.detail = () => import("./detail");
this.fscreeen = true; // this.fscreeen = true;
this.modal = true;
},
// edit(id) {
// this.curId = id;
// this.title = "编辑";
// this.detail = () => import("./edit");
// this.modal = true; // this.modal = true;
// }, // },
// remove(id) { remove(id) {
// Api.delete(id).then((r) => { Api.delete(id).then((r) => {
// if (r.success) { if (r.success) {
// this.$refs.grid.load(); this.$refs.grid.load();
// this.$Message.success("删除成功"); this.$Message.success("删除成功");
// } }
// }); });
// }, },
logDetail(id) {
this.curId = id;
this.title = "查看日志";
this.detail = () => import("./log");
this.fscreeen = false;
this.modal = true;
},
cancel() { cancel() {
this.curId = 0; this.curId = 0;
this.modal = false; this.modal = false;
...@@ -522,21 +515,6 @@ export default { ...@@ -522,21 +515,6 @@ export default {
let vkey = "resource" + "." + key; let vkey = "resource" + "." + key;
return this.$t(vkey) || 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> </script>
......
<template> <template>
<div> <div>
<Table border :columns="columns" :data="data" class="tableCommon" height="300"></Table> <Table border :columns="columns" :data="data" class="tableCommon" height="300"></Table>
</div> </div>
</template> </template>
<script> <script>
import Api from './api' import Api from "./api";
export default { export default {
name: 'log', name: "log",
data() { data() {
return { return {
data: [], data: [],
columns: [ columns: [
{ {
title: this.l('action'), title: this.l("action"),
key: 'action', key: "action",
width: 120, width: 120,
align:"center", align: "center",
render: (h, params) => { render: (h, params) => {
return h('state', { return h("state", {
props: { props: {
code: 'mes_xingchi_resource.resource.life_state', code: "mes_xingchi_resource.resource.life_state",
type: 'text', type: "text",
value: params.row.action + '' value: params.row.action + "",
} },
}) });
} },
}, },
{ {
title: this.l('count'), title: this.l("count"),
key: 'count', key: "count",
width: 120,
align: 'right' align: "right",
}, },
{ {
title: this.l('numberAvailable'), title: this.l("numberAvailable"),
key: 'numberAvailable', key: "numberAvailable",
width: 120,
align: 'right' align: "right",
}, },
{ {
title: this.l('creationTime'), title: this.l("creationTime"),
key: 'creationTime', key: "creationTime",
width: 200,
align:"center" align: "center",
}, },
{ {
title: this.l('libraryTube'), title: this.l("libraryTube"),
key: 'libraryTube', key: "libraryTube",
align:"center", align: "center",
} },
] ],
} };
}, },
props: { eid: Number }, props: { eid: Number },
methods: { methods: {
//数据初始化 //数据初始化
load(v) { load() {
Api.getHistory({ id: v }).then((r) => { Api.getHistory({ id: this.eid }).then((r) => {
if (r.success) { if (r.success) {
this.data = r.result this.data = r.result;
} }
}) });
}, },
handleClose() { handleClose() {
this.$emit('on-close') this.$emit("on-close");
}, },
l(key) { l(key) {
let vkey = 'resource' + '.' + key let vkey = "resource" + "." + key;
return this.$t(vkey) || key return this.$t(vkey) || key;
} },
},
mounted() {
this.load();
}, },
watch: { };
eid(v) {
if (v != 0) {
this.load(v)
}
}
}
}
</script> </script>
<style> <style>
</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 @@ ...@@ -15,16 +15,7 @@
class="tableCommon" class="tableCommon"
@on-selection-change="selectInfo" @on-selection-change="selectInfo"
height="300" height="300"
> ></Table>
<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>
<Form :label-width="110" class="mt20 mb20"> <Form :label-width="110" class="mt20 mb20">
<Row> <Row>
<Col span="15">&nbsp;</Col> <Col span="15">&nbsp;</Col>
...@@ -47,119 +38,123 @@ ...@@ -47,119 +38,123 @@
</div> </div>
</template> </template>
<script> <script>
import Api from './api' import Api from "./api";
export default { export default {
name: 'Add', name: "Add",
data() { data() {
return { return {
dataList: [], dataList: [],
columns: [ columns: [
{ {
type: 'selection', type: "selection",
width: 70, width: 70,
align: 'center' align: "center",
}, },
// {
// type: "index",
// width: 70,
// align: "center",
// },
{ {
key: 'resourceCode', title: this.l("nameOfResource"),
title: this.l('resourceCode'), key: "nameOfResource",
width: 180
}, },
{ {
title: this.l('nameOfResource'), key: "resourceCode",
key: 'nameOfResource' title: this.l("resourceCode"),
width: 180,
}, },
{ {
title: this.l('specifications'), title: this.l("libraryTube"),
key: 'specifications', key: "libraryTube",
width: 100
}, },
{ {
title: this.l('measuringUnit'), title: "领料人",
key: 'measuringUnit', key: "customer",
width: 100
}, },
{ {
title: this.l('qualityCharacteristics'), key: "creationTime",
key: 'qualityCharacteristics', title: "借出时间",
width: 100
}, },
// {
// title: this.l("resourceMainId"),
// key: "resourceMainId",
// width: 100,
// },
{ {
title: this.l('batchNo'), title: this.l("storeTitle"),
key: 'batchNo', key: "storeTitle",
width: 100 width: 100,
}, },
{ {
title: this.l('storeTitle'), title: this.l("count"),
key: 'storeTitle', key: "count",
width: 100
},
{
title: this.l('count'),
key: 'count',
width: 120, width: 120,
slot: 'count' },
}
], ],
search: { search: {
name: '', name: "",
pageSize: 0, // pageSize: 0,
pageIndex: 0 // pageIndex: 0,
}, },
resource: [], resource: [],
selectList: [], selectList: [],
libraryTube: this.$store.state.userInfo.userName //库管员 libraryTube: this.$store.state.userInfo.userName, //库管员
} };
},
props: {
eid: Number,
},
mounted() {
this.get();
}, },
props: {},
methods: { methods: {
get() {
Api.paged({ trollerId: this.eid }).then((r) => {
if (r.success) {
this.dataList = r.result.items;
}
});
},
handleSubmit() { handleSubmit() {
if (JSON.stringify(this.selectList) != '[]') { if (JSON.stringify(this.selectList) != "[]") {
this.resource = this.selectList this.resource = this.selectList;
Api.cartGiveBack(this.resource).then((r) => { Api.cartGiveBack(this.resource).then((r) => {
if (r.success) { if (r.success) {
this.$Message.success('归还成功') this.$Message.success("归还成功");
this.$emit('on-ok') this.$emit("on-ok");
} }
}) });
} else { } else {
this.$Message.error('请选择归还的资源') this.$Message.error("请选择归还的资源");
} }
}, },
handleClose() { handleClose() {
this.$emit('on-close') this.$emit("on-close");
}, },
selectInfo(value) { selectInfo(value) {
this.selectList = [] this.selectList = [];
this.selectList = value this.selectList = value;
}, },
l(key) { l(key) {
let vkey = 'resource' + '.' + key let vkey = "resource" + "." + key;
return this.$t(vkey) || key return this.$t(vkey) || key;
}, },
easySearch() { easySearch() {
this.dataList = [] Api.paged({ trollerId: this.eid, name: $.trim(this.search.name) }).then(
Api.cartGetList(this.search).then((r) => { (r) => {
if (r.success) { if (r.success) {
let items = [] this.dataList = r.result.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
} }
}) );
}, },
inputOrderCat(row, index) {
this.dataList[index].count = row.count
}
}, },
watch: {} watch: {},
} };
</script> </script>
<style> <style>
</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