yemianqunaxiananniutinajia

This commit is contained in:
shijing 2022-03-02 13:37:44 +08:00
parent 8dcaec8003
commit 544478dc0b
7 changed files with 1614 additions and 1677 deletions

View File

@ -13,46 +13,38 @@
border
v-el-height-adaptive-table="{ bottomOffset: 41 }"
>
<el-table-column type="index" width="50" label="序号" />
<el-table-column align="center" label="工号">
<template slot-scope="scope">{{ scope.row.number }}</template>
<el-table-column type="index" width="50" label="序号"/>
<el-table-column align="center" prop="number" label="工号">
</el-table-column>
<el-table-column align="center" label="姓名">
<template slot-scope="scope">{{ scope.row.name }}</template>
<el-table-column align="center" prop="name" label="姓名">
</el-table-column>
<el-table-column align="center" label="到岗情况">
<template slot-scope="scope">
<el-tag type="success" v-if="scope.row.is_atwork">在岗</el-tag>
<el-tag type="danger" v-else>离岗</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="离岗备注">
<template slot-scope="scope">{{
scope.row.not_work_remark
}}</template>
<el-table-column align="center" prop="not_work_remark" label="离岗备注">
</el-table-column>
<el-table-column align="center" label="打卡时间">
<template slot-scope="scope">{{ scope.row.last_check_time }}</template>
<el-table-column align="center" prop="last_check_time" label="打卡时间">
</el-table-column>
<el-table-column align="header-center" label="部门">
<template v-if="scope.row.dept_" slot-scope="scope">{{
scope.row.dept_.name
}}</template>
<template v-if="scope.row.dept_" slot-scope="scope">
{{scope.row.dept_.name}}
</template>
</el-table-column>
<el-table-column align="center" label="操作" fixed="right">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['employee_notworkremark'])&&scope.row.is_atwork == false"
type="primary"
v-if="scope.row.is_atwork == false"
@click="handlestopwork(scope)"
>离岗说明
>
离岗说明
</el-link>
</template>
</el-table-column>
</el-table>
<pagination
v-show="userList.count > 0"
:total="userList.count"
@ -60,7 +52,6 @@
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
@ -74,17 +65,25 @@
>
<el-form-item label="备注" prop="remark">
<el-input
type="textarea"
v-model="stopwork.not_work_remark"
type="textarea"
placeholder="备注"
/>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false"
>取消</el-button
<el-button
type="danger"
@click="dialogVisible = false"
>
<el-button type="primary" @click="smtconfirm()">确认</el-button>
取消
</el-button>
<el-button
type="primary"
@click="smtconfirm()"
>
确认
</el-button>
</div>
</el-dialog>
</el-tab-pane>
@ -99,7 +98,12 @@
placeholder="选择年月"
>
</el-date-picker>
<el-button type="primary" @click="submit">查询</el-button>
<el-button
type="primary"
@click="submit"
>
查询
</el-button>
</div>
<el-table
:data="atworkList"
@ -112,35 +116,25 @@
@current-change="handleCurrentChange"
v-el-height-adaptive-table="{ bottomOffset: 41 }"
>
<el-table-column type="index" width="50" label="序号" />
<el-table-column align="center" label="工号">
<template slot-scope="scope">{{ scope.row.number }}</template>
<el-table-column type="index" width="50" label="序号"/>
<el-table-column align="center" prop="number" label="工号">
</el-table-column>
<el-table-column align="center" label="姓名">
<template slot-scope="scope">{{ scope.row.name }}</template>
<el-table-column align="center" prop="name" label="姓名">
</el-table-column>
<el-table-column align="header-center" label="部门">
<template slot-scope="scope">{{
scope.row.dept_name
}}</template>
<el-table-column align="header-center" prop="dept_name" label="部门">
</el-table-column>
<el-table-column align="center" label="出勤天数">
<template slot-scope="scope">{{ scope.row.count }}</template>
<el-table-column align="center" prop="count" label="出勤天数">
</el-table-column>
<el-table-column align="center" label="应到天数">
<template slot-scope="scope">{{
scope.row.count_workday
}}</template>
<el-table-column align="center" prop="count_workday" label="应到天数">
</el-table-column>
</el-table>
</el-col>
<el-col :span="12">
<el-calendar v-model="value">
<template slot="dateCell" slot-scope="{ date, data }">
<p >
{{ data.day.split("-").slice(1).join("-") }}<br />
{{ dealMyDate(data.day) }}
<p>
{{ data.day.split("-").slice(1).join("-") }}<br/>
{{ dealMyDate(data.day) }}
</p>
</template>
</el-calendar>
@ -152,155 +146,158 @@
</div>
</template>
<style>
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409eff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 100px;
height: 100px;
line-height: 100px;
text-align: center;
}
.avatar {
width: 100px;
height: 100px;
display: block;
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409eff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 100px;
height: 100px;
line-height: 100px;
text-align: center;
}
.avatar {
width: 100px;
height: 100px;
display: block;
}
</style>
<script>
import { getEmployeeList } from "@/api/employee";
import checkPermission from "@/utils/permission";
import { notWork, getNotWorkList ,getClockrecordList} from "@/api/hrm";
import {getEmployeeList} from "@/api/employee";
import checkPermission from "@/utils/permission";
import {notWork, getNotWorkList, getClockrecordList} from "@/api/hrm";
import { getatwork } from "@/api/srm";
import { upUrl, upHeaders } from "@/api/file";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {getatwork} from "@/api/srm";
import {upUrl, upHeaders} from "@/api/file";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
components: { Pagination, Treeselect },
data() {
return {
userList: { count: 0 },
atworkList: [],
stopwork: { not_work_remark: "" },
value3: null,
value2: null,
listLoading: true,
dialogVisible: false,
stopworkID: null,
notworkList: "",
listQuery: {
page: 1,
page_size: 20,
},
resDate: [
{ date: "2022-02-20", content: "放假" },
{ date: "2022-02-26", content: "去交电费" },
{ date: "2022-02-25", content: "去学习vue" },
],
atworkDate: { year: null, month: null },
value: new Date(),
};
},
computed: {},
watch: {},
created() {
this.getList();
},
methods: {
checkPermission,
//今日到岗
getList() {
this.listQuery.fields = "number,name,is_atwork,dept_,id,not_work_remark,last_check_time";
getEmployeeList(this.listQuery).then((response) => {
if (response.data) {
this.userList = response.data;
}
});
export default {
components: {Pagination, Treeselect},
data() {
return {
userList: {count: 0},
atworkList: [],
stopwork: {not_work_remark: ""},
value3: null,
value2: null,
listLoading: true,
dialogVisible: false,
stopworkID: null,
notworkList: "",
listQuery: {
page: 1,
page_size: 20,
},
resDate: [
{date: "2022-02-20", content: "放假"},
{date: "2022-02-26", content: "去交电费"},
{date: "2022-02-25", content: "去学习vue"},
],
atworkDate: {year: null, month: null},
value: new Date(),
};
},
handlestopwork(scope) {
this.dialogVisible = true;
this.stopworkID = scope.row.id;
computed: {},
watch: {},
created() {
this.getList();
},
handleCurrentChange(row) {
this.resDate=[],
getNotWorkList({page:0,user:row.user_id}).then((response) => {
if (response.data) {
response.data.forEach((item) => {
this.resDate.push({
data: item.not_work_date,
content: item.remark,
});
});
}
});
getClockrecordList({page:0,create_by:row.user_id}).then((response) => {
if (response.data) {
response.data.forEach((item) => {
var curTime=(item.update_time).substring(0,10)
console.log(curTime);
this.resDate.push({
data: curTime,
content: "在岗",
});
});
}
});
},
//离职备注提交
smtconfirm() {
notWork(this.stopworkID, this.stopwork).then((res) => {
if (res.code >= 200) {
this.$message.success("离职备注提交成功!");
this.dialogVisible = false;
this.getList();
}
});
},
//到岗统计
submit() {
this.atworkDate.year = this.value2.getFullYear();
this.atworkDate.month = this.value2.getMonth() + 1;
this.value = this.value2;
(this.resDate = []),
getatwork(this.atworkDate).then((response) => {
methods: {
checkPermission,
//今日到岗
getList() {
this.listQuery.fields = "number,name,is_atwork,dept_,id,not_work_remark,last_check_time";
getEmployeeList(this.listQuery).then((response) => {
if (response.data) {
this.atworkList = response.data;
this.userList = response.data;
}
});
},
},
handlestopwork(scope) {
this.dialogVisible = true;
this.stopworkID = scope.row.id;
},
handleCurrentChange(row) {
this.resDate = [],
getNotWorkList({page: 0, user: row.user_id}).then((response) => {
if (response.data) {
response.data.forEach((item) => {
this.resDate.push({
data: item.not_work_date,
content: item.remark,
});
});
//考勤日历
dealMyDate(v) {
let len = this.resDate.length;
let res = "";
for (let i = 0; i < len; i++) {
if (this.resDate[i].data == v) {
res = this.resDate[i].content;
break;
}
});
getClockrecordList({page: 0, create_by: row.user_id}).then((response) => {
if (response.data) {
response.data.forEach((item) => {
var curTime = (item.update_time).substring(0, 10)
console.log(curTime);
this.resDate.push({
data: curTime,
content: "在岗",
});
});
}
});
},
//离职备注提交
smtconfirm() {
notWork(this.stopworkID, this.stopwork).then((res) => {
if (res.code >= 200) {
this.$message.success("离职备注提交成功!");
this.dialogVisible = false;
this.getList();
}
});
},
//到岗统计
submit() {
this.atworkDate.year = this.value2.getFullYear();
this.atworkDate.month = this.value2.getMonth() + 1;
this.value = this.value2;
(this.resDate = []),
getatwork(this.atworkDate).then((response) => {
if (response.data) {
this.atworkList = response.data;
}
});
},
//考勤日历
dealMyDate(v) {
let len = this.resDate.length;
let res = "";
for (let i = 0; i < len; i++) {
if (this.resDate[i].data == v) {
res = this.resDate[i].content;
break;
}
}
}
return res;
return res;
},
},
},
};
};
</script>

View File

@ -1,249 +1,249 @@
<template>
<div class="app-container">
<el-card>
<div>
<el-input
v-model="listQuery.name"
placeholder="姓名"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
size="small"
>搜索</el-button>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
size="small"
>重置</el-button>
</div>
<el-table
v-loading="listLoading"
:data="userList.results"
style="width: 100%;margin-top:6px;"
highlight-current-row
row-key="id"
height="100"
stripe
border
v-el-height-adaptive-table="{bottomOffset: 41}"
>
<el-table-column type="index" width="50" />
<el-table-column align="center" label="工号">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column align="center" label="姓名">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column align="header-center" label="照片">
<template slot-scope="scope"> <img :src="scope.row.photo" min-width="70" height="70"/></template>
</el-table-column>
<el-table-column align="header-center" label="电子签名">
<template slot-scope="scope"> <img :src="scope.row.signature" min-width="70" height="40"/></template>
</el-table-column>
<el-table-column align="header-center" label="部门">
<template
v-if="scope.row.dept_"
slot-scope="scope"
>{{ scope.row.dept_.name }}</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-link
v-if="!scope.row.is_superuser"
:disabled="!checkPermission(['user_update'])"
type="primary"
size="small"
@click="handleEdit(scope)"
>编辑</el-link>
<el-link
v-if="!scope.row.is_superuser"
:disabled="!checkPermission(['user_delete'])"
type="danger"
size="small"
@click="handleDelete(scope)"
>删除</el-link>
</template>
</el-table-column>
</el-table>
<pagination
v-show="userList.count>0"
:total="userList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
<el-card>
<div>
<el-input
v-model="listQuery.name"
placeholder="姓名"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
</el-card>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
size="small"
@click="handleFilter"
>
搜索
</el-button>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
size="small"
@click="resetFilter"
>
重置
</el-button>
</div>
<el-table
v-loading="listLoading"
:data="userList.results"
style="width: 100%;margin-top:6px;"
highlight-current-row
row-key="id"
height="100"
stripe
border
v-el-height-adaptive-table="{bottomOffset: 41}"
>
<el-table-column type="index" width="50"/>
<el-table-column align="center" label="工号" prop="number">
</el-table-column>
<el-table-column align="center" label="姓名" prop="name">
</el-table-column>
<el-table-column align="header-center" label="照片">
<template slot-scope="scope"><img :src="scope.row.photo" min-width="70" height="70"/></template>
</el-table-column>
<el-table-column align="header-center" label="电子签名">
<template slot-scope="scope"><img :src="scope.row.signature" min-width="70" height="40"/></template>
</el-table-column>
<el-table-column align="header-center" label="部门">
<template
v-if="scope.row.dept_"
slot-scope="scope"
>
{{ scope.row.dept_.name }}
</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-link
v-if="!scope.row.is_superuser"
:disabled="!checkPermission(['employee_update'])"
type="primary"
size="small"
@click="handleEdit(scope)"
>
编辑
</el-link>
<el-link
v-if="!scope.row.is_superuser"
:disabled="!checkPermission(['user_delete'])"
type="danger"
size="small"
@click="handleDelete(scope)"
>
删除
</el-link>
</template>
</el-table-column>
</el-table>
<pagination
v-show="userList.count>0"
:total="userList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</el-card>
</div>
</template>
<style>
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409eff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 100px;
height: 100px;
line-height: 100px;
text-align: center;
}
.avatar {
width: 100px;
height: 100px;
display: block;
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409eff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 100px;
height: 100px;
line-height: 100px;
text-align: center;
}
.avatar {
width: 100px;
height: 100px;
display: block;
}
</style>
<script>
import { getUserList, createUser, deleteUser, updateUser } from "@/api/user";
import { deleteUser} from "@/api/user";
import {getEmployeeList,} from "@/api/employee";
import checkPermission from "@/utils/permission"
import {upUrl, upHeaders} from "@/api/file"
import Pagination from "@/components/Pagination" // secondary package based on el-pagination
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { getEmployeeList, } from "@/api/employee";
import { getOrgAll } from "@/api/org"
import { getRoleAll } from "@/api/role"
import { genTree } from "@/utils"
import checkPermission from "@/utils/permission"
import { upUrl, upHeaders } from "@/api/file"
import Pagination from "@/components/Pagination" // secondary package based on el-pagination
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
const defaultUser = {
id: "",
name: "",
username: "",
dept: null,
avatar: "/media/default/avatar.png"
};
export default {
components: { Pagination, Treeselect },
data() {
return {
user: defaultUser,
upHeaders: upHeaders(),
upUrl: upUrl(),
userList: {count:0},
roles: [],
listLoading: true,
listQuery: {
page: 1,
page_size: 20
},
enabledOptions: [
{ key: "true", display_name: "激活" },
{ key: "false", display_name: "禁用" }
],
dialogVisible: false,
dialogType: "new",
rule1: {
name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
username: [{ required: true, message: "请输入账号", trigger: "change" }]
// password: [
// { required: true, message: '请输入密码', trigger: 'change' }
// ],
},
filterOrgText: "",
treeLoding: false,
orgData: []
};
},
computed: {},
watch: {
filterOrgText(val) {
this.$refs.tree.filter(val);
}
},
created() {
this.getList();
},
methods: {
checkPermission,
handleAvatarSuccess(res, file) {
this.user.avatar = res.data.path
},
beforeAvatarUpload(file) {
const isLt2M = file.size / 1024 / 1024 < 0.5;
if (!isLt2M) {
this.$message.error("上传头像图片大小不能超过 500KB!");
}
return isLt2M;
},
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
handleOrgClick(obj, node, vue) {
this.listQuery.page = 1;
this.listQuery.dept = obj.id;
this.getList();
},
getList() {
this.listLoading = true;
getEmployeeList(this.listQuery).then(response => {
if (response.data) {
this.userList = response.data
}
this.listLoading = false;
});
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20
const defaultUser = {
id: "",
name: "",
username: "",
dept: null,
avatar: "/media/default/avatar.png"
};
export default {
components: {Pagination},
data() {
return {
user: defaultUser,
upHeaders: upHeaders(),
upUrl: upUrl(),
userList: {count: 0},
roles: [],
listLoading: true,
listQuery: {
page: 1,
page_size: 20
},
enabledOptions: [
{key: "true", display_name: "激活"},
{key: "false", display_name: "禁用"}
],
dialogVisible: false,
dialogType: "new",
rule1: {
name: [{required: true, message: "请输入姓名", trigger: "blur"}],
username: [{required: true, message: "请输入账号", trigger: "change"}]
},
filterOrgText: "",
treeLoding: false,
orgData: []
};
this.getList();
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
computed: {},
watch: {
filterOrgText(val) {
this.$refs.tree.filter(val);
}
},
created() {
this.getList();
handleEdit(scope) {
this.$router.push({name:"userupdate",params:{id:scope.row.id}})
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error"
})
.then(async () => {
await deleteUser(scope.row.id);
this.userList.splice(scope.row.index, 1);
this.$message({
type: "success",
message: "成功删除!"
});
})
.catch(err => {
console.error(err);
methods: {
checkPermission,
handleAvatarSuccess(res) {
this.user.avatar = res.data.path
},
beforeAvatarUpload(file) {
const isLt2M = file.size / 1024 / 1024 < 0.5;
if (!isLt2M) {
this.$message.error("上传头像图片大小不能超过 500KB!");
}
return isLt2M;
},
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
handleOrgClick(obj) {
this.listQuery.page = 1;
this.listQuery.dept = obj.id;
this.getList();
},
getList() {
this.listLoading = true;
getEmployeeList(this.listQuery).then(response => {
if (response.data) {
this.userList = response.data
}
this.listLoading = false;
});
},
},
}
};
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20
};
this.getList();
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
handleEdit(scope) {
this.$router.push({name: "userupdate", params: {id: scope.row.id}})
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error"
})
.then(async () => {
await deleteUser(scope.row.id);
this.userList.splice(scope.row.index, 1);
this.$message({
type: "success",
message: "成功删除!"
});
})
.catch(err => {
this.$message.error(err);
});
},
}
};
</script>

View File

@ -1,289 +1,242 @@
<template>
<div class="app-container">
<el-card>
<el-tabs v-model="activeName" type="card">
<el-tabs v-model="activeName" type="card">
<el-tab-pane label="待军检" name="first">
<el-button type="primary" icon="el-icon-plus" @click="handleorder"
>申请
<el-button
v-if="checkPermission(['wp_need_to_order'])"
type="primary"
icon="el-icon-plus"
@click="handleorder"
>
申请
</el-button>
<el-table
:data="iproductData.results"
ref="multipleTable"
border
fit
stripe
highlight-current-row
max-height="700"
height="100"
v-el-height-adaptive-table="{bottomOffset: 42}"
>
<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>
<el-table-column label="成品批次">
<template slot-scope="scope">{{ scope.row.batch }}</template>
</el-table-column>
<el-table-column label="成品名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column label="所在仓库">
<template slot-scope="scope">{{ scope.row.warehouse_.name }}</template>
</el-table-column>
</el-table>
<pagination
v-show="iproductData.count > 0"
:total="iproductData.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
<el-table
ref="multipleTable"
:data="iproductData.results"
border
fit
stripe
highlight-current-row
max-height="700"
height="100"
v-el-height-adaptive-table="{bottomOffset: 42}"
>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column type="index" width="50"/>
<el-table-column label="成品编号" prop="number">
</el-table-column>
<el-table-column label="成品批次" prop="batch">
</el-table-column>
<el-table-column label="成品名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column label="所在仓库">
<template slot-scope="scope">{{ scope.row.warehouse_.name }}</template>
</el-table-column>
</el-table>
<pagination
v-show="iproductData.count > 0"
:total="iproductData.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</el-tab-pane>
<el-tab-pane label="军检列表" name="second">
<el-table
:data="iproductData2.results"
border
fit
stripe
highlight-current-row
max-height="700"
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>
<el-table-column label="成品批次">
<template slot-scope="scope">{{ scope.row.batch }}</template>
</el-table-column>
<el-table-column label="成品名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<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-table
:data="iproductData2.results"
border
fit
stripe
highlight-current-row
max-height="700"
height="100"
v-el-height-adaptive-table="{bottomOffset: 42}"
>
<el-table-column type="index" width="50"/>
<el-table-column label="成品编号" prop="number">
</el-table-column>
<el-table-column label="成品批次" prop="batch">
</el-table-column>
<el-table-column label="成品名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<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>
<span v-else></span>
</template>
</el-table-column>
<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>
<span v-else></span>
</template>
</el-table-column>
<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>
<span v-else></span>
</template>
</el-table-column>
<el-table-column label="军检">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_mtestok == false">不合格</el-tag>
<el-tag v-else-if="scope.row.is_mtestok == true">合格</el-tag>
<span v-else></span>
</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="220px"
>
需要确定订单
</el-tag>
<span v-else></span>
</template>
</el-table-column>
<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>
<span v-else></span>
</template>
</el-table-column>
<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>
<span v-else></span>
</template>
</el-table-column>
<el-table-column label="军检">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_mtestok == false">不合格</el-tag>
<el-tag v-else-if="scope.row.is_mtestok == true">合格</el-tag>
<span v-else></span></template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="220px"
>
<template slot-scope="scope">
<el-link
v-if="scope.row.is_mtestok==null"
@click="handleMtest(scope)"
>军检</el-link
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="iproductData2.count > 0"
:total="iproductData2.count"
:page.sync="listQuery2.page"
:limit.sync="listQuery2.page_size"
@pagination="getList2"
/>
<template slot-scope="scope">
<el-link
v-if="checkPermission(['wp_mtest'])&&scope.row.is_mtestok==null"
@click="handleMtest(scope)"
>
军检
</el-link>
</template>
</el-table-column>
</el-table>
<pagination
v-show="iproductData2.count > 0"
:total="iproductData2.count"
:page.sync="listQuery2.page"
:limit.sync="listQuery2.page_size"
@pagination="getList2"
/>
</el-tab-pane>
</el-tabs>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
title="军检"
>
<el-form
ref="Form"
:model="mtest"
label-width="150px"
label-position="right"
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
title="军检"
>
<el-form
ref="Form"
:model="mtest"
label-width="150px"
label-position="right"
>
<el-form-item label="军检是否合格">
<el-radio v-model="mtest.is_mtestok" label=True>合格</el-radio>
<el-radio v-model="mtest.is_mtestok" label=False>不合格</el-radio>
<el-radio v-model="mtest.is_mtestok" label=True >合格</el-radio>
<el-radio v-model="mtest.is_mtestok" label=False >不合格</el-radio>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="mtest.remark_mtest" placeholder="备注" />
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="smtconfirm('Form')">确认</el-button>
</div>
</el-dialog>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="mtest.remark_mtest" placeholder="备注"/>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="smtconfirm('Form')">确认</el-button>
</div>
</el-dialog>
</el-card>
</div>
</template>
<script>
import { getiproductList,saleMtest} from "@/api/inm";
import checkPermission from "@/utils/permission";
import { mtest, needtoorder, } from "@/api/wpm";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
import {getiproductList} from "@/api/inm";
import checkPermission from "@/utils/permission";
import {mtest, needtoorder,} from "@/api/wpm";
// import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
export default {
components: { Pagination },
data() {
return {
iproductData: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
iproductData2: {
count: 0,
},
listQuery2: {
page: 1,
page_size: 20,
},
mtest: {},
salesdetail:"",
saleproduct:"",
dialogVisible:false,
activeName: 'first',
mutipID1:[],
};
},
computed: {},
watch: {},
created() {
this.getList();
this.getList2();
},
methods: {
checkPermission,
getList(){
this.listQuery.material__type = 1;
this.listQuery.need_to_order=false;
getiproductList(this.listQuery).then((response) => {
if (response.data) {
this.iproductData= response.data;
}
});
},
getList2(){
this.listQuery2.material__type = 1;
getiproductList(this.listQuery2).then((response) => {
if (response.data) {
this.iproductData2= response.data;
}
});
},
handleMtest(scope){
this.saleproduct=scope.row.wproduct;
this.dialogVisible=true;
export default {
components: {Pagination},
data() {
return {
iproductData: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
iproductData2: {
count: 0,
},
listQuery2: {
page: 1,
page_size: 20,
},
mtest: {},
salesdetail: "",
saleproduct: "",
dialogVisible: false,
activeName: 'first',
mutipID1: [],
};
},
smtconfirm(){
mtest(this.saleproduct,this.mtest).then((res) => {
if (res.code >= 200) {
this.getList2();
this.dialogVisible = false;
this.$message.success("成功");
}
});
created() {
this.getList();
this.getList2();
},
//批量申请
handleorder() {
let _this = this;
_this.mutipID1 = [];
this.$refs.multipleTable.selection.forEach((item) => {
_this.mutipID1.push(item.wproduct);
});
needtoorder({
wproducts: this.mutipID1,
}).then((res) => {
if (res.code >= 200) {
this.$message.success("申请成功!");
this.getList();
}
});
}
},
};
methods: {
checkPermission,
getList() {
this.listQuery.material__type = 1;
this.listQuery.need_to_order = false;
getiproductList(this.listQuery).then((response) => {
if (response.data) {
this.iproductData = response.data;
}
});
},
getList2() {
this.listQuery2.material__type = 1;
getiproductList(this.listQuery2).then((response) => {
if (response.data) {
this.iproductData2 = response.data;
}
});
},
handleMtest(scope) {
this.saleproduct = scope.row.wproduct;
this.dialogVisible = true;
},
smtconfirm() {
mtest(this.saleproduct, this.mtest).then((res) => {
if (res.code >= 200) {
this.getList2();
this.dialogVisible = false;
this.$message.success("成功");
}
});
},
//批量申请
handleorder() {
let _this = this;
_this.mutipID1 = [];
this.$refs.multipleTable.selection.forEach((item) => {
_this.mutipID1.push(item.wproduct);
});
needtoorder({
wproducts: this.mutipID1,
}).then((res) => {
if (res.code >= 200) {
this.$message.success("申请成功!");
this.getList();
}
});
}
},
};
</script>

View File

@ -2,70 +2,67 @@
<div class="app-container">
<el-card>
<div>
<el-button 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"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button
>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>重置</el-button
>
</div>
<el-button
v-if="checkPermission(['contract_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"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>
搜索
</el-button>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>
重置
</el-button>
</div>
</el-card>
<el-card >
<el-card>
<el-table
v-loading="listLoading"
:data="contractList.results"
border
border
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="合同名称" width="160" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.name }}</template>
<el-table-column type="index" width="50"/>
<el-table-column label="合同名称" prop="name" width="160" show-overflow-tooltip>
</el-table-column>
<el-table-column label="合同编号" width="160" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.number }}</template>
<el-table-column label="合同编号" prop="number" width="160" show-overflow-tooltip>
</el-table-column>
<el-table-column label="合同金额(元)" width="120">
<template slot-scope="scope">{{ scope.row.amount }}</template>
<el-table-column label="合同金额(元)" prop="amount" width="120">
</el-table-column>
<el-table-column label="开票金额(元)" width="120" >
<template slot-scope="scope">{{ scope.row.invoice }}</template>
<el-table-column label="开票金额(元)" prop="invoice" width="120">
</el-table-column>
<el-table-column label="客户名称" width="130" show-overflow-tooltip>
<el-table-column label="客户名称" width="130" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.customer_.name }}</template>
</el-table-column>
<el-table-column label="签订日期" width="120" >
<template slot-scope="scope">{{ scope.row.sign_date }}</template>
<el-table-column label="签订日期" prop="sign_date" width="120">
</el-table-column>
<el-table-column label="描述" width="130" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.description }}</template>
<el-table-column label="描述" prop="description" width="130" show-overflow-tooltip>
</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"
@ -74,27 +71,27 @@
fixed="right"
>
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
v-if="checkPermission(['contract_update'])"
type="primary"
@click="handleEdit(scope)"
>编辑</el-link
>
编辑
</el-link>
<el-link
v-if="checkPermission(['warehouse_delete'])"
v-if="checkPermission(['contract_delete'])"
type="danger"
@click="handleDelete(scope)"
>删除</el-link
>
<el-link
v-if="checkPermission(['warehouse_delete'])"
type="primary"
删除
</el-link>
<el-link
v-if="checkPermission(['contract_update'])"
type="primary"
@click="handleDetail(scope)"
>详情</el-link
>
详情
</el-link>
</template>
</el-table-column>
</el-table>
@ -118,19 +115,19 @@
:rules="rule1"
>
<el-form-item label="合同名称" prop="name">
<el-input v-model="contract.name" placeholder="合同名称" />
<el-input v-model="contract.name" placeholder="合同名称"/>
</el-form-item>
<el-form-item label="合同编号" prop="number">
<el-input v-model="contract.number" placeholder="合同编号" />
<el-input v-model="contract.number" placeholder="合同编号"/>
</el-form-item>
<el-form-item label="合同金额(元)" prop="amount">
<el-input v-model="contract.amount" placeholder="合同金额" />
<el-form-item label="合同金额(元)" prop="amount">
<el-input v-model="contract.amount" placeholder="合同金额"/>
</el-form-item>
<el-form-item label="开票金额(元)" prop="invoice">
<el-input v-model="contract.invoice" placeholder="开票金额" />
<el-input v-model="contract.invoice" placeholder="开票金额"/>
</el-form-item>
<el-form-item label="签订日期" prop="sign_date">
<el-date-picker
<el-form-item label="签订日期" prop="sign_date">
<el-date-picker
v-model="contract.sign_date"
type="date"
placeholder="选择日期"
@ -139,20 +136,19 @@
>
</el-date-picker>
</el-form-item>
<el-form-item label="客户" prop="sign_date">
<el-select style="width: 100%" v-model="contract.customer" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
<el-form-item label="客户" prop="sign_date">
<el-select style="width: 100%" v-model="contract.customer" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="描述" prop="description">
<el-input v-model="contract.description" placeholder="描述" />
</el-form-item>
<el-form-item label="描述" prop="description">
<el-input v-model="contract.description" placeholder="描述"/>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
@ -162,137 +158,137 @@
</div>
</template>
<script>
import { getContractList, createContract,updateContract,deleteContract,getCustomerList } from "@/api/sam";
import checkPermission from "@/utils/permission";
import {getContractList, createContract, updateContract, deleteContract, getCustomerList} from "@/api/sam";
import checkPermission from "@/utils/permission";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultecontract = {
};
export default {
components: { Pagination },
data() {
return {
contract: defaultecontract,
contractList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
options:[],
listLoading: true,
dialogVisible: false,
dialogType: "new",
rule1: {
name: [{ required: true, message: "请输入", trigger: "blur" }],
},
};
},
computed: {},
watch: {},
created() {
this.getLists();
this.getList();
},
methods: {
checkPermission,
getList() {
this.listLoading = true;
getContractList(this.listQuery).then((response) => {
if (response.data) {
this.contractList = response.data;
}
this.listLoading = false;
});
import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultecontract = {};
export default {
components: {Pagination},
data() {
return {
contract: defaultecontract,
contractList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
options: [],
listLoading: true,
dialogVisible: false,
dialogType: "new",
rule1: {
name: [{required: true, message: "请输入", trigger: "blur"}],
},
};
},
getLists() {
getCustomerList({pageoff:true}).then((response) => {
this.options = genTree(response.data);
});
},
handleFilter() {
this.listQuery.page = 1;
created() {
this.getLists();
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
}
this.getList();
},
handleCreate() {
this.contract = Object.assign({}, defaultecontract);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleEdit(scope) {
this.contract = 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 deleteContract(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
methods: {
checkPermission,
async confirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
updateContract(this.contract.id, this.contract).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
createContract(this.contract).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
getList() {
this.listLoading = true;
getContractList(this.listQuery).then((response) => {
if (response.data) {
this.contractList = response.data;
}
} else {
return false;
}
});
this.listLoading = false;
});
},
getLists() {
getCustomerList({pageoff: true}).then((response) => {
this.options = genTree(response.data);
});
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
};
this.getList();
},
handleCreate() {
this.contract = Object.assign({}, defaultecontract);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleEdit(scope) {
this.contract = 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 deleteContract(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) {
updateContract(this.contract.id, this.contract).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
createContract(this.contract).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
//合同详情
handleDetail(scope) {
this.$router.push({name: "contractdetail", params: {id: scope.row.id},})
}
},
//合同详情
handleDetail(scope){
this.$router.push({name: "contractdetail", params: { id: scope.row.id }, })
}
},
};
};
</script>

View File

@ -2,34 +2,40 @@
<div class="app-container">
<el-card>
<div>
<el-button 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"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button
>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>重置</el-button
>
</div>
<el-button
v-if="checkPermission(['customer_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"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>
搜索
</el-button>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>
重置
</el-button>
</div>
</el-card>
<el-card >
<el-card>
<el-table
v-loading="listLoading"
:data="customerList.results"
@ -37,48 +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="客户名称" width="200" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.name }}</template>
<el-table-column type="index" width="50"/>
<el-table-column label="客户名称" prop="name" width="200" show-overflow-tooltip>
</el-table-column>
<el-table-column label="详细地址" width="200" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.address }}</template>
<el-table-column label="详细地址" prop="address" width="200" show-overflow-tooltip>
</el-table-column>
<el-table-column label="联系人" width="130" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.contact }}</template>
<el-table-column label="联系人" prop="contact" width="130" show-overflow-tooltip>
</el-table-column>
<el-table-column label="联系电话" width="130" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.contact_phone }}</template>
<el-table-column label="联系电话" prop="contact_phone" width="130" show-overflow-tooltip>
</el-table-column>
<el-table-column label="描述" width="200" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.description }}</template>
<el-table-column label="描述" prop="description" width="200" show-overflow-tooltip>
</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"
label="操作"
>
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handleEdit(scope)"
v-if="checkPermission(['customer_update'])"
type="primary"
>编辑</el-link
@click="handleEdit(scope)"
>
编辑
</el-link>
<el-link
v-if="checkPermission(['warehouse_delete'])"
v-if="checkPermission(['customer_delete'])"
type="danger"
@click="handleDelete(scope)"
>删除</el-link
>
删除
</el-link>
</template>
</el-table-column>
</el-table>
@ -103,19 +102,19 @@
:rules="rule1"
>
<el-form-item label="客户名称" prop="name">
<el-input v-model="customer.name" placeholder="客户名称" />
<el-input v-model="customer.name" placeholder="客户名称"/>
</el-form-item>
<el-form-item label="客户地址" prop="address">
<el-input v-model="customer.address" placeholder="客户地址" />
<el-input v-model="customer.address" placeholder="客户地址"/>
</el-form-item>
<el-form-item label="联系人" prop="contact">
<el-input v-model="customer.contact" placeholder="联系人" />
<el-form-item label="联系人" prop="contact">
<el-input v-model="customer.contact" placeholder="联系人"/>
</el-form-item>
<el-form-item label="联系电话" prop="contact_phone">
<el-input v-model="customer.contact_phone" placeholder="联系电话" />
<el-form-item label="联系电话" prop="contact_phone">
<el-input v-model="customer.contact_phone" placeholder="联系电话"/>
</el-form-item>
<el-form-item label="描述" prop="description">
<el-input v-model="customer.description" placeholder="描述" />
<el-form-item label="描述" prop="description">
<el-input v-model="customer.description" placeholder="描述"/>
</el-form-item>
</el-form>
@ -127,123 +126,124 @@
</div>
</template>
<script>
import { getCustomerList, createCustomer,updateCustomer,deleteCustomer } from "@/api/sam";
import checkPermission from "@/utils/permission";
import {getCustomerList, createCustomer, updateCustomer, deleteCustomer} from "@/api/sam";
import checkPermission from "@/utils/permission";
// import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultecustomer = {};
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultecustomer = {
};
export default {
components: { Pagination },
data() {
return {
customer: defaultecustomer,
customerList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
listLoading: true,
dialogVisible: false,
dialogType: "new",
rule1: {
name: [{ required: true, message: "请输入", trigger: "blur" }],
},
};
},
computed: {},
watch: {},
created() {
this.getList();
},
methods: {
checkPermission,
//设备列表
getList() {
this.listLoading = true;
getCustomerList(this.listQuery).then((response) => {
if (response.data) {
this.customerList = response.data;
}
this.listLoading = false;
});
export default {
components: {Pagination},
data() {
return {
customer: defaultecustomer,
customerList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
listLoading: true,
dialogVisible: false,
dialogType: "new",
rule1: {
name: [{required: true, message: "请输入", trigger: "blur"}],
},
};
},
handleFilter() {
this.listQuery.page = 1;
created() {
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
}
this.getList();
},
handleCreate() {
this.customer = Object.assign({}, defaultecustomer);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleEdit(scope) {
this.customer = 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 deleteCustomer(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
methods: {
checkPermission,
async confirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
updateCustomer(this.customer.id, this.customer).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
createCustomer(this.customer).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
//设备列表
getList() {
this.listLoading = true;
getCustomerList(this.listQuery).then((response) => {
if (response.data) {
this.customerList = response.data;
}
} else {
return false;
}
});
this.listLoading = false;
});
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
};
this.getList();
},
handleCreate() {
this.customer = Object.assign({}, defaultecustomer);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleEdit(scope) {
this.customer = 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 deleteCustomer(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) {
updateCustomer(this.customer.id, this.customer).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
createCustomer(this.customer).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
},
},
};
};
</script>

View File

@ -2,34 +2,40 @@
<div class="app-container">
<el-card>
<div>
<el-button 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"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button
>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>重置</el-button
>
</div>
<el-button
v-if="checkPermission(['order_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"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>
搜索
</el-button>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>
重置
</el-button>
</div>
</el-card>
<el-card >
<el-card>
<el-table
v-loading="listLoading"
:data="orderList.results"
@ -37,69 +43,67 @@
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="订单编号" width="160" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.number }}</template>
<el-table-column type="index" width="50"/>
<el-table-column label="订单编号" prop="number" width="160" show-overflow-tooltip>
</el-table-column>
<el-table-column label="客户" width="200" show-overflow-tooltip>
<el-table-column label="客户" width="200" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.customer_.name }}</template>
</el-table-column>
<el-table-column label="所属合同" width="200" show-overflow-tooltip>
<el-table-column label="所属合同" width="200" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.contract">{{ scope.row.contract_.name }}</template>
</el-table-column>
<el-table-column label="产品名称" width="200" show-overflow-tooltip>
<el-table-column label="产品名称" width="200" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.product_.name }}</template>
</el-table-column>
<el-table-column label="产品型号" width="120" show-overflow-tooltip>
<el-table-column label="产品型号" width="120" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.product_.specification }}</template>
</el-table-column>
<el-table-column label="产品数量" width="90" >
<template slot-scope="scope">{{ scope.row.count }}</template>
<el-table-column label="产品数量" prop="count" width="90">
</el-table-column>
<el-table-column label="交货日期" width="150" >
<template slot-scope="scope">{{ scope.row.delivery_date }}</template>
<el-table-column label="交货日期" prop="delivery_date" width="150">
</el-table-column>
<el-table-column label="已交货数量" width="150" >
<template slot-scope="scope">{{ scope.row.delivered_count }}</template>
<el-table-column label="已交货数量" prop="delivered_count" width="150">
</el-table-column>
<el-table-column label="是否需要军检" width="150" >
<template slot-scope="scope">
<el-tag v-if="scope.row.need_mtest == false"></el-tag>
<el-tag v-else-if="scope.row.need_mtest == true"></el-tag></template>
</el-table-column>
<el-table-column label="创建时间" width="160" >
<el-table-column label="是否需要军检" width="150">
<template slot-scope="scope">
<el-tag v-if="scope.row.need_mtest === false"></el-tag>
<el-tag v-else-if="scope.row.need_mtest === true"></el-tag>
</template>
</el-table-column>
<el-table-column label="创建时间" width="160">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
fixed="right"
width="130"
fixed="right"
width="130"
>
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
v-if="checkPermission(['order_update'])"
@click="handleEdit(scope)"
type="primary"
>编辑</el-link
>
编辑
</el-link>
<el-link
v-if="checkPermission(['warehouse_delete'])"
v-if="checkPermission(['order_delete'])"
type="danger"
@click="handleDelete(scope)"
>删除</el-link
>
<el-link
v-if="checkPermission(['warehouse_delete'])"
type="primary"
删除
</el-link>
<el-link
v-if="checkPermission(['order_update'])"
type="primary"
@click="handleDetail(scope)"
>详情</el-link
>
详情
</el-link>
</template>
</el-table-column>
</el-table>
@ -123,26 +127,24 @@
label-position="right"
:rules="rule1"
>
<el-form-item label="订单编号" prop="number">
<el-input v-model="order.number" placeholder="订单编号自动生成" disabled="true" />
<el-input v-model="order.number" placeholder="订单编号自动生成" disabled="true"/>
</el-form-item>
<el-form-item label="所需产品" prop="product">
<el-select style="width: 100%" v-model="order.product" placeholder="请选择">
<el-option
v-for="item in productoptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
<el-form-item label="所需产品" prop="product">
<el-select style="width: 100%" v-model="order.product" placeholder="请选择">
<el-option
v-for="item in productoptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="所需数量" prop="count" >
<el-input-number type="number" v-model="order.count" :min="0"></el-input-number>
</el-form-item>
<el-form-item label="交货日期" prop="delivery_date">
<el-date-picker
<el-form-item label="所需数量" prop="count">
<el-input-number type="number" v-model="order.count" :min="0"></el-input-number>
</el-form-item>
<el-form-item label="交货日期" prop="delivery_date">
<el-date-picker
v-model="order.delivery_date"
type="date"
placeholder="选择日期"
@ -151,31 +153,30 @@
>
</el-date-picker>
</el-form-item>
<el-form-item label="客户" prop="customer">
<el-select style="width: 100%" v-model="order.customer" placeholder="请选择">
<el-option
v-for="item in customeroptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
<el-form-item label="客户" prop="customer">
<el-select style="width: 100%" v-model="order.customer" placeholder="请选择">
<el-option
v-for="item in customeroptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="所属合同" prop="contract">
<el-select style="width: 100%" v-model="order.contract" @change="selectcontract" placeholder="请选择">
<el-option
v-for="item in contractoptions"
:key="item.id"
:label="item.name+'____'+item.number"
:value="item.id">
</el-option>
</el-form-item>
<el-form-item label="所属合同" prop="contract">
<el-select style="width: 100%" v-model="order.contract" @change="selectcontract" placeholder="请选择">
<el-option
v-for="item in contractoptions"
:key="item.id"
:label="item.name+'____'+item.number"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="是否军检">
<el-switch v-model="order.need_mtest"></el-switch>
</el-form-item>
</el-form-item>
<el-form-item label="是否军检">
<el-switch v-model="order.need_mtest"></el-switch>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
@ -185,172 +186,174 @@
</div>
</template>
<script>
import { getOrderList, createOrder,updateOrder,deleteOrder,getContractList,getCustomerList,getContract } from "@/api/sam";
import { getMaterialList } from "@/api/mtm";
import checkPermission from "@/utils/permission";
import {
getOrderList,
createOrder,
updateOrder,
deleteOrder,
getContractList,
getCustomerList,
getContract
} from "@/api/sam";
import {getMaterialList} from "@/api/mtm";
import checkPermission from "@/utils/permission";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaulteorder = {
need_mtest:false,
customer:""
};
export default {
components: { Pagination },
data() {
return {
order: defaulteorder,
orderList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
contractoptions:[],
productoptions:[],
customeroptions:[],
listLoading: true,
dialogVisible: false,
dialogType: "new",
rule1: {
product: [{ required: true, message: "请输入", trigger: "blur" }],
delivery_date: [{ required: true, message: "请输入", trigger: "blur" }],
},
};
},
computed: {},
watch: {},
created() {
this.getListm();
this.getListc();
this.getListcm();
this.getList();
},
methods: {
checkPermission,
getList() {
this.listLoading = true;
getOrderList(this.listQuery).then((response) => {
if (response.data) {
this.orderList = response.data;
}
this.listLoading = false;
});
import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaulteorder = {
need_mtest: false,
customer: ""
};
export default {
components: {Pagination},
data() {
return {
order: defaulteorder,
orderList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
contractoptions: [],
productoptions: [],
customeroptions: [],
listLoading: true,
dialogVisible: false,
dialogType: "new",
rule1: {
product: [{required: true, message: "请输入", trigger: "blur"}],
delivery_date: [{required: true, message: "请输入", trigger: "blur"}],
},
};
},
getListm() {
getMaterialList({pageoff:true,type:1}).then((response) => {
this.productoptions = genTree(response.data);
});
},
getListc() {
getContractList({pageoff:true}).then((response) => {
this.contractoptions = response.data;
});
},
getListcm() {
getCustomerList({pageoff:true}).then((response) => {
this.customeroptions = genTree(response.data);
});
},
selectcontract(selval)
{
getContract(selval).then((response) => {
if (response.data) {
console.log(response.data);
this.order.customer = response.data.customer_.name;
}
});
},
handleFilter() {
this.listQuery.page = 1;
created() {
this.getListm();
this.getListc();
this.getListcm();
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
}
this.getList();
},
handleCreate() {
this.order = Object.assign({}, defaulteorder);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
methods: {
checkPermission,
handleEdit(scope) {
this.order = 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 deleteOrder(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) {
updateOrder(this.order.id, this.order).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
createOrder(this.order).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
getList() {
this.listLoading = true;
getOrderList(this.listQuery).then((response) => {
if (response.data) {
this.orderList = response.data;
}
} else {
return false;
}
});
this.listLoading = false;
});
},
getListm() {
getMaterialList({pageoff: true, type: 1}).then((response) => {
this.productoptions = genTree(response.data);
});
},
getListc() {
getContractList({pageoff: true}).then((response) => {
this.contractoptions = response.data;
});
},
getListcm() {
getCustomerList({pageoff: true}).then((response) => {
this.customeroptions = genTree(response.data);
});
},
selectcontract(selval) {
getContract(selval).then((response) => {
if (response.data) {
// console.log(response.data);
this.order.customer = response.data.customer_.name;
}
});
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
};
this.getList();
},
handleCreate() {
this.order = Object.assign({}, defaulteorder);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleEdit(scope) {
this.order = 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 deleteOrder(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) {
updateOrder(this.order.id, this.order).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
createOrder(this.order).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
//订单详情
handleDetail(scope) {
this.$router.push({name: "orderdetail", params: {id: scope.row.id},})
}
},
//订单详情
handleDetail(scope){
this.$router.push({name: "orderdetail", params: { id: scope.row.id }, })
}
},
};
};
</script>

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(['sale_create'])"
type="primary"
icon="el-icon-plus"
@click="handleCreate"
>
新增销售发货
</el-button>
<el-input
v-model="listQuery.search"
placeholder="客户名称"
@ -17,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>
@ -38,82 +45,73 @@
height="100"
v-el-height-adaptive-table="{ bottomOffset: 42 }"
>
<el-table-column type="index" width="50" />
<el-table-column type="index" width="50"/>
<el-table-column label="产品名称" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.product">{{
scope.row.product_.name
}}</template>
<template slot-scope="scope" v-if="scope.row.product">
{{scope.row.product_.name}}
</template>
</el-table-column>
<el-table-column label="产品型号" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.product">{{
scope.row.product_.specification
}}</template>
<template slot-scope="scope" v-if="scope.row.product">
{{scope.row.product_.specification}}
</template>
</el-table-column>
<el-table-column label="客户名称" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.customer">{{
scope.row.customer_.name
}}</template>
<template slot-scope="scope" v-if="scope.row.customer">
{{scope.row.customer_.name}}
</template>
</el-table-column>
<el-table-column label="订单编号" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.order">{{
scope.row.order_.number
}}</template>
<template slot-scope="scope" v-if="scope.row.order">
{{scope.row.order_.number }}
</template>
</el-table-column>
<el-table-column label="合同名称" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.order_">{{
scope.row.order_.contract_.name
}}</template>
<template slot-scope="scope" v-if="scope.row.order_">
{{scope.row.order_.contract_.name}}
</template>
</el-table-column>
<el-table-column label="预计发货时间">
<template slot-scope="scope">{{ scope.row.edelivery_date }}</template>
<el-table-column label="预计发货时间" prop="edelivery_date">
</el-table-column>
<el-table-column label="预计发货数量">
<template slot-scope="scope">{{ scope.row.count }}</template>
<el-table-column label="预计发货数量" prop="count">
</el-table-column>
<el-table-column label="实际发货数量">
<template slot-scope="scope">{{ scope.row.count_real }}</template>
<el-table-column label="实际发货数量" prop="count_real">
</el-table-column>
<el-table-column label="是否审核">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_audited == false"></el-tag>
<el-tag v-else></el-tag></template
>
<el-tag v-else></el-tag>
</template>
</el-table-column>
<el-table-column label="收货人">
<template slot-scope="scope">{{ scope.row.receiver }}</template>
<el-table-column label="收货人" prop="receiver">
</el-table-column>
<el-table-column label="收货人电话">
<template slot-scope="scope">{{ scope.row.receiver_phone }}</template>
<el-table-column label="收货人电话" prop="receiver_phone">
</el-table-column>
<el-table-column label="收货人地址" show-overflow-tooltip>
<template slot-scope="scope">{{
scope.row.receiver_address
}}</template>
<el-table-column label="收货人地址" prop="receiver_address" show-overflow-tooltip>
</el-table-column>
<el-table-column label="操作" fixed="right">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_delete'])"
v-if="checkPermission(['sale_create'])"
type="primary"
@click="handleDetail(scope)"
>详情</el-link
>
详情
</el-link>
<el-link
v-if="scope.row.is_audited == false"
v-if="checkPermission(['sale_hear'])&&scope.row.is_audited == false"
type="primary"
@click="handleAudit(scope)"
>审核</el-link
>
审核
</el-link>
<el-link
v-if="scope.row.is_audited == false"
v-if="checkPermission(['sale_delete'])&&scope.row.is_audited == false"
type="danger"
@click="handleDelete(scope)"
>删除</el-link
>
删除
</el-link>
</template>
</el-table-column>
</el-table>
@ -139,10 +137,10 @@
>
<el-form-item label="关联订单" prop="name">
<el-select
style="width: 100%"
v-model="sale.order"
@change="selectorder"
style="width: 100%"
placeholder="请选择"
@change="selectorder"
>
<el-option
v-for="item in orderoptions"
@ -153,14 +151,13 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="关联客户" prop="customer" >
<el-form-item label="关联客户" prop="customer">
<el-select
style="width: 100%"
v-model="sale.customer"
@change="selectcustomer"
style="width: 100%"
placeholder="请选择"
:disabled="show"
:disabled="show"
@change="selectcustomer"
>
<el-option
v-for="item in customeroptions"
@ -171,18 +168,17 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="关联合同" prop="contract">
<el-input v-model="sale.contract" placeholder="关联合同" :disabled="edit"/>
<el-form-item label="关联合同" prop="contract">
<el-input v-model="sale.contract" placeholder="关联合同" :disabled="edit"/>
</el-form-item>
<el-form-item label="所需产品" prop="product">
<el-select
:disabled="show"
style="width: 100%"
v-model="sale.product"
@change="selectproduct"
placeholder="请选择"
ref="btn"
v-model="sale.product"
:disabled="show"
style="width: 100%"
placeholder="请选择"
@change="selectproduct"
>
<el-option
v-for="item in materialoptions"
@ -193,46 +189,41 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="选择产品" prop="iproducts">
<el-table
ref="multipleTable"
:data="iproductoptions"
border
fit
stripe
highlight-current-row
ref="multipleTable"
height="200"
>
<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 type="selection" width="55"></el-table-column>
<el-table-column type="index" width="50"/>
<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="成品名称">
<template slot-scope="scope">{{
scope.row.material_.name
}}</template>
<template slot-scope="scope">
{{scope.row.material_.name}}
</template>
</el-table-column>
<el-table-column label="所在仓库">
<template slot-scope="scope">{{
scope.row.warehouse_.name
}}</template>
<template slot-scope="scope">
{{scope.row.warehouse_.name}}
</template>
</el-table-column>
<el-table-column label="是否已军检">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_mtested == false">未军检</el-tag>
<el-tag v-else>已军检</el-tag></template
>
<el-tag v-else>已军检</el-tag>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item label="预计发货时间" prop="edelivery_date">
<el-date-picker
v-model="sale.edelivery_date"
@ -261,7 +252,7 @@
</el-form-item>
<el-form-item label="收货人" prop="receiver">
<el-input v-model="sale.receiver" placeholder="收货人" />
<el-input v-model="sale.receiver" placeholder="收货人"/>
</el-form-item>
<el-form-item label="联系电话" prop="receiver_phone">
<el-input
@ -270,11 +261,11 @@
/>
</el-form-item>
<el-form-item label="收货地址" prop="receiver_address">
<el-input v-model="sale.receiver_address" placeholder="收货地址" />
<el-input v-model="sale.receiver_address" placeholder="收货地址"/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="sale.remark" placeholder="备注" />
<el-input v-model="sale.remark" placeholder="备注"/>
</el-form-item>
</el-form>
@ -286,296 +277,293 @@
</div>
</template>
<script>
import {
createSale,
getOrderList,
getCustomerList,
getSaleList,
getOrder,
deleteSale,
getSale,
saleAudit,
getCustomer
} from "@/api/sam";
import checkPermission from "@/utils/permission";
import { getMaterialList } from "@/api/mtm";
import { getiproductList } from "@/api/inm";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaulteSale = {
order: null,
customer: null,
contract:"",
product: null,
edelivery_date: "",
trans_mode: null,
receiver: "",
receiver_phone: "",
receiver_address: "",
remark: "",
};
export default {
components: { Pagination },
data() {
return {
sale: defaulteSale,
saleList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
iproducts: [],
orderoptions: [],
customeroptions: [],
materialoptions: [],
iproductoptions: [],
dialogVisible: false,
show:false,
edit:true,
dialogType: "new",
options: [
{
value: 10,
label: "铁路快运",
import {
createSale,
getOrderList,
getCustomerList,
getSaleList,
getOrder,
deleteSale,
getSale,
saleAudit,
getCustomer,
updateContract
} from "@/api/sam";
import checkPermission from "@/utils/permission";
import {getMaterialList} from "@/api/mtm";
import {getiproductList} from "@/api/inm";
// import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaulteSale = {
order: null,
customer: null,
contract: "",
product: null,
edelivery_date: "",
trans_mode: null,
receiver: "",
receiver_phone: "",
receiver_address: "",
remark: "",
};
export default {
components: {Pagination},
data() {
return {
sale: defaulteSale,
saleList: {
count: 0,
},
{
value: 20,
label: "铁路慢运",
listQuery: {
page: 1,
page_size: 20,
},
{
value: 30,
label: "铁路整车",
},
{
value: 40,
label: "汽车运输",
},
{
value: 50,
label: "空运",
},
],
};
},
computed: {},
watch: {},
created() {
this.getList();
this.getCustomerLists();
// this.getproductList();
this.getOrderLists();
this.getMaterialList();
},
methods: {
checkPermission,
//关联订单
getOrderLists() {
getOrderList({ page: 0 }).then((response) => {
if (response.data) {
this.orderoptions = response.data;
}
});
},
//选择订单变化
selectorder(selval) {
getOrder(selval).then((response) => {
if (response.data) {
this.show=true;
this.sale.customer = response.data.customer;
this.sale.product = response.data.product;
this.sale.contract = response.data.contract_.name;
this.sale.receiver = response.data.customer_.contact;
this.sale.receiver_phone = response.data.customer_.contact_phone;
this.sale.receiver_address = response.data.customer_.address;
getiproductList({
page: 0,
to_order: response.data.id,
state: 10,
}).then((response) => {
if (response.data) {
this.iproductoptions = response.data;
}
});
}
});
},
selectcustomer(selval)
{
getCustomer(selval).then((response) => {
if (response.data) {
this.sale.receiver = response.data.contact;
this.sale.receiver_phone = response.data.contact_phone;
this.sale.receiver_address = response.data.address;
}
});
},
getList() {
getSaleList(this.listQuery).then((response) => {
if (response.data) {
this.saleList = response.data;
}
});
},
//关联客户
getCustomerLists() {
getCustomerList({ page: 0 }).then((response) => {
this.customeroptions = response.data;
});
},
//选择产品
getMaterialList() {
getMaterialList({ type: 1, page: 0 }).then((response) => {
if (response.data) {
this.materialoptions = response.data;
}
});
},
//成品
// getproductList() {
// getiproductList({page:0,material__type:1}).then((response) => {
// if (response.data) {
// this.iproductoptions=response.data;
// }
// });
// },
//根据选择的产品弹出对应库里的产品
selectproduct() {
getiproductList({
page: 0,
material__type: 1,
material: this.sale.product,
}).then((response) => {
if (response.data) {
this.iproductoptions = response.data;
}
});
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
iproducts: [],
orderoptions: [],
customeroptions: [],
materialoptions: [],
iproductoptions: [],
dialogVisible: false,
show: false,
edit: true,
dialogType: "new",
options: [
{
value: 10,
label: "铁路快运",
},
{
value: 20,
label: "铁路慢运",
},
{
value: 30,
label: "铁路整车",
},
{
value: 40,
label: "汽车运输",
},
{
value: 50,
label: "空运",
},
],
};
},
computed: {},
watch: {},
created() {
this.getList();
this.getCustomerLists();
// this.getproductList();
this.getOrderLists();
this.getMaterialList();
},
handleCreate() {
this.sale = Object.assign({}, defaulteSale);
this.dialogType = "new";
this.dialogVisible = true;
this.iproducts = [];
this.$nextTick(() => {
this.$refs["Form"].resetFields();
this.iproductoptions = [];
});
},
handleEdit(scope) {
this.sale = Object.assign({}, scope.row); // copy obj
console.log(this.sale);
this.dialogType = "edit";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].resetFields();
});
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteSale(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
methods: {
checkPermission,
//关联订单
getOrderLists() {
getOrderList({page: 0}).then((response) => {
if (response.data) {
this.orderoptions = response.data;
}
});
},
},
//选择订单变化
async confirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
updateContract(this.sale.id, this.sale).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
this.$refs.multipleTable.selection.forEach((item) => {
this.iproducts.push(item.id);
});
selectorder(selval) {
this.sale.iproducts = this.iproducts;
createSale(this.sale).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
getOrder(selval).then((response) => {
if (response.data) {
this.show = true;
this.sale.customer = response.data.customer;
this.sale.product = response.data.product;
this.sale.contract = response.data.contract_.name;
this.sale.receiver = response.data.customer_.contact;
this.sale.receiver_phone = response.data.customer_.contact_phone;
this.sale.receiver_address = response.data.customer_.address;
getiproductList({
page: 0,
to_order: response.data.id,
state: 10,
}).then((response) => {
if (response.data) {
this.iproductoptions = response.data;
}
});
}
} else {
return false;
}
});
},
//销售详情
handleDetail(scope) {
this.$router.push({ name: "salesdetail", params: { id: scope.row.id } });
},
//审核
handleAudit(scope) {
this.$confirm("确认审核?", "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "success",
})
.then(async () => {
await saleAudit(scope.row.id);
this.getList();
this.$message.success("审核成功!");
})
.catch((err) => {
console.error(err);
});
},
selectcustomer(selval) {
getCustomer(selval).then((response) => {
if (response.data) {
this.sale.receiver = response.data.contact;
this.sale.receiver_phone = response.data.contact_phone;
this.sale.receiver_address = response.data.address;
}
});
},
getList() {
getSaleList(this.listQuery).then((response) => {
if (response.data) {
this.saleList = response.data;
}
});
},
//关联客户
getCustomerLists() {
getCustomerList({page: 0}).then((response) => {
this.customeroptions = response.data;
});
},
//选择产品
getMaterialList() {
getMaterialList({type: 1, page: 0}).then((response) => {
if (response.data) {
this.materialoptions = response.data;
}
});
},
//成品
// getproductList() {
// getiproductList({page:0,material__type:1}).then((response) => {
// if (response.data) {
// this.iproductoptions=response.data;
// }
// });
// },
//根据选择的产品弹出对应库里的产品
selectproduct() {
getiproductList({
page: 0,
material__type: 1,
material: this.sale.product,
}).then((response) => {
if (response.data) {
this.iproductoptions = response.data;
}
});
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
};
this.getList();
},
handleCreate() {
this.sale = Object.assign({}, defaulteSale);
this.dialogType = "new";
this.dialogVisible = true;
this.iproducts = [];
this.$nextTick(() => {
this.$refs["Form"].resetFields();
this.iproductoptions = [];
});
},
handleEdit(scope) {
this.sale = Object.assign({}, scope.row); // copy obj
// console.log(this.sale);
this.dialogType = "edit";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].resetFields();
});
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteSale(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) {
updateContract(this.sale.id, this.sale).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
this.$refs.multipleTable.selection.forEach((item) => {
this.iproducts.push(item.id);
});
this.sale.iproducts = this.iproducts;
createSale(this.sale).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
//销售详情
handleDetail(scope) {
this.$router.push({name: "salesdetail", params: {id: scope.row.id}});
},
//审核
handleAudit(scope) {
this.$confirm("确认审核?", "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "success",
})
.then(async () => {
await saleAudit(scope.row.id);
this.getList();
this.$message.success("审核成功!");
})
.catch((err) => {
this.$message.error(err);
});
},
},
},
};
};
</script>
<style scoped>
.trdiv >>> .el-transfer-panel {
width: 350px;
}
.trdiv >>> .el-transfer__buttons {
width: 110px;
}
.trdiv >>> .el-transfer-panel {
width: 350px;
}
.trdiv >>> .el-transfer__buttons {
width: 110px;
}
</style>