Commit c6783e18 authored by 周远喜's avatar 周远喜

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

parents 9231cad3 65e81f94
...@@ -327,7 +327,7 @@ ...@@ -327,7 +327,7 @@
height:65px; height:65px;
.ivu-footer-toolbar-right { .ivu-footer-toolbar-right {
float: left; float: left;
padding-left: 200px; padding-left: 280px;
} }
} }
} }
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
</Drawer> </Drawer>
<FooterToolbar style="height:65px" v-if="batch" v-show="footerToolbar"> <FooterToolbar style="height:65px" v-if="batch" v-show="footerToolbar">
<div class="tip"> <div class="tip">
已选{{selectItems.length}} 已选{{selectItems.length}}
<slot name="batch"></slot> <slot name="batch"></slot>
</div> </div>
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
</p> </p>
<div class="dispatch_part_body" :style="{height:byheight}"> <div class="dispatch_part_body" :style="{height:byheight}">
<!-- {{ids}} --> <!-- {{ids}} -->
<Row :gutter="15" class="card_body"> <Row :gutter="15" class="card_body01">
<Col span="8" class="dispatch_card" v-for="(item,index) in listTask" :key="index"> <Col span="8" class="dispatch_card" v-for="(item,index) in listTask" :key="index">
<Card> <Card>
<p slot="title" class="card_top"> <p slot="title" class="card_top">
......
...@@ -25,4 +25,7 @@ export default { ...@@ -25,4 +25,7 @@ export default {
routingdistribute(params) {//工艺派发 routingdistribute(params) {//工艺派发
return Api.post(`${PlanUrl}/messchedule/routingdistribute`, params); return Api.post(`${PlanUrl}/messchedule/routingdistribute`, params);
}, },
moveintoaps() {//跳转进入排产池前判断
return Api.post(`${PlanUrl}/messchedule/moveintoaps`);
},
} }
\ No newline at end of file
<template> <template>
<div class="myBug"> <div class="myBug">
<DataGrid :columns="columns" ref="grid" :action="action" @on-selection-change="selectInfo" :batch='false'> <DataGrid
:columns="columns"
ref="grid"
:action="action"
@on-selection-change="selectInfo"
:batch="false"
>
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"> <FormItem prop="keys">
...@@ -60,14 +66,14 @@ ...@@ -60,14 +66,14 @@
</div> </div>
</template> </template>
<script> <script>
import Api from './api' import Api from "./api";
import Add from './add' import Add from "./add";
import Edit from './edit' import Edit from "./edit";
import Detail from './detail' import Detail from "./detail";
import Search from './search' import Search from "./search";
import Dispatch from './dispatch' import Dispatch from "./dispatch";
export default { export default {
name: 'list', name: "list",
components: { components: {
Add, Add,
Edit, Edit,
...@@ -80,8 +86,7 @@ export default { ...@@ -80,8 +86,7 @@ export default {
action: Api.index, action: Api.index,
easySearch: { easySearch: {
keys: { keys: {
op: op: "mesCode,taskType,stage,projectNumber,materialName",
'mesCode,taskType,stage,projectNumber,materialName',
value: null value: null
} }
}, },
...@@ -94,181 +99,181 @@ export default { ...@@ -94,181 +99,181 @@ export default {
curId: 0, curId: 0,
columns: [ columns: [
{ {
type: 'selection', type: "selection",
width: 70, width: 70,
align: 'center' align: "center"
}, },
{ {
title: this.l('mesCode'), title: this.l("mesCode"),
key: 'mesCode', key: "mesCode",
width: 240, width: 240,
align: 'left' align: "left"
}, },
{ {
key: 'productName', key: "productName",
title: this.l('productName'), title: this.l("productName"),
align: 'left', align: "left",
easy: true, easy: true,
width:160, width: 160,
high: true, high: true,
tooltip:true tooltip: true
}, },
{ {
key: 'status', key: "status",
title: this.l('status'), title: this.l("status"),
align: 'center', align: "center",
high: true, high: true,
code: 'plan.order.status' code: "plan.order.status"
}, },
{ {
key: 'mainRoutingSetStatus', key: "mainRoutingSetStatus",
title: this.l('mainRoutingSetStatus'), title: this.l("mainRoutingSetStatus"),
align: 'center', align: "center",
high: true, high: true,
code: 'aps.plan.mainRoutingStatus' code: "aps.plan.mainRoutingStatus"
}, },
{ {
key: 'isSupportingFinish', key: "isSupportingFinish",
title: this.l('isSupportingFinish'), title: this.l("isSupportingFinish"),
align: 'center', align: "center",
high: true, high: true,
code: 'aps.plan.supportingStatus' code: "aps.plan.supportingStatus"
}, },
{ {
key: 'projectNumber', key: "projectNumber",
title: this.l('projectNumber'), title: this.l("projectNumber"),
align: 'left', align: "left",
easy: true, easy: true,
high: true high: true
}, },
{ {
key: 'batchNumber', key: "batchNumber",
title: this.l('batchNumber'), title: this.l("batchNumber"),
align: 'left', align: "left",
easy: true, easy: true,
high: true high: true
}, },
{ {
key: 'urgencyLevel', key: "urgencyLevel",
title: this.l('urgencyLevel'), title: this.l("urgencyLevel"),
align: 'left', align: "left",
easy: true, easy: true,
high: true high: true
}, },
{ {
key: 'taskType', key: "taskType",
title: this.l('taskType'), title: this.l("taskType"),
align: 'left', align: "left",
easy: true, easy: true,
high: true, high: true,
hide: true, hide: true,
code: 'plan.order.taskType' code: "plan.order.taskType"
}, },
{ {
key: 'drawnNumber', key: "drawnNumber",
title: this.l('drawnNumber'), title: this.l("drawnNumber"),
align: 'left', align: "left",
easy: true, easy: true,
high: true high: true
}, },
{ {
key: 'stage', key: "stage",
title: this.l('stage'), title: this.l("stage"),
align: 'left', align: "left",
easy: true, easy: true,
high: true, high: true,
code: 'plan.order.stage' code: "plan.order.stage"
}, },
{ {
key: 'materialName', key: "materialName",
title: this.l('materialName'), title: this.l("materialName"),
align: 'left', align: "left",
easy: true, easy: true,
high: true high: true
}, },
{ {
key: 'quantity', key: "quantity",
title: this.l('quantity'), title: this.l("quantity"),
align: 'left', align: "left",
high: true high: true
}, },
{ {
key: 'routingMethod', key: "routingMethod",
title: this.l('routingMethod'), title: this.l("routingMethod"),
align: 'left', align: "left",
easy: true, easy: true,
high: true, high: true,
code: 'plan.order.routingMethod' code: "plan.order.routingMethod"
}, },
{ {
key: 'materialWeight', key: "materialWeight",
title: this.l('materialWeight'), title: this.l("materialWeight"),
align: 'left', align: "left",
high: true, high: true,
hide: true hide: true
}, },
{ {
key: 'productCode', key: "productCode",
title: this.l('productCode'), title: this.l("productCode"),
align: 'left', align: "left",
easy: true, easy: true,
high: true, high: true,
hide: true hide: true
}, },
{ {
key: 'isPreschedule', key: "isPreschedule",
title: this.l('isPreschedule'), title: this.l("isPreschedule"),
align: 'left', align: "left",
high: true, high: true,
code: 'mes_xingchi_plan.mes_order.is_preschedule', code: "mes_xingchi_plan.mes_order.is_preschedule",
hide: true hide: true
}, },
{ {
key: 'spareQty', key: "spareQty",
title: this.l('spareQty'), title: this.l("spareQty"),
align: 'left', align: "left",
high: true, high: true,
hide: true hide: true
}, },
{ {
key: 'demandStart', key: "demandStart",
title: this.l('demandStart'), title: this.l("demandStart"),
align: 'left', align: "left",
high: true, high: true,
hide: true hide: true
}, },
{ {
key: 'demandFinish', key: "demandFinish",
title: this.l('demandFinish'), title: this.l("demandFinish"),
align: 'left', align: "left",
high: true, high: true,
hide: true hide: true
}, },
{ {
key: 'partNamePro', key: "partNamePro",
title: this.l('partNamePro'), title: this.l("partNamePro"),
align: 'left', align: "left",
easy: true, easy: true,
high: true, high: true,
hide: true hide: true
}, },
{ {
title: '操作', title: "操作",
key: 'action', key: "action",
width: 140, width: 140,
align: 'center', align: "center",
render: (h, params) => { render: (h, params) => {
return h('div', { class: 'action' }, [ return h("div", { class: "action" }, [
h( h(
'op', "op",
{ {
attrs: { oprate: 'detail' }, attrs: { oprate: "detail" },
style: { style: {
color: params.row.mainRoutingSetStatus == 0 ? 'red' : '' color: params.row.mainRoutingSetStatus == 0 ? "red" : ""
}, },
on: { on: {
click: () => click: () =>
...@@ -279,10 +284,10 @@ export default { ...@@ -279,10 +284,10 @@ export default {
} }
}, },
params.row.mainRoutingSetStatus == 0 params.row.mainRoutingSetStatus == 0
? '工艺派发' ? "工艺派发"
: params.row.mainRoutingSetStatus == 1 : params.row.mainRoutingSetStatus == 1
? '移入排产' ? "移入排产"
: '' : ""
) )
// h( // h(
// 'op', // 'op',
...@@ -300,7 +305,7 @@ export default { ...@@ -300,7 +305,7 @@ export default {
// }, // },
// '删除' // '删除'
// ) // )
]) ]);
} }
} }
], ],
...@@ -315,206 +320,215 @@ export default { ...@@ -315,206 +320,215 @@ export default {
resultsStatus: 0, resultsStatus: 0,
dispatchStatus: 0, //派发标识 dispatchStatus: 0, //派发标识
scheduleStatus: 0, //排产标识 scheduleStatus: 0, //排产标识
resultsOrderList: '' resultsOrderList: ""
} };
}, },
mounted() { mounted() {
console.log(this) console.log(this);
}, },
async fetch({ store, params }) { async fetch({ store, params }) {
await store.dispatch('loadDictionary') // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
methods: { methods: {
handleSelectAll(status) { handleSelectAll(status) {
//选择列表数据 //选择列表数据
this.$refs.grid.selectAll(status) this.$refs.grid.selectAll(status);
}, },
selectInfo(value) { selectInfo(value) {
if (value.length > 0) { if (value.length > 0) {
this.footerBar = true this.footerBar = true;
} else { } else {
this.footerBar = false this.footerBar = false;
} }
this.selectList = [] this.selectList = [];
this.selectList = value this.selectList = value;
this.selectCount = this.selectList.length this.selectCount = this.selectList.length;
let statueArry = [] let statueArry = [];
let tempmesCodeList = [] let tempmesCodeList = [];
this.resultsStatusArr = [] this.resultsStatusArr = [];
value.forEach((data) => { value.forEach(data => {
var that = this var that = this;
statueArry.push(data.id) statueArry.push(data.id);
this.resultsStatusArr.push(data.mainRoutingSetStatus) this.resultsStatusArr.push(data.mainRoutingSetStatus);
tempmesCodeList.push(data.mesCode) tempmesCodeList.push(data.mesCode);
}) });
let mainRS = this.uniq(this.resultsStatusArr) //数组去重 let mainRS = this.uniq(this.resultsStatusArr); //数组去重
if (mainRS.length == 1) { if (mainRS.length == 1) {
this.results = [] this.results = [];
this.results = statueArry this.results = statueArry;
this.getListId(statueArry) this.getListId(statueArry);
this.resultsOrderList = JSON.stringify(tempmesCodeList) //提示mesCode this.resultsOrderList = JSON.stringify(tempmesCodeList) //提示mesCode
.replace('[', '') .replace("[", "")
.replace(']', '') .replace("]", "")
.replace(/\"/g, '') .replace(/\"/g, "");
if (mainRS[0] == 0) { if (mainRS[0] == 0) {
//未派发 //未派发
this.dispatchStatus = 1 this.dispatchStatus = 1;
this.scheduleStatus = 0 this.scheduleStatus = 0;
} else if (mainRS[0] == 1) { } else if (mainRS[0] == 1) {
//已派发 //已派发
this.dispatchStatus = 0 this.dispatchStatus = 0;
this.scheduleStatus = 1 this.scheduleStatus = 1;
} else { } else {
//派发中 //派发中
this.dispatchStatus = 0 this.dispatchStatus = 0;
this.scheduleStatus = 0 this.scheduleStatus = 0;
} }
} else { } else {
this.dispatchStatus = 0 this.dispatchStatus = 0;
this.scheduleStatus = 0 this.scheduleStatus = 0;
} }
}, },
//得到需要批量操作的ids //得到需要批量操作的ids
getListId(value) { getListId(value) {
this.listBatchIds1 = value this.listBatchIds1 = value;
if (this.listBatchIds1.length > 0) { if (this.listBatchIds1.length > 0) {
this.footerBar = true this.footerBar = true;
} else { } else {
this.footerBar = false this.footerBar = false;
} }
}, },
canselFooter() { canselFooter() {
this.footerBar = false this.footerBar = false;
this.handleSelectAll(false) this.handleSelectAll(false);
}, },
modalDispatch() { modalDispatch() {
//打开工艺派发 //打开工艺派发
this.listBatchIds = this.listBatchIds1 //用于列表操作时和多选时的listBatchId的冲突 this.listBatchIds = this.listBatchIds1; //用于列表操作时和多选时的listBatchId的冲突
if (this.dispatchStatus == 1) { if (this.dispatchStatus == 1) {
this.dispatchModal = true this.dispatchModal = true;
} else { } else {
this.$Message.error('所选订单里存在已派发订单!') this.$Message.error("所选订单里存在已派发订单!");
} }
}, },
modalSchedule() { modalSchedule() {
//移入排产 //移入排产
this.listBatchIds = this.listBatchIds1 this.listBatchIds = this.listBatchIds1;
if (this.scheduleStatus == 1) { if (this.scheduleStatus == 1) {
this.scheduleModal = true this.scheduleModal = true;
} else { } else {
this.$Message.error('所选订单里存在未派发订单!') this.$Message.error("所选订单里存在未派发订单!");
} }
}, },
goMethod(value) { goMethod(value) {
//行内点击后面按钮 //行内点击后面按钮
this.resultsOrderList = value.mesCode this.resultsOrderList = value.mesCode;
this.listBatchIds = [value.id] this.listBatchIds = [value.id];
if (value.mainRoutingSetStatus == 0) { if (value.mainRoutingSetStatus == 0) {
//this.dispatchStatus = 1 //this.dispatchStatus = 1
//this.scheduleStatus = 0 //this.scheduleStatus = 0
this.dispatchModal = true this.dispatchModal = true;
} else if (value.mainRoutingSetStatus == 1) { } else if (value.mainRoutingSetStatus == 1) {
//this.dispatchStatus = 0 //this.dispatchStatus = 0
//this.scheduleStatus = 1 //this.scheduleStatus = 1
this.scheduleModal = true this.scheduleModal = true;
} }
}, },
scheduleOk() { scheduleOk() {
let params = { ids: this.listBatchIds } let params = { ids: this.listBatchIds };
Api.moveinbatch(params) Api.moveinbatch(params)
.then((r) => { .then(r => {
if (r.success) { if (r.success) {
this.$Message.success('移入排产成功') this.$Message.success("移入排产成功");
} else { } else {
this.$Message.error('移入排产失败') this.$Message.error("移入排产失败");
} }
}) })
.catch((err) => { .catch(err => {
this.$Message.error('移入排产失败') this.$Message.error("移入排产失败");
}) });
this.canselFooter() this.canselFooter();
this.cancel() this.cancel();
}, },
//跳转到aps排产池(有判断)
goAps() { goAps() {
Api.moveintoaps().then((res) => {
if (res.success) {
if (res.result.res) {
this.$router.push({ this.$router.push({
name: 'aps-aps' name: "aps-aps"
// params: { customerId: id } // params: { customerId: id }
}) });
} else {
this.$Message.error(res.result.msg);
}
}
});
}, },
addOk() { addOk() {
this.$refs.grid.load() this.$refs.grid.load();
this.addModal = false this.addModal = false;
this.detailModal = false this.detailModal = false;
this.editModal = false this.editModal = false;
this.curId = 0 this.curId = 0;
//aps //aps
this.dispatchModal = false this.dispatchModal = false;
this.scheduleModal = false this.scheduleModal = false;
this.listBatchIds = [] this.listBatchIds = [];
this.listBatchIds1 = [] this.listBatchIds1 = [];
this.canselFooter() this.canselFooter();
}, },
search() { search() {
this.$refs.grid.reload(this.easySearch) this.$refs.grid.reload(this.easySearch);
}, },
detail(id) { detail(id) {
this.detailModal = true this.detailModal = true;
this.curId = id this.curId = id;
}, },
edit(id) { edit(id) {
this.editModal = true this.editModal = true;
this.curId = id this.curId = id;
}, },
remove(id) { remove(id) {
this.deletelModal = true this.deletelModal = true;
this.curId = id this.curId = id;
}, },
removeOk() { removeOk() {
Api.delete({ id: this.curId }).then((r) => { Api.delete({ id: this.curId }).then(r => {
if (r.success) { if (r.success) {
this.$refs.grid.load() this.$refs.grid.load();
this.deletelModal = false this.deletelModal = false;
this.$Message.success('删除成功') this.$Message.success("删除成功");
} }
}) });
}, },
removeCancel() { removeCancel() {
this.deletelModal = false this.deletelModal = false;
}, },
cancel() { cancel() {
this.curId = 0 this.curId = 0;
this.addModal = false this.addModal = false;
this.detailModal = false this.detailModal = false;
this.editModal = false this.editModal = false;
this.deletedlModal = false this.deletedlModal = false;
//aps //aps
this.dispatchModal = false this.dispatchModal = false;
this.scheduleModal = false this.scheduleModal = false;
// this.listBatchIds = [] // this.listBatchIds = []
// this.listBatchIds1 = [] // this.listBatchIds1 = []
// this.canselFooter() // this.canselFooter()
}, },
l(key) { l(key) {
let vkey = 'mes_order' + '.' + key let vkey = "mes_order" + "." + key;
return this.$t(vkey) || key return this.$t(vkey) || key;
}, },
uniq(array) { uniq(array) {
//数组去重 //数组去重
array.sort() array.sort();
var temp = [] var temp = [];
temp = [array[0]] temp = [array[0]];
for (var i = 1; i < array.length; i++) { for (var i = 1; i < array.length; i++) {
if (array[i] !== temp[temp.length - 1]) { if (array[i] !== temp[temp.length - 1]) {
temp.push(array[i]) temp.push(array[i]);
} }
} }
return temp return temp;
} }
} }
} };
</script> </script>
<style lang="less"> <style lang="less">
.footerSpan { .footerSpan {
......
<template>
<Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :show-message="false" :label-width="90">
<Row>
<FormItem label="类型" prop="typeid">
<Select v-model="formValidate.typeid" placeholder="请选择" style="width:240px;">
<Option v-for="(item,index) in alltype " :key="item.index" :value="item.value">{{item.label}}</Option>
</Select>
</FormItem>
</Row>
<Row>
<FormItem label="名称" prop="name">
<Input v-model="formValidate.name" style="width:240px;"></Input>
</FormItem>
</Row>
<Row>
<FormItem label="描述" prop="description">
<Input v-model="formValidate.description" style="width:240px;"></Input>
</FormItem>
</Row>
<!-- <FormItem label="编号" prop="number">
<Input v-model="formValidate.number" number></Input>
</FormItem> -->
</Form>
</template>
<script>
export default {
name:'addDictionary',
props:['alltype'],
data(){
return {
formValidate:{typeid:'',name:'',description:''},
ruleValidate:{
name:[{required: true}],
// number:[{required: true,type:'number'}],
typeid:[{required: true}]
}
}
}
}
</script>
<style scoped>
.ivu-form-item {width:48%;display:inline-block;}
.ivu-form-item:nth-child(odd) {
margin-left: 10px
}
</style>
\ No newline at end of file
<template>
<div>
<div class="contentRight">
<label>类型:</label>
<Select v-model="model1" @on-change="change" placeholder="请选择" style="width: 200px">
<Option v-for="(item,index) in selectdata" :key="item.index" :value="item.value">{{item.label}}</Option>
</Select>
<div style="float:right" class="paddingbtn">
<Button type="primary" @click="add('formValidate')">新增</Button>
<!-- <Button type="primary" @click="edit">编辑</Button>
<Button type="primary" @click="del">删除</Button> -->
</div>
<tb :tbPro="tbPro" ref="table" v-on:rowclick="rowclick" class="margin-top-10"></tb>
</div>
<Modal v-model="modal1" title="新增字典数据" :width="440" :mask-closable="false"
:loading="myloading"
ok-text="保存" cancel-text="取消" @on-ok="ok('formValidate')" @on-cancel='cancel'
>
<add-dictionary ref="datadictionary" :alltype="selectdata"></add-dictionary>
<!-- <div slot="footer" style="text-align:center">
<Button type="primary" @click="ok('formValidate')">保存</Button>
<Button
type="primary"
style="border-color: rgb(204, 204, 204);background-color:white;color:black"
@click="cancel"
>取消</Button>
</div> -->
</Modal>
<myconfirm ref="mysel" v-on:confirmok="okmysel" v-on:confirmcancel="cancelmysel"></myconfirm>
</div>
</template>
<script>
import tb from '../roleManagent/components/tb'
import addDictionary from './components/add'
import myconfirm from '../../processDesign/productTree/components/myconfirm'
import service from '@/plugins/request'
export default {
components:{tb,addDictionary,myconfirm},
data(){
return {
myloading:true,
model1:'',
modal1:false,
isEdit:false,
formValidate1:{},
keyid:0,
clickdata:{},
//xia la
selectdata:[
{
value:'产品类型',
label:'产品类型'
},
{
value:'产品分类',
label:'产品分类'
},
{
value:'工艺类型',
label:'工艺类型'
},
{
value:'工艺阶段',
label:'工艺阶段'
},
{
value:'产品型号',
label:'产品型号'
},
],
//表格数据和属性
tbPro:{
height:"",
isBorder: true,
stripe: true,//斑马纹
highlight:true,//高亮显示
columns: [
{
type: 'index',
width: 60,
align: 'center'
},
{
title: '名称',
key: 'name'
},
{
title: '描述',
key: 'description'
},
{
title: '编码',
key: 'code'
},
{
title: '操作',
key: 'action',
align: 'center',
width:400,
render: (h, params) => {
return h('div', [
h(
'span',
{
props: {
type: 'text',
ghost:true
},
style: {
color: '#249E91',
marginRight:"5px",
cursor:"pointer"
},
on: {
click: () => {
this.edit(params)
}
}
},
'编辑'
),
h(
'span',
{
props: {
type: 'text',
ghost:true
},
style: {
color: '#F56C6C',
marginRight:"5px",
cursor:"pointer"
},
on: {
click: () => {
this.del(params)
}
}
},
'删除'
)
])
}
}
],
data: [
]
}
}
},
created(){
var url=`${systemUrl}/DictionaryType/GetPaged`
service.get(`${url}`).then(response=>{
//console.log(response.data.result.items)
this.selectdata=response.data.result.items
this.model1=this.selectdata[0].value
this.loaddata(this.model1)
});
this.tbPro.height = window.innerHeight - 180;
},
mounted(){
window.onresize = () => {
return (() => {
this.tbPro.height = window.innerHeight - 180;
})()
}
},
computed:{
alldata:function(){
return this.tbPro.data
}
},
methods:{
loaddata(id){
var url=`${systemUrl}/Dictionary/GetPaged`
service.get(`${url}`,{params:{TypeId:id}}).then(response=>{
this.tbPro.data=response.data.result.items
})
},
change(data){
// console.log(data);
this.loaddata(data)
},
add:function(name){
this.isEdit=false;
var a = this.$refs.datadictionary;
a.$refs[name].resetFields();
this.modal1=true;
this.$refs.datadictionary.formValidate={typeid:'',description:'',name:''}
},
edit(params){
var a = this.$refs.datadictionary;
a.$refs['formValidate'].resetFields();
this.modal1=true;
this.isEdit=true;
let {typeId,name,description,id,code}=params.row;
// console.log(typeId)
// console.log(number);
this.$refs.datadictionary.formValidate={typeid:typeId,name:name,description:description,id:id,code:code}
},
del(params){
console.log(params)
this.keyid=params.row.id
console.log(this.keyid)
this.$refs.mysel.confirmmodal=true;
},
okmysel(bl){
var url=`${systemUrl}/Dictionary/Delete?id=${this.keyid}`
service.delete(`${url}`).then(response=>{
if(response.data.success)
{
this.$Message.success('删除成功')
this.loaddata(this.model1)
}
}).catch(error=>{
this.$Message.error('删除失败')
})
this.$refs.mysel.confirmmodal=bl
},
cancelmysel(bl){
this.$refs.mysel.confirmmodal=bl
},
//保存增加修改
ok(name){
var a = this.$refs.datadictionary;
var url=`${systemUrl}/Dictionary/CreateOrUpdate`
var ar=this.alldata.find((val)=>{
return (val.name==this.$refs.datadictionary.formValidate.name)
})
if(ar){
this.$Message.error('已存在字典项的名字');
setTimeout(() => {
this.myloading = false
this.$nextTick(() => {
this.myloading = true
})
}, 500)
return;
}
a.$refs[name].validate((valid) => {
if (valid) {
this.formValidate1 = this.$refs.datadictionary.formValidate
if (this.isedit)
{
//this.formValidate1.id=
}
service.post(`${url}`,JSON.stringify({Dictionary:this.formValidate1})).then(response=>{
if(response.data.success){
this.$Message.success('保存成功')
this.loaddata(this.model1)
this.modal1 = false
}
}).catch(error=>{
//console.log(123)
// console.log(error)
this.$Message.error('保存失败')
})
} else {
setTimeout(() => {
this.myloading = false
this.$nextTick(() => {
this.myloading = true
})
}, 500)
this.$Message.error('请输入必填项')
}
})
},
cancel(){
this.modal1=false;
},
rowclick(data,index){
console.log(typeof(data));
this.clickdata=data;
// console.log(this.clickdata);
}
}
}
</script>
<style scoped>
</style>
<template id="addPRi">
<Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :show-message="false" :label-width="80" >
<FormItem label="父权限" prop="up_id">
<Select v-model="formValidate.up_id" style="width:240px;">
<Option v-for="(item,index) in list " :key="index" :value="item.value" style="display:none">{{item.label}} </Option>
<Tree v-show="isShow" :data="seldata" @on-select-change="handleSelect"></Tree>
</Select>
</FormItem>
<FormItem label="权限名称" prop="name">
<Input v-model="formValidate.name" style="width:240px;"></Input>
</FormItem>
<FormItem label="系统" prop="from_system">
<Select v-model="formValidate.from_system" @on-change="selectSys" style="width:240px;">
<Option v-for="(item,index) in allsystem " :key="index+1" :value="item.value">{{item.label}}</Option>
</Select>
</FormItem>
<FormItem label="操作类型" prop="type">
<Select v-model="formValidate.type" placeholder="请选择" style="width:240px;">
<Option value=1>菜单</Option>
<Option value=2>系统</Option>
<Option value=3>页面</Option>
</Select>
</FormItem>
<FormItem label="地址" prop="url">
<Input v-model="formValidate.url" style="width:240px;"></Input>
<!-- <Select v-model="formValidate.url" placeholder="请选择">
<Option v-for="(item,index) in allpages " :key="item.value" :value="item.value">{{item.label}}</Option>
</Select> -->
</FormItem>
<!-- <FormItem label="密级" prop="secret_class">
<Select v-model="formValidate.secret_class" placeholder="请选择" style="width:240px;">
<Option v-for="(item,index) in mijis " :key="item.value" :value="item.value">{{item.label}}</Option>
</Select>
</FormItem> -->
<FormItem label="状态" prop="status">
<Select v-model="formValidate.status" placeholder="请选择" style="width:240px;">
<Option value=0>启用</Option>
<Option value=1>禁用</Option>
</Select>
</FormItem>
<!-- <FormItem label="打开方式" prop="target">
<Select v-model="formValidate.target" placeholder="请选择" style="width:240px;">
<Option value="系统内">系统内</Option>
<Option value="新页面">新页面</Option>
</Select>
</FormItem> -->
<FormItem label="排序" prop="priority">
<Input v-model="formValidate.priority" style="width:240px;"></Input>
</FormItem>
</Form>
</template>
<script>
import service from '@/plugins/request'
export default {
name:'addPrivilege',
tit:'',
props:[
'seldata'
],
data(){
return {
formValidate:{name:'',up_id:-1,from_system:'',type:'',url:'',status:'',target:'',priority:'',secret_class:''},
ruleValidate: {
up_id:[{required: true}],
name:[{required: true}],
from_system:[{required: true}],
type:[{required: true}],
url:[{required: true}]
// priority:[ { required: true, message: '排序不能为空' },
// { type: 'number', message: '请输入排序,只能填写数字' }]
},
list:[],
isShow:true,
allsystem:[
{
value:'0',
label:'三车间MES'
},
{
value:'1',
label:'机加MES'
}
],
allpages:[
{
value:'/a/index.html',
label:'/a/index.html'
},
{
value:'/a/port.html',
label:'/a/port.html'
},
{
value:'/a/default.html',
label:'/a/default.html'
}
],
mijis:[
{
value:'机密',
label:'机密'
},
{
value:'一般',
label:'一般'
},
{
value:'内部',
label:'内部'
}
]
}
},
created(){
this.formValidate.from_system=this.allsystem[0].value
//this.gettree(this.formValidate.from_system);
},
computed:{
},
methods:{
selectSys(){
this.$emit('selectSys',this.formValidate.from_system)
},
handleSelect(data){
this.list=[];
this.list.push({label:data[0].title,value:data[0].value});
console.log(this.list);
this.formValidate.up_id=data[0].value;
},
getdata(){
return this.formValidate
}
}
}
</script>
<style scoped>
.ivu-form-item {width:48%;display:inline-block;}
.ivu-form-item:nth-child(odd) {
margin-left: 10px
}
</style>
\ No newline at end of file
<!--
* @Author: 黄龙
* @pageName: 'tree-grid 树型表格'
* @Date: 2017-07-17 16:48:44
* @Last Modified by: 黄龙
* @Last Modified time: 2017-07-17 16:48:44
* @events @on-row-click 单击行或者单击操作按钮方法
@on-selection-change 多选模式下 选中项变化时触发
@on-sort-change 排序时有效,当点击排序时触发
@props items 显示的结构化数据
columns 表格列的配置描述 sortable:true 开启排序功能
type: 'selection'为多选功能 type: 'action' 为操作功能 actions:[{}] 操作按钮
-->
<template>
<div :style="{width:tableWidth,height:tableWidth}" class='autoTbale'>
<table class="table table-bordered" id='hl-tree-table' ref="hl-tree-table">
<thead>
<tr>
<th v-for="(column,index) in cloneColumns" :key="index" style="background:#F5F6FA">
<label v-if="column.type === 'selection'">
<input type="checkbox" v-model="checks" @click="handleCheckAll">
</label>
<label v-else>
{{ renderHeader(column, index) }}
<span class="ivu-table-sort" v-if="column.sortable">
<Icon type="arrow-up-b" :class="{on: column._sortType === 'asc'}" @click.native="handleSort(index, 'asc')" />
<Icon type="arrow-down-b" :class="{on: column._sortType === 'desc'}" @click.native="handleSort(index, 'desc')" />
</span>
</label>
</th>
</tr>
</thead>
<tbody>
<tr v-for="(item,index) in initItems" :key="item.index" v-show="show(item)" :class="{'child-tr':item.parent}" class="mytr noacitve" @click="clicktr(item,$event,index)">
<td v-for="(column,snum) in columns" :key="column.key" :style=tdStyle(column)>
<label v-if="column.type === 'selection'">
<input type="checkbox" :value="item.id" v-model="checkGroup" @click="handleCheckClick(item,$event,index)">
</label>
<div v-if="column.type === 'action'" class="action">
<op :oprate="action.oprate" :class="action.class" @click="RowClick(item,$event,index,action.text)" v-for='action in (column.actions)' :key="action.text">{{action.text}}</op>
</div>
<label @click="toggle(index,item)" v-if="!column.type">
<span v-if='snum==iconRow()'>
<i v-html='item.spaceHtml'></i>
<i v-if="item.children&&item.children.length>0" class="ivu-icon" style="font-size:20px" :class="{'ivu-icon-md-arrow-dropright':!item.expanded,'ivu-icon-md-arrow-dropdown':item.expanded }"></i>
<i v-else class="ms-tree-space"></i>
</span> {{renderBody(item,column) }}
</label>
</td>
</tr>
</tbody>
</table>
</div>
</template>
<script>
export default {
name: 'treeGrid',
props: {
columns: Array,
items: {
type: Array,
default: function() {
return [];
}
}
},
data() {
return {
initItems: [], //处理后数据数组
cloneColumns: [], //处理后的表头数据
checkGroup: [], //复选框数组
checks: false, //全选
screenWidth: document.body.clientWidth, //自适应宽
tdsWidth: 0, //td总宽
timer: false, //控制监听时长
dataLength: 0, //树形数据长度
isActive:false,
leftWidth:0
}
},
computed: {
tableWidth() {
return this.tdsWidth > this.screenWidth && this.screenWidth > 0 ? this.screenWidth + 'px' : '100%'
}
},
watch: {
screenWidth(val) {
if (!this.timer) {
this.screenWidth = val
this.timer = true
setTimeout(() => {
this.timer = false
}, 400)
}
},
items() {
if (this.items) {
this.dataLength = this.Length(this.items)
this.initData(this.deepCopy(this.items), 1, null);
this.checkGroup = this.renderCheck(this.items)
if (this.checkGroup.length == this.dataLength) {
this.checks = true
} else {
this.checks = false
}
}
},
columns: {
handler() {
this.cloneColumns = this.makeColumns();
},
deep: true
},
checkGroup(data) {
this.checkAllGroupChange(data)
},
},
mounted() {
if (this.items) {
this.dataLength = this.Length(this.items)
this.initData(this.deepCopy(this.items), 1, null);
this.cloneColumns = this.makeColumns();
this.checkGroup = this.renderCheck(this.items)
if (this.checkGroup.length == this.dataLength) {
this.checks = true
} else {
this.checks = false
}
}
// 绑定onresize事件 监听屏幕变化设置宽
this.$nextTick(() => {
this.screenWidth = document.body.clientWidth
})
window.onresize = () => {
return (() => {
window.screenWidth = document.body.clientWidth;
this.screenWidth = window.screenWidth;
})()
}
},
methods: {
clicktr(data,e,i){
//console.log(e);
let result = this.makeData(data);
//console.log(result);
this.$emit('on-row-click', result, e, i)
var boxArr = document.querySelectorAll(".mytr");
// console.log(boxArr)
boxArr.forEach(function(item,index){
item.classList.remove('acitvetr');
if(i !==index){
item.classList.add('noacitve');
}
});
boxArr[i].classList.remove('noacitve');
boxArr[i].classList.add('acitvetr');
},
// 有无多选框折叠位置优化
iconRow() {
for (var i = 0, len = this.columns.length; i < len; i++) {
if (this.columns[i].type == 'selection') {
return 1
}
}
return 0
},
// 设置td宽度,td的align
tdStyle(column) {
var style = {}
if (column.align) {
style["text-align"] = column.align;
}
if (column.width) {
style["min-width"] = column.width + 'px';
}
return style;
},
// 排序事件
handleSort(index, type) {
this.cloneColumns.forEach((col) => col._sortType = 'normal');
if (this.cloneColumns[index]._sortType === type) {
this.cloneColumns[index]._sortType = 'normal'
} else {
this.cloneColumns[index]._sortType = type
}
this.$emit('on-sort-change', this.cloneColumns[index]['key'], this.cloneColumns[index]['_sortType'])
},
// 点击某一行事件
RowClick(data, event, index, text) {
let result = this.makeData(data)
this.$emit('on-row-click', result, event, index, text)
},
// 点击事件 返回数据处理
makeData(data) {
const t = this.type(data);
let o;
if (t === 'array') {
o = [];
} else if (t === 'object') {
o = {};
} else {
return data;
}
if (t === 'array') {
for (let i = 0; i < data.length; i++) {
o.push(this.makeData(data[i]));
}
} else if (t === 'object') {
for (let i in data) {
if (i != 'spaceHtml' && i != 'parent' && i != 'level' && i != 'expanded' && i != 'isShow' && i !=
'load') {
o[i] = this.makeData(data[i]);
}
}
}
return o;
},
// 处理表头数据
makeColumns() {
let columns = this.deepCopy(this.columns);
this.tdsWidth = 0
columns.forEach((column, index) => {
column._index = index;
column._width = column.width ? column.width : '';
column._sortType = 'normal';
this.tdsWidth += column.width ? parseFloat(column.width) : 0;
});
return columns;
},
// 数据处理 增加自定义属性监听
initData(items, level, parent) {
this.initItems = []
let spaceHtml = "";
for (var i = 1; i < level; i++) {
spaceHtml += "<i class='ms-tree-space'></i>"
}
items.forEach((item, index) => {
item = Object.assign({}, item, {
"parent": parent,
"level": level,
"spaceHtml": spaceHtml
});
if ((typeof item.expanded) == "undefined") {
item = Object.assign({}, item, {
"expanded": false
});
}
if ((typeof item.show) == "undefined") {
item = Object.assign({}, item, {
"isShow": false
});
}
if ((typeof item.isChecked) == "undefined") {
item = Object.assign({}, item, {
"isChecked": false
});
}
item = Object.assign({}, item, {
"load": (item.expanded ? true : false)
});
this.initItems.push(item);
if (item.children && item.expanded) {
this.initData(item.children, level + 1, item);
}
})
},
// 隐藏显示
show(item) {
return ((item.level == 1) || (item.parent && item.parent.expanded && item.isShow));
},
toggle(index, item) {
let level = item.level + 1;
let spaceHtml = "";
for (var i = 1; i < level; i++) {
spaceHtml += "<i class='ms-tree-space'></i>"
}
if (item.children) {
if (item.expanded) {
item.expanded = !item.expanded;
this.close(index, item);
} else {
item.expanded = !item.expanded;
if (item.load) {
this.open(index, item);
} else {
item.load = true;
item.children.forEach((child, childIndex) => {
this.initItems.splice((index + childIndex + 1), 0, child);
//设置监听属性
this.$set(this.initItems[index + childIndex + 1], 'parent', item);
this.$set(this.initItems[index + childIndex + 1], 'level', level);
this.$set(this.initItems[index + childIndex + 1], 'spaceHtml', spaceHtml);
this.$set(this.initItems[index + childIndex + 1], 'isShow', true);
this.$set(this.initItems[index + childIndex + 1], 'expanded', false);
})
}
}
}
},
open(index, item) {
if (item.children) {
item.children.forEach((child, childIndex) => {
child.isShow = true;
if (child.children && child.expanded) {
this.open(index + childIndex + 1, child);
}
})
}
},
close(index, item) {
if (item.children) {
item.children.forEach((child, childIndex) => {
child.isShow = false;
child.expanded = false;
if (child.children) {
this.close(index + childIndex + 1, child);
}
})
}
},
//点击check勾选框,判断是否有children节点 如果有就一并勾选
handleCheckClick(data, event, index){
data.isChecked = !data.isChecked;
var arr = data.children;
if(arr){
if(data.isChecked){
this.checkGroup.push(data.id);
for (let i=0; i<arr.length; i++){
this.checkGroup.push(arr[i].id)
}
}else {
for (var i=0; i<this.checkGroup.length; i++){
if(this.checkGroup[i] == data.id){
this.checkGroup.splice(i,1)
}
for (var j=0; j<arr.length; j++){
if(this.checkGroup[i] == arr[j].id){
this.checkGroup.splice(i,1);
}
}
}
}
}
},
//checkbox 全选 选择事件
handleCheckAll() {
this.checks = !this.checks;
if (this.checks) {
this.checkGroup = this.getArray(this.checkGroup.concat(this.All(this.items)))
} else {
this.checkGroup = []
}
// this.$emit('on-selection-change', this.checkGroup)
},
// 数组去重
getArray(a) {
var hash = {},
len = a.length,
result = [];
for (var i = 0; i < len; i++) {
if (!hash[a[i]]) {
hash[a[i]] = true;
result.push(a[i]);
}
}
return result;
},
checkAllGroupChange(data) {
if (this.dataLength > 0 && data.length === this.dataLength) {
this.checks = true;
} else {
this.checks = false;
}
this.$emit('on-selection-change', this.checkGroup)
},
All(data) {
let arr = []
data.forEach((item) => {
arr.push(item.id)
if (item.children && item.children.length > 0) {
arr = arr.concat(this.All(item.children));
}
})
return arr
},
// 返回树形数据长度
Length(data) {
let length = data.length
data.forEach((child) => {
if (child.children) {
length += this.Length(child.children)
}
})
return length;
},
// 返回表头
renderHeader(column, $index) {
if ('renderHeader' in this.columns[$index]) {
return this.columns[$index].renderHeader(column, $index);
} else {
return column.title || '#';
}
},
// 返回内容
renderBody(row, column, index) {
return row[column.key]
},
// 默认选中
renderCheck(data) {
let arr = []
data.forEach((item) => {
if (item._checked) {
arr.push(item.id)
}
if (item.children && item.children.length > 0) {
arr = arr.concat(this.renderCheck(item.children));
}
})
return arr
},
// 深度拷贝函数
deepCopy(data) {
var t = this.type(data),
o, i, ni;
if (t === 'array') {
o = [];
} else if (t === 'object') {
o = {};
} else {
return data;
}
if (t === 'array') {
for (i = 0, ni = data.length; i < ni; i++) {
o.push(this.deepCopy(data[i]));
}
return o;
} else if (t === 'object') {
for (i in data) {
o[i] = this.deepCopy(data[i]);
}
return o;
}
},
type(obj) {
var toString = Object.prototype.toString;
var map = {
'[object Boolean]': 'boolean',
'[object Number]': 'number',
'[object String]': 'string',
'[object Function]': 'function',
'[object Array]': 'array',
'[object Date]': 'date',
'[object RegExp]': 'regExp',
'[object Undefined]': 'undefined',
'[object Null]': 'null',
'[object Object]': 'object'
};
return map[toString.call(obj)];
}
},
beforeDestroy() {
window.onresize = null
}
}
</script>
<style scoped>
.autoTbale {
overflow: auto;
}
table {
width: 100%;
border-spacing: 0;
border-collapse: collapse;
}
.table-bordered {
border: 1px solid #EBEBEB;
}
.table>tbody>tr>td,
.table>tbody>tr>th,
.table>thead>tr>td,
.table>thead>tr>th {
border-top: 1px solid #e7eaec;
line-height: 1.42857;
padding: 8px ;
vertical-align: middle;
text-align: center
}
.table>tbody>tr>td:nth-child(1){
padding: 8px 8px 8px 30px;
text-align: left;
}
.table-bordered>tbody>tr>td,
.table-bordered>tbody>tr>th,
.table-bordered>tfoot>tr>td,
.table-bordered>tfoot>tr>th,
.table-bordered>thead>tr>td,
.table-bordered>thead>tr>th {
border: 1px solid #e7e7e7;
}
.table>thead>tr>th {
border-bottom: 1px solid #DDD;
}
.table-bordered>thead>tr>td,
.table-bordered>thead>tr>th {
background-color: #F5F5F6;
}
#hl-tree-table>tbody>tr {
height: 48px;
}
#hl-tree-table>tbody>tr:hover{
background-color: #ebf7ff;
}
.noacitve {
background-color: #fbfbfb;
}
.acitvetr {
background-color: #ebf7ff;
}
/deep/.ms-tree-space {
position: relative;
top: 1px;
display: inline-block;
font-style: normal;
font-weight: 400;
line-height: 1;
width: 14px;
height: 14px;
}
/deep/.ms-tree-space::before {
content: ""
}
#hl-tree-table th>label {
margin: 0;
}
</style>
<template>
<div>
<div class="contentRight " :style="{height:divHeihgt}">
<div style="height:32px;">
<div style="display:inline-block;">
<span class="margriht6">系统</span>
<Select
v-model="model1"
label-in-value
@on-change="model1Change"
style="width:240px"
placeholder="请选择"
>
<Option v-for="item in sysdata" :value="item.value" :key="item.value">{{item.label }}</Option>
</Select>
<span class="margriht6 marleft10">状态</span>
<Select v-model="model2" style="width:80px" placeholder="请选择">
<Option v-for="item in roleStatus" :value="item.value" :key="item.value">{{item.label }}</Option>
</Select>
<Button type="primary" @click="search">查询</Button>
</div>
<div style="float:right" class="paddingbtn">
<Button type="primary" @click="add">新增</Button>
<Button type="primary" @click="edit">编辑</Button>
<Button type="primary" @click="del">删除</Button>
</div>
</div>
<div class="margin-top-10">
<tree-grid
:items="data"
ref="table"
:columns="columns"
@on-row-click="rowClick"
@on-selection-change="selectionClick"
@on-sort-change="sortClick"
></tree-grid>
</div>
</div>
<Modal
v-model="modal1"
:mask-closable="false"
title="新增权限菜单"
:width="800"
:loading="myloading"
ok-text="保存"
cancel-text="取消"
@on-ok="ok('formValidate')"
@on-cancel="cancel"
>
<add-privilege :seldata="seldata" ref="addpri" v-on:selectSys="selectSys"></add-privilege>
<!-- <div slot="footer" style="text-align:center">
<Button type="primary" @click="ok('formValidate')">保存</Button>
<Button
type="primary"
style="border-color: rgb(204, 204, 204);background-color:white;color:black"
@click="cancel"
>取消</Button>
</div>-->
</Modal>
<myconfirm ref="mysel" v-on:confirmok="okmysel" v-on:confirmcancel="cancelmysel"></myconfirm>
</div>
</template>
<script>
import treeGrid from './components/treeGrid'
import addPrivilege from './components/add'
import myconfirm from '../../processDesign/productTree/components/myconfirm'
import service from '@/plugins/request'
export default {
components: {
treeGrid,
addPrivilege,
myconfirm
},
data() {
return {
model1: '',
model1Name: '',
model2: '',
modal1: false,
keyid: 0,
divHeihgt:"",
myloading:true,
//点击的行号
clickindex: -1,
clickdata: {},
checkids: [],
//添加还是编辑
isedit: false,
//添加时候表单数据
formValidate1: {},
sysdata: [
// {
// value: '-1',
// label: '全部'
// },
{
value: '0',
label: '3车间MES'
},
{
value: '1',
label: '机加MES'
}
],
roleStatus: [
{
value: '-1',
label: '不限'
},
{
value: '0',
label: '启用'
},
{
value: '1',
label: '禁用'
}
],
columns: [
// {
// type: 'selection'
// },
{
title: '权限名称',
key: 'name',
width: '150',
sortable: true
},
// {
// title: '父权限',
// key: 'up_id'
// },
{
title: '系统',
key: 'system_name',
align:"left",
},
{
title: '地址',
key: 'url',
width: '200',
align:"left",
},
// {
// title: '密级',
// key: 'secret_class'
// },
{
title: '状态',
key: 'status_name',
render: (h, params) => {
return h(
'span',
{
on: {
click: () => {}
}
},
params.status == '0' ? '启用' : '禁用'
)
}
},
{
title: '类型',
key: 'type_name'
},
// {
// title: '打开方式',
// key: 'target'
// },
{
title: '排序',
key: 'priority'
},
{
title: '创建时间',
key: 'creationTime',
width: '150',
},
{
title: '修改时间',
key: 'lastModificationTime',
width: '150',
}
// {
// title: '操作',
// type: 'action',
// actions: [{
// type: 'primary',
// text: '编辑'
// }, {
// type: 'error',
// text: '删除'
// }],
// width: '150',
// }
],
data: [],
//父权限菜单树
seldata: [],
//父权限名
parent_name: ''
}
},
methods: {
loaddata: function() {
var url = `${systemUrl}/Privilege/getprivileges`
var that = this
service.get(`${url}`, { params: this.searchdata }).then((response) => {
// console.log(response)
that.data = response.data.result
})
},
lodataByid: function(data1) {
var url = `${systemUrl}/Privilege/GetById`
service
.get(`${url}`, { params: { id: this.clickindex } })
.then((response) => {
//console.log(response)
data1 = response.data.result
//console.log(data1)
this.gettree(data1.from_system, data1)
})
},
gettree(sid, data1) {
service
.get(`${systemUrl}/Privilege/getTree`, {
params: { from_system: sid,id:this.clickindex}
})
.then((response) => {
this.seldata = response.data.result
this.$refs.addpri.list = []
if (this.clickindex >= 0) {
if (data1) {
//下拉列表切换的时候
if (data1 == 'selectSys') {
//alert(1)
this.$refs.addpri.formValidate.up_id = 0
this.$refs.addpri.list.push({ label: '根节点', value: 0 })
this.setSelect(this.seldata, 0)
} else {
// alert(2)
console.log(data1)
if (this.isedit) {
// alert(12)
this.setSelect(this.seldata, data1.up_id)
this.$refs.addpri.list.push({
label: this.parent_name,
value: data1.up_id
})
this.$refs.addpri.formValidate = data1
this.$refs.addpri.formValidate.from_system=data1.from_system+''
this.$refs.addpri.formValidate.status = data1.status + ''
this.$refs.addpri.formValidate.type = data1.type + ''
} else {
// alert(13)
this.setSelect(this.seldata, data1.id)
this.$refs.addpri.formValidate={}
this.$refs.addpri.formValidate.up_id = data1.id
this.$refs.addpri.formValidate.from_system = data1.from_system+''
//this.$refs.addpri.formValidate.id=''
this.$refs.addpri.list.push({
label: this.parent_name,
value: data1.id
})
}
}
}
} else {
}
})
},
search: function() {
this.isedit = false
this.clickindex=-1
this.loaddata()
this.gettree(this.searchdata.from_system)
},
selectSys: function(val) {
this.gettree(val, 'selectSys')
},
setnoselect: function(data, val) {
data.forEach((item, index) => {
item.selected = false
if (item.children) {
this.setnoselect(item.children)
}
})
},
setSelect: function(data, val) {
//data=this.seldata;
this.setnoselect(data)
data.forEach((item, index) => {
item.selected = false
if (item.value == val) {
// alert(11)
item.selected = true
this.parent_name = item.title
} else {
if (item.children) {
this.setSelect(item.children, val)
}
}
})
//console.log(data)
},
add: function() {
// if(this.datacount>=1 && this.clickindex < 0){
// this.$Message.error("请选中一个根节点后再添加");
// return;
// }
this.isedit = false
this.setnoselect(this.seldata)
this.$refs.addpri.$refs['formValidate'].resetFields()
this.modal1 = true
this.$refs.addpri.list = []
if (this.clickindex < 0) {
this.$refs.addpri.formValidate.up_id = 0
this.$refs.addpri.list.push({ label: '根节点', value: 0 })
this.setSelect(this.seldata, 0)
console.log(this.searchdata.from_system)
this.$refs.addpri.formValidate.from_system = this.searchdata.from_system+''
}
//选中一行
else {
var data1 = {}
this.lodataByid(data1)
}
},
//新增,编辑保存
ok: function(name) {
var a = this.$refs.addpri
a.$refs[name].validate((valid) => {
if (valid) {
//this.$Message.success('Success!');
var url = `${systemUrl}/Privilege/CreateOrUpdate`
var that = this
if(!this.$refs.addpri.formValidate.status){
this.$refs.addpri.formValidate.status=0
}
if(!this.$refs.addpri.formValidate.priority){
this.$refs.addpri.formValidate.priority=0
}
if(this.$refs.addpri.formValidate.priority){
if(typeof(this.$refs.addpri.formValidate.priority) !='number'){
that.$Message.error('排序字段只能输入数字');
return;
}
}
this.formValidate1 = this.$refs.addpri.formValidate
//console.log(this.formValidate1)
service
.post(`${url}`, JSON.stringify({ Privilege: this.formValidate1 }))
.then((response) => {
if (response.data.success) {
that.$Message.success('保存成功')
that.loaddata()
// that.gettree();
this.modal1 = false
}
})
.catch((error) => {
that.$Message.error('保存失败')
})
//
} else {
setTimeout(() => {
this.myloading = false
this.$nextTick(() => {
this.myloading = true
})
}, 500)
this.$Message.error('请输入必填项')
}
})
},
edit: function() {
if (this.clickindex >= 0) {
this.modal1 = true
this.isedit = true
this.$refs.addpri.$refs['formValidate'].resetFields()
var data1 = {}
this.lodataByid(data1)
//编辑页面父权限下拉设置
// this.$refs.addpri.formValidate.up_id=data.up_id;
} else {
this.$Message.warning('请选中一行数据')
}
},
del: function() {
if (this.clickindex >= 0 || this.checkids.length > 0) {
var data = this.clickdata
this.keyid = data.id
this.$refs.mysel.confirmmodal = true
} else {
this.$Message.warning('请选中一行数据')
}
},
okmysel(bl) {
var url = `${systemUrl}/Privilege/Delete`
var that = this
service
.delete(`${url}?id=${this.keyid}`)
.then((response) => {
if (response.data.success) {
that.$Message.success('删除成功')
that.loaddata()
}
})
.catch((error) => {
that.$Message.error('删除失败')
})
that.$refs.mysel.confirmmodal = bl
},
cancelmysel(bl) {
this.$refs.mysel.confirmmodal = bl
},
cancel: function() {
this.isedit=false
this.modal1 = false
},
rowClick(data, event, index, txt) {
//console.log('当前行数据:' + data)
//console.log('点击行号:' + index)
//console.log('点击事件:' + event)
data = JSON.stringify(data)
data = JSON.parse(data)
this.clickindex = data.id
this.clickdata = data
},
selectionClick(arr) {
//console.log('选中数据id数组:' + arr)
this.checkids = arr
},
sortClick(key, type) {
//console.log('排序字段:' + key)
//console.log('排序规则:' + type)
},
model1Change: function(v) {
//console.log(v);
this.model1Name = v.label
}
},
created() {
this.model1 = this.sysdata[0].value
this.model1Name = this.sysdata[0].label
this.model2 = this.roleStatus[0].value
this.loaddata()
//this.gettree(this.model1)
this.divHeihgt= window.innerHeight - 100+"px";
},
mounted() {
// this.tbPro.height = window.innerHeight - this.$refs.table.$el.offsetTop - 70
window.onresize = () => {
return (() => {
this.divHeihgt = window.innerHeight - 100+"px";
})()
}
},
computed: {
searchdata: function() {
return {
from_system: this.model1,
status: this.model2,
system_name: this.model1Name
}
},
datacount:function(){
return this.data.length
}
}
}
</script>
<style scoped>
.margriht6 {
display: inline-block;
margin-right: 6px;
}
.marleft10 {
margin-left: 10px;
}
.marleft20 {
margin-left: 20px;
}
</style>
\ No newline at end of file
...@@ -537,7 +537,7 @@ export default { ...@@ -537,7 +537,7 @@ export default {
var url = `${systemUrl}/MyRole/GetRolesAsync`; var url = `${systemUrl}/MyRole/GetRolesAsync`;
var data = []; var data = [];
service.get(`${url}`, { params: { role_type: type } }).then(response => { service.get(`${url}`, { params: { role_type: type } }).then(response => {
data = response.data.result.items; data = response.result.items;
if (type == 1) { if (type == 1) {
this.authList = data; this.authList = data;
} }
...@@ -554,7 +554,7 @@ export default { ...@@ -554,7 +554,7 @@ export default {
this.show3 = true; this.show3 = true;
var url = `${systemUrl}/MyUserRole/GetPaged`; var url = `${systemUrl}/MyUserRole/GetPaged`;
service.get(`${url}`, { params: { userId: id } }).then(response => { service.get(`${url}`, { params: { userId: id } }).then(response => {
var data = response.data.result.items; var data = response.result.items;
var dt1 = data.filter(function(ite) { var dt1 = data.filter(function(ite) {
return ite.role_type == 0; return ite.role_type == 0;
}); });
...@@ -582,7 +582,7 @@ export default { ...@@ -582,7 +582,7 @@ export default {
}) })
) )
.then(response => { .then(response => {
if (response.data.success) { if (response.success) {
this.$Message.success("保存成功"); this.$Message.success("保存成功");
this.authModel.extra = []; this.authModel.extra = [];
this.authModel.default = []; this.authModel.default = [];
......
...@@ -189,9 +189,9 @@ export default { ...@@ -189,9 +189,9 @@ export default {
let urlget = `${PlanUrl}/dispatch/getschemes?RoutingId=` + usId + let urlget = `${PlanUrl}/dispatch/getschemes?RoutingId=` + usId +
'&IsMain=0' + order_ids '&IsMain=0' + order_ids
service.get(`${urlget}`).then((res) => { service.get(`${urlget}`).then((res) => {
if (res.data.result) { if (res.result) {
var savedUl = [] var savedUl = []
res.data.result.map((u) => { res.result.map((u) => {
let detailnew = { let detailnew = {
detailId: u.routingDetailId, //工序id--后端接收 detailId: u.routingDetailId, //工序id--后端接收
detailNumber: u.routingDetailNumber, //工序序号 detailNumber: u.routingDetailNumber, //工序序号
...@@ -223,7 +223,7 @@ export default { ...@@ -223,7 +223,7 @@ export default {
let urlList = `${designUrl}/routingdetail/getlistbyheaderid?headerID=` + usId let urlList = `${designUrl}/routingdetail/getlistbyheaderid?headerID=` + usId
service.get(`${urlList}`).then((res) => { service.get(`${urlList}`).then((res) => {
var ul = [] var ul = []
res.data.result.map((u) => { res.result.map((u) => {
let detail = { let detail = {
detailId: u.id, //工序id--后端接收 detailId: u.id, //工序id--后端接收
detailNumber: u.task_seq,//工序序号 detailNumber: u.task_seq,//工序序号
......
...@@ -188,8 +188,8 @@ export default { ...@@ -188,8 +188,8 @@ export default {
var url = var url =
`${PlanUrl}/orderexecutemovie/getpaged?` + QS.stringify(this.datasearch) `${PlanUrl}/orderexecutemovie/getpaged?` + QS.stringify(this.datasearch)
service.get(`${url}`).then((response) => { service.get(`${url}`).then((response) => {
this.moviedata = response.data.result.items this.moviedata = response.result.items
this.datatotal = response.data.result.totalCount this.datatotal = response.result.totalCount
}) })
}, },
onPageChanged(page_index) { onPageChanged(page_index) {
...@@ -217,7 +217,7 @@ export default { ...@@ -217,7 +217,7 @@ export default {
}) })
) )
.then((response) => { .then((response) => {
if (response.data.success) { if (response.success) {
this.$Message.success('保存成功') this.$Message.success('保存成功')
this.procedure = false this.procedure = false
this.cleardata() this.cleardata()
...@@ -252,7 +252,7 @@ export default { ...@@ -252,7 +252,7 @@ export default {
service service
.delete(`${url}`) .delete(`${url}`)
.then((response) => { .then((response) => {
if (response.data.success) { if (response.success) {
this.$Message.success('删除成功') this.$Message.success('删除成功')
this.loaddata() this.loaddata()
} else { } else {
......
...@@ -171,8 +171,8 @@ export default { ...@@ -171,8 +171,8 @@ export default {
QS.stringify(this.datasearch) QS.stringify(this.datasearch)
service.get(`${url}`).then((response) => { service.get(`${url}`).then((response) => {
this.data1 = response.data.result.items this.data1 = response.result.items
this.datatotal = response.data.result.totalCount this.datatotal = response.result.totalCount
}) })
}, },
onPageChanged(page_index) { onPageChanged(page_index) {
...@@ -198,7 +198,7 @@ export default { ...@@ -198,7 +198,7 @@ export default {
}) })
) )
.then((response) => { .then((response) => {
if (response.data.success) { if (response.success) {
this.$Message.success('保存成功') this.$Message.success('保存成功')
this.loaddata() this.loaddata()
this.cleardata() this.cleardata()
......
...@@ -369,11 +369,11 @@ export default { ...@@ -369,11 +369,11 @@ export default {
this.currententry = null this.currententry = null
var url = `${PlanUrl}/orderexecute/getentrylist?ExecuteId=` + ExecuteId var url = `${PlanUrl}/orderexecute/getentrylist?ExecuteId=` + ExecuteId
service.get(`${url}`).then((response) => { service.get(`${url}`).then((response) => {
this.entryData = response.data.result.entryList this.entryData = response.result.entryList
this.entryHistoryData = this.entryData this.entryHistoryData = this.entryData
let data = [] let data = []
for (var i = 0; i < this.entryData.length; i++) { for (var i = 0; i < this.entryData.length; i++) {
if (this.entryData[i].id == response.data.result.currentID) { if (this.entryData[i].id == response.result.currentID) {
data = this.entryData[i] data = this.entryData[i]
this.currententry = data this.currententry = data
this.currentID = this.entryData[i].id this.currentID = this.entryData[i].id
...@@ -431,8 +431,8 @@ export default { ...@@ -431,8 +431,8 @@ export default {
'&headerID=' + '&headerID=' +
this.data.routing_header_id this.data.routing_header_id
service.get(`${url}`).then((response) => { service.get(`${url}`).then((response) => {
if (response.data.result != null) { if (response.result != null) {
let ordata = response.data.result let ordata = response.result
for (let j = 0; j < this.data.row.length; j++) { for (let j = 0; j < this.data.row.length; j++) {
let obj = this.data.row[j] let obj = this.data.row[j]
var gh = ordata.filter(function(number) { var gh = ordata.filter(function(number) {
...@@ -456,9 +456,9 @@ export default { ...@@ -456,9 +456,9 @@ export default {
`${designUrl}/orderbillrel/getorderbilllistbyorders?orderids=` + `${designUrl}/orderbillrel/getorderbilllistbyorders?orderids=` +
this.data.orderIDs this.data.orderIDs
service.get(`${url}`).then((response) => { service.get(`${url}`).then((response) => {
if (response.data.result != null) { if (response.result != null) {
if (response.data.result.length > 0) { if (response.result.length > 0) {
this.loadMaterial(response.data.result) this.loadMaterial(response.result)
} }
} }
}) })
...@@ -468,9 +468,9 @@ export default { ...@@ -468,9 +468,9 @@ export default {
var url = var url =
`${designUrl}/ordermaterial/getbyid?Id=` + Bill[0].material_bill_id `${designUrl}/ordermaterial/getbyid?Id=` + Bill[0].material_bill_id
service.get(`${url}`).then((response) => { service.get(`${url}`).then((response) => {
if (response.data.result != null) { if (response.result != null) {
this.material_bill_id = Bill[0].material_bill_id this.material_bill_id = Bill[0].material_bill_id
this.material_bill = response.data.result.orderMaterial this.material_bill = response.result.orderMaterial
} }
}) })
}, },
...@@ -541,7 +541,7 @@ export default { ...@@ -541,7 +541,7 @@ export default {
}) })
) )
.then((response) => { .then((response) => {
if (response.data.success) { if (response.success) {
this.updateentrystatus(row.id, 14) this.updateentrystatus(row.id, 14)
} }
}) })
...@@ -566,7 +566,7 @@ export default { ...@@ -566,7 +566,7 @@ export default {
}) })
) )
.then((response) => { .then((response) => {
if (response.data.success) { if (response.success) {
this.updateentrystatus(row.id, 14) this.updateentrystatus(row.id, 14)
} }
}) })
......
...@@ -268,13 +268,12 @@ export default { ...@@ -268,13 +268,12 @@ export default {
content="开工" content="开工"
}else if(params.row.status==13||params.row.status==14) }else if(params.row.status==13||params.row.status==14)
{ {
content="查看" content="查看"
}else if(params.row.status==6) }else if(params.row.status==6)
{ {
content="继续" content="继续"
}else{ }else{
content="查看";
content="查看";
} }
return h('div', { class: 'action' },[ return h('div', { class: 'action' },[
...@@ -310,8 +309,8 @@ content="查看"; ...@@ -310,8 +309,8 @@ content="查看";
"skipCount":0, "skipCount":0,
"maxResultCount": 10 "maxResultCount": 10
}).then(res => { }).then(res => {
this.mDatas = res.data.result.items this.mDatas = res.result.items
this.search.total = res.data.result.totalCount this.search.total = res.result.totalCount
}); });
}, },
// 分页 // 分页
......
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