| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405 |
- <template>
- <el-container>
- <div class="main-item">
- <el-card class="box-card">
- <div slot="header" class="clearfix">
- <span>二级管理单位</span>
- <el-button
- @click="toAddUnitTwo"
- style="float: right; padding: 3px 0"
- type="text"
- v-if="ownPriv('manage')"
- >添加二级单位</el-button>
- </div>
- <el-table
- :data="unitTwoList"
- border
- stripe
- highlight-current-row
- @current-change="handleCurrentChange_unitTwo"
- :height="tableHeight"
- style="width: 100%">
- <el-table-column prop="nm" label="单位名称" min-width="120"></el-table-column>
- <el-table-column fixed="right" label="操作" min-width="100">
- <template slot-scope="scope">
- <el-button @click="toEditUnitTwo(scope.row)" icon="el-icon-edit" type="text" v-if="ownPriv('manage')"></el-button>
- <el-button @click="delete_unitTwo(scope.row)" icon="el-icon-delete" type="text" v-if="ownPriv('manage')"></el-button>
- <el-button @click="showProblem(scope.row,'二级管理单位')" icon="el-icon-tickets" type="text"></el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-card>
- </div>
- <div class="main-item">
- <el-card class="box-card">
- <div slot="header" class="clearfix">
- <span>三级管理单位</span>
- <el-button
- @click="toAddUnitThree"
- style="float: right; padding: 3px 0"
- type="text"
- >添加三级单位</el-button>
- </div>
- <el-table :data="unitThreeList" border stripe :height="tableHeight" style="width: 100%">
- <el-table-column prop="nm" label="单位名称" min-width="100"></el-table-column>
- <el-table-column prop="pidName" label="所属二级单位" min-width="100"></el-table-column>
- <el-table-column fixed="right" label="操作" min-width="100">
- <template slot-scope="scope">
- <el-button @click="toEditUnitThree(scope.row)" icon="el-icon-edit" type="text" v-if="ownPriv('manage')"></el-button>
- <el-button
- @click="delete_unitThree(scope.row)"
- icon="el-icon-delete"
- type="text"
- v-if="ownPriv('manage')"
- ></el-button>
- <el-button @click="showProblem(scope.row,'三级管理单位')" icon="el-icon-tickets" type="text"></el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-card>
- </div>
- <!-- 添加/编辑二级管理单位 -->
- <el-dialog :title="dialogType + '二级管理单位'" :visible.sync="unitTwo_Dialog">
- <el-form label-width="120px">
- <el-form-item label="二级单位名称" required>
- <el-input v-model="unitTwo.nm" clearable></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="unitTwo_Dialog = false">取 消</el-button>
- <el-button type="primary" @click="add_unitTwo">确 定</el-button>
- </div>
- </el-dialog>
- <!-- 添加/编辑三级管理单位 -->
- <el-dialog :title="dialogType + '三级管理单位'" :visible.sync="unitThree_Dialog">
- <el-form label-width="120px">
- <el-form-item label="三级单位名称" required>
- <el-input v-model="unitThree.nm" clearable></el-input>
- </el-form-item>
- <!-- <el-form-item label="所属二级单位" required>
- <el-select v-model="unitThree.pid" placeholder="请选择">
- <el-option
- :label="item.nm"
- :value="item.id"
- v-for="(item,index) in unitTwoList"
- :key="index"
- ></el-option>
- </el-select>
- </el-form-item> -->
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="unitThree_Dialog = false">取 消</el-button>
- <el-button type="primary" @click="add_unitThree">确 定</el-button>
- </div>
- </el-dialog>
- <project-problem @dialogClose="showProblemDialog = false" :villType="'9'" :unitLevel="unitLevel" :currentRow="currentRow" :unitProblemInfo="unitProblemInfo" v-if="showProblemDialog"></project-problem>
- </el-container>
- </template>
- <script>
- import request from '../../../utils/gw_ajax_request.js'
- import projectProblem from "./projectProblem.vue";
- export default {
- props: ['currentRow'],
- data(){
- return{
- tableHeight: window.innerHeight - 210,
- unitTwoList: [],
- unitThreeList: [],
- unitTwo: {
- nm: ""
- },
- unitThree: {
- nm: "",
- pid: ""
- },
- dialogType: "添加",
- unitTwo_Dialog: false,
- unitThree_Dialog: false,
- showProblemDialog: false,
- unitProblemInfo: {},
- unitLevel: '', //一级管理单位 二级管理单位 三级管理单位
- currentUnitTwoRow: {},
- isClicked: true
- }
- },
- components: {
- projectProblem: projectProblem
- },
- computed: {
- persId() {
- return localStorage.getItem("userid")
- ? localStorage.getItem("userid")
- : "1098101939614724096";
- },
- },
- methods:{
- //获取二级单位列表信息
- getUnitTwoList() {
- let paramObj = {
- lev: "2",
- regId: this.currentRow.id
- };
- request.post(`/bis/insp/mampu/info/findByList`, paramObj).then(res => {
- if (res.success) {
- this.unitTwoList = res.data;
- if(this.unitTwoList.length){
- this.currentUnitTwoRow = this.unitTwoList[0]
- this.getUnitThreeList()
- }else{
- this.unitThreeList = []
- }
- }
- });
- },
- //获取三级单位列表信息
- getUnitThreeList() {
- let paramObj = {
- lev: "3",
- regId: this.currentRow.id,
- pid: this.currentUnitTwoRow.id
- };
- request.post(`/bis/insp/mampu/info/findByList`, paramObj).then(res => {
- if (res.success) {
- this.unitThreeList = res.data;
- }
- });
- },
- // 添加二级管理单位
- toAddUnitTwo() {
- if(!this.currentRow.oneUnitName){
- this.$message.warning('请先添加一级管理单位')
- return
- }
- this.dialogType = "添加";
- this.unitTwo = {
- nm: ""
- };
- this.unitTwo_Dialog = true;
- },
- toEditUnitTwo(row) {
- this.dialogType = "编辑";
- let rowData = {};
- Object.assign(rowData, row);
- this.unitTwo = rowData;
- this.unitTwo_Dialog = true;
- },
- add_unitTwo() {
- if(!this.unitTwo.nm){
- this.$message.warning('请填写二级单位名称')
- return
- }
- if(this.isClicked){
- this.isClicked = false
- if (this.dialogType == "添加") {
- this.unitTwo.lev = "2";
- this.unitTwo.regId = this.currentRow.id;
- this.unitTwo.pid = this.currentRow.oneUnitId;
- this.unitTwo.persId = this.persId;
- request
- .post(`/bis/insp/mampu/info/add`, this.unitTwo)
- .then(res => {
- if (res.success) {
- this.$message.success(this.dialogType + "成功");
- this.unitTwo_Dialog = false;
- this.getUnitTwoList();
- setTimeout(()=> {
- this.isClicked = true
- }, 1000);
- } else {
- this.$message.error(res.message);
- }
- })
- .catch(error => {
- this.$message.error(res.message);
- });
- } else {
- request
- .post(`/bis/insp/mampu/info/update`, this.unitTwo)
- .then(res => {
- if (res.success) {
- this.$message.success(this.dialogType + "成功");
- this.unitTwo_Dialog = false;
- this.getUnitTwoList();
- setTimeout(()=> {
- this.isClicked = true
- }, 1000);
- } else {
- this.$message.error(res.message);
- }
- })
- .catch(error => {
- this.$message.error(res.message);
- });
- }
- }
- },
- delete_unitTwo(row) {
- this.$confirm("确认删除当前二级单位吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- request.post(`/bis/insp/mampu/info/delete/${row.id}`).then(res => {
- if (res.success) {
- this.$message.success("删除成功");
- this.getUnitTwoList();
- } else {
- this.$message.error(res.message);
- }
- });
- })
- .catch(() => {});
- },
- // 添加三级管理单位
- toAddUnitThree() {
- this.dialogType = "添加";
- this.unitThree = {
- nm: "",
- pid: this.currentUnitTwoRow.id
- };
- this.unitThree_Dialog = true;
- },
- toEditUnitThree(row) {
- this.dialogType = "编辑";
- let rowData = {};
- Object.assign(rowData, row);
- this.unitThree = rowData;
- this.unitThree_Dialog = true;
- },
- add_unitThree() {
- if(!this.unitThree.nm){
- this.$message.warning('请填写三级单位名称')
- return
- }
- if(this.isClicked){
- this.isClicked = false
- if (this.dialogType == "添加") {
- this.unitThree.lev = "3";
- this.unitThree.regId = this.currentRow.id;
- this.unitThree.pid = this.currentUnitTwoRow.id;
- this.unitThree.persId = this.persId;
- request
- .post(`/bis/insp/mampu/info/add`, this.unitThree)
- .then(res => {
- if (res.success) {
- this.$message.success(this.dialogType + "成功");
- this.unitThree_Dialog = false;
- this.getUnitThreeList();
- setTimeout(()=> {
- this.isClicked = true
- }, 1000);
- } else {
- this.$message.error(res.message);
- }
- })
- .catch(error => {
- this.$message.error(res.message);
- });
- } else {
- request
- .post(`/bis/insp/mampu/info/update`, this.unitThree)
- .then(res => {
- if (res.success) {
- this.$message.success(this.dialogType + "成功");
- this.unitThree_Dialog = false;
- this.getUnitThreeList();
- setTimeout(()=> {
- this.isClicked = true
- }, 1000);
- } else {
- this.$message.error(res.message);
- }
- })
- .catch(error => {
- this.$message.error(res.message);
- });
- }
- }
- },
- delete_unitThree(row) {
- this.$confirm("确认删除当前单位吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- request.post(`/bis/insp/mampu/info/delete/${row.id}`).then(res => {
- if (res.success) {
- this.$message.success("删除成功");
- this.getUnitThreeList();
- } else {
- this.$message.error(res.message);
- }
- });
- })
- .catch(() => {});
- },
- showProblem(row,level){
- this.unitProblemInfo = row
- this.unitLevel = level
- this.showProblemDialog = true
- },
- //表格选中行操作
- handleCurrentChange_unitTwo(val){
- if(val){
- this.currentUnitTwoRow = val;
- this.getUnitThreeList()
- }
- },
- },
- watch:{
- currentRow(val){
- if (val) {
- this.getUnitTwoList();
- this.getUnitThreeList();
- }
- }
- },
- filters: {
- nature(val) {
- if (val != "0" && !val) {
- return "";
- }
- if (val == "1") {
- return "项目法人(建设单位)";
- } else if (val == "2") {
- return "勘察设计单位";
- } else if (val == "3") {
- return "监理单位";
- } else if (val == "4") {
- return "施工单位";
- } else if (val == "5") {
- return "金属结构及机电设备安装单位";
- } else if (val == "6") {
- return "安全监测单位";
- } else if (val == "7") {
- return "质量检测单位";
- } else {
- return "其它";
- }
- },
- government(val) {
- if (val != "0" && !val) {
- return "";
- }
- if (val == "1") {
- return "直管";
- } else if (val == "2") {
- return "代建";
- }
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .main-item{
- width: 52%;
- &:first-child{
- width: 46%;
- margin-right: 0.5%;
- }
- }
- </style>
|