|
|
@@ -0,0 +1,281 @@
|
|
|
+<template>
|
|
|
+ <div class="workSummary">
|
|
|
+ <DialogCom
|
|
|
+ :title="id ? '编辑安全保卫部年度工作总结' : '新增安全保卫部年度工作总结'"
|
|
|
+ :visible.sync="isShow"
|
|
|
+ @close="onHide"
|
|
|
+ width="700px"
|
|
|
+ >
|
|
|
+ <div class="page-body">
|
|
|
+ <el-form
|
|
|
+ :model="formData"
|
|
|
+ :rules="formDataRules"
|
|
|
+ size="small"
|
|
|
+ ref="form"
|
|
|
+ label-position="right"
|
|
|
+ label-width="130px"
|
|
|
+ label-prefix=":"
|
|
|
+ >
|
|
|
+ <el-form-item prop="orgId" label="行社名称:">
|
|
|
+ <!-- <tree-select
|
|
|
+ v-model="formData.orgId"
|
|
|
+ :options="deptOptions"
|
|
|
+ :show-count="true"
|
|
|
+ :normalizer="tenantIdnormalizer"
|
|
|
+ :props="{ checkStrictly: true, label: 'name' }"
|
|
|
+ placeholder="请选择机构"
|
|
|
+ :noChildrenText="''"
|
|
|
+ noOptionsText="没有数据"
|
|
|
+ noResultsText="没有搜索结果"
|
|
|
+ /> -->
|
|
|
+ <org-tree style="width: 100%"
|
|
|
+ v-model="formData.orgId"
|
|
|
+ @defaultKey="getDefaultKey"
|
|
|
+ @checkChange="checkChange"
|
|
|
+ @click="clickTreeNode"
|
|
|
+ :showCheckSub="false"
|
|
|
+ hangsheTree
|
|
|
+ ref="orgTree"
|
|
|
+ ></org-tree>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="type" label="文件种类:">
|
|
|
+ <el-input v-model="formData.type"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="工作年度:" prop="year">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="formData.year"
|
|
|
+ :clearable="timeClearable"
|
|
|
+ type="year"
|
|
|
+ placeholder="请选择工作总结年度"
|
|
|
+ value-format="yyyy"
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="date" label="文件日期:">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="formData.date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ placeholder="请选择文件发布日期"
|
|
|
+ type="date"
|
|
|
+ :clearable="false"
|
|
|
+ ></el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="文件资料" prop="images">
|
|
|
+ <W-file-upload
|
|
|
+ :fileType="['docx','doc', 'pdf']"
|
|
|
+ ref="upload"
|
|
|
+ :defaultValue="formFileListDefualtValue"
|
|
|
+ v-model="formData.images"
|
|
|
+ :fileSize="25"
|
|
|
+ @success="successHandler('form','images')"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div style="margin-top: 100px" slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="onSubmit">确定</el-button>
|
|
|
+ <el-button @click="isShow = false">取消</el-button>
|
|
|
+ </div>
|
|
|
+ </DialogCom>
|
|
|
+ <UserSelector
|
|
|
+ ref="UserSelector"
|
|
|
+ @select="onUserSelect"
|
|
|
+ :clearSelectOnClose="false"
|
|
|
+ ></UserSelector>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { mapState, mapMutations } from "vuex";
|
|
|
+import { mapGetters } from "vuex";
|
|
|
+import { Add, edit, getaqbwbndjh } from "@/api/safetyBook/aqbwbndjh";
|
|
|
+import { deptTreeSelect } from "@/api/system/public";
|
|
|
+import UserSelector from "@/components/userSelector/index.vue";
|
|
|
+import ImgsUpload from "@/components/ImgsUpload";
|
|
|
+import Editor from "@/components/Editor";
|
|
|
+import imgUpload from "@/components/ImageUpload/index.vue";
|
|
|
+import WFileUpload from "@/components/W-FileUpload/index.vue";
|
|
|
+import {noAuto} from '@/utils/fieldMxins.js'
|
|
|
+import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
|
|
|
+export default {
|
|
|
+ mixins:[noAuto],
|
|
|
+ dicts: ["safety_book_type"],
|
|
|
+ components: { UserSelector, ImgsUpload, Editor, imgUpload, WFileUpload,OrgTree },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ formFileListDefualtValue: [],
|
|
|
+ id: null,
|
|
|
+ isShow: false,
|
|
|
+ timeClearable: true,
|
|
|
+ formData: this.reset(),
|
|
|
+ //修改新增中的机构树
|
|
|
+ deptOptions: [],
|
|
|
+ formDataRules: {
|
|
|
+ userIds: [{ required: true, message: "请选择参与人员" }],
|
|
|
+ date: [{ required: true, message: "请选择日期" }],
|
|
|
+ images: [{ required: true, message: "请上传年度工作总结文件" }],
|
|
|
+ content: [{ required: true, message: "请输入内容" }],
|
|
|
+ orgId: [{ required: true, message: "请选择机构" }],
|
|
|
+ type: [{ required: true, message: "请输入文件种类" }],
|
|
|
+ year: [{ required: true, message: "请选择年度" }],
|
|
|
+ },
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
+ watch: {},
|
|
|
+ computed: {
|
|
|
+ ...mapState([]),
|
|
|
+ ...mapGetters(["orgId", "orgName"]),
|
|
|
+ // joinedStringArray: {
|
|
|
+ // get() {
|
|
|
+ // if (this.formData.names == null || this.formData.names == undefined) {
|
|
|
+ // this.formData.names = this.formData.userNames.split(", ");
|
|
|
+ // }
|
|
|
+ // return this.formData.names.join(", ");
|
|
|
+ // },
|
|
|
+ // set(value) {
|
|
|
+ // this.formData.names = value.split(", ");
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...mapMutations([]),
|
|
|
+ imageListChanged(list) {
|
|
|
+ this.formData.images = list;
|
|
|
+ console.log("images", this.formData.images);
|
|
|
+ },
|
|
|
+ // 节点单击事件
|
|
|
+ clickTreeNode(data) {
|
|
|
+ this.formData.orgId = data.id;
|
|
|
+ // this.handleQuery();
|
|
|
+ },
|
|
|
+ /** 下穿状态改变*/
|
|
|
+ // changeCheckBox() {
|
|
|
+ // this.getList();
|
|
|
+ // },
|
|
|
+
|
|
|
+ getDefaultKey(key) {
|
|
|
+ this.formData.orgId = key;
|
|
|
+ // this.getList();
|
|
|
+ },
|
|
|
+ /** 查询机构树数据 */
|
|
|
+ getDeptTree() {
|
|
|
+ deptTreeSelect().then((response) => {
|
|
|
+ this.deptOptions = response.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** treeSelect组件自定义数据*/
|
|
|
+ tenantIdnormalizer(node, instanceId) {
|
|
|
+ if (node.children && !node.children.length) {
|
|
|
+ delete node.children;
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ id: node.id,
|
|
|
+ label: node.shortName,
|
|
|
+ children: node.children,
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
+ reset() {
|
|
|
+ return {
|
|
|
+ id: null,
|
|
|
+ // names: [],
|
|
|
+ // userIds: [],
|
|
|
+ date: null,
|
|
|
+ images: [],
|
|
|
+ // content: null,
|
|
|
+ title: null,
|
|
|
+ orgId: null,
|
|
|
+ type: "工作总结",
|
|
|
+ year: null,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ async refresh(id) {
|
|
|
+ this.formFileListDefualtValue = [];
|
|
|
+ if (id != null && id != undefined) {
|
|
|
+ await getaqbwbndjh(id).then((res) => {
|
|
|
+ // this.formData.names = res.data.userNames.split(",");
|
|
|
+ this.formData = res.data;
|
|
|
+ this.formFileListDefualtValue = res.data.images;
|
|
|
+ // this.formData.year=res.data.year;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async show(id) {
|
|
|
+ // console.log(id, "id");
|
|
|
+ this.getDeptTree();
|
|
|
+ this.formData = this.reset();
|
|
|
+ this.id = id;
|
|
|
+ await this.refresh(id);
|
|
|
+ if (id) {
|
|
|
+ } else {
|
|
|
+ // console.log(this.orgId,"this.orgId")
|
|
|
+ this.formData.orgId = this.orgId;
|
|
|
+ }
|
|
|
+ this.isShow = true;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 事件
|
|
|
+ onHide() {
|
|
|
+ this.formData = this.reset();
|
|
|
+ this.$refs.form.resetFields();
|
|
|
+ },
|
|
|
+ onSubmit() {
|
|
|
+ console.log(this.formData, "this.formData");
|
|
|
+ this.$refs.form.validate(async (isValidate) => {
|
|
|
+ if (!isValidate) return;
|
|
|
+ if (this.id == null || this.id == undefined) {
|
|
|
+ await Add(this.formData).then((res) => {
|
|
|
+ this.$emit("success");
|
|
|
+ this.isShow = false;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ await edit(this.formData).then((res) => {
|
|
|
+ this.$emit("success");
|
|
|
+ this.isShow = false;
|
|
|
+ });
|
|
|
+ this.$refs["UserSelector"].clearSelected();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //选择用户回调
|
|
|
+ onUserSelect(data) {
|
|
|
+ var ids = data.map((obj) => obj.id);
|
|
|
+ var names = data.map((obj) => obj.name);
|
|
|
+ this.formData.userIds = ids;
|
|
|
+ this.formData.names = names;
|
|
|
+ this.formData.userNames = names.join(",");
|
|
|
+ // console.log(this.formData.userIds, "this.formData.userIds");
|
|
|
+ },
|
|
|
+ //用户选择
|
|
|
+ selectUser(event) {
|
|
|
+ // event.preventDefault();
|
|
|
+ this.$refs.UserSelector.show();
|
|
|
+ },
|
|
|
+
|
|
|
+ // 事件
|
|
|
+ //apimark//
|
|
|
+ },
|
|
|
+ mounted() {},
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.workSummary {
|
|
|
+ // .el-form {
|
|
|
+ // width: 600px;
|
|
|
+ // padding-top: 40px;
|
|
|
+ // }
|
|
|
+ ::v-deep .org_query_selector{
|
|
|
+ width: 100% !important;
|
|
|
+ .vue-treeselect{
|
|
|
+ width: 100% !important;
|
|
|
+ }
|
|
|
+ div:first-child{
|
|
|
+ margin-right: 10px !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|