|
|
@@ -0,0 +1,305 @@
|
|
|
+<template>
|
|
|
+ <div class="rule-type">
|
|
|
+ <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="180px"
|
|
|
+ label-prefix=":"
|
|
|
+ >
|
|
|
+ <el-form-item prop="signLevel" label="签署层级:">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.signLevel"
|
|
|
+ style="width: 100%"
|
|
|
+ placeholder="请选择签署层级"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dict.type.sign_level"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="`${dict.value}`"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="type" label="签署责任书类型:">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.type"
|
|
|
+ style="width: 100%"
|
|
|
+ placeholder="请选择签署责任书类型"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dict.type.safety_book_type"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="`${dict.value}`"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </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="partyA" label="甲方:">
|
|
|
+ <div>
|
|
|
+ <el-input
|
|
|
+ v-model="formData.partyA"
|
|
|
+ placeholder="请输入甲方:"
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="partyAOrg" label="甲方机构:">
|
|
|
+ <div>
|
|
|
+ <el-input
|
|
|
+ v-model="formData.partyAOrg"
|
|
|
+ placeholder="请输入甲方机构:"
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="partyB" label="乙方:">
|
|
|
+ <div>
|
|
|
+ <el-input
|
|
|
+ v-model="formData.partyB"
|
|
|
+ placeholder="请输入乙方:"
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="partyBOrg" label="乙方机构:">
|
|
|
+ <tree-select
|
|
|
+ v-model="formData.partyBOrg"
|
|
|
+ :options="deptOptions"
|
|
|
+ :show-count="true"
|
|
|
+ :normalizer="tenantIdnormalizer"
|
|
|
+ :props="{ checkStrictly: true, label: 'shortName' }"
|
|
|
+ placeholder="请选择乙方所属机构"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <!-- <el-form-item prop="userIds" label="签署人:">
|
|
|
+ <div>
|
|
|
+ <el-input
|
|
|
+ :readonly="true"
|
|
|
+ v-model="joinedStringArray"
|
|
|
+ placeholder="点击选择"
|
|
|
+ ></el-input>
|
|
|
+ <el-button @click="selectUser">选择</el-button>
|
|
|
+ </div>
|
|
|
+ </el-form-item> -->
|
|
|
+ <el-form-item prop="time" label="签署时间:">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="formData.time"
|
|
|
+ :clearable="true"
|
|
|
+ type="date"
|
|
|
+ placeholder="选择时间"
|
|
|
+ value-format="yyyy-MM-dd hh:mm:ss"
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <el-col :xs="24" :sm="24" :md="24" :lg="24">
|
|
|
+ <el-form-item label="上传文件" prop="files">
|
|
|
+ <W-file-upload
|
|
|
+ ref="upload"
|
|
|
+ :defaultValue="formFileListDefualtValue"
|
|
|
+ v-model="formData.files"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div slot="footer" class="dialog-footer" style="margin-top: 10px">
|
|
|
+ <el-button @click="isShow = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="onSubmit">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </DialogCom>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { mapState, mapMutations } from "vuex";
|
|
|
+import { mapGetters } from "vuex";
|
|
|
+import WFileUpload from "@/components/W-FileUpload/index.vue";
|
|
|
+import {
|
|
|
+ listSafetyBook,
|
|
|
+ getSafetyBook,
|
|
|
+ editOrAdd,
|
|
|
+ delSafetyBook,
|
|
|
+} from "@/api/safetyBookNew/index";
|
|
|
+import { deptTreeSelect } from "@/api/system/public";
|
|
|
+import dayjs from "dayjs";
|
|
|
+export default {
|
|
|
+ dicts: ["safety_book_type","sign_level"],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ id: null,
|
|
|
+ isShow: false,
|
|
|
+ timeClearable: true,
|
|
|
+ formData: this.reset(),
|
|
|
+ tableData: [],
|
|
|
+ formFileListDefualtValue: [],
|
|
|
+ //修改新增中的机构树
|
|
|
+ deptOptions: [],
|
|
|
+ formDataRules: {
|
|
|
+
|
|
|
+ type: [{ required: true, message: "请选择签署责任书类型" }],
|
|
|
+ year: [{ required: true, message: "请选择所属年度" }],
|
|
|
+ partyA: [{ required: true, message: "请输入甲方" }],
|
|
|
+ partyAOrg: [{ required: true, message: "请输入甲方机构" }],
|
|
|
+ partyB: [{ required: true, message: "请输入乙方" }],
|
|
|
+ partyBOrg: [{ required: true, message: "请输入乙方机构" }],
|
|
|
+ time: [{ required: true, message: "请选择时间" }],
|
|
|
+ files: [{ required: true, message: "请上传责任书" }],
|
|
|
+ },
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
+ watch: {},
|
|
|
+ computed: {
|
|
|
+ ...mapState([]),
|
|
|
+ ...mapGetters(["orgId", "orgName"]),
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...mapMutations([]),
|
|
|
+ isPic(url) {
|
|
|
+ if (url.endsWith("jpg") || url.endsWith("png")) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ },
|
|
|
+
|
|
|
+ dayjs,
|
|
|
+
|
|
|
+ editII(row) {
|
|
|
+
|
|
|
+ },
|
|
|
+ //新增签署
|
|
|
+ openSelect() {
|
|
|
+
|
|
|
+ },
|
|
|
+ /** 查询机构树数据 */
|
|
|
+ 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,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ removeRow(row) {
|
|
|
+ this.$modal
|
|
|
+ .confirm("是否确认删除?")
|
|
|
+ .then(function () {})
|
|
|
+ .then(() => {
|
|
|
+ this.tableData = this.tableData.filter((item) => item !== row);
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ });
|
|
|
+ },
|
|
|
+ reset() {
|
|
|
+ return {
|
|
|
+ id: null,
|
|
|
+ type: null,
|
|
|
+ year: null,
|
|
|
+ time: null,
|
|
|
+ files: [],
|
|
|
+ partyA: null,
|
|
|
+ partyAOrg: null,
|
|
|
+ partyB: null,
|
|
|
+ partyBOrg: null,
|
|
|
+ signLevel:null,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ async refresh(id) {
|
|
|
+ if (id != null && id != undefined) {
|
|
|
+ await getSafetyBook(id).then((res) => {
|
|
|
+ // console.log(res.data,"res")
|
|
|
+ this.formData = res.data;
|
|
|
+ this.tableData = res.data.bookUsers;
|
|
|
+ this.formFileListDefualtValue = res.data.files;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async show(id) {
|
|
|
+ // console.log(id, "id");
|
|
|
+ this.formFileListDefualtValue = [];
|
|
|
+ this.getDeptTree();
|
|
|
+ this.formData = this.reset();
|
|
|
+ this.tableData = [];
|
|
|
+ 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;
|
|
|
+ this.formData.bookUsers = this.tableData;
|
|
|
+ await editOrAdd(this.formData);
|
|
|
+ this.$emit("success");
|
|
|
+ this.isShow = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 事件
|
|
|
+ //apimark//
|
|
|
+ },
|
|
|
+ mounted() {},
|
|
|
+ components: { WFileUpload },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.brand_info {
|
|
|
+ .el-form {
|
|
|
+ width: 600px;
|
|
|
+ padding-top: 40px;
|
|
|
+ }
|
|
|
+}
|
|
|
+.container {
|
|
|
+ width: 50px;
|
|
|
+ height: 50px;
|
|
|
+ float: left;
|
|
|
+ .item {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ .item img {
|
|
|
+ width: 100% !important;
|
|
|
+ object-fit: cover !important;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|