|
|
@@ -5,187 +5,190 @@
|
|
|
width="70%"
|
|
|
:close-on-click-modal="false"
|
|
|
:visible.sync="visible"> -->
|
|
|
- <div class="my-title">{{ !id ? '新增': display ? '详情' : '修改' }}</div>
|
|
|
- <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
|
|
|
- <el-row class="my-row">
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="工种编码" prop="code">
|
|
|
- <el-input v-model="dataForm.code" :disabled="true" placeholder="系统自动生成"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8" style="padding-left: 20px">
|
|
|
- <el-form-item label="车间" prop="proWorkshopId">
|
|
|
- <WorkshopComponent v-model="dataForm.proWorkshopId" :workshop-id="dataForm.proWorkshopId" :disabled="display" style="width:100%;"/>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8" style="padding-left: 20px">
|
|
|
- <el-form-item label="工种名称" prop="name">
|
|
|
- <el-input v-model="dataForm.name" :disabled="display" placeholder="工种名称"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row class="my-row">
|
|
|
- <el-col :span="8" style="padding-left: 20px">
|
|
|
- <el-form-item label="工种级别" prop="level">
|
|
|
- <el-select
|
|
|
- v-model="dataForm.level"
|
|
|
- :disabled="display"
|
|
|
- placeholder="请选择"
|
|
|
- style="width:100%"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in optionsLevel"
|
|
|
- :key="item.code"
|
|
|
- :label="item.value"
|
|
|
- :value="item.code">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8" style="padding-left: 20px">
|
|
|
- <el-form-item label="工时单价" prop="quotedPrice">
|
|
|
- <el-input v-model="dataForm.quotedPrice" placeholder="工时单价" oninput="value=value.replace(/[^0-9.]/g,'')">
|
|
|
- <i slot="suffix" style="font-style:normal;margin-right: 10px;">元</i>
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row class="my-row">
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="工种要求" prop="requirement">
|
|
|
- <el-input v-model="dataForm.requirement" :disabled="display" placeholder="工种要求"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row class="my-row">
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="备注说明" prop="notes">
|
|
|
- <el-input v-model="dataForm.notes" :disabled="display" placeholder="备注说明"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row class="my-row">
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="掌握人" prop="masterIds">
|
|
|
- <user-components v-model="dataForm.masterIds" :user-ids="dataForm.masterIds" @change='masterChange' :disabled="display" style="width:100%;"/>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8" style="padding-left: 20px">
|
|
|
- <el-form-item label="负责人" prop="foreman">
|
|
|
- <user-component v-model="dataForm.foreman" :user-id="dataForm.foreman" @userSelected='foremanChange' :disabled="display" style="width:100%;"/>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-form>
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="onChose">取消</el-button>
|
|
|
- <el-button v-if="!display" type="primary" @click="dataFormSubmit()" v-reClick>确定</el-button>
|
|
|
- </span>
|
|
|
+ <div class="my-title">{{ !id ? '新增' : display ? '详情' : '修改' }}</div>
|
|
|
+ <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
|
|
|
+ <el-row class="my-row">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="工种编码" prop="code">
|
|
|
+ <el-input v-model="dataForm.code" :disabled="true" placeholder="系统自动生成"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" style="padding-left: 20px">
|
|
|
+ <el-form-item label="车间" prop="proWorkshopId">
|
|
|
+ <WorkshopComponent v-model="dataForm.proWorkshopId" :workshop-id="dataForm.proWorkshopId"
|
|
|
+ :disabled="display" style="width:100%;" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" style="padding-left: 20px">
|
|
|
+ <el-form-item label="工种名称" prop="name">
|
|
|
+ <el-input v-model="dataForm.name" :disabled="display" placeholder="工种名称"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row class="my-row">
|
|
|
+ <el-col :span="8" style="padding-left: 20px">
|
|
|
+ <el-form-item label="工种级别" prop="level">
|
|
|
+ <el-select v-model="dataForm.level" :disabled="display" placeholder="请选择" style="width:100%">
|
|
|
+ <el-option v-for="item in optionsLevel" :key="item.code" :label="item.value" :value="item.code">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" style="padding-left: 20px">
|
|
|
+ <el-form-item label="工种类别" prop="typeName">
|
|
|
+ <el-select v-model="dataForm.typeName" :disabled="display" placeholder="请选择" style="width:100%">
|
|
|
+ <el-option label="生产" value="produce" />
|
|
|
+ <el-option label="检验" value="check" />
|
|
|
+ <el-option label="总检" value="t-check" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" style="padding-left: 20px">
|
|
|
+ <el-form-item label="工时单价" prop="quotedPrice">
|
|
|
+ <el-input v-model="dataForm.quotedPrice" placeholder="工时单价" oninput="value=value.replace(/[^0-9.]/g,'')">
|
|
|
+ <i slot="suffix" style="font-style:normal;margin-right: 10px;">元</i>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row class="my-row">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="工种要求" prop="requirement">
|
|
|
+ <el-input v-model="dataForm.requirement" :disabled="display" placeholder="工种要求"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row class="my-row">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="备注说明" prop="notes">
|
|
|
+ <el-input v-model="dataForm.notes" :disabled="display" placeholder="备注说明"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row class="my-row">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="掌握人" prop="masterIds">
|
|
|
+ <user-components v-model="dataForm.masterIds" :user-ids="dataForm.masterIds" @change='masterChange'
|
|
|
+ :disabled="display" style="width:100%;" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" style="padding-left: 20px">
|
|
|
+ <el-form-item label="负责人" prop="foreman">
|
|
|
+ <user-component v-model="dataForm.foreman" :user-id="dataForm.foreman" @userSelected='foremanChange'
|
|
|
+ :disabled="display" style="width:100%;" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="onChose">取消</el-button>
|
|
|
+ <el-button v-if="!display" type="primary" @click="dataFormSubmit()" v-reClick>确定</el-button>
|
|
|
+ </span>
|
|
|
<!-- </el-dialog> -->
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import UserComponents from '@/views/modules/common/user-components'
|
|
|
- import UserComponent from '@/views/modules/common/user-component'
|
|
|
- import WorkshopComponent from '@/views/modules/common/workshop-component.vue'
|
|
|
- import { getDictList } from '@/api/dict'
|
|
|
- import { addOrUpdateWorkType, getWorkTypeDetail } from '@/api/product'
|
|
|
- export default {
|
|
|
- name: 'work-type-add-or-update',
|
|
|
- components: {UserComponents, UserComponent, WorkshopComponent},
|
|
|
- computed: {
|
|
|
- orgId: {
|
|
|
- get () { return this.$store.state.user.orgId }
|
|
|
+import UserComponents from '@/views/modules/common/user-components'
|
|
|
+import UserComponent from '@/views/modules/common/user-component'
|
|
|
+import WorkshopComponent from '@/views/modules/common/workshop-component.vue'
|
|
|
+import { getDictList } from '@/api/dict'
|
|
|
+import { addOrUpdateWorkType, getWorkTypeDetail } from '@/api/product'
|
|
|
+export default {
|
|
|
+ name: 'work-type-add-or-update',
|
|
|
+ components: { UserComponents, UserComponent, WorkshopComponent },
|
|
|
+ computed: {
|
|
|
+ orgId: {
|
|
|
+ get() { return this.$store.state.user.orgId }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ visible: false,
|
|
|
+ display: false,
|
|
|
+ optionsLevel: [],
|
|
|
+ id: 0,
|
|
|
+ dataForm: {},
|
|
|
+ dataRule: {
|
|
|
+ name: [{ required: true, message: '工种名称不能为空', trigger: 'blur' }],
|
|
|
+ level: [{ required: true, message: '工种级别不能为空', trigger: 'change' }],
|
|
|
+ typeName: [{ required: true, message: '工种类别不能为空', trigger: 'change' }],
|
|
|
+ requirement: [{ required: true, message: '工种要求不能为空', trigger: 'blur' }],
|
|
|
+ quotedPrice: [{ required: true, message: '工时单价不能为空', trigger: 'blur' }],
|
|
|
+ masterIds: [{ required: true, message: '请选择掌握人', trigger: 'blur' }],
|
|
|
+ foreman: [{ required: true, message: '请选择工种负责人', trigger: 'blur' }]
|
|
|
}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ onChose() {
|
|
|
+ this.$emit('onChose')
|
|
|
},
|
|
|
- data () {
|
|
|
- return {
|
|
|
- visible: false,
|
|
|
- display: false,
|
|
|
- optionsLevel: [],
|
|
|
- id: 0,
|
|
|
- dataForm: {},
|
|
|
- dataRule: {
|
|
|
- name: [{ required: true, message: '工种名称不能为空', trigger: 'blur' }],
|
|
|
- level: [{ required: true, message: '工种级别不能为空', trigger: 'change' }],
|
|
|
- requirement: [{ required: true, message: '工种要求不能为空', trigger: 'blur' }],
|
|
|
- quotedPrice: [{ required: true, message: '工时单价不能为空', trigger: 'blur' }],
|
|
|
- masterIds: [{ required: true, message: '请选择掌握人', trigger: 'blur' }],
|
|
|
- foreman: [{ required: true, message: '请选择工种负责人', trigger: 'blur' }]
|
|
|
+ async init(id, display) {
|
|
|
+ this.dataForm = {}
|
|
|
+ this.optionsLevel = []
|
|
|
+ this.visible = true
|
|
|
+ this.id = id || 0
|
|
|
+ this.display = display
|
|
|
+ // 获取工种级别
|
|
|
+ await getDictList({ type: 'pro_work_level' }).then(({ data }) => {
|
|
|
+ if (data) {
|
|
|
+ this.optionsLevel = data
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
+ if (!id) return
|
|
|
+ await getWorkTypeDetail(this.id).then(({ data }) => {
|
|
|
+ if (data && data.code === '200') {
|
|
|
+ this.dataForm = data.data
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
- methods: {
|
|
|
- onChose () {
|
|
|
- this.$emit('onChose')
|
|
|
- },
|
|
|
- async init (id, display) {
|
|
|
- this.dataForm = {}
|
|
|
- this.optionsLevel = []
|
|
|
- this.visible = true
|
|
|
- this.id = id || 0
|
|
|
- this.display = display
|
|
|
- // 获取工种级别
|
|
|
- await getDictList({type: 'pro_work_level'}).then(({data}) => {
|
|
|
- if (data) {
|
|
|
- this.optionsLevel = data
|
|
|
- }
|
|
|
- })
|
|
|
- if (!id) return
|
|
|
- await getWorkTypeDetail(this.id).then(({data}) => {
|
|
|
- if (data && data.code === '200') {
|
|
|
- this.dataForm = data.data
|
|
|
+ validateField(type) {
|
|
|
+ this.$refs.dataForm.validateField(type)
|
|
|
+ },
|
|
|
+ // 表单提交
|
|
|
+ dataFormSubmit() {
|
|
|
+ this.$refs['dataForm'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let params = {
|
|
|
+ level: this.dataForm.level,
|
|
|
+ masterIds: this.dataForm.masterIds,
|
|
|
+ name: this.dataForm.name,
|
|
|
+ notes: this.dataForm.notes,
|
|
|
+ orgId: this.orgId,
|
|
|
+ requirement: this.dataForm.requirement,
|
|
|
+ quotedPrice: this.dataForm.quotedPrice,
|
|
|
+ typeId: this.id ? this.id : null,
|
|
|
+ foreman: this.dataForm.foreman,
|
|
|
+ typeName: this.dataForm.typeName,
|
|
|
+ proWorkshopId: this.dataForm.proWorkshopId
|
|
|
}
|
|
|
- })
|
|
|
- },
|
|
|
- validateField (type) {
|
|
|
- this.$refs.dataForm.validateField(type)
|
|
|
- },
|
|
|
- // 表单提交
|
|
|
- dataFormSubmit () {
|
|
|
- this.$refs['dataForm'].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- let params = {
|
|
|
- level: this.dataForm.level,
|
|
|
- masterIds: this.dataForm.masterIds,
|
|
|
- name: this.dataForm.name,
|
|
|
- notes: this.dataForm.notes,
|
|
|
- orgId: this.orgId,
|
|
|
- requirement: this.dataForm.requirement,
|
|
|
- quotedPrice: this.dataForm.quotedPrice,
|
|
|
- typeId: this.id ? this.id : null,
|
|
|
- foreman: this.dataForm.foreman,
|
|
|
- proWorkshopId: this.dataForm.proWorkshopId
|
|
|
+ addOrUpdateWorkType(params, !this.id).then(({ data }) => {
|
|
|
+ if (data && data.code === '200') {
|
|
|
+ this.$message({
|
|
|
+ message: '操作成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 1500,
|
|
|
+ onClose: () => {
|
|
|
+ this.onChose()
|
|
|
+ this.$emit('refreshDataList')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message.error(data.msg)
|
|
|
}
|
|
|
- addOrUpdateWorkType(params, !this.id).then(({data}) => {
|
|
|
- if (data && data.code === '200') {
|
|
|
- this.$message({
|
|
|
- message: '操作成功',
|
|
|
- type: 'success',
|
|
|
- duration: 1500,
|
|
|
- onClose: () => {
|
|
|
- this.onChose()
|
|
|
- this.$emit('refreshDataList')
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.$message.error(data.msg)
|
|
|
- }
|
|
|
- }).catch(() => {})
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- masterChange (val) {
|
|
|
- this.dataForm.masterIds = val
|
|
|
- },
|
|
|
- foremanChange (val) {
|
|
|
- this.dataForm.foreman = val
|
|
|
- }
|
|
|
+ }).catch(() => { })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ masterChange(val) {
|
|
|
+ this.dataForm.masterIds = val
|
|
|
+ },
|
|
|
+ foremanChange(val) {
|
|
|
+ this.dataForm.foreman = val
|
|
|
}
|
|
|
}
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
-<style scoped>
|
|
|
-
|
|
|
-</style>
|
|
|
+<style scoped></style>
|