| | |
| | | <el-divider /> |
| | | <div style="margin-left: 10px;display: flex"> |
| | | <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button> |
| | | <el-button type="primary" icon="el-icon-upload2" @click="upload">导入</el-button> |
| | | <!-- <el-button type="primary" icon="el-icon-upload2" @click="upload">导入</el-button>--> |
| | | </div> |
| | | <el-divider /> |
| | | <div class="elTableDiv"> |
| | |
| | | label="序号" |
| | | /> |
| | | <el-table-column |
| | | prop="org_code" |
| | | prop="code" |
| | | label="标准代码" |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="org_name" |
| | | prop="name" |
| | | label="标准名称" |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="description" |
| | | prop="descr" |
| | | label="标准描述" |
| | | sortable="custom" |
| | | /> |
| | |
| | | <el-dialog |
| | | :title="operation==='add'?'新增':(operation==='edit'?'编辑':'查看')" |
| | | :visible.sync="dialogVisible" |
| | | width="800" |
| | | top="15vh" |
| | | width="800px" |
| | | :top="isIpad?'5vh':'15vh'" |
| | | :close-on-click-modal="false" |
| | | @closed="handleClose" |
| | | @close="handleClose" |
| | | > |
| | | <div style="margin-bottom: 10px"> |
| | | <i class="el-icon-s-comment" style="color:#42b983;" /> 标准信息: |
| | | </div> |
| | | <el-form ref="dialogForm" style="margin-left: 80px" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> |
| | | <el-form-item label="标准编码" prop="OrgCode"> |
| | | <el-input v-model="dialogForm.OrgCode" :disabled="operation!=='add'" style="width: 200px" /> |
| | | <el-form |
| | | ref="dialogForm" |
| | | style="margin-left: 80px" |
| | | inline |
| | | :rules="dialogFormRules" |
| | | :model="dialogForm" |
| | | label-width="80px" |
| | | > |
| | | <el-form-item label="标准编码" prop="code"> |
| | | <el-input v-model="dialogForm.code" :disabled="operation!=='add'" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="标准名称" prop="OrgName"> |
| | | <el-input v-model="dialogForm.OrgName" style="width: 200px" /> |
| | | <el-form-item label="标准名称" prop="name"> |
| | | <el-input v-model="dialogForm.name" :disabled="operation==='check'" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="描述"> |
| | | <el-input v-model="dialogForm.OrgName" type="textarea" style="width: 200px" /> |
| | | <el-input v-model="dialogForm.description" :disabled="operation==='check'" type="textarea" style="width: 200px" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div style="margin-bottom: 10px"> |
| | |
| | | @sort-change="sortChange" |
| | | > |
| | | <el-table-column |
| | | prop="RowNum" |
| | | label="序号" |
| | | type="index" |
| | | width="100" |
| | | /> |
| | | <el-table-column |
| | | prop="mc" |
| | | label="检验标准名称" |
| | | prop="code" |
| | | label="检验标准编码(名称)" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.isVisible===0">{{ row.mc }}</div> |
| | | <el-input v-if="row.isVisible===1" v-model="row.mc" /> |
| | | <div v-if="row.isVisible===0" style="display: flex;"> |
| | | <div>{{ row.code }}</div> |
| | | <div style="margin-left: 10px">{{ row.name }}</div> |
| | | </div> |
| | | |
| | | <el-select |
| | | v-if="row.isVisible===1" |
| | | v-model="row.code" |
| | | filterable |
| | | :popper-append-to-body="false" |
| | | style="width: 400px;" |
| | | placeholder="请选择" |
| | | @change="val=>changeCode(val,row)" |
| | | > |
| | | <el-option |
| | | v-for="item in JYSelectArr" |
| | | :key="item.code" |
| | | :label="item.code+''+item.name" |
| | | :value="item.code" |
| | | /> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column--> |
| | | <!-- prop="name"--> |
| | | <!-- label="检验标准名称"--> |
| | | <!-- >--> |
| | | <!-- <template slot-scope="{row}">--> |
| | | <!-- <div v-if="row.isVisible===0">{{ row.name }}</div>--> |
| | | <!-- <el-select--> |
| | | <!-- v-if="row.isVisible===1"--> |
| | | <!-- v-model="row.name"--> |
| | | <!-- filterable--> |
| | | <!-- :popper-append-to-body="false"--> |
| | | <!-- style="width: 200px;"--> |
| | | <!-- placeholder="请选择"--> |
| | | <!-- @change="val=>changeName(val,row)"--> |
| | | <!-- >--> |
| | | <!-- <el-option--> |
| | | <!-- v-for="item in JYSelectArr"--> |
| | | <!-- :key="item.code"--> |
| | | <!-- :label="item.name"--> |
| | | <!-- :value="item.code"--> |
| | | <!-- />--> |
| | | <!-- </el-select>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | <el-table-column |
| | | prop="ms" |
| | | prop="descr" |
| | | label="检验描述描述" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.isVisible===0">{{ row.ms }}</div> |
| | | <el-input v-if="row.isVisible===1" v-model="row.ms" /> |
| | | <div v-if="row.isVisible===0">{{ row.descr }}</div> |
| | | <el-input v-if="row.isVisible===1" v-model="row.descr" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | v-if="operation!=='check'" |
| | | label="操作" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div class="operationClass"> |
| | | <el-button v-if="row.isVisible===0" type="text" @click="JYedit(row)">编辑</el-button> |
| | | <el-button v-if="row.isVisible===0" type="text" @click="JYdel(row)">删除</el-button> |
| | | <el-button v-if="row.isVisible===1" type="text" @click="JYsave(row)">保存</el-button> |
| | | <el-button v-if="row.isVisible===1" type="text" @click="Jycancel(row)">取消</el-button> |
| | | <el-button v-if="row.isVisible===1" type="text" @click="JYsave(row)">确定</el-button> |
| | | <el-button v-if="row.isVisible===1" type="text" @click="JYcancel(row)">取消</el-button> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <!--分页--> |
| | | <!-- <pagination--> |
| | | <!-- v-show="JYtotal>0"--> |
| | | <!-- :total="JYtotal"--> |
| | | <!-- :page.sync="JYfrom.page"--> |
| | | <!-- :limit.sync="JYfrom.rows"--> |
| | | <!-- align="right"--> |
| | | <!-- layout="prev, pager, next,sizes"--> |
| | | <!-- popper-class="select_bottom"--> |
| | | <!-- @pagination="getStepCheckItemSelect"--> |
| | | <!-- />--> |
| | | |
| | | <span slot="footer" class="dialog-footer"> |
| | | <div class="footerButton"> |
| | | <el-button @click="dialogVisibleCancel">取 消</el-button> |
| | | <el-button type="primary" @click="dialogVisibleConfirm">确 定</el-button> |
| | | <el-button v-if="operation==='check'" @click="dialogVisibleCancel">返 回</el-button> |
| | | <el-button v-if="operation!=='check'" @click="dialogVisibleCancel">取 消</el-button> |
| | | <el-button v-if="operation!=='check'" type="primary" @click="dialogVisibleConfirm">提 交</el-button> |
| | | </div> |
| | | </span> |
| | | </el-dialog> |
| | |
| | | |
| | | <script> |
| | | import Pagination from '@/components/Pagination' |
| | | import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz' |
| | | import { getCookie } from '@/utils/auth' |
| | | import { StepCheckStanedSearch } from '@/api/zlgl' |
| | | import { |
| | | AddUpdateStepCheckStaned, DeleteStepCheckStaned, |
| | | EditStepCheckStanedSearch, |
| | | StepCheckItemSelect, |
| | | StepCheckStanedSearch |
| | | } from '@/api/zlgl' |
| | | |
| | | const SER_HZ = /^[\u4e00-\u9fa5]+$/ |
| | | export default { |
| | |
| | | } |
| | | } |
| | | return { |
| | | isIpad: false, |
| | | mainHeight: 0, |
| | | tableHeight: 0, |
| | | form: { |
| | |
| | | page: 1, // 第几页 |
| | | rows: 20 // 每页多少条 |
| | | }, |
| | | OrgTypeArr: [ |
| | | { label: '工厂', value: 'F' }, |
| | | { label: '部门', value: 'D' }, |
| | | { label: '车间', value: 'W' }, |
| | | { label: '科室', value: 'K' }, |
| | | { label: '生产线', value: 'L' } |
| | | ], |
| | | |
| | | total: 10, |
| | | tableData: [], |
| | | dialogVisible: false, |
| | | dialogForm: { |
| | | OrgType: '', |
| | | OrgCode: '', |
| | | OrgName: '', |
| | | SupUnit: ''// 上级单位 |
| | | code: '', // 工序检验标准编码 |
| | | name: '', // 工序检验标准名称 |
| | | enable: '', // 传空值 |
| | | description: '' // 工序检验标准描述 |
| | | }, |
| | | operation: '', |
| | | dialogFormRules: { |
| | | OrgType: [ |
| | | { required: true, message: '请输入选择类型', trigger: ['blur', 'change'] } |
| | | ], |
| | | OrgCode: [ |
| | | code: [ |
| | | { required: true, validator: validateName, trigger: ['blur', 'change'] } |
| | | ], |
| | | OrgName: [ |
| | | name: [ |
| | | { required: true, message: '请输入名称', trigger: ['blur', 'change'] } |
| | | ], |
| | | SupUnit: [ |
| | | { required: true, validator: validateTypeCode, trigger: ['blur', 'change'] } |
| | | ] |
| | | }, |
| | | JYTableData: [ |
| | | { RowNum: 1, mc: 'xxx1', ms: 'aaaa' } |
| | | ], // 对话框检验信息表格 |
| | | JYfrom: { |
| | | page: 1, |
| | | rows: 10 |
| | | }, |
| | | JYtotal: 10 |
| | | JYTableData: [], // 对话框检验信息表格 |
| | | JYSelectArr: [], // 检验项目下拉数组 |
| | | JYSelectedArr: [] // 已选检验项目数组 |
| | | } |
| | | }, |
| | | created() { |
| | | this.getStepCheckStanedSearch() |
| | | this.getStepCheckItemSelect() |
| | | this.handleRequest() |
| | | }, |
| | | mounted() { |
| | | window.addEventListener('resize', this.getHeight) |
| | | this.getHeight() |
| | | }, |
| | | methods: { |
| | | handleRequest() { |
| | | this.getStepCheckStanedSearch().then(res => { |
| | | if (res.code === '200') { |
| | | this.getStepCheckItemSelect() |
| | | } |
| | | }) |
| | | }, |
| | | async getStepCheckStanedSearch() { |
| | | const res = await StepCheckStanedSearch(this.form) |
| | | this.tableData = res.data |
| | | this.total = res.count |
| | | return { code: res.code } |
| | | }, |
| | | // 排序改变时 |
| | | sortChange({ column, prop, order }) { |
| | |
| | | }, |
| | | // 重置 |
| | | reset() { |
| | | this.form.OrgCode = '' |
| | | this.form.OrgName = '' |
| | | this.form.OrgType = '' |
| | | this.form.UserName = '' |
| | | this.form.stanedcode = '' |
| | | this.form.stanedname = '' |
| | | this.form.staneddescr = '' |
| | | this.getStepCheckStanedSearch() |
| | | }, |
| | | |
| | |
| | | edit(operation, row) { |
| | | this.operation = operation |
| | | this.dialogVisible = true |
| | | |
| | | this.$nextTick(() => { |
| | | this.dialogForm.OrgCode = row.org_code |
| | | this.dialogForm.OrgName = row.org_name |
| | | this.dialogForm.SupUnit = row.parent_id |
| | | }) |
| | | this.getEditStepCheckStanedSearch(row.code) |
| | | }, |
| | | // 查看 |
| | | check(operation, row) { |
| | | this.operation = operation |
| | | this.dialogVisible = true |
| | | this.getEditStepCheckStanedSearch(row.code) |
| | | }, |
| | | async getEditStepCheckStanedSearch(val) { |
| | | const { data: res } = await EditStepCheckStanedSearch({ defectcode: val }) |
| | | this.dialogForm.code = res.code |
| | | this.dialogForm.name = res.name |
| | | this.dialogForm.description = res.description |
| | | this.JYTableData = res.Data |
| | | this.JYTableData.forEach(item => { |
| | | let number = Math.random() * Math.random()// 作为删除时的标识符 |
| | | number = number === 0 ? (10 + Math.random()) : number |
| | | item.isVisible = 0 |
| | | item.descr = item.stepcheckitem_desc |
| | | item.number = number |
| | | this.JYSelectedArr.push(item.code) |
| | | }) |
| | | }, |
| | | // 删除按钮 |
| | | async del(row) { |
| | |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | DeleteOrganization({ orgid: row.code }).then(res => { |
| | | DeleteStepCheckStaned({ stanedcode: row.code }).then(res => { |
| | | if (res.code === '200') { |
| | | this.$message.success('删除成功!') |
| | | this.getStepCheckStanedSearch() |
| | |
| | | }, |
| | | // 对话框关闭事件 |
| | | handleClose() { |
| | | this.dialogForm.OrgType = '' |
| | | this.dialogForm.OrgCode = '' |
| | | this.dialogForm.OrgName = '' |
| | | this.dialogForm.SupUnit = '' |
| | | this.dialogForm.code = '' |
| | | this.dialogForm.name = '' |
| | | this.dialogForm.enable = '' |
| | | this.dialogForm.description = '' |
| | | this.JYTableData = [] |
| | | this.JYSelectedArr = [] |
| | | this.$refs.dialogForm.clearValidate() |
| | | }, |
| | | // 对话框取消 |
| | |
| | | dialogVisibleConfirm() { |
| | | this.$refs.dialogForm.validate(valid => { |
| | | if (valid) { |
| | | const tableData = [] |
| | | this.JYTableData.forEach((item, index) => { |
| | | tableData.push({ |
| | | STEPCHECKITEM_SEQ: (index + 1), |
| | | STEPCHECKITEM_CODE: item.code, |
| | | STEPCHECKITEM_DESC: item.descr |
| | | }) |
| | | }) |
| | | const data = { |
| | | OrganCode: this.dialogForm.OrgCode, |
| | | OrganName: this.dialogForm.OrgName, |
| | | OperType: this.operation === 'add' ? 'Add' : 'Update', |
| | | Operator: getCookie('admin') |
| | | code: this.dialogForm.code, |
| | | name: this.dialogForm.name, |
| | | description: this.dialogForm.description, |
| | | enable: '', |
| | | Data: tableData |
| | | } |
| | | AddUpdateOrganization(data).then(res => { |
| | | AddUpdateStepCheckStaned(this.operation === 'add' ? 'Add' : 'Update', data).then(res => { |
| | | if (res.code === '200') { |
| | | this.$message.success(this.operation === 'add' ? '添加成功!' : '修改成功!') |
| | | this.dialogVisible = false |
| | |
| | | getHeight() { |
| | | this.$nextTick(() => { |
| | | this.mainHeight = window.innerHeight - 250 |
| | | this.tableHeight = this.mainHeight - 100 |
| | | this.tableHeight = this.mainHeight - 50 |
| | | this.isIpad = window.innerHeight < 769 |
| | | // if (window.innerHeight < 769) { |
| | | // this.tableHeight = this.tableHeight - 50 |
| | | // } |
| | | }) |
| | | }, |
| | | |
| | | // 获取检验项信息表 |
| | | getStepCheckItemSelect() { |
| | | // let number = Math.random() * Math.random()// 作为删除时的标识符 |
| | | // number = number === 0 ? (10 + Math.random()) : number |
| | | this.JYTableData.forEach(item => { |
| | | item.isVisible = 0 |
| | | }) |
| | | // 获取检验项目下拉列表 |
| | | async getStepCheckItemSelect() { |
| | | const { data: res } = await StepCheckItemSelect() |
| | | this.JYSelectArr = res |
| | | }, |
| | | // 检验标准编码值改变 |
| | | changeCode(val, row) { |
| | | row.name = this.JYSelectArr.find(it => it.code === val).name |
| | | row.descr = this.JYSelectArr.find(it => it.code === val).descr |
| | | }, |
| | | // 检验标准名称值改变 |
| | | // changeName(val, row) { |
| | | // row.code = this.JYSelectArr.find(it => it.code === val).code |
| | | // row.descr = this.JYSelectArr.find(it => it.code === val).descr |
| | | // }, |
| | | // 检验新增 |
| | | JYadd() { |
| | | if (this.JYTableData.length > 0 && this.JYTableData[this.JYTableData.length - 1].isVisible === 1) { |
| | | return this.$message.info('请先确定或取消本条记录!') |
| | | } |
| | | |
| | | let number = Math.random() * Math.random()// 作为删除时的标识符 |
| | | number = number === 0 ? (10 + Math.random()) : number |
| | | const data = { mc: '', ms: '', isVisible: 1, number } |
| | | this.JYTableData.unshift(data) |
| | | const data = { code: '', name: '', descr: '', isVisible: 1, number } |
| | | this.JYTableData.push(data) |
| | | }, |
| | | JYedit(row) { |
| | | this.JYSelectedArr.forEach((item, index) => { |
| | | if (item === row.code) { |
| | | this.JYSelectedArr.splice(index, 1) |
| | | } |
| | | }) |
| | | |
| | | this.JYTableData.forEach((item, index) => { |
| | | if (item.mc === row.mc) { |
| | | if (item.code === row.code) { |
| | | item.isVisible = 1 |
| | | } |
| | | }) |
| | |
| | | this.JYTableData.splice(index, 1) |
| | | } |
| | | }) |
| | | }, |
| | | JYsave(row) { |
| | | this.JYTableData.forEach(item => { |
| | | if (item.number === row.number) { |
| | | item.isVisible = 0 |
| | | |
| | | this.JYSelectedArr.forEach((item, index) => { |
| | | if (item === row.code) { |
| | | this.JYSelectedArr.splice(index, 1) |
| | | } |
| | | }) |
| | | }, |
| | | Jycancel(row) { |
| | | JYsave(row) { |
| | | if (row.code === '') { |
| | | return this.$message.info('检验标准编码(名称)不能为空!') |
| | | } |
| | | // if (row.name === '') { |
| | | // return this.$message.info('检验标准名称不能为空!') |
| | | // } |
| | | |
| | | if (this.JYSelectedArr.find(item => item === row.code) !== undefined) { |
| | | return this.$message.info('检验标准编码(名称)不能重复!') |
| | | } else { |
| | | this.JYSelectedArr.push(row.code) |
| | | } |
| | | |
| | | this.JYTableData.forEach((item, index) => { |
| | | if (item.number === row.number) { |
| | | item.isVisible = 0 |
| | | this.JYTableData.splice(index, 1, { |
| | | number: row.number, |
| | | code: row.code, |
| | | name: row.name, |
| | | isVisible: 0, |
| | | descr: row.descr |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | JYcancel(row) { |
| | | this.JYTableData.forEach((item, index) => { |
| | | if (item.number === row.number) { |
| | | this.JYTableData.splice(index, 1) |
| | | } |
| | | }) |
| | | |
| | | this.JYSelectedArr.forEach((item, index) => { |
| | | if (item === row.code) { |
| | | this.JYSelectedArr.splice(index, 1) |
| | | } |
| | | }) |
| | | } |
| | |
| | | border: none; |
| | | padding: 0 20px; |
| | | } |
| | | |
| | | ::v-deep .el-button--primary:hover { |
| | | border: none; |
| | | } |
| | | |
| | | ::v-deep .el-button--info { |
| | | height: 30px; |
| | | display: flex; |
| | |
| | | height: 30px; |
| | | line-height: 30px; |
| | | } |
| | | |
| | | ::v-deep .el-input__inner:focus { |
| | | border-color: $main_color; |
| | | } |
| | |
| | | border-color: $main_color; |
| | | } |
| | | |
| | | ::v-deep .el-select .el-input__inner:focus{ |
| | | ::v-deep .el-select .el-input__inner:focus { |
| | | border-color: $main_color; |
| | | } |
| | | |
| | | ::v-deep .el-select-dropdown__item.selected{ |
| | | ::v-deep .el-select-dropdown__item.selected { |
| | | color: $main_color; |
| | | } |
| | | ::v-deep .el-checkbox__inner:hover{ |
| | | |
| | | ::v-deep .el-checkbox__inner:hover { |
| | | border-color: $main_color; |
| | | } |
| | | ::v-deep .el-textarea__inner:focus{ |
| | | |
| | | ::v-deep .el-textarea__inner:focus { |
| | | border-color: $main_color; |
| | | } |
| | | |
| | | ::v-deep .el-select__caret { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | </style> |