yemianqunaxiananniutinajia
This commit is contained in:
parent
8dcaec8003
commit
544478dc0b
|
@ -13,46 +13,38 @@
|
||||||
border
|
border
|
||||||
v-el-height-adaptive-table="{ bottomOffset: 41 }"
|
v-el-height-adaptive-table="{ bottomOffset: 41 }"
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50" label="序号" />
|
<el-table-column type="index" width="50" label="序号"/>
|
||||||
<el-table-column align="center" label="工号">
|
<el-table-column align="center" prop="number" label="工号">
|
||||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="姓名">
|
<el-table-column align="center" prop="name" label="姓名">
|
||||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="到岗情况">
|
<el-table-column align="center" label="到岗情况">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag type="success" v-if="scope.row.is_atwork">在岗</el-tag>
|
<el-tag type="success" v-if="scope.row.is_atwork">在岗</el-tag>
|
||||||
|
|
||||||
<el-tag type="danger" v-else>离岗</el-tag>
|
<el-tag type="danger" v-else>离岗</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="离岗备注">
|
<el-table-column align="center" prop="not_work_remark" label="离岗备注">
|
||||||
<template slot-scope="scope">{{
|
|
||||||
scope.row.not_work_remark
|
|
||||||
}}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="打卡时间">
|
<el-table-column align="center" prop="last_check_time" label="打卡时间">
|
||||||
<template slot-scope="scope">{{ scope.row.last_check_time }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="header-center" label="部门">
|
<el-table-column align="header-center" label="部门">
|
||||||
<template v-if="scope.row.dept_" slot-scope="scope">{{
|
<template v-if="scope.row.dept_" slot-scope="scope">
|
||||||
scope.row.dept_.name
|
{{scope.row.dept_.name}}
|
||||||
}}</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="操作" fixed="right">
|
<el-table-column align="center" label="操作" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-link
|
<el-link
|
||||||
|
v-if="checkPermission(['employee_notworkremark'])&&scope.row.is_atwork == false"
|
||||||
type="primary"
|
type="primary"
|
||||||
v-if="scope.row.is_atwork == false"
|
|
||||||
@click="handlestopwork(scope)"
|
@click="handlestopwork(scope)"
|
||||||
>离岗说明
|
>
|
||||||
|
离岗说明
|
||||||
</el-link>
|
</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination
|
||||||
v-show="userList.count > 0"
|
v-show="userList.count > 0"
|
||||||
:total="userList.count"
|
:total="userList.count"
|
||||||
|
@ -60,7 +52,6 @@
|
||||||
:limit.sync="listQuery.page_size"
|
:limit.sync="listQuery.page_size"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<el-dialog
|
<el-dialog
|
||||||
:visible.sync="dialogVisible"
|
:visible.sync="dialogVisible"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
|
@ -74,17 +65,25 @@
|
||||||
>
|
>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input
|
<el-input
|
||||||
type="textarea"
|
|
||||||
v-model="stopwork.not_work_remark"
|
v-model="stopwork.not_work_remark"
|
||||||
|
type="textarea"
|
||||||
placeholder="备注"
|
placeholder="备注"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="text-align: right">
|
<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>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
@ -99,7 +98,12 @@
|
||||||
placeholder="选择年月"
|
placeholder="选择年月"
|
||||||
>
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
<el-button type="primary" @click="submit">查询</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="submit"
|
||||||
|
>
|
||||||
|
查询
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-table
|
<el-table
|
||||||
:data="atworkList"
|
:data="atworkList"
|
||||||
|
@ -112,35 +116,25 @@
|
||||||
@current-change="handleCurrentChange"
|
@current-change="handleCurrentChange"
|
||||||
v-el-height-adaptive-table="{ bottomOffset: 41 }"
|
v-el-height-adaptive-table="{ bottomOffset: 41 }"
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50" label="序号" />
|
<el-table-column type="index" width="50" label="序号"/>
|
||||||
<el-table-column align="center" label="工号">
|
<el-table-column align="center" prop="number" label="工号">
|
||||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="姓名">
|
<el-table-column align="center" prop="name" label="姓名">
|
||||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column align="header-center" prop="dept_name" label="部门">
|
||||||
<el-table-column align="header-center" label="部门">
|
|
||||||
<template slot-scope="scope">{{
|
|
||||||
scope.row.dept_name
|
|
||||||
}}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="出勤天数">
|
<el-table-column align="center" prop="count" label="出勤天数">
|
||||||
<template slot-scope="scope">{{ scope.row.count }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="应到天数">
|
<el-table-column align="center" prop="count_workday" label="应到天数">
|
||||||
<template slot-scope="scope">{{
|
|
||||||
scope.row.count_workday
|
|
||||||
}}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-calendar v-model="value">
|
<el-calendar v-model="value">
|
||||||
<template slot="dateCell" slot-scope="{ date, data }">
|
<template slot="dateCell" slot-scope="{ date, data }">
|
||||||
<p >
|
<p>
|
||||||
{{ data.day.split("-").slice(1).join("-") }}<br />
|
{{ data.day.split("-").slice(1).join("-") }}<br/>
|
||||||
{{ dealMyDate(data.day) }}
|
{{ dealMyDate(data.day) }}
|
||||||
</p>
|
</p>
|
||||||
</template>
|
</template>
|
||||||
</el-calendar>
|
</el-calendar>
|
||||||
|
@ -152,155 +146,158 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style>
|
<style>
|
||||||
.avatar-uploader .el-upload {
|
.avatar-uploader .el-upload {
|
||||||
border: 1px dashed #d9d9d9;
|
border: 1px dashed #d9d9d9;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.avatar-uploader .el-upload:hover {
|
|
||||||
border-color: #409eff;
|
.avatar-uploader .el-upload:hover {
|
||||||
}
|
border-color: #409eff;
|
||||||
.avatar-uploader-icon {
|
}
|
||||||
font-size: 28px;
|
|
||||||
color: #8c939d;
|
.avatar-uploader-icon {
|
||||||
width: 100px;
|
font-size: 28px;
|
||||||
height: 100px;
|
color: #8c939d;
|
||||||
line-height: 100px;
|
width: 100px;
|
||||||
text-align: center;
|
height: 100px;
|
||||||
}
|
line-height: 100px;
|
||||||
.avatar {
|
text-align: center;
|
||||||
width: 100px;
|
}
|
||||||
height: 100px;
|
|
||||||
display: block;
|
.avatar {
|
||||||
}
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
import { getEmployeeList } from "@/api/employee";
|
import {getEmployeeList} from "@/api/employee";
|
||||||
import checkPermission from "@/utils/permission";
|
import checkPermission from "@/utils/permission";
|
||||||
import { notWork, getNotWorkList ,getClockrecordList} from "@/api/hrm";
|
import {notWork, getNotWorkList, getClockrecordList} from "@/api/hrm";
|
||||||
|
|
||||||
import { getatwork } from "@/api/srm";
|
import {getatwork} from "@/api/srm";
|
||||||
import { upUrl, upHeaders } from "@/api/file";
|
import {upUrl, upHeaders} from "@/api/file";
|
||||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||||
import Treeselect from "@riophae/vue-treeselect";
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { Pagination, Treeselect },
|
components: {Pagination, Treeselect},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
userList: { count: 0 },
|
userList: {count: 0},
|
||||||
atworkList: [],
|
atworkList: [],
|
||||||
stopwork: { not_work_remark: "" },
|
stopwork: {not_work_remark: ""},
|
||||||
value3: null,
|
value3: null,
|
||||||
value2: null,
|
value2: null,
|
||||||
listLoading: true,
|
listLoading: true,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
stopworkID: null,
|
stopworkID: null,
|
||||||
notworkList: "",
|
notworkList: "",
|
||||||
listQuery: {
|
listQuery: {
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: 20,
|
page_size: 20,
|
||||||
},
|
},
|
||||||
resDate: [
|
resDate: [
|
||||||
{ date: "2022-02-20", content: "放假" },
|
{date: "2022-02-20", content: "放假"},
|
||||||
{ date: "2022-02-26", content: "去交电费" },
|
{date: "2022-02-26", content: "去交电费"},
|
||||||
{ date: "2022-02-25", content: "去学习vue" },
|
{date: "2022-02-25", content: "去学习vue"},
|
||||||
],
|
],
|
||||||
atworkDate: { year: null, month: null },
|
atworkDate: {year: null, month: null},
|
||||||
value: new Date(),
|
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;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
handlestopwork(scope) {
|
computed: {},
|
||||||
this.dialogVisible = true;
|
watch: {},
|
||||||
this.stopworkID = scope.row.id;
|
created() {
|
||||||
|
this.getList();
|
||||||
},
|
},
|
||||||
handleCurrentChange(row) {
|
methods: {
|
||||||
this.resDate=[],
|
checkPermission,
|
||||||
getNotWorkList({page:0,user:row.user_id}).then((response) => {
|
//今日到岗
|
||||||
if (response.data) {
|
getList() {
|
||||||
response.data.forEach((item) => {
|
this.listQuery.fields = "number,name,is_atwork,dept_,id,not_work_remark,last_check_time";
|
||||||
this.resDate.push({
|
getEmployeeList(this.listQuery).then((response) => {
|
||||||
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) => {
|
|
||||||
if (response.data) {
|
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++) {
|
getClockrecordList({page: 0, create_by: row.user_id}).then((response) => {
|
||||||
if (this.resDate[i].data == v) {
|
if (response.data) {
|
||||||
res = this.resDate[i].content;
|
|
||||||
break;
|
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>
|
</script>
|
||||||
|
|
|
@ -1,249 +1,249 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
<el-card>
|
||||||
<el-card>
|
<div>
|
||||||
|
<el-input
|
||||||
<div>
|
v-model="listQuery.name"
|
||||||
|
placeholder="姓名"
|
||||||
<el-input
|
style="width: 200px;"
|
||||||
v-model="listQuery.name"
|
class="filter-item"
|
||||||
placeholder="姓名"
|
@keyup.enter.native="handleFilter"
|
||||||
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>
|
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style>
|
<style>
|
||||||
.avatar-uploader .el-upload {
|
.avatar-uploader .el-upload {
|
||||||
border: 1px dashed #d9d9d9;
|
border: 1px dashed #d9d9d9;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.avatar-uploader .el-upload:hover {
|
|
||||||
border-color: #409eff;
|
.avatar-uploader .el-upload:hover {
|
||||||
}
|
border-color: #409eff;
|
||||||
.avatar-uploader-icon {
|
}
|
||||||
font-size: 28px;
|
|
||||||
color: #8c939d;
|
.avatar-uploader-icon {
|
||||||
width: 100px;
|
font-size: 28px;
|
||||||
height: 100px;
|
color: #8c939d;
|
||||||
line-height: 100px;
|
width: 100px;
|
||||||
text-align: center;
|
height: 100px;
|
||||||
}
|
line-height: 100px;
|
||||||
.avatar {
|
text-align: center;
|
||||||
width: 100px;
|
}
|
||||||
height: 100px;
|
|
||||||
display: block;
|
.avatar {
|
||||||
}
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<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";
|
const defaultUser = {
|
||||||
import { getOrgAll } from "@/api/org"
|
id: "",
|
||||||
import { getRoleAll } from "@/api/role"
|
name: "",
|
||||||
import { genTree } from "@/utils"
|
username: "",
|
||||||
import checkPermission from "@/utils/permission"
|
dept: null,
|
||||||
import { upUrl, upHeaders } from "@/api/file"
|
avatar: "/media/default/avatar.png"
|
||||||
import Pagination from "@/components/Pagination" // secondary package based on el-pagination
|
};
|
||||||
import Treeselect from '@riophae/vue-treeselect'
|
export default {
|
||||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
components: {Pagination},
|
||||||
const defaultUser = {
|
data() {
|
||||||
id: "",
|
return {
|
||||||
name: "",
|
user: defaultUser,
|
||||||
username: "",
|
upHeaders: upHeaders(),
|
||||||
dept: null,
|
upUrl: upUrl(),
|
||||||
avatar: "/media/default/avatar.png"
|
userList: {count: 0},
|
||||||
};
|
roles: [],
|
||||||
export default {
|
listLoading: true,
|
||||||
components: { Pagination, Treeselect },
|
listQuery: {
|
||||||
data() {
|
page: 1,
|
||||||
return {
|
page_size: 20
|
||||||
user: defaultUser,
|
},
|
||||||
upHeaders: upHeaders(),
|
enabledOptions: [
|
||||||
upUrl: upUrl(),
|
{key: "true", display_name: "激活"},
|
||||||
userList: {count:0},
|
{key: "false", display_name: "禁用"}
|
||||||
roles: [],
|
],
|
||||||
listLoading: true,
|
dialogVisible: false,
|
||||||
listQuery: {
|
dialogType: "new",
|
||||||
page: 1,
|
rule1: {
|
||||||
page_size: 20
|
name: [{required: true, message: "请输入姓名", trigger: "blur"}],
|
||||||
},
|
username: [{required: true, message: "请输入账号", trigger: "change"}]
|
||||||
enabledOptions: [
|
},
|
||||||
{ key: "true", display_name: "激活" },
|
filterOrgText: "",
|
||||||
{ key: "false", display_name: "禁用" }
|
treeLoding: false,
|
||||||
],
|
orgData: []
|
||||||
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
|
|
||||||
};
|
};
|
||||||
this.getList();
|
|
||||||
},
|
},
|
||||||
handleFilter() {
|
computed: {},
|
||||||
this.listQuery.page = 1;
|
watch: {
|
||||||
this.getList();
|
filterOrgText(val) {
|
||||||
|
this.$refs.tree.filter(val);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
|
||||||
handleEdit(scope) {
|
|
||||||
this.$router.push({name:"userupdate",params:{id:scope.row.id}})
|
|
||||||
},
|
},
|
||||||
handleDelete(scope) {
|
methods: {
|
||||||
this.$confirm("确认删除?", "警告", {
|
checkPermission,
|
||||||
confirmButtonText: "确认",
|
handleAvatarSuccess(res) {
|
||||||
cancelButtonText: "取消",
|
this.user.avatar = res.data.path
|
||||||
type: "error"
|
},
|
||||||
})
|
|
||||||
.then(async () => {
|
beforeAvatarUpload(file) {
|
||||||
await deleteUser(scope.row.id);
|
const isLt2M = file.size / 1024 / 1024 < 0.5;
|
||||||
this.userList.splice(scope.row.index, 1);
|
if (!isLt2M) {
|
||||||
this.$message({
|
this.$message.error("上传头像图片大小不能超过 500KB!");
|
||||||
type: "success",
|
}
|
||||||
message: "成功删除!"
|
return isLt2M;
|
||||||
});
|
},
|
||||||
})
|
|
||||||
.catch(err => {
|
filterNode(value, data) {
|
||||||
console.error(err);
|
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>
|
</script>
|
||||||
|
|
|
@ -1,289 +1,242 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
|
||||||
<el-card>
|
<el-card>
|
||||||
<el-tabs v-model="activeName" type="card">
|
<el-tabs v-model="activeName" type="card">
|
||||||
<el-tab-pane label="待军检" name="first">
|
<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-button>
|
||||||
<el-table
|
<el-table
|
||||||
|
ref="multipleTable"
|
||||||
:data="iproductData.results"
|
:data="iproductData.results"
|
||||||
ref="multipleTable"
|
border
|
||||||
border
|
fit
|
||||||
fit
|
stripe
|
||||||
stripe
|
highlight-current-row
|
||||||
highlight-current-row
|
max-height="700"
|
||||||
max-height="700"
|
height="100"
|
||||||
height="100"
|
v-el-height-adaptive-table="{bottomOffset: 42}"
|
||||||
v-el-height-adaptive-table="{bottomOffset: 42}"
|
>
|
||||||
>
|
<el-table-column type="selection" width="55"></el-table-column>
|
||||||
<el-table-column type="selection" width="55"> </el-table-column>
|
<el-table-column type="index" width="50"/>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column label="成品编号" prop="number">
|
||||||
<el-table-column label="成品编号">
|
</el-table-column>
|
||||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
<el-table-column label="成品批次" prop="batch">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="成品名称">
|
||||||
<el-table-column label="成品批次">
|
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
|
||||||
<template slot-scope="scope">{{ scope.row.batch }}</template>
|
</el-table-column>
|
||||||
</el-table-column>
|
<el-table-column label="所在仓库">
|
||||||
<el-table-column label="成品名称">
|
<template slot-scope="scope">{{ scope.row.warehouse_.name }}</template>
|
||||||
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table>
|
||||||
|
<pagination
|
||||||
<el-table-column label="所在仓库">
|
v-show="iproductData.count > 0"
|
||||||
<template slot-scope="scope">{{ scope.row.warehouse_.name }}</template>
|
:total="iproductData.count"
|
||||||
</el-table-column>
|
:page.sync="listQuery.page"
|
||||||
|
:limit.sync="listQuery.page_size"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
</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>
|
||||||
<el-tab-pane label="军检列表" name="second">
|
<el-tab-pane label="军检列表" name="second">
|
||||||
<el-table
|
<el-table
|
||||||
|
:data="iproductData2.results"
|
||||||
:data="iproductData2.results"
|
border
|
||||||
border
|
fit
|
||||||
fit
|
stripe
|
||||||
stripe
|
highlight-current-row
|
||||||
highlight-current-row
|
max-height="700"
|
||||||
max-height="700"
|
height="100"
|
||||||
height="100"
|
v-el-height-adaptive-table="{bottomOffset: 42}"
|
||||||
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="成品编号" prop="number">
|
||||||
<el-table-column label="成品编号">
|
</el-table-column>
|
||||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
<el-table-column label="成品批次" prop="batch">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="成品名称">
|
||||||
<el-table-column label="成品批次">
|
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
|
||||||
<template slot-scope="scope">{{ scope.row.batch }}</template>
|
</el-table-column>
|
||||||
</el-table-column>
|
<el-table-column label="所在仓库">
|
||||||
<el-table-column label="成品名称">
|
<template slot-scope="scope">{{ scope.row.warehouse_.name }}</template>
|
||||||
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
|
</el-table-column>
|
||||||
</el-table-column>
|
<el-table-column label="订单">
|
||||||
|
<template slot-scope="scope">
|
||||||
<el-table-column label="所在仓库">
|
<span v-if="scope.row.to_order_">{{scope.row.to_order_.number}}</span>
|
||||||
<template slot-scope="scope">{{ scope.row.warehouse_.name }}</template>
|
<el-tag v-else-if="scope.row.to_order_ == null && scope.row.need_to_order == true">
|
||||||
</el-table-column>
|
需要确定订单
|
||||||
|
</el-tag>
|
||||||
<el-table-column label="订单">
|
<span v-else></span>
|
||||||
<template slot-scope="scope">
|
</template>
|
||||||
<span v-if="scope.row.to_order_">{{
|
</el-table-column>
|
||||||
scope.row.to_order_.number
|
<el-table-column label="合同">
|
||||||
}}</span>
|
<template slot-scope="scope">
|
||||||
<el-tag
|
<span v-if="scope.row.to_order_">{{scope.row.to_order_.contract_.name}}</span>
|
||||||
v-else-if="
|
<span v-else-if="scope.row.to_order_ == null && scope.row.need_to_order == true"></span>
|
||||||
scope.row.to_order_ == null && scope.row.need_to_order == true
|
<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-tag>
|
<el-link
|
||||||
<span v-else></span>
|
v-if="checkPermission(['wp_mtest'])&&scope.row.is_mtestok==null"
|
||||||
</template>
|
@click="handleMtest(scope)"
|
||||||
</el-table-column>
|
>
|
||||||
<el-table-column label="合同">
|
军检
|
||||||
<template slot-scope="scope">
|
</el-link>
|
||||||
<span v-if="scope.row.to_order_">{{
|
</template>
|
||||||
scope.row.to_order_.contract_.name
|
</el-table-column>
|
||||||
}}</span>
|
</el-table>
|
||||||
<span
|
<pagination
|
||||||
v-else-if="
|
v-show="iproductData2.count > 0"
|
||||||
scope.row.to_order_ == null && scope.row.need_to_order == true
|
:total="iproductData2.count"
|
||||||
"
|
:page.sync="listQuery2.page"
|
||||||
>
|
:limit.sync="listQuery2.page_size"
|
||||||
</span>
|
@pagination="getList2"
|
||||||
<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"
|
|
||||||
/>
|
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
<el-dialog
|
||||||
<el-dialog
|
:visible.sync="dialogVisible"
|
||||||
:visible.sync="dialogVisible"
|
:close-on-click-modal="false"
|
||||||
:close-on-click-modal="false"
|
title="军检"
|
||||||
title="军检"
|
|
||||||
>
|
|
||||||
<el-form
|
|
||||||
ref="Form"
|
|
||||||
:model="mtest"
|
|
||||||
label-width="150px"
|
|
||||||
label-position="right"
|
|
||||||
|
|
||||||
>
|
>
|
||||||
|
<el-form
|
||||||
|
ref="Form"
|
||||||
|
:model="mtest"
|
||||||
|
label-width="150px"
|
||||||
|
label-position="right"
|
||||||
|
>
|
||||||
<el-form-item label="军检是否合格">
|
<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-form-item>
|
||||||
<el-radio v-model="mtest.is_mtestok" label=False >不合格</el-radio>
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="mtest.remark_mtest" placeholder="备注"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="remark">
|
</el-form>
|
||||||
<el-input v-model="mtest.remark_mtest" placeholder="备注" />
|
<div style="text-align: right">
|
||||||
</el-form-item>
|
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="smtconfirm('Form')">确认</el-button>
|
||||||
</el-form>
|
</div>
|
||||||
<div style="text-align: right">
|
</el-dialog>
|
||||||
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
|
||||||
<el-button type="primary" @click="smtconfirm('Form')">确认</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getiproductList,saleMtest} from "@/api/inm";
|
import {getiproductList} from "@/api/inm";
|
||||||
import checkPermission from "@/utils/permission";
|
import checkPermission from "@/utils/permission";
|
||||||
import { mtest, needtoorder, } from "@/api/wpm";
|
import {mtest, needtoorder,} from "@/api/wpm";
|
||||||
import { genTree } from "@/utils";
|
// import {genTree} from "@/utils";
|
||||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { Pagination },
|
components: {Pagination},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
iproductData: {
|
||||||
iproductData: {
|
count: 0,
|
||||||
count: 0,
|
},
|
||||||
},
|
listQuery: {
|
||||||
listQuery: {
|
page: 1,
|
||||||
page: 1,
|
page_size: 20,
|
||||||
page_size: 20,
|
},
|
||||||
},
|
iproductData2: {
|
||||||
iproductData2: {
|
count: 0,
|
||||||
count: 0,
|
},
|
||||||
},
|
listQuery2: {
|
||||||
listQuery2: {
|
page: 1,
|
||||||
page: 1,
|
page_size: 20,
|
||||||
page_size: 20,
|
},
|
||||||
},
|
mtest: {},
|
||||||
mtest: {},
|
salesdetail: "",
|
||||||
salesdetail:"",
|
saleproduct: "",
|
||||||
saleproduct:"",
|
dialogVisible: false,
|
||||||
dialogVisible:false,
|
activeName: 'first',
|
||||||
activeName: 'first',
|
mutipID1: [],
|
||||||
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;
|
|
||||||
},
|
},
|
||||||
smtconfirm(){
|
created() {
|
||||||
|
this.getList();
|
||||||
mtest(this.saleproduct,this.mtest).then((res) => {
|
this.getList2();
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
});
|
methods: {
|
||||||
needtoorder({
|
checkPermission,
|
||||||
wproducts: this.mutipID1,
|
getList() {
|
||||||
}).then((res) => {
|
this.listQuery.material__type = 1;
|
||||||
if (res.code >= 200) {
|
this.listQuery.need_to_order = false;
|
||||||
this.$message.success("申请成功!");
|
getiproductList(this.listQuery).then((response) => {
|
||||||
this.getList();
|
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>
|
</script>
|
||||||
|
|
|
@ -2,70 +2,67 @@
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-card>
|
<el-card>
|
||||||
<div>
|
<div>
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
<el-button
|
||||||
>新增合同</el-button
|
v-if="checkPermission(['contract_create'])"
|
||||||
>
|
type="primary"
|
||||||
<el-input
|
icon="el-icon-plus"
|
||||||
v-model="listQuery.search"
|
@click="handleCreate"
|
||||||
placeholder="客户名称"
|
>
|
||||||
style="width: 300px"
|
新增合同
|
||||||
class="filter-item"
|
</el-button>
|
||||||
@keyup.enter.native="handleFilter"
|
<el-input
|
||||||
/>
|
v-model="listQuery.search"
|
||||||
<el-button
|
placeholder="客户名称"
|
||||||
class="filter-item"
|
style="width: 300px"
|
||||||
type="primary"
|
class="filter-item"
|
||||||
icon="el-icon-search"
|
@keyup.enter.native="handleFilter"
|
||||||
@click="handleFilter"
|
/>
|
||||||
>搜索</el-button
|
<el-button
|
||||||
>
|
class="filter-item"
|
||||||
<el-button
|
type="primary"
|
||||||
class="filter-item"
|
icon="el-icon-search"
|
||||||
type="primary"
|
@click="handleFilter"
|
||||||
icon="el-icon-refresh-left"
|
>
|
||||||
@click="resetFilter"
|
搜索
|
||||||
>重置</el-button
|
</el-button>
|
||||||
>
|
<el-button
|
||||||
</div>
|
class="filter-item"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-refresh-left"
|
||||||
|
@click="resetFilter"
|
||||||
|
>
|
||||||
|
重置
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card >
|
<el-card>
|
||||||
<el-table
|
<el-table
|
||||||
v-loading="listLoading"
|
v-loading="listLoading"
|
||||||
:data="contractList.results"
|
:data="contractList.results"
|
||||||
border
|
border
|
||||||
fit
|
fit
|
||||||
stripe
|
stripe
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
height="100"
|
height="100"
|
||||||
v-el-height-adaptive-table="{bottomOffset: 42}"
|
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="合同名称" width="160" show-overflow-tooltip>
|
<el-table-column label="合同名称" prop="name" width="160" show-overflow-tooltip>
|
||||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="合同编号" prop="number" width="160" show-overflow-tooltip>
|
||||||
<el-table-column label="合同编号" width="160" show-overflow-tooltip>
|
|
||||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合同金额(元)" width="120">
|
<el-table-column label="合同金额(元)" prop="amount" width="120">
|
||||||
<template slot-scope="scope">{{ scope.row.amount }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="开票金额(元)" width="120" >
|
<el-table-column label="开票金额(元)" prop="invoice" width="120">
|
||||||
<template slot-scope="scope">{{ scope.row.invoice }}</template>
|
|
||||||
</el-table-column>
|
</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>
|
<template slot-scope="scope">{{ scope.row.customer_.name }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="签订日期" width="120" >
|
<el-table-column label="签订日期" prop="sign_date" width="120">
|
||||||
<template slot-scope="scope">{{ scope.row.sign_date }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="描述" width="130" show-overflow-tooltip>
|
<el-table-column label="描述" prop="description" width="130" show-overflow-tooltip>
|
||||||
<template slot-scope="scope">{{ scope.row.description }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" width="160">
|
<el-table-column label="创建时间" prop="create_time" width="160">
|
||||||
<template slot-scope="scope">{{ scope.row.create_time }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
align="center"
|
align="center"
|
||||||
|
@ -74,27 +71,27 @@
|
||||||
fixed="right"
|
fixed="right"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
|
||||||
<el-link
|
<el-link
|
||||||
v-if="checkPermission(['warehouse_update'])"
|
v-if="checkPermission(['contract_update'])"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="handleEdit(scope)"
|
@click="handleEdit(scope)"
|
||||||
>编辑</el-link
|
|
||||||
>
|
>
|
||||||
|
编辑
|
||||||
|
</el-link>
|
||||||
<el-link
|
<el-link
|
||||||
v-if="checkPermission(['warehouse_delete'])"
|
v-if="checkPermission(['contract_delete'])"
|
||||||
type="danger"
|
type="danger"
|
||||||
@click="handleDelete(scope)"
|
@click="handleDelete(scope)"
|
||||||
>删除</el-link
|
|
||||||
>
|
>
|
||||||
<el-link
|
删除
|
||||||
v-if="checkPermission(['warehouse_delete'])"
|
</el-link>
|
||||||
type="primary"
|
<el-link
|
||||||
|
v-if="checkPermission(['contract_update'])"
|
||||||
|
type="primary"
|
||||||
@click="handleDetail(scope)"
|
@click="handleDetail(scope)"
|
||||||
>详情</el-link
|
|
||||||
>
|
>
|
||||||
|
详情
|
||||||
|
</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -118,19 +115,19 @@
|
||||||
:rules="rule1"
|
:rules="rule1"
|
||||||
>
|
>
|
||||||
<el-form-item label="合同名称" prop="name">
|
<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>
|
||||||
<el-form-item label="合同编号" prop="number">
|
<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>
|
||||||
<el-form-item label="合同金额(元)" prop="amount">
|
<el-form-item label="合同金额(元)" prop="amount">
|
||||||
<el-input v-model="contract.amount" placeholder="合同金额" />
|
<el-input v-model="contract.amount" placeholder="合同金额"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="开票金额(元)" prop="invoice">
|
<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>
|
||||||
<el-form-item label="签订日期" prop="sign_date">
|
<el-form-item label="签订日期" prop="sign_date">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="contract.sign_date"
|
v-model="contract.sign_date"
|
||||||
type="date"
|
type="date"
|
||||||
placeholder="选择日期"
|
placeholder="选择日期"
|
||||||
|
@ -139,20 +136,19 @@
|
||||||
>
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="客户" prop="sign_date">
|
<el-form-item label="客户" prop="sign_date">
|
||||||
<el-select style="width: 100%" v-model="contract.customer" placeholder="请选择">
|
<el-select style="width: 100%" v-model="contract.customer" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in options"
|
v-for="item in options"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value">
|
:value="item.value">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="描述" prop="description">
|
|
||||||
<el-input v-model="contract.description" placeholder="描述" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="描述" prop="description">
|
||||||
|
<el-input v-model="contract.description" placeholder="描述"/>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="text-align: right">
|
<div style="text-align: right">
|
||||||
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
||||||
|
@ -162,137 +158,137 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getContractList, createContract,updateContract,deleteContract,getCustomerList } from "@/api/sam";
|
import {getContractList, createContract, updateContract, deleteContract, getCustomerList} from "@/api/sam";
|
||||||
import checkPermission from "@/utils/permission";
|
import checkPermission from "@/utils/permission";
|
||||||
|
|
||||||
|
|
||||||
import { genTree } from "@/utils";
|
import {genTree} from "@/utils";
|
||||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||||
const defaultecontract = {
|
const defaultecontract = {};
|
||||||
};
|
export default {
|
||||||
export default {
|
components: {Pagination},
|
||||||
components: { Pagination },
|
data() {
|
||||||
data() {
|
return {
|
||||||
return {
|
contract: defaultecontract,
|
||||||
contract: defaultecontract,
|
contractList: {
|
||||||
contractList: {
|
count: 0,
|
||||||
count: 0,
|
},
|
||||||
},
|
listQuery: {
|
||||||
listQuery: {
|
page: 1,
|
||||||
page: 1,
|
page_size: 20,
|
||||||
page_size: 20,
|
},
|
||||||
},
|
options: [],
|
||||||
options:[],
|
listLoading: true,
|
||||||
listLoading: true,
|
dialogVisible: false,
|
||||||
dialogVisible: false,
|
dialogType: "new",
|
||||||
dialogType: "new",
|
rule1: {
|
||||||
rule1: {
|
name: [{required: true, message: "请输入", trigger: "blur"}],
|
||||||
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;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getLists() {
|
created() {
|
||||||
|
this.getLists();
|
||||||
getCustomerList({pageoff:true}).then((response) => {
|
|
||||||
|
|
||||||
this.options = genTree(response.data);
|
|
||||||
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
handleFilter() {
|
|
||||||
this.listQuery.page = 1;
|
|
||||||
this.getList();
|
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) {
|
methods: {
|
||||||
this.contract = Object.assign({}, scope.row); // copy obj
|
checkPermission,
|
||||||
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);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
async confirm(form) {
|
getList() {
|
||||||
this.$refs[form].validate((valid) => {
|
this.listLoading = true;
|
||||||
if (valid) {
|
getContractList(this.listQuery).then((response) => {
|
||||||
const isEdit = this.dialogType === "edit";
|
if (response.data) {
|
||||||
if (isEdit) {
|
this.contractList = response.data;
|
||||||
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 {
|
this.listLoading = false;
|
||||||
return 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>
|
</script>
|
||||||
|
|
|
@ -2,34 +2,40 @@
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-card>
|
<el-card>
|
||||||
<div>
|
<div>
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
<el-button
|
||||||
>新增客户</el-button
|
v-if="checkPermission(['customer_create'])"
|
||||||
>
|
type="primary"
|
||||||
<el-input
|
icon="el-icon-plus"
|
||||||
v-model="listQuery.search"
|
@click="handleCreate"
|
||||||
placeholder="客户名称"
|
>
|
||||||
style="width: 300px"
|
新增客户
|
||||||
class="filter-item"
|
</el-button>
|
||||||
@keyup.enter.native="handleFilter"
|
<el-input
|
||||||
/>
|
v-model="listQuery.search"
|
||||||
<el-button
|
placeholder="客户名称"
|
||||||
class="filter-item"
|
style="width: 300px"
|
||||||
type="primary"
|
class="filter-item"
|
||||||
icon="el-icon-search"
|
@keyup.enter.native="handleFilter"
|
||||||
@click="handleFilter"
|
/>
|
||||||
>搜索</el-button
|
<el-button
|
||||||
>
|
class="filter-item"
|
||||||
<el-button
|
type="primary"
|
||||||
class="filter-item"
|
icon="el-icon-search"
|
||||||
type="primary"
|
@click="handleFilter"
|
||||||
icon="el-icon-refresh-left"
|
>
|
||||||
@click="resetFilter"
|
搜索
|
||||||
>重置</el-button
|
</el-button>
|
||||||
>
|
<el-button
|
||||||
</div>
|
class="filter-item"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-refresh-left"
|
||||||
|
@click="resetFilter"
|
||||||
|
>
|
||||||
|
重置
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card >
|
<el-card>
|
||||||
<el-table
|
<el-table
|
||||||
v-loading="listLoading"
|
v-loading="listLoading"
|
||||||
:data="customerList.results"
|
:data="customerList.results"
|
||||||
|
@ -37,48 +43,41 @@
|
||||||
fit
|
fit
|
||||||
stripe
|
stripe
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
height="100"
|
height="100"
|
||||||
v-el-height-adaptive-table="{bottomOffset: 42}"
|
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="客户名称" width="200" show-overflow-tooltip>
|
<el-table-column label="客户名称" prop="name" width="200" show-overflow-tooltip>
|
||||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="详细地址" prop="address" width="200" show-overflow-tooltip>
|
||||||
<el-table-column label="详细地址" width="200" show-overflow-tooltip>
|
|
||||||
<template slot-scope="scope">{{ scope.row.address }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="联系人" width="130" show-overflow-tooltip>
|
<el-table-column label="联系人" prop="contact" width="130" show-overflow-tooltip>
|
||||||
<template slot-scope="scope">{{ scope.row.contact }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="联系电话" width="130" show-overflow-tooltip>
|
<el-table-column label="联系电话" prop="contact_phone" width="130" show-overflow-tooltip>
|
||||||
<template slot-scope="scope">{{ scope.row.contact_phone }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="描述" width="200" show-overflow-tooltip>
|
<el-table-column label="描述" prop="description" width="200" show-overflow-tooltip>
|
||||||
<template slot-scope="scope">{{ scope.row.description }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" width="160" >
|
<el-table-column label="创建时间" prop="create_time" width="160">
|
||||||
<template slot-scope="scope">{{ scope.row.create_time }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
align="center"
|
align="center"
|
||||||
label="操作"
|
label="操作"
|
||||||
|
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
|
||||||
<el-link
|
<el-link
|
||||||
v-if="checkPermission(['warehouse_update'])"
|
v-if="checkPermission(['customer_update'])"
|
||||||
@click="handleEdit(scope)"
|
|
||||||
type="primary"
|
type="primary"
|
||||||
>编辑</el-link
|
@click="handleEdit(scope)"
|
||||||
>
|
>
|
||||||
|
编辑
|
||||||
|
</el-link>
|
||||||
<el-link
|
<el-link
|
||||||
v-if="checkPermission(['warehouse_delete'])"
|
v-if="checkPermission(['customer_delete'])"
|
||||||
type="danger"
|
type="danger"
|
||||||
@click="handleDelete(scope)"
|
@click="handleDelete(scope)"
|
||||||
>删除</el-link
|
|
||||||
>
|
>
|
||||||
|
删除
|
||||||
|
</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -103,19 +102,19 @@
|
||||||
:rules="rule1"
|
:rules="rule1"
|
||||||
>
|
>
|
||||||
<el-form-item label="客户名称" prop="name">
|
<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>
|
||||||
<el-form-item label="客户地址" prop="address">
|
<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>
|
||||||
<el-form-item label="联系人" prop="contact">
|
<el-form-item label="联系人" prop="contact">
|
||||||
<el-input v-model="customer.contact" placeholder="联系人" />
|
<el-input v-model="customer.contact" placeholder="联系人"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="联系电话" prop="contact_phone">
|
<el-form-item label="联系电话" prop="contact_phone">
|
||||||
<el-input v-model="customer.contact_phone" placeholder="联系电话" />
|
<el-input v-model="customer.contact_phone" placeholder="联系电话"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="描述" prop="description">
|
<el-form-item label="描述" prop="description">
|
||||||
<el-input v-model="customer.description" placeholder="描述" />
|
<el-input v-model="customer.description" placeholder="描述"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
|
@ -127,123 +126,124 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getCustomerList, createCustomer,updateCustomer,deleteCustomer } from "@/api/sam";
|
import {getCustomerList, createCustomer, updateCustomer, deleteCustomer} from "@/api/sam";
|
||||||
import checkPermission from "@/utils/permission";
|
import checkPermission from "@/utils/permission";
|
||||||
|
// import {genTree} from "@/utils";
|
||||||
|
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||||
|
const defaultecustomer = {};
|
||||||
|
|
||||||
|
export default {
|
||||||
import { genTree } from "@/utils";
|
components: {Pagination},
|
||||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
data() {
|
||||||
const defaultecustomer = {
|
return {
|
||||||
};
|
customer: defaultecustomer,
|
||||||
export default {
|
customerList: {
|
||||||
components: { Pagination },
|
count: 0,
|
||||||
data() {
|
},
|
||||||
return {
|
listQuery: {
|
||||||
customer: defaultecustomer,
|
page: 1,
|
||||||
customerList: {
|
page_size: 20,
|
||||||
count: 0,
|
},
|
||||||
},
|
listLoading: true,
|
||||||
listQuery: {
|
dialogVisible: false,
|
||||||
page: 1,
|
dialogType: "new",
|
||||||
page_size: 20,
|
rule1: {
|
||||||
},
|
name: [{required: true, message: "请输入", trigger: "blur"}],
|
||||||
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;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
handleFilter() {
|
|
||||||
this.listQuery.page = 1;
|
|
||||||
this.getList();
|
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) {
|
methods: {
|
||||||
this.customer = Object.assign({}, scope.row); // copy obj
|
checkPermission,
|
||||||
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);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
async confirm(form) {
|
//设备列表
|
||||||
this.$refs[form].validate((valid) => {
|
getList() {
|
||||||
if (valid) {
|
this.listLoading = true;
|
||||||
const isEdit = this.dialogType === "edit";
|
getCustomerList(this.listQuery).then((response) => {
|
||||||
if (isEdit) {
|
if (response.data) {
|
||||||
updateCustomer(this.customer.id, this.customer).then((res) => {
|
this.customerList = response.data;
|
||||||
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 {
|
this.listLoading = false;
|
||||||
return 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>
|
</script>
|
||||||
|
|
|
@ -2,34 +2,40 @@
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-card>
|
<el-card>
|
||||||
<div>
|
<div>
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
<el-button
|
||||||
>新增订单</el-button
|
v-if="checkPermission(['order_create'])"
|
||||||
>
|
type="primary"
|
||||||
<el-input
|
icon="el-icon-plus"
|
||||||
v-model="listQuery.search"
|
@click="handleCreate"
|
||||||
placeholder="订单名称"
|
>
|
||||||
style="width: 300px"
|
新增订单
|
||||||
class="filter-item"
|
</el-button>
|
||||||
@keyup.enter.native="handleFilter"
|
<el-input
|
||||||
/>
|
v-model="listQuery.search"
|
||||||
<el-button
|
placeholder="订单名称"
|
||||||
class="filter-item"
|
style="width: 300px"
|
||||||
type="primary"
|
class="filter-item"
|
||||||
icon="el-icon-search"
|
@keyup.enter.native="handleFilter"
|
||||||
@click="handleFilter"
|
/>
|
||||||
>搜索</el-button
|
<el-button
|
||||||
>
|
class="filter-item"
|
||||||
<el-button
|
type="primary"
|
||||||
class="filter-item"
|
icon="el-icon-search"
|
||||||
type="primary"
|
@click="handleFilter"
|
||||||
icon="el-icon-refresh-left"
|
>
|
||||||
@click="resetFilter"
|
搜索
|
||||||
>重置</el-button
|
</el-button>
|
||||||
>
|
<el-button
|
||||||
</div>
|
class="filter-item"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-refresh-left"
|
||||||
|
@click="resetFilter"
|
||||||
|
>
|
||||||
|
重置
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card >
|
<el-card>
|
||||||
<el-table
|
<el-table
|
||||||
v-loading="listLoading"
|
v-loading="listLoading"
|
||||||
:data="orderList.results"
|
:data="orderList.results"
|
||||||
|
@ -37,69 +43,67 @@
|
||||||
fit
|
fit
|
||||||
stripe
|
stripe
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
height="100"
|
height="100"
|
||||||
v-el-height-adaptive-table="{bottomOffset: 42}"
|
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="订单编号" prop="number" width="160" show-overflow-tooltip>
|
||||||
<el-table-column label="订单编号" width="160" show-overflow-tooltip>
|
|
||||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
|
||||||
</el-table-column>
|
</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>
|
<template slot-scope="scope">{{ scope.row.customer_.name }}</template>
|
||||||
</el-table-column>
|
</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>
|
<template slot-scope="scope" v-if="scope.row.contract">{{ scope.row.contract_.name }}</template>
|
||||||
</el-table-column>
|
</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>
|
<template slot-scope="scope">{{ scope.row.product_.name }}</template>
|
||||||
</el-table-column>
|
</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>
|
<template slot-scope="scope">{{ scope.row.product_.specification }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="产品数量" width="90" >
|
<el-table-column label="产品数量" prop="count" width="90">
|
||||||
<template slot-scope="scope">{{ scope.row.count }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="交货日期" width="150" >
|
<el-table-column label="交货日期" prop="delivery_date" width="150">
|
||||||
<template slot-scope="scope">{{ scope.row.delivery_date }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="已交货数量" width="150" >
|
<el-table-column label="已交货数量" prop="delivered_count" width="150">
|
||||||
<template slot-scope="scope">{{ scope.row.delivered_count }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="是否需要军检" width="150" >
|
<el-table-column label="是否需要军检" width="150">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag v-if="scope.row.need_mtest == false">否</el-tag>
|
<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-tag v-else-if="scope.row.need_mtest === true">是</el-tag>
|
||||||
</el-table-column>
|
</template>
|
||||||
<el-table-column label="创建时间" width="160" >
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" width="160">
|
||||||
<template slot-scope="scope">{{ scope.row.create_time }}</template>
|
<template slot-scope="scope">{{ scope.row.create_time }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
align="center"
|
align="center"
|
||||||
label="操作"
|
label="操作"
|
||||||
fixed="right"
|
fixed="right"
|
||||||
width="130"
|
width="130"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
|
||||||
<el-link
|
<el-link
|
||||||
v-if="checkPermission(['warehouse_update'])"
|
v-if="checkPermission(['order_update'])"
|
||||||
@click="handleEdit(scope)"
|
@click="handleEdit(scope)"
|
||||||
type="primary"
|
type="primary"
|
||||||
>编辑</el-link
|
|
||||||
>
|
>
|
||||||
|
编辑
|
||||||
|
</el-link>
|
||||||
<el-link
|
<el-link
|
||||||
v-if="checkPermission(['warehouse_delete'])"
|
v-if="checkPermission(['order_delete'])"
|
||||||
type="danger"
|
type="danger"
|
||||||
@click="handleDelete(scope)"
|
@click="handleDelete(scope)"
|
||||||
>删除</el-link
|
|
||||||
>
|
>
|
||||||
<el-link
|
删除
|
||||||
v-if="checkPermission(['warehouse_delete'])"
|
</el-link>
|
||||||
type="primary"
|
<el-link
|
||||||
|
v-if="checkPermission(['order_update'])"
|
||||||
|
type="primary"
|
||||||
@click="handleDetail(scope)"
|
@click="handleDetail(scope)"
|
||||||
>详情</el-link
|
|
||||||
>
|
>
|
||||||
|
详情
|
||||||
|
</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -123,26 +127,24 @@
|
||||||
label-position="right"
|
label-position="right"
|
||||||
:rules="rule1"
|
:rules="rule1"
|
||||||
>
|
>
|
||||||
|
|
||||||
<el-form-item label="订单编号" prop="number">
|
<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>
|
||||||
<el-form-item label="所需产品" prop="product">
|
<el-form-item label="所需产品" prop="product">
|
||||||
<el-select style="width: 100%" v-model="order.product" placeholder="请选择">
|
<el-select style="width: 100%" v-model="order.product" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in productoptions"
|
v-for="item in productoptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value">
|
:value="item.value">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</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>
|
||||||
<el-form-item label="交货日期" prop="delivery_date">
|
<el-form-item label="所需数量" prop="count">
|
||||||
<el-date-picker
|
<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"
|
v-model="order.delivery_date"
|
||||||
type="date"
|
type="date"
|
||||||
placeholder="选择日期"
|
placeholder="选择日期"
|
||||||
|
@ -151,31 +153,30 @@
|
||||||
>
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="客户" prop="customer">
|
<el-form-item label="客户" prop="customer">
|
||||||
<el-select style="width: 100%" v-model="order.customer" placeholder="请选择">
|
<el-select style="width: 100%" v-model="order.customer" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in customeroptions"
|
v-for="item in customeroptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value">
|
:value="item.value">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="所属合同" prop="contract">
|
<el-form-item label="所属合同" prop="contract">
|
||||||
<el-select style="width: 100%" v-model="order.contract" @change="selectcontract" placeholder="请选择">
|
<el-select style="width: 100%" v-model="order.contract" @change="selectcontract" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in contractoptions"
|
v-for="item in contractoptions"
|
||||||
|
:key="item.id"
|
||||||
:key="item.id"
|
:label="item.name+'____'+item.number"
|
||||||
:label="item.name+'____'+item.number"
|
:value="item.id"
|
||||||
:value="item.id">
|
>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="是否军检">
|
<el-form-item label="是否军检">
|
||||||
<el-switch v-model="order.need_mtest"></el-switch>
|
<el-switch v-model="order.need_mtest"></el-switch>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="text-align: right">
|
<div style="text-align: right">
|
||||||
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
||||||
|
@ -185,172 +186,174 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getOrderList, createOrder,updateOrder,deleteOrder,getContractList,getCustomerList,getContract } from "@/api/sam";
|
import {
|
||||||
import { getMaterialList } from "@/api/mtm";
|
getOrderList,
|
||||||
import checkPermission from "@/utils/permission";
|
createOrder,
|
||||||
|
updateOrder,
|
||||||
|
deleteOrder,
|
||||||
|
getContractList,
|
||||||
|
getCustomerList,
|
||||||
|
getContract
|
||||||
|
} from "@/api/sam";
|
||||||
|
import {getMaterialList} from "@/api/mtm";
|
||||||
|
import checkPermission from "@/utils/permission";
|
||||||
|
|
||||||
|
|
||||||
import { genTree } from "@/utils";
|
import {genTree} from "@/utils";
|
||||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||||
const defaulteorder = {
|
const defaulteorder = {
|
||||||
need_mtest:false,
|
need_mtest: false,
|
||||||
customer:""
|
customer: ""
|
||||||
};
|
};
|
||||||
export default {
|
export default {
|
||||||
components: { Pagination },
|
components: {Pagination},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
order: defaulteorder,
|
order: defaulteorder,
|
||||||
orderList: {
|
orderList: {
|
||||||
count: 0,
|
count: 0,
|
||||||
},
|
},
|
||||||
listQuery: {
|
listQuery: {
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: 20,
|
page_size: 20,
|
||||||
},
|
},
|
||||||
contractoptions:[],
|
contractoptions: [],
|
||||||
productoptions:[],
|
productoptions: [],
|
||||||
customeroptions:[],
|
customeroptions: [],
|
||||||
listLoading: true,
|
listLoading: true,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
dialogType: "new",
|
dialogType: "new",
|
||||||
rule1: {
|
rule1: {
|
||||||
|
product: [{required: true, message: "请输入", trigger: "blur"}],
|
||||||
|
delivery_date: [{required: true, message: "请输入", trigger: "blur"}],
|
||||||
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;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getListm() {
|
created() {
|
||||||
|
this.getListm();
|
||||||
getMaterialList({pageoff:true,type:1}).then((response) => {
|
this.getListc();
|
||||||
|
this.getListcm();
|
||||||
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();
|
this.getList();
|
||||||
},
|
},
|
||||||
resetFilter() {
|
methods: {
|
||||||
this.listQuery = {
|
checkPermission,
|
||||||
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) {
|
getList() {
|
||||||
this.order = Object.assign({}, scope.row); // copy obj
|
this.listLoading = true;
|
||||||
this.dialogType = "edit";
|
getOrderList(this.listQuery).then((response) => {
|
||||||
this.dialogVisible = true;
|
if (response.data) {
|
||||||
this.$nextTick(() => {
|
this.orderList = response.data;
|
||||||
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("成功");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else {
|
this.listLoading = false;
|
||||||
return 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>
|
</script>
|
||||||
|
|
|
@ -2,9 +2,14 @@
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-card>
|
<el-card>
|
||||||
<div>
|
<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
|
<el-input
|
||||||
v-model="listQuery.search"
|
v-model="listQuery.search"
|
||||||
placeholder="客户名称"
|
placeholder="客户名称"
|
||||||
|
@ -17,15 +22,17 @@
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-search"
|
icon="el-icon-search"
|
||||||
@click="handleFilter"
|
@click="handleFilter"
|
||||||
>搜索</el-button
|
|
||||||
>
|
>
|
||||||
|
搜索
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-refresh-left"
|
icon="el-icon-refresh-left"
|
||||||
@click="resetFilter"
|
@click="resetFilter"
|
||||||
>重置</el-button
|
|
||||||
>
|
>
|
||||||
|
重置
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card>
|
<el-card>
|
||||||
|
@ -38,82 +45,73 @@
|
||||||
height="100"
|
height="100"
|
||||||
v-el-height-adaptive-table="{ bottomOffset: 42 }"
|
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>
|
<el-table-column label="产品名称" show-overflow-tooltip>
|
||||||
<template slot-scope="scope" v-if="scope.row.product">{{
|
<template slot-scope="scope" v-if="scope.row.product">
|
||||||
scope.row.product_.name
|
{{scope.row.product_.name}}
|
||||||
}}</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="产品型号" show-overflow-tooltip>
|
<el-table-column label="产品型号" show-overflow-tooltip>
|
||||||
<template slot-scope="scope" v-if="scope.row.product">{{
|
<template slot-scope="scope" v-if="scope.row.product">
|
||||||
scope.row.product_.specification
|
{{scope.row.product_.specification}}
|
||||||
}}</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="客户名称" show-overflow-tooltip>
|
<el-table-column label="客户名称" show-overflow-tooltip>
|
||||||
<template slot-scope="scope" v-if="scope.row.customer">{{
|
<template slot-scope="scope" v-if="scope.row.customer">
|
||||||
scope.row.customer_.name
|
{{scope.row.customer_.name}}
|
||||||
}}</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="订单编号" show-overflow-tooltip>
|
<el-table-column label="订单编号" show-overflow-tooltip>
|
||||||
<template slot-scope="scope" v-if="scope.row.order">{{
|
<template slot-scope="scope" v-if="scope.row.order">
|
||||||
scope.row.order_.number
|
{{scope.row.order_.number }}
|
||||||
}}</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="合同名称" show-overflow-tooltip>
|
<el-table-column label="合同名称" show-overflow-tooltip>
|
||||||
<template slot-scope="scope" v-if="scope.row.order_">{{
|
<template slot-scope="scope" v-if="scope.row.order_">
|
||||||
scope.row.order_.contract_.name
|
{{scope.row.order_.contract_.name}}
|
||||||
}}</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="预计发货时间" prop="edelivery_date">
|
||||||
<el-table-column label="预计发货时间">
|
|
||||||
<template slot-scope="scope">{{ scope.row.edelivery_date }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="预计发货数量">
|
<el-table-column label="预计发货数量" prop="count">
|
||||||
<template slot-scope="scope">{{ scope.row.count }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="实际发货数量">
|
<el-table-column label="实际发货数量" prop="count_real">
|
||||||
<template slot-scope="scope">{{ scope.row.count_real }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="是否审核">
|
<el-table-column label="是否审核">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag v-if="scope.row.is_audited == false">否</el-tag>
|
<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>
|
||||||
<el-table-column label="收货人">
|
<el-table-column label="收货人" prop="receiver">
|
||||||
<template slot-scope="scope">{{ scope.row.receiver }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="收货人电话">
|
<el-table-column label="收货人电话" prop="receiver_phone">
|
||||||
<template slot-scope="scope">{{ scope.row.receiver_phone }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="收货人地址" show-overflow-tooltip>
|
<el-table-column label="收货人地址" prop="receiver_address" show-overflow-tooltip>
|
||||||
<template slot-scope="scope">{{
|
|
||||||
scope.row.receiver_address
|
|
||||||
}}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" fixed="right">
|
<el-table-column label="操作" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-link
|
<el-link
|
||||||
v-if="checkPermission(['warehouse_delete'])"
|
v-if="checkPermission(['sale_create'])"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="handleDetail(scope)"
|
@click="handleDetail(scope)"
|
||||||
>详情</el-link
|
|
||||||
>
|
>
|
||||||
|
详情
|
||||||
|
</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"
|
type="primary"
|
||||||
@click="handleAudit(scope)"
|
@click="handleAudit(scope)"
|
||||||
>审核</el-link
|
|
||||||
>
|
>
|
||||||
|
审核
|
||||||
|
</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"
|
type="danger"
|
||||||
@click="handleDelete(scope)"
|
@click="handleDelete(scope)"
|
||||||
>删除</el-link
|
|
||||||
>
|
>
|
||||||
|
删除
|
||||||
|
</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -139,10 +137,10 @@
|
||||||
>
|
>
|
||||||
<el-form-item label="关联订单" prop="name">
|
<el-form-item label="关联订单" prop="name">
|
||||||
<el-select
|
<el-select
|
||||||
style="width: 100%"
|
|
||||||
v-model="sale.order"
|
v-model="sale.order"
|
||||||
@change="selectorder"
|
style="width: 100%"
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
|
@change="selectorder"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in orderoptions"
|
v-for="item in orderoptions"
|
||||||
|
@ -153,14 +151,13 @@
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="关联客户" prop="customer" >
|
<el-form-item label="关联客户" prop="customer">
|
||||||
<el-select
|
<el-select
|
||||||
style="width: 100%"
|
|
||||||
v-model="sale.customer"
|
v-model="sale.customer"
|
||||||
@change="selectcustomer"
|
style="width: 100%"
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
:disabled="show"
|
:disabled="show"
|
||||||
|
@change="selectcustomer"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in customeroptions"
|
v-for="item in customeroptions"
|
||||||
|
@ -171,18 +168,17 @@
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="关联合同" prop="contract">
|
<el-form-item label="关联合同" prop="contract">
|
||||||
<el-input v-model="sale.contract" placeholder="关联合同" :disabled="edit"/>
|
<el-input v-model="sale.contract" placeholder="关联合同" :disabled="edit"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="所需产品" prop="product">
|
<el-form-item label="所需产品" prop="product">
|
||||||
<el-select
|
<el-select
|
||||||
:disabled="show"
|
|
||||||
style="width: 100%"
|
|
||||||
v-model="sale.product"
|
|
||||||
@change="selectproduct"
|
|
||||||
placeholder="请选择"
|
|
||||||
ref="btn"
|
ref="btn"
|
||||||
|
v-model="sale.product"
|
||||||
|
:disabled="show"
|
||||||
|
style="width: 100%"
|
||||||
|
placeholder="请选择"
|
||||||
|
@change="selectproduct"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in materialoptions"
|
v-for="item in materialoptions"
|
||||||
|
@ -193,46 +189,41 @@
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="选择产品" prop="iproducts">
|
<el-form-item label="选择产品" prop="iproducts">
|
||||||
<el-table
|
<el-table
|
||||||
|
ref="multipleTable"
|
||||||
:data="iproductoptions"
|
:data="iproductoptions"
|
||||||
border
|
border
|
||||||
fit
|
fit
|
||||||
stripe
|
stripe
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
ref="multipleTable"
|
|
||||||
height="200"
|
height="200"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55"> </el-table-column>
|
<el-table-column type="selection" width="55"></el-table-column>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50"/>
|
||||||
<el-table-column label="成品编号">
|
<el-table-column label="成品编号" prop="number">
|
||||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="成品批次" prop="batch">
|
||||||
<el-table-column label="成品批次">
|
|
||||||
<template slot-scope="scope">{{ scope.row.batch }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="成品名称">
|
<el-table-column label="成品名称">
|
||||||
<template slot-scope="scope">{{
|
<template slot-scope="scope">
|
||||||
scope.row.material_.name
|
{{scope.row.material_.name}}
|
||||||
}}</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="所在仓库">
|
<el-table-column label="所在仓库">
|
||||||
<template slot-scope="scope">{{
|
<template slot-scope="scope">
|
||||||
scope.row.warehouse_.name
|
{{scope.row.warehouse_.name}}
|
||||||
}}</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="是否已军检">
|
<el-table-column label="是否已军检">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag v-if="scope.row.is_mtested == false">未军检</el-tag>
|
<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-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="预计发货时间" prop="edelivery_date">
|
<el-form-item label="预计发货时间" prop="edelivery_date">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="sale.edelivery_date"
|
v-model="sale.edelivery_date"
|
||||||
|
@ -261,7 +252,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="收货人" prop="receiver">
|
<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>
|
||||||
<el-form-item label="联系电话" prop="receiver_phone">
|
<el-form-item label="联系电话" prop="receiver_phone">
|
||||||
<el-input
|
<el-input
|
||||||
|
@ -270,11 +261,11 @@
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="收货地址" prop="receiver_address">
|
<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>
|
||||||
|
|
||||||
<el-form-item label="备注" prop="remark">
|
<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-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
|
@ -286,296 +277,293 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
createSale,
|
createSale,
|
||||||
getOrderList,
|
getOrderList,
|
||||||
getCustomerList,
|
getCustomerList,
|
||||||
getSaleList,
|
getSaleList,
|
||||||
getOrder,
|
getOrder,
|
||||||
deleteSale,
|
deleteSale,
|
||||||
getSale,
|
getSale,
|
||||||
saleAudit,
|
saleAudit,
|
||||||
getCustomer
|
getCustomer,
|
||||||
} from "@/api/sam";
|
updateContract
|
||||||
import checkPermission from "@/utils/permission";
|
} from "@/api/sam";
|
||||||
import { getMaterialList } from "@/api/mtm";
|
import checkPermission from "@/utils/permission";
|
||||||
import { getiproductList } from "@/api/inm";
|
import {getMaterialList} from "@/api/mtm";
|
||||||
import { genTree } from "@/utils";
|
import {getiproductList} from "@/api/inm";
|
||||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
// import {genTree} from "@/utils";
|
||||||
const defaulteSale = {
|
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||||
order: null,
|
const defaulteSale = {
|
||||||
customer: null,
|
order: null,
|
||||||
contract:"",
|
customer: null,
|
||||||
product: null,
|
contract: "",
|
||||||
edelivery_date: "",
|
product: null,
|
||||||
trans_mode: null,
|
edelivery_date: "",
|
||||||
receiver: "",
|
trans_mode: null,
|
||||||
receiver_phone: "",
|
receiver: "",
|
||||||
receiver_address: "",
|
receiver_phone: "",
|
||||||
remark: "",
|
receiver_address: "",
|
||||||
};
|
remark: "",
|
||||||
export default {
|
};
|
||||||
components: { Pagination },
|
export default {
|
||||||
data() {
|
components: {Pagination},
|
||||||
return {
|
data() {
|
||||||
sale: defaulteSale,
|
return {
|
||||||
saleList: {
|
sale: defaulteSale,
|
||||||
count: 0,
|
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: "铁路快运",
|
|
||||||
},
|
},
|
||||||
{
|
listQuery: {
|
||||||
value: 20,
|
page: 1,
|
||||||
label: "铁路慢运",
|
page_size: 20,
|
||||||
},
|
},
|
||||||
{
|
iproducts: [],
|
||||||
value: 30,
|
orderoptions: [],
|
||||||
label: "铁路整车",
|
customeroptions: [],
|
||||||
},
|
materialoptions: [],
|
||||||
{
|
iproductoptions: [],
|
||||||
value: 40,
|
dialogVisible: false,
|
||||||
label: "汽车运输",
|
show: false,
|
||||||
},
|
edit: true,
|
||||||
{
|
dialogType: "new",
|
||||||
value: 50,
|
options: [
|
||||||
label: "空运",
|
{
|
||||||
},
|
value: 10,
|
||||||
],
|
label: "铁路快运",
|
||||||
};
|
},
|
||||||
},
|
{
|
||||||
computed: {},
|
value: 20,
|
||||||
watch: {},
|
label: "铁路慢运",
|
||||||
created() {
|
},
|
||||||
this.getList();
|
{
|
||||||
this.getCustomerLists();
|
value: 30,
|
||||||
// this.getproductList();
|
label: "铁路整车",
|
||||||
this.getOrderLists();
|
},
|
||||||
this.getMaterialList();
|
{
|
||||||
},
|
value: 40,
|
||||||
methods: {
|
label: "汽车运输",
|
||||||
checkPermission,
|
},
|
||||||
//关联订单
|
{
|
||||||
getOrderLists() {
|
value: 50,
|
||||||
getOrderList({ page: 0 }).then((response) => {
|
label: "空运",
|
||||||
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,
|
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
watch: {},
|
||||||
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
|
this.getCustomerLists();
|
||||||
|
// this.getproductList();
|
||||||
|
this.getOrderLists();
|
||||||
|
this.getMaterialList();
|
||||||
},
|
},
|
||||||
handleCreate() {
|
methods: {
|
||||||
this.sale = Object.assign({}, defaulteSale);
|
checkPermission,
|
||||||
this.dialogType = "new";
|
//关联订单
|
||||||
this.dialogVisible = true;
|
getOrderLists() {
|
||||||
this.iproducts = [];
|
getOrderList({page: 0}).then((response) => {
|
||||||
this.$nextTick(() => {
|
if (response.data) {
|
||||||
this.$refs["Form"].resetFields();
|
this.orderoptions = response.data;
|
||||||
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);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
//选择订单变化
|
||||||
|
|
||||||
async confirm(form) {
|
selectorder(selval) {
|
||||||
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;
|
getOrder(selval).then((response) => {
|
||||||
createSale(this.sale).then((res) => {
|
if (response.data) {
|
||||||
if (res.code >= 200) {
|
this.show = true;
|
||||||
this.getList();
|
this.sale.customer = response.data.customer;
|
||||||
this.dialogVisible = false;
|
this.sale.product = response.data.product;
|
||||||
this.$message.success("成功");
|
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>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.trdiv >>> .el-transfer-panel {
|
.trdiv >>> .el-transfer-panel {
|
||||||
width: 350px;
|
width: 350px;
|
||||||
}
|
}
|
||||||
.trdiv >>> .el-transfer__buttons {
|
|
||||||
width: 110px;
|
.trdiv >>> .el-transfer__buttons {
|
||||||
}
|
width: 110px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue