123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325 |
- <template>
- <el-dialog
- :title="!dataForm.id ? '新增' : '修改'"
- :close-on-click-modal="false"
- :before-close="closeDialog"
- :visible.sync="visible"
- :modal="false"
- width="75%">
- <el-form :inline="true" :model="dataForm" :rules="dataRule" ref="dataForm">
- <div class="form-group dialog">
- <el-form-item label="审核路径名称" prop="pathName">
- <el-input v-model="dataForm.pathName" placeholder="审核路径名称"></el-input>
- </el-form-item>
- <el-form-item label="状态" prop="status">
- <el-select v-model="dataForm.status" placeholder="状态" style="width: 100%">
- <el-option
- v-for="item in optionsStatue"
- :key="item.id"
- :label="item.name"
- :value="item.id">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="维护人" prop="opUserName">
- <el-input v-model="dataForm.opUserName" disabled placeholder="维护人"></el-input>
- </el-form-item>
- <el-form-item label="维护时间" prop="opDate">
- <el-input v-model="dataForm.opDate" disabled placeholder="维护时间"></el-input>
- </el-form-item>
- <el-form-item label="备注" class="full" prop="remarks">
- <el-input v-model="dataForm.remarks" placeholder="备注"></el-input>
- </el-form-item>
- </div>
- </el-form>
- <el-button @click.prevent="addRow()" style="float: left">添加</el-button>
- <el-table :data="dataList" tooltip-effect="dark" border stripe style="width: 100%; margin-bottom: 20px">
- <el-table-column
- width="80PX"
- label="级次"
- type="index">
- </el-table-column>
- <el-table-column
- prop="levelName"
- header-align="center"
- align="center"
- label="路径名称">
- <template slot-scope="scope">
- <el-input v-model="scope.row.levelName" placeholder="路径名称" show-word-limit/>
- </template>
- </el-table-column>
- <el-table-column
- prop="iffixAuditUser"
- header-align="center"
- align="center"
- label="是否指定审批人">
- <template slot-scope="scope">
- <el-select v-model="scope.row.iffixAuditUser" placeholder="是否指定审批人" @change="changeIffixAudit(scope.row)"
- style="width: 100%">
- <el-option
- v-for="item in optionsiffixAudit"
- :key="item.id"
- :label="item.name"
- :value="item.id">
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column
- prop="auditUserId"
- header-align="center"
- align="center"
- label="审核人">
- <template slot-scope="scope">
- <el-select v-model="scope.row.auditUserId" v-if="scope.row.iffixAuditUser === 'F'"
- filterable multiple collapse-tags placeholder="审核人" style="width: 100%">
- <el-option
- v-for="item in optionsUsers"
- :key="item.userId"
- :label="item.actualname"
- :value="item.userId">
- </el-option>
- </el-select>
- <el-select v-model="scope.row.auditUserId" v-if="scope.row.iffixAuditUser === 'T'"
- filterable multiple collapse-tags placeholder="审核人" style="width: 100%">
- <el-option
- v-for="item in optionsUsers_s"
- :key="item.userId"
- :label="item.userName"
- :value="item.userId">
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column
- prop="iffinalItem"
- header-align="center"
- align="center"
- label="是否最后一级">
- <template slot-scope="scope">
- <el-select v-model="scope.row.iffinalItem" placeholder="是否最后一级" style="width: 100%">
- <el-option
- v-for="item in optionsIfStatus"
- :key="item.val"
- :label="item.name"
- :value="item.val">
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column
- prop="remarks"
- header-align="center"
- align="center"
- label="备注">
- <template slot-scope="scope">
- <el-input v-model="scope.row.remarks" placeholder="备注" show-word-limit/>
- </template>
- </el-table-column>
- <el-table-column
- header-align="center"
- align="center"
- label="操作">
- <template slot-scope="scope">
- <el-button @click.native.prevent="deleteRow(scope.$index, dataList)" size="small">移除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <span slot="footer" class="dialog-footer">
- <el-button @click="closeDia">取消</el-button>
- <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
- </span>
- </el-dialog>
- </template>
- <script>
- import {addCharge,reviewer,modify} from '@/api/system/auditPaths-add-or-update'
- import { queryUserVal } from '@/api/warehouseBusiness/agreement'
- import { listUser } from '@/api/system/user'
- export default {
- data () {
- return {
- dataForm: {
- status: 'A',
- },
- visible: false,
- dataRule: {},
- dataList: [],
- optionsUsers: [],
- optionsUsers_s:[],
- optionsiffixAudit: [{
- id: 'T',
- name: '是'
- }, {
- id: 'F',
- name: '否'
- }],
- optionsIfStatus: [{
- val: 'F',
- name: '否'
- }, {
- val: 'T',
- name: '是'
- }],
- optionsStatue: [{
- id: 'A',
- name: '有效'
- }, {
- id: 'S',
- name: '停用'
- }]
- }
- },
- methods: {
- init (val) {
- this.optionsUsers = []
- this.visible = true
- if (typeof val !== 'undefined') {
- console.log(val)
- this.queryAuditPath(val)
- this.queryUsers()
- } else {
- this.queryUsers()
- }
- },
- queryUsers () {
- queryUserVal().then((response)=>{
- // this.contrastList.createBy = response.user.userName
- // this.dataForm.opUserName = response.user.userName
- console.log(response)
- this.$set(this.dataForm, "opUserName", response.user.userName);
- this.$set(this.dataForm, "opDate", response.date.slice(0,10));
- })
- console.log(this.dataForm)
- //请求所有审核人角色
- reviewer().then(data =>{
- this.optionsUsers = data
- console.log(data)
- })
- //请求所有用户名
- listUser().then(response => {
- this.optionsUsers_s = response.rows
- console.log(response.rows)
- })
- // this.$http({
- // url: this.$http.adornUrl('/sys/user/selectUser'),
- // method: 'post',
- // data: ({mobile: 'auditUser'})
- // }).then(({data}) => {
- // if (typeof data.list !== 'undefined' && data.list !== null) {
- // if (typeof data.list.users !== 'undefined' && data.list.users !== null) {
- // this.optionsUsers = data.list.users
- // }
- // }
- // })
- },
- queryAuditPath (val) {
- modify(val).then(res => {
- console.log(res)
- let data = res.data.data
- this.dataForm = data.auditPaths
- this.dataList = data.auditPathsLevels
- for (let index in this.dataList){
- this.dataList[index].auditUserId = data.auditUserIds[index]
- }
- })
- },
- addRow () {
- let val = {
- levelName: null,
- auditUserId: [],
- // auditUserName: null,
- iffixAuditUser: 'T',
- iffinalItem: 'T',
- remarks: null
- }
- this.dataList.push(val)
- },
- deleteRow (index, rows) { // 删除改行
- rows.splice(index, 1)
- },
- changeIffixAudit (row) {
- row.auditUserId = []
- },
- // 表单提交
- dataFormSubmit () {
- console.log(this.dataForm)
- console.log(this.dataList)
- if (this.dataList.length === 0) {
- this.$message.error('请维护审批级次')
- return false
- }
- for (let x in this.dataList) {
- if (this.dataList[x].iffixAuditUser === 'S') {
- if (this.dataList[x].auditUserId === null || this.dataList[x].auditUserId === '' || this.dataList[x].auditUserId.length === 0) {
- this.$message.error('请维护第' + (Number(x) + 1) + '级的审核人')
- return false
- }
- }
- }
- let formData = new FormData()
- formData.append('auditPaths', JSON.stringify(this.dataForm))
- formData.append('auditPathsLevels', JSON.stringify(this.dataList))
- this.$confirm(`是否提交?`, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(function() {
- return addCharge(formData)
- }).then((data) => {
- console.log(data)
- if (data && data.code === 200) {
- this.$message({
- message: '操作成功',
- type: 'success'
- });
- this.closeDia()
- } else {
- this.$message.error(data.msg)
- }
- })
- // this.$confirm(`是否提交?`, '提示', {
- // confirmButtonText: '确定',
- // cancelButtonText: '取消',
- // type: 'warning'
- // }).then(() => {
- // let formData = new FormData()
- // formData.append('auditPaths', JSON.stringify(this.dataForm))
- // formData.append('auditPathsLevels', JSON.stringify(this.dataList))
- // this.$http({
- // url: this.$http.adornUrl(`/engineering/auditPaths/save`),
- // method: 'post',
- // data: formData
- // }).then(({data}) => {
- // if (data && data.code === 0) {
- // this.$message({
- // message: '操作成功',
- // type: 'success',
- // duration: 600,
- // onClose: () => {
- // this.closeDia()
- // }
- // })
- // } else {
- // this.$message.error(data.msg)
- // }
- // })
- // })
- },
- closeDialog (done) {
- done()
- // location.reload()
- this.visible = false
- this.$emit('refreshDataList')
- Object.assign(this.$data, this.$options.data.call(this))
- },
- closeDia () {
- this.visible = false
- this.$emit('refreshDataList')
- Object.assign(this.$data, this.$options.data.call(this))
- }
- }
- }
- </script>
|