| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387 |
- import QtQuick
- import QtQuick.Controls
- import QtQuick.Layouts
- import com.InteractiveTask 1.0
- Item {
- id: materialcheckform
- x: 290
- y: 130
- width: 1600
- height: 920
- property string strMaterialCheckFormGet: ""
- signal signal_getMaterialCheckForm(int planId);
- signal signal_postSaveForm(string data);
- onVisibleChanged: {
- if (visible === true)
- {
- proThread.moveCursorTo(0, 0);
- }
- if (visible === false)
- materialcheckform_dialog_confirm.close();
- }
- PromptInfo
- {
- id: materialcheckform_prompt_info;
- }
- Connections {
- target: materialcheckform
- onVisibleChanged: {
- if (materialcheckform.visible === true)
- {
- waitPromptBox.show();
- signal_getMaterialCheckForm(materialCheckPlan.planId);
- }
- else
- {
- materialcheckform_tableModel.clear();
- materialcheckform_tableModel_standard.clear();
- }
- }
- }
- ListModel {
- id: materialcheckform_tableModel
- // 物资标志
- // materialFlag: 0 = 未定义、 1 = 正常、 2 = 损坏、 3 = 过期
- // onDataChanged: {
- // // build_model_view()
- // }
- }
- ListModel {
- id: materialcheckform_tableModel_standard
- }
- Dialog {
- id: materialcheckform_dialog_confirm
- title: "操作确认"
- x: parent.width / 2 - width / 2
- y: parent.height / 2 - height / 2
- width: 600
- height: 400
- clip: true
- modal: true
- property int flag: 0;
- // 自定义背景(带圆角)
- background: Rectangle {
- color: "white"
- clip: true
- }
- // 自定义标题栏
- header: Rectangle {
- x: 0
- y: 0
- width: parent.width
- height: 50 // 设置标题栏高度
- color: "#ff3968e9" // 设置标题栏背景色
- // 标题文本
- Text {
- x: 20
- y: 0
- width: 80
- height: 50 // 设置标题栏高度
- text: materialcheckform_dialog_confirm.title
- font.pixelSize: 25
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "white"
- }
- }
- contentItem: Rectangle {
- x: 0
- y: 0
- width: parent.width
- height: 200
- color: "white"
- Text {
- id: materialcheckform_text_dialog_item;
- width: parent.width
- height: 100
- text: ""
- font.pixelSize: 30
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
- }
- // 单选按钮
- Item {
- id: materialcheckform_item_check
- x: 0
- y: 150
- width: parent.width
- height: 100
- Row {
- anchors.horizontalCenter: parent.horizontalCenter
- spacing: 20
- // 正常单选按钮
- Rectangle {
- id: materialcheckform_btn_normal
- width: 164
- height: 61
- color: "#33008000"
- radius: 20
- clip: true
- ToolButton
- {
- anchors.centerIn: parent
- enabled: false // 不可点击
- display: AbstractButton.TextBesideIcon // 文字在图标旁边
- icon.source: ""
- icon.width: 36
- icon.height: 30
- text: "正常"
- palette.buttonText: "#ffffff"
- font {
- pixelSize: 25
- }
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- materialcheckform_dialog_confirm.flag =
- (materialcheckform_dialog_confirm.flag === 1 ? 0 : 1);
- }
- }
- }
- Rectangle {
- id: materialcheckform_btn_expire;
- width: 164
- height: 61
- color: "#33ff9900"
- radius: 20
- clip: true
- ToolButton
- {
- anchors.centerIn: parent
- enabled: false // 不可点击
- display: AbstractButton.TextBesideIcon // 文字在图标旁边
- icon.source: ""
- icon.width: 36
- icon.height: 30
- text: "过期"
- palette.buttonText: "#ffffff"
- font {
- pixelSize: 25
- }
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- materialcheckform_dialog_confirm.flag =
- (materialcheckform_dialog_confirm.flag === 2 ? 0 : 2);
- }
- }
- }
- Rectangle {
- id: materialcheckform_btn_damage;
- width: 164
- height: 61
- color: "#33ff0000"
- radius: 20
- clip: true
- ToolButton
- {
- anchors.centerIn: parent
- enabled: false // 不可点击
- display: AbstractButton.TextBesideIcon // 文字在图标旁边
- icon.source: ""
- icon.width: 36
- icon.height: 30
- text: "损坏"
- palette.buttonText: "#ffffff"
- font {
- pixelSize: 25
- }
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- materialcheckform_dialog_confirm.flag =
- (materialcheckform_dialog_confirm.flag === 3 ? 0 : 3);
- }
- }
- }
- }
- }
- // 自定义 DialogButtonBox
- DialogButtonBox {
- id: materialcheckform_buttonBox
- x: 0
- y: 250
- width: parent.width
- height: 100
- // 自定义按钮
- Button {
- implicitWidth: 120
- implicitHeight: 50
- text: "确认"
- background: Rectangle {
- color: "green"
- radius: 5
- }
- contentItem: Text {
- text: parent.text
- font.pixelSize: 30
- color: "white"
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
- onClicked: {
- if (materialcheckform_dialog_confirm.flag != 0)
- {
- for (var i = 0; i < materialcheckform_tableModel.count; i++)
- {
- var item = materialcheckform_tableModel.get(i);
- if (item.materialFlag === 0)
- {
- item.materialFlag = materialcheckform_dialog_confirm.flag;
- }
- }
- }
- materialcheckform_dialog_confirm.close()
- }
- }
- Button {
- implicitWidth: 120
- implicitHeight: 50
- text: "取消"
- background: Rectangle {
- color: "red"
- radius: 5
- }
- contentItem: Text {
- text: parent.text
- font.pixelSize: 30
- color: "white"
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
- onClicked: {
- materialcheckform_dialog_confirm.reject()
- }
- }
- }
- onFlagChanged: {
- materialcheckform_btn_normal.color= "#33008000";
- materialcheckform_btn_expire.color= "#33FF9900";
- materialcheckform_btn_damage.color= "#33FF0000";
- switch (materialcheckform_dialog_confirm.flag)
- {
- case 1:{
- materialcheckform_btn_normal.color= "#008000";
- }break;
- case 2:{
- materialcheckform_btn_expire.color= "#FF9900";
- }break;
- case 3:{
- materialcheckform_btn_damage.color= "#FF0000";
- }break;
- }
- }
- }
- Dialog {
- id: materialcheckform_dialog_confirm_prompt
- title: "操作确认"
- x: parent.width / 2 - width / 2
- y: parent.height / 2 - height / 2
- width: 600
- height: 400
- clip: true
- modal: true
- property int flag: 0;
- // 自定义背景(带圆角)
- background: Rectangle {
- color: "white"
- clip: true
- }
- // 自定义标题栏
- header: Rectangle {
- x: 0
- y: 0
- width: parent.width
- height: 50 // 设置标题栏高度
- color: "#ff3968e9" // 设置标题栏背景色
- // 标题文本
- Text {
- x: 20
- y: 0
- width: 80
- height: 50 // 设置标题栏高度
- text: materialcheckform_dialog_confirm_prompt.title
- font.pixelSize: 25
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "white"
- }
- }
- contentItem: Rectangle {
- x: 0
- y: 0
- width: parent.width
- height: 200
- color: "white"
- Text {
- id: materialcheckform_text_dialog_prompt;
- width: parent.width
- height: 100
- text: ""
- font.pixelSize: 30
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
- }
- // 自定义 DialogButtonBox
- DialogButtonBox {
- x: 0
- y: 250
- width: parent.width
- height: 100
- // 自定义按钮
- Button {
- implicitWidth: 120
- implicitHeight: 50
- text: "确认"
- background: Rectangle {
- color: "green"
- radius: 5
- }
- contentItem: Text {
- text: parent.text
- font.pixelSize: 30
- color: "white"
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
- onClicked: {
- materialcheckform_dialog_confirm_prompt.close();
- }
- }
- Button {
- implicitWidth: 120
- implicitHeight: 50
- text: "取消"
- background: Rectangle {
- color: "red"
- radius: 5
- }
- contentItem: Text {
- text: parent.text
- font.pixelSize: 30
- color: "white"
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
- onClicked: {
- materialcheckform_dialog_confirm_prompt.reject()
- }
- }
- }
- }
- // 一键检查
- Button {
- id: materialcheckform_btn_onekey_check
- x: 928
- y: 835
- width: 192
- height: 75
- background: Rectangle {
- color: "#ff9900" // 设置背景为透明
- radius: 10 // 可选,设置圆角
- }
- text: qsTr("一键检查")
- font.pixelSize: 30
- palette.buttonText: "white" // 设置字体颜色为绿色
- Connections {
- target: materialcheckform_btn_onekey_check
- onClicked: {
- var iCount = 0;
- for (var i = 0; i < materialcheckform_tableModel.count; i++)
- {
- var item = materialcheckform_tableModel.get(i);
- if (item.materialFlag === 0)
- {
- iCount++;
- }
- }
- var strText;
- if (iCount > 0)
- {
- strText = "将待检查的" + iCount + "件物资,全部标注为:";
- materialcheckform_item_check.visible = true;
- }
- else
- {
- strText = "没有待检查的物资";
- materialcheckform_item_check.visible = false;
- }
- materialcheckform_text_dialog_item.text = strText;
- materialcheckform_dialog_confirm.open();
- }
- }
- }
- // 保存
- Button {
- id: materialcheckform_btn_save
- x: 1168
- y: 835
- width: 192
- height: 75
- background: Rectangle {
- color: "#ff0000" // 设置背景为透明
- radius: 10 // 可选,设置圆角
- }
- text: qsTr("保存")
- font.pixelSize: 30
- palette.buttonText: "white" // 设置字体颜色为绿色
- Connections {
- target: materialcheckform_btn_save
- onClicked: {
- infoPromptBox.title("操作确认");
- infoPromptBox.message("确定要保存检查结果吗?");
- infoPromptBox.button_clear();
- infoPromptBox.button_push("red", "取消", null, null);
- infoPromptBox.button_push(
- "#055eb3", "确定", ()=>{
- var taskType = InteractiveTask.TypeHttpPost_insertCheckRecord;
- var jsonObjRoot = {};
- var jsonArrList = [];
- for (var i = 0; i < materialcheckform_tableModel.count; i++)
- {
- var item = materialcheckform_tableModel.get(i);
- var jsonObjList = item.materialJson;
- if (item.materialFlag === 0)
- {
- jsonObjList["status"] = "";
- jsonObjList["reason"] = "";
- }
- else if (item.materialFlag === 1)
- {
- jsonObjList["status"] = "0";
- jsonObjList["reason"] = "";
- }
- else if (item.materialFlag === 2)
- {
- jsonObjList["status"] = "1";
- jsonObjList["reason"] = "2";
- }
- else if (item.materialFlag === 3)
- {
- jsonObjList["status"] = "1";
- jsonObjList["reason"] = "1";
- }
- jsonArrList.push(jsonObjList);
- }
- jsonObjRoot["list"] = jsonArrList;
- var strJson = JSON.stringify(jsonObjRoot);
- // 添加提交任务
- interactiveCore.appendTask(
- taskType, strJson, (json)=>{
- var jsonObjRoot = JSON.parse(json);
- if (jsonObjRoot.code === 200)
- {
- var iWait = 0;
- var iNormal = 0;
- var iExpire = 0;
- var iDamage = 0;
- var text = "";
- for (var i = 0; i < materialcheckform_tableModel.count; i++)
- {
- var item = materialcheckform_tableModel.get(i);
- switch (item.materialFlag)
- {
- case 0: iWait++; break;
- case 1: iNormal++; break;
- case 2: iExpire++; break;
- case 3: iDamage++; break;
- }
- }
- materialcheckform_text_wait_check.text = "待检查:" + iWait
- materialcheckform_text_normal_check.text = "正常:" + iNormal
- materialcheckform_text_expire_check.text = "过期:" + iExpire
- materialcheckform_text_damage_check.text = "损坏:" + iDamage
- if (iWait > 0)
- {
- text = "保存成功,还有" + iWait + "件物资待检查";
- }
- else
- {
- text = "保存成功,没有物资待检查";
- }
- infoPromptBox.title("保存成功");
- infoPromptBox.message(text);
- infoPromptBox.button_clear();
- infoPromptBox.button_push("#055eb3", "确定", null, null);
- infoPromptBox.show();
- }
- else
- {
- infoPromptBox.title("保存失败");
- infoPromptBox.message(jsonObjRoot.msg);
- infoPromptBox.button_clear();
- infoPromptBox.button_push("#055eb3", "确定", null, null);
- infoPromptBox.show();
- }
- });
- }, null);
- infoPromptBox.show();
- }
- }
- }
- // 返回按钮
- Button {
- id: materialcheckform_btn_return
- x: 1408
- y: 835
- width: 192
- height: 75
- background: Rectangle {
- color: "#055eb3" // 设置背景为透明
- radius: 10 // 可选,设置圆角
- }
- text: qsTr("返回")
- font.pixelSize: 30
- palette.buttonText: "white" // 设置字体颜色为绿色
- Connections {
- target: materialcheckform_btn_return
- onClicked: {
- if (pConfig.sopenDoor)
- {
- infoPromptBox.title("提示");
- infoPromptBox.message("开柜状态下不允许该操作");
- infoPromptBox.button_clear();
- infoPromptBox.button_push("#055eb3", "确定", null, null);
- infoPromptBox.show();
- }
- else
- {
- materialcheckform.visible = false;
- materialCheckPlan.visible = true;
- mainScreen.changeModel_text("物资检查");
- mainScreen.resetLogin_timeout();
- }
- }
- }
- }
- // 待检查 文字区域
- Text {
- id: materialcheckform_text_wait_check
- x: 0
- y: 810
- width: 1600
- height: 90
- text: "待检查:0"
- font.pixelSize: 30
- color: "#d7d7d2"
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- leftPadding: 20 // 添加左边距使文本不紧贴边缘
- }
- // 正常 文字区域
- Text {
- id: materialcheckform_text_normal_check
- x: 0
- y: 810
- width: 1600
- height: 90
- text: "正常:0"
- font.pixelSize: 30
- color: "#d7d7d2"
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- leftPadding: 250 // 添加左边距使文本不紧贴边缘
- }
- // 过期 文字区域
- Text {
- id: materialcheckform_text_expire_check
- x: 0
- y: 810
- width: 1600
- height: 90
- text: "过期:0"
- font.pixelSize: 30
- color: "#d7d7d2"
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- leftPadding: 450 // 添加左边距使文本不紧贴边缘
- }
- // 损坏 文字区域
- Text {
- id: materialcheckform_text_damage_check
- x: 0
- y: 810
- width: 1600
- height: 90
- text: "损坏:0"
- font.pixelSize: 30
- color: "#d7d7d2"
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- leftPadding: 650 // 添加左边距使文本不紧贴边缘
- }
- // 主体区域
- Rectangle {
- id: materialcheckform_rect_main
- width: 1600
- height: 800
- color: "#272b7ae9"
- radius: 20
- clip: true
- // 表格区域
- Rectangle {
- x: 0
- y: 0
- width: 1110
- height: 800
- color: "#272b7ae9"
- radius: 20
- // 表格
- Column {
- anchors.fill: parent
- spacing: 0
- // 表头
- Row {
- id: materialcheckform_header
- width: parent.width
- height: 100
- spacing: 0
- // 编号
- Rectangle {
- width: 100
- height: parent.height
- color: "#33ffffff"
- border.color: "#47bfff"
- Text {
- anchors.centerIn: parent
- text: "编号"
- font.pixelSize: 25
- color: "#d7d7d2"
- font.bold: true
- }
- }
- // 物资类型
- Rectangle {
- width: 140
- height: parent.height
- color: "#33ffffff"
- border.color: "#47bfff"
- Text {
- anchors.centerIn: parent
- text: "物资类型"
- font.pixelSize: 25
- color: "#d7d7d2"
- font.bold: true
- }
- }
- // 物资名称
- Rectangle {
- width: 180
- height: parent.height
- color: "#33ffffff"
- border.color: "#47bfff"
- Text {
- anchors.centerIn: parent
- text: "物资名称"
- font.pixelSize: 25
- color: "#d7d7d2"
- font.bold: true
- }
- }
- // RFID
- Rectangle {
- width: 220
- height: parent.height
- color: "#33ffffff"
- border.color: "#47bfff"
- Text {
- anchors.centerIn: parent
- text: "RFID"
- font.pixelSize: 25
- color: "#d7d7d2"
- font.bold: true
- }
- }
- // 正常
- Rectangle {
- width: 80
- height: parent.height
- color: "#33ffffff"
- border.color: "#47bfff"
- Image {
- anchors.centerIn: parent
- visible: true
- source: "qrc:/png/title_normal.png"
- fillMode: Image.PreserveAspectFit
- }
- }
- // 过期
- Rectangle {
- width: 80
- height: parent.height
- color: "#33ffffff"
- border.color: "#47bfff"
- Image {
- anchors.centerIn: parent
- visible: true
- source: "qrc:/png/title_expire.png"
- fillMode: Image.PreserveAspectFit
- }
- }
- // 损坏
- Rectangle {
- width: 80
- height: parent.height
- color: "#33ffffff"
- border.color: "#47bfff"
- Image {
- anchors.centerIn: parent
- visible: true
- source: "qrc:/png/title_damage.png"
- fillMode: Image.PreserveAspectFit
- }
- }
- // 措施
- Rectangle {
- width: 230
- height: parent.height
- color: "#33ffffff"
- border.color: "#47bfff"
- Text {
- anchors.centerIn: parent
- text: "措施"
- font.pixelSize: 25
- color: "#d7d7d2"
- font.bold: true
- }
- }
- }
- // 表格内容
- ListView {
- width: parent.width
- height: parent.height - materialcheckform_header.height
- clip: true
- model: materialcheckform_tableModel
- property var _materialTextArr: [];
- delegate: Row {
- width: 1110
- height: Math.max(materialNameRfid.implicitHeight, 100)
- spacing: 0
- QtObject {
- id: itemData
- property int flag: model.materialFlag
- onFlagChanged: {
- materialcheckform_rect_normal.color= "#272b7ae9";
- materialcheckform_rect_expire.color= "#272b7ae9";
- materialcheckform_rect_damage.color= "#272b7ae9";
- switch (flag)
- {
- case 1:{
- materialcheckform_rect_normal.color= "#008000";
- }break;
- case 2:{
- materialcheckform_rect_expire.color= "#FF9900";
- }break;
- case 3:{
- materialcheckform_rect_damage.color= "#FF0000";
- }break;
- }
- }
- }
- // 编号
- Rectangle {
- width: 100
- height: parent.height
- color: "#272b7ae9"
- border.color: "#47bfff"
- clip: true
- Text {
- anchors.centerIn: parent
- font.pixelSize: 20
- color: "#d7d7d2"
- text: model.materialCode
- wrapMode: Text.WordWrap
- }
- }
- // 物资类型
- Rectangle {
- width: 140
- height: parent.height
- color: "#272b7ae9"
- border.color: "#47bfff"
- clip: true
- ToolButton
- {
- anchors.centerIn: parent
- enabled: false // 不可点击
- display: AbstractButton.TextUnderIcon
- icon.source: model.materialIcon
- icon.width: 36
- icon.height: 30
- text: model.materialType
- palette.buttonText: "#d7d7d2"
- font {
- pixelSize: 20
- }
- }
- }
- // 物资名称
- Rectangle {
- width: 180
- height: parent.height
- color: "#272b7ae9"
- border.color: "#47bfff"
- clip: true
- Text {
- anchors.centerIn: parent
- font.pixelSize: 20
- color: "#d7d7d2"
- text: model.materialName
- wrapMode: Text.WordWrap
- }
- }
- // RFID
- Rectangle {
- width: 220
- height: parent.height
- color: "#272b7ae9"
- border.color: "#47bfff"
- clip: true
- Text {
- id: materialNameRfid
- width: parent.width - 10 // 留点边距
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- wrapMode: Text.WordWrap
- font.pixelSize: 20
- color: "#d7d7d2"
- text: model.materialRfid
- elide: Text.ElideRight
- ToolTip {
- visible: materialNameRfid.truncated && textHoverArea.containsMouse
- delay: 500
- text: materialNameRfid.text
- }
- MouseArea {
- id: textHoverArea
- anchors.fill: parent
- hoverEnabled: true
- }
- }
- }
- // 正常
- Rectangle {
- id: materialcheckform_rect_normal
- width: 80
- height: parent.height
- color: "#272b7ae9"
- border.color: "#47bfff"
- Image {
- anchors.centerIn: parent
- visible: true
- source: "qrc:/png/title_normal.png"
- fillMode: Image.PreserveAspectFit
- }
- MouseArea {
- anchors.fill: parent // 让MouseArea覆盖整个Image区域
- onClicked: {
- model.materialFlag = (model.materialFlag === 1 ? 0 : 1);
- model.materialText = (model.materialFlag === 1 ? "" : "")
- }
- }
- }
- // 过期
- Rectangle {
- id: materialcheckform_rect_expire
- width: 80
- height: parent.height
- color: "#272b7ae9"
- border.color: "#47bfff"
- Image {
- anchors.centerIn: parent
- visible: true
- source: "qrc:/png/title_expire.png"
- fillMode: Image.PreserveAspectFit
- }
- MouseArea {
- anchors.fill: parent // 让MouseArea覆盖整个Image区域
- onClicked: {
- model.materialFlag = (model.materialFlag === 2 ? 0 : 2);
- model.materialText = (model.materialFlag === 2 ? "更换" : "")
- }
- }
- }
- // 损坏
- Rectangle {
- id: materialcheckform_rect_damage
- width: 80
- height: parent.height
- color: "#272b7ae9"
- border.color: "#47bfff"
- Image {
- anchors.centerIn: parent
- visible: true
- source: "qrc:/png/title_damage.png"
- fillMode: Image.PreserveAspectFit
- }
- MouseArea {
- anchors.fill: parent // 让MouseArea覆盖整个Image区域
- onClicked: {
- model.materialFlag = (model.materialFlag === 3 ? 0 : 3);
- model.materialText = (model.materialFlag === 3 ? "更换或维修" : "")
- }
- }
- }
- // 措施
- Rectangle {
- width: 230
- height: parent.height
- color: "#272b7ae9"
- border.color: "#47bfff"
- clip: true
- Text {
- anchors.centerIn: parent
- font.pixelSize: 20
- color: "#d7d7d2"
- font.bold: true
- text: model.materialText
- wrapMode: Text.WordWrap
- }
- }
- }
- }
- }
- }
- // 检查标准
- Rectangle {
- x: 1140
- y: 0
- width: 460
- height: 800
- color: "#272b7ae9"
- radius: 20
- //
- Column {
- anchors.fill: parent
- spacing: 0
- //
- Row {
- id: materialcheckform_header_standard
- width: parent.width
- height: 100
- spacing: 0
- // 编号
- Rectangle {
- width: 460
- height: parent.height
- color: "#33ffffff"
- border.color: "#47bfff"
- Text {
- anchors.centerIn: parent
- text: "检查标准"
- font.pixelSize: 25
- color: "#d7d7d2"
- font.bold: true
- }
- }
- }
- // 表格内容
- ListView {
- width: parent.width
- height: parent.height - materialcheckform_header_standard.height
- clip: true
- model: materialcheckform_tableModel_standard
- delegate: Row {
- id: materialcheckform_content_row;
- width: parent.width
- spacing: 0
- // 文本内容
- Rectangle {
- width: parent.width
- height: parent.height
- color: "#272b7ae9"
- border.color: "#47bfff"
- ToolButton
- {
- id : materialcheckform_content_head
- anchors.centerIn: parent
- enabled: false // 不可点击
- display: AbstractButton.TextBesideIcon // 文字在图标旁边
- icon.source: model.standardIcon
- icon.width: 45
- icon.height: 37
- text: model.standardType
- palette.buttonText: "#d7d7d2"
- font {
- pixelSize: 30
- }
- }
- Text {
- id : materialcheckform_content_text
- width: parent.width;
- anchors.centerIn: parent
- font.pixelSize: 20
- color: "#d7d7d2"
- font.bold: true
- wrapMode: Text.WordWrap
- text: model.standardText
- }
- Component.onCompleted: {
- if (model.standardHead)
- {
- materialcheckform_content_row.height = 100;
- materialcheckform_content_head.visible = true;
- materialcheckform_content_text.visible = false;
- }
- else
- {
- materialcheckform_content_row.height =
- materialcheckform_content_text.implicitHeight;
- materialcheckform_content_head.visible = false;
- materialcheckform_content_text.visible = true;
- }
- }
- }
- }
- }
- }
- }
- }
- function slot_getMaterialCheckForm(data)
- {
- slot_postSaveForm(data);
- strMaterialCheckFormGet = data;
- materialcheckform_tableModel.clear();
- materialcheckform_tableModel_standard.clear();
- var jsonObjRoot = JSON.parse(data);
- if (jsonObjRoot.code === 200)
- {
- var jsonObjData = jsonObjRoot.data;
- // 物资检查列表
- var jsonArrList = jsonObjData.list;
- for (var i = 0; i < jsonArrList.length; ++i)
- {
- var jsonObjList = jsonArrList[i];
- var materialCode = jsonObjList.materialsId;
- var materialType = jsonObjList.materialsTypeName;
- var materialIcon = jsonObjList.materialsTypeIcon;
- var materialName = jsonObjList.materialsName;
- var materialRfid = jsonObjList.materialsRfid;
- var materialText = jsonObjList.measure;
- materialRfid = (materialRfid === null ? "" : materialRfid);
- materialText = (materialText === null ? "" : materialText);
- var materialFlag = 0;
- if(jsonObjList.status === "0")
- {
- materialFlag = 1;
- }
- else if (jsonObjList.status === "1")
- {
- if (jsonObjList.reason === "2")
- {
- materialFlag = 2;
- }
- else if (jsonObjList.reason === "1")
- {
- materialFlag = 3;
- }
- }
- materialcheckform_tableModel.append({
- materialFlag: materialFlag,
- materialCode: materialCode,
- materialType: materialType,
- materialIcon: materialIcon,
- materialName: materialName,
- materialRfid: materialRfid,
- materialText: materialText,
- materialJson: jsonObjList,
- });
- }
- // 物资检查标准
- var jsonArrStandards = jsonObjData.standards;
- for (var j = 0; j < jsonArrStandards.length; ++j)
- {
- var jsonObjStandard = jsonArrStandards[j];
- var standardType = jsonObjStandard.materialsTypeName;
- var standardIcon = jsonObjStandard.materialsTypeIcon;
- var standardText = jsonObjStandard.checkStandard;
- materialcheckform_tableModel_standard.append({
- standardHead: true,
- standardType: standardType,
- standardIcon: standardIcon,
- });
- materialcheckform_tableModel_standard.append({
- standardHead: false,
- standardText: standardText,
- });
- }
- }
- build_model_view()
- waitPromptBox.hide();
- }
- function build_model_view()
- {
- var iWait = 0;
- var iNormal = 0;
- var iExpire = 0;
- var iDamage = 0;
- for (var i = 0; i < materialcheckform_tableModel.count; i++)
- {
- var item = materialcheckform_tableModel.get(i);
- switch (item.materialFlag)
- {
- case 0: iWait++; break;
- case 1: iNormal++; break;
- case 2: iExpire++; break;
- case 3: iDamage++; break;
- }
- }
- materialcheckform_text_wait_check.text = "待检查:" + iWait
- materialcheckform_text_normal_check.text = "正常:" + iNormal
- materialcheckform_text_expire_check.text = "过期:" + iExpire
- materialcheckform_text_damage_check.text = "损坏:" + iDamage
- }
- function show_dialog()
- {
- var iWait = 0;
- for (var i = 0; i < materialcheckform_tableModel.count; i++)
- {
- var item = materialcheckform_tableModel.get(i);
- switch (item.materialFlag)
- {
- case 0: iWait++; break;
- }
- }
- if (iWait > 0)
- {
- materialcheckform_text_dialog_prompt.text = "保存成功,还有" + iWait + "件物资待检查";
- materialcheckform_dialog_confirm_prompt.open();
- }
- else
- {
- materialcheckform_text_dialog_prompt.text = "保存成功,没有物资待检查";
- materialcheckform_dialog_confirm_prompt.open();
- }
- }
- // 返回检查结果
- function save_check_result()
- {
- var jsonObjRoot = {};
- var jsonArrList = [];
- for (var i = 0; i < materialcheckform_tableModel.count; i++)
- {
- var item = materialcheckform_tableModel.get(i);
- var jsonObjList = item.materialJson;
- if (item.materialFlag === 0)
- {
- jsonObjList["status"] = "";
- jsonObjList["reason"] = "";
- }
- else if (item.materialFlag === 1)
- {
- jsonObjList["status"] = "0";
- jsonObjList["reason"] = "";
- }
- else if (item.materialFlag === 2)
- {
- jsonObjList["status"] = "1";
- jsonObjList["reason"] = "2";
- }
- else if (item.materialFlag === 3)
- {
- jsonObjList["status"] = "1";
- jsonObjList["reason"] = "1";
- }
- jsonArrList.push(jsonObjList);
- }
- jsonObjRoot["list"] = jsonArrList;
- var strJson = JSON.stringify(jsonObjRoot);
- console.log(jsonObjRoot);
- signal_postSaveForm(strJson);
- }
- function slot_postSaveForm(data)
- {
- var jsonObjRoot = JSON.parse(data);
- if (jsonObjRoot.code === 200)
- {
- // materialcheckform_prompt_info.promptInfoTimeout = 3;
- // materialcheckform_prompt_info.promptInfoText = jsonObjRoot.msg;
- // materialcheckform_prompt_info.promptInfoIcon = "qrc:/png/error.png"
- // materialcheckform_prompt_info.promptInfoColor = "#6600ff00"
- }
- else
- {
- materialcheckform_prompt_info.promptInfoTimeout = 3;
- materialcheckform_prompt_info.promptInfoText = jsonObjRoot.msg;
- materialcheckform_prompt_info.promptInfoIcon = "qrc:/png/error.png"
- materialcheckform_prompt_info.promptInfoColor = "#66ea3a0e"
- }
- }
- }
|