<template>
|
<div class="neighbor">
|
<v-header
|
title="需求清单"
|
:bar="bar"
|
search
|
@on-search="onSearch"
|
></v-header>
|
<!-- <div class="add">
|
<span class="f-size">自动审核:</span>
|
<el-switch
|
v-model="examine"
|
@change="openstatusbtn($event)"
|
active-color="#13ce66"
|
inactive-color="#ff4949"
|
active-value="1"
|
inactive-value="2"
|
>
|
</el-switch>
|
</div> -->
|
<!-- <div class="mr-b-10">
|
<el-button size="small" @click="$router.push('/add_neighbor?title=需求')"
|
>新增</el-button
|
>
|
</div> -->
|
<div class="tab">
|
<v-tool-table :trs="trs" :tds="tds">
|
<template v-slot:status="{ scope }">
|
{{ status[scope.status] }}
|
</template>
|
<template v-slot:solveStatus="{ scope }">
|
{{ solveStatuslist[scope.isDisplay * 1] }}
|
</template>
|
<template v-slot:claimNum="{ scope }">
|
{{ scope.claimNum == "-1" ? "无限制" : scope.claimNum }}
|
</template>
|
<template v-slot:btn="{ scope }">
|
<div class="table_flex">
|
<!-- {{item.scope.id}} -->
|
<span @click="onShow(scope)">查看</span>
|
<span v-if="scope.isDisplay * 1 === 1" @click="onToggle(scope, 0)"
|
>隐藏</span
|
>
|
<span v-if="scope.isDisplay * 1 === 0" @click="onToggle(scope, 1)"
|
>显示</span
|
>
|
<!-- <span
|
v-if="scope.solveStatus == 3"
|
@click="hellpEvaluateClick(scope)"
|
>评价</span
|
> -->
|
<!-- <span
|
v-if="
|
scope.status !== 4 && scope.status !== 3 && scope.status !== 2
|
"
|
@click="onSend(scope)"
|
>审核</span
|
> -->
|
<span @click="onDel(scope)">删除</span>
|
</div>
|
</template>
|
</v-tool-table>
|
</div>
|
<v-tool-page :item="paged" @on-page="onPage"></v-tool-page>
|
<el-dialog title="填写评价" :visible.sync="dislogValue" append-to-body>
|
<el-form
|
:model="paramForm"
|
:rules="paramRules"
|
ref="paramForm"
|
label-width="120px"
|
>
|
<el-form-item label="预计服务时长">
|
<span>{{ paramForm.targetServiceTime }}小时</span>
|
</el-form-item>
|
<el-form-item label="实际服务时长" prop="realServiceTime">
|
<el-input
|
class="iw-220"
|
clearable
|
placeholder="请输入实际服务时长"
|
v-model.trim="paramForm.realServiceTime"
|
oninput="value=value.replace(/^\.+|[^\d.]/g,'')"
|
@blur="salaryChange"
|
></el-input>
|
<span class="mr-l-10">小时</span>
|
</el-form-item>
|
<el-form-item label="评价内容" prop="comment">
|
<el-input
|
type="textarea"
|
class="textarea-width"
|
:rows="5"
|
resize="none"
|
placeholder="请输入评价内容"
|
maxlength="300"
|
clearable
|
show-word-limit
|
v-model="paramForm.comment"
|
></el-input>
|
</el-form-item>
|
<el-form-item prop="password" label="">
|
<el-button @click="handleAction('close')">取 消</el-button>
|
<el-button
|
type="primary"
|
:loading="btnType"
|
@click="handleAction('submit')"
|
>确 认</el-button
|
>
|
</el-form-item>
|
</el-form>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import { mapState } from "vuex";
|
export default {
|
props: {},
|
components: {},
|
data() {
|
return {
|
bar: [
|
{
|
title: "关键词",
|
name: "name",
|
plac: "请输入分类、发布人、发布内容等关键词进行查看",
|
width: "350px !important"
|
},
|
{
|
title: "处理状态",
|
name: "status",
|
type: "select",
|
plac: "请选择",
|
list: ["认领中", "进行中", "已结束"].map((r, v) => {
|
return { label: r, value: v + 1 };
|
})
|
},
|
{
|
title: "发布状态",
|
name: "isDisplay",
|
type: "select",
|
plac: "请选择",
|
list: ["隐藏", "显示"].map((r, v) => {
|
return { label: r, value: v };
|
})
|
},
|
{ title: "发布日期", name: "startAt", type: "times" }
|
// {
|
// title: "分类名称",
|
// name: "topicId",
|
// type: "select",
|
// plac: "请选择",
|
// list: []
|
// }
|
],
|
status: ["", "认领中", "进行中", "已完成"],
|
solveStatuslist: ["隐藏", "显示"],
|
trs: [
|
{ text: "序号", val: "index", width: "50px" },
|
{ text: "需求内容", val: "title" },
|
{ text: "需求类型", val: "classifyName" },
|
{ text: "任务地点", val: "address" },
|
{ text: "联系人", val: "linkman" },
|
{ text: "联系电话", val: "phone" },
|
{ text: "已认领人数", val: "joinNum" },
|
{ text: "最大认领人数", val: "btn",slot:"claimNum" },
|
{ text: "处理状态", val: "btn", slot: "status", width: "80px" },
|
{ text: "发布状态", val: "btn", slot: "solveStatus" },
|
{ text: "发布时间", val: "creationTime" },
|
{ text: "操作", val: "btn" }
|
],
|
tds: [],
|
paged: { page: 0, total: 0, r: 0, limit: 10 },
|
os: {},
|
search: {},
|
examine: 0,
|
dislogValue: false,
|
paramForm: {
|
comment: "",
|
realServiceTime: "",
|
targetServiceTime: ""
|
},
|
btnType: false,
|
paramRules: {
|
realServiceTime: [
|
{
|
required: true,
|
message: "请输入实际服务时长",
|
trigger: "blur"
|
}
|
],
|
comment: [
|
{
|
required: true,
|
message: "请输入评价内容",
|
trigger: "blur"
|
}
|
]
|
}
|
};
|
},
|
computed: {
|
...mapState({ vuex_page: "pageReset" })
|
},
|
watch: {
|
vuex_page: {
|
handler(n) {
|
if (n.page === this.$route.path) {
|
this.paged.page = 1;
|
this.init();
|
}
|
},
|
deep: true
|
}
|
},
|
inject: ["appPath"],
|
methods: {
|
salaryChange(e) {
|
this.paramForm.realServiceTime = e.target.value;
|
},
|
// 页面操作
|
async handleAction(type, row) {
|
switch (type) {
|
case "close": {
|
this.paramForm = {
|
comment: "",
|
realServiceTime: "",
|
targetServiceTime: ""
|
};
|
this.$refs.paramForm.resetFields();
|
this.dislogValue = false;
|
break;
|
}
|
case "submit": {
|
this.$refs.paramForm.validate(val => {
|
if (val) {
|
this.btnType = true;
|
this.paramForm.solveStatus = 4;
|
this.$api.post("neighbor/update", this.paramForm, () => {
|
this.btnType = false;
|
demo.toast("评价成功");
|
this.dislogValue = false;
|
this.init();
|
});
|
}
|
});
|
break;
|
}
|
default: {
|
break;
|
}
|
}
|
},
|
hellpEvaluateClick(row) {
|
console.log(row.id);
|
this.paramForm.id = row.id;
|
this.paramForm.targetServiceTime = row.targetServiceTime;
|
this.dislogValue = true;
|
},
|
hellpHandleClick(row) {
|
this.$router.push(`/helpDetails?id=${row.id}&title=需求`);
|
},
|
hellpCloseClick(row) {
|
this.$confirm("是否取消求助", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
}).then(() => {
|
this.$api.post(
|
"neighbor/update",
|
{
|
id: row.id,
|
solveStatus: 0
|
},
|
res => {
|
demo.toast("取消成功");
|
this.init();
|
}
|
);
|
});
|
},
|
onSearch(v) {
|
console.log(v);
|
this.search = {
|
startTime: v.startAt[0] || "",
|
endTime: v.startAt[1] || "",
|
search: v.name,
|
status: v.status,
|
isDisplay: v.isDisplay
|
};
|
this.paged.page = 1;
|
this.init();
|
},
|
// 分页点击
|
onPage(v) {
|
if (v.page === this.paged.page && v.page && !v.reset) {
|
return 0;
|
}
|
this.paged.page = v.page;
|
this.paged.limit = v.limit;
|
this.init();
|
},
|
|
openstatusbtn($event, val) {
|
this.examine = $event;
|
this.$api.get(
|
"neighbor/editCircleExamineStatus",
|
{ status: this.examine },
|
e => {
|
if (this.examine == 1) {
|
demo.toast("打开成功");
|
} else {
|
demo.toast("关闭成功");
|
}
|
}
|
);
|
},
|
|
getSatus() {
|
this.$api.get("neighbor/getCircleExamineStatus", {}, e => {
|
this.examine = e;
|
});
|
},
|
|
// 获取数据
|
init() {
|
let user = demo.$session.get("user");
|
|
let v = demo.copy(
|
Object.assign(this.os, this.search, {
|
pageNum: this.paged.page,
|
pageSize: this.paged.limit,
|
kind: 2,
|
communityId: user.communityId
|
})
|
);
|
this.$api.get("StriveFor/NeedProblem/getList", v, e => {
|
this.paged.total = e.total;
|
e.records.map(item => {
|
item.imageList = item.releaseImages
|
? item.releaseImages.split(",")
|
: [];
|
});
|
e.records.map((item, index) => {
|
item.index = (this.paged.page - 1) * this.paged.limit + index + 1;
|
});
|
this.tds = e.records;
|
});
|
},
|
// 查看
|
onShow(v) {
|
this.appPath("man_demandList_detail/" + v.id);
|
},
|
// 显示隐藏
|
onToggle(v, n) {
|
let data = {
|
id: v.id,
|
isDisplay: n
|
};
|
this.$api.post("StriveFor/NeedProblem/editData", data, e => {
|
this.init();
|
});
|
},
|
// 删除
|
onDel(v) {
|
this.$js.model("删除", "是否删除?", res => {
|
if (res) {
|
this.$api.del(
|
"StriveFor/NeedProblem/expurgateData?id=" + v.id,
|
"",
|
e => {
|
this.init();
|
}
|
);
|
}
|
});
|
},
|
// 审核
|
onSend(v) {
|
this.$store.dispatch("setFixed", {
|
event: "add",
|
data: { type: "neigh-send", data: { v } },
|
timeout: Date.now()
|
});
|
},
|
// 新增
|
onAdd() {
|
this.$store.dispatch("setFixed", {
|
event: "add",
|
data: { type: "neigh-add", data: { belongType: 1 } },
|
timeout: Date.now()
|
});
|
},
|
getTopic() {
|
this.$api.get("neighbor/topic/list", {}, e => {
|
e.forEach(item => {
|
this.bar[3].list.push({
|
label: item.name,
|
value: item.id
|
});
|
});
|
});
|
}
|
},
|
mounted() {
|
this.getTopic();
|
this.getSatus();
|
}
|
};
|
</script>
|
<style lang="less" scoped>
|
.neighbor {
|
overflow-y: auto;
|
.add,
|
.tab {
|
margin-bottom: 10px;
|
.f-size {
|
font-size: 14px;
|
}
|
}
|
}
|
.textarea-width {
|
width: 350px;
|
}
|
.iw-220 {
|
width: 220px;
|
}
|
</style>
|
<style>
|
.el-dialog {
|
width: 800px;
|
}
|
</style>
|