From 8499181e9d717bfc5a689d6a5f61c3b182f2f28e Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期四, 04 九月 2025 20:02:47 +0800
Subject: [PATCH] 提示改为alert
---
src/views/flowmgr/taskassign.vue | 253 ++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 220 insertions(+), 33 deletions(-)
diff --git a/src/views/flowmgr/taskassign.vue b/src/views/flowmgr/taskassign.vue
index 63b0e04..5096daf 100644
--- a/src/views/flowmgr/taskassign.vue
+++ b/src/views/flowmgr/taskassign.vue
@@ -2,23 +2,65 @@
* @Author: 鏉庡枂(寮�鍙戠粍) lzhe@yxqiche.com
* @Date: 2025-05-28 12:03:55
* @LastEditors: gaoshp
- * @LastEditTime: 2025-08-02 21:58:47
+ * @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>
+ </avue-form>
</basic-container>
</template>
<script>
+import {
+ getQueryString,
+} from '@/utils/util';
+
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 isTempFlow = getQueryString("isTempFlow");
+ //isTempFlow = isTempFlow === 'Y'?'Y':'N';
+
var that = this;
return {
form: {},
- machineCodeList: [],
+
+ treeData: [],
+ defaultProps: {
+ children: 'children',
+ label: 'name',
+ disabled: (data) => data.nodeType!=='machine',//浠呮満搴婅妭鐐瑰彲閫�
+ isLeaf: (data) => !data.hasChildren
+ },
+
attachOption: {
labelWidth: 160,
submitBtn: true,
@@ -26,11 +68,22 @@
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' }],
},
{
@@ -40,6 +93,9 @@
span: 12,
dataType: 'string',
rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+ blur: (col) => {
+ this.handleTrim(col)
+ },
},
{
label: '浜у搧鍨嬪彿',
@@ -48,25 +104,22 @@
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,
- type: 'number',
step: 1,
precision: 0,
- dataType: 'number',
- max: 999,
+ dataType: 'string',
rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+ blur: (col) => {
+ this.handleTrim(col)
+ },
},
{
label: '宸ュ簭鍚嶇О',
@@ -74,8 +127,10 @@
type: 'input',
span: 12,
dataType: 'string',
- maxlength: 2,
rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+ blur: (col) => {
+ this.handleTrim(col)
+ },
},
{
label: '宸ュ簭鐗堟',
@@ -84,37 +139,57 @@
span: 12,
dataType: 'string',
rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+ blur: (col) => {
+ this.handleTrim(col)
+ },
},
{
- label: '宸ヨ壓鐗堟',
+ label: '鎵规鍙�',
prop: 'craftEdition',
+ placeholder:'濡�"A"',
type: 'input',
span: 12,
dataType: 'string',
- rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+ maxlength: 10,
+ blur: (col) => {
+ this.handleTrim(col)
+ },
},
- {
+ /*{
label: '鍔犲伐鏈哄簥',
prop: 'machineCode',
type: 'select',
- dicUrl: `/blade-mdm/machine/page`,
- dicFormatter: function(res) {
+ filterable: true,
+ dicUrl: `/blade-mdm/machine/page?size=10000`,
+ dicFormatter: function (res) {
that.machineCodeList = res.data.records;
return res.data.records;
},
rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
props: {
- label: 'name',
+ label: 'code',
value: 'code',
},
+ span: 12
+ },*/
+ {
+ label: '鍔犲伐鏈哄簥',
+ prop: 'machineCode',
+ type: 'select',
+ 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' }],
},
{
@@ -127,43 +202,155 @@
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' }],
+ }
],
},
- 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) {
+ 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];
+ }
+ )
+ },
+ 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;
+ },
+
+ 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 };
+ /*
+ this.machineCodeList.forEach(item => {
+ if (form.machineCode == item.code) {
form.machineMode = item.name;
}
})
- form.producePlanId = "1932411828915224578";
+ */
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;
+
+ }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