yemianqunaxiananniutinajia

This commit is contained in:
shijing 2022-03-02 14:40:42 +08:00
parent 544478dc0b
commit 750e751513
7 changed files with 1695 additions and 1656 deletions

View File

@ -2,12 +2,22 @@
<div class="app-container">
<el-card>
<div>
<el-button type="primary" icon="el-icon-plus" @click="handlecgCreate"
>新增采购入库</el-button
<el-button
v-if="checkPermission(['fifo_in_pur'])"
type="primary"
icon="el-icon-plus"
@click="handlecgCreate"
>
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增其他入库</el-button
新增采购入库
</el-button>
<el-button
v-if="checkPermission(['fifo_in_other'])"
type="primary"
icon="el-icon-plus"
@click="handleCreate"
>
新增其他入库
</el-button>
<el-input
v-model="listQuery.search"
placeholder="仓库名称/仓库编号"
@ -20,15 +30,17 @@
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button
>
搜索
</el-button>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>重置</el-button
>
重置
</el-button>
</div>
</el-card>
<el-card>
@ -42,18 +54,15 @@
height="100"
v-el-height-adaptive-table="{ bottomOffset: 42 }"
>
<el-table-column type="index" width="50" />
<el-table-column label="记录编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
<el-table-column type="index" width="50"/>
<el-table-column label="记录编号" prop="number">
</el-table-column>
<el-table-column label="操作人员">
<template slot-scope="scope" v-if="scope.row.create_by">{{
scope.row.create_by_.name
}}</template>
<template slot-scope="scope" v-if="scope.row.create_by">
{{scope.row.create_by_.name}}
</template>
</el-table-column>
<el-table-column label="出/入库时间">
<template slot-scope="scope">{{ scope.row.inout_date }}</template>
<el-table-column label="出/入库时间" prop="inout_date">
</el-table-column>
<el-table-column label="出/入库类型">
<template slot-scope="scope">{{ types_[scope.row.type] }}</template>
@ -64,35 +73,38 @@
<el-tag v-else>已审核</el-tag>
</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
<el-table-column label="创建时间" prop="create_time">
</el-table-column>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="scope.row.type==2"
v-if="checkPermission(['fifo_pack'])&&scope.row.type==2"
type="primary"
@click="handlePack(scope)"
>装箱</el-link
>
<el-link
v-if="checkPermission(['warehouse_update'])"
装箱
</el-link>
<el-link
v-if="checkPermission(['fifo_pack'])"
type="primary"
@click="handleDetail(scope)"
>查看</el-link
>
查看
</el-link>
<el-link
v-if="scope.row.is_audited == false"
v-if="checkPermission(['fifo_hear'])&&scope.row.is_audited == false"
type="primary"
@click="handleAudit(scope)"
>审核</el-link
>
审核
</el-link>
<el-link
v-if="checkPermission(['warehouse_delete'])"
v-if="checkPermission(['fifo_delete'])"
type="danger"
@click="handleDelete(scope)"
>删除</el-link
>
删除
</el-link>
</template>
</el-table-column>
</el-table>
@ -116,7 +128,7 @@
label-position="right"
:rules="rule1"
>
<el-form-item label="采购订单" >
<el-form-item label="采购订单">
<el-select v-model="inpur.pu_order">
<el-option
v-for="item in puorderoptions"
@ -129,12 +141,18 @@
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisibles = false"
>取消</el-button
<el-button
type="danger"
@click="dialogVisibles = false"
>
<el-button type="primary" @click="confirminpur('Form1')"
>确认</el-button
取消
</el-button>
<el-button
type="primary"
@click="confirminpur('Form1')"
>
确认
</el-button>
</div>
</el-dialog>
<el-dialog
@ -150,7 +168,7 @@
label-position="right"
:rules="rule1"
>
<el-form-item class="warehouse" label="供应商" >
<el-form-item class="warehouse" label="供应商">
<el-select v-model="inventory.vendor" size="small">
<el-option
v-for="item in vendoroptions"
@ -180,7 +198,6 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="5" style="margin-right: 10px">
<el-form-item
class="material"
@ -198,7 +215,6 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="5" style="margin-right: 10px">
<el-form-item
class="count"
@ -220,24 +236,22 @@
<el-input v-model="item.batch" placeholder="批次号"></el-input>
</el-form-item>
</el-col>
<el-col :span="5" style="margin-right: 10px">
<el-col :span="5" style="margin-right: 10px">
<el-form-item
class="expiration_date"
label="有效期"
:prop="'details.' + index + '.expiration_date'"
>
<el-date-picker
v-model="item.expiration_date"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
style="width:100%"
>
</el-date-picker>
<el-date-picker
v-model="item.expiration_date"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
style="width:100%"
>
</el-date-picker>
</el-form-item>
</el-col>
<!-- 删除按钮 -->
<el-col :span="1">
<el-tooltip
@ -295,234 +309,233 @@
</div>
</template>
<script>
import {
getfifoList,
createInventory,
createInother,
getWarehouseList,
deleteFifoitem,
deleteFifo,
audit,
} from "@/api/inm";
import { getPuorderList } from "@/api/pum";
import checkPermission from "@/utils/permission";
import { getpVendorList } from "@/api/vendor";
import { getMaterialList } from "@/api/mtm";
import { getUserList } from "@/api/user";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaulteinventory = {
vendor: null,
details: [
{
warehouse: "", //仓库
material: "", // 物料
count: "", //数量
batch: "", //批次
import {
getfifoList,
createInventory,
createInother,
getWarehouseList,
deleteFifoitem,
deleteFifo,
audit,
} from "@/api/inm";
import {getPuorderList} from "@/api/pum";
import checkPermission from "@/utils/permission";
import {getpVendorList} from "@/api/vendor";
import {getMaterialList} from "@/api/mtm";
import {getUserList} from "@/api/user";
import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaulteinventory = {
vendor: null,
details: [
{
warehouse: "", //仓库
material: "", // 物料
count: "", //数量
batch: "", //批次
},
],
};
export default {
components: {Pagination},
data() {
return {
inventory: defaulteinventory,
fifoList: {
count: 0,
},
types_: {
1: "生产领料",
2: "销售提货",
3: "采购入库",
4: "生产入库",
5: "其他入库",
},
inpur: {},
listQuery: {
page: 1,
page_size: 20,
},
puorderoptions: [],
warehouseData: [],
materialoptions: [],
vendoroptions: [],
listLoading: true,
dialogVisible: false,
dialogType: "new",
dialogVisibles: false,
rule1: {
name: [{required: true, message: "请输入", trigger: "blur"}],
},
};
},
],
};
export default {
components: { Pagination },
data() {
return {
inventory: defaulteinventory,
fifoList: {
count: 0,
},
types_: {
1: "生产领料",
2: "销售提货",
3: "采购入库",
4: "生产入库",
5: "其他入库",
},
inpur: {},
listQuery: {
page: 1,
page_size: 20,
},
puorderoptions: [],
warehouseData: [],
materialoptions: [],
vendoroptions: [],
listLoading: true,
dialogVisible: false,
dialogType: "new",
dialogVisibles: false,
rule1: {
name: [{ required: true, message: "请输入", trigger: "blur" }],
},
};
},
computed: {},
watch: {},
created() {
this.getlists();
this.getList();
this.getListgys();
this.getmaterialList();
this.getpuorderList();
},
methods: {
checkPermission,
computed: {},
watch: {},
created() {
this.getlists();
this.getList();
this.getListgys();
this.getmaterialList();
this.getpuorderList();
},
methods: {
checkPermission,
getList() {
this.listLoading = true;
getList() {
this.listLoading = true;
getfifoList(this.listQuery).then((response) => {
if (response.data) {
this.fifoList = response.data;
}
this.listLoading = false;
});
},
//出入库详情
handleDetail(scope) {
this.$router.push({
name: "fifodetail",
params: { id: scope.row.id, pu_order: scope.row.pu_order},
});
},
//供应商列表
getListgys() {
getpVendorList({ page: 0 }).then((response) => {
if (response.data) {
this.vendoroptions = response.data;
}
});
},
//采购订单
getpuorderList() {
getPuorderList({ page: 0 }).then((response) => {
if (response.data) {
this.puorderoptions = response.data;
}
});
},
//采购入库提交
confirminpur() {
createInventory(this.inpur).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisibles = false;
this.$message.success("成功");
}
});
},
//仓库
getlists() {
getWarehouseList({ page: 0 }).then((response) => {
if (response.data) {
this.warehouseData = genTree(response.data);
}
this.listLoading = false;
});
},
handlecgCreate() {
this.dialogVisibles = true;
},
addConditions() {
if (this.inventory.details.length <= 10) {
this.inventory.details.push({
warehouse: "", //仓库
material: "", // 物料
count: "", //数量
batch: "", // 批次
getfifoList(this.listQuery).then((response) => {
if (response.data) {
this.fifoList = response.data;
}
this.listLoading = false;
});
} else {
this.$message("最多可添加十项条件");
},
//出入库详情
handleDetail(scope) {
this.$router.push({
name: "fifodetail",
params: {id: scope.row.id, pu_order: scope.row.pu_order},
});
},
//供应商列表
getListgys() {
getpVendorList({page: 0}).then((response) => {
if (response.data) {
this.vendoroptions = response.data;
}
});
},
//采购订单
getpuorderList() {
getPuorderList({page: 0}).then((response) => {
if (response.data) {
this.puorderoptions = response.data;
}
});
},
//采购入库提交
confirminpur() {
createInventory(this.inpur).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisibles = false;
this.$message.success("成功");
}
});
},
//仓库
getlists() {
getWarehouseList({page: 0}).then((response) => {
if (response.data) {
this.warehouseData = genTree(response.data);
}
this.listLoading = false;
});
},
handlecgCreate() {
this.dialogVisibles = true;
},
addConditions() {
if (this.inventory.details.length <= 10) {
this.inventory.details.push({
warehouse: "", //仓库
material: "", // 物料
count: "", //数量
batch: "", // 批次
});
} else {
this.$message("最多可添加十项条件");
}
},
deleteItem(index) {
this.inventory.details.splice(index, 1);
},
//物料
getmaterialList() {
this.listLoading = true;
getMaterialList({pageoff: true}).then((response) => {
if (response.data) {
this.materialoptions = genTree(response.data);
}
this.listLoading = false;
});
},
handleCreate() {
this.inventory.details = [
{
warehouse: "", // 仓库
material: "", // 物料
count: "", //数量
batch: "", //批次
},
];
this.inventory = Object.assign({}, defaulteinventory);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
//审核
handleAudit(scope) {
this.$confirm("是否通过?", "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "success",
})
.then(async () => {
await audit(scope.row.id);
this.getList();
this.$message.success("已审核");
})
.catch((err) => {
console.error(err);
});
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
};
this.getList();
},
async confirm(form) {
console.log(this.inventory);
createInother(this.inventory).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteFifo(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
//装箱
handlePack(scope) {
this.$router.push({name: "salesdetail", params: {id: scope.row.sale},})
}
},
deleteItem(index) {
this.inventory.details.splice(index, 1);
},
//物料
getmaterialList() {
this.listLoading = true;
getMaterialList({ pageoff: true }).then((response) => {
if (response.data) {
this.materialoptions = genTree(response.data);
}
this.listLoading = false;
});
},
handleCreate() {
this.inventory.details = [
{
warehouse: "", // 仓库
material: "", // 物料
count: "", //数量
batch: "", //批次
},
];
this.inventory = Object.assign({}, defaulteinventory);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
//审核
handleAudit(scope) {
this.$confirm("是否通过?", "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "success",
})
.then(async () => {
await audit(scope.row.id);
this.getList();
this.$message.success("已审核");
})
.catch((err) => {
console.error(err);
});
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
};
this.getList();
},
async confirm(form) {
console.log(this.inventory);
createInother(this.inventory).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteFifo(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
//装箱
handlePack(scope)
{
this.$router.push({name: "salesdetail", params: { id: scope.row.sale }, })
}
},
};
};
</script>

View File

@ -1,13 +1,18 @@
<template>
<div class="app-container">
<el-card>
<el-button type="primary" icon="el-icon-plus" @click="handleorder"
>选择订单
<el-button
v-if="checkPermission(['wp_to_order'])"
type="primary"
icon="el-icon-plus"
@click="handleorder"
>
选择订单
</el-button>
<el-table
ref="multipleTable"
v-loading="listLoading"
:data="iproductData.results"
ref="multipleTable"
border
fit
stripe
@ -17,12 +22,9 @@
>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column type="index" width="50"/>
<el-table-column label="成品编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
<el-table-column label="成品编号" prop="number">
</el-table-column>
<el-table-column label="成品批次">
<template slot-scope="scope">{{ scope.row.batch }}</template>
<el-table-column label="成品批次" prop="batch">
</el-table-column>
<el-table-column label="成品名称" min-width="100" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
@ -30,13 +32,10 @@
<el-table-column label="所在仓库">
<template slot-scope="scope">{{scope.row.warehouse_.name}}</template>
</el-table-column>
<el-table-column label="订单">
<template slot-scope="scope">
<span v-if="scope.row.to_order_">{{scope.row.to_order_.number}}</span>
<el-tag
v-else-if="scope.row.to_order_ == null && scope.row.need_to_order == true"
>
<el-tag v-else-if="scope.row.to_order_ == null && scope.row.need_to_order == true">
需要确定订单
</el-tag>
<span v-else></span>
@ -45,9 +44,7 @@
<el-table-column label="合同">
<template slot-scope="scope">
<span v-if="scope.row.to_order_">{{scope.row.to_order_.contract_.name}}</span>
<span
v-else-if="scope.row.to_order_ == null && scope.row.need_to_order == true"
>
<span v-else-if="scope.row.to_order_ == null && scope.row.need_to_order == true">
</span>
<span v-else></span>
</template>
@ -55,9 +52,7 @@
<el-table-column label="客户">
<template slot-scope="scope">
<span v-if="scope.row.to_order_">{{scope.row.to_order_.customer_.name}}</span>
<span
v-else-if="scope.row.to_order_ == null && scope.row.need_to_order == true"
>
<span v-else-if="scope.row.to_order_ == null && scope.row.need_to_order == true">
</span>
<span v-else></span>
</template>
@ -69,13 +64,9 @@
<span v-else></span>
</template>
</el-table-column>
<el-table-column label="销售状态">
<el-table-column label="销售状态">
<template slot-scope="scope">{{state_[scope.row.state]}}</template>
</el-table-column>
<!-- <el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
@ -150,7 +141,8 @@
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="toorders(scope)"
>确认
>
确认
</el-link>
</template>
</el-table-column>
@ -167,7 +159,7 @@
import checkPermission from "@/utils/permission";
import {getOrderList} from "@/api/sam";
import {mtest, toorder} from "@/api/wpm";
import {genTree} from "@/utils";
// import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
export default {
@ -188,12 +180,12 @@
mtestform: {
is_mtestok: false,
},
state_: {
10: "可出售",
20: "销售锁定",
30: "已售出",
},
state_: {
10: "可出售",
20: "销售锁定",
30: "已售出",
},
form1: {},
dialogFormVisibleorder: false,
orderList: [],
@ -225,10 +217,12 @@
this.listLoading = false;
});
},
handleMtest(scope) {
this.saleproduct = scope.row.id;
this.dialogVisible = true;
},
submtest() {
mtest(this.saleproduct, this.mtestform).then((res) => {
if (res.code >= 200) {
@ -237,6 +231,7 @@
}
});
},
//批量选择成品发给谋订单
handleorder() {
this.dialogFormVisibleorder = true;
@ -261,6 +256,7 @@
}
);
},
//提交批量产品选择的订单
toorders(scope) {
toorder({

View File

@ -2,9 +2,14 @@
<div class="app-container">
<el-card>
<div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增仓库</el-button
<el-button
v-if="checkPermission(['warehouse_create'])"
type="primary"
icon="el-icon-plus"
@click="handleCreate"
>
新增仓库
</el-button>
<el-input
v-model="listQuery.search"
placeholder="仓库名称/仓库编号"
@ -17,19 +22,20 @@
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button
>
搜索
</el-button>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>重置</el-button
>
重置
</el-button>
</div>
</el-card>
<el-card >
<el-card>
<el-table
v-loading="listLoading"
:data="warehouseList.results"
@ -37,45 +43,41 @@
fit
stripe
highlight-current-row
height="100"
height="100"
v-el-height-adaptive-table="{bottomOffset: 42}"
>
<el-table-column type="index" width="50" />
<el-table-column label="仓库名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
<el-table-column type="index" width="50"/>
<el-table-column label="仓库名称" prop="name">
</el-table-column>
<el-table-column label="仓库编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
<el-table-column label="仓库编号" prop="number">
</el-table-column>
<el-table-column label="具体地点">
<template slot-scope="scope">{{ scope.row.place }}</template>
<el-table-column label="具体地点" prop="place">
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
<el-table-column label="创建时间" prop="create_time">
</el-table-column>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
type="primary"
type="primary"
@click="handleMaterial(scope)"
>查看物料</el-link
>
查看物料
</el-link>
<el-link
v-if="checkPermission(['warehouse_update'])"
type="primary"
type="primary"
@click="handleEdit(scope)"
>编辑</el-link
>
编辑
</el-link>
<el-link
v-if="checkPermission(['warehouse_delete'])"
type="danger"
@click="handleDelete(scope)"
>删除</el-link
>
删除
</el-link>
</template>
</el-table-column>
</el-table>
@ -100,13 +102,13 @@
:rules="rule1"
>
<el-form-item label="仓库名称" prop="name">
<el-input v-model="warehouse.name" placeholder="仓库名称" />
<el-input v-model="warehouse.name" placeholder="仓库名称"/>
</el-form-item>
<el-form-item label="仓库编号" prop="number">
<el-input v-model="warehouse.number" placeholder="仓库编号" />
<el-input v-model="warehouse.number" placeholder="仓库编号"/>
</el-form-item>
<el-form-item label="具体地点" prop="place">
<el-input v-model="warehouse.place" placeholder="具体地点" />
<el-input v-model="warehouse.place" placeholder="具体地点"/>
</el-form-item>
</el-form>
<div style="text-align: right">
@ -117,146 +119,151 @@
</div>
</template>
<script>
import {
getWarehouseList,
createWarehouse,
updateWarehouse,
deleteWarehouse,
} from "@/api/inm";
import checkPermission from "@/utils/permission";
import {
getWarehouseList,
createWarehouse,
updateWarehouse,
deleteWarehouse,
} from "@/api/inm";
import checkPermission from "@/utils/permission";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultewarehouse = {};
export default {
components: { Pagination },
data() {
return {
warehouse: defaultewarehouse,
warehouseList: {
count: 0,
},
options: [
{
value: 0,
label: "运转正常",
// import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultewarehouse = {};
export default {
components: {Pagination},
data() {
return {
warehouse: defaultewarehouse,
warehouseList: {
count: 0,
},
{
value: 1,
label: "停用",
options: [
{
value: 0,
label: "运转正常",
},
{
value: 1,
label: "停用",
},
{
value: 2,
label: "报废",
},
],
listQuery: {
page: 1,
page_size: 20,
},
{
value: 2,
label: "报废",
keeperOptions: [],
depOptions: [],
listLoading: true,
dialogVisible: false,
dialogType: "new",
rule1: {
name: [{required: true, message: "请输入", trigger: "blur"}],
number: [{required: true, message: "请输入", trigger: "blur"}],
place: [{required: true, message: "请输入", trigger: "blur"}],
},
],
listQuery: {
page: 1,
page_size: 20,
},
keeperOptions: [],
depOptions: [],
listLoading: true,
dialogVisible: false,
dialogType: "new",
rule1: {
name: [{ required: true, message: "请输入", trigger: "blur" }],
number: [{ required: true, message: "请输入", trigger: "blur" }],
place: [{ required: true, message: "请输入", trigger: "blur" }],
},
};
},
computed: {},
watch: {},
created() {
this.getList();
},
methods: {
checkPermission,
//设备列表
getList() {
this.listLoading = true;
getWarehouseList(this.listQuery).then((response) => {
if (response.data) {
this.warehouseList = response.data;
}
this.listLoading = false;
});
},
//跳转到该仓库的物料表
handleMaterial(scope) {
this.$router.push({ name: "inventory", params: { id: scope.row.id } });
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
};
},
computed: {},
watch: {},
created() {
this.getList();
},
handleCreate() {
this.warehouse = Object.assign({}, defaultewarehouse);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleEdit(scope) {
this.warehouse = Object.assign({}, scope.row); // copy obj
this.dialogType = "edit";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteWarehouse(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
async confirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
updateWarehouse(this.warehouse.id, this.warehouse).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
createWarehouse(this.warehouse).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
methods: {
checkPermission,
//设备列表
getList() {
this.listLoading = true;
getWarehouseList(this.listQuery).then((response) => {
if (response.data) {
this.warehouseList = response.data;
}
} else {
return false;
}
});
this.listLoading = false;
});
},
//跳转到该仓库的物料表
handleMaterial(scope) {
this.$router.push({name: "inventory", params: {id: scope.row.id}});
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
};
this.getList();
},
handleCreate() {
this.warehouse = Object.assign({}, defaultewarehouse);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleEdit(scope) {
this.warehouse = Object.assign({}, scope.row); // copy obj
this.dialogType = "edit";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteWarehouse(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
this.$message.error(err);
});
},
async confirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
updateWarehouse(this.warehouse.id, this.warehouse).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
createWarehouse(this.warehouse).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
},
},
};
};
</script>

View File

@ -2,10 +2,14 @@
<div class="app-container">
<el-card>
<div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增采购订单</el-button
<el-button
v-if="checkPermission(['puorder_create'])"
type="primary"
icon="el-icon-plus"
@click="handleCreate"
>
新增采购订单
</el-button>
<el-input
v-model="listQuery.search"
placeholder="采购订单编号、供应商名称"
@ -18,15 +22,17 @@
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button
>
搜索
</el-button>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>重置</el-button
>
重置
</el-button>
</div>
</el-card>
<el-card style="margin-top: 2px">
@ -41,14 +47,13 @@
height="100"
v-el-height-adaptive-table="{ bottomOffset: 43 }"
>
<el-table-column type="index" width="50" />
<el-table-column label="采购订单编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
<el-table-column type="index" width="50"/>
<el-table-column label="采购订单编号" prop="number">
</el-table-column>
<el-table-column label="供应商">
<template slot-scope="scope" v-if="scope.row.vendor_">{{
scope.row.vendor_.name
}}</template>
<template slot-scope="scope" v-if="scope.row.vendor_">
{{scope.row.vendor_.name}}
</template>
</el-table-column>
<el-table-column label="审核情况" width="150">
<template slot-scope="scope">
@ -56,38 +61,38 @@
<el-tag v-else-if="scope.row.is_audited == true">已审核</el-tag>
</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
<el-table-column label="创建时间" prop="create_time">
</el-table-column>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['vendor_update'])"
type="primary"
v-if="checkPermission(['puorder_update'])"
type="primary"
@click="handlePuOrderItem(scope)"
>订单项</el-link
>
订单项
</el-link>
<el-link
v-if="
checkPermission(['vendor_update']) &&
scope.row.is_audited == false
"
type="primary"
v-if="checkPermission(['puorder_hear']) &&scope.row.is_audited == false"
type="primary"
@click="handleAudit(scope)"
>审核</el-link
>
审核
</el-link>
<el-link
v-if="checkPermission(['vendor_update'])"
type="primary"
v-if="checkPermission(['puorder_update'])"
type="primary"
@click="handleEdit(scope)"
>编辑</el-link
>
编辑
</el-link>
<el-link
v-if="checkPermission(['vendor_delete'])"
v-if="checkPermission(['puorder_delete'])"
type="danger"
@click="handleDelete(scope)"
>删除</el-link
>
删除
</el-link>
</template>
</el-table-column>
</el-table>
@ -111,13 +116,13 @@
:rules="rule1"
>
<el-form-item label="订单编号" prop="number">
<el-input v-model="puorder.number" placeholder="订单编号" />
<el-input v-model="puorder.number" placeholder="订单编号"/>
</el-form-item>
<el-form-item label="供应商" prop="vendor">
<el-select
style="width: 100%"
v-model="puorder.vendor"
style="width: 100%"
placeholder="请选择"
>
<el-option
@ -138,157 +143,157 @@
</div>
</template>
<script>
import { getpVendorList } from "@/api/vendor";
import { getUserList } from "@/api/user";
import {
getPuorderList,
createPuorder,
updatePuorder,
deletePuorder,
createPuorderAudit,
createPuorderItem,
deletePuorderItem,
} from "@/api/pum";
import checkPermission from "@/utils/permission";
import {getpVendorList} from "@/api/vendor";
import {getUserList} from "@/api/user";
import {
getPuorderList,
createPuorder,
updatePuorder,
deletePuorder,
createPuorderAudit,
createPuorderItem,
deletePuorderItem,
} from "@/api/pum";
import checkPermission from "@/utils/permission";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultpuorder = {
number: "",
};
export default {
components: { Pagination },
data() {
return {
puorder: defaultpuorder,
puorderList: {
count: 0,
},
import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultpuorder = {
number: "",
};
export default {
components: {Pagination},
data() {
return {
puorder: defaultpuorder,
puorderList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
vendorList: [],
dialogVisible: false,
dialogType: "new",
rule1: {
number: [{ required: true, message: "请输入", trigger: "blur" }],
vendor: [
{ required: true, message: "请选择供应商", trigger: "change" },
],
},
};
},
computed: {},
watch: {},
created() {
this.getList();
this.getVendorList();
},
methods: {
checkPermission,
//采购订单
getList() {
this.listLoading = true;
getPuorderList(this.listQuery).then((response) => {
if (response.data) {
this.puorderList = response.data;
}
this.listLoading = false;
});
},
//供应商列表
getVendorList() {
getpVendorList({ page: 0 }).then((response) => {
if (response.data) {
this.vendorList = response.data;
}
});
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
listQuery: {
page: 1,
page_size: 20,
},
vendorList: [],
dialogVisible: false,
dialogType: "new",
rule1: {
number: [{required: true, message: "请输入", trigger: "blur"}],
vendor: [
{required: true, message: "请选择供应商", trigger: "change"},
],
},
};
},
computed: {},
watch: {},
created() {
this.getList();
this.getVendorList();
},
handleCreate() {
this.puorder = Object.assign({}, defaultpuorder);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleEdit(scope) {
this.puorder = Object.assign({}, scope.row); // copy obj
this.dialogType = "edit";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deletePuorder(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
async confirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
updatePuorder(this.puorder.id, this.puorder).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
createPuorder(this.puorder).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
methods: {
checkPermission,
//采购订单
getList() {
this.listLoading = true;
getPuorderList(this.listQuery).then((response) => {
if (response.data) {
this.puorderList = response.data;
}
} else {
return false;
}
});
},
handlePuOrderItem(scope) {
this.$router.push({ name: "puorderitem", params: { id: scope.row.id } });
},
handleAudit(scope) {
this.listLoading = false;
});
},
//供应商列表
getVendorList() {
getpVendorList({page: 0}).then((response) => {
if (response.data) {
this.vendorList = response.data;
}
});
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
};
this.getList();
},
handleCreate() {
this.puorder = Object.assign({}, defaultpuorder);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
createPuorderAudit(scope.row.id).then((res) => {
if (res.code >= 200) {
this.getList();
this.$message.success("审核成功!");
}
});
handleEdit(scope) {
this.puorder = Object.assign({}, scope.row); // copy obj
this.dialogType = "edit";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deletePuorder(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
async confirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
updatePuorder(this.puorder.id, this.puorder).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
createPuorder(this.puorder).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
handlePuOrderItem(scope) {
this.$router.push({name: "puorderitem", params: {id: scope.row.id}});
},
handleAudit(scope) {
createPuorderAudit(scope.row.id).then((res) => {
if (res.code >= 200) {
this.getList();
this.$message.success("审核成功!");
}
});
},
},
},
};
};
</script>

View File

@ -2,7 +2,12 @@
<div class="app-container">
<el-card>
<div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreate">
<el-button
v-if="checkPermission(['vendor_create'])"
type="primary"
icon="el-icon-plus"
@click="handleCreate"
>
新增供应商
</el-button>
<el-input
@ -43,27 +48,19 @@
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50"/>
<el-table-column label="供应商名">
<template slot-scope="scope">{{ scope.row.name }}</template>
<el-table-column label="供应商名" prop="name">
</el-table-column>
<el-table-column label="联系人">
<template slot-scope="scope">{{ scope.row.contact }}</template>
<el-table-column label="联系人" prop="contact">
</el-table-column>
<el-table-column label="联系电话">
<template slot-scope="scope">{{ scope.row.contact_phone }}</template>
<el-table-column label="联系电话" prop="contact_phone">
</el-table-column>
<el-table-column label="地址" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.address }}</template>
<el-table-column label="地址" prop="address" min-width="120" show-overflow-tooltip>
</el-table-column>
<el-table-column label="供应物料">
<template slot-scope="scope">{{ scope.row.material }}</template>
<el-table-column label="供应物料" prop="material">
</el-table-column>
<el-table-column label="备注">
<template slot-scope="scope">{{ scope.row.description }}</template>
<el-table-column label="备注" prop="description">
</el-table-column>
<el-table-column label="创建时间" width="160">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
<el-table-column label="创建时间" prop="create_time" width="160">
</el-table-column>
<el-table-column
align="center"
@ -124,9 +121,9 @@
</el-form-item>
<el-form-item label="备注" prop="description">
<el-input
v-model="vendor.description"
type="textarea"
:rows="4"
v-model="vendor.description"
placeholder="备注"
/>
</el-form-item>
@ -140,10 +137,9 @@
</template>
<script>
import {getpVendorList, createVendor, updateVendor, deleteVendor} from "@/api/vendor";
import {getUserList} from "@/api/user";
// import {getUserList} from "@/api/user";
import checkPermission from "@/utils/permission";
import {genTree} from "@/utils";
// import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultvendor = {
name: "",
@ -205,13 +201,15 @@
this.listQuery.page = 1;
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
}
};
this.getList();
},
handleCreate() {
this.vendor = Object.assign({}, defaultvendor);
this.dialogType = "new";
@ -229,6 +227,7 @@
this.$refs["Form"].clearValidate();
});
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
@ -241,7 +240,7 @@
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
this.$message.error(err);
});
},

View File

@ -2,30 +2,37 @@
<div class="app-container">
<el-card>
<div>
<el-button
v-if="checkPermission(['workflow_create'])"
type="primary"
icon="el-icon-plus"
@click="handleCreate"
>
新增
</el-button>
<el-input
v-model="listQuery.search"
placeholder="名称"
style="width: 300px"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
v-model="listQuery.search"
placeholder="名称"
style="width: 300px"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button
>
搜索
</el-button>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>重置</el-button
>
</div>
<div style="margin-top: 2px">
<el-button type="primary" icon="el-icon-plus" @click="handleCreate">新增</el-button>
重置
</el-button>
</div>
</el-card>
<el-card style="margin-top: 2px">
@ -38,20 +45,17 @@
highlight-current-row
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50" />
<el-table-column label="名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
<el-table-column type="index" width="50"/>
<el-table-column label="名称" prop="name">
</el-table-column>
<el-table-column label="描述">
<template slot-scope="scope">{{ scope.row.description }}</template>
<el-table-column label="描述" prop="description">
</el-table-column>
<el-table-column label="工单查看权限校验">
<template slot-scope="scope">
{{ !!(scope.row.view_permission_check)?'':'' }}
</template>
</el-table-column>
<el-table-column width="180" label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
<el-table-column width="180" prop="create_time" label="创建时间">
</el-table-column>
<el-table-column
align="center"
@ -62,24 +66,36 @@
<el-link
v-if="checkPermission(['workflow_update'])"
@click="handlecfgt(scope)"
>配置</el-link>
>
配置
</el-link>
<el-link
v-if="checkPermission(['workflow_update'])"
@click="handleEdit(scope)"
>编辑</el-link>
>
编辑
</el-link>
<el-link
v-if="checkPermission(['workflow_delete'])"
type="danger"
@click="handleDelete(scope)"
>删除</el-link>
>
删除
</el-link>
<el-link
v-if="checkPermission(['workflow_update'])"
type="primary"
@click="handleTicket(scope)"
>查看工单</el-link>
>
查看工单
</el-link>
<el-link
v-if="checkPermission(['workflow_update'])"
type="primary"
@click="handleWatch(scope)"
>查看流程图</el-link>
>
查看流程图
</el-link>
</template>
</el-table-column>
</el-table>
@ -116,18 +132,19 @@
:model="workflow"
label-width="100px"
label-position="right"
:rules="rule1">
:rules="rule1"
>
<el-form-item label="名称" prop="name">
<el-input v-model="workflow.name" placeholder="名称" />
<el-input v-model="workflow.name" placeholder="名称"/>
</el-form-item>
<el-form-item label="流水号前缀">
<el-input v-model="workflow.sn_prefix " placeholder="流水号前缀" />
<el-input v-model="workflow.sn_prefix " placeholder="流水号前缀"/>
</el-form-item>
<el-form-item label="描述" prop="description">
<el-input
v-model="workflow.description"
type="textarea"
:rows="4"
v-model="workflow.description"
placeholder="描述"
/>
</el-form-item>
@ -147,10 +164,10 @@
/>
</el-form-item>
<el-form-item label="标题模板" prop="title_template">
<el-input v-model="workflow.title_template" placeholder="你有一个待办工单:{title}" />
<el-input v-model="workflow.title_template" placeholder="你有一个待办工单:{title}"/>
</el-form-item>
<el-form-item label="内容模板" prop="content_template">
<el-input v-model="workflow.content_template" placeholder="标题:{title}, 创建时间:{create_time}" />
<el-input v-model="workflow.content_template" placeholder="标题:{title}, 创建时间:{create_time}"/>
</el-form-item>
</el-form>
<div style="text-align: right">
@ -162,253 +179,274 @@
</template>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script>
import { getWfTransitionList,getWorkflowList, createWorkflow,updateWorkflow,deleteWorkflow,getWfCustomfieldList,getWfStateList } from "@/api/workflow";
import {
getWfTransitionList,
getWorkflowList,
createWorkflow,
updateWorkflow,
deleteWorkflow,
getWfCustomfieldList,
getWfStateList
} from "@/api/workflow";
import checkPermission from "@/utils/permission";
// import vueJsonEditor from 'vue-json-editor'
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
import dagreD3 from 'dagre-d3'
import * as d3 from 'd3'
const defaultworkflow = {
name: "",
number: "",
};
export default {
components: { Pagination },
data() {
return {
// workflow: defaultworkflow,
workflow:{
name:'',
sn_prefix:'',
description:'',
view_permission_check:'',
display_form_str:'',
title_template:'',
content_template:'',
},
limitedWatch:false,
view_permission_check:false,
hasJsonFlag:true, // json是否验证通过
hasJsonFlag1:true, // json是否验证通过
workflowList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
choiceOption:[],
display_form_str:[],
limit_expression:[],
listLoading: true,
dialogVisible: false,
dialogType: "new",
watchedName:'',
watchedCreateTime:'',
rule1: {
name: [{ required: true, message: "请输入", trigger: "blur" }],
description: [{ required: true, message: "请输入", trigger: "blur" }]
},
};
},
computed: {},
watch: {},
created() {
this.getList();
},
methods: {
checkPermission,
getList() {
this.listLoading = true;
getWorkflowList(this.listQuery).then((response) => {
if (response.data) {
this.workflowList = response.data;
}
this.listLoading = false;
});
const defaultworkflow = {
name: "",
number: "",
};
export default {
components: {Pagination},
data() {
return {
// workflow: defaultworkflow,
workflow: {
name: '',
sn_prefix: '',
description: '',
view_permission_check: '',
display_form_str: '',
title_template: '',
content_template: '',
},
limitedWatch: false,
view_permission_check: false,
hasJsonFlag: true, // json是否验证通过
hasJsonFlag1: true, // json是否验证通过
workflowList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
choiceOption: [],
display_form_str: [],
limit_expression: [],
listLoading: true,
dialogVisible: false,
dialogType: "new",
watchedName: '',
watchedCreateTime: '',
rule1: {
name: [{required: true, message: "请输入", trigger: "blur"}],
description: [{required: true, message: "请输入", trigger: "blur"}]
},
};
},
handleFilter() {
this.listQuery.page = 1;
computed: {},
watch: {},
created() {
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
}
this.getList();
},
handleCreate() {
this.workflow = Object.assign({}, defaultworkflow);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleEdit(scope) {
this.workflow = Object.assign({}, scope.row); // copy obj
this.dialogType = "edit";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
getWfCustomfieldList(scope.row.id).then((response) => {
if (response.data) {
this.choiceOption = response.data;
}
});
},
handlecfgt(scope)
{
this.$router.push({name:"configuration",params:{workflow:scope.row.id}})
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteWorkflow(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
handleTicket(scope){
this.$router.push({name:"workFlowTickets",params:{workflow:scope.row.id}})
},
async confirm(form) {
debugger;
console.log(this.workflow.display_form_str)
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
this.checkJson();
this.checkJson2();
updateWorkflow(this.workflow.id, this.workflow).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
this.checkJson();
this.checkJson2();
createWorkflow(this.workflow).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
handleWatch(scope){
let that = this;
let workFlow = scope.row.id;
that.watchedName = scope.row.name;
that.watchedCreateTime = scope.row.create_time;
that.limitedWatch = true;
that.$nextTick(()=>{
var g = new dagreD3.graphlib.Graph().setGraph({
rankdir: 'DL',
nodesep: 100,
edgesep: 10,//两条线之间的距离
ranksep: 50,//节点之间的距离
marginx: 160,
marginy: 20,
});
//获取state得到节点
getWfStateList(workFlow).then((response) => {
methods: {
checkPermission,
getList() {
this.listLoading = true;
getWorkflowList(this.listQuery).then((response) => {
if (response.data) {
let nodes = response.data;
// 添加节点
nodes.forEach((item) => {
g.setNode(item.id, {
// 节点标签
label: item.name,
// 节点形状
shape: 'rect',
toolText: item.name,
//节点样式
style: "fill:#fff;stroke:#000",
labelStyle: "fill:#000;",
rx :5,//矩形节点圆角度
ry :5
});
});
g.nodes().forEach(function (v) {
console.log("Node " + v + ": " + JSON.stringify(g.node(v)));
});
//获取流转得到线 链接关系
getWfTransitionList(workFlow).then((res)=>{
if(res.data){
let transitionList = res.data;
transitionList.forEach((transition0)=>{
if (transition0.condition_expression.length>0){
debugger;
g.setNode(transition0.source_state_.id+100000, {label: "条件表达式",style: "stroke: #000;fill: #afa", shape: "diamond"});
g.setEdge(transition0.source_state_.id, transition0.source_state_.id+100000, {
// 边标签
label: transition0.name,
style: "fill:#ffffff;stroke:#c0c1c3;stroke-width:1.5px"
});
let condition_expression = transition0.condition_expression;
condition_expression.forEach(condition_expression0=>{
g.setEdge(transition0.source_state_.id+100000, condition_expression0.target_state, {
label: condition_expression0.label,
style: "fill:#ffffff;stroke:#c0c1c3;stroke-width:1.5px"
})
})
}else{
g.setEdge(transition0.source_state_.id, transition0.destination_state_.id, {
// 边标签
label: transition0.name,
// 边样式
style: "fill:#ffffff;stroke:#c0c1c3;stroke-width:1.5px" // 根据后台数据来改变连线的颜色
});
}
})
g.nodes().length-1
g.nodes().forEach(function (v) {
console.log("Node " + v + ": " + JSON.stringify(g.node(v)));
});
// 创建渲染器
let render = new dagreD3.render();
// 选择 svg 并添加一个g元素作为绘图容器.
let svg = d3.select('#mySvg');
let svgGroup = svg.append('g');
// 在绘图容器上运行渲染器生成流程图.
render(d3.select("svg g"), g);
}else{}
});
this.workflowList = response.data;
}
this.listLoading = false;
});
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
}
this.getList();
},
handleCreate() {
this.workflow = Object.assign({}, defaultworkflow);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleEdit(scope) {
this.workflow = Object.assign({}, scope.row); // copy obj
this.dialogType = "edit";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
getWfCustomfieldList(scope.row.id).then((response) => {
if (response.data) {
this.choiceOption = response.data;
}
});
},
})
},
closeMark(){
this.limitedWatch = false;
},
onJsonChange (value) {
handlecfgt(scope) {
this.$router.push({name: "configuration", params: {workflow: scope.row.id}})
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteWorkflow(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
handleTicket(scope) {
this.$router.push({name: "workFlowTickets", params: {workflow: scope.row.id}})
},
async confirm(form) {
// console.log(this.workflow.display_form_str)
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
this.checkJson();
this.checkJson2();
updateWorkflow(this.workflow.id, this.workflow).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
this.checkJson();
this.checkJson2();
createWorkflow(this.workflow).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
handleWatch(scope) {
let that = this;
let workFlow = scope.row.id;
that.watchedName = scope.row.name;
that.watchedCreateTime = scope.row.create_time;
that.limitedWatch = true;
that.$nextTick(() => {
var g = new dagreD3.graphlib.Graph().setGraph({
rankdir: 'DL',
nodesep: 100,
edgesep: 10,//两条线之间的距离
ranksep: 50,//节点之间的距离
marginx: 160,
marginy: 20,
});
//获取state得到节点
getWfStateList(workFlow).then((response) => {
if (response.data) {
let nodes = response.data;
// 添加节点
nodes.forEach((item) => {
g.setNode(item.id, {
// 节点标签
label: item.name,
// 节点形状
shape: 'rect',
toolText: item.name,
//节点样式
style: "fill:#fff;stroke:#000",
labelStyle: "fill:#000;",
rx: 5,//矩形节点圆角度
ry: 5
});
});
g.nodes().forEach(function (v) {
console.log("Node " + v + ": " + JSON.stringify(g.node(v)));
});
//获取流转得到线 链接关系
getWfTransitionList(workFlow).then((res) => {
if (res.data) {
let transitionList = res.data;
transitionList.forEach((transition0) => {
if (transition0.condition_expression.length > 0) {
debugger;
g.setNode(transition0.source_state_.id + 100000, {
label: "条件表达式",
style: "stroke: #000;fill: #afa",
shape: "diamond"
});
g.setEdge(transition0.source_state_.id, transition0.source_state_.id + 100000, {
// 边标签
label: transition0.name,
style: "fill:#ffffff;stroke:#c0c1c3;stroke-width:1.5px"
});
let condition_expression = transition0.condition_expression;
condition_expression.forEach(condition_expression0 => {
g.setEdge(transition0.source_state_.id + 100000, condition_expression0.target_state, {
label: condition_expression0.label,
style: "fill:#ffffff;stroke:#c0c1c3;stroke-width:1.5px"
})
})
} else {
g.setEdge(transition0.source_state_.id, transition0.destination_state_.id, {
// 边标签
label: transition0.name,
// 边样式
style: "fill:#ffffff;stroke:#c0c1c3;stroke-width:1.5px" // 根据后台数据来改变连线的颜色
});
}
})
g.nodes().length - 1
g.nodes().forEach(function (v) {
console.log("Node " + v + ": " + JSON.stringify(g.node(v)));
});
// 创建渲染器
let render = new dagreD3.render();
// 选择 svg 并添加一个g元素作为绘图容器.
let svg = d3.select('#mySvg');
let svgGroup = svg.append('g');
// 在绘图容器上运行渲染器生成流程图.
render(d3.select("svg g"), g);
} else {
}
});
}
});
})
},
closeMark() {
this.limitedWatch = false;
},
onJsonChange(value) {
// console.log('更改value:', value);
// 实时保存
this.onJsonSave(value)
},
onJsonSave (value) {
onJsonSave(value) {
// console.log('保存value:', value);
this.limit_expression = value
this.hasJsonFlag = true
@ -416,20 +454,21 @@ export default {
onError(value) {
this.hasJsonFlag = false
},
onJsonChange1 (value) {
onJsonChange1(value) {
// 实时保存
this.onJsonSave1(value)
},
onJsonSave1 (value) {
onJsonSave1(value) {
this.display_form_str = value
this.hasJsonFlag1 = true
},
onError1(value) {
this.hasJsonFlag1 = false
},
// 检查json
checkJson(){
if (this.hasJsonFlag == false){
checkJson() {
if (this.hasJsonFlag == false) {
// alert("限制表达式json验证失败")
return false
} else {
@ -437,9 +476,10 @@ export default {
return true
}
},
// 检查json
checkJson2(){
if (this.hasJsonFlag1 == false){
// 检查json
checkJson2() {
if (this.hasJsonFlag1 == false) {
// alert("展现表单字段json验证失败")
return false
} else {
@ -447,24 +487,27 @@ export default {
return true
}
},
},
};
},
};
</script>
<style scoped>
::-webkit-scrollbar {
width: 15px;
}
::-webkit-scrollbar-track{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.2);
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .2);
background-color: #fefefe;
border-radius: 7px;
}
::-webkit-scrollbar-thumb{
::-webkit-scrollbar-thumb {
border-radius: 7px;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.5);
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .5);
background-color: #f5f5f5;
}
.svgMark{
.svgMark {
width: 100%;
height: 100%;
position: fixed;
@ -475,9 +518,10 @@ export default {
overflow: auto;
margin: 0;
z-index: 2000;
background: rgba(0,0,0,.3);
background: rgba(0, 0, 0, .3);
}
.svgWrapper{
.svgWrapper {
background: #fff;
width: 800px;
margin: 10vh auto 0;
@ -486,30 +530,36 @@ export default {
max-height: 80vh;
overflow-y: scroll;
}
.svgItem{
padding: 20px 40px 0 ;
.svgItem {
padding: 20px 40px 0;
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
font-size: 18px;
display: flex;
justify-content: space-between;
}
svg {
font-size: 14px;
}
.node rect {
stroke: #606266;
fill: #fff;
}
.edgePath path {
stroke: #606266;
fill: #333;
stroke-width: 1.5px;
}
g.conditions > rect {
fill: #00ffd0;
stroke: #000;
}
.el-icon-close{
.el-icon-close {
cursor: pointer;
}
</style>

File diff suppressed because it is too large Load Diff