From ce70bd97c7f2577f0978b39b9da1ccdd8d5b768f Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期五, 19 九月 2025 22:50:14 +0800
Subject: [PATCH] 机床增加设备编号
---
src/views/flowmgr/taskassign.vue | 403 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 363 insertions(+), 40 deletions(-)
diff --git a/src/views/flowmgr/taskassign.vue b/src/views/flowmgr/taskassign.vue
index cc02ce7..a27f14d 100644
--- a/src/views/flowmgr/taskassign.vue
+++ b/src/views/flowmgr/taskassign.vue
@@ -1,24 +1,77 @@
<!--
* @Author: 鏉庡枂(寮�鍙戠粍) lzhe@yxqiche.com
* @Date: 2025-05-28 12:03:55
- * @LastEditors: 鏉庡枂(寮�鍙戠粍) lzhe@yxqiche.com
- * @LastEditTime: 2025-07-10 12:16:15
+ * @LastEditors: gaoshp
+ * @LastEditTime: 2025-08-10 13:05:56
* @FilePath: /mdmweb/src/views/flowmgr/taskassign.vue
* @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<basic-container>
- <avue-form ref="form" :option="attachOption" v-model="attachForm" @submit="formSubmit"></avue-form>
+ <avue-form ref="form" :option="attachOption" v-model="attachForm" @submit="formSubmit"><!-- -->
+ <template #machineCode="{}">
+ <el-tree-select ref="tree" filterable v-model="attachForm.machineCode"
+ node-key="machineCode"
+ :data="treeData" :props="defaultProps">
+ </el-tree-select>
+ </template>
+ <template #drawingNo="{}">
+ <el-autocomplete v-model="attachForm.drawingNo"
+ :fetch-suggestions="querySearchAsync"
+ :trigger-on-focus="false" @select="handleSelect"
+ >
+ </el-autocomplete>
+ </template>
+ <!--
+ <template #programmer="{}">
+ <el-autocomplete ref="autoProgrammer" :disabled="drawingNoMatch" v-model="attachForm.programmer"
+ :fetch-suggestions="queryProgrammerAsync"
+ :trigger-on-focus="false" @select="handleProgrammerSelect"
+ >
+ </el-autocomplete>
+ </template>
+-->
+ </avue-form>
</basic-container>
</template>
<script>
export default {
+ watch: {
+ 'attachForm.drawingNo': function (val) {
+ if(val && this.attachForm.processNo && this.attachForm.processEdition) {
+ this.attachForm.title = `${val}-${this.attachForm.processNo}-${this.attachForm.processEdition}-璁″垝浠诲姟`;
+
+
+ }
+ },
+ 'attachForm.processNo': function (val) {
+ if(val && this.attachForm.drawingNo && this.attachForm.processEdition) {
+ //this.attachForm.title = `${val}-${this.attachForm.processNo}-鏁版帶绋嬪簭缂栧埗`;
+ this.attachForm.title = `${this.attachForm.drawingNo}-${val}-${this.attachForm.processEdition}-璁″垝浠诲姟`;
+ }
+ },
+ 'attachForm.processEdition': function (val) {
+ if(val && this.attachForm.drawingNo && this.attachForm.processNo ) {
+ //this.attachForm.title = `${val}-${this.attachForm.processNo}-鏁版帶绋嬪簭缂栧埗`;
+ this.attachForm.title = `${this.attachForm.drawingNo}-${this.attachForm.processNo}-${val}-璁″垝浠诲姟`;
+ }
+ },
+ },
data() {
var that = this;
return {
form: {},
- machineCodeList: [],
+
+ treeData: [],
+ defaultProps: {
+ children: 'children',
+ label: 'name',
+ disabled: (data) => data.nodeType!=='machine',//浠呮満搴婅妭鐐瑰彲閫�
+ isLeaf: (data) => !data.hasChildren
+ },
+ timeout:0, //闆朵欢鍙峰姞杞界殑timeout
+ //drawingNoMatch:true,//闆朵欢鍙锋槸鍚﹀尮閰嶅垎宸ヨ〃
attachOption: {
labelWidth: 160,
submitBtn: true,
@@ -26,39 +79,59 @@
tip: false,
column: [
{
- label: '鍥惧彿',
+ label: '娴佺▼鏍囬',
+ prop: 'title',
+ type: 'input',
+ span: 24,
+ disabled:true,
+ dataType: 'string'
+ },
+ {
+ label: '闆剁粍浠跺彿',
prop: 'drawingNo',
type: 'input',
span: 12,
dataType: 'string',
+ blur: (col) => {
+ this.handleTrim(col);
+
+ },
+ rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
},
{
- label: '鍥惧彿鐗堟',
- prop: 'partNoEdition',
+ label: '鍥剧焊鐗堟',
+ prop: 'drawingNoEdition',
type: 'input',
span: 12,
dataType: 'string',
+ rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+ blur: (col) => {
+ this.handleTrim(col)
+ },
},
{
label: '浜у搧鍨嬪彿',
- prop: 'productType',
+ prop: 'productModel',
type: 'input',
span: 12,
dataType: 'string',
- // rules: [
- // {
- // required: true,
- // message: '璇烽�夋嫨娴佺▼绫诲瀷',
- // trigger: 'blur',
- // },
- // ],
+ rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+ blur: (col) => {
+ this.handleTrim(col)
+ },
},
{
label: '宸ュ簭鍙�',
prop: 'processNo',
type: 'input',
span: 12,
+ step: 1,
+ precision: 0,
dataType: 'string',
+ rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+ blur: (col) => {
+ this.handleTrim(col)
+ },
},
{
label: '宸ュ簭鍚嶇О',
@@ -66,35 +139,53 @@
type: 'input',
span: 12,
dataType: 'string',
+ rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+ blur: (col) => {
+ this.handleTrim(col)
+ },
},
{
- label: '宸ヨ壓鐗堟',
- prop: 'craftEdition',
+ label: '宸ュ簭鐗堟',
+ prop: 'processEdition',
type: 'input',
span: 12,
dataType: 'string',
+ rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+ blur: (col) => {
+ this.handleTrim(col)
+ },
},
+ {
+ label: '鎵规鍙�',
+ prop: 'craftEdition',
+ placeholder:'濡�"2S24001"',
+ type: 'input',
+ span: 12,
+ dataType: 'string',
+ maxlength: 10,
+ blur: (col) => {
+ this.handleTrim(col)
+ },
+ },
+
{
label: '鍔犲伐鏈哄簥',
prop: 'machineCode',
type: 'select',
- dicUrl: `/blade-mdm/machine/page`,
- dicFormatter: function(res) {
- that.machineCodeList = res.data.records;
- return res.data.records;
- },
- props: {
- label: 'name',
- value: 'code',
- },
+ rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
span: 12
},
{
label: '璁″垝閿佸畾鏃堕棿锛堝ぉ锛�',
prop: 'planLockDays',
- type: 'input',
+ type: 'number',
+ min:0,
+ max:30,
span: 12,
- dataType: 'string',
+ controls:true,
+ dataType: 'number',
+ controlsPosition:'right',
+ rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
},
{
label: '璁″垝寮�宸ユ椂闂�',
@@ -104,44 +195,276 @@
valueFormat: "YYYY-MM-DD",
span: 12,
dataType: 'string',
+ rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
},
+ {
+ label: '涓存椂鏇存敼鍗曞彿',
+ prop: 'deviation',
+ type: 'input',
+ span: 12,
+ dataType: 'string',
+ class:'input_holder_warn',
+ placeholder:'闈炰复鏃舵洿鏀瑰崟浠诲姟璇风暀绌�',
+ blur: (col) => {
+ this.handleTrim(col)
+ },
+ // rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+ },
+ {
+ label: '涓荤宸ヨ壓',
+ prop: 'producePlanId',
+ type: 'select',//column 12
+ clearable:true,
+ remote: true,
+ placeholder:'鏃犳硶鍖归厤浜哄憳鑱岃矗琛ㄦ椂璇烽�夋嫨涓荤宸ヨ壓',
+ dicUrl: `/blade-mdm/producedivision/select-programmer?programmer={{key}}`,
+ dicFormatter:(res)=>{
+ return res.data.map(obj => {
+ let item = new Object();
+ item.value = obj.id;
+ item.label = obj.programmerName;
+ item.desc = `涓撲笟缁勯暱锛�${obj.teamLeaderName},鏍″锛�${obj.checkerName},瀹℃牳锛�${obj.seniorName}`
+ return item;
+ }); ;
+ },
+ span: 12,
+ dataType: 'string',
+ },
+ /*{
+ label: '涓荤宸ヨ壓',
+ prop: 'programmer',
+ type: 'input',//column 12
+ span: 12,
+ dataType: 'string',
+ },*/
],
},
- attachForm: {},
+ attachForm: {planLockDays:7,planStartTime: this.$dayjs().format('YYYY-MM-DD')},//榛樿7澶�
+ defaultForm: {planLockDays:7,planStartTime: this.$dayjs().format('YYYY-MM-DD')},
};
},
methods: {
- formSubmit(form,done) {
- var form = {...form};
- this.machineCodeList.forEach(item=> {
- if(form.machineCode == item.code) {
- form.machineMode = item.name;
+ treeLoad () {
+ axios({
+ url: '/blade-mdm/gkw/node/load-tree',
+ method: 'get',
+ }).then(
+ res => {
+ this.treeData = this.filterTreeData(res.data.data);
+ var firstIndex = 0;
+ res.data.data.forEach((item,index)=> {
+ if(item.children.length != 0) {
+ firstIndex = index;
+ }
+ })
+ //defaultKeys.push(item.id);
+ this.defaultKeys = [res.data.data[firstIndex].id];
}
- })
- form.producePlanId = "1932411828915224578";
+ )
+ },
+ filterTreeData(oriTreeData){
+ var roots = [];
+ for(var i=0;i<oriTreeData.length;i++){
+ roots.push(this.filterTreeNodes(oriTreeData[i]));
+ }
+ return roots;
+ },
+ filterTreeNodes(node) {
+ // 濡傛灉褰撳墠鑺傜偣鐨刵odeType鏄�'machine'锛屽垯娓呴櫎鍏跺瓙鑺傜偣
+ if (node.nodeType === 'machine') {
+ // 鍒涘缓涓�涓柊瀵硅薄锛屽鍒跺綋鍓嶈妭鐐圭殑灞炴�э紝浣嗘竻闄hildren
+ return {
+ ...node,
+ children: []
+ };
+ }
+
+ // 濡傛灉褰撳墠鑺傜偣鏈夊瓙鑺傜偣锛岄�掑綊澶勭悊姣忎釜瀛愯妭鐐�
+ if (node.children && node.children.length > 0) {
+ return {
+ ...node,
+ children: node.children.map(child => this.filterTreeNodes(child))
+ };
+ }
+
+ // 濡傛灉鏃笉鏄痬achine鑺傜偣涔熸病鏈夊瓙鑺傜偣锛岀洿鎺ヨ繑鍥炲師鑺傜偣
+ return node;
+ },
+
+ querySearchAsync(query, cb) {//闆剁粍浠跺彿鎼滅储寤鸿
+ axios({
+ url: '/blade-mdm/producedivision/select-data',
+ method: 'get',
+ params: {drawingNo: query},
+ }).then(
+ res => {
+ if(res.data.code == 200){
+ let list = res.data.data;
+ for(let i of list){
+ i.value = i.ljh;
+ }
+
+ clearTimeout(this.timeout)
+ this.timeout = setTimeout(() => {
+ cb(list);
+ }, 1000)
+
+ }
+ },
+ error => {
+ console.log(error);
+ }
+ );
+
+ },
+ handleSelect(item) {
+ this.attachForm.productModel = item.cph;
+ },
+ /*
+ queryProgrammerAsync(query, cb) {//涓荤宸ヨ壓鎼滅储寤鸿
+ axios({
+ url: '/blade-mdm/producedivision/select-programmer',
+ method: 'get',
+ params: {programmer: query},
+ }).then(
+ res => {
+ if(res.data.code == 200){
+ let list = res.data.data;
+ for(let i of list){
+ i.value = '涓荤宸ヨ壓锛�'+i.programmerName+',鏍″锛�'+i.checkerName;
+ }
+
+ clearTimeout(this.timeout)
+ this.timeout = setTimeout(() => {
+ cb(list);
+ }, 600)
+
+ }
+ },
+ error => {
+ console.log(error);
+ }
+ );
+
+ },
+ */
+ /*
+ handleProgrammerSelect(item){
+ this.attachForm.producePlanId = item.id;
+ this.attachForm.planDrawingNo = this.attachForm.drawingNo;//璁板綍姝ゆ椂鐨勯浂缁勪欢鍙�
+ console.log('productid',this.attachForm )
+
+ },*/
+ handleTrim(col){
+ //console.log(col)
+ let value = this.attachForm[col.column.prop];
+ if (typeof value === 'string') {
+ const trimmedValue = value.trim();
+ // 鍙湁褰撳�肩‘瀹炲彂鐢熷彉鍖栨椂鎵嶆洿鏂�
+ if (trimmedValue !== value) {
+ this.attachForm[col.column.prop] = trimmedValue;
+ }
+ }
+ // this.attachForm[col.column.prop]='dddd'
+ },
+ formSubmit(form, done) {
+ var form = { ...form };
+
+ if(this.attachForm.producePlanId){
+ //鎵嬪姩鎸囧畾浜嗕汉鍛樿亴璐h〃id锛屼笉鐢ㄧ户缁粠鏈嶅姟绔獙璇�
+ this.startDispatch(form,done);
+ }else{
+ axios({
+ url: '/blade-mdm/producedivision/select-by-drawingno',
+ method: 'get',
+ params: {drawingNo:this.attachForm.drawingNo},
+ }).then(
+ res => {
+
+ if(res.data.code == 200){
+
+ this.attachForm.producePlanId = res.data.data.id;
+ //this.drawingNoMatch = true;
+ console.log('planid',this.attachForm.productPlanId)
+ this.startDispatch(form,done);
+ }else{
+ //this.drawingNoMatch = false;
+
+ this.$alert(res.data.msg+".閲嶆柊杈撳叆鎴栬�呮墜鍔ㄩ�夋嫨涓荤宸ヨ壓銆�", '鍙戣捣浠诲姟澶辫触',{type:'error',confirmButtonText:'鍏抽棴'});
+ }
+ done();
+ },
+ error => {
+ console.log(error);
+ done();
+ }
+ );
+ }
+
+ },
+ startDispatch(form,done){
+ //楠岃瘉閮介�氳繃浜嗭紝鎵ц鍚姩娴佺▼
axios({
url: '/blade-mdm/flow/dispatch/start',
method: 'post',
data: form,
}).then(
res => {
+
+ if(res.data.code == 200){
this.$message({
type: 'success',
message: '鎿嶄綔鎴愬姛!',
});
this.$refs.form.resetForm();
- done();
+ this.attachForm = this.defaultForm;
+ //this.drawingNoMatch = true;
+ }else{
+ this.$alert(res.data.msg, '鍙戣捣浠诲姟澶辫触',{type:'error',confirmButtonText:'鍏抽棴'});
+ }
+ done();
},
error => {
- window.console.log(error);
- done();
+ window.console.log(error);
+ done();
}
);
+ },
+ handleGlobalBlur( {prop, value} ) {
+ console.log('prop')
+ // 1. 绛涢�夐渶瑕佸鐞嗙殑瀛楁绫诲瀷锛堜粎杈撳叆绫伙細input/textarea锛�
+ const inputTypes = ["input", "textarea"];
+ const currentColumn = this.attachOption.column.find(item => item.prop === prop);
+
+ // 2. 鑻ヤ负杈撳叆绫诲瓧娈碉紝涓斿�间负瀛楃涓诧紝鎵ц trim 澶勭悊
+ if (currentColumn && inputTypes.includes(currentColumn.type) && typeof value === "string") {
+ const trimmedValue = value.trim();
+ // 3. 鍚屾澶勭悊鍚庣殑鍊煎埌琛ㄥ崟 model锛堥伩鍏嶇洿鎺ヤ慨鏀� prop锛岄�氳繃 $set 纭繚鍝嶅簲寮忥級
+ this.$set(this.attachForm, prop, trimmedValue);
+ }
+ },
+ handleBlur(prop, value) {
+ if (typeof value === 'string') {
+ const trimmedValue = value.trim();
+ // 鍙湁褰撳�肩‘瀹炲彂鐢熷彉鍖栨椂鎵嶆洿鏂�
+ if (trimmedValue !== value) {
+ this.attachForm[prop] = trimmedValue;
+ }
+ }
}
+ },
+
+ mounted() {
+ this.treeLoad();
},
};
</script>
<style lang="scss">
-
+.input_holder_warn {
+ .el-input__inner::placeholder {
+ color: rgb(255, 106, 0); /* 璁剧疆棰滆壊涓虹孩鑹� */
+ font-size: 16px; /* 璁剧疆瀛椾綋澶у皬涓�16px */
+ }
+}
</style>
--
Gitblit v1.9.3