明日调令、图列、文字、看板操作权限等

master
xy 2 years ago
parent d07f88d806
commit 437e6a0d54

@ -1,5 +1,20 @@
import request from "@/utils/request";
function customParamsSerializer(params) {
let result = '';
for (let key in params) {
if (params.hasOwnProperty(key)) {
if (Array.isArray(params[key])) {
params[key].forEach((item,index) => {
result += `${key}[${index}]=${item}&`;
});
} else {
result += `${key}=${params[key]}&`;
}
}
}
return result.slice(0, -1);
}
export function getOaToken (isLoading=false) {
return request({
url: "/api/admin/oa/get-oa-token",
@ -43,3 +58,13 @@ export function checkTransfer (params) {
isLoading: false
})
}
export function sendSms (params) {
return request({
url: "/api/admin/sned_sms",
method: "get",
params,
paramsSerializer: customParamsSerializer,
isLoading: false
})
}

@ -0,0 +1,652 @@
<script>
import linkPickModal from "./linkPickModal.vue";
import { save, show, index, destroy } from "@/api/system/baseForm";
import { getparameter } from "@/api/system/dictionary";
import { domMap } from "@/const/inputType";
import { addPropsMap } from "@/const/addProps";
import { deepCopy } from "@/utils";
export default {
components: {
linkPickModal,
},
props: {
formInfo: {
type: Array,
default: () => [],
},
tableName: String,
},
render(h) {
return h("div", [
h(
"el-dialog",
{
props: {
title: "新增",
visible: this.dialogVisible,
width: "600px",
},
on: {
"update:visible": (val) => {
this.dialogVisible = val;
},
},
},
[
h(
"el-scrollbar",
{
style: {
height: "58vh",
},
},
[
h(
"el-form",
{
ref: "elForm",
class: "form-body",
props: {
model: this.form,
labelWidth: "80px",
rules: this.rules,
labelPosition: "right",
size: "small",
},
},
(() => {
let dom = [];
this.formInfo
.filter((i) => i.form_show)
.forEach((i, index) => {
dom.push(
h(
"el-form-item",
{
ref: `elFormItem${i.field}`,
style: {
width: "100%",
},
props: {
label: i.name,
prop: i.field,
required:
i.validation instanceof Array
? !!i.validation.find((i) => i === "required")
: false,
},
},
this.$scopedSlots[i.field]
? this.$scopedSlots[i.field]({
fieldInfo: i,
form: this.form,
file: this.file,
})
: i._relations &&
i.edit_input !== "file" &&
i.edit_input !== "files"
? [
h(
"el-input",
{
props: {
readonly: true,
value:
i._relations.link_relation ===
"newHasOne" ||
i._relations.link_relation === "hasOne"
? this.originalForm[
i._relations.link_with_name
]?.name ||
this.originalForm[
i._relations.link_with_name
]?.mingcheng ||
this.originalForm[
i._relations.link_with_name
]?.no ||
this.originalForm[
i._relations.link_with_name
]?.id || this.form[i.field]
: this.equipmentName || this.originalForm[
i._relations.link_with_name
]
?.map(
(j) =>
(j?.name)
)
?.toString(),
},
on: {
['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();
}
},
}
),
]
: [
h(
domMap.get(i.edit_input),
{
ref: `elEdit_${i.field}`,
style: {
width: "100%",
},
props: {
...addPropsMap.get(i.edit_input),
...this.extraProps(i),
placeholder: i.help,
value: this.form[i.field],
},
attrs: {
placeholder: i.help || `请填写${i.name}`,
},
on: {
[this.getEventType(i.edit_input)]: (
e
) => {
if (i.field) {
this.form[i.field] = e;
this.form = Object.assign(
{},
this.form
);
}
},
},
scopedSlots:
i.edit_input === "file" ||
i.edit_input === "files"
? {
file: (scope) => {
let { file } = scope;
return [
h("div", {}, [
h("i", {
class: {
"el-icon-circle-check":
file.status ===
"success",
"el-icon-loading":
file.status ===
"uploading",
},
style: {
color:
file.status ===
"success"
? "green"
: "",
},
}),
h(
"a",
{
attrs: {
href: file.url,
download: file.name,
},
class: {
"uploaded-a":
file.status ===
"success",
},
style: {
padding: "0 4px",
},
},
file.name
),
]),
h("i", {
class: "el-icon-close",
on: {
["click"]: () =>
this.fileRemoveHandler(
file,
i.field
),
},
}),
];
},
}
: "",
},
this.optionsRender(h, i)
),
]
)
);
});
return dom;
})()
),
]
),
h("template", { slot: "footer" }, [
h(
"el-button",
{
on: {
click: () => (this.dialogVisible = false),
},
},
"取 消"
),
h(
"el-button",
{
props: {
type: "warning",
plain: true,
},
on: {
click: () => this.init(),
},
},
"重 置"
),
h(
"el-button",
{
props: {
type: "primary",
},
on: {
click: this.submit,
},
},
"确 定"
),
]),
]
),
h("linkPickModal", {
ref: "linkPickModal",
props: {
linkType: this.pickedLinkField.linkType,
linkTableName: this.pickedLinkField.linkTableName,
field: this.pickedLinkField.field,
originalRows: this.pickedLinkField.originalRows,
},
on: {
["confirm"]: ({ field, value }) => {
this.form[field] = value;
this.equipmentName = value.map(i => i.name)?.toString()
},
},
}),
]);
},
data() {
return {
id: "",
type: "add",
dialogVisible: false,
form: {},
originalForm: {},
rules: {},
file: {},
pickedLinkField: {
linkType: "",
linkTableName: "",
field: "",
originalRows: [],
},
equipmentName: ""
};
},
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";
},
//
optionsRender(h, info) {
if (info.edit_input === "checkbox" || info.edit_input === "radio") {
return info._params && info._params instanceof Array
? info._params.map((i) =>
h("el-option", {
props: {
label:
i.key || i.value || i.name || i.no || i.mingcheng || i.id,
value: info._relations
? i[info._relations.foreign_key]
: i.value,
},
})
)
: [];
}
if (info.edit_input === "file" || info.edit_input === "files") {
return [
h(
"el-button",
{
slot: "trigger",
props: {
size: "small",
type: "primary",
},
},
"选取文件"
),
h(
"el-button",
{
style: {
"margin-left": "10px",
},
props: {
size: "small",
type: "success",
},
on: {
["click"]: (e) => {
this.$refs[`elEdit_${info.field}`].submit();
},
},
},
"上传到服务器"
),
h(
"div",
{
class: "el-upload__tip",
slot: "tip",
},
"文件不超过500kb"
),
];
}
},
extraProps(info) {
let props = {};
if (info.edit_input === "file" || info.edit_input === "files") {
props.fileList = this.file[info.field];
props.beforeUpload = (file) => {
if (file.size / 1000 > 500) {
this.$message({
type: "warning",
message: "上传图片大小超过500kb",
});
return false;
}
};
props.onSuccess = (response, file, fileList) => {
this.file[info.field] = fileList;
};
props.onRemove = (file, fileList) => {
this.file[info.field] = fileList;
};
props.onError = (err, file, fileList) => {
this.file[info.field] = fileList;
this.$message({
type: "warning",
message: err,
});
};
}
return props;
},
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 (
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.id,
start_date: this.form.start_date,
name: i.name
};
}) : '';
}
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 {
}
}
if (!copyForm[info._relations?.link_with_name]) {
delete copyForm[info._relations?.link_with_name];
}
});
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.floor(newVal.length / 8).toString()
);
},
//immediate: true,
},
dialogVisible(val) {
if (val) {
if (this.type === "editor") {
this.$nextTick(() => this.getDetail());
}
} else {
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);
width: calc(100% - 8px);
}
</style>

@ -0,0 +1,722 @@
<template>
<div>
<!-- 查询配置 -->
<div>
<div ref="lxHeader">
<LxHeader
icon="md-apps"
:text="$route.meta.title"
style="margin-bottom: 10px; border: 0px; margin-top: 15px"
>
<div slot="content"></div>
<slot>
<header-content :auths="auths_auth_mixin">
<template #search>
<div style="display: flex">
<Select
v-model="select.filter[0].key"
style="width: 100px"
placeholder="搜索条目"
>
<Option
v-for="item in form"
: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' &&
!columnArrTest(select.filter[0].key)
"
>
<Input
v-model="select.filter[0].value"
style="width: 150px; margin-left: 10px"
placeholder="请填写关键词"
/>
</template>
<template
v-else-if="
select.filter[0].op !== 'range' &&
columnArrTest(select.filter[0].key)
"
>
<Select
v-model="select.filter[0].value"
style="width: 150px; margin-left: 10px"
placeholder="请选择关键词"
>
<Option
v-for="item in getColumnParams(select.filter[0].key)"
:key="item.id"
:value="
getColumnField(select.filter[0].key)._relations
? item[
getColumnField(select.filter[0].key)._relations
.foreign_key
]
: item.value
"
>{{
item.key ||
item.value ||
item.name ||
item.no ||
item.mingcheng ||
item.id
}}</Option
>
</Select>
</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="$refs['xyTable'].getTableData(true)"
>查询</Button
>
<xy-selectors
style="margin-left: 10px"
@reset="reset"
@search="$refs['xyTable'].getTableData(true)"
>
<template>
<div class="select">
<div
class="select__item"
v-for="(item, index) in select.filter"
:key="`${item.value}-${index}`"
>
<p>条件{{ index + 1 }}</p>
<Select
v-model="item.key"
style="width: 100px"
placeholder="搜索条目"
>
<Option
v-for="item in form"
:key="item.id"
:value="item.field"
>{{ item.name }}</Option
>
</Select>
<Select
v-model="item.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="
item.op !== 'range' && !columnArrTest(item.key)
"
>
<Input
v-model="item.value"
style="width: 150px; margin-left: 10px"
placeholder="请填写关键词"
/>
</template>
<template
v-else-if="
item.op !== 'range' && columnArrTest(item.key)
"
>
<Select
v-model="item.value"
style="width: 150px; margin-left: 10px"
placeholder="请选择关键词"
>
<Option
v-for="item in getColumnParams(item.key)"
:key="item.id"
:value="
getColumnField(item.key)._relations
? item[
getColumnField(item.key)._relations
.foreign_key
]
: item.value
"
>{{
item.key ||
item.value ||
item.name ||
item.no ||
item.mingcheng ||
item.id
}}</Option
>
</Select>
</template>
<template v-else>
<Input
:value="item.value.split(',')[0]"
style="width: 150px; margin-left: 10px"
placeholder="范围开始关键词"
@input="(e) => inputStartHandler(e, item)"
/>
<span style="margin-left: 10px"></span>
<Input
:value="item.value.split(',')[1]"
style="width: 150px; margin-left: 10px"
placeholder="范围结束关键词"
@input="(e) => inputEndHandler(e, item)"
/>
</template>
<el-button
v-if="index !== 0"
size="small"
type="danger"
icon="el-icon-delete"
circle
style="margin-left: 10px"
@click="select.filter.splice(index, 1)"
></el-button>
</div>
</div>
<div class="add-btn">
<el-button
size="small"
type="primary"
icon="el-icon-plus"
circle
@click="
select.filter.push({ key: '', op: '', value: '' })
"
></el-button>
<span>新增一条</span>
</div>
</template>
</xy-selectors>
</div>
</template>
<template #create>
<Button
type="primary"
@click="
$refs['dialog'].setType('add'), $refs['dialog'].show()
"
>新增</Button
>
</template>
<template #import>
<Button type="primary" @click="$refs['imports'].show()"
>导入</Button
>
</template>
<template #export>
<Button
type="primary"
@click="exportExcel(new Date().getTime().toString())"
>导出</Button
>
</template>
</header-content>
</slot>
</LxHeader>
</div>
</div>
<!--$refs['drawer'].setId(row.id);
$refs['drawer'].show();-->
<xy-table
:btn-width="240"
:auths="auths_auth_mixin"
:delay-req="true"
:destroy-action="destroy"
ref="xyTable"
:border="true"
:action="index"
:req-opt="tableSelect"
:destroy-req-opt="select"
:table-item="table"
@detail="
(row) => {
$router.push({
path: $route.path + '/detail/' + row.id,
});
}
"
@editor="
(row) => {
$refs['dialog'].setId(row.id);
$refs['dialog'].setType('editor');
$refs['dialog'].show();
}
"
>
<template #callback="{ row }">
<Button
size="small"
type="primary"
@click="
$refs['callback'].setId(row.id),
$refs['callback'].setType('add'),
$refs['callback'].show()
"
>反馈</Button
>
</template>
<template #distribute="{ row }">
<Button
v-if="row.status === 1"
size="small"
type="primary"
@click="setTransferStatus(2,row)"
>下发</Button
>
<Button
v-if="row.status === 2"
size="small"
type="primary"
ghost
@click="setTransferStatus(1,row)"
>取消</Button
>
</template>
</xy-table>
<addGroup
:table-name="customForm.tableName"
:form-info="form"
ref="dialog"
@refresh="$refs['xyTable'].getTableData()"
>
</addGroup>
<imports
:table-name="customForm.tableName"
:form-info="form"
ref="imports"
@refresh="$refs['xyTable'].getTableData()"
></imports>
</div>
</template>
<script>
import { index as fieldIndex } from "@/api/system/customFormField";
import { authMixin } from "@/mixin/authMixin";
import { index, destroy, save } from "@/api/system/baseForm";
import { op } from "@/const/op";
import { download } from "@/utils/downloadRequest";
import { getparameter } from "@/api/system/dictionary";
import { show } from "@/api/system/customForm";
import * as XLSX from "xlsx";
import { saveAs } from "file-saver";
import { listdept } from "@/api/system/department";
import addGroup from "./component/addGroup.vue";
import LxHeader from "@/components/LxHeader/index.vue";
import headerContent from "@/components/LxHeader/XyContent.vue";
import imports from "./component/imports.vue";
import { deepCopy } from "@/utils";
export default {
components: {
LxHeader,
addGroup,
headerContent,
imports,
},
mixins: [authMixin],
provide: {
formStore: () => this.form,
},
data() {
return {
op,
select: {
table_name: "",
filter: [
{
key: "",
op: "",
value: "",
},
],
},
selectQuery: [],
form: [],
table: [],
customForm: {
customFormId: "",
tableName: "",
},
};
},
methods: {
setTransferStatus (status,row) {
let copyRow = deepCopy(row);
copyRow.status = status;
for (let key in copyRow) {
if (/_relation/g.test(key)) {
delete copyRow[key]
}
}
save({
table_name: 'transfers',
...copyRow
}).then(_ => this.$refs['xyTable'].getTableData())
},
index,
destroy,
download,
reset() {
this.select.filter.splice(1);
this.select.filter[0] = {
key: "",
op: "",
value: "",
};
},
async exportExcel(sheetName) {
const res = await index(
Object.assign(this.select, { page: 1, page_size: 9999 })
);
if (res.data) {
let headers = this.form.map((i) => {
return {
key: i.field,
title: i.name,
};
});
const data = res.data.map((row) =>
headers.map((header) => row[header.key])
);
data.unshift(headers.map((header) => header.title));
const wb = XLSX.utils.book_new();
const ws = XLSX.utils.aoa_to_sheet(data);
XLSX.utils.book_append_sheet(wb, ws, sheetName);
const wbout = XLSX.write(wb, {
bookType: "xlsx",
bookSST: true,
type: "array",
});
saveAs(
new Blob([wbout], { type: "application/octet-stream" }),
`${sheetName}.xlsx`
);
}
},
//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 getFormDetail() {
if (this.$route.meta.params?.custom_form) {
let decode = decodeURIComponent(this.$route.meta.params?.custom_form);
try {
let custom_form = JSON.parse(decode);
this.customForm.customFormId = custom_form.custom_form_id;
this.customForm.tableName = custom_form.table_name;
this.select.table_name = custom_form.table_name;
} catch (err) {
console.warn(err);
}
}
if (this.$route.meta.params?.select) {
try {
this.selectQuery = JSON.parse(
decodeURIComponent(this.$route.meta.params?.select)
);
} catch (err) {
console.warn(err);
}
}
const res = await show({ id: this.customForm.customFormId }, false);
//
//
let baseTable = new Map([
[
"departments",
async () => {
const res = await listdept();
return res;
},
],
["admins", []],
]);
let { fields, relation } = res;
let fieldRes = fields.sort((a, b) => a.sort - b.sort);
if (
!fields ||
!relation ||
!fields instanceof Array ||
!relation instanceof Array
) {
throw new Error("fields或relation格式错误");
}
fieldRes?.forEach((i, index) => {
i._relations = relation.find((j) => j.custom_form_field === i.field);
if (i.select_item && typeof i.select_item === "object") {
let keys = Object.keys(i.select_item);
if (keys.length > 0) {
i._params = keys.map((key) => {
return {
key,
value: /^\d*$/.test(i.select_item[key])
? Number(i.select_item[key])
: i.select_item[key],
};
});
}
}
if (i.edit_input === "file" || i.edit_input === "files") {
return;
}
if (i._relations) {
if (baseTable.get(i._relations.link_table_name)) {
baseTable
.get(i._relations.link_table_name)()
.then((res) => (i._params = res));
} else {
i._params = i._relations.parameter_id
? getparameter({ id: i._relations.parameter_id }, false).then(
(res) => {
i._params = res.detail;
}
)
: this.index({
table_name: i._relations.link_table_name,
page: 1,
page_size: 9999,
}).then((res) => {
i._params = res.data;
});
}
}
});
this.form = fields;
this.form
?.filter((i) => i.list_show)
.forEach((i) => {
let linkOb = {};
if (i.edit_input === "richtext") {
linkOb.customFn = (row) => {
return (
<div
style={{ "max-height": "55px", overflow: "scroll" }}
domPropsInnerHTML={row[i.field]}
></div>
);
};
}
if (
i.select_item &&
typeof i.select_item === "object" &&
!(i.select_item instanceof Array)
) {
let keys = Object.keys(i.select_item);
linkOb.customFn = (row) => {
let paramMap = new Map();
keys.forEach((key) => {
paramMap.set(i.select_item[key], key);
});
return <span>{paramMap.get(row[i.field]?.toString())}</span>;
};
}
if (i._relations) {
let { link_relation, foreign_key, link_with_name } = i._relations;
if (link_relation === "newHasOne" || link_relation === "hasOne") {
linkOb.customFn = (row) => {
if (i.edit_input === "file") {
return (
<a
download={row[link_with_name]?.original_name}
href={row[link_with_name]?.url}
>
{row[link_with_name]?.original_name}
</a>
);
} else {
return (
<span>
{row[link_with_name]?.name ||
row[link_with_name]?.no ||
row[link_with_name]?.value}
</span>
);
}
};
}
if (link_relation === "hasMany" || link_relation === "newHasMany") {
linkOb.customFn = (row) => {
if (i.edit_input === "files") {
return (
<div style="display: flex;flex-direction: column;">
{row[link_with_name]?.map((o) => (
<a>{o?.original_name || o?.name}</a>
))}
</div>
);
} else {
return (
<div>
{row[link_with_name]?.map((o) => (
<p>
{o?.name ||
o?.no ||
o?.value ||
o?.biaoti ||
o?.mingcheng || o?.telephone || o?.id}
</p>
))}
</div>
);
}
};
}
}
let alignLeft = [];
this.table.push(
Object.assign(
{
prop: i.field,
label: i.name,
width: i.width,
align: alignLeft.find((m) => m === i.field) ? "left" : "center",
fixed: i.is_fixed,
},
linkOb
)
);
});
this.table.unshift({
type: "index",
width: 60,
label: "序号",
});
},
},
computed: {
columnArrTest() {
return function (field) {
return this.form.find((i) => i.field === field)
? this.form.find((i) => i.field === field).search_input ===
"checkbox" ||
this.form.find((i) => i.field === field).search_input === "radio"
: false;
};
},
getColumnField() {
return function (field) {
return this.form.find((i) => i.field === field)
? this.form.find((i) => i.field === field)
: {};
};
},
getColumnParams() {
return function (field) {
return this.form.find((i) => i.field === field)
? this.form.find((i) => i.field === field)._params
: [];
};
},
tableSelect() {
let filter = [...this.select.filter, ...this.selectQuery];
return {
...this.select,
filter,
};
},
},
created() {
this.getFormDetail();
},
};
</script>
<style scoped lang="scss">
.select {
&__item {
& > p {
display: inline-block;
width: 80px;
text-align: center;
}
& + div {
margin-top: 6px;
}
}
}
.add-btn {
display: flex;
justify-content: center;
align-items: center;
margin-top: 10px;
& > span {
padding: 0 10px;
}
}
a {
color: red;
text-decoration: none;
transition: all 0.2s;
}
a:hover {
color: red;
text-decoration: underline;
}
</style>

@ -3,6 +3,7 @@ import { save, show, index, destroy } from "@/api/system/baseForm";
import { CreateDialog } from "@/utils/createDialog"
import { deepCopy } from "@/utils";
import { resolveFormInfo } from '@/utils/createTable';
import { sendSms } from "@/api/other"
export default {
props: {
tableName: String,
@ -10,6 +11,35 @@ export default {
render(h) {
let dialog = new CreateDialog(this,[
{
key: "telephone_group",
label: "通知号码组",
render: row => {
return (
<el-select style="width: 100%;"
vModel={this.groupId}
value-key="id"
clearable={true}
on={{
['change']:e => {
this.smsForm.mobile = e.id_telephone_group_relations_group_id_relation?.map(i => i.name)}
}}>
{
this.telephoneGroups.map(i =>
(
<el-option value={i} label={i.name}>
<span style="float: left">{i.name}</span>
<span style="text-align: right;float: right;width: 50%;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
{
i.id_telephone_group_relations_group_id_relation?.map((j, ji) => (j.name + ( ji === i.id_telephone_group_relations_group_id_relation.length - 1 ? '' : ',' )))
}
</span>
</el-option>
)
)
}
</el-select>
)
}
}
],{
width: "650px"
@ -29,6 +59,13 @@ export default {
originalForm: {},
rules: {},
file: {},
telephoneGroups: [],
groupId: '',
smsForm: {
mobile: [],
content: ""
}
};
},
methods: {
@ -99,6 +136,7 @@ export default {
},
submit() {
this.smsForm.content = this.form.content
if (this.type === "add") {
this.form.transfer_id = this.transfer_id;
if (this.form.hasOwnProperty("id")) {
@ -121,8 +159,20 @@ export default {
});
this.$emit("refresh");
this.hidden();
if (this.smsForm.mobile && this.smsForm.mobile.length > 0 && this.smsForm.content) {
sendSms(this.smsForm)
}
})
},
async getTelephoneGroups () {
this.telephoneGroups = (await index({
table_name: "groups",
page: 1,
page_size: 999
})).data
}
},
computed: {
title () {
@ -190,6 +240,7 @@ export default {
},
},
created() {
this.getTelephoneGroups()
resolveFormInfo(5,'form').then(res => this.formInfo = res)
}
};

@ -68,7 +68,7 @@
</div>
<Button type="primary" size="small" class="list-item__btn" @click="stepClick(item,{},true)"></Button>
<Button type="primary" size="small" class="list-item__btn" @click="$emit('callback',item)"></Button>
<Icon v-if="isShowNotice(item)" type="md-volume-down" color="#db4f2b" class="list-item__callback" @click="$emit('callbackList',item)"/>
<Icon v-if="isShowNotice(item)" type="md-alert" color="#db4f2b" class="list-item__callback" @click="$emit('callbackList',item)"/>
</div>
</transition-group>
</div>
@ -513,6 +513,21 @@ $list-height: calc(#{$container-height} - 5.33rem);
color: #333;
border-color: #a4ddf0;
}
&__callback {
font-size: 2.2rem;
margin-left: 6px;
animation: flash 5s infinite linear;
cursor: pointer;
@keyframes flash {
0%,4%,100% {
opacity: 1;
}
2% {
opacity: 0;
}
}
}
}
}
</style>

@ -68,7 +68,7 @@
</div>
<Button type="primary" size="small" class="list-item__btn" @click="stepClick(item,{},true)"></Button>
<Button type="primary" size="small" class="list-item__btn" @click="$emit('callback',item)"></Button>
<Icon v-if="isShowNotice(item)" type="md-volume-down" color="#db4f2b" class="list-item__callback" @click="$emit('callbackList',item)"/>
<Icon v-if="isShowNotice(item)" type="md-alert" color="#db4f2b" class="list-item__callback" @click="$emit('callbackList',item)"/>
</div>
</transition-group>
</div>

@ -396,6 +396,7 @@ export default {
};
},
methods: {
setTransferStatus (status,row) {
let copyRow = deepCopy(row);
copyRow.status = status;

@ -100,6 +100,7 @@
>模板选择</Button
>
</el-popover>
<Input v-model="select.name" style="width: 140px;margin-left: auto;" placeholder="点位名称"></Input>
</div>
</div>
@ -244,6 +245,7 @@ export default {
area: [],
type: [],
leibie: [],
name: ""
},
weather: [],
copyOriginalData: [],
@ -1144,9 +1146,10 @@ export default {
},
select: {
handler: function (val) {
if (val.area.length > 0 || val.type.length > 0) {
if (val.area.length > 0 || val.type.length > 0 || val.name) {
let list1 = [];
let list2 = [];
let list3 = [];
if (val.area.length > 0) {
list1 = this.equipments().filter((i) =>
val.area.find((j) => j === i.area)
@ -1157,8 +1160,13 @@ export default {
val.type.find((j) => j === i.type)
);
}
if (val.name) {
list3 = this.equipments().filter((i) =>
new RegExp(val.name, "g").test(i.name)
);
}
this.data =
Array.from(new Set([...list1, ...list2].map(JSON.stringify)))
Array.from(new Set([...list1, ...list2,...list3].map(JSON.stringify)))
.map(JSON.parse)
.map((i) => ({
equipment: i,

@ -287,33 +287,20 @@
}
"
>
<template #callback="{ row }">
<template #reject="{ row }">
<Button
size="small"
type="primary"
@click="
$refs['callback'].setId(row.id),
$refs['callback'].setType('add'),
$refs['callback'].show()
"
>反馈</Button
@click="rejectFeedback(row)"
>驳回反馈</Button
>
</template>
<template #distribute="{ row }">
<template #cancel="{ row }">
<Button
v-if="row.status === 1"
size="small"
type="primary"
@click="setTransferStatus(2,row)"
>下发</Button
>
<Button
v-if="row.status === 2"
size="small"
type="primary"
ghost
@click="setTransferStatus(1,row)"
>取消</Button
@click="cancelTransfer(row)"
>退回调令</Button
>
</template>
</xy-table>
@ -381,6 +368,44 @@ export default {
};
},
methods: {
rejectFeedback (row) {
this.$confirm('确认进行此操作, 是否继续?','提示',{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(_ => {
save({
table_name: 'feedbacks',
id: row.id,
status: 0
}).then(_ => {
this.$message({
type: "success",
message: "操作成功"
})
this.$refs['xyTable'].getTableData()
})
})
},
cancelTransfer (row) {
this.$confirm('确认进行此操作, 是否继续?','提示',{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(_ => {
save({
table_name: 'transfers',
id: row.transfer_id,
status: 1
}).then(_ => {
this.$message({
type: "success",
message: "操作成功"
})
})
})
},
setTransferStatus (status,row) {
let copyRow = deepCopy(row);
copyRow.status = status;

Loading…
Cancel
Save