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

Merge branch 'product' of http://git.mes123.com/zhouyx/mes-ui into product

parents bcc55990 532eb6bc
<template>
<div class="resources-p h100">
<DataGrid
:columns="columns"
ref="grid"
:action="action"
:high="false"
@on-selection-change="onSelect"
>
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input placeholder="请输入资源名称/编号/类型/部门" v-model="easySearch.keys.value" />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
<template slot="batch">
<Form ref="form" :model="entity" :rules="rules" :label-width="90" class="form-row">
<Row>
<Col span="8">
<FormItem :label="l('isimportant')" prop="isimportant">
<RadioGroup v-model="entity.isimportant">
<Radio label="1"></Radio>
<Radio label="2"></Radio>
</RadioGroup>
</FormItem>
</Col>
<Col span="8">
<FormItem :label="l('capabilityValue')">
<InputNumber v-model="entity.capabilityValue"></InputNumber>
</FormItem>
</Col>
<Col span="8">
<FormItem>
<Button type="primary" @click="handleSubmit" v-noClick>保存</Button>
</FormItem>
</Col>
</Row>
</Form>
</template>
<div class="resources-p h100">
<DataGrid :columns="columns" ref="grid" :action="action" :high="false" @on-selection-change="onSelect">
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input placeholder="请输入资源名称/编号/类型/部门" v-model="easySearch.keys.value" />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
<template slot="batch">
<Form ref="form" :model="entity" :rules="rules" :label-width="90" class="form-row">
<Row>
<Col span="8">
<FormItem :label="l('isimportant')" prop="isimportant">
<RadioGroup v-model="entity.isimportant">
<Radio label="1"></Radio>
<Radio label="2"></Radio>
</RadioGroup>
</FormItem>
</Col>
<Col span="8">
<FormItem :label="l('capabilityValue')">
<InputNumber v-model="entity.capabilityValue"></InputNumber>
</FormItem>
</Col>
<Col span="8">
<FormItem>
<Button type="primary" @click="handleSubmit" v-noClick>保存</Button>
</FormItem>
</Col>
</Row>
</Form>
</template>
</DataGrid>
<Modal v-model="editModal" title="设置日历" footer-hide>
<Set :eid="curId" @on-close="cancel" @on-ok="addOk" />
<Modal v-model="editModal" title="设置日历" footer-hide width="1000">
<Set :eid="curId" @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="deletelModal" title="删除" @on-ok="removeOk" @on-cancel="cancel">
<p>确定删除?</p>
<p>确定删除?</p>
</Modal>
</div>
</div>
</template>
<script>
import Api from "./api";
import Set from "./set";
export default {
name: "list",
components: {
Set,
},
data() {
return {
action: Api.index,
easySearch: {
keys: { op: "title,code,type,departTitle", value: null },
},
entity: {
isimportant: "1",
},
disabled: false,
ids: [],
editModal: false,
deletelModal: false,
curId: 0,
rules: {
isimportant: [{ required: true, message: "必填", trigger: "blur" }],
capabilityValue: [{ required: true, message: "必填", trigger: "blur" }],
},
columns: [
{ key: "id", title: this.l("id"), hide: true, align: "left" },
{
type: "selection",
width: 70,
align: "center",
},
// {
// key: "deleterUserId",
// title: this.l("deleterUserId"),
// hide: true,
// align: "left"
// },
{
key: "title",
title: this.l("title"),
align: "left",
easy: true,
high: true,
name: "list",
components: {
Set,
},
data() {
return {
action: Api.index,
easySearch: {
keys: {
op: "title,code,type,departTitle",
value: null
},
},
entity: {
isimportant: "1",
},
disabled: false,
ids: [],
editModal: false,
deletelModal: false,
curId: 0,
rules: {
isimportant: [{
required: true,
message: "必填",
trigger: "blur"
}],
capabilityValue: [{
required: true,
message: "必填",
trigger: "blur"
}],
},
columns: [{
key: "id",
title: this.l("id"),
hide: true,
align: "left"
},
{
type: "selection",
width: 70,
align: "center",
},
// {
// key: "deleterUserId",
// title: this.l("deleterUserId"),
// hide: true,
// align: "left"
// },
{
key: "title",
title: this.l("title"),
align: "left",
easy: true,
high: true,
},
{
key: "code",
title: this.l("code"),
align: "left",
easy: true,
high: true,
},
{
key: "type",
title: this.l("type"),
align: "center",
code: "aps.resource.type",
easy: true,
high: true,
},
// {
// key: "property",
// title: this.l("property"),
// align: "left",
// high: true
// },
// {
// key: "departId",
// title: this.l("departId"),
// align: "left",
// high: true
// },
{
key: "departTitle",
title: this.l("departTitle"),
align: "left",
easy: true,
high: true,
},
{
key: "isimportant",
title: this.l("isimportant"),
align: "left",
render: (h, params) => {
let statuse = params.row.isimportant;
let text = statuse == 1 ? "是" : statuse == 2 ? "否" : "";
return h("span", {}, text);
},
},
{
key: "capabilityValue",
title: this.l("capabilityValue"),
align: "left",
easy: true,
high: true,
},
{
key: "calId",
title: this.l("calId"),
align: "center",
easy: true,
high: true,
},
{
key: "holidayCalId",
title: this.l("holidayCalId"),
align: "center",
easy: true,
high: true,
},
{
key: "calName",
title: this.l("calName"),
align: "left",
easy: true,
high: true,
},
{
key: "holidayCalName",
title: this.l("holidayCalName"),
align: "left",
easy: true,
high: true,
},
{
title: "操作",
key: "id",
width: 140,
align: "center",
render: (h, params) => {
return h("div", {
class: "action"
}, [
h(
"op", {
attrs: {
oprate: "edit"
},
on: {
click: () => this.edit(params.row.id)
},
},
"设置"
),
h(
"op", {
attrs: {
oprate: "remove",
title: "删除"
},
on: {
click: () => this.remove(params.row.id)
},
},
"删除"
),
]);
},
},
],
};
},
mounted() {
console.log(this);
},
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
addOk() {
this.$refs.grid.load();
this.editModal = false;
this.curId = 0;
},
{
key: "code",
title: this.l("code"),
align: "left",
easy: true,
high: true,
search() {
this.$refs.grid.reload(this.easySearch);
},
{
key: "type",
title: this.l("type"),
align: "center",
code: "aps.resource.type",
easy: true,
high: true,
edit(id) {
this.editModal = true;
this.curId = id;
},
// {
// key: "property",
// title: this.l("property"),
// align: "left",
// high: true
// },
// {
// key: "departId",
// title: this.l("departId"),
// align: "left",
// high: true
// },
{
key: "departTitle",
title: this.l("departTitle"),
align: "left",
easy: true,
high: true,
remove(id) {
this.deletelModal = true;
this.curId = id;
},
{
key: "isimportant",
title: this.l("isimportant"),
align: "left",
render: (h, params) => {
let statuse = params.row.isimportant;
let text = statuse == 1 ? "是" : statuse == 2 ? "否" : "";
return h("span", {}, text);
},
removeOk() {
Api.delete({
id: this.curId
}).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.deletelModal = false;
this.$Message.success("删除成功");
}
});
},
{
key: "capabilityValue",
title: this.l("capabilityValue"),
align: "left",
easy: true,
high: true,
removeCancel() {
this.deletelModal = false;
},
{
key: "calId",
title: this.l("calId"),
align: "center",
easy: true,
high: true,
cancel() {
this.curId = 0;
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.deletedlModal = false;
},
{
key: "holidayCalId",
title: this.l("holidayCalId"),
align: "center",
easy: true,
high: true,
onSelect(a, b) {
console.log(a);
//批量选择
let selectRows = a;
this.ids = [];
selectRows.forEach((e) => {
this.ids.push(e.id);
});
},
{
key: "calName",
title: this.l("calName"),
align: "left",
easy: true,
high: true,
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
let data = {
ids: this.ids,
isimportant: this.entity.isimportant,
capabilityValue: this.entity.capabilityValue,
};
Api.set(data)
.then((r) => {
if (r.success) {
this.$Message.success("保存成功");
this.$refs.grid.load();
this.$refs.grid.footerToolbar = false;
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.$Message.error("保存失败");
console.warn(err);
});
} else {
this.$Message.error("请输入必填项");
}
});
},
{
key: "holidayCalName",
title: this.l("holidayCalName"),
align: "left",
easy: true,
high: true,
handleClose() {
this.footer = false;
this.handleSelectAll(false);
},
{
title: "操作",
key: "id",
width: 140,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{
attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row.id) },
},
"设置"
),
h(
"op",
{
attrs: { oprate: "remove", title: "删除" },
on: { click: () => this.remove(params.row.id) },
},
"删除"
),
]);
},
l(key) {
let vkey = "plan_resource" + "." + key;
return this.$t(vkey) || key;
},
],
};
},
mounted() {
console.log(this);
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
addOk() {
this.$refs.grid.load();
this.editModal = false;
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
edit(id) {
this.editModal = true;
this.curId = id;
},
remove(id) {
this.deletelModal = true;
this.curId = id;
},
removeOk() {
Api.delete({ id: this.curId }).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.deletelModal = false;
this.$Message.success("删除成功");
}
});
},
removeCancel() {
this.deletelModal = false;
},
cancel() {
this.curId = 0;
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.deletedlModal = false;
},
onSelect(a, b) {
console.log(a);
//批量选择
let selectRows = a;
this.ids = [];
selectRows.forEach((e) => {
this.ids.push(e.id);
});
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
let data = {
ids: this.ids,
isimportant: this.entity.isimportant,
capabilityValue: this.entity.capabilityValue,
};
Api.set(data)
.then((r) => {
if (r.success) {
this.$Message.success("保存成功");
this.$refs.grid.load();
this.$refs.grid.footerToolbar = false;
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.$Message.error("保存失败");
console.warn(err);
});
} else {
this.$Message.error("请输入必填项");
}
});
},
handleClose() {
this.footer = false;
this.handleSelectAll(false);
},
l(key) {
let vkey = "plan_resource" + "." + key;
return this.$t(vkey) || key;
},
},
};
</script>
<style lang="less">
@import "../../../assets/css/custom.less";
.resources-p {
.form-row {
width: 600px;
margin-left: 50px;
.ivu-form-item-label {
color: @form-color;
.form-row {
width: 600px;
margin-left: 50px;
.ivu-form-item-label {
color: @form-color;
}
}
.ivu-footer-toolbar-right {
width: 1100px;
position: relative !important;
}
.btn {
position: absolute !important;
top: 12px !important;
right: 40px !important;
}
}
.ivu-footer-toolbar-right {
width: 1100px;
position: relative !important;
}
.btn {
position: absolute !important;
top: 12px !important;
right: 40px !important;
}
}
</style>
\ No newline at end of file
</style>
<template>
<Form ref="form" :model="formItem" :rules="rules" :label-width="90">
<Form ref="form" :model="formItem" :rules="rules" :label-width="110">
<Row>
<Col span="12">
<Col span="12">
<FormItem label="资源名称" prop="equip_name">
<Input v-model="formItem.equip_name" placeholder="请输入设备名称" readonly></Input>
<Input v-model="formItem.equip_name" placeholder="请输入设备名称" readonly></Input>
</FormItem>
</Col>
<Col :span="12">
</Col>
<Col :span="12">
<FormItem label="资源编号" prop="equip_id">
<Input v-model="formItem.equip_id" placeholder="请输入设备编号" readonly></Input>
<Input v-model="formItem.equip_id" placeholder="请输入设备编号" readonly></Input>
</FormItem>
</Col>
<Col :span="12">
</Col>
<Col :span="12">
<FormItem label="工作日历" prop="work">
<Select v-model="formItem1.calendarwork_pk" clearable placeholder="请选择...">
<Option v-for="item in workList" :value="item.id" :key="item.calName">{{ item.calName }}</Option>
</Select>
<Select v-model="formItem1.calendarwork_pk" filterable clearable placeholder="请选择...">
<Option v-for="item in workList" :value="item.id" :key="item.calName">{{ item.calName }}</Option>
</Select>
</FormItem>
</Col>
<Col :span="12">
</Col>
<Col :span="12">
<FormItem label="加班日历" prop="overtime">
<Select v-model="formItem2.calendarovertime_pk" clearable placeholder="请选择...">
<Option
v-for="item in overtimeList"
:value="item.id"
:key="item.holidayCalName"
>{{ item.holidayCalName }}</Option>
</Select>
<Select v-model="formItem2.calendarovertime_pk" filterable clearable placeholder="请选择...">
<Option v-for="item in overtimeList" :value="item.id" :key="item.holidayCalName">{{ item.holidayCalName }}</Option>
</Select>
</FormItem>
</Col>
<Col :span="12">
</Col>
<Col :span="12">
<FormItem label="是否关重" prop="isimportant">
<RadioGroup v-model="formItem.isimportant">
<Radio label="1"></Radio>
<Radio label="2"></Radio>
</RadioGroup>
<RadioGroup v-model="formItem.isimportant">
<Radio label="1"></Radio>
<Radio label="2"></Radio>
</RadioGroup>
</FormItem>
</Col>
<Col :span="12">
</Col>
<Col :span="12">
<FormItem label="能力值" prop="capabilityValue">
<!-- <Input v-model="formItem.capabilityValue" placeholder="请输入能力值"></Input> -->
<InputNumber v-model="formItem.capabilityValue" :max="100" :min="1"></InputNumber>
<!-- <Input v-model="formItem.capabilityValue" placeholder="请输入能力值"></Input> -->
<InputNumber v-model="formItem.capabilityValue" :max="100" :min="1"></InputNumber>
</FormItem>
</Col>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" v-noClick>保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
<Button type="primary" @click="handleSubmit" v-noClick>保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</Form>
</template>
<script>
import Api from "./api";
export default {
name: "Edit",
data() {
return {
workList: [],
overtimeList: [],
formItem: {
equip_name: "",
equip_id: "",
isimportant: "1",
capabilityValue: "",
},
formItem1: {
id: 0,
equip_pk: 0,
calendarwork_pk: 0,
},
formItem2: {
id: 0,
equip_pk: 0,
calendarovertime_pk: 0,
},
entity: {},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }],
},
};
},
props: {
eid: Number,
},
created() {
this.laodaction();
},
methods: {
laodaction() {
let parmse = {
pageIndex: 1,
conditions: [],
pageSize: 10,
};
Api.create(parmse).then((r) => {
if (r.success) {
this.workList = r.result;
} else {
this.$Message.error("获取数据失败...");
}
});
Api.create1(parmse).then((r) => {
if (r.success) {
this.overtimeList = r.result;
} else {
this.$Message.error("获取数据失败...");
}
});
name: "Edit",
data() {
return {
workList: [],
overtimeList: [],
formItem: {
equip_name: "",
equip_id: "",
isimportant: "1",
capabilityValue: "",
},
formItem1: {
id: 0,
equip_pk: 0,
calendarwork_pk: 0,
},
formItem2: {
id: 0,
equip_pk: 0,
calendarovertime_pk: 0,
},
entity: {},
rules: {
name: [{
required: true,
message: "必填",
trigger: "blur"
}],
},
};
},
load(v) {
Api.get({ id: v }).then((r) => {
this.formItem.equip_name = r.result.title;
this.formItem.equip_id = r.result.code;
this.formItem.capabilityValue = r.result.capabilityValue;
this.formItem1.calendarwork_pk = r.result.calKey;
this.formItem2.calendarovertime_pk = r.result.holidayKey;
this.formItem1.equip_pk = r.result.id;
this.formItem2.equip_pk = r.result.id;
if (r.result.isimportant) {
this.formItem.isimportant = r.result.isimportant + "";
} else {
this.formItem.isimportant = "1";
}
});
props: {
eid: Number,
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
Api.update({
equipCalendarWork: this.formItem1,
equipCalendarOverTime: this.formItem2,
isimportant: this.formItem.isimportant,
capabilityValue: this.formItem.capabilityValue,
})
.then((r) => {
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.$Message.error("保存失败");
console.warn(err);
});
}
});
created() {
this.laodaction();
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "plan_resource" + "." + key;
return this.$t(key);
methods: {
laodaction() {
let parmse = {
pageIndex: 1,
conditions: [],
pageSize: 10,
};
Api.create(parmse).then((r) => {
if (r.success) {
this.workList = r.result;
} else {
this.$Message.error("获取数据失败...");
}
});
Api.create1(parmse).then((r) => {
if (r.success) {
this.overtimeList = r.result;
} else {
this.$Message.error("获取数据失败...");
}
});
},
load(v) {
Api.get({
id: v
}).then((r) => {
this.formItem.equip_name = r.result.title;
this.formItem.equip_id = r.result.code;
this.formItem.capabilityValue = r.result.capabilityValue;
this.formItem1.calendarwork_pk = r.result.calKey;
this.formItem2.calendarovertime_pk = r.result.holidayKey;
this.formItem1.equip_pk = r.result.id;
this.formItem2.equip_pk = r.result.id;
if (r.result.isimportant) {
this.formItem.isimportant = r.result.isimportant + "";
} else {
this.formItem.isimportant = "1";
}
});
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
Api.update({
equipCalendarWork: this.formItem1,
equipCalendarOverTime: this.formItem2,
isimportant: this.formItem.isimportant,
capabilityValue: this.formItem.capabilityValue,
})
.then((r) => {
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "plan_resource" + "." + key;
return this.$t(key);
},
},
},
watch: {
eid(v) {
if (v != 0) {
this.formItem1.calendarwork_pk = "";
this.formItem2.calendarovertime_pk = "";
this.load(v);
}
watch: {
eid(v) {
if (v != 0) {
this.formItem1.calendarwork_pk = "";
this.formItem2.calendarovertime_pk = "";
this.load(v);
}
},
},
},
};
</script>
\ No newline at end of file
</script>
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