| | |
| | | <template>
|
| | | <div>
|
| | | <div class="body" :style="{height:mainHeight+'px'}">
|
| | | <div class="bodyTopButtonGroup" style="justify-content: space-between">
|
| | | <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
|
| | | <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=15')">导入</el-button>
|
| | | </div>
|
| | |
|
| | | <div class="bodyTopFormGroup">
|
| | | <el-form
|
| | | ref="form"
|
| | | :model="form"
|
| | | label-width="100px"
|
| | | inline
|
| | | style="display: flex;"
|
| | | >
|
| | | <div class="elForm">
|
| | | <el-form-item label="工序编码" style=" display: flex;">
|
| | | <el-input v-model="form.stepcode" placeholder="请输入" style="width: 200px" />
|
| | | </el-form-item>
|
| | | <el-form-item label="工序名称" style=" display: flex;">
|
| | | <el-input v-model="form.stepname" placeholder="请输入" style="width: 200px" />
|
| | | </el-form-item>
|
| | | <el-form-item label="工序类型" style=" display: flex;">
|
| | | <el-select
|
| | | v-model="form.steptypecode"
|
| | | style="width:200px"
|
| | | placeholder="请选择"
|
| | | :popper-append-to-body="false"
|
| | | >
|
| | | <el-option
|
| | | v-for="item in steptypeArr"
|
| | | :key="item.code"
|
| | | :label="item.name"
|
| | | :value="item.code"
|
| | | />
|
| | | </el-select>
|
| | | </el-form-item>
|
| | | <el-form-item label="状态" style=" display: flex;">
|
| | | <el-select
|
| | | v-model="form.enable"
|
| | | style="width:200px"
|
| | | placeholder="请选择"
|
| | | :popper-append-to-body="false"
|
| | | >
|
| | | <el-option
|
| | | v-for="item in enableArr"
|
| | | :key="item.code"
|
| | | :label="item.name"
|
| | | :value="item.code"
|
| | | />
|
| | | </el-select>
|
| | | </el-form-item>
|
| | | </div>
|
| | | <div
|
| | | class="bodySearchReset"
|
| | | :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
|
| | | >
|
| | | <el-button v-waves type="primary" icon="el-icon-search" @click="getStepSearch">查询</el-button>
|
| | | <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
|
| | | </div>
|
| | | </el-form>
|
| | | <div
|
| | | class="bodyTopFormExpand"
|
| | | style="height:5px"
|
| | | >
|
| | | <!-- <svg-icon-->
|
| | | <!-- v-show="mouseHoverType==='mouseout'"-->
|
| | | <!-- style="cursor: pointer"-->
|
| | | <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"-->
|
| | | <!-- @mouseenter="mouseHoverType=$event.type"-->
|
| | | <!-- />-->
|
| | | <!-- <svg-icon-->
|
| | | <!-- v-show="mouseHoverType==='mouseenter'"-->
|
| | | <!-- style="cursor: pointer"-->
|
| | | <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"-->
|
| | | <!-- @click="isExpandForm=!isExpandForm"-->
|
| | | <!-- @mouseout="mouseHoverType=$event.type"-->
|
| | | <!-- />-->
|
| | | </div>
|
| | | </div>
|
| | |
|
| | | <div class="elTableDiv">
|
| | | <el-table
|
| | | ref="tableDataRef"
|
| | | class="tableFixed"
|
| | | :data="tableData"
|
| | | :height="tableHeight+'px'"
|
| | | border
|
| | | row-class-name="custom-row"
|
| | | :style="{width: 100+'%',height:tableHeight+'px',}"
|
| | | highlight-current-row
|
| | | :header-cell-style="this.$headerCellStyle"
|
| | | :cell-style="this.$cellStyle"
|
| | | @sort-change="sortChange"
|
| | | >
|
| | | <el-table-column
|
| | | prop="rowNum"
|
| | | width="50"
|
| | | fixed
|
| | | label="序号"
|
| | | />
|
| | | <el-table-column
|
| | | prop="stepcode"
|
| | | label="工序编码"
|
| | | sortable="custom"
|
| | | />
|
| | | <el-table-column
|
| | | prop="stepname"
|
| | | label="工序名称"
|
| | | sortable="custom"
|
| | | />
|
| | | <el-table-column
|
| | | prop="flwtype"
|
| | | label="工序类型"
|
| | | sortable="custom"
|
| | | >
|
| | | <template slot-scope="{row}">
|
| | | {{ row.flwtype==='Z'?'自制':'外协' }}
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column
|
| | | prop="enable"
|
| | | label="状态"
|
| | | sortable="custom"
|
| | | >
|
| | | <template slot-scope="{row}">
|
| | | <el-tag v-if="row.enable==='Y'" size="small" type="success">正常</el-tag>
|
| | | <el-tag v-if="row.enable==='N'" size="small" type="danger">停用</el-tag>
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column
|
| | | prop="descr"
|
| | | label="描述"
|
| | | sortable="custom"
|
| | | >
|
| | | <template slot-scope="{row}">
|
| | | {{ row.descr?row.descr:'/' }}
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column
|
| | | prop="lm_user"
|
| | | label="创建人员"
|
| | | sortable="custom"
|
| | | />
|
| | | <el-table-column
|
| | | prop="lm_date"
|
| | | label="创建时间"
|
| | | width="160"
|
| | | sortable="custom"
|
| | | />
|
| | | <el-table-column
|
| | | label="操作"
|
| | | width="120"
|
| | | fixed="right"
|
| | | >
|
| | | <template slot-scope="{row}">
|
| | | <div class="operationClass">
|
| | | <el-tooltip class="item" effect="dark" content="编辑" placement="top">
|
| | | <i
|
| | | v-if="row.leve!==0"
|
| | | class="el-icon-edit-outline"
|
| | | :style="{color:$store.state.settings.theme}"
|
| | | @click="edit('edit',row)"
|
| | | />
|
| | | </el-tooltip>
|
| | | <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">
|
| | | <i
|
| | | v-if="row.leve!==0"
|
| | | class="el-icon-delete"
|
| | | :style="{color:$store.state.settings.theme}"
|
| | | @click="del(row)"
|
| | | />
|
| | | </el-tooltip>
|
| | | </div>
|
| | | </template>
|
| | | </el-table-column>
|
| | | </el-table>
|
| | | </div>
|
| | | <!--分页-->
|
| | | <pagination
|
| | | :total="total"
|
| | | :page.sync="form.page"
|
| | | :limit.sync="form.rows"
|
| | | align="right"
|
| | | layout="total,prev, pager, next,sizes,jumper"
|
| | | popper-class="select_bottom"
|
| | | @pagination="getStepSearch"
|
| | | />
|
| | | </div>
|
| | |
|
| | | <el-dialog
|
| | | v-el-drag-dialog
|
| | | :title="operation==='add'?'新增':'编辑'"
|
| | | :visible.sync="dialogVisible"
|
| | | width="800px"
|
| | | :close-on-click-modal="false"
|
| | | top="15vh"
|
| | | @closed="handleClose"
|
| | | @close="handleClose"
|
| | | >
|
| | | <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
|
| | | <el-form-item label="工序编码" prop="stepcode">
|
| | | <el-input v-model="dialogForm.stepcode" :disabled="operation!=='add'" style="width: 200px" />
|
| | | </el-form-item>
|
| | | <el-form-item label="工序名称" prop="stepname">
|
| | | <el-input v-model="dialogForm.stepname" style="width: 200px" />
|
| | | </el-form-item>
|
| | | <el-form-item label="工序类型" required>
|
| | | <el-select
|
| | | v-model="dialogForm.steptypecode"
|
| | | style="width:200px"
|
| | | placeholder="请选择"
|
| | | :popper-append-to-body="false"
|
| | | >
|
| | | <el-option
|
| | | v-for="item in steptypeArr"
|
| | | :key="item.code"
|
| | | :label="item.name"
|
| | | :value="item.code"
|
| | | />
|
| | | </el-select>
|
| | | </el-form-item>
|
| | | <el-form-item required label="状态">
|
| | | <el-radio-group v-model="dialogForm.enable">
|
| | | <el-radio label="Y">正常</el-radio>
|
| | | <el-radio label="N">停用</el-radio>
|
| | | </el-radio-group>
|
| | | </el-form-item>
|
| | | <el-form-item label="描述">
|
| | | <el-input
|
| | | v-model="dialogForm.description"
|
| | | type="textarea"
|
| | | style="width: 200px"
|
| | | />
|
| | | </el-form-item>
|
| | | </el-form>
|
| | | <span slot="footer" class="dialog-footer">
|
| | | <div class="footerButton">
|
| | | <el-button v-waves @click="dialogVisibleCancel">取 消</el-button>
|
| | | <el-button
|
| | | v-waves
|
| | | type="primary"
|
| | | :loading="$store.state.app.buttonIsDisabled"
|
| | | :disabled="$store.state.app.buttonIsDisabled"
|
| | | @click="dialogVisibleConfirm"
|
| | | >确 定</el-button>
|
| | | </div>
|
| | | </span>
|
| | | </el-dialog>
|
| | |
|
| | | </div>
|
| | | </template>
|
| | |
|
| | | <script>
|
| | | import Pagination from '@/components/Pagination'
|
| | | import { AddUpdateStep, DeleteStep, StepSearch } from '@/api/basicSettings'
|
| | | import { validateCode } from '@/utils/global'
|
| | | import elDragDialog from '@/directive/el-drag-dialog'
|
| | | import waves from '@/directive/waves'
|
| | |
|
| | | export default {
|
| | | name: 'ProcessList',
|
| | | components: {
|
| | | Pagination
|
| | | },
|
| | | directives: { elDragDialog, waves },
|
| | | data() {
|
| | | return {
|
| | | mainHeight: 0,
|
| | | tableHeight: 0,
|
| | | form: {
|
| | | stepcode: '', //
|
| | | stepname: '', //
|
| | | enable: '', //
|
| | | steptypecode: '', // 工序类型
|
| | | prop: 'stepcode', // 排序字段
|
| | | order: 'asc', // 排序字段
|
| | | page: 1, // 第几页
|
| | | rows: 20 // 每页多少条
|
| | | },
|
| | | total: 10,
|
| | | tableData: [],
|
| | | steptypeArr: [
|
| | | { code: 'Z', name: '自制' },
|
| | | { code: 'W', name: '外协' }
|
| | | ],
|
| | | enableArr: [
|
| | | { code: 'Y', name: '正常' },
|
| | | { code: 'N', name: '停用' }
|
| | | ],
|
| | | dialogVisible: false,
|
| | | dialogForm: {
|
| | | id: '',
|
| | | stepcode: '', //
|
| | | stepname: '', //
|
| | | steptypecode: 'Z',
|
| | | description: '', // 描述
|
| | | enable: 'Y'// 状态
|
| | | },
|
| | | operation: '',
|
| | | dialogFormRules: {
|
| | | stepcode: [
|
| | | { required: true, validator: validateCode, trigger: ['blur', 'change'] }
|
| | | ],
|
| | | stepname: [
|
| | | { required: true, message: '请输入工序名称', trigger: ['blur', 'change'] }
|
| | | ]
|
| | | }
|
| | |
|
| | | }
|
| | | },
|
| | | activated() {
window.addEventListener('resize', this.getHeight)
this.getHeight()
},
created() {
|
| | | this.getStepSearch()
|
| | | },
|
| | | mounted() {
|
| | | window.addEventListener('resize', this.getHeight)
|
| | | this.getHeight()
|
| | | },
|
| | | methods: {
|
| | | // 组织架构大列表查询
|
| | | async getStepSearch() {
|
| | | const res = await StepSearch(this.form)
|
| | | this.tableData = res.data
|
| | | this.total = res.count
|
| | | },
|
| | |
|
| | | // 排序改变时
|
| | | sortChange({ column, prop, order }) {
|
| | | if (order === 'descending') {
|
| | | order = 'desc'
|
| | | } else if (order === 'ascending') {
|
| | | order = 'asc'
|
| | | } else {
|
| | | order = 'desc'
|
| | | }
|
| | | this.form.order = order
|
| | | this.form.prop = prop
|
| | | this.getStepSearch()
|
| | | },
|
| | | // 重置
|
| | | reset() {
|
| | | this.form.stepcode = ''
|
| | | this.form.stepname = ''
|
| | | this.form.enable = ''
|
| | | this.form.steptypecode = ''
|
| | | this.getStepSearch()
|
| | | },
|
| | | // 新增按钮
|
| | | add(operation) {
|
| | | this.operation = operation
|
| | | this.dialogVisible = true
|
| | | this.dialogForm.OperType = 'Add'
|
| | | },
|
| | | // 修改按钮
|
| | | async edit(operation, row) {
|
| | | this.operation = operation
|
| | | this.dialogVisible = true
|
| | | this.dialogForm.OperType = 'Update'
|
| | |
|
| | | this.$nextTick(() => {
|
| | | this.dialogForm.id = row.id
|
| | | this.dialogForm.stepcode = row.stepcode
|
| | | this.dialogForm.stepname = row.stepname
|
| | | this.dialogForm.description = row.descr
|
| | | this.dialogForm.enable = row.enable
|
| | | this.dialogForm.steptypecode = row.flwtype
|
| | | })
|
| | | },
|
| | | // 删除按钮
|
| | | async del(row) {
|
| | | this.$confirm('是否确认删除?', '提示', {
|
| | | confirmButtonText: '确定',
|
| | | cancelButtonText: '取消',
|
| | | type: 'warning'
|
| | | }).then(() => {
|
| | | DeleteStep({ stepcode: row.stepcode }).then(res => {
|
| | | if (res.code === '200') {
|
| | | this.$notify.success('删除成功!')
|
| | | if (this.form.page > 1 && this.tableData.length === 1) {
|
| | | this.form.page--
|
| | | }
|
| | | this.getStepSearch()
|
| | | }
|
| | | })
|
| | | }).catch(() => {
|
| | | this.$notify.info('已取消删除')
|
| | | })
|
| | | },
|
| | | // 对话框关闭事件
|
| | | handleClose() {
|
| | | this.dialogForm.stepcode = ''
|
| | | this.dialogForm.stepname = ''
|
| | | this.dialogForm.id = ''
|
| | | this.dialogForm.enable = 'Y'
|
| | | this.dialogForm.description = ''
|
| | | this.dialogForm.steptypecode = 'Z'
|
| | | this.$refs.dialogForm.clearValidate()
|
| | | },
|
| | | // 对话框取消
|
| | | dialogVisibleCancel() {
|
| | | this.dialogVisible = false
|
| | | },
|
| | | // 对话框确认
|
| | | dialogVisibleConfirm() {
|
| | | this.$refs.dialogForm.validate(valid => {
|
| | | if (valid) {
|
| | | // console.log(JSON.parse(JSON.stringify(this.dialogForm)))
|
| | | this.$store.state.app.buttonIsDisabled = true
|
| | | AddUpdateStep(this.dialogForm).then(res => {
|
| | | if (res.code === '200') {
|
| | | this.$notify.success(this.operation === 'add' ? '添加成功!' : '修改成功!')
|
| | | this.dialogVisible = false
|
| | | this.$store.state.app.buttonIsDisabled = false
|
| | | this.getStepSearch()
|
| | | } else {
|
| | | this.$store.state.app.buttonIsDisabled = false
|
| | | this.$notify.error(this.operation === 'add' ? '添加失败!' : '修改失败!')
|
| | | }
|
| | | })
|
| | | }
|
| | | })
|
| | | },
|
| | | // 获取页面高度
|
| | | getHeight() {
|
| | | this.$nextTick(() => {
|
| | | this.mainHeight = window.innerHeight - 85
|
| | | this.tableHeight = this.mainHeight - 200
|
| | | this.$refs.tableDataRef.doLayout()
|
| | | })
|
| | | }
|
| | | }
|
| | | }
|
| | | </script>
|
| | | <template> |
| | | <div> |
| | | <div class="body" :style="{height:mainHeight+'px'}"> |
| | | <div class="bodyTopButtonGroup" style="justify-content: space-between"> |
| | | <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button> |
| | | <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=15')">导入</el-button> |
| | | </div> |
| | | |
| | | <div class="bodyTopFormGroup"> |
| | | <el-form |
| | | ref="form" |
| | | :model="form" |
| | | label-width="100px" |
| | | inline |
| | | style="display: flex;" |
| | | > |
| | | <div class="elForm"> |
| | | <el-form-item label="工序编码" style=" display: flex;"> |
| | | <el-input v-model="form.stepcode" placeholder="请输入" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="工序名称" style=" display: flex;"> |
| | | <el-input v-model="form.stepname" placeholder="请输入" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="工序类型" style=" display: flex;"> |
| | | <el-select |
| | | v-model="form.steptypecode" |
| | | style="width:200px" |
| | | placeholder="请选择" |
| | | :popper-append-to-body="false" |
| | | > |
| | | <el-option |
| | | v-for="item in steptypeArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="状态" style=" display: flex;"> |
| | | <el-select |
| | | v-model="form.enable" |
| | | style="width:200px" |
| | | placeholder="请选择" |
| | | :popper-append-to-body="false" |
| | | > |
| | | <el-option |
| | | v-for="item in enableArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </div> |
| | | <div |
| | | class="bodySearchReset" |
| | | :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" |
| | | > |
| | | <el-button v-waves type="primary" icon="el-icon-search" @click="getStepSearch">查询</el-button> |
| | | <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">重置</el-button> |
| | | </div> |
| | | </el-form> |
| | | <div |
| | | class="bodyTopFormExpand" |
| | | style="height:5px" |
| | | > |
| | | <!-- <svg-icon--> |
| | | <!-- v-show="mouseHoverType==='mouseout'"--> |
| | | <!-- style="cursor: pointer"--> |
| | | <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> |
| | | <!-- @mouseenter="mouseHoverType=$event.type"--> |
| | | <!-- />--> |
| | | <!-- <svg-icon--> |
| | | <!-- v-show="mouseHoverType==='mouseenter'"--> |
| | | <!-- style="cursor: pointer"--> |
| | | <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> |
| | | <!-- @click="isExpandForm=!isExpandForm"--> |
| | | <!-- @mouseout="mouseHoverType=$event.type"--> |
| | | <!-- />--> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="elTableDiv"> |
| | | <el-table |
| | | ref="tableDataRef" |
| | | class="tableFixed" |
| | | :data="tableData" |
| | | :height="tableHeight+'px'" |
| | | border |
| | | row-class-name="custom-row" |
| | | :style="{width: 100+'%',height:tableHeight+'px',}" |
| | | highlight-current-row |
| | | :header-cell-style="this.$headerCellStyle" |
| | | :cell-style="this.$cellStyle" |
| | | @sort-change="sortChange" |
| | | > |
| | | <el-table-column |
| | | prop="rowNum" |
| | | width="50" |
| | | fixed |
| | | label="序号" |
| | | /> |
| | | <el-table-column |
| | | prop="stepcode" |
| | | label="工序编码" |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="stepname" |
| | | label="工序名称" |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="flwtype" |
| | | label="工序类型" |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | {{ row.flwtype==='Z'?'自制':'外协' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="enable" |
| | | label="状态" |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-tag v-if="row.enable==='Y'" size="small" type="success">正常</el-tag> |
| | | <el-tag v-if="row.enable==='N'" size="small" type="danger">停用</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="descr" |
| | | label="描述" |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | {{ row.descr?row.descr:'/' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="lm_user" |
| | | label="创建人员" |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="lm_date" |
| | | label="创建时间" |
| | | width="160" |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | label="操作" |
| | | width="120" |
| | | fixed="right" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div class="operationClass"> |
| | | <el-tooltip class="item" effect="dark" content="编辑" placement="top"> |
| | | <i |
| | | v-if="row.leve!==0" |
| | | class="el-icon-edit-outline" |
| | | :style="{color:$store.state.settings.theme}" |
| | | @click="edit('edit',row)" |
| | | /> |
| | | </el-tooltip> |
| | | <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top"> |
| | | <i |
| | | v-if="row.leve!==0" |
| | | class="el-icon-delete" |
| | | :style="{color:$store.state.settings.theme}" |
| | | @click="del(row)" |
| | | /> |
| | | </el-tooltip> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <!--分页--> |
| | | <pagination |
| | | :total="total" |
| | | :page.sync="form.page" |
| | | :limit.sync="form.rows" |
| | | align="right" |
| | | layout="total,prev, pager, next,sizes,jumper" |
| | | popper-class="select_bottom" |
| | | @pagination="getStepSearch" |
| | | /> |
| | | </div> |
| | | |
| | | <el-dialog |
| | | v-el-drag-dialog |
| | | :title="operation==='add'?'新增':'编辑'" |
| | | :visible.sync="dialogVisible" |
| | | width="800px" |
| | | :close-on-click-modal="false" |
| | | top="15vh" |
| | | @closed="handleClose" |
| | | @close="handleClose" |
| | | > |
| | | <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> |
| | | <el-form-item label="工序编码" prop="stepcode"> |
| | | <el-input v-model="dialogForm.stepcode" :disabled="operation!=='add'" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="工序名称" prop="stepname"> |
| | | <el-input v-model="dialogForm.stepname" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="工序类型" required> |
| | | <el-select |
| | | v-model="dialogForm.steptypecode" |
| | | style="width:200px" |
| | | placeholder="请选择" |
| | | :popper-append-to-body="false" |
| | | > |
| | | <el-option |
| | | v-for="item in steptypeArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item required label="状态"> |
| | | <el-radio-group v-model="dialogForm.enable"> |
| | | <el-radio label="Y">正常</el-radio> |
| | | <el-radio label="N">停用</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="描述"> |
| | | <el-input |
| | | v-model="dialogForm.description" |
| | | type="textarea" |
| | | style="width: 200px" |
| | | /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <div class="footerButton"> |
| | | <el-button v-waves @click="dialogVisibleCancel">取 消</el-button> |
| | | <el-button |
| | | v-waves |
| | | type="primary" |
| | | :loading="$store.state.app.buttonIsDisabled" |
| | | :disabled="$store.state.app.buttonIsDisabled" |
| | | @click="dialogVisibleConfirm" |
| | | >确 定</el-button> |
| | | </div> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import Pagination from '@/components/Pagination' |
| | | import { AddUpdateStep, DeleteStep, StepSearch } from '@/api/basicSettings' |
| | | import { validateCode } from '@/utils/global' |
| | | import elDragDialog from '@/directive/el-drag-dialog' |
| | | import waves from '@/directive/waves' |
| | | |
| | | export default { |
| | | name: 'ProcessList', |
| | | components: { |
| | | Pagination |
| | | }, |
| | | directives: { elDragDialog, waves }, |
| | | data() { |
| | | return { |
| | | mainHeight: 0, |
| | | tableHeight: 0, |
| | | form: { |
| | | stepcode: '', // |
| | | stepname: '', // |
| | | enable: '', // |
| | | steptypecode: '', // 工序类型 |
| | | prop: 'stepcode', // 排序字段 |
| | | order: 'asc', // 排序字段 |
| | | page: 1, // 第几页 |
| | | rows: 20 // 每页多少条 |
| | | }, |
| | | total: 10, |
| | | tableData: [], |
| | | steptypeArr: [ |
| | | { code: 'Z', name: '自制' }, |
| | | { code: 'W', name: '外协' } |
| | | ], |
| | | enableArr: [ |
| | | { code: 'Y', name: '正常' }, |
| | | { code: 'N', name: '停用' } |
| | | ], |
| | | dialogVisible: false, |
| | | dialogForm: { |
| | | id: '', |
| | | stepcode: '', // |
| | | stepname: '', // |
| | | steptypecode: 'Z', |
| | | description: '', // 描述 |
| | | enable: 'Y'// 状态 |
| | | }, |
| | | operation: '', |
| | | dialogFormRules: { |
| | | stepcode: [ |
| | | { required: true, validator: validateCode, trigger: ['blur', 'change'] } |
| | | ], |
| | | stepname: [ |
| | | { required: true, message: '请输入工序名称', trigger: ['blur', 'change'] } |
| | | ] |
| | | } |
| | | |
| | | } |
| | | }, |
| | | activated() { |
| | | window.addEventListener('resize', this.getHeight) |
| | | this.getHeight() |
| | | this.getStepSearch() |
| | | }, |
| | | created() { |
| | | this.getStepSearch() |
| | | }, |
| | | mounted() { |
| | | window.addEventListener('resize', this.getHeight) |
| | | this.getHeight() |
| | | }, |
| | | methods: { |
| | | // 组织架构大列表查询 |
| | | async getStepSearch() { |
| | | const res = await StepSearch(this.form) |
| | | this.tableData = res.data |
| | | this.total = res.count |
| | | }, |
| | | |
| | | // 排序改变时 |
| | | sortChange({ column, prop, order }) { |
| | | if (order === 'descending') { |
| | | order = 'desc' |
| | | } else if (order === 'ascending') { |
| | | order = 'asc' |
| | | } else { |
| | | order = 'desc' |
| | | } |
| | | this.form.order = order |
| | | this.form.prop = prop |
| | | this.getStepSearch() |
| | | }, |
| | | // 重置 |
| | | reset() { |
| | | this.form.stepcode = '' |
| | | this.form.stepname = '' |
| | | this.form.enable = '' |
| | | this.form.steptypecode = '' |
| | | this.getStepSearch() |
| | | }, |
| | | // 新增按钮 |
| | | add(operation) { |
| | | this.operation = operation |
| | | this.dialogVisible = true |
| | | this.dialogForm.OperType = 'Add' |
| | | }, |
| | | // 修改按钮 |
| | | async edit(operation, row) { |
| | | this.operation = operation |
| | | this.dialogVisible = true |
| | | this.dialogForm.OperType = 'Update' |
| | | |
| | | this.$nextTick(() => { |
| | | this.dialogForm.id = row.id |
| | | this.dialogForm.stepcode = row.stepcode |
| | | this.dialogForm.stepname = row.stepname |
| | | this.dialogForm.description = row.descr |
| | | this.dialogForm.enable = row.enable |
| | | this.dialogForm.steptypecode = row.flwtype |
| | | }) |
| | | }, |
| | | // 删除按钮 |
| | | async del(row) { |
| | | this.$confirm('是否确认删除?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | DeleteStep({ stepcode: row.stepcode }).then(res => { |
| | | if (res.code === '200') { |
| | | this.$notify.success('删除成功!') |
| | | if (this.form.page > 1 && this.tableData.length === 1) { |
| | | this.form.page-- |
| | | } |
| | | this.getStepSearch() |
| | | } |
| | | }) |
| | | }).catch(() => { |
| | | this.$notify.info('已取消删除') |
| | | }) |
| | | }, |
| | | // 对话框关闭事件 |
| | | handleClose() { |
| | | this.dialogForm.stepcode = '' |
| | | this.dialogForm.stepname = '' |
| | | this.dialogForm.id = '' |
| | | this.dialogForm.enable = 'Y' |
| | | this.dialogForm.description = '' |
| | | this.dialogForm.steptypecode = 'Z' |
| | | this.$refs.dialogForm.clearValidate() |
| | | }, |
| | | // 对话框取消 |
| | | dialogVisibleCancel() { |
| | | this.dialogVisible = false |
| | | }, |
| | | // 对话框确认 |
| | | dialogVisibleConfirm() { |
| | | this.$refs.dialogForm.validate(valid => { |
| | | if (valid) { |
| | | // console.log(JSON.parse(JSON.stringify(this.dialogForm))) |
| | | this.$store.state.app.buttonIsDisabled = true |
| | | AddUpdateStep(this.dialogForm).then(res => { |
| | | if (res.code === '200') { |
| | | this.$notify.success(this.operation === 'add' ? '添加成功!' : '修改成功!') |
| | | this.dialogVisible = false |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | this.getStepSearch() |
| | | } else { |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | this.$notify.error(this.operation === 'add' ? '添加失败!' : '修改失败!') |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | // 获取页面高度 |
| | | getHeight() { |
| | | this.$nextTick(() => { |
| | | this.mainHeight = window.innerHeight - 85 |
| | | this.tableHeight = this.mainHeight - 200 |
| | | this.$refs.tableDataRef.doLayout() |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |