master
xy 3 years ago
parent 51763ea1c7
commit 91ac8b970d

@ -30,25 +30,25 @@
</el-descriptions>
<div class="form">
<div>
<div style="display: flex;align-items: center;">
<span class="title"
><span style="color: red; padding-right: 10px">*</span
>确认日期</span
>
<el-date-picker
style="margin-left: 20px;"
style="margin-left: 20px;flex: 1;"
v-model="detail.querenriqi"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
clearable
></el-date-picker>
</div>
<div style="margin-top: 20px;">
<div style="margin-top: 20px;display: flex;align-items: center;">
<span class="title"
><span style="color: red; padding-right: 10px">*</span
>确认场馆</span
>
<el-select style="margin-left: 20px;" v-model="detail.venue_id"></el-select>
<el-input readonly style="margin-left: 20px;flex: 1;" :value="pickVenueDetail ? pickVenueDetail.name : ''" @focus="$refs['venuePick'].show();"></el-input>
</div>
<div class="btns">
@ -60,13 +60,19 @@
</div>
</template>
</el-drawer>
<venuePick ref="venuePick" @venueDetailPick="venueDetailPick"></venuePick>
</div>
</template>
<script>
import venuePick from "@/views/orders/components/venuePick.vue";
import { show, save } from "@/api/system/baseForm";
import { deepCopy } from "@/utils";
export default {
components: {
venuePick
},
props: {
formInfo: {
type: Array,
@ -80,6 +86,7 @@ export default {
isShow: false,
detail: {},
pickVenueDetail: {},
};
},
methods: {
@ -100,6 +107,10 @@ export default {
return this.id;
},
venueDetailPick (node) {
this.pickVenueDetail = node;
this.detail.venue_detail_confirm_id = node.id;
},
confirm() {
if (!this.detail.querenriqi) {
this.$message({
@ -108,6 +119,13 @@ export default {
});
return;
}
if (!this.detail.venue_detail_confirm_id) {
this.$message({
type: "warning",
message: "请选择确认场馆",
});
return;
}
let copyForm = deepCopy(this.detail);
for (const key in copyForm) {
if (key.includes("_relation")) {
@ -115,18 +133,25 @@ export default {
}
}
copyForm.zhuangtai = 2;
console.log(copyForm);
// save(Object.assign(copyForm, { table_name: this.tableName })).then(
// (res) => {
// this.$message({
// type: "success",
// message: "",
// });
// }
// );
// this.$emit("refresh");
// this.hidden();
if (copyForm.venue_detail_confirm_id !== copyForm.venue_detail_id) {
this.$confirm('当前确认场馆与预约场馆不同, 是否确认?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
save(Object.assign(copyForm, { table_name: this.tableName })).then(
(res) => {
this.$message({
type: "success",
message: "操作成功",
});
}
);
this.$emit("refresh");
this.hidden();
}).catch(() => {
});
}
},
},
computed: {
@ -156,7 +181,6 @@ export default {
?.toString();
}
}
document.querySelector('input').setAttribute('checked')
return this.detail[i.field];
};
@ -173,7 +197,9 @@ export default {
true
).then((res) => {
this.detail = res;
this.detail['querenriqi'] ? '' : (this.detail['querenriqi'] = this.$moment(new Date()).format('YYYY-MM-DD HH:mm:ss'))
this.detail['querenriqi'] ? '' : (this.detail['querenriqi'] = this.$moment(new Date()).format('YYYY-MM-DD HH:mm:ss'));
this.detail.venue_detail_confirm_id = this.detail.venue_detail_id;
this.pickVenueDetail = this.detail.venue_detail_id_venue_details_id_relation;
});
}
},

@ -121,33 +121,20 @@ export default {
?.toString(),
},
on: {
// ['focus']:e => {
// this.$refs['linkPickModal'].show()
// }
},
},
[
h("el-button", {
props: {
icon: "el-icon-arrow-right",
},
slot: "append",
on: {
click: (e) => {
this.pickedLinkField.field = i.field;
this.pickedLinkField.linkType =
i._relations.link_relation;
this.pickedLinkField.linkTableName =
i._relations.link_table_name;
this.pickedLinkField.originalRows =
this.originalForm[
i._relations.link_with_name
['focus']:e => {
this.pickedLinkField.field = i.field;
this.pickedLinkField.linkType =
i._relations.link_relation;
this.pickedLinkField.linkTableName =
i._relations.link_table_name;
this.pickedLinkField.originalRows =
this.originalForm[
i._relations.link_with_name
];
this.$refs["linkPickModal"].show();
},
},
}),
]
this.$refs["linkPickModal"].show();
}
},
}
),
]
: [

@ -243,6 +243,11 @@
$refs['addVenue'].show();
return;
}
if (/\/order\/list/g.test($route.path)) {
$refs['addOrder'].setType('add');
$refs['addOrder'].show();
return;
}
$refs['dialog'].setType('add');
$refs['dialog'].show();
}
@ -278,8 +283,6 @@
:req-opt="select"
:destroy-req-opt="select"
:table-item="table"
:btn-to-more="true"
:more-auths="['edit', 'delete']"
@detail="
(row) => {
$router.push({
@ -295,6 +298,12 @@
$refs['addVenue'].show();
return;
}
if (/\/order\/list/g.test($route.path)) {
$refs['addOrder'].setId(row.id);
$refs['addOrder'].setType('editor');
$refs['addOrder'].show();
return;
}
$refs['dialog'].setId(row.id);
$refs['dialog'].setType('editor');
$refs['dialog'].show();
@ -303,8 +312,18 @@
>
<template #confirm="{ row }">
<template v-if="row.zhuangtai != 3 && row.zhuangtai != 2">
<Button size="small" type="primary" @click="$refs['loss'].setId(row.id),$refs['loss'].show()"></Button>
<Button size="small" type="primary" @click="$refs['deal'].setId(row.id),$refs['deal'].show()"></Button>
<Button
size="small"
type="primary"
@click="$refs['loss'].setId(row.id), $refs['loss'].show()"
>流失确认</Button
>
<Button
size="small"
type="primary"
@click="$refs['deal'].setId(row.id), $refs['deal'].show()"
>成交确认</Button
>
</template>
</template>
<template #follow="{ row }">
@ -328,6 +347,13 @@
@refresh="$refs['xyTable'].getTableData()"
>
</dialoger>
<addOrder
:table-name="customForm.tableName"
:form-info="form"
ref="addOrder"
@refresh="$refs['xyTable'].getTableData()"
>
</addOrder>
<drawer
:table-name="customForm.tableName"
:form-info="form"
@ -352,10 +378,12 @@
:form-info="form"
@refresh="$refs['xyTable'].getTableData()"
></loss>
<deal ref="deal"
:table-name="customForm.tableName"
:form-info="form"
@refresh="$refs['xyTable'].getTableData()"></deal>
<deal
ref="deal"
:table-name="customForm.tableName"
:form-info="form"
@refresh="$refs['xyTable'].getTableData()"
></deal>
</div>
</template>
@ -380,6 +408,7 @@ import addVenue from "@/views/venues/components/add.vue";
import addFollow from "@/views/orders/components/addFollow.vue";
import loss from "@/views/component/loss.vue";
import deal from "./deal.vue";
import addOrder from "@/views/orders/components/addOrder.vue";
export default {
components: {
LxHeader,
@ -391,6 +420,7 @@ export default {
addFollow,
loss,
deal,
addOrder,
},
mixins: [authMixin],
provide: {

@ -0,0 +1,361 @@
<script>
import venuePick from "./venuePick.vue";
import { save, show, index, destroy } from "@/api/system/baseForm";
import { deepCopy } from "@/utils";
import { CreateDialog } from "@/utils/createDialog"
export default {
components: {
venuePick,
},
props: {
formInfo: {
type: Array,
default: () => [],
},
tableName: String,
},
render(h) {
let addOrder = new CreateDialog(this,[
{
key: 'venue_detail_id',
label: '场馆选择',
render:() => {
return h(
"el-input",
{
props: {
readonly: true,
value: this.pickVenueDetail.name || this.originalForm?.venue_detail_id_venue_details_id_relation?.name || ''
},
on: {
['focus']:e => {
this.$refs['venuePick'].show();
}
},
}
)
}
}
])
return h('div',[
addOrder.render(),
h('venuePick',{
ref: 'venuePick',
on: {
venueDetailPick:node => {
console.log(node)
this.pickVenueDetail = node;
this.form.venue_detail_id = node.id;
}
}
})
])
},
data() {
return {
columns: 1,
id: "",
type: "add",
dialogVisible: false,
form: {},
originalForm: {},
rules: {},
file: {},
pickedLinkField: {
linkType: "",
linkTableName: "",
field: "",
originalRows: [],
},
pickVenueDetail: {}
};
},
methods: {
fileRemoveHandler(file, field) {
this.file[field] = this.file[field].filter((item) => item !== file);
this.file = Object.assign({}, this.file);
},
//on
getEventType(info) {
if (info === "checkbox") {
return "change";
}
return "input";
},
init() {
for (let key in this.form) {
if (this.form[key] instanceof Array) {
this.form[key] = [];
} else {
this.form[key] = "";
}
}
this.$refs["elForm"].clearValidate();
},
show() {
this.dialogVisible = true;
},
hidden() {
this.dialogVisible = false;
},
setType(type = "add") {
let types = ["add", "editor"];
if (types.includes(type)) {
this.type = type;
} else {
console.warn("Unknown type: " + type);
}
},
setId(id) {
if (typeof id == "number") {
this.id = id;
} else {
console.error("error typeof id: " + typeof id);
}
},
async getDetail() {
const res = await show({ id: this.id, table_name: this.tableName });
this.$integrateData(this.form, res);
this.form = Object.assign({}, this.form);
this.formInfo.forEach((i) => {
if (i && (i.edit_input === "file" || i.edit_input === "files")) {
res[i._relations.link_with_name]
? (this.file[i.field] =
res[i._relations.link_with_name] instanceof Array
? res[i._relations.link_with_name].map((i) => {
return {
name: i?.original_name,
url: i?.url,
response: i,
};
})
: [
{
name: res[i._relations.link_with_name]?.original_name,
url: res[i._relations.link_with_name]?.url,
response: res[i._relations.link_with_name],
},
])
: (this.file[i.field] = []);
return;
}
if (
i &&
(i._relations?.link_relation === "newHasMany" ||
i._relations?.link_relation === "hasMany")
) {
this.form[i.field] = res[i._relations.link_with_name].map(
(j) => j[i._relations.custom_form_field]
);
}
});
this.originalForm = deepCopy(res);
},
submit() {
let promiseAll = [];
if (this.type === "add") {
if (this.form.hasOwnProperty("id")) {
delete this.form.id;
}
}
if (this.type === "editor") {
Object.defineProperty(this.form, "id", {
value: this.id,
enumerable: true,
configurable: true,
writable: true,
});
}
this.$refs["elForm"].validate((validate) => {
if (validate) {
let copyForm = deepCopy(this.form);
this.formInfo.forEach((info) => {
if (
info._relations?.link_relation === "newHasMany" ||
info._relations?.link_relation === "hasMany"
) {
if (this.originalForm[info._relations.link_with_name]) {
this.originalForm[info._relations.link_with_name].map((i) => {
promiseAll.push(
destroy({
id: i.id,
table_name: info._relations.link_table_name,
})
);
});
}
}
// if (copyForm[info._relations?.link_with_name]?.length > 0) {
// delete copyForm[info.field];
// }
if (
info._relations?.link_relation === "newHasMany" ||
info._relations?.link_relation === "hasMany"
) {
if (info.edit_input === "files") {
copyForm[info._relations.link_with_name] = this.file[
info.field
]?.map((i) => {
return {
upload_id: i?.response?.id,
original_name: i?.response?.original_name,
};
});
} else {
copyForm[info._relations.link_with_name] =
copyForm[info.field] instanceof Array
? copyForm[info.field]?.map((i) => {
return {
[info._relations.custom_form_field]: i,
//...copyRelation,
};
})
: "";
}
delete copyForm[info.field];
}
if (
info._relations?.link_relation === "newHasOne" ||
info._relations?.link_relation === "hasOne"
) {
if (info.edit_input === "file") {
copyForm[info.field] = this.file[info.field]
? this.file[info.field][0]?.response?.id
: "";
} else {
// let copyRelation = deepCopy(
// info._params.find(
// (param) => param.id == this.form[info.field]
// )
// );
// if (copyRelation) {
// delete copyRelation.id;
// copyForm[info._relations.link_with_name] = [
// {
// id: this.form[info._relations?.link_with_name]?.id,
// [info.field === "shenhebumen"
// ? "dept_id"
// : info._relations.foreign_key]: this.form[info.field],
// ...copyRelation,
// },
// ];
// }
}
//delete copyForm[info.field];
}
if (!copyForm[info._relations?.link_with_name]) {
delete copyForm[info._relations?.link_with_name];
}
// if (info._relations?.link_with_name) {
// if (info.edit_input === "files" || info.edit_input === "file") {
// this.form[info._relations.link_with_name] = this.file[info.field].map(i => i?.response);
// delete this.form[info.field]
// } else {
// this.form[info._relations.link_with_name] = this.form[info.field] instanceof Array ? this.form[info.field].map(i => {
// return info._params.find(param => i === param[info._relations.foreign_key])
// }) : [info._params.find(param => this.form[info.field] === param[info._relations.foreign_key])]
// delete this.form[info.field]
// }
// }
});
promiseAll.push(
save(Object.assign(copyForm, { table_name: this.tableName }))
);
Promise.all(promiseAll).then((res) => {
this.$Message.success({
content: `${this.type === "add" ? "新增" : "编辑"}成功`,
});
this.$emit("refresh");
this.hidden();
});
}
});
},
},
computed: {},
watch: {
formInfo: {
handler: function (newVal) {
this.form = {};
this.rules = {};
this.file = {};
newVal.forEach((i) => {
if (i.field) {
this.form[i.field] = "";
if (
i.validation instanceof Array &&
i.validation.length > 0 &&
!!i.validation.find((i) => i === "required")
) {
this.rules[i.field] = [
{ required: true, message: `请填写${i.name}` },
];
}
if (i.edit_input === "files") {
this.form[i.field] = [];
}
if (i.edit_input === "files" || i.edit_input === "file") {
this.file[i.field] = [];
}
if (i.edit_input === "checkbox") {
this.form[i.field] = [];
}
}
});
document.documentElement.style.setProperty('--column-num', Math.round(newVal.length / 8).toString())
},
//immediate: true,
},
dialogVisible(val) {
if (val) {
if (this.type === "editor") {
this.$nextTick(() => this.getDetail());
}
} else {
this.pickVenueDetail = {};
this.originalForm = {};
this.file = {};
this.id = "";
this.type = "";
this.init();
this.$refs["elForm"].clearValidate();
delete this.form.id;
}
},
},
};
</script>
<style scoped lang="scss">
:root {
--column-num: 2;
}
.uploaded-a {
color: red;
text-decoration: none;
transition: all 0.2s;
}
.uploaded-a:hover {
color: red;
text-decoration: underline;
}
.form-body {
display: grid;
grid-gap: 10px;
grid-template-columns: repeat(var(--column-num), 1fr);
}
</style>

@ -0,0 +1,145 @@
<template>
<div>
<el-dialog :visible.sync="dialogVisible">
<template>
<div class="select">
<Select
v-model="select.filter[0].key"
style="width: 100px"
placeholder="搜索条目"
>
<Option v-for="item in [{field:'changguanbianhao',name:'场馆编号'},{field:'name',name:'场馆名称'},{field:'lishuqishu',name:'隶属编号'}]" :key="item.id" :value="item.field">{{
item.name
}}</Option>
</Select>
<Select
v-model="select.filter[0].op"
style="width: 100px; margin-left: 10px"
placeholder="搜索条件"
>
<Option v-for="item in op" :key="item.value" :value="item.value">{{
item.label
}}</Option>
</Select>
<template v-if="select.filter[0].op !== 'range'">
<Input
clearable
v-model="select.filter[0].value"
style="width: 150px; margin-left: 10px"
placeholder="请填写关键词"
/>
</template>
<template v-else>
<Input
:value="select.filter[0].value.split(',')[0]"
style="width: 150px; margin-left: 10px"
placeholder="范围开始关键词"
@input="(e) => inputStartHandler(e, select.filter[0])"
/>
<span style="margin-left: 10px; display: flex; align-items: center"
></span
>
<Input
:value="select.filter[0].value.split(',')[1]"
style="width: 150px; margin-left: 10px"
placeholder="范围结束关键词"
@input="(e) => inputEndHandler(e, select.filter[0])"
/>
</template>
<Button
style="margin-left: 10px"
type="primary"
@click="getList"
>查询</Button
>
</div>
<el-tree ref="elTree" highlight-current :data="list" :props="{ children: 'id_venue_details_venue_id_relation', label: 'name' }"></el-tree>
</template>
<template #footer>
<span>
<el-button size="mini" @click="dialogVisible = false"
> </el-button
>
<el-button size="mini" type="primary" @click="confirm"
> </el-button
>
</span>
</template>
</el-dialog>
</div>
</template>
<script>
import { index } from "@/api/system/baseForm";
import { op } from '@/const/op';
export default {
props: {
},
data() {
return {
op,
dialogVisible: false,
select: {
table_name: "venues",
filter: [
{
key: '',
op: '',
value: ''
}
]
},
list: []
};
},
methods: {
show() {
this.dialogVisible = true;
},
hide() {
this.dialogVisible = false;
},
//target
inputStartHandler(e, target) {
let temp = target?.value.split(",")[1];
target.value = `${e},${temp ? temp : ""}`;
},
inputEndHandler(e, target) {
let temp = target?.value.split(",")[0];
target.value = `${temp ? temp : ""},${e}`;
},
async getList () {
const res = await index(this.select)
this.list = res.data;
},
confirm () {
let node = this.$refs['elTree'].getCurrentNode()
if (node.hasOwnProperty('venue_id')) {
this.$emit('venueDetailPick',node)
this.hide();
} else {
this.$message({
type: 'warning',
message: '请选择一个场馆楼层'
})
}
}
},
computed: {},
watch: {
},
created() {
this.getList()
}
};
</script>
<style scoped lang="scss">
.select {
margin-bottom: 10px;
}
</style>
Loading…
Cancel
Save